All of lore.kernel.org
 help / color / mirror / Atom feed
* Fwd: Re: Build breakage in latest -next
@ 2013-10-31 15:48 Ralf Baechle
  2013-11-04 12:21 ` [PATCH] MIPS: Netlogic: replace early_init_devtree() call Jayachandran C
  0 siblings, 1 reply; 3+ messages in thread
From: Ralf Baechle @ 2013-10-31 15:48 UTC (permalink / raw)
  To: linux-mips; +Cc: Jayachandran C, Ganesan Ramalingam, John Crispin

Comments regarding Rob's build fix below appreciated.

Thanks,

  Ralf

Date: Tue, 29 Oct 2013 17:55:04 -0500
From: Rob Herring <rob.herring@calxeda.com>
Subject: Re: Build breakage in latest -next

On 10/29/2013 04:04 PM, Ralf Baechle wrote:
> nlm_xlp_defconfig fails with:
> 
>   LINK    vmlinux
>   LD      vmlinux.o
>   MODPOST vmlinux.o
>   GEN     .version
>   CHK     include/generated/compile.h
>   UPD     include/generated/compile.h
>   CC      init/version.o
>   LD      init/built-in.o
> arch/mips/built-in.o: In function `plat_mem_setup':
> (.init.text+0x5b0): undefined reference to `early_init_devtree'
> make[2]: *** [vmlinux] Error 1
> make[1]: *** [sub-make] Error 2
> make: *** [all] Error 2
> make: Leaving directory `/home/ralf/src/linux/obj/nlm_xlp-build'
> 
> It appears this was caused by f75813c0127bbef41ac3152f64a72ba212a5514c
> [mips: use early_init_dt_scan] which removes the early_init_devtree
> function but doesn't the call in arch/mips/netlogic/xlp/setup.c.

I could change this to a call to device_tree_init, but the way it was 
done results in scanning the DT twice. I would like to move the 
device_tree_init call to be earlier instead to avoid this. I think this 
should be functionally equivalent, but could use more eyes on it.

Rob

diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index c538d6e..f5e5b0a 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -602,6 +602,8 @@ static void __init arch_mem_init(char **cmdline_p)
 {
 	extern void plat_mem_setup(void);
 
+	device_tree_init();
+
 	/* call board setup routine */
 	plat_mem_setup();
 
@@ -662,7 +664,6 @@ static void __init arch_mem_init(char **cmdline_p)
 				crashk_res.end - crashk_res.start + 1,
 				BOOTMEM_DEFAULT);
 #endif
-	device_tree_init();
 	sparse_init();
 	plat_swiotlb_setup();
 	paging_init();
diff --git a/arch/mips/netlogic/xlp/setup.c b/arch/mips/netlogic/xlp/setup.c
index 76a7131..e8938b7 100644
--- a/arch/mips/netlogic/xlp/setup.c
+++ b/arch/mips/netlogic/xlp/setup.c
@@ -97,9 +97,6 @@ void __init plat_mem_setup(void)
 	_machine_halt	= nlm_linux_exit;
 	pm_power_off	= nlm_linux_exit;
 
-	/* memory and bootargs from DT */
-	early_init_devtree(initial_boot_params);
-
 	if (boot_mem_map.nr_map == 0) {
 		pr_info("Using DRAM BARs for memory map.\n");
 		xlp_init_mem_from_bars();

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

* [PATCH] MIPS: Netlogic: replace early_init_devtree() call
  2013-10-31 15:48 Fwd: Re: Build breakage in latest -next Ralf Baechle
@ 2013-11-04 12:21 ` Jayachandran C
  2013-11-04 16:04   ` Rob Herring
  0 siblings, 1 reply; 3+ messages in thread
From: Jayachandran C @ 2013-11-04 12:21 UTC (permalink / raw)
  To: linux-mips, ralf; +Cc: robherring2, Jayachandran C

The early_init_devtree() API was removed in linux-next for 3.13 with
commit "mips: use early_init_dt_scan". This causes Netlogic XLP compile
to fail:

arch/mips/netlogic/xlp/setup.c:101: undefined reference to `early_init_devtree'

Add xlp_early_init_devtree() which uses the __dt_setup_arch() to
handle early device tree related initialization to fix this.

Signed-off-by: Jayachandran C <jchandra@broadcom.com>
---
 arch/mips/include/asm/netlogic/xlp-hal/xlp.h |    1 +
 arch/mips/netlogic/xlp/dt.c                  |   18 ++++++++++++++----
 arch/mips/netlogic/xlp/setup.c               |    2 +-
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/arch/mips/include/asm/netlogic/xlp-hal/xlp.h b/arch/mips/include/asm/netlogic/xlp-hal/xlp.h
index 17daffb2..470f209 100644
--- a/arch/mips/include/asm/netlogic/xlp-hal/xlp.h
+++ b/arch/mips/include/asm/netlogic/xlp-hal/xlp.h
@@ -69,6 +69,7 @@ void nlm_hal_init(void);
 int xlp_get_dram_map(int n, uint64_t *dram_map);
 
 /* Device tree related */
+void xlp_early_init_devtree(void);
 void *xlp_dt_init(void *fdtp);
 
 static inline int cpu_is_xlpii(void)
diff --git a/arch/mips/netlogic/xlp/dt.c b/arch/mips/netlogic/xlp/dt.c
index 88df445..8316d54 100644
--- a/arch/mips/netlogic/xlp/dt.c
+++ b/arch/mips/netlogic/xlp/dt.c
@@ -39,8 +39,11 @@
 #include <linux/of_platform.h>
 #include <linux/of_device.h>
 
+#include <asm/prom.h>
+
 extern u32 __dtb_xlp_evp_begin[], __dtb_xlp_svp_begin[],
 	__dtb_xlp_fvp_begin[], __dtb_start[];
+static void *xlp_fdt_blob;
 
 void __init *xlp_dt_init(void *fdtp)
 {
@@ -67,19 +70,26 @@ void __init *xlp_dt_init(void *fdtp)
 			break;
 		}
 	}
-	initial_boot_params = fdtp;
+	xlp_fdt_blob = fdtp;
 	return fdtp;
 }
 
+void __init xlp_early_init_devtree(void)
+{
+	__dt_setup_arch(xlp_fdt_blob);
+	strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
+}
+
 void __init device_tree_init(void)
 {
 	unsigned long base, size;
+	struct boot_param_header *fdtp = xlp_fdt_blob;
 
-	if (!initial_boot_params)
+	if (!fdtp)
 		return;
 
-	base = virt_to_phys((void *)initial_boot_params);
-	size = be32_to_cpu(initial_boot_params->totalsize);
+	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);
diff --git a/arch/mips/netlogic/xlp/setup.c b/arch/mips/netlogic/xlp/setup.c
index 76a7131..6d981bb 100644
--- a/arch/mips/netlogic/xlp/setup.c
+++ b/arch/mips/netlogic/xlp/setup.c
@@ -98,7 +98,7 @@ void __init plat_mem_setup(void)
 	pm_power_off	= nlm_linux_exit;
 
 	/* memory and bootargs from DT */
-	early_init_devtree(initial_boot_params);
+	xlp_early_init_devtree();
 
 	if (boot_mem_map.nr_map == 0) {
 		pr_info("Using DRAM BARs for memory map.\n");
-- 
1.7.9.5

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

* Re: [PATCH] MIPS: Netlogic: replace early_init_devtree() call
  2013-11-04 12:21 ` [PATCH] MIPS: Netlogic: replace early_init_devtree() call Jayachandran C
@ 2013-11-04 16:04   ` Rob Herring
  0 siblings, 0 replies; 3+ messages in thread
From: Rob Herring @ 2013-11-04 16:04 UTC (permalink / raw)
  To: Jayachandran C, linux-mips, ralf

On 11/04/2013 06:21 AM, Jayachandran C wrote:
> The early_init_devtree() API was removed in linux-next for 3.13 with
> commit "mips: use early_init_dt_scan". This causes Netlogic XLP compile
> to fail:
> 
> arch/mips/netlogic/xlp/setup.c:101: undefined reference to `early_init_devtree'
> 
> Add xlp_early_init_devtree() which uses the __dt_setup_arch() to
> handle early device tree related initialization to fix this.
> 
> Signed-off-by: Jayachandran C <jchandra@broadcom.com>
> ---
>  arch/mips/include/asm/netlogic/xlp-hal/xlp.h |    1 +
>  arch/mips/netlogic/xlp/dt.c                  |   18 ++++++++++++++----
>  arch/mips/netlogic/xlp/setup.c               |    2 +-
>  3 files changed, 16 insertions(+), 5 deletions(-)

If there are no objections, I'll apply this to my tree. I don't really
like this being platform specific, but I can't make sense of all the per
platform stuff in MIPS land to come up with a better solution. It
shouldn't really be a platform decision when to do DT scanning and
initialization. Just looking at the command line handling makes me run away.

Rob

> diff --git a/arch/mips/include/asm/netlogic/xlp-hal/xlp.h b/arch/mips/include/asm/netlogic/xlp-hal/xlp.h
> index 17daffb2..470f209 100644
> --- a/arch/mips/include/asm/netlogic/xlp-hal/xlp.h
> +++ b/arch/mips/include/asm/netlogic/xlp-hal/xlp.h
> @@ -69,6 +69,7 @@ void nlm_hal_init(void);
>  int xlp_get_dram_map(int n, uint64_t *dram_map);
>  
>  /* Device tree related */
> +void xlp_early_init_devtree(void);
>  void *xlp_dt_init(void *fdtp);
>  
>  static inline int cpu_is_xlpii(void)
> diff --git a/arch/mips/netlogic/xlp/dt.c b/arch/mips/netlogic/xlp/dt.c
> index 88df445..8316d54 100644
> --- a/arch/mips/netlogic/xlp/dt.c
> +++ b/arch/mips/netlogic/xlp/dt.c
> @@ -39,8 +39,11 @@
>  #include <linux/of_platform.h>
>  #include <linux/of_device.h>
>  
> +#include <asm/prom.h>
> +
>  extern u32 __dtb_xlp_evp_begin[], __dtb_xlp_svp_begin[],
>  	__dtb_xlp_fvp_begin[], __dtb_start[];
> +static void *xlp_fdt_blob;
>  
>  void __init *xlp_dt_init(void *fdtp)
>  {
> @@ -67,19 +70,26 @@ void __init *xlp_dt_init(void *fdtp)
>  			break;
>  		}
>  	}
> -	initial_boot_params = fdtp;
> +	xlp_fdt_blob = fdtp;
>  	return fdtp;
>  }
>  
> +void __init xlp_early_init_devtree(void)
> +{
> +	__dt_setup_arch(xlp_fdt_blob);
> +	strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
> +}
> +
>  void __init device_tree_init(void)
>  {
>  	unsigned long base, size;
> +	struct boot_param_header *fdtp = xlp_fdt_blob;
>  
> -	if (!initial_boot_params)
> +	if (!fdtp)
>  		return;
>  
> -	base = virt_to_phys((void *)initial_boot_params);
> -	size = be32_to_cpu(initial_boot_params->totalsize);
> +	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);
> diff --git a/arch/mips/netlogic/xlp/setup.c b/arch/mips/netlogic/xlp/setup.c
> index 76a7131..6d981bb 100644
> --- a/arch/mips/netlogic/xlp/setup.c
> +++ b/arch/mips/netlogic/xlp/setup.c
> @@ -98,7 +98,7 @@ void __init plat_mem_setup(void)
>  	pm_power_off	= nlm_linux_exit;
>  
>  	/* memory and bootargs from DT */
> -	early_init_devtree(initial_boot_params);
> +	xlp_early_init_devtree();
>  
>  	if (boot_mem_map.nr_map == 0) {
>  		pr_info("Using DRAM BARs for memory map.\n");
> 

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

end of thread, other threads:[~2013-11-04 16:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-31 15:48 Fwd: Re: Build breakage in latest -next Ralf Baechle
2013-11-04 12:21 ` [PATCH] MIPS: Netlogic: replace early_init_devtree() call Jayachandran C
2013-11-04 16:04   ` Rob Herring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.