Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH 00/20] FDT clean-ups and libfdt support
@ 2014-04-03 22:16 Rob Herring
  2014-04-03 22:16 ` [PATCH 01/20] mips: octeon: convert to use unflatten_and_copy_device_tree Rob Herring
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Rob Herring @ 2014-04-03 22:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: Grant Likely, Rob Herring, Aurelien Jacquiot,
	Benjamin Herrenschmidt, Chris Zankel, H. Peter Anvin, Ingo Molnar,
	James Hogan, Jonas Bonn, linux-arm-kernel, linux-c6x-dev, linux,
	linux-metag, linux-mips, linuxppc-dev, linux-xtensa, Mark Salter,
	Max Filippov, Michal Simek, Paul Mackerras, Ralf Baechle,
	Russell King, Thomas Gleixner, Vineet Gupta, x86

From: Rob Herring <robh@kernel.org>

This is a series of clean-ups of architecture FDT code and converts the
core FDT code over to using libfdt functions. This is in preparation
to add FDT based address translation parsing functions for early
console support. 

The current MIPS lantiq and xlp DT code is buggy as built-in DTBs need
to be copied out of init section. Patches 2 and 3 should be applied to
3.15.

A branch is available here[1]. Please test! I've compiled on arm,
arm64, mips, microblaze, and powerpc and booted on arm and arm64.

Rob

[1] git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git libfdt

Rob Herring (20):
  mips: octeon: convert to use unflatten_and_copy_device_tree
  mips: lantiq: copy built-in DTB out of init section
  mips: xlp: copy built-in DTB out of init section
  mips: ralink: convert to use unflatten_and_copy_device_tree
  ARM: dt: use default early_init_dt_alloc_memory_arch
  c6x: convert fdt pointers to opaque pointers
  mips: convert fdt pointers to opaque pointers
  of/fdt: consolidate built-in dtb section variables
  of/fdt: create common debugfs
  of/fdt: remove some unneeded includes
  of/fdt: remove unused of_scan_flat_dt_by_path
  of/fdt: update of_get_flat_dt_prop in prep for libfdt
  of/fdt: Convert FDT functions to use libfdt
  of/fdt: use libfdt accessors for header data
  of/fdt: move memreserve and dtb memory reservations into core
  build: add libfdt include path globally
  powerpc: use libfdt accessors for header data
  x86: use libfdt accessors for header data
  of/fdt: convert initial_boot_params to opaque pointer
  of: push struct boot_param_header and defines into powerpc

 Makefile                                    |   5 +
 arch/arc/include/asm/sections.h             |   1 -
 arch/arc/kernel/devtree.c                   |   2 +-
 arch/arm/include/asm/prom.h                 |   2 -
 arch/arm/kernel/devtree.c                   |  34 +--
 arch/arm/mach-exynos/exynos.c               |   2 +-
 arch/arm/mach-vexpress/platsmp.c            |   2 +-
 arch/arm/mm/init.c                          |   1 -
 arch/arm/plat-samsung/s5p-dev-mfc.c         |   4 +-
 arch/arm64/mm/init.c                        |  21 --
 arch/c6x/kernel/setup.c                     |   4 +-
 arch/metag/kernel/setup.c                   |   4 -
 arch/microblaze/kernel/prom.c               |  37 +--
 arch/mips/cavium-octeon/Makefile            |   3 -
 arch/mips/cavium-octeon/setup.c             |  18 +-
 arch/mips/include/asm/mips-boards/generic.h |   4 -
 arch/mips/include/asm/prom.h                |   6 +-
 arch/mips/kernel/prom.c                     |   2 +-
 arch/mips/lantiq/prom.c                     |  15 +-
 arch/mips/lantiq/prom.h                     |   2 -
 arch/mips/mti-sead3/Makefile                |   2 -
 arch/mips/mti-sead3/sead3-setup.c           |   8 +-
 arch/mips/netlogic/xlp/dt.c                 |  17 +-
 arch/mips/ralink/of.c                       |  29 +--
 arch/openrisc/kernel/vmlinux.h              |   2 -
 arch/powerpc/include/asm/prom.h             |  39 +++
 arch/powerpc/kernel/epapr_paravirt.c        |   2 +-
 arch/powerpc/kernel/fadump.c                |   4 +-
 arch/powerpc/kernel/prom.c                  |  77 ++----
 arch/powerpc/kernel/rtas.c                  |   2 +-
 arch/powerpc/mm/hash_utils_64.c             |  22 +-
 arch/powerpc/platforms/52xx/efika.c         |   4 +-
 arch/powerpc/platforms/chrp/setup.c         |   4 +-
 arch/powerpc/platforms/powernv/opal.c       |  12 +-
 arch/powerpc/platforms/pseries/setup.c      |   4 +-
 arch/x86/kernel/devicetree.c                |   7 +-
 arch/xtensa/kernel/setup.c                  |   3 +-
 drivers/of/Kconfig                          |   1 +
 drivers/of/fdt.c                            | 379 +++++++++-------------------
 drivers/of/of_reserved_mem.c                |   4 +-
 include/linux/of_fdt.h                      |  64 +----
 lib/Makefile                                |   2 -
 42 files changed, 261 insertions(+), 596 deletions(-)

-- 
1.8.3.2

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 01/20] mips: octeon: convert to use unflatten_and_copy_device_tree
  2014-04-03 22:16 [PATCH 00/20] FDT clean-ups and libfdt support Rob Herring
@ 2014-04-03 22:16 ` Rob Herring
  2014-04-07 17:46   ` Andreas Herrmann
  2014-04-03 22:16 ` [PATCH 02/20] mips: lantiq: copy built-in DTB out of init section Rob Herring
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Rob Herring @ 2014-04-03 22:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: Grant Likely, Rob Herring, Ralf Baechle, linux-mips

From: Rob Herring <robh@kernel.org>

The octeon FDT code can be simplified by using
unflatten_and_copy_device_tree function. This removes all accesses to
FDT header data by the arch code.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---
 arch/mips/cavium-octeon/setup.c | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index 331b837..0b27411 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -1058,31 +1058,23 @@ extern const char __dtb_octeon_68xx_begin;
 extern const char __dtb_octeon_68xx_end;
 void __init device_tree_init(void)
 {
-	int dt_size;
-	struct boot_param_header *fdt;
+	void *fdt;
 	bool do_prune;
 
 	if (octeon_bootinfo->minor_version >= 3 && octeon_bootinfo->fdt_addr) {
 		fdt = phys_to_virt(octeon_bootinfo->fdt_addr);
 		if (fdt_check_header(fdt))
 			panic("Corrupt Device Tree passed to kernel.");
-		dt_size = be32_to_cpu(fdt->totalsize);
 		do_prune = false;
 	} else if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
-		fdt = (struct boot_param_header *)&__dtb_octeon_68xx_begin;
-		dt_size = &__dtb_octeon_68xx_end - &__dtb_octeon_68xx_begin;
+		fdt = &__dtb_octeon_68xx_begin;
 		do_prune = true;
 	} else {
-		fdt = (struct boot_param_header *)&__dtb_octeon_3xxx_begin;
-		dt_size = &__dtb_octeon_3xxx_end - &__dtb_octeon_3xxx_begin;
+		fdt = &__dtb_octeon_3xxx_begin;
 		do_prune = true;
 	}
 
-	/* Copy the default tree from init memory. */
-	initial_boot_params = early_init_dt_alloc_memory_arch(dt_size, 8);
-	if (initial_boot_params == NULL)
-		panic("Could not allocate initial_boot_params");
-	memcpy(initial_boot_params, fdt, dt_size);
+	initial_boot_params = fdt;
 
 	if (do_prune) {
 		octeon_prune_device_tree();
@@ -1090,7 +1082,7 @@ void __init device_tree_init(void)
 	} else {
 		pr_info("Using passed Device Tree.\n");
 	}
-	unflatten_device_tree();
+	unflatten_and_copy_device_tree();
 }
 
 static int __initdata disable_octeon_edac_p;
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 02/20] mips: lantiq: copy built-in DTB out of init section
  2014-04-03 22:16 [PATCH 00/20] FDT clean-ups and libfdt support Rob Herring
  2014-04-03 22:16 ` [PATCH 01/20] mips: octeon: convert to use unflatten_and_copy_device_tree Rob Herring
@ 2014-04-03 22:16 ` Rob Herring
  2014-04-03 22:16 ` [PATCH 03/20] mips: xlp: " Rob Herring
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Rob Herring @ 2014-04-03 22:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: Grant Likely, Rob Herring, Ralf Baechle, linux-mips

From: Rob Herring <robh@kernel.org>

The existing code is buggy because built-in DTBs are in init memory.
Fix this by using the unflatten_and_copy_device_tree function.

This removes all accesses to FDT header data by the arch code.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---
 arch/mips/lantiq/prom.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/arch/mips/lantiq/prom.c b/arch/mips/lantiq/prom.c
index 19686c5..cdea687 100644
--- a/arch/mips/lantiq/prom.c
+++ b/arch/mips/lantiq/prom.c
@@ -76,18 +76,7 @@ void __init plat_mem_setup(void)
 
 void __init device_tree_init(void)
 {
-	unsigned long base, size;
-
-	if (!initial_boot_params)
-		return;
-
-	base = virt_to_phys((void *)initial_boot_params);
-	size = be32_to_cpu(initial_boot_params->totalsize);
-
-	/* Before we do anything, lets reserve the dt blob */
-	reserve_bootmem(base, size, BOOTMEM_DEFAULT);
-
-	unflatten_device_tree();
+	unflatten_and_copy_device_tree();
 }
 
 void __init prom_init(void)
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 03/20] mips: xlp: copy built-in DTB out of init section
  2014-04-03 22:16 [PATCH 00/20] FDT clean-ups and libfdt support Rob Herring
  2014-04-03 22:16 ` [PATCH 01/20] mips: octeon: convert to use unflatten_and_copy_device_tree Rob Herring
  2014-04-03 22:16 ` [PATCH 02/20] mips: lantiq: copy built-in DTB out of init section Rob Herring
@ 2014-04-03 22:16 ` Rob Herring
  2014-04-03 22:16 ` [PATCH 04/20] mips: ralink: convert to use unflatten_and_copy_device_tree Rob Herring
  2014-04-03 22:16 ` [PATCH 08/20] of/fdt: consolidate built-in dtb section variables Rob Herring
  4 siblings, 0 replies; 11+ messages in thread
From: Rob Herring @ 2014-04-03 22:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: Grant Likely, Rob Herring, Ralf Baechle, linux-mips

From: Rob Herring <robh@kernel.org>

The existing code is buggy because built-in DTBs are in init memory.
It is also broken because the reserved bootmem was then freed after
unflattening, but the unflattened tree points to data in the flat tree.
Fix this by using the unflatten_and_copy_device_tree function.

This removes all accesses to FDT header data by the arch code.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---
 arch/mips/netlogic/xlp/dt.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/arch/mips/netlogic/xlp/dt.c b/arch/mips/netlogic/xlp/dt.c
index 5754097..7f9615a 100644
--- a/arch/mips/netlogic/xlp/dt.c
+++ b/arch/mips/netlogic/xlp/dt.c
@@ -87,22 +87,7 @@ void __init xlp_early_init_devtree(void)
 
 void __init device_tree_init(void)
 {
-	unsigned long base, size;
-	struct boot_param_header *fdtp = xlp_fdt_blob;
-
-	if (!fdtp)
-		return;
-
-	base = virt_to_phys(fdtp);
-	size = be32_to_cpu(fdtp->totalsize);
-
-	/* Before we do anything, lets reserve the dt blob */
-	reserve_bootmem(base, size, BOOTMEM_DEFAULT);
-
-	unflatten_device_tree();
-
-	/* free the space reserved for the dt blob */
-	free_bootmem(base, size);
+	unflatten_and_copy_device_tree();
 }
 
 static struct of_device_id __initdata xlp_ids[] = {
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 04/20] mips: ralink: convert to use unflatten_and_copy_device_tree
  2014-04-03 22:16 [PATCH 00/20] FDT clean-ups and libfdt support Rob Herring
                   ` (2 preceding siblings ...)
  2014-04-03 22:16 ` [PATCH 03/20] mips: xlp: " Rob Herring
@ 2014-04-03 22:16 ` Rob Herring
  2014-04-03 22:16 ` [PATCH 08/20] of/fdt: consolidate built-in dtb section variables Rob Herring
  4 siblings, 0 replies; 11+ messages in thread
From: Rob Herring @ 2014-04-03 22:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: Grant Likely, Rob Herring, Ralf Baechle, linux-mips

From: Rob Herring <robh@kernel.org>

The ralink FDT code can be simplified by using
unflatten_and_copy_device_tree function. This removes all accesses to
FDT header data by the arch code.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---
 arch/mips/ralink/of.c | 25 +------------------------
 1 file changed, 1 insertion(+), 24 deletions(-)

diff --git a/arch/mips/ralink/of.c b/arch/mips/ralink/of.c
index eccc552..0170d82 100644
--- a/arch/mips/ralink/of.c
+++ b/arch/mips/ralink/of.c
@@ -52,30 +52,7 @@ __iomem void *plat_of_remap_node(const char *node)
 
 void __init device_tree_init(void)
 {
-	unsigned long base, size;
-	void *fdt_copy;
-
-	if (!initial_boot_params)
-		return;
-
-	base = virt_to_phys((void *)initial_boot_params);
-	size = be32_to_cpu(initial_boot_params->totalsize);
-
-	/* Before we do anything, lets reserve the dt blob */
-	reserve_bootmem(base, size, BOOTMEM_DEFAULT);
-
-	/* The strings in the flattened tree are referenced directly by the
-	 * device tree, so copy the flattened device tree from init memory
-	 * to regular memory.
-	 */
-	fdt_copy = alloc_bootmem(size);
-	memcpy(fdt_copy, initial_boot_params, size);
-	initial_boot_params = fdt_copy;
-
-	unflatten_device_tree();
-
-	/* free the space reserved for the dt blob */
-	free_bootmem(base, size);
+	unflatten_and_copy_device_tree();
 }
 
 void __init plat_mem_setup(void)
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 08/20] of/fdt: consolidate built-in dtb section variables
  2014-04-03 22:16 [PATCH 00/20] FDT clean-ups and libfdt support Rob Herring
                   ` (3 preceding siblings ...)
  2014-04-03 22:16 ` [PATCH 04/20] mips: ralink: convert to use unflatten_and_copy_device_tree Rob Herring
@ 2014-04-03 22:16 ` Rob Herring
  2014-04-07 10:54   ` James Hogan
  2014-04-08  4:23   ` Vineet Gupta
  4 siblings, 2 replies; 11+ messages in thread
From: Rob Herring @ 2014-04-03 22:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: Grant Likely, Rob Herring, Vineet Gupta, James Hogan,
	Ralf Baechle, Jonas Bonn, Chris Zankel, Max Filippov, linux-metag,
	linux-mips, linux, linux-xtensa

From: Rob Herring <robh@kernel.org>

Unify the various architectures __dtb_start and __dtb_end definitions
moving them into of_fdt.h.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: Chris Zankel <chris@zankel.net>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: linux-metag@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: linux@lists.openrisc.net
Cc: linux-xtensa@linux-xtensa.org
---
 arch/arc/include/asm/sections.h             | 1 -
 arch/metag/kernel/setup.c                   | 4 ----
 arch/mips/include/asm/mips-boards/generic.h | 2 --
 arch/mips/lantiq/prom.h                     | 2 --
 arch/mips/netlogic/xlp/dt.c                 | 2 +-
 arch/mips/ralink/of.c                       | 2 --
 arch/openrisc/kernel/vmlinux.h              | 2 --
 arch/xtensa/kernel/setup.c                  | 1 -
 include/linux/of_fdt.h                      | 3 +++
 9 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/arch/arc/include/asm/sections.h b/arch/arc/include/asm/sections.h
index 764f1e3..09db952 100644
--- a/arch/arc/include/asm/sections.h
+++ b/arch/arc/include/asm/sections.h
@@ -12,6 +12,5 @@
 #include <asm-generic/sections.h>
 
 extern char __arc_dccm_base[];
-extern char __dtb_start[];
 
 #endif
diff --git a/arch/metag/kernel/setup.c b/arch/metag/kernel/setup.c
index 129c7cd..31cf53d 100644
--- a/arch/metag/kernel/setup.c
+++ b/arch/metag/kernel/setup.c
@@ -105,10 +105,6 @@
 
 extern char _heap_start[];
 
-#ifdef CONFIG_METAG_BUILTIN_DTB
-extern u32 __dtb_start[];
-#endif
-
 #ifdef CONFIG_DA_CONSOLE
 /* Our early channel based console driver */
 extern struct console dash_console;
diff --git a/arch/mips/include/asm/mips-boards/generic.h b/arch/mips/include/asm/mips-boards/generic.h
index b969491..c904c24 100644
--- a/arch/mips/include/asm/mips-boards/generic.h
+++ b/arch/mips/include/asm/mips-boards/generic.h
@@ -67,8 +67,6 @@
 
 extern int mips_revision_sconid;
 
-extern char __dtb_start[];
-
 #ifdef CONFIG_PCI
 extern void mips_pcibios_init(void);
 #else
diff --git a/arch/mips/lantiq/prom.h b/arch/mips/lantiq/prom.h
index 69a4c58..bfd2d58 100644
--- a/arch/mips/lantiq/prom.h
+++ b/arch/mips/lantiq/prom.h
@@ -26,6 +26,4 @@ struct ltq_soc_info {
 extern void ltq_soc_detect(struct ltq_soc_info *i);
 extern void ltq_soc_init(void);
 
-extern char __dtb_start[];
-
 #endif
diff --git a/arch/mips/netlogic/xlp/dt.c b/arch/mips/netlogic/xlp/dt.c
index 7f9615a..bdde331 100644
--- a/arch/mips/netlogic/xlp/dt.c
+++ b/arch/mips/netlogic/xlp/dt.c
@@ -42,7 +42,7 @@
 #include <asm/prom.h>
 
 extern u32 __dtb_xlp_evp_begin[], __dtb_xlp_svp_begin[],
-	__dtb_xlp_fvp_begin[], __dtb_xlp_gvp_begin[], __dtb_start[];
+	__dtb_xlp_fvp_begin[], __dtb_xlp_gvp_begin[];
 static void *xlp_fdt_blob;
 
 void __init *xlp_dt_init(void *fdtp)
diff --git a/arch/mips/ralink/of.c b/arch/mips/ralink/of.c
index 91d7060..2513952 100644
--- a/arch/mips/ralink/of.c
+++ b/arch/mips/ralink/of.c
@@ -28,8 +28,6 @@
 __iomem void *rt_sysc_membase;
 __iomem void *rt_memc_membase;
 
-extern char __dtb_start[];
-
 __iomem void *plat_of_remap_node(const char *node)
 {
 	struct resource res;
diff --git a/arch/openrisc/kernel/vmlinux.h b/arch/openrisc/kernel/vmlinux.h
index 70b9ce4..bbcdf21 100644
--- a/arch/openrisc/kernel/vmlinux.h
+++ b/arch/openrisc/kernel/vmlinux.h
@@ -5,6 +5,4 @@
 extern char __initrd_start, __initrd_end;
 #endif
 
-extern u32 __dtb_start[];
-
 #endif
diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c
index 84fe931..89986e5 100644
--- a/arch/xtensa/kernel/setup.c
+++ b/arch/xtensa/kernel/setup.c
@@ -73,7 +73,6 @@ extern int initrd_below_start_ok;
 #endif
 
 #ifdef CONFIG_OF
-extern u32 __dtb_start[];
 void *dtb_start = __dtb_start;
 #endif
 
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index ddd7219..d4d0efe 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -80,6 +80,9 @@ extern int __initdata dt_root_addr_cells;
 extern int __initdata dt_root_size_cells;
 extern struct boot_param_header *initial_boot_params;
 
+extern char __dtb_start[];
+extern char __dtb_end[];
+
 /* For scanning the flat device-tree at boot time */
 extern char *find_flat_dt_string(u32 offset);
 extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname,
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 08/20] of/fdt: consolidate built-in dtb section variables
  2014-04-03 22:16 ` [PATCH 08/20] of/fdt: consolidate built-in dtb section variables Rob Herring
@ 2014-04-07 10:54   ` James Hogan
  2014-04-07 10:54     ` James Hogan
  2014-04-08  4:23   ` Vineet Gupta
  1 sibling, 1 reply; 11+ messages in thread
From: James Hogan @ 2014-04-07 10:54 UTC (permalink / raw)
  To: Rob Herring
  Cc: linux-kernel, Grant Likely, Rob Herring, Vineet Gupta,
	Ralf Baechle, Jonas Bonn, Chris Zankel, Max Filippov, linux-metag,
	linux-mips, linux, linux-xtensa

[-- Attachment #1: Type: text/plain, Size: 698 bytes --]

On 03/04/14 23:16, Rob Herring wrote:
> From: Rob Herring <robh@kernel.org>
> 
> Unify the various architectures __dtb_start and __dtb_end definitions
> moving them into of_fdt.h.
> 
> Signed-off-by: Rob Herring <robh@kernel.org>
> Cc: Vineet Gupta <vgupta@synopsys.com>
> Cc: James Hogan <james.hogan@imgtec.com>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: Jonas Bonn <jonas@southpole.se>
> Cc: Chris Zankel <chris@zankel.net>
> Cc: Max Filippov <jcmvbkbc@gmail.com>
> Cc: linux-metag@vger.kernel.org
> Cc: linux-mips@linux-mips.org
> Cc: linux@lists.openrisc.net
> Cc: linux-xtensa@linux-xtensa.org

Acked-by: James Hogan <james.hogan@imgtec.com> [metag]

Cheers
James


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 08/20] of/fdt: consolidate built-in dtb section variables
  2014-04-07 10:54   ` James Hogan
@ 2014-04-07 10:54     ` James Hogan
  0 siblings, 0 replies; 11+ messages in thread
From: James Hogan @ 2014-04-07 10:54 UTC (permalink / raw)
  To: Rob Herring
  Cc: linux-kernel, Grant Likely, Rob Herring, Vineet Gupta,
	Ralf Baechle, Jonas Bonn, Chris Zankel, Max Filippov, linux-metag,
	linux-mips, linux, linux-xtensa

[-- Attachment #1: Type: text/plain, Size: 698 bytes --]

On 03/04/14 23:16, Rob Herring wrote:
> From: Rob Herring <robh@kernel.org>
> 
> Unify the various architectures __dtb_start and __dtb_end definitions
> moving them into of_fdt.h.
> 
> Signed-off-by: Rob Herring <robh@kernel.org>
> Cc: Vineet Gupta <vgupta@synopsys.com>
> Cc: James Hogan <james.hogan@imgtec.com>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: Jonas Bonn <jonas@southpole.se>
> Cc: Chris Zankel <chris@zankel.net>
> Cc: Max Filippov <jcmvbkbc@gmail.com>
> Cc: linux-metag@vger.kernel.org
> Cc: linux-mips@linux-mips.org
> Cc: linux@lists.openrisc.net
> Cc: linux-xtensa@linux-xtensa.org

Acked-by: James Hogan <james.hogan@imgtec.com> [metag]

Cheers
James


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 01/20] mips: octeon: convert to use unflatten_and_copy_device_tree
  2014-04-03 22:16 ` [PATCH 01/20] mips: octeon: convert to use unflatten_and_copy_device_tree Rob Herring
@ 2014-04-07 17:46   ` Andreas Herrmann
  2014-04-16  1:02     ` Rob Herring
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Herrmann @ 2014-04-07 17:46 UTC (permalink / raw)
  To: Rob Herring
  Cc: linux-kernel, Grant Likely, Rob Herring, Ralf Baechle, linux-mips,
	David Daney

On Thu, Apr 03, 2014 at 05:16:44PM -0500, Rob Herring wrote:
> From: Rob Herring <robh@kernel.org>
> 
> The octeon FDT code can be simplified by using
> unflatten_and_copy_device_tree function. This removes all accesses to
> FDT header data by the arch code.

Hi Rob,

I think (in general) this modification is ok. But I suggest to use
following (slightly modified) version.


Thanks,

Andreas

-- 8< --
Subject: MIPS: Octeon: Convert to use unflatten_and_copy_device_tree

From: Rob Herring <robh@kernel.org>

The octeon FDT code can be simplified by using
unflatten_and_copy_device_tree function. This removes all accesses to
FDT header data by the arch code.

[andreas.herrmann: * Fixed compile problem:
 arch/mips/cavium-octeon/setup.c: In function 'device_tree_init':
 arch/mips/cavium-octeon/setup.c:1070:7: error: assignment discards 'const' qualifier from pointer target type [-Werror]
 arch/mips/cavium-octeon/setup.c:1073:7: error: assignment discards 'const' qualifier from pointer target type [-Werror]
                   * Removed (now) obsolete extern declarations (for __dtb_octeon_3xxx_end,
                     __dtb_octeon_68xx_end)]

Tested-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Signed-off-by: Rob Herring <robh@kernel.org>
---
 arch/mips/cavium-octeon/setup.c |   20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index 331b837..72ae938 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -1053,36 +1053,26 @@ void prom_free_prom_memory(void)
 int octeon_prune_device_tree(void);
 
 extern const char __dtb_octeon_3xxx_begin;
-extern const char __dtb_octeon_3xxx_end;
 extern const char __dtb_octeon_68xx_begin;
-extern const char __dtb_octeon_68xx_end;
 void __init device_tree_init(void)
 {
-	int dt_size;
-	struct boot_param_header *fdt;
+	const void *fdt;
 	bool do_prune;
 
 	if (octeon_bootinfo->minor_version >= 3 && octeon_bootinfo->fdt_addr) {
 		fdt = phys_to_virt(octeon_bootinfo->fdt_addr);
 		if (fdt_check_header(fdt))
 			panic("Corrupt Device Tree passed to kernel.");
-		dt_size = be32_to_cpu(fdt->totalsize);
 		do_prune = false;
 	} else if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
-		fdt = (struct boot_param_header *)&__dtb_octeon_68xx_begin;
-		dt_size = &__dtb_octeon_68xx_end - &__dtb_octeon_68xx_begin;
+		fdt = &__dtb_octeon_68xx_begin;
 		do_prune = true;
 	} else {
-		fdt = (struct boot_param_header *)&__dtb_octeon_3xxx_begin;
-		dt_size = &__dtb_octeon_3xxx_end - &__dtb_octeon_3xxx_begin;
+		fdt = &__dtb_octeon_3xxx_begin;
 		do_prune = true;
 	}
 
-	/* Copy the default tree from init memory. */
-	initial_boot_params = early_init_dt_alloc_memory_arch(dt_size, 8);
-	if (initial_boot_params == NULL)
-		panic("Could not allocate initial_boot_params");
-	memcpy(initial_boot_params, fdt, dt_size);
+	initial_boot_params = (void *)fdt;
 
 	if (do_prune) {
 		octeon_prune_device_tree();
@@ -1090,7 +1080,7 @@ void __init device_tree_init(void)
 	} else {
 		pr_info("Using passed Device Tree.\n");
 	}
-	unflatten_device_tree();
+	unflatten_and_copy_device_tree();
 }
 
 static int __initdata disable_octeon_edac_p;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 08/20] of/fdt: consolidate built-in dtb section variables
  2014-04-03 22:16 ` [PATCH 08/20] of/fdt: consolidate built-in dtb section variables Rob Herring
  2014-04-07 10:54   ` James Hogan
@ 2014-04-08  4:23   ` Vineet Gupta
  1 sibling, 0 replies; 11+ messages in thread
From: Vineet Gupta @ 2014-04-08  4:23 UTC (permalink / raw)
  To: Rob Herring, linux-kernel@vger.kernel.org
  Cc: Grant Likely, Rob Herring, James Hogan, Ralf Baechle, Jonas Bonn,
	Chris Zankel, Max Filippov, linux-metag@vger.kernel.org,
	linux-mips@linux-mips.org, linux@lists.openrisc.net,
	linux-xtensa@linux-xtensa.org

Hi Rob,

On Friday 04 April 2014 03:47 AM, Rob Herring wrote:
> From: Rob Herring <robh@kernel.org>
>
> Unify the various architectures __dtb_start and __dtb_end definitions
> moving them into of_fdt.h.
>
> Signed-off-by: Rob Herring <robh@kernel.org>
> Cc: Vineet Gupta <vgupta@synopsys.com>
> Cc: James Hogan <james.hogan@imgtec.com>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: Jonas Bonn <jonas@southpole.se>
> Cc: Chris Zankel <chris@zankel.net>
> Cc: Max Filippov <jcmvbkbc@gmail.com>
> Cc: linux-metag@vger.kernel.org
> Cc: linux-mips@linux-mips.org
> Cc: linux@lists.openrisc.net
> Cc: linux-xtensa@linux-xtensa.org

Acked-by: Vineet Gupta <vgupta@synopsys.com>  # arch/arc bits

Thx,
-Vineet

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 01/20] mips: octeon: convert to use unflatten_and_copy_device_tree
  2014-04-07 17:46   ` Andreas Herrmann
@ 2014-04-16  1:02     ` Rob Herring
  0 siblings, 0 replies; 11+ messages in thread
From: Rob Herring @ 2014-04-16  1:02 UTC (permalink / raw)
  To: Andreas Herrmann
  Cc: linux-kernel@vger.kernel.org, Grant Likely, Ralf Baechle,
	linux-mips, David Daney

On Mon, Apr 7, 2014 at 12:46 PM, Andreas Herrmann
<herrmann.der.user@googlemail.com> wrote:
> On Thu, Apr 03, 2014 at 05:16:44PM -0500, Rob Herring wrote:
>> From: Rob Herring <robh@kernel.org>
>>
>> The octeon FDT code can be simplified by using
>> unflatten_and_copy_device_tree function. This removes all accesses to
>> FDT header data by the arch code.
>
> Hi Rob,
>
> I think (in general) this modification is ok. But I suggest to use
> following (slightly modified) version.

Having to compile each platform on MIPS sure is annoying. Reminds me
of ARM a few years ago. We need a good rant from Linus about MIPS. ;)

>
> -       /* Copy the default tree from init memory. */
> -       initial_boot_params = early_init_dt_alloc_memory_arch(dt_size, 8);
> -       if (initial_boot_params == NULL)
> -               panic("Could not allocate initial_boot_params");
> -       memcpy(initial_boot_params, fdt, dt_size);
> +       initial_boot_params = (void *)fdt;

Does calling early_init_devtree here work instead. This will add
parsing memory, initrd and command line. If you don't have those then
it should be a nop other than setting initial_boot_params. It should
only matter if your DT has these things and you want/need to ignore
them. Do this would get things more inline with other arches.

Rob

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-04-16  1:02 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-03 22:16 [PATCH 00/20] FDT clean-ups and libfdt support Rob Herring
2014-04-03 22:16 ` [PATCH 01/20] mips: octeon: convert to use unflatten_and_copy_device_tree Rob Herring
2014-04-07 17:46   ` Andreas Herrmann
2014-04-16  1:02     ` Rob Herring
2014-04-03 22:16 ` [PATCH 02/20] mips: lantiq: copy built-in DTB out of init section Rob Herring
2014-04-03 22:16 ` [PATCH 03/20] mips: xlp: " Rob Herring
2014-04-03 22:16 ` [PATCH 04/20] mips: ralink: convert to use unflatten_and_copy_device_tree Rob Herring
2014-04-03 22:16 ` [PATCH 08/20] of/fdt: consolidate built-in dtb section variables Rob Herring
2014-04-07 10:54   ` James Hogan
2014-04-07 10:54     ` James Hogan
2014-04-08  4:23   ` Vineet Gupta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox