Message ID | 20200408165802.167546-3-palmer@dabbelt.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/3] RISC-V: Allow device trees to be built into the kernel | expand |
On 2020/04/09 1:58, Palmer Dabbelt wrote: > From: Palmer Dabbelt <palmerdabbelt@google.com> > > The K210's bootloader doesn't provide a device tree, so we must provide > our own. > > FIXME: I don't actually know the unique IDs on the K210. OK. I will test. > > Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com> > --- > arch/riscv/Kconfig.socs | 13 ++++++++++++- > arch/riscv/boot/dts/kendryte/Makefile | 2 +- > arch/riscv/kernel/builtin-dtb-table.c | 5 +++++ > arch/riscv/kernel/builtin-dtb.S | 6 ++++++ > 4 files changed, 24 insertions(+), 2 deletions(-) > > diff --git a/arch/riscv/Kconfig.socs b/arch/riscv/Kconfig.socs > index a843100124ae..49e953f45e1f 100644 > --- a/arch/riscv/Kconfig.socs > +++ b/arch/riscv/Kconfig.socs > @@ -37,11 +37,22 @@ config SOC_VIRT > config SOC_KENDRYTE > bool "Kendryte K210 SoC" > depends on !MMU > - select BUILTIN_DTB Since SOC_KENDRYTE_K210_DTB_BUILTIN depends on BUILTIN_DTB, you need to keep this select, no ? > select SERIAL_SIFIVE if TTY > select SERIAL_SIFIVE_CONSOLE if TTY > select SIFIVE_PLIC > + select SOC_KENDRYTE_K210_DTB_BUILTIN > help > This enables support for Kendryte K210 SoC platform hardware. > > +config SOC_KENDRYTE_K210_DTB > + def_bool y > + depends on OF This one is used only in the makefile. Why not use SOC_KENDRYTE_K210_DTB_BUILTIN directly and drop this SOC_KENDRYTE_K210_DTB ? > + > +config SOC_KENDRYTE_K210_DTB_BUILTIN > + bool "Builtin device tree for the Kendryte K210" > + depends on BUILTIN_DTB > + select SOC_KENDRYTE_K210_DTB > + help > + Builds a device tree for the Kendryte K210 into the Linux image. > + > endmenu > diff --git a/arch/riscv/boot/dts/kendryte/Makefile b/arch/riscv/boot/dts/kendryte/Makefile > index 815444e69e89..01d7eb15673f 100644 > --- a/arch/riscv/boot/dts/kendryte/Makefile > +++ b/arch/riscv/boot/dts/kendryte/Makefile > @@ -1,2 +1,2 @@ > # SPDX-License-Identifier: GPL-2.0 > -dtb-$(CONFIG_SOC_KENDRYTE) += k210.dtb > +dtb-$(CONFIG_SOC_KENDRYTE_K210_DTB) += k210.dtb > diff --git a/arch/riscv/kernel/builtin-dtb-table.c b/arch/riscv/kernel/builtin-dtb-table.c > index 7ad6fe93b8a6..203174ba6f22 100644 > --- a/arch/riscv/kernel/builtin-dtb-table.c > +++ b/arch/riscv/kernel/builtin-dtb-table.c > @@ -4,3 +4,8 @@ > */ > > #include <asm/soc.h> > + > +#ifdef CONFIG_SOC_KENDRYTE_K210_DTB_BUILTIN > +extern void *kendryte_k210_dtb; > +SOC_BUILTIN_DTB_DECLARE(kendryte_k210, 0x0, 0x0, 0x0, kendryte_k210_dtb); > +#endif > diff --git a/arch/riscv/kernel/builtin-dtb.S b/arch/riscv/kernel/builtin-dtb.S > index 3d459ad86948..b0fd5ca231d7 100644 > --- a/arch/riscv/kernel/builtin-dtb.S > +++ b/arch/riscv/kernel/builtin-dtb.S > @@ -1,3 +1,9 @@ > /* SPDX-License-Identifier: GPL-2.0 */ > > .section .dtb.init.rodata,"a" > + > +#ifdef CONFIG_SOC_KENDRYTE_K210_DTB_BUILTIN > +.global kendryte_k210_dtb > +kendryte_k210_dtb: > + .incbin "arch/riscv/boot/dts/kendryte/k210.dtb" > +#endif >
diff --git a/arch/riscv/Kconfig.socs b/arch/riscv/Kconfig.socs index a843100124ae..49e953f45e1f 100644 --- a/arch/riscv/Kconfig.socs +++ b/arch/riscv/Kconfig.socs @@ -37,11 +37,22 @@ config SOC_VIRT config SOC_KENDRYTE bool "Kendryte K210 SoC" depends on !MMU - select BUILTIN_DTB select SERIAL_SIFIVE if TTY select SERIAL_SIFIVE_CONSOLE if TTY select SIFIVE_PLIC + select SOC_KENDRYTE_K210_DTB_BUILTIN help This enables support for Kendryte K210 SoC platform hardware. +config SOC_KENDRYTE_K210_DTB + def_bool y + depends on OF + +config SOC_KENDRYTE_K210_DTB_BUILTIN + bool "Builtin device tree for the Kendryte K210" + depends on BUILTIN_DTB + select SOC_KENDRYTE_K210_DTB + help + Builds a device tree for the Kendryte K210 into the Linux image. + endmenu diff --git a/arch/riscv/boot/dts/kendryte/Makefile b/arch/riscv/boot/dts/kendryte/Makefile index 815444e69e89..01d7eb15673f 100644 --- a/arch/riscv/boot/dts/kendryte/Makefile +++ b/arch/riscv/boot/dts/kendryte/Makefile @@ -1,2 +1,2 @@ # SPDX-License-Identifier: GPL-2.0 -dtb-$(CONFIG_SOC_KENDRYTE) += k210.dtb +dtb-$(CONFIG_SOC_KENDRYTE_K210_DTB) += k210.dtb diff --git a/arch/riscv/kernel/builtin-dtb-table.c b/arch/riscv/kernel/builtin-dtb-table.c index 7ad6fe93b8a6..203174ba6f22 100644 --- a/arch/riscv/kernel/builtin-dtb-table.c +++ b/arch/riscv/kernel/builtin-dtb-table.c @@ -4,3 +4,8 @@ */ #include <asm/soc.h> + +#ifdef CONFIG_SOC_KENDRYTE_K210_DTB_BUILTIN +extern void *kendryte_k210_dtb; +SOC_BUILTIN_DTB_DECLARE(kendryte_k210, 0x0, 0x0, 0x0, kendryte_k210_dtb); +#endif diff --git a/arch/riscv/kernel/builtin-dtb.S b/arch/riscv/kernel/builtin-dtb.S index 3d459ad86948..b0fd5ca231d7 100644 --- a/arch/riscv/kernel/builtin-dtb.S +++ b/arch/riscv/kernel/builtin-dtb.S @@ -1,3 +1,9 @@ /* SPDX-License-Identifier: GPL-2.0 */ .section .dtb.init.rodata,"a" + +#ifdef CONFIG_SOC_KENDRYTE_K210_DTB_BUILTIN +.global kendryte_k210_dtb +kendryte_k210_dtb: + .incbin "arch/riscv/boot/dts/kendryte/k210.dtb" +#endif