Skip to contentSkip to conversation

usb: ehci ppc device-tree-aware driver

PATCH In review Valentine Barshak 5 participants 8 messages Sep 24, 2007 – Oct 23, 2007

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

cover usb: ehci ppc device-tree-aware 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]>.

#1 lore raw

PATCH 1/3 usb: add device-tree-aware ehci driver

This adds device-tree-aware ehci-ppc-of driver.
The code is based on the ehci-ppc-soc driver by
Stefan Roese <[email protected]>.

---
 drivers/usb/host/Kconfig       |    8 +
 drivers/usb/host/ehci-hcd.c    |   16 ++
 drivers/usb/host/ehci-ppc-of.c |  243 +++++++++++++++++++++++++++++++++++++++++
 drivers/usb/host/ehci.h        |    2 
 4 files changed, 267 insertions(+), 2 deletions(-)
drivers/usb/host/ehci.h +1 -1
diff -ruN linux-2.6.orig/drivers/usb/host/ehci.h linux-2.6/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/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 +243 -0

243 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/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
#2 lore raw

PATCH 2/3 usb: ehci-ppc-of dts bindings.

In reply to Valentine Barshak

Adds EHCI OF bindings to documentation.

---
 Documentation/powerpc/booting-without-of.txt |   28 +++++++++++++++++++++++++++
 1 files changed, 28 insertions(+)
Documentation/powerpc/booting-without-of.txt +28 -0
diff -ruN linux-2.6.orig/Documentation/powerpc/booting-without-of.txt linux-2.6/Documentation/powerpc/booting-without-of.txt
@@ -52,6 +52,7 @@
       i) Freescale QUICC Engine module (QE)
       j) CFI or JEDEC memory-mapped NOR flash
       k) Global Utilities Block
+      l) USB EHCI controllers
 
   VII - Specifying interrupt information for devices
     1) interrupts property
@@ -1848,6 +1849,33 @@
 		fsl,has-rstcr;
 	};
 
+  l) USB EHCI controllers
+
+  Required properties:
+  - compatible : should be "usb-ehci".
+  - reg : should contain at least address and length of the standard EHCI
+    register set for the device. Optional platform-dependent registers
+    (debug-port or other) can be also specified here, but only after
+    definition of standard EHCI registers.
+  - interrupts : one EHCI interrupt should be described here.
+  If device registers are implemented in big endian mode, the device
+  node should have "big-endian-regs" property.
+  If controller implementation operates with big endian descriptors,
+  "big-endian-desc" property should be specified.
+  If both big endian registers and descriptors are used by the controller
+  implementation, "big-endian" property can be specified instead of having
+  both "big-endian-regs" and "big-endian-desc".
+
+   Example (Sequoia 440EPx):
+	ehci@e0000300 {
+		compatible = "ibm,usb-ehci-440epx", "usb-ehci";
+		interrupt-parent = <&UIC0>;
+		interrupts = <1a 4>;
+		reg = <0 e0000300 90 0 e0000390 70>;
+		big-endian;
+	};
+
+
    More devices will be defined as this spec matures.
 
 VII - Specifying interrupt information for devices
#3 lore raw

PATCH 3/3 Add PowerPC 440EPx Sequoia ehci dts entry

In reply to Valentine Barshak

Adds USB EHCI entry to PowerPC 440EPx Sequoia DTS.

---
 arch/powerpc/boot/dts/sequoia.dts |    8 ++++++++
 1 files changed, 8 insertions(+)
arch/powerpc/boot/dts/sequoia.dts +8 -0
diff -ruN linux-2.6.orig/arch/powerpc/boot/dts/sequoia.dts linux-2.6/arch/powerpc/boot/dts/sequoia.dts
@@ -122,6 +122,14 @@
 			interrupt-map-mask = <ffffffff>;
 		};
 
+		USB0: ehci@e0000300 {
+			compatible = "ibm,usb-ehci-440epx", "usb-ehci";
+			interrupt-parent = <&UIC0>;
+			interrupts = <1a 4>;
+			reg = <0 e0000300 90 0 e0000390 70>;
+			big-endian;
+		};
+
 		POB0: opb {
 		  	compatible = "ibm,opb-440epx", "ibm,opb";
 			#address-cells = <1>;
#4 lore raw
In reply to Valentine Barshak
Quoted 5 lines · Valentine Barshak

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

Do PPC folk sign off on how this is done?

I don't follow all the ins/outs of the OF devtree stuff...

Acked-by
#5 lore raw
Quoted 10 lines · David Brownell
Quoted 5 lines · Valentine Barshak

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

Do PPC folk sign off on how this is done?

I don't follow all the ins/outs of the OF devtree stuff...

The driver looks good to me, both the interaction with the of_platform_bus layer and the handling of I/O addresses. I haven't actually tried running it, but I'm rather confident that if it works on the Sequoia, it should also do the right thing on any other powerpc system that has an EHCI on some other (non-PCI) bus.

Acked-by
#6 lore raw
Quoted 11 lines · Arnd Bergmann
Quoted 3 lines

Do PPC folk sign off on how this is done?

I don't follow all the ins/outs of the OF devtree stuff...

The driver looks good to me, both the interaction with the of_platform_bus layer and the handling of I/O addresses. I haven't actually tried running it, but I'm rather confident that if it works on the Sequoia, it should also do the right thing on any other powerpc system that has an EHCI on some other (non-PCI) bus.

Best regards,
Stefan

#7 lore raw
Quoted 11 lines · On Wed, 10 Oct 2007 10:30:02 +0200 Stefan Roese <[email protected]> wrote:
Quoted 10 lines · Arnd Bergmann
Quoted 3 lines

Do PPC folk sign off on how this is done?

I don't follow all the ins/outs of the OF devtree stuff...

The driver looks good to me, both the interaction with the of_platform_bus layer and the handling of I/O addresses. I haven't actually tried running it, but I'm rather confident that if it works on the Sequoia, it should also do the right thing on any other powerpc system that has an EHCI on some other (non-PCI) bus.

Quoted 3 lines
Quoted 1 line

David, were you going to pull in the echi-ppc-of driver (patch 1 of this series) for 2.6.24? Just trying to figure out if I need to pull the other two patches into my tree.

josh