diff mbox series

[v2] MIPS: ingenic: Add support for appended devicetree

Message ID 20190221224310.9507-1-paul@crapouillou.net (mailing list archive)
State Mainlined
Commit 15205fc05482ba3d9574ded5bd4508f240f6ff52
Headers show
Series [v2] MIPS: ingenic: Add support for appended devicetree | expand

Commit Message

Paul Cercueil Feb. 21, 2019, 10:43 p.m. UTC
Add support for booting the kernel from an externally-appended
devicetree, if no devicetree was built-in.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---

Changes:

v2: Use fw_passed_dtb instead of __appended_dtb

 arch/mips/Kconfig        |  2 +-
 arch/mips/jz4740/setup.c | 14 ++++++++++----
 2 files changed, 11 insertions(+), 5 deletions(-)

Comments

Paul Burton Feb. 25, 2019, 7:08 p.m. UTC | #1
Hello,

Paul Cercueil wrote:
> Add support for booting the kernel from an externally-appended
> devicetree, if no devicetree was built-in.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>

Applied to mips-next.

Thanks,
    Paul

[ This message was auto-generated; if you believe anything is incorrect
  then please email paul.burton@mips.com to report it. ]
diff mbox series

Patch

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index a84c24d894aa..8b7ea9062198 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -391,7 +391,7 @@  config MACH_INGENIC
 	select GPIOLIB
 	select COMMON_CLK
 	select GENERIC_IRQ_CHIP
-	select BUILTIN_DTB
+	select BUILTIN_DTB if MIPS_NO_APPENDED_DTB
 	select USE_OF
 	select LIBFDT
 
diff --git a/arch/mips/jz4740/setup.c b/arch/mips/jz4740/setup.c
index afb40f8bce96..7e63c54eb8d2 100644
--- a/arch/mips/jz4740/setup.c
+++ b/arch/mips/jz4740/setup.c
@@ -31,7 +31,6 @@ 
 
 #define JZ4740_EMC_SDRAM_CTRL 0x80
 
-
 static void __init jz4740_detect_mem(void)
 {
 	void __iomem *jz_emc_base;
@@ -66,15 +65,22 @@  static unsigned long __init get_board_mach_type(const void *fdt)
 void __init plat_mem_setup(void)
 {
 	int offset;
+	void *dtb;
 
 	jz4740_reset_init();
-	__dt_setup_arch(__dtb_start);
 
-	offset = fdt_path_offset(__dtb_start, "/memory");
+	if (__dtb_start != __dtb_end)
+		dtb = __dtb_start;
+	else
+		dtb = (void *)fw_passed_dtb;
+
+	__dt_setup_arch(dtb);
+
+	offset = fdt_path_offset(dtb, "/memory");
 	if (offset < 0)
 		jz4740_detect_mem();
 
-	mips_machtype = get_board_mach_type(__dtb_start);
+	mips_machtype = get_board_mach_type(dtb);
 }
 
 void __init device_tree_init(void)