Skip to contentSkip to conversation

powerpc: Add a device_initcall to call of_platform_bus_probe on all fsl SoCs

PATCH In review Kim Phillips 3 participants 6 messages Dec 19, 2006 – Dec 20, 2006 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: Add a device_initcall to call of_platform_bus_probe on all fsl SoCs

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).

---
 arch/powerpc/kernel/of_platform.c |    1 +
 arch/powerpc/sysdev/fsl_soc.c     |    9 +++++++++
 2 files changed, 10 insertions(+), 0 deletions(-)
arch/powerpc/kernel/of_platform.c +1 -0
index 3002ea3..72da78b 100644
@@ -50,6 +50,7 @@ static struct of_device_id of_default_bu
 	{ .type = "plb5", },
 	{ .type = "plb4", },
 	{ .type = "opb", },
+	{ .type = "qe", },
 	{},
 };
 
arch/powerpc/sysdev/fsl_soc.c +9 -0
index ad31e56..c41b851 100644
@@ -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;
Signature · 1 line
1.4.4
#1 lore raw
Quoted 8 lines · Kim Phillips

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).

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.

Quoted 44 lines
---
 arch/powerpc/kernel/of_platform.c |    1 +
 arch/powerpc/sysdev/fsl_soc.c     |    9 +++++++++
 2 files changed, 10 insertions(+), 0 deletions(-)
arch/powerpc/kernel/of_platform.c +1 -0
index 3002ea3..72da78b 100644
@@ -50,6 +50,7 @@ static struct of_device_id of_default_bu
 	{ .type = "plb5", },
 	{ .type = "plb4", },
 	{ .type = "opb", },
+	{ .type = "qe", },
 	{},
 };
 
arch/powerpc/sysdev/fsl_soc.c +9 -0
index ad31e56..c41b851 100644
@@ -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;
#2 lore raw
Quoted 11 lines · On Wed, 20 Dec 2006 10:00:46 +1100 Benjamin Herrenschmidt…
Quoted 8 lines · Kim Phillips

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).

Big NACK

[this implies a nack on the consolidate 83xx files patch]

Quoted 3 lines

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.

Quoted 2 lines

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?

Quoted 2 lines

Ben.

Kim

#3 lore raw
Quoted 8 lines

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.

#4 lore raw
Quoted 5 lines · Benjamin Herrenschmidt

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.

Quoted 3 lines

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

#5 lore raw
Quoted 4 lines · Scott Wood
Quoted 3 lines · Benjamin Herrenschmidt

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 ?

Quoted 8 lines
Quoted 2 lines

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 :-)

Quoted 2 lines

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.