Skip to contentSkip to conversation

Add USB support to mpc8349-mitx board port

PATCH In review Grant Likely 3 participants 8 messages Jul 6, 2007 – Jul 9, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add USB support to mpc8349-mitx board port

From: Grant Likely <[email protected]>

This patch depends on Li Yang's patch: "83xx USB platform code rework"

---

 arch/powerpc/platforms/83xx/mpc834x_itx.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/powerpc/platforms/83xx/mpc834x_itx.c +2 -0
index 40a0194..1ace7ac 100644
@@ -63,6 +63,8 @@ static void __init mpc834x_itx_setup_arch(void)
 
 	ppc_md.pci_exclude_device = mpc83xx_exclude_device;
 #endif
+
+	mpc834x_usb_cfg();
 }
 
 static void __init mpc834x_itx_init_IRQ(void)
#1 lore raw
Quoted 5 lines · Grant Likely
arch/powerpc/platforms/83xx/mpc834x_itx.c +0 -0
@@ -63,6 +63,8 @@ static void __init mpc834x_itx_setup_arch(void)

=A0
=A0=A0=A0=A0=A0=A0=A0=A0ppc_md.pci_exclude_device =3D mpc83xx_exclude_dev=

ice;

Quoted 4 lines

=A0#endif
+
+=A0=A0=A0=A0=A0=A0=A0mpc834x_usb_cfg();
=A0}

Why is that necessary? Shouldn't there be an of_platform_driver that simply does all the setup automatically if the device is present?

	Arnd <><
#2 lore raw
Quoted 5 lines · Arnd Bergmann
Quoted 4 lines · Grant Likely
arch/powerpc/platforms/83xx/mpc834x_itx.c +0 -0
@@ -63,6 +63,8 @@ static void __init mpc834x_itx_setup_arch(void)
 
Quoted 8 lines

arch/powerpc/platforms/83xx/mpc834x_itx.c static void __init mpc834x_itx_setup_arch(void) · line 68

Quoted 5 lines
arch/powerpc/platforms/83xx/mpc834x_itx.c +2 -0
 ppc_md.pci_exclude_device = mpc83xx_exclude_device;
 #endif
+
+mpc834x_usb_cfg();
 }

Why is that necessary? Shouldn't there be an of_platform_driver that simply does all the setup automatically if the device is present?

This call is actually for SoC setup stuff. There are actually 2 USB engines on the SoC, and this call figures out what mode the pins are supposed to be in. I think this stuff firmly falls into the platform setup arena since it is highly chip specific.

You bring up a good point though. The current usb support code in sysdev/fsl_soc.c uses arch_initcall(fsl_usb_of_init) to go searching for USB interfaces in the device tree, which are EHCI (and sometimes OTG) compatible. fsl_usb_of_init calls platform_device_register_simple() for each USB device found which is kind of a round about way of doing things. That should probably be depreciated and an of_platform_device binding should be added to the EHCI driver.

This same comment probably goes for the other arch_initcall functions in fsl_soc.c which do exactly the same thing for other devices.

Cheers,
g.

Signature · 4 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
[email protected]
(403) 399-0195
#3 lore raw
Quoted 30 lines · Grant Likely
Quoted 5 lines · Arnd Bergmann
Quoted 4 lines · Grant Likely
arch/powerpc/platforms/83xx/mpc834x_itx.c +0 -0
@@ -63,6 +63,8 @@ static void __init mpc834x_itx_setup_arch(void)
 
Quoted 8 lines

arch/powerpc/platforms/83xx/mpc834x_itx.c static void __init mpc834x_itx_setup_arch(void) · line 68

Quoted 5 lines
arch/powerpc/platforms/83xx/mpc834x_itx.c +2 -0
 ppc_md.pci_exclude_device = mpc83xx_exclude_device;
 #endif
+
+mpc834x_usb_cfg();
 }

Why is that necessary? Shouldn't there be an of_platform_driver that simply does all the setup automatically if the device is present?

This call is actually for SoC setup stuff. There are actually 2 USB engines on the SoC, and this call figures out what mode the pins are supposed to be in. I think this stuff firmly falls into the platform setup arena since it is highly chip specific.

You bring up a good point though. The current usb support code in sysdev/fsl_soc.c uses arch_initcall(fsl_usb_of_init) to go searching for USB interfaces in the device tree, which are EHCI (and sometimes OTG) compatible. fsl_usb_of_init calls platform_device_register_simple() for each USB device found which is kind of a round about way of doing things. That should probably be depreciated and an of_platform_device binding should be added to the EHCI driver.

Quoted 2 lines

This same comment probably goes for the other arch_initcall functions in fsl_soc.c which do exactly the same thing for other devices.

This depends, some devices in fsl_soc.c may exist on non-powerpc SoCs that do not have OF. The USB core in 8349 for example also is in the arm based mx27 and mx31. These devices should remain platform devices and the glue in fls_soc.c will continure to be needed.

Cheers,

Quoted 12 lines

g.

--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
[email protected]
(403) 399-0195
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev

#4 lore raw
Quoted 7 lines · John Rigby
Quoted 2 lines

This same comment probably goes for the other arch_initcall functions in fsl_soc.c which do exactly the same thing for other devices.

This depends, some devices in fsl_soc.c may exist on non-powerpc SoCs that do not have OF. The USB core in 8349 for example also is in the arm based mx27 and mx31. These devices should remain platform devices and the glue in fls_soc.c will continure to be needed.

I disagree; the current method is "glue for the glue". There is no reason why the driver cannot have two bindings; one for platform_device and one for of_platform_device. It's about the same amount of code, but uses less indirection for the device tree case.

Cheers,
g.

Signature · 4 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
[email protected]
(403) 399-0195
#5 lore raw

I see your point, I agree the two layers of glue is bad. But this means the double code is spread across many drivers instead of being in one place (fsl_soc.c).

Quoted 25 lines · Grant Likely
Quoted 7 lines · John Rigby
Quoted 2 lines

This same comment probably goes for the other arch_initcall functions in fsl_soc.c which do exactly the same thing for other devices.

This depends, some devices in fsl_soc.c may exist on non-powerpc SoCs that do not have OF. The USB core in 8349 for example also is in the arm based mx27 and mx31. These devices should remain platform devices and the glue in fls_soc.c will continure to be needed.

I disagree; the current method is "glue for the glue". There is no reason why the driver cannot have two bindings; one for platform_device and one for of_platform_device. It's about the same amount of code, but uses less indirection for the device tree case.

Cheers,
g.

--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
[email protected]
(403) 399-0195

#6 lore raw
Quoted 3 lines · John Rigby

I see your point, I agree the two layers of glue is bad. But this means the double code is spread across many drivers instead of being in one place (fsl_soc.c).

??? I don't understand what you mean. Are you saying that it's better to have all the OF bindings in one place (fsl_soc.c) instead of with each individual driver?

Cheers,
g.

Signature · 4 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
[email protected]
(403) 399-0195
#7 lore raw

I'm just saying that an argument can be made that having all the OF to non-OF
glue in one place is better than having dual bindings in every driver.

If you count ugliness in terms of file count the fsl_soc.c solution gets a score of 1 and the dual binding solution gets an score of N. Where N is the number of drivers.

John

Quoted 20 lines · Grant Likely
Quoted 3 lines · John Rigby

I see your point, I agree the two layers of glue is bad. But this means the double code is spread across many drivers instead of being in one place (fsl_soc.c).

??? I don't understand what you mean. Are you saying that it's better to have all the OF bindings in one place (fsl_soc.c) instead of with each individual driver?

Cheers,
g.

--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
[email protected]
(403) 399-0195