MIPS: Netlogic: Add support for built in DTB
authorJayachandran C <jayachandranc@netlogicmicro.com>
Fri, 13 Jul 2012 16:23:22 +0000 (21:53 +0530)
committerJohn Crispin <blogic@openwrt.org>
Wed, 22 Aug 2012 21:46:37 +0000 (23:46 +0200)
Provide a config option to embed a device tree for XLP evaluation
boards. This DTB will be used if the firmware does not pass in a
device tree pointer.

Signed-off-by: Jayachandran C <jayachandranc@netlogicmicro.com>
Patchwork: http://patchwork.linux-mips.org/patch/4103/
Signed-off-by: John Crispin <blogic@openwrt.org>
arch/mips/Kconfig
arch/mips/netlogic/Kconfig
arch/mips/netlogic/Makefile
arch/mips/netlogic/dts/Makefile [new file with mode: 0644]
arch/mips/netlogic/xlp/setup.c

index 331d574df99c8d86ecdce41c9366164fac63f396..8190bdcd5a6a8805991d4b4377cbc05576c2df28 100644 (file)
@@ -830,6 +830,7 @@ config NLM_XLP_BOARD
        select ZONE_DMA if 64BIT
        select SYNC_R4K
        select SYS_HAS_EARLY_PRINTK
+       select USE_OF
        help
          This board is based on Netlogic XLP Processor.
          Say Y here if you have a XLP based board.
index 75bec44b5856ee916a3c006af7744a0746242983..8059eb76f8eb7cfdf6273e12131ca9e0566435b8 100644 (file)
@@ -1,2 +1,17 @@
+if NLM_XLP_BOARD || NLM_XLR_BOARD
+
+if NLM_XLP_BOARD
+config DT_XLP_EVP
+       bool "Built-in device tree for XLP EVP/SVP boards"
+       default y
+       help
+         Add an FDT blob for XLP EVP and SVP boards into the kernel.
+         This DTB will be used if the firmware does not pass in a DTB
+          pointer to the kernel.  The corresponding DTS file is at
+          arch/mips/netlogic/dts/xlp_evp.dts
+endif
+
 config NLM_COMMON
        bool
+
+endif
index 36d169b2ca6d34f7185c491746c2e773206c301d..7602d1386614ee2d384b421c9b415a093667cf85 100644 (file)
@@ -1,3 +1,4 @@
 obj-$(CONFIG_NLM_COMMON)       +=      common/
 obj-$(CONFIG_CPU_XLR)          +=      xlr/
 obj-$(CONFIG_CPU_XLP)          +=      xlp/
+obj-$(CONFIG_CPU_XLP)          +=      dts/
diff --git a/arch/mips/netlogic/dts/Makefile b/arch/mips/netlogic/dts/Makefile
new file mode 100644 (file)
index 0000000..67ae3fe
--- /dev/null
@@ -0,0 +1,4 @@
+obj-$(CONFIG_DT_XLP_EVP) := xlp_evp.dtb.o
+
+$(obj)/%.dtb: $(obj)/%.dts
+       $(call if_changed,dtc)
index 0d2d679c6c56de369c4495e8239efd724729a0ec..d8997098defda9e265fb7d6adc9be34859669fbc 100644 (file)
@@ -57,6 +57,7 @@ unsigned long nlm_common_ebase = 0x0;
 /* default to uniprocessor */
 uint32_t nlm_coremask = 1, nlm_cpumask  = 1;
 int  nlm_threads_per_core = 1;
+extern u32 __dtb_start[];
 
 static void nlm_linux_exit(void)
 {
@@ -97,9 +98,18 @@ void __init prom_init(void)
 {
        void *fdtp;
 
-       fdtp = (void *)(long)fw_arg0;
        xlp_mmu_init();
        nlm_hal_init();
+
+       /*
+        * If no FDT pointer is passed in, use the built-in FDT.
+        * device_tree_init() does not handle CKSEG0 pointers in
+        * 64-bit, so convert pointer.
+        */
+       fdtp = (void *)(long)fw_arg0;
+       if (!fdtp)
+               fdtp = __dtb_start;
+       fdtp = phys_to_virt(__pa(fdtp));
        early_init_devtree(fdtp);
 
        nlm_common_ebase = read_c0_ebase() & (~((1 << 12) - 1));