Skip to contentSkip to conversation

usb: add support for device tree aware EHCI driver

PATCH In review Valentine Barshak 4 participants 6 messages Sep 13, 2007 – Sep 14, 2007

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

PATCH 1/1 usb: add support for device tree aware EHCI driver

Some PowerPC systems have a built-in EHCI controller.
This is a device tree aware version of the EHCI controller driver. Currently it's been tested on the PowerPC 440EPx Sequoia board. Other platforms can be added later.
The code is based on the ehci-ppc-soc driver by Stefan Roese <[email protected]>. The of_platform support is based on ohci-ppc-of driver
by Sylvain Munaut <[email protected]>.

---
 drivers/usb/host/Kconfig       |    8 +
 drivers/usb/host/ehci-hcd.c    |   16 ++
 drivers/usb/host/ehci-ppc-of.c |  251 +++++++++++++++++++++++++++++++++++++++++
 drivers/usb/host/ehci.h        |    2 
 4 files changed, 275 insertions(+), 2 deletions(-)
drivers/usb/host/ehci.h +1 -1
diff -ruN linux-2.6.orig/drivers/usb/host/ehci.h linux-2.6.bld/drivers/usb/host/ehci.h
@@ -725,7 +725,7 @@
  * definition below can die once the 4xx support is
  * finally ported over.
  */
-#if defined(CONFIG_PPC)
+#if defined(CONFIG_PPC) && !defined(CONFIG_PPC_MERGE)
 #define readl_be(addr)		in_be32((__force unsigned *)addr)
 #define writel_be(val, addr)	out_be32((__force unsigned *)addr, val)
 #endif
drivers/usb/host/ehci-hcd.c +15 -1
diff -ruN linux-2.6.orig/drivers/usb/host/ehci-hcd.c linux-2.6.bld/drivers/usb/host/ehci-hcd.c
@@ -944,11 +944,16 @@
 #define	PS3_SYSTEM_BUS_DRIVER	ps3_ehci_driver
 #endif
 
-#ifdef CONFIG_440EPX
+#if defined(CONFIG_440EPX) && !defined(CONFIG_PPC_MERGE)
 #include "ehci-ppc-soc.c"
 #define	PLATFORM_DRIVER		ehci_ppc_soc_driver
 #endif
 
+#ifdef CONFIG_USB_EHCI_HCD_PPC_OF
+#include "ehci-ppc-of.c"
+#define OF_PLATFORM_DRIVER	ehci_hcd_ppc_of_driver
+#endif
+
 #if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) && \
     !defined(PS3_SYSTEM_BUS_DRIVER)
 #error "missing bus glue for ehci-hcd"
@@ -963,6 +968,12 @@
 		 sizeof(struct ehci_qh), sizeof(struct ehci_qtd),
 		 sizeof(struct ehci_itd), sizeof(struct ehci_sitd));
 
+#ifdef OF_PLATFORM_DRIVER
+	retval = of_register_platform_driver(&OF_PLATFORM_DRIVER);
+	if (retval < 0)
+		return retval;
+#endif
+
 #ifdef PLATFORM_DRIVER
 	retval = platform_driver_register(&PLATFORM_DRIVER);
 	if (retval < 0)
@@ -998,6 +1009,9 @@
 
 static void __exit ehci_hcd_cleanup(void)
 {
+#ifdef OF_PLATFORM_DRIVER
+	of_unregister_platform_driver(&OF_PLATFORM_DRIVER);
+#endif
 #ifdef PLATFORM_DRIVER
 	platform_driver_unregister(&PLATFORM_DRIVER);
 #endif
drivers/usb/host/ehci-ppc-of.c +253 -0

253 lines not on this page · raw message

drivers/usb/host/Kconfig +8 -0
diff -ruN linux-2.6.orig/drivers/usb/host/Kconfig linux-2.6.bld/drivers/usb/host/Kconfig
@@ -84,6 +84,14 @@
 	---help---
 	  Variation of ARC USB block used in some Freescale chips.
 
+config USB_EHCI_HCD_PPC_OF
+	bool "EHCI support for PPC USB controller on OF platform bus"
+	depends on USB_EHCI_HCD && PPC_OF
+	default y
+	---help---
+	  Enables support for the USB controller PowerPC present on the
+	  OpenFirmware platform bus.
+
 config USB_ISP116X_HCD
 	tristate "ISP116X HCD support"
 	depends on USB
#1 lore raw
Quoted 7 lines · On Thu, 13 Sep 2007 21:57:02 +0400 Valentine Barshak <[email protected]>…

Some PowerPC systems have a built-in EHCI controller.
This is a device tree aware version of the EHCI controller driver. Currently it's been tested on the PowerPC 440EPx Sequoia board. Other platforms can be added later.
The code is based on the ehci-ppc-soc driver by Stefan Roese <[email protected]>. The of_platform support is based on ohci-ppc-of driver
by Sylvain Munaut <[email protected]>.

Where's the DTS binding for this? It doesn't exist in the current sequoia.dts.

josh

#2 lore raw

PATCH 1/1 PowerPC: usb ehci of_platform bindings for Sequoia 440EPx

EHCI OF bindings for PowerPC 440EPx Sequoia.

---
 arch/powerpc/boot/dts/sequoia.dts |    7 +++++++
 1 files changed, 7 insertions(+)
arch/powerpc/boot/dts/sequoia.dts +7 -0
diff -ruN linux-2.6.orig/arch/powerpc/boot/dts/sequoia.dts linux-2.6.bld/arch/powerpc/boot/dts/sequoia.dts
@@ -122,6 +122,13 @@
 			interrupt-map-mask = <ffffffff>;
 		};
 
+		usb@e0000300 {
+			compatible = "ibm,ehci-440epx", "ehci-be-desc", "ehci-be-mmio";
+			interrupt-parent = <&UIC0>;
+			interrupts = <1a 4>;
+			reg = <0 e0000300 ff>;
+		};
+
 		POB0: opb {
 		  	compatible = "ibm,opb-440epx", "ibm,opb";
 			#address-cells = <1>;
#3 lore raw

Re: [PATCH] PowerPC: usb ehci of_platform bindings for Sequoia 440EPx

Quoted 1 line

EHCI OF bindings for PowerPC 440EPx Sequoia.

Those aren't bindings, they are examples. Bindings are pieces of documentation that describe what device-specific properties mean what, what standard properties are required with what values, etc.

Examples are good to have, of course.

One thing you really need to document is what "ehci-be-desc" and friends mean. I can give you one comment already: for devices that are usually little-endian, but an implementation implements registers as big-endian, precedent is to show that in the device tree by including an (empty) "big-endian" property, rather than inventing new "compatible" values.

Segher

#4 lore raw

Re: [PATCH] PowerPC: usb ehci of_platform bindings for Sequoia 440EPx

Quoted 7 lines · Segher Boessenkool
Quoted 1 line

EHCI OF bindings for PowerPC 440EPx Sequoia.

Those aren't bindings, they are examples. Bindings are pieces of documentation that describe what device-specific properties mean what, what standard properties are required with what values, etc.

Quoted 8 lines

Examples are good to have, of course.

One thing you really need to document is what "ehci-be-desc" and friends mean. I can give you one comment already: for devices that are usually little-endian, but an implementation implements registers as big-endian, precedent is to show that in the device tree by including an (empty) "big-endian" property, rather than inventing new "compatible" values.

I was looking at the ohci-ppc-of driver that has "ohci-bigendian" compatible string and enables both be-mmio and be-desc for the device in this case. I just wanted to separate mmio and desc stuff for ehci, since some devices need be-mmio only. I'll use "big-endian" property instead of "ehci-be-mmio" compatible value. That's a good point, thanks.
Do I have to add "sequoia usb ehci" description to Documentation/powerpc/booting-without-of.txt?
Do I also have to describe ehci-ppc-of stuff in general?
BTW, I see nothing about ohci-ppc-of there.
Thanks,
Valentine.

Quoted 4 lines

Segher

#5 lore raw

Re: [PATCH] PowerPC: usb ehci of_platform bindings for Sequoia 440EPx

Quoted 17 lines · Valentine Barshak
Quoted 7 lines · Segher Boessenkool
Quoted 1 line

EHCI OF bindings for PowerPC 440EPx Sequoia.

Those aren't bindings, they are examples. Bindings are pieces of documentation that describe what device-specific properties mean what, what standard properties are required with what values, etc.

Quoted 8 lines

Examples are good to have, of course.

One thing you really need to document is what "ehci-be-desc" and friends mean. I can give you one comment already: for devices that are usually little-endian, but an implementation implements registers as big-endian, precedent is to show that in the device tree by including an (empty) "big-endian" property, rather than inventing new "compatible" values.

Quoted 10 lines

I was looking at the ohci-ppc-of driver that has "ohci-bigendian" compatible string and enables both be-mmio and be-desc for the device in this case. I just wanted to separate mmio and desc stuff for ehci, since some devices need be-mmio only.
I'll use "big-endian" property instead of "ehci-be-mmio" compatible value. That's a good point, thanks.
Do I have to add "sequoia usb ehci" description to Documentation/powerpc/booting-without-of.txt?
Do I also have to describe ehci-ppc-of stuff in general? BTW, I see nothing about ohci-ppc-of there.

We may need to comprehend the Freescale USB controller since its technically an EHCI controller. There should be some stuff in booting-without-of.txt related to it.

- k