Skip to content

Commit a6c8fe9

Browse files
authored
Merge pull request #53 from YuzukiHD/dev
add yuzukihomekit, add sdhci_type_t to indi sdhci_type_t, rproc fix sram_remap_set
2 parents 35d3a31 + 47ae72d commit a6c8fe9

File tree

16 files changed

+1185
-21
lines changed

16 files changed

+1185
-21
lines changed

board/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,8 @@ endif()
4040

4141
if(CONFIG_BOARD_100ASK_D1_H)
4242
add_subdirectory(100ask-d1-h)
43+
endif()
44+
45+
if(CONFIG_BOARD_YUZUKIHOMEKIT)
46+
add_subdirectory(yuzukihomekit)
4347
endif()

board/longanpi-4b/board.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ sunxi_serial_t uart_dbg = {
2727
.gpio_rx = {GPIO_PIN(GPIO_PORTB, 10), GPIO_PERIPH_MUX2},
2828
};
2929

30-
sunxi_serial_t uart_dbg_15m = {
30+
sunxi_serial_t uart_dbg_1m5 = {
3131
.base = SUNXI_UART0_BASE,
3232
.id = 0,
3333
.baud_rate = UART_BAUDRATE_1500000,
@@ -57,6 +57,7 @@ sdhci_t sdhci0 = {
5757
.voltage = MMC_VDD_27_36,
5858
.width = MMC_BUS_WIDTH_4,
5959
.clock = MMC_CLK_100M,
60+
.sdio_type = SDHCI_TYPE_SD,
6061
.removable = 0,
6162
.isspi = FALSE,
6263
.skew_auto_mode = TRUE,
@@ -76,6 +77,7 @@ sdhci_t sdhci2 = {
7677
.voltage = MMC_VDD_27_36,
7778
.width = MMC_BUS_WIDTH_4,
7879
.clock = MMC_CLK_50M,
80+
.sdio_type = SDHCI_TYPE_MMC,
7981
.removable = 0,
8082
.isspi = FALSE,
8183
.skew_auto_mode = TRUE,

board/longanpi-4b/extlinux_boot/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ static int fdt_pack_reg(const void *fdt, void *buf, uint64_t address, uint64_t s
304304
return p - (char *) buf;
305305
}
306306

307-
int update_pmu_ext_info_dtb(image_info_t *image) {
307+
static int update_pmu_ext_info_dtb(image_info_t *image) {
308308
int nodeoffset, pmu_ext_type, err, i;
309309
uint32_t phandle = 0;
310310

board/yuzukihomekit/CMakeLists.txt

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
set(APP_COMMON_SOURCE
2+
${CMAKE_CURRENT_SOURCE_DIR}/start.S
3+
${CMAKE_CURRENT_SOURCE_DIR}/board.c
4+
${CMAKE_CURRENT_SOURCE_DIR}/eabi_compat.c
5+
${CMAKE_CURRENT_SOURCE_DIR}/head.c
6+
)
7+
8+
add_subdirectory(syter_boot)

board/yuzukihomekit/README.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# SyterKit Common
2+
3+
## start.S
4+
5+
This code snippet is an ARM assembly language program that includes initialization settings and exception handlers. Here's a breakdown of its functionalities:
6+
7+
1. Initialization Settings: It sets registers and writes specific values to configure the processor's working mode, interrupt enable, etc.
8+
9+
2. Set Vector Table: It writes the address of the vector table to the Vector Base Address Register, which is used for handling exceptions and interrupts.
10+
11+
3. Enable NEON/VFP Unit: It configures the processor to enable the NEON (Advanced SIMD) and VFP (Floating-Point) units.
12+
13+
4. Clear BSS Section: It zeroes out variables in the BSS section.
14+
15+
5. Disable Interrupts: It disables FIQ and IRQ interrupts and switches the processor to SVC32 mode.
16+
17+
6. Set Timer Frequency: It sets the timer frequency to 24M.
18+
19+
7. Call the main Function: It jumps to the main function to execute the main logic.
20+
21+
## eabi_compat.c
22+
23+
This code snippet appears to be providing implementations for the functions `abort`, `raise`, and `__aeabi_unwind_cpp_pr0`. Here's a breakdown of their functionalities:
24+
25+
1. `void abort(void)`: This function creates an infinite loop, causing the program to hang indefinitely. It is typically used to indicate a critical error or unrecoverable condition in a program.
26+
27+
2. `int raise(int signum)`: This function is a placeholder and always returns 0. In standard C, this function is used to raise a signal and initiate the corresponding signal handler. However, in this implementation, it does nothing and simply returns 0.
28+
29+
3. `void __aeabi_unwind_cpp_pr0(void)`: This is a dummy function that serves as a placeholder to avoid linker complaints. Its purpose is to satisfy the linker when using C++ exceptions and unwinding, but it does not contain any actual functionality.

board/yuzukihomekit/board.c

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
#include <stdbool.h>
2+
#include <stddef.h>
3+
#include <stdint.h>
4+
#include <types.h>
5+
6+
#include <log.h>
7+
8+
#include <common.h>
9+
10+
#include <sys-clk.h>
11+
#include <reg-ncat.h>
12+
13+
#include <mmu.h>
14+
15+
#include <sys-gpio.h>
16+
#include <sys-spi.h>
17+
#include <sys-uart.h>
18+
#include <sys-dram.h>
19+
#include <sys-sdcard.h>
20+
21+
sunxi_serial_t uart_dbg = {
22+
.base = SUNXI_UART3_BASE,
23+
.id = 3,
24+
.gpio_tx = {GPIO_PIN(GPIO_PORTB, 6), GPIO_PERIPH_MUX7},
25+
.gpio_rx = {GPIO_PIN(GPIO_PORTB, 7), GPIO_PERIPH_MUX7},
26+
};
27+
28+
sunxi_spi_t sunxi_spi0 = {
29+
.base = SUNXI_SPI0_BASE,
30+
.id = 0,
31+
.clk_rate = 75 * 1000 * 1000,
32+
.gpio_cs = {GPIO_PIN(GPIO_PORTC, 1), GPIO_PERIPH_MUX4},
33+
.gpio_sck = {GPIO_PIN(GPIO_PORTC, 0), GPIO_PERIPH_MUX4},
34+
.gpio_mosi = {GPIO_PIN(GPIO_PORTC, 2), GPIO_PERIPH_MUX4},
35+
.gpio_miso = {GPIO_PIN(GPIO_PORTC, 3), GPIO_PERIPH_MUX4},
36+
.gpio_wp = {GPIO_PIN(GPIO_PORTC, 4), GPIO_PERIPH_MUX4},
37+
.gpio_hold = {GPIO_PIN(GPIO_PORTC, 5), GPIO_PERIPH_MUX4},
38+
};
39+
40+
sdhci_t sdhci0 = {
41+
.name = "sdhci0",
42+
.id = 0,
43+
.reg = (sdhci_reg_t *) 0x04020000,
44+
.voltage = MMC_VDD_27_36,
45+
.width = MMC_BUS_WIDTH_4,
46+
.clock = MMC_CLK_50M,
47+
.removable = 0,
48+
.isspi = FALSE,
49+
.skew_auto_mode = TRUE,
50+
.sdhci_pll = CCU_MMC_CTRL_PLL_PERIPH1X,
51+
.gpio_clk = {GPIO_PIN(GPIO_PORTF, 2), GPIO_PERIPH_MUX2},
52+
.gpio_cmd = {GPIO_PIN(GPIO_PORTF, 3), GPIO_PERIPH_MUX2},
53+
.gpio_d0 = {GPIO_PIN(GPIO_PORTF, 1), GPIO_PERIPH_MUX2},
54+
.gpio_d1 = {GPIO_PIN(GPIO_PORTF, 0), GPIO_PERIPH_MUX2},
55+
.gpio_d2 = {GPIO_PIN(GPIO_PORTF, 5), GPIO_PERIPH_MUX2},
56+
.gpio_d3 = {GPIO_PIN(GPIO_PORTF, 4), GPIO_PERIPH_MUX2},
57+
};
58+
59+
dram_para_t dram_para = {
60+
.dram_clk = 792,
61+
.dram_type = 3,
62+
.dram_zq = 0x7b7bfb,
63+
.dram_odt_en = 0x00,
64+
.dram_para1 = 0x000010d2,
65+
.dram_para2 = 0,
66+
.dram_mr0 = 0x1c70,
67+
.dram_mr1 = 0x42,
68+
.dram_mr2 = 0x18,
69+
.dram_mr3 = 0,
70+
.dram_tpr0 = 0x004a2195,
71+
.dram_tpr1 = 0x02423190,
72+
.dram_tpr2 = 0x0008b061,
73+
.dram_tpr3 = 0xb4787896,// unused
74+
.dram_tpr4 = 0,
75+
.dram_tpr5 = 0x48484848,
76+
.dram_tpr6 = 0x00000048,
77+
.dram_tpr7 = 0x1620121e,// unused
78+
.dram_tpr8 = 0,
79+
.dram_tpr9 = 0,// clock?
80+
.dram_tpr10 = 0,
81+
.dram_tpr11 = 0x00340000,
82+
.dram_tpr12 = 0x00000046,
83+
.dram_tpr13 = 0x34000100,
84+
};
85+
86+
void clean_syterkit_data(void) {
87+
/* Disable MMU, data cache, instruction cache, interrupts */
88+
arm32_mmu_disable();
89+
printk(LOG_LEVEL_INFO, "disable mmu ok...\n");
90+
arm32_dcache_disable();
91+
printk(LOG_LEVEL_INFO, "disable dcache ok...\n");
92+
arm32_icache_disable();
93+
printk(LOG_LEVEL_INFO, "disable icache ok...\n");
94+
arm32_interrupt_disable();
95+
printk(LOG_LEVEL_INFO, "free interrupt ok...\n");
96+
}

board/yuzukihomekit/eabi_compat.c

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* SPDX-License-Identifier: Apache-2.0 */
2+
3+
void abort(void) {
4+
while (1)
5+
;
6+
}
7+
8+
int raise(int signum) {
9+
return 0;
10+
}
11+
12+
/* Dummy function to avoid linker complaints */
13+
void __aeabi_unwind_cpp_pr0(void) {
14+
}

board/yuzukihomekit/head.c

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#include <stdbool.h>
2+
#include <stddef.h>
3+
#include <stdint.h>
4+
#include <types.h>
5+
6+
typedef struct boot_file_head {
7+
uint32_t jump_instruction; /* one intruction jumping to real code */
8+
uint8_t magic[8]; /* ="eGON.BT0" */
9+
uint32_t check_sum; /* generated by PC */
10+
uint32_t *length; /* generated by LD */
11+
uint32_t pub_head_size; /* the size of boot_file_head_t */
12+
uint8_t pub_head_vsn[4]; /* the version of boot_file_head_t */
13+
uint32_t *ret_addr; /* the return value */
14+
uint32_t *run_addr; /* run addr */
15+
uint32_t boot_cpu; /* eGON version */
16+
uint8_t platform[8]; /* platform information */
17+
} boot_file_head_t;
18+
19+
#define BROM_FILE_HEAD_SIZE_OFFSET (((sizeof(boot_file_head_t) + sizeof(int)) / sizeof(int) + 1))
20+
#define JUMP_INSTRUCTION (BROM_FILE_HEAD_SIZE_OFFSET | 0xEA000000)
21+
22+
#define BOOT0_MAGIC "eGON.BT0"
23+
#define STAMP_VALUE (0x12345678)
24+
#define BOOT_PUB_HEAD_VERSION "3000"
25+
26+
extern uint32_t __spl_size[];
27+
extern uint32_t __code_start_address[];
28+
29+
const __attribute__((section(".boot0_head"))) boot_file_head_t boot_head = {
30+
.jump_instruction = JUMP_INSTRUCTION,
31+
.magic = BOOT0_MAGIC,
32+
.check_sum = STAMP_VALUE,
33+
.length = __spl_size,
34+
.pub_head_size = sizeof(boot_file_head_t),
35+
.pub_head_vsn = BOOT_PUB_HEAD_VERSION,
36+
.ret_addr = __code_start_address,
37+
.run_addr = __code_start_address,
38+
.boot_cpu = 0,
39+
.platform = {0, 0, '3', '.', '0', '.', '0', 0},
40+
};

0 commit comments

Comments
 (0)