diff mbox series

[1/4] riscv: sophgo: milkv_duo: initial support added

Message ID 20240107112713.61966-2-seashell11234455@gmail.com
State Changes Requested
Delegated to: Andes
Headers show
Series riscv: sophgo: milkv_duo: add support for Milk-V Duo board | expand

Commit Message

Kongyang Liu Jan. 7, 2024, 11:27 a.m. UTC
Add support for Sophgo's Milk-V Duo board, only minimal device tree and
serial console are enabled, and it can boot via vendor first stage
bootloader.

Signed-off-by: Kongyang Liu <seashell11234455@gmail.com>

---

 arch/riscv/Kconfig                 |  4 ++++
 board/sophgo/milkv_duo/Kconfig     | 28 ++++++++++++++++++++++++++++
 board/sophgo/milkv_duo/MAINTAINERS |  6 ++++++
 board/sophgo/milkv_duo/Makefile    |  5 +++++
 board/sophgo/milkv_duo/board.c     |  9 +++++++++
 include/configs/milkv_duo.h        | 16 ++++++++++++++++
 6 files changed, 68 insertions(+)
 create mode 100644 board/sophgo/milkv_duo/Kconfig
 create mode 100644 board/sophgo/milkv_duo/MAINTAINERS
 create mode 100644 board/sophgo/milkv_duo/Makefile
 create mode 100644 board/sophgo/milkv_duo/board.c
 create mode 100644 include/configs/milkv_duo.h

Comments

Tom Rini Jan. 8, 2024, 8:42 p.m. UTC | #1
On Sun, Jan 07, 2024 at 07:27:07PM +0800, Kongyang Liu wrote:

> Add support for Sophgo's Milk-V Duo board, only minimal device tree and
> serial console are enabled, and it can boot via vendor first stage
> bootloader.
> 
> Signed-off-by: Kongyang Liu <seashell11234455@gmail.com>
> 
> ---
> 
>  arch/riscv/Kconfig                 |  4 ++++
>  board/sophgo/milkv_duo/Kconfig     | 28 ++++++++++++++++++++++++++++
>  board/sophgo/milkv_duo/MAINTAINERS |  6 ++++++
>  board/sophgo/milkv_duo/Makefile    |  5 +++++
>  board/sophgo/milkv_duo/board.c     |  9 +++++++++
>  include/configs/milkv_duo.h        | 16 ++++++++++++++++

The defconfig patch should be folded in to this one.

[snip]
> diff --git a/board/sophgo/milkv_duo/board.c b/board/sophgo/milkv_duo/board.c
> new file mode 100644
> index 0000000000..eaa47be173
> --- /dev/null
> +++ b/board/sophgo/milkv_duo/board.c
> @@ -0,0 +1,9 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (c) 2024, Kongyang Liu <seashell11234455@gmail.com>
> + */
> +
> +int board_init(void)
> +{
> +	return 0;
> +}

Shouldn't you enable caches here?

> diff --git a/include/configs/milkv_duo.h b/include/configs/milkv_duo.h
> new file mode 100644
> index 0000000000..dd1d146c50
> --- /dev/null
> +++ b/include/configs/milkv_duo.h
> @@ -0,0 +1,16 @@
> +/* SPDX-License-Identifier: GPL-2.0+ */
> +/*
> + * Copyright (c) 2024, Kongyang Liu <seashell11234455@gmail.com>
> + *
> + */
> +
> +#ifndef __CONFIG_H
> +#define __CONFIG_H
> +
> +#define CFG_SYS_SDRAM_BASE         0x80000000
> +
> +#define CFG_EXTRA_ENV_SETTINGS                 \
> +	"consoledev=ttyS0"                         \
> +	"baudrate=115200\0"                        \

We shouldn't need to set baudrate, it will be handled for us. Is
consoledev something that must be set? Can it all be done in a plain
text environment anyhow? Thanks.
Kongyang Liu Jan. 11, 2024, 5:32 p.m. UTC | #2
Tom Rini <trini@konsulko.com> 于2024年1月9日周二 04:42写道:
>
> On Sun, Jan 07, 2024 at 07:27:07PM +0800, Kongyang Liu wrote:
>
> > Add support for Sophgo's Milk-V Duo board, only minimal device tree and
> > serial console are enabled, and it can boot via vendor first stage
> > bootloader.
> >
> > Signed-off-by: Kongyang Liu <seashell11234455@gmail.com>
> >
> > ---
> >
> >  arch/riscv/Kconfig                 |  4 ++++
> >  board/sophgo/milkv_duo/Kconfig     | 28 ++++++++++++++++++++++++++++
> >  board/sophgo/milkv_duo/MAINTAINERS |  6 ++++++
> >  board/sophgo/milkv_duo/Makefile    |  5 +++++
> >  board/sophgo/milkv_duo/board.c     |  9 +++++++++
> >  include/configs/milkv_duo.h        | 16 ++++++++++++++++
>
> The defconfig patch should be folded in to this one.
>
I will fold it in next version.

> [snip]
> > diff --git a/board/sophgo/milkv_duo/board.c b/board/sophgo/milkv_duo/board.c
> > new file mode 100644
> > index 0000000000..eaa47be173
> > --- /dev/null
> > +++ b/board/sophgo/milkv_duo/board.c
> > @@ -0,0 +1,9 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +/*
> > + * Copyright (c) 2024, Kongyang Liu <seashell11234455@gmail.com>
> > + */
> > +
> > +int board_init(void)
> > +{
> > +     return 0;
> > +}
>
> Shouldn't you enable caches here?
>
Enable caches will cause other problems, and I will implement it
in subsequent patches.

> > diff --git a/include/configs/milkv_duo.h b/include/configs/milkv_duo.h
> > new file mode 100644
> > index 0000000000..dd1d146c50
> > --- /dev/null
> > +++ b/include/configs/milkv_duo.h
> > @@ -0,0 +1,16 @@
> > +/* SPDX-License-Identifier: GPL-2.0+ */
> > +/*
> > + * Copyright (c) 2024, Kongyang Liu <seashell11234455@gmail.com>
> > + *
> > + */
> > +
> > +#ifndef __CONFIG_H
> > +#define __CONFIG_H
> > +
> > +#define CFG_SYS_SDRAM_BASE         0x80000000
> > +
> > +#define CFG_EXTRA_ENV_SETTINGS                 \
> > +     "consoledev=ttyS0"                         \
> > +     "baudrate=115200\0"                        \
>
> We shouldn't need to set baudrate, it will be handled for us. Is
> consoledev something that must be set? Can it all be done in a plain
> text environment anyhow? Thanks.
>
I will check and detele it if it is unnecessary.

Best regards
Kongyang Liu
> --
> Tom
diff mbox series

Patch

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 6d0d812ddb..de99ce3a28 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -14,6 +14,9 @@  config TARGET_ANDES_AE350
 config TARGET_MICROCHIP_ICICLE
 	bool "Support Microchip PolarFire-SoC Icicle Board"
 
+config TARGET_MILKV_DUO
+	bool "Support Milk-v Duo Board"
+
 config TARGET_OPENPITON_RISCV64
 	bool "Support RISC-V cores on OpenPiton SoC"
 
@@ -80,6 +83,7 @@  source "board/openpiton/riscv64/Kconfig"
 source "board/sifive/unleashed/Kconfig"
 source "board/sifive/unmatched/Kconfig"
 source "board/sipeed/maix/Kconfig"
+source "board/sophgo/milkv_duo/Kconfig"
 source "board/starfive/visionfive2/Kconfig"
 source "board/thead/th1520_lpi4a/Kconfig"
 
diff --git a/board/sophgo/milkv_duo/Kconfig b/board/sophgo/milkv_duo/Kconfig
new file mode 100644
index 0000000000..2a458f291c
--- /dev/null
+++ b/board/sophgo/milkv_duo/Kconfig
@@ -0,0 +1,28 @@ 
+if TARGET_MILKV_DUO
+
+config SYS_BOARD
+	default "milkv_duo"
+
+config SYS_VENDOR
+	default "sophgo"
+
+config SYS_CPU
+	default "generic"
+
+config SYS_CONFIG_NAME
+	default "milkv_duo"
+
+config TEXT_BASE
+	default 0x80200000
+
+config ENV_SIZE
+	default 0x20000
+
+config ENV_SECT_SIZE
+	default 0x40000
+
+config BOARD_SPECIFIC_OPTIONS
+	def_bool y
+	select GENERIC_RISCV
+
+endif
diff --git a/board/sophgo/milkv_duo/MAINTAINERS b/board/sophgo/milkv_duo/MAINTAINERS
new file mode 100644
index 0000000000..651a0592f7
--- /dev/null
+++ b/board/sophgo/milkv_duo/MAINTAINERS
@@ -0,0 +1,6 @@ 
+Milk-V Duo
+M:	Kongyang Liu <seashell11234455@gmail.com>
+S:	Maintained
+F:	board/sophgo/milkv_duo/
+F:	configs/milkv_duo_defconfig
+F:	doc/board/sophgo/milkv_duo.rst
diff --git a/board/sophgo/milkv_duo/Makefile b/board/sophgo/milkv_duo/Makefile
new file mode 100644
index 0000000000..a087013f5c
--- /dev/null
+++ b/board/sophgo/milkv_duo/Makefile
@@ -0,0 +1,5 @@ 
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (c) 2024, Kongyang Liu <seashell11234455@gmail.com>
+
+obj-y := board.o
diff --git a/board/sophgo/milkv_duo/board.c b/board/sophgo/milkv_duo/board.c
new file mode 100644
index 0000000000..eaa47be173
--- /dev/null
+++ b/board/sophgo/milkv_duo/board.c
@@ -0,0 +1,9 @@ 
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2024, Kongyang Liu <seashell11234455@gmail.com>
+ */
+
+int board_init(void)
+{
+	return 0;
+}
diff --git a/include/configs/milkv_duo.h b/include/configs/milkv_duo.h
new file mode 100644
index 0000000000..dd1d146c50
--- /dev/null
+++ b/include/configs/milkv_duo.h
@@ -0,0 +1,16 @@ 
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (c) 2024, Kongyang Liu <seashell11234455@gmail.com>
+ *
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#define CFG_SYS_SDRAM_BASE         0x80000000
+
+#define CFG_EXTRA_ENV_SETTINGS                 \
+	"consoledev=ttyS0"                         \
+	"baudrate=115200\0"                        \
+
+#endif /* __CONFIG_H */