Skip to content

Commit

Permalink
bsp: cvitek: Add support for duos_sd
Browse files Browse the repository at this point in the history
Supports both big and little cores of RISC-V C906,
but does not support ARM cores. Currently, only UART
drivers are supported on the peripherals.

Signed-off-by: Shicheng Chu <[email protected]>
  • Loading branch information
Z8MAN8 authored and mysterywolf committed Aug 27, 2024
1 parent 669a682 commit 66738d7
Show file tree
Hide file tree
Showing 11 changed files with 148 additions and 7 deletions.
4 changes: 3 additions & 1 deletion bsp/cvitek/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
支持开发板以及集成 SoC 芯片信息如下

- milk-v duo: [https://milkv.io/duo](https://milkv.io/duo),SoC 采用 CV1800B。
- milk-v duo256m: [https://milkv.io/duo256m](https://milkv.io/docs/duo/getting-started/duo256m),SoC 采用 SG2002。
- milk-v duo256m: [https://milkv.io/duo256m](https://milkv.io/docs/duo/getting-started/duo256m),SoC 采用 SG2002(原 CV181xC)。
- milk-v duos: [https://milkv.io/duos](https://milkv.io/docs/duo/getting-started/duos),SoC 采用 SG2000(原 CV181xH)。

Duo 家族开发板采用 CV18xx 系列芯片。芯片的工作模式总结如下:

Expand Down Expand Up @@ -109,6 +110,7 @@ Board Type (milkv-duo) --->
( ) milkv-duo-spinor
(X) milkv-duo256m
( ) milkv-duo256m-spinor
( ) milkv-duos
```

2. 编译
Expand Down
6 changes: 3 additions & 3 deletions bsp/cvitek/board_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

function get_board_type()
{
BOARD_CONFIG=("CONFIG_BOARD_TYPE_MILKV_DUO" "CONFIG_BOARD_TYPE_MILKV_DUO_SPINOR" "CONFIG_BOARD_TYPE_MILKV_DUO_SPINAND" "CONFIG_BOARD_TYPE_MILKV_DUO256M" "CONFIG_BOARD_TYPE_MILKV_DUO256M_SPINOR" "CONFIG_BOARD_TYPE_MILKV_DUO256M_SPINAND")
BOARD_VALUE=("milkv-duo" "milkv-duo-spinor" "milkv-duo-spinand" "milkv-duo256m" "milkv-duo256m-spinor" "milkv-duo256m-spinand")
STORAGE_VAUE=("sd" "spinor" "spinand" "sd" "spinor" "spinand")
BOARD_CONFIG=("CONFIG_BOARD_TYPE_MILKV_DUO" "CONFIG_BOARD_TYPE_MILKV_DUO_SPINOR" "CONFIG_BOARD_TYPE_MILKV_DUO_SPINAND" "CONFIG_BOARD_TYPE_MILKV_DUO256M" "CONFIG_BOARD_TYPE_MILKV_DUO256M_SPINOR" "CONFIG_BOARD_TYPE_MILKV_DUO256M_SPINAND" "CONFIG_BOARD_TYPE_MILKV_DUOS")
BOARD_VALUE=("milkv-duo" "milkv-duo-spinor" "milkv-duo-spinand" "milkv-duo256m" "milkv-duo256m-spinor" "milkv-duo256m-spinand" "milkv-duos-sd")
STORAGE_VAUE=("sd" "spinor" "spinand" "sd" "spinor" "spinand" "sd")

for ((i=0;i<${#BOARD_CONFIG[@]};i++))
do
Expand Down
8 changes: 8 additions & 0 deletions bsp/cvitek/c906_little/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ config SOC_TYPE_CV180X
bool
default n

config SOC_TYPE_SG2000
bool
default n

config SOC_TYPE_SG2002
bool
default n
Expand All @@ -66,4 +70,8 @@ choice
select SOC_TYPE_SG2002
bool "milkv-duo256m-spinor"

config BOARD_TYPE_MILKV_DUOS
select SOC_TYPE_SG2000
bool "milkv-duos"

endchoice
2 changes: 1 addition & 1 deletion bsp/cvitek/c906_little/SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ objs = PrepareBuilding(env, RTT_ROOT, has_libcpu = False)
# include libraries
objs.extend(SConscript(drivers_path_prefix + '/SConscript', variant_dir='build/drivers', duplicate=0))

if GetDepend('BOARD_TYPE_MILKV_DUO256M'):
if GetDepend('BOARD_TYPE_MILKV_DUO256M') or GetDepend('BOARD_TYPE_MILKV_DUOS'):
env['LINKFLAGS'] = env['LINKFLAGS'].replace('cv180x_lscript.ld', 'cv181x_lscript.ld')
env['LINKFLAGS'] = env['LINKFLAGS'].replace('-L board/script/cv180x', '-L board/script/cv181x')

Expand Down
8 changes: 8 additions & 0 deletions bsp/cvitek/cv18xx_risc-v/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ config SOC_TYPE_CV180X
bool
default n

config SOC_TYPE_SG2000
bool
default n

config SOC_TYPE_SG2002
bool
default n
Expand All @@ -72,6 +76,10 @@ choice
select SOC_TYPE_SG2002
bool "milkv-duo256m-spinor"

config BOARD_TYPE_MILKV_DUOS
select SOC_TYPE_SG2000
bool "milkv-duos"

endchoice

choice BSP_ROOTFS_TYPE
Expand Down
2 changes: 2 additions & 0 deletions bsp/cvitek/cv18xx_risc-v/applications/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#define LED_PIN "E02" /* Onboard LED pins */
#elif defined(BOARD_TYPE_MILKV_DUO) || defined(BOARD_TYPE_MILKV_DUO_SPINOR)
#define LED_PIN "C24" /* Onboard LED pins */
#elif defined(BOARD_TYPE_MILKV_DUOS)
#define LED_PIN "A29" /* Onboard LED pins */
#endif

int main(void)
Expand Down
Binary file not shown.
56 changes: 56 additions & 0 deletions bsp/cvitek/cv18xx_risc-v/dtb/milkv-duos-sd/multi.its
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* U-Boot uImage source file with multiple kernels, ramdisks and FDT blobs
*/

/dts-v1/;

/ {
description = "Various kernels, ramdisks and FDT blobs";
#address-cells = <2>;

images {
kernel-1 {
description = "cvitek kernel";
data = /incbin/("./Image.lzma");
type = "kernel";
arch = "riscv";
os = "linux";
compression = "lzma";
load = <0x0 0x80200000>;
entry = <0x0 0x80200000>;
hash-2 {
algo = "crc32";
};
};


/*FDT*/

fdt-cv1813h_milkv_duos_sd {
description = "cvitek device tree - cv1813h_milkv_duos_sd";
data = /incbin/("./cv1813h_milkv_duos_sd.dtb");
type = "flat_dt";
arch = "riscv";
compression = "none";
hash-1 {
algo = "sha256";
};
};



};

/*CFG*/
configurations {

config-cv1813h_milkv_duos_sd {
description = "boot cvitek system with board cv1813h_milkv_duos_sd";
kernel = "kernel-1";
fdt = "fdt-cv1813h_milkv_duos_sd";
};

};


};
2 changes: 1 addition & 1 deletion bsp/cvitek/drivers/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ CPPDEFINES = []
CPPPATH = [cwd]

CHIP_TYPE = 'cv180x'
if GetDepend('BOARD_TYPE_MILKV_DUO256M') or GetDepend('BOARD_TYPE_MILKV_DUO256M_SPINOR') or GetDepend('BOARD_TYPE_MILKV_DUO256M_SPINAND'):
if GetDepend('BOARD_TYPE_MILKV_DUO256M') or GetDepend('BOARD_TYPE_MILKV_DUO256M_SPINOR') or GetDepend('BOARD_TYPE_MILKV_DUO256M_SPINAND') or GetDepend('BOARD_TYPE_MILKV_DUOS'):
CHIP_TYPE = 'cv181x'
elif GetDepend('BOARD_TYPE_MILKV_DUO') or GetDepend('BOARD_TYPE_MILKV_DUO_SPINOR') or GetDepend('BOARD_TYPE_MILKV_DUO_SPINAND'):
CHIP_TYPE = 'cv180x'
Expand Down
2 changes: 1 addition & 1 deletion bsp/cvitek/drivers/drv_pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ const struct fselect pin_selects_array[][8] = {
/* PAD_AUD_AOUTR */ {FS_NONE, FS_NONE, FS_NONE, {XGPIOC_24, 3}, {IIS1_DI, 4}, {IIS2_DO, 5}, {IIS1_DO, 6}, FS_NONE},
};

#elif defined(SOC_TYPE_SG2002)
#elif defined(SOC_TYPE_SG2002) || defined(SOC_TYPE_SG2000)

struct fmux pinmux_array[] = {
FS_PINMUX(CAM_MCLK0),
Expand Down
65 changes: 65 additions & 0 deletions bsp/cvitek/drivers/drv_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,71 @@ static const char *pinname_whitelist_uart4_tx[] = {
};
#endif

#elif defined(BOARD_TYPE_MILKV_DUOS)

#ifdef BSP_USING_UART0
static const char *pinname_whitelist_uart0_rx[] = {
"UART0_RX",
NULL,
};
static const char *pinname_whitelist_uart0_tx[] = {
"UART0_TX",
NULL,
};
#endif

#ifdef BSP_USING_UART1
static const char *pinname_whitelist_uart1_rx[] = {
"JTAG_CPU_TCK",
"UART0_RX",
NULL,
};
static const char *pinname_whitelist_uart1_tx[] = {
"JTAG_CPU_TMS",
"UART0_TX",
"IIC0_SCL",
NULL,
};
#endif

#ifdef BSP_USING_UART2
static const char *pinname_whitelist_uart2_rx[] = {
"VIVO_D9",
"VIVO_D5",
"VIVO_CLK",
"PWR_GPIO1",
NULL,
};
static const char *pinname_whitelist_uart2_tx[] = {
"VIVO_D10",
"VIVO_D6",
"VIVO_D2",
"IIC0_SCL",
"PWR_GPIO0",
NULL,
};
#endif

#ifdef BSP_USING_UART3
static const char *pinname_whitelist_uart3_rx[] = {
"ADC2",
NULL,
};
static const char *pinname_whitelist_uart3_tx[] = {
"ADC3",
NULL,
};
#endif

#ifdef BSP_USING_UART4
static const char *pinname_whitelist_uart4_rx[] = {
NULL,
};
static const char *pinname_whitelist_uart4_tx[] = {
NULL,
};
#endif

#else
#error "Unsupported board type!"
#endif
Expand Down

0 comments on commit 66738d7

Please sign in to comment.