Procházet zdrojové kódy

MIPS: JZ4740: only detect RAM size if not specified in DT

Allow a devicetree to specify the memory present in the system rather
than probing it from the memory controller. This both saves the probing
for systems where the amount of memory is fixed, and will simplify the
bringup of later Ingenic SoCs where the memory controller register
layout differs.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/10163/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Paul Burton před 10 roky
rodič
revize
6ec127fb3c
3 změnil soubory, kde provedl 10 přidání a 1 odebrání
  1. 1 0
      arch/mips/Kconfig
  2. 2 0
      arch/mips/jz4740/Makefile
  3. 7 1
      arch/mips/jz4740/setup.c

+ 1 - 0
arch/mips/Kconfig

@@ -302,6 +302,7 @@ config MACH_INGENIC
 	select GENERIC_IRQ_CHIP
 	select GENERIC_IRQ_CHIP
 	select BUILTIN_DTB
 	select BUILTIN_DTB
 	select USE_OF
 	select USE_OF
+	select LIBFDT
 
 
 config LANTIQ
 config LANTIQ
 	bool "Lantiq based platforms"
 	bool "Lantiq based platforms"

+ 2 - 0
arch/mips/jz4740/Makefile

@@ -7,6 +7,8 @@
 obj-y += prom.o time.o reset.o setup.o \
 obj-y += prom.o time.o reset.o setup.o \
 	gpio.o platform.o timer.o serial.o
 	gpio.o platform.o timer.o serial.o
 
 
+CFLAGS_setup.o = -I$(src)/../../../scripts/dtc/libfdt
+
 # board specific support
 # board specific support
 
 
 obj-$(CONFIG_JZ4740_QI_LB60)	+= board-qi_lb60.o
 obj-$(CONFIG_JZ4740_QI_LB60)	+= board-qi_lb60.o

+ 7 - 1
arch/mips/jz4740/setup.c

@@ -18,6 +18,7 @@
 #include <linux/io.h>
 #include <linux/io.h>
 #include <linux/irqchip.h>
 #include <linux/irqchip.h>
 #include <linux/kernel.h>
 #include <linux/kernel.h>
+#include <linux/libfdt.h>
 #include <linux/of_fdt.h>
 #include <linux/of_fdt.h>
 #include <linux/of_platform.h>
 #include <linux/of_platform.h>
 
 
@@ -55,9 +56,14 @@ static void __init jz4740_detect_mem(void)
 
 
 void __init plat_mem_setup(void)
 void __init plat_mem_setup(void)
 {
 {
+	int offset;
+
 	jz4740_reset_init();
 	jz4740_reset_init();
-	jz4740_detect_mem();
 	__dt_setup_arch(__dtb_start);
 	__dt_setup_arch(__dtb_start);
+
+	offset = fdt_path_offset(__dtb_start, "/memory");
+	if (offset < 0)
+		jz4740_detect_mem();
 }
 }
 
 
 void __init device_tree_init(void)
 void __init device_tree_init(void)