bsp: cvitek: Add support for duos_sd

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 <1468559561@qq.com>
This commit is contained in:
Shicheng Chu 2024-08-27 10:17:21 +08:00 committed by Meco Man
parent 669a6822e7
commit 66738d71da
11 changed files with 148 additions and 7 deletions

View File

@ -24,7 +24,8 @@
支持开发板以及集成 SoC 芯片信息如下 支持开发板以及集成 SoC 芯片信息如下
- milk-v duo: [https://milkv.io/duo](https://milkv.io/duo)SoC 采用 CV1800B。 - 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 系列芯片。芯片的工作模式总结如下: Duo 家族开发板采用 CV18xx 系列芯片。芯片的工作模式总结如下:
@ -109,6 +110,7 @@ Board Type (milkv-duo) --->
( ) milkv-duo-spinor ( ) milkv-duo-spinor
(X) milkv-duo256m (X) milkv-duo256m
( ) milkv-duo256m-spinor ( ) milkv-duo256m-spinor
( ) milkv-duos
``` ```
2. 编译 2. 编译

View File

@ -2,9 +2,9 @@
function get_board_type() 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_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") 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") STORAGE_VAUE=("sd" "spinor" "spinand" "sd" "spinor" "spinand" "sd")
for ((i=0;i<${#BOARD_CONFIG[@]};i++)) for ((i=0;i<${#BOARD_CONFIG[@]};i++))
do do

View File

@ -42,6 +42,10 @@ config SOC_TYPE_CV180X
bool bool
default n default n
config SOC_TYPE_SG2000
bool
default n
config SOC_TYPE_SG2002 config SOC_TYPE_SG2002
bool bool
default n default n
@ -66,4 +70,8 @@ choice
select SOC_TYPE_SG2002 select SOC_TYPE_SG2002
bool "milkv-duo256m-spinor" bool "milkv-duo256m-spinor"
config BOARD_TYPE_MILKV_DUOS
select SOC_TYPE_SG2000
bool "milkv-duos"
endchoice endchoice

View File

@ -34,7 +34,7 @@ objs = PrepareBuilding(env, RTT_ROOT, has_libcpu = False)
# include libraries # include libraries
objs.extend(SConscript(drivers_path_prefix + '/SConscript', variant_dir='build/drivers', duplicate=0)) 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('cv180x_lscript.ld', 'cv181x_lscript.ld')
env['LINKFLAGS'] = env['LINKFLAGS'].replace('-L board/script/cv180x', '-L board/script/cv181x') env['LINKFLAGS'] = env['LINKFLAGS'].replace('-L board/script/cv180x', '-L board/script/cv181x')

View File

@ -48,6 +48,10 @@ config SOC_TYPE_CV180X
bool bool
default n default n
config SOC_TYPE_SG2000
bool
default n
config SOC_TYPE_SG2002 config SOC_TYPE_SG2002
bool bool
default n default n
@ -72,6 +76,10 @@ choice
select SOC_TYPE_SG2002 select SOC_TYPE_SG2002
bool "milkv-duo256m-spinor" bool "milkv-duo256m-spinor"
config BOARD_TYPE_MILKV_DUOS
select SOC_TYPE_SG2000
bool "milkv-duos"
endchoice endchoice
choice BSP_ROOTFS_TYPE choice BSP_ROOTFS_TYPE

View File

@ -16,6 +16,8 @@
#define LED_PIN "E02" /* Onboard LED pins */ #define LED_PIN "E02" /* Onboard LED pins */
#elif defined(BOARD_TYPE_MILKV_DUO) || defined(BOARD_TYPE_MILKV_DUO_SPINOR) #elif defined(BOARD_TYPE_MILKV_DUO) || defined(BOARD_TYPE_MILKV_DUO_SPINOR)
#define LED_PIN "C24" /* Onboard LED pins */ #define LED_PIN "C24" /* Onboard LED pins */
#elif defined(BOARD_TYPE_MILKV_DUOS)
#define LED_PIN "A29" /* Onboard LED pins */
#endif #endif
int main(void) int main(void)

View File

@ -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";
};
};
};

View File

@ -12,7 +12,7 @@ CPPDEFINES = []
CPPPATH = [cwd] CPPPATH = [cwd]
CHIP_TYPE = 'cv180x' 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' CHIP_TYPE = 'cv181x'
elif GetDepend('BOARD_TYPE_MILKV_DUO') or GetDepend('BOARD_TYPE_MILKV_DUO_SPINOR') or GetDepend('BOARD_TYPE_MILKV_DUO_SPINAND'): elif GetDepend('BOARD_TYPE_MILKV_DUO') or GetDepend('BOARD_TYPE_MILKV_DUO_SPINOR') or GetDepend('BOARD_TYPE_MILKV_DUO_SPINAND'):
CHIP_TYPE = 'cv180x' CHIP_TYPE = 'cv180x'

View File

@ -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}, /* 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[] = { struct fmux pinmux_array[] = {
FS_PINMUX(CAM_MCLK0), FS_PINMUX(CAM_MCLK0),

View File

@ -357,6 +357,71 @@ static const char *pinname_whitelist_uart4_tx[] = {
}; };
#endif #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 #else
#error "Unsupported board type!" #error "Unsupported board type!"
#endif #endif