linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: Add a device_initcall to call of_platform_bus_probe on all fsl SoCs
@ 2006-12-19 21:31 Kim Phillips
  2006-12-19 23:00 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 6+ messages in thread
From: Kim Phillips @ 2006-12-19 21:31 UTC (permalink / raw)
  To: linuxppc-dev

Utilize of_platform_bus_probe() in lieu of manually
calling of_platform_device_create for each ucc_geth device
(consequently, the QE is added to of_default_bus_ids).

This has been extended outside mpc83xx platform code,
since other fsl SoCs are going to need it (thanks Kumar).

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
---
 arch/powerpc/kernel/of_platform.c |    1 +
 arch/powerpc/sysdev/fsl_soc.c     |    9 +++++++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c
index 3002ea3..72da78b 100644
--- a/arch/powerpc/kernel/of_platform.c
+++ b/arch/powerpc/kernel/of_platform.c
@@ -50,6 +50,7 @@ static struct of_device_id of_default_bu
 	{ .type = "plb5", },
 	{ .type = "plb4", },
 	{ .type = "opb", },
+	{ .type = "qe", },
 	{},
 };
 
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index ad31e56..c41b851 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -28,6 +28,7 @@
 #include <linux/fs_uart_pd.h>
 
 #include <asm/system.h>
+#include <asm/of_platform.h>
 #include <asm/atomic.h>
 #include <asm/io.h>
 #include <asm/irq.h>
@@ -63,6 +64,14 @@ phys_addr_t get_immrbase(void)
 
 EXPORT_SYMBOL(get_immrbase);
 
+static int __init fsl_publish_devices(void)
+{
+	of_platform_bus_probe(NULL, NULL, NULL);
+
+	return 0;
+}
+device_initcall(fsl_publish_devices);
+
 #ifdef CONFIG_CPM2
 
 static u32 brgfreq = -1;
-- 
1.4.4

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

* Re: [PATCH] powerpc: Add a device_initcall to call of_platform_bus_probe on all fsl SoCs
  2006-12-19 21:31 [PATCH] powerpc: Add a device_initcall to call of_platform_bus_probe on all fsl SoCs Kim Phillips
@ 2006-12-19 23:00 ` Benjamin Herrenschmidt
  2006-12-19 23:22   ` Kim Phillips
  0 siblings, 1 reply; 6+ messages in thread
From: Benjamin Herrenschmidt @ 2006-12-19 23:00 UTC (permalink / raw)
  To: Kim Phillips; +Cc: linuxppc-dev

On Tue, 2006-12-19 at 15:31 -0600, Kim Phillips wrote:
> Utilize of_platform_bus_probe() in lieu of manually
> calling of_platform_device_create for each ucc_geth device
> (consequently, the QE is added to of_default_bus_ids).
> 
> This has been extended outside mpc83xx platform code,
> since other fsl SoCs are going to need it (thanks Kumar).
> 
> Signed-off-by: Kim Phillips <kim.phillips@freescale.com>

Big NACK

The effect of this patch is that of_platform_bus_probe() will be
unconditionally called on anything if a paltform using fsl_soc.c is
included in the build.

I want that called by the platform code or by something called by the
platform code for FSL boards, not totally unconditional like that.

Ben.
 
> ---
>  arch/powerpc/kernel/of_platform.c |    1 +
>  arch/powerpc/sysdev/fsl_soc.c     |    9 +++++++++
>  2 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c
> index 3002ea3..72da78b 100644
> --- a/arch/powerpc/kernel/of_platform.c
> +++ b/arch/powerpc/kernel/of_platform.c
> @@ -50,6 +50,7 @@ static struct of_device_id of_default_bu
>  	{ .type = "plb5", },
>  	{ .type = "plb4", },
>  	{ .type = "opb", },
> +	{ .type = "qe", },
>  	{},
>  };
>  
> diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
> index ad31e56..c41b851 100644
> --- a/arch/powerpc/sysdev/fsl_soc.c
> +++ b/arch/powerpc/sysdev/fsl_soc.c
> @@ -28,6 +28,7 @@
>  #include <linux/fs_uart_pd.h>
>  
>  #include <asm/system.h>
> +#include <asm/of_platform.h>
>  #include <asm/atomic.h>
>  #include <asm/io.h>
>  #include <asm/irq.h>
> @@ -63,6 +64,14 @@ phys_addr_t get_immrbase(void)
>  
>  EXPORT_SYMBOL(get_immrbase);
>  
> +static int __init fsl_publish_devices(void)
> +{
> +	of_platform_bus_probe(NULL, NULL, NULL);
> +
> +	return 0;
> +}
> +device_initcall(fsl_publish_devices);
> +
>  #ifdef CONFIG_CPM2
>  
>  static u32 brgfreq = -1;

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

* Re: [PATCH] powerpc: Add a device_initcall to call of_platform_bus_probe on all fsl SoCs
  2006-12-19 23:00 ` Benjamin Herrenschmidt
@ 2006-12-19 23:22   ` Kim Phillips
  2006-12-19 23:40     ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 6+ messages in thread
From: Kim Phillips @ 2006-12-19 23:22 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev

On Wed, 20 Dec 2006 10:00:46 +1100
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:

> On Tue, 2006-12-19 at 15:31 -0600, Kim Phillips wrote:
> > Utilize of_platform_bus_probe() in lieu of manually
> > calling of_platform_device_create for each ucc_geth device
> > (consequently, the QE is added to of_default_bus_ids).
> > 
> > This has been extended outside mpc83xx platform code,
> > since other fsl SoCs are going to need it (thanks Kumar).
> > 
> > Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
> 
> Big NACK

[this implies a nack on the consolidate 83xx files patch]
 
> The effect of this patch is that of_platform_bus_probe() will be
> unconditionally called on anything if a paltform using fsl_soc.c is
> included in the build.

well, that's the whole point.  85xx will soon need this.

> I want that called by the platform code or by something called by the
> platform code for FSL boards, not totally unconditional like that.

it's not characteristic of FSL _boards_ per se.  It's characteristic of FSL powerpc SoC chips, and it resides in a file that will only be built for that case.  This is a legitimate way to support multiple platforms in a single image without incurring multiple device_initcall()s with the same parameter.  I didn't see an appropriate ppc_md. function to use; are you suggesting we add one just for this?  wouldn't that be fsl specific also, but reside in common code?

> Ben.
>  
Kim

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

* Re: [PATCH] powerpc: Add a device_initcall to call of_platform_bus_probe on all fsl SoCs
  2006-12-19 23:22   ` Kim Phillips
@ 2006-12-19 23:40     ` Benjamin Herrenschmidt
  2006-12-20  0:10       ` Scott Wood
  0 siblings, 1 reply; 6+ messages in thread
From: Benjamin Herrenschmidt @ 2006-12-19 23:40 UTC (permalink / raw)
  To: Kim Phillips; +Cc: linuxppc-dev


> it's not characteristic of FSL _boards_ per se.  It's characteristic of FSL
> powerpc SoC chips, and it resides in a file that will only be built for that
> case.  This is a legitimate way to support multiple platforms in a single
> image without incurring multiple device_initcall()s with the same parameter.

> I didn't see an appropriate ppc_md. function to use; are you suggesting we add
> one just for this?  wouldn't that be fsl specific also, but reside in common code?

What cores do those chip use ? Any reason why one couldn't build a
kernel that boots those chips -and- chrp,pmac,etc... in one image ?

If that is the case, then your initcall will incorrectly be called on
platforms that don't need it.

I think what we need to do is to define a mecanism for board initcalls.

Something like board_xxx_initcall(boardname, function);

Ben.

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

* Re: [PATCH] powerpc: Add a device_initcall to call of_platform_bus_probe on all fsl SoCs
  2006-12-19 23:40     ` Benjamin Herrenschmidt
@ 2006-12-20  0:10       ` Scott Wood
  2006-12-20  0:19         ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 6+ messages in thread
From: Scott Wood @ 2006-12-20  0:10 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev

Benjamin Herrenschmidt wrote:
> What cores do those chip use ? Any reason why one couldn't build a
> kernel that boots those chips -and- chrp,pmac,etc... in one image ?
> 
> If that is the case, then your initcall will incorrectly be called on
> platforms that don't need it.

It won't do anything, though, unless it finds a node that matches 
of_default_bus_ids.  Are there any platforms on which "soc" nodes (or 
others in the default list) shouldn't be probed?  If not, perhaps make a 
generic initcall to of_platform_bus_probe(), so that it won't be called 
multiple times by different SoC types that are in the same kernel?

Otherwise, perhaps the SoCs could be given "fsl-soc" in their compatible 
field, and have fsl_publish_devices() pass that as a match struct.

> I think what we need to do is to define a mecanism for board initcalls.
> 
> Something like board_xxx_initcall(boardname, function);

It's not really a board-level issue, though -- at most, it's SoC-level.

-Scott

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

* Re: [PATCH] powerpc: Add a device_initcall to call of_platform_bus_probe on all fsl SoCs
  2006-12-20  0:10       ` Scott Wood
@ 2006-12-20  0:19         ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 6+ messages in thread
From: Benjamin Herrenschmidt @ 2006-12-20  0:19 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev

On Tue, 2006-12-19 at 18:10 -0600, Scott Wood wrote:
> Benjamin Herrenschmidt wrote:
> > What cores do those chip use ? Any reason why one couldn't build a
> > kernel that boots those chips -and- chrp,pmac,etc... in one image ?
> > 
> > If that is the case, then your initcall will incorrectly be called on
> > platforms that don't need it.
> 
> It won't do anything, though, unless it finds a node that matches 
> of_default_bus_ids.  Are there any platforms on which "soc" nodes (or 
> others in the default list) shouldn't be probed?  If not, perhaps make a 
> generic initcall to of_platform_bus_probe(), so that it won't be called 
> multiple times by different SoC types that are in the same kernel?

There is none right now that shouldn't be probed but I haven't been too
happy about having a default list in the first place (despite me writing
that code :-)

> Otherwise, perhaps the SoCs could be given "fsl-soc" in their compatible 
> field, and have fsl_publish_devices() pass that as a match struct.

Might be a better option.

I'd rather keep things well separate for now.

Ben.

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

end of thread, other threads:[~2006-12-20  0:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-19 21:31 [PATCH] powerpc: Add a device_initcall to call of_platform_bus_probe on all fsl SoCs Kim Phillips
2006-12-19 23:00 ` Benjamin Herrenschmidt
2006-12-19 23:22   ` Kim Phillips
2006-12-19 23:40     ` Benjamin Herrenschmidt
2006-12-20  0:10       ` Scott Wood
2006-12-20  0:19         ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).