Skip to contentSkip to conversation

USB EHCI multiplatform series again

PATCH Superseded Arnd Bergmann 6 participants 29 messages Mar 28, 2013 – Apr 1, 2013

Subsystems (4)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#1 lore raw

PATCH v3 1/7 USB: EHCI: make ehci-orion a separate driver

In reply to Arnd Bergmann

From: Manjunath Goudar <[email protected]>

Separate the Orion host controller driver from ehci-hcd host code into its own driver module because of following reason.

With the multiplatform changes in arm-soc tree, it becomes possible to enable the mvebu platform (which uses ehci-orion) at the same time as other platforms that require a conflicting EHCI bus glue. At the moment, this results in a warning like

drivers/usb/host/ehci-hcd.c:1297:0: warning: "PLATFORM_DRIVER" redefined [enabled by default] drivers/usb/host/ehci-hcd.c:1277:0: note: this is the location of the previous definition drivers/usb/host/ehci-orion.c:334:31: warning: 'ehci_orion_driver' defined but not used [-Wunused-variable]

and an ehci driver that only works on one of them.

With the infrastructure added by Alan Stern in patch 3e0232039 "USB: EHCI: prepare to make ehci-hcd a library module", we can avoid this problem by turning a bus glue into a separate module, as we do here for the orion bus glue.

An earlier version of this patch was included in 3.9 but caused a regression there, which has subsequently been fixed.

In V3:
1.More detail provided in commit message regarding this patch. 2.Replaced hcd_name string "ehci-orion" into "orion-ehci". 3.MODULE_LICENSE is GPL v2.
4.In ehci_init_driver calling second argument passed as NULL instead of
ehci_orion_overrides because ehci_orion_overrides is removed.

In V2:
Tegra patch related changes removed from this patch.

---
 drivers/usb/host/Kconfig      | 10 ++++++
 drivers/usb/host/Makefile     |  1 +
 drivers/usb/host/ehci-hcd.c   |  6 +---
 drivers/usb/host/ehci-orion.c | 82 ++++++++++++++++++-------------------------
 4 files changed, 47 insertions(+), 52 deletions(-)
drivers/usb/host/Kconfig +10 -0
index 2f68221..d89b7ad 100644
@@ -163,6 +163,16 @@ config USB_EHCI_HCD_OMAP
 	  Enables support for the on-chip EHCI controller on
 	  OMAP3 and later chips.
 
+config USB_EHCI_HCD_ORION
+	tristate  "Support for Marvell EBU on-chip EHCI USB controller"
+	depends on USB_EHCI_HCD && PLAT_ORION
+	default y
+	---help---
+	  Enables support for the on-chip EHCI controller on Marvell's
+	  embedded ARM SoCs, including Orion, Kirkwood, Dove, Armada XP,
+	  Armada 370.  This is different from the EHCI implementation
+	  on Marvell's mobile PXA and MMP SoC, see USB_EHCI_MV for those.
+
 config USB_EHCI_MSM
 	bool "Support for MSM on-chip EHCI USB controller"
 	depends on USB_EHCI_HCD && ARCH_MSM
drivers/usb/host/Makefile +1 -0
index 56de410..9492f50 100644
@@ -28,6 +28,7 @@ obj-$(CONFIG_USB_EHCI_PCI)	+= ehci-pci.o
 obj-$(CONFIG_USB_EHCI_HCD_PLATFORM)	+= ehci-platform.o
 obj-$(CONFIG_USB_EHCI_MXC)	+= ehci-mxc.o
 obj-$(CONFIG_USB_EHCI_HCD_OMAP)	+= ehci-omap.o
+obj-$(CONFIG_USB_EHCI_HCD_ORION)	+= ehci-orion.o
 
 obj-$(CONFIG_USB_OXU210HP_HCD)	+= oxu210hp-hcd.o
 obj-$(CONFIG_USB_ISP116X_HCD)	+= isp116x-hcd.o
drivers/usb/host/ehci-hcd.c +1 -5
index b12b97d..1f97268 100644
@@ -1249,11 +1249,6 @@ MODULE_LICENSE ("GPL");
 #define XILINX_OF_PLATFORM_DRIVER	ehci_hcd_xilinx_of_driver
 #endif
 
-#ifdef CONFIG_PLAT_ORION
-#include "ehci-orion.c"
-#define	PLATFORM_DRIVER		ehci_orion_driver
-#endif
-
 #ifdef CONFIG_USB_W90X900_EHCI
 #include "ehci-w90x900.c"
 #define	PLATFORM_DRIVER		ehci_hcd_w90x900_driver
@@ -1319,6 +1314,7 @@ MODULE_LICENSE ("GPL");
 	!IS_ENABLED(CONFIG_USB_CHIPIDEA_HOST) && \
 	!IS_ENABLED(CONFIG_USB_EHCI_MXC) && \
 	!IS_ENABLED(CONFIG_USB_EHCI_HCD_OMAP) && \
+	!IS_ENABLED(CONFIG_USB_EHCI_HCD_ORION) && \
 	!defined(PLATFORM_DRIVER) && \
 	!defined(PS3_SYSTEM_BUS_DRIVER) && \
 	!defined(OF_PLATFORM_DRIVER) && \
drivers/usb/host/ehci-orion.c +35 -47

109 lines not on this page · raw message

Signature · 1 line
1.8.1.2
#10 lore raw

PATCH v3 3/7 USB: EHCI: make ehci-s5p a separate driver

In reply to Arnd Bergmann

From: Manjunath Goudar <[email protected]>

Separate the Samsung S5P/EXYNOS host controller driver from ehci-hcd host code so that it can be built as a separate driver module. This work is part of enabling multi-platform kernels on ARM; however, note that other changes are still needed before S5P/EXYNOS can be booted with a multi-platform kernel. We currently expect those to get merged for 3.10.

With the infrastructure added by Alan Stern in patch 3e0232039 "USB: EHCI: prepare to make ehci-hcd a library module", we can avoid this problem by turning a bus glue into a separate module, as we do here for the s5p bus glue.

In V3:
-Detail commit message added here,why this patch is required.
-MODULE_LICENSE is GPL v2.
-Added .extra_priv_size to eliminate the separate allocation of the s5p_ehci_hcd structure
and removed .reset function pointer initialization.
-Arranged #include's in alphabetical order.
-After using extra_priv_size initialization,struct usb_hcd *hcd is redundant that's why removed
from the prob function.
-Eliminated s5p_ehci_phy_enable,contents of statements moved into the s5p_ehci_probe -Eliminated s5p_ehci_phy_disable, contents of statements moved into the s5p_ehci_remove.

In V2:
Tegra patch related changes removed from this patch.

---
 drivers/usb/host/Kconfig    |   5 +-
 drivers/usb/host/Makefile   |   1 +
 drivers/usb/host/ehci-hcd.c |   6 +-
 drivers/usb/host/ehci-s5p.c | 153 ++++++++++++++++++++++----------------------
 4 files changed, 82 insertions(+), 83 deletions(-)
drivers/usb/host/Kconfig +3 -2
index 12fb83e..01c1acb 100644
@@ -218,10 +218,11 @@ config USB_EHCI_SH
 	  If you use the PCI EHCI controller, this option is not necessary.
 
 config USB_EHCI_S5P
-       boolean "S5P EHCI support"
+       tristate "EHCI support for Samsung S5P/EXYNOS SoC Series"
        depends on USB_EHCI_HCD && PLAT_S5P
        help
-	 Enable support for the S5P SOC's on-chip EHCI controller.
+	Enable support for the Samsung S5Pxxxx and Exynos3/4/5 SOC's
+	on-chip EHCI controller.
 
 config USB_EHCI_MV
 	bool "EHCI support for Marvell on-chip controller"
drivers/usb/host/Makefile +1 -0
index 3e02471..3d895b5 100644
@@ -30,6 +30,7 @@ obj-$(CONFIG_USB_EHCI_MXC)	+= ehci-mxc.o
 obj-$(CONFIG_USB_EHCI_HCD_OMAP)	+= ehci-omap.o
 obj-$(CONFIG_USB_EHCI_HCD_ORION)	+= ehci-orion.o
 obj-$(CONFIG_USB_EHCI_HCD_SPEAR)	+= ehci-spear.o
+obj-$(CONFIG_USB_EHCI_S5P)	+= ehci-s5p.o
 
 obj-$(CONFIG_USB_OXU210HP_HCD)	+= oxu210hp-hcd.o
 obj-$(CONFIG_USB_ISP116X_HCD)	+= isp116x-hcd.o
drivers/usb/host/ehci-hcd.c +1 -5
index c8c70a1..8f1f4b4 100644
@@ -1284,11 +1284,6 @@ MODULE_LICENSE ("GPL");
 #define PLATFORM_DRIVER		tegra_ehci_driver
 #endif
 
-#ifdef CONFIG_USB_EHCI_S5P
-#include "ehci-s5p.c"
-#define PLATFORM_DRIVER		s5p_ehci_driver
-#endif
-
 #ifdef CONFIG_SPARC_LEON
 #include "ehci-grlib.c"
 #define PLATFORM_DRIVER		ehci_grlib_driver
@@ -1311,6 +1306,7 @@ MODULE_LICENSE ("GPL");
 	!IS_ENABLED(CONFIG_USB_EHCI_HCD_OMAP) && \
 	!IS_ENABLED(CONFIG_USB_EHCI_HCD_ORION) && \
 	!IS_ENABLED(CONFIG_USB_EHCI_HCD_SPEAR) && \
+	!IS_ENABLED(CONFIG_USB_EHCI_S5P) && \
 	!defined(PLATFORM_DRIVER) && \
 	!defined(PS3_SYSTEM_BUS_DRIVER) && \
 	!defined(OF_PLATFORM_DRIVER) && \
drivers/usb/host/ehci-s5p.c +77 -76

256 lines not on this page · raw message

Signature · 1 line
1.8.1.2
#4 lore raw

PATCH v3 2/7 USB: EHCI: make ehci-spear a separate driver

In reply to Arnd Bergmann

From: Manjunath Goudar <[email protected]>

Separate the SPEAr host controller driver from ehci-hcd host code so that it can be built as a separate driver module.
This work is part of enabling multi-platform kernels on ARM; however, note that other changes are still needed before SPEAr can be booted with a multi-platform kernel, but they are queued in the arm-soc tree for 3.10.

With the infrastructure added by Alan Stern in patch 3e0232039 "USB: EHCI: prepare to make ehci-hcd a library module", we can avoid this problem by turning a bus glue into a separate module, as we do here for the SPEAr bus glue.

In V3:
-Detailed commit message added here about why this patch is required. -Eliminated ehci_spear_setup routine beacuse hcd registers
directly setting in spear_ehci_hcd_drv_probe function.
-spear_overrides struct initialized.
-Eliminate struct ehci_hcd ehci from struct spear_ehci,to enable SPEAr clock
uses directly usb_hcd *hcd in spear_start_ehci function.
-to_spear_ehci() macro modified for spear_ehci.

In V2:
Replaced spear as SPEAr everywhere, leaving functions/variables/config options.

---
 drivers/usb/host/Kconfig      |  8 ++++
 drivers/usb/host/Makefile     |  1 +
 drivers/usb/host/ehci-hcd.c   |  6 +--
 drivers/usb/host/ehci-spear.c | 88 ++++++++++++++++++++-----------------------
 4 files changed, 51 insertions(+), 52 deletions(-)
drivers/usb/host/Kconfig +8 -0
index d89b7ad..12fb83e 100644
@@ -173,6 +173,14 @@ config USB_EHCI_HCD_ORION
 	  Armada 370.  This is different from the EHCI implementation
 	  on Marvell's mobile PXA and MMP SoC, see USB_EHCI_MV for those.
 
+config USB_EHCI_HCD_SPEAR
+        tristate "Support for ST SPEAr on-chip EHCI USB controller"
+        depends on USB_EHCI_HCD && PLAT_SPEAR
+        default y
+        ---help---
+          Enables support for the on-chip EHCI controller on
+          ST SPEAr chips.
+
 config USB_EHCI_MSM
 	bool "Support for MSM on-chip EHCI USB controller"
 	depends on USB_EHCI_HCD && ARCH_MSM
drivers/usb/host/Makefile +1 -0
index 9492f50..3e02471 100644
@@ -29,6 +29,7 @@ obj-$(CONFIG_USB_EHCI_HCD_PLATFORM)	+= ehci-platform.o
 obj-$(CONFIG_USB_EHCI_MXC)	+= ehci-mxc.o
 obj-$(CONFIG_USB_EHCI_HCD_OMAP)	+= ehci-omap.o
 obj-$(CONFIG_USB_EHCI_HCD_ORION)	+= ehci-orion.o
+obj-$(CONFIG_USB_EHCI_HCD_SPEAR)	+= ehci-spear.o
 
 obj-$(CONFIG_USB_OXU210HP_HCD)	+= oxu210hp-hcd.o
 obj-$(CONFIG_USB_ISP116X_HCD)	+= isp116x-hcd.o
drivers/usb/host/ehci-hcd.c +1 -5
index 1f97268..c8c70a1 100644
@@ -1264,11 +1264,6 @@ MODULE_LICENSE ("GPL");
 #define PLATFORM_DRIVER		ehci_octeon_driver
 #endif
 
-#ifdef CONFIG_PLAT_SPEAR
-#include "ehci-spear.c"
-#define PLATFORM_DRIVER		spear_ehci_hcd_driver
-#endif
-
 #ifdef CONFIG_USB_EHCI_MSM
 #include "ehci-msm.c"
 #define PLATFORM_DRIVER		ehci_msm_driver
@@ -1315,6 +1310,7 @@ MODULE_LICENSE ("GPL");
 	!IS_ENABLED(CONFIG_USB_EHCI_MXC) && \
 	!IS_ENABLED(CONFIG_USB_EHCI_HCD_OMAP) && \
 	!IS_ENABLED(CONFIG_USB_EHCI_HCD_ORION) && \
+	!IS_ENABLED(CONFIG_USB_EHCI_HCD_SPEAR) && \
 	!defined(PLATFORM_DRIVER) && \
 	!defined(PS3_SYSTEM_BUS_DRIVER) && \
 	!defined(OF_PLATFORM_DRIVER) && \
drivers/usb/host/ehci-spear.c +41 -47

123 lines not on this page · raw message

Signature · 1 line
1.8.1.2
#25 lore raw

PATCH v3 7/7 USB: OHCI: avoid conflicting platform drivers

In reply to Arnd Bergmann

Like the EHCI driver, OHCI supports a large number of different platform glue drivers by directly including them, which causes problems with conflicting macro definitions in some cases. As more ARM architecture specific back-ends are required to coexist in a single build, we should split those out into separate drivers. Unfortunately, the infrastructure for that is still under development, so to give us more time, this uses a separate *_PLATFORM_DRIVER macro for each ARM specific OHCI backend, just like we already do on PowerPC and some of the other ARM platforms.

In linux-3.10, only the SPEAr and CNS3xxx back-ends would actually conflict without this patch, but over time we would get more of them, so this is a way to avoid having to patch the driver every time it breaks. We should still split out all back-ends into separate loadable modules, but that work is only needed to improve code size and cleanliness after this patch, not for correctness.

While we're here, this fixes the incorrectly sorted error path for the OMAP1 and OMAP3 backends to ensure we always unregister the exact set of drivers that were registered before erroring out.

---
 drivers/usb/host/ohci-hcd.c | 136 ++++++++++++++++++++++++++++++++++++++------
 1 file changed, 118 insertions(+), 18 deletions(-)
drivers/usb/host/ohci-hcd.c +118 -18
index 180a2b0..9e6de95 100644
@@ -1102,12 +1102,12 @@ MODULE_LICENSE ("GPL");
 
 #if defined(CONFIG_ARCH_S3C24XX) || defined(CONFIG_ARCH_S3C64XX)
 #include "ohci-s3c2410.c"
-#define PLATFORM_DRIVER		ohci_hcd_s3c2410_driver
+#define S3C2410_PLATFORM_DRIVER	ohci_hcd_s3c2410_driver
 #endif
 
 #ifdef CONFIG_USB_OHCI_EXYNOS
 #include "ohci-exynos.c"
-#define PLATFORM_DRIVER		exynos_ohci_driver
+#define EXYNOS_PLATFORM_DRIVER	exynos_ohci_driver
 #endif
 
 #ifdef CONFIG_USB_OHCI_HCD_OMAP1
@@ -1127,25 +1127,24 @@ MODULE_LICENSE ("GPL");
 
 #ifdef CONFIG_ARCH_EP93XX
 #include "ohci-ep93xx.c"
-#define PLATFORM_DRIVER		ohci_hcd_ep93xx_driver
+#define EP93XX_PLATFORM_DRIVER	ohci_hcd_ep93xx_driver
 #endif
 
 #ifdef CONFIG_ARCH_AT91
 #include "ohci-at91.c"
-#define PLATFORM_DRIVER		ohci_hcd_at91_driver
+#define AT91_PLATFORM_DRIVER	ohci_hcd_at91_driver
 #endif
 
 #ifdef CONFIG_ARCH_LPC32XX
 #include "ohci-nxp.c"
-#define PLATFORM_DRIVER		usb_hcd_nxp_driver
+#define NXP_PLATFORM_DRIVER	usb_hcd_nxp_driver
 #endif
 
 #ifdef CONFIG_ARCH_DAVINCI_DA8XX
 #include "ohci-da8xx.c"
-#define PLATFORM_DRIVER		ohci_hcd_da8xx_driver
+#define DAVINCI_PLATFORM_DRIVER	ohci_hcd_da8xx_driver
 #endif
 
-
 #ifdef CONFIG_USB_OHCI_HCD_PPC_OF
 #include "ohci-ppc-of.c"
 #define OF_PLATFORM_DRIVER	ohci_hcd_ppc_of_driver
@@ -1153,7 +1152,7 @@ MODULE_LICENSE ("GPL");
 
 #ifdef CONFIG_PLAT_SPEAR
 #include "ohci-spear.c"
-#define PLATFORM_DRIVER		spear_ohci_hcd_driver
+#define SPEAR_PLATFORM_DRIVER	spear_ohci_hcd_driver
 #endif
 
 #ifdef CONFIG_PPC_PS3
@@ -1199,7 +1198,14 @@ MODULE_LICENSE ("GPL");
 	!defined(SA1111_DRIVER) &&	\
 	!defined(PS3_SYSTEM_BUS_DRIVER) && \
 	!defined(SM501_OHCI_DRIVER) && \
-	!defined(TMIO_OHCI_DRIVER)
+	!defined(TMIO_OHCI_DRIVER) && \
+	!defined(S3C2410_PLATFORM_DRIVER) && \
+	!defined(EXYNOS_PLATFORM_DRIVER) && \
+	!defined(EP93XX_PLATFORM_DRIVER) && \
+	!defined(AT91_PLATFORM_DRIVER) && \
+	!defined(NXP_PLATFORM_DRIVER) && \
+	!defined(DAVINCI_PLATFORM_DRIVER) && \
+	!defined(SPEAR_PLATFORM_DRIVER)
 #error "missing bus glue for ohci-hcd"
 #endif
 
@@ -1277,9 +1283,79 @@ static int __init ohci_hcd_mod_init(void)
 		goto error_tmio;
 #endif
 
+#ifdef S3C2410_PLATFORM_DRIVER
+	retval = platform_driver_register(&S3C2410_PLATFORM_DRIVER);
+	if (retval < 0)
+		goto error_s3c2410;
+#endif
+
+#ifdef EXYNOS_PLATFORM_DRIVER
+	retval = platform_driver_register(&EXYNOS_PLATFORM_DRIVER);
+	if (retval < 0)
+		goto error_exynos;
+#endif
+
+#ifdef EP93XX_PLATFORM_DRIVER
+	retval = platform_driver_register(&EP93XX_PLATFORM_DRIVER);
+	if (retval < 0)
+		goto error_ep93xx;
+#endif
+
+#ifdef AT91_PLATFORM_DRIVER
+	retval = platform_driver_register(&AT91_PLATFORM_DRIVER);
+	if (retval < 0)
+		goto error_at91;
+#endif
+
+#ifdef NXP_PLATFORM_DRIVER
+	retval = platform_driver_register(&NXP_PLATFORM_DRIVER);
+	if (retval < 0)
+		goto error_nxp;
+#endif
+
+#ifdef DAVINCI_PLATFORM_DRIVER
+	retval = platform_driver_register(&DAVINCI_PLATFORM_DRIVER);
+	if (retval < 0)
+		goto error_davinci;
+#endif
+
+#ifdef SPEAR_PLATFORM_DRIVER
+	retval = platform_driver_register(&SPEAR_PLATFORM_DRIVER);
+	if (retval < 0)
+		goto error_spear;
+#endif
+
 	return retval;
 
 	/* Error path */
+#ifdef SPEAR_PLATFORM_DRIVER
+	platform_driver_unregister(&SPEAR_PLATFORM_DRIVER);
+ error_spear:
+#endif
+#ifdef DAVINCI_PLATFORM_DRIVER
+	platform_driver_unregister(&DAVINCI_PLATFORM_DRIVER);
+ error_davinci:
+#endif
+#ifdef NXP_PLATFORM_DRIVER
+	platform_driver_unregister(&NXP_PLATFORM_DRIVER);
+ error_nxp:
+#endif
+#ifdef AT91_PLATFORM_DRIVER
+	platform_driver_unregister(&AT91_PLATFORM_DRIVER);
+ error_at91:
+#endif
+#ifdef EP93XX_PLATFORM_DRIVER
+	platform_driver_unregister(&EP93XX_PLATFORM_DRIVER);
+ error_ep93xx:
+#endif
+#ifdef EXYNOS_PLATFORM_DRIVER
+	platform_driver_unregister(&EXYNOS_PLATFORM_DRIVER);
+ error_exynos:
+#endif
+#ifdef S3C2410_PLATFORM_DRIVER
+	platform_driver_unregister(&S3C2410_PLATFORM_DRIVER);
+ error_s3c2410:
+#endif
 #ifdef TMIO_OHCI_DRIVER
 	platform_driver_unregister(&TMIO_OHCI_DRIVER);
  error_tmio:
@@ -1300,17 +1376,17 @@ static int __init ohci_hcd_mod_init(void)
 	platform_driver_unregister(&OF_PLATFORM_DRIVER);
  error_of_platform:
 #endif
-#ifdef PLATFORM_DRIVER
-	platform_driver_unregister(&PLATFORM_DRIVER);
- error_platform:
+#ifdef OMAP3_PLATFORM_DRIVER
+	platform_driver_unregister(&OMAP3_PLATFORM_DRIVER);
+ error_omap3_platform:
 #endif
 #ifdef OMAP1_PLATFORM_DRIVER
 	platform_driver_unregister(&OMAP1_PLATFORM_DRIVER);
  error_omap1_platform:
 #endif
-#ifdef OMAP3_PLATFORM_DRIVER
-	platform_driver_unregister(&OMAP3_PLATFORM_DRIVER);
- error_omap3_platform:
+#ifdef PLATFORM_DRIVER
+	platform_driver_unregister(&PLATFORM_DRIVER);
+ error_platform:
 #endif
 #ifdef PS3_SYSTEM_BUS_DRIVER
 	ps3_ohci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
@@ -1329,6 +1405,27 @@ module_init(ohci_hcd_mod_init);
 
 static void __exit ohci_hcd_mod_exit(void)
 {
+#ifdef SPEAR_PLATFORM_DRIVER
+	platform_driver_unregister(&SPEAR_PLATFORM_DRIVER);
+#endif
+#ifdef DAVINCI_PLATFORM_DRIVER
+	platform_driver_unregister(&DAVINCI_PLATFORM_DRIVER);
+#endif
+#ifdef NXP_PLATFORM_DRIVER
+	platform_driver_unregister(&NXP_PLATFORM_DRIVER);
+#endif
+#ifdef AT91_PLATFORM_DRIVER
+	platform_driver_unregister(&AT91_PLATFORM_DRIVER);
+#endif
+#ifdef EP93XX_PLATFORM_DRIVER
+	platform_driver_unregister(&EP93XX_PLATFORM_DRIVER);
+#endif
+#ifdef EXYNOS_PLATFORM_DRIVER
+	platform_driver_unregister(&EXYNOS_PLATFORM_DRIVER);
+#endif
+#ifdef S3C2410_PLATFORM_DRIVER
+	platform_driver_unregister(&S3C2410_PLATFORM_DRIVER);
+#endif
 #ifdef TMIO_OHCI_DRIVER
 	platform_driver_unregister(&TMIO_OHCI_DRIVER);
 #endif
@@ -1344,12 +1441,15 @@ static void __exit ohci_hcd_mod_exit(void)
 #ifdef OF_PLATFORM_DRIVER
 	platform_driver_unregister(&OF_PLATFORM_DRIVER);
 #endif
-#ifdef PLATFORM_DRIVER
-	platform_driver_unregister(&PLATFORM_DRIVER);
-#endif
 #ifdef OMAP3_PLATFORM_DRIVER
 	platform_driver_unregister(&OMAP3_PLATFORM_DRIVER);
 #endif
+#ifdef OMAP1_PLATFORM_DRIVER
+	platform_driver_unregister(&OMAP1_PLATFORM_DRIVER);
+#endif
+#ifdef PLATFORM_DRIVER
+	platform_driver_unregister(&PLATFORM_DRIVER);
+#endif
 #ifdef PS3_SYSTEM_BUS_DRIVER
 	ps3_ohci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
 #endif
Signature · 1 line
1.8.1.2
#0 lore raw

v3 cover USB EHCI multiplatform series again

Hi Alan,

These are the current patches from Manjunath, after I helped him address the remaining review comments and found a few more in the process.

Unfortunately, Manjunath is currently on vacation and I will be away for the next couple of days when he returns, so I took the liberty to send the patches myself to have a chance of getting them merged in time for 3.10.

The patches are all based on today's usb-next branch, which includes my earlier patch to remove the vt8500 backend. They are sorted by
priority: the first one obviously should have been in 3.9 but didn't make it. The second one will be needed in 3.10, and the third one quite likely as well. The atmel and msm patches can wait for 3.11 since we don't plan to have multiplatform support for those SoCs in 3.10. Manjunath also did patches for the tegra, mv and w90X900 back-ends, but there are still known bugs in them so we don't submit them yet. Tegra might become multiplatform in 3.10, but that will still work as long as it's the only platform defining the PLATFORM_DRIVER macro.

Please review the latest version so we can get at least the first three patches merged for 3.10, or more if you are happy with them. I'm not sure what to do about OHCI, the last patch in this series is the best I could think of, given that nobody has worked on a proper series.

Nicolas and David: the at91 and msm patches have no maintainer Ack so far and are build-tested only. Please let us know if you want to get them merged for 3.10, or if we should drop them for now and let you pick them up when you get around to adding multiplatform support for your SoCs. The at91 patch requires "USB: EHCI: export ehci_shutdown", which will also be needed for the upcoming Tegra patch.

Arnd

Arnd Bergmann (2):
USB: EHCI: export ehci_shutdown
USB: OHCI: avoid conflicting platform drivers

Manjunath Goudar (5):
USB: EHCI: make ehci-orion a separate driver
USB: EHCI: make ehci-spear a separate driver
USB: EHCI: make ehci-s5p a separate driver
USB: EHCI: make ehci-atmel a separate driver
USB: EHCI: make ehci-msm a separate driver

 drivers/usb/host/Kconfig      |  33 ++++++++-
 drivers/usb/host/Makefile     |   5 ++
 drivers/usb/host/ehci-atmel.c |  85 +++++++++++------------
 drivers/usb/host/ehci-hcd.c   |  33 ++-------
 drivers/usb/host/ehci-msm.c   |  85 ++++++++++-------------
 drivers/usb/host/ehci-orion.c |  82 ++++++++++------------
 drivers/usb/host/ehci-s5p.c   | 153 +++++++++++++++++++++---------------------
 drivers/usb/host/ehci-spear.c |  88 +++++++++++-------------
 drivers/usb/host/ehci.h       |   1 +
 drivers/usb/host/ohci-hcd.c   | 136 ++++++++++++++++++++++++++++++++-----
 10 files changed, 391 insertions(+), 310 deletions(-)
Cc Alan Stern <[email protected]>
Cc Bryan Huntsman <[email protected]>
Cc David Brown <[email protected]>
Cc Greg KH <[email protected]>
Cc Jean-Christophe Plagniol-Villard <[email protected]>
Cc Kukjin Kim <[email protected]>
Cc Kyungmin Park <[email protected]>
Cc Manjunath Goudar <[email protected]>
Cc Nicolas Ferre <[email protected]>
Cc Shiraz Hashim <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc linux-kernel at vger.kernel.org
Cc linux-usb at vger.kernel.org
Cc spear-devel at list.st.com
Signature · 1 line
1.8.1.2
#13 lore raw

PATCH v3 4/7 USB: EHCI: export ehci_shutdown

The ehci_shutdown function is used by the platform specific ehci backends for at91, tegra and ps3. In order to turn any of these into separate modules, we need to make this function globally visible and export it.

Cc Greg KH <[email protected]>
Cc Alan Stern <[email protected]>
Cc linux-usb at vger.kernel.org
---
 drivers/usb/host/ehci-hcd.c | 3 ++-
 drivers/usb/host/ehci.h     | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/usb/host/ehci-hcd.c +2 -1
index 8f1f4b4..1c9aa17 100644
@@ -353,7 +353,7 @@ static void ehci_silence_controller(struct ehci_hcd *ehci)
  * This forcibly disables dma and IRQs, helping kexec and other cases
  * where the next system software may expect clean state.
  */
-static void ehci_shutdown(struct usb_hcd *hcd)
+void ehci_shutdown(struct usb_hcd *hcd)
 {
 	struct ehci_hcd	*ehci = hcd_to_ehci(hcd);
 
@@ -367,6 +367,7 @@ static void ehci_shutdown(struct usb_hcd *hcd)
 
 	hrtimer_cancel(&ehci->hrtimer);
 }
+EXPORT_SYMBOL_GPL(ehci_shutdown);
 
 /*-------------------------------------------------------------------------*/
 
drivers/usb/host/ehci.h +1 -0
index e666999..915739d 100644
@@ -799,6 +799,7 @@ struct ehci_driver_overrides {
 extern void	ehci_init_driver(struct hc_driver *drv,
 				const struct ehci_driver_overrides *over);
 extern int	ehci_setup(struct usb_hcd *hcd);
+extern void	ehci_shutdown(struct usb_hcd *hcd);
 
 #ifdef CONFIG_PM
 extern int	ehci_suspend(struct usb_hcd *hcd, bool do_wakeup);
Signature · 1 line
1.8.1.2
#17 lore raw

PATCH v3 5/7 USB: EHCI: make ehci-atmel a separate driver

In reply to Arnd Bergmann

From: Manjunath Goudar <[email protected]>

Separate the Atmel host controller driver from ehci-hcd host code so that it can be built as a separate driver module.
This work is part of enabling multi-platform kernels on ARM; however, note that other changes are still needed before Atmel can be booted with a multi-platform kernel. This is currently planned for Linux-3.11.

With the infrastructure added by Alan Stern in patch 3e0232039 "USB: EHCI: prepare to make ehci-hcd a library module", we can avoid this problem by turning a bus glue into a separate module, as we do here for the Atmel bus glue.

In V3:
-Detailed commit message added here about why this patch is required.
-Replaced hcd_name string "ehci-atmel" to "atmel-ehci".
-In Makefile inserted Blank line that separates the EHCI drivers from the following non-EHCI drivers. -Export ehci_shutdown symbol as it is needed by the Atmel driver.
-Eliminated ehci_atmel_setup routine beacuse hcd registers
directly setting in ehci_atmel_drv_probe function.

In V2:
Resolved below compiler error.
drivers/usb/host/ehci-atmel.c: In function 'ehci_atmel_drv_remove':
drivers/usb/host/ehci-atmel.c:167: error: implicit declaration of function 'ehci_shutdown'

Cc Alan Stern <[email protected]>
Cc Greg KH <[email protected]>
Cc Andrew Victor <[email protected]>
Cc Nicolas Ferre <[email protected]>
Cc Jean-Christophe Plagniol-Villard <[email protected]>
Cc linux-usb at vger.kernel.org
Cc linux-kernel at vger.kernel.org
---
 drivers/usb/host/Kconfig      |  8 ++++
 drivers/usb/host/Makefile     |  1 +
 drivers/usb/host/ehci-atmel.c | 85 ++++++++++++++++++++-----------------------
 drivers/usb/host/ehci-hcd.c   |  6 +--
 4 files changed, 50 insertions(+), 50 deletions(-)
drivers/usb/host/Kconfig +8 -0
index 01c1acb..8c564aa 100644
@@ -181,6 +181,14 @@ config USB_EHCI_HCD_SPEAR
           Enables support for the on-chip EHCI controller on
           ST SPEAr chips.
 
+config USB_EHCI_HCD_AT91
+        tristate  "Support for Atmel on-chip EHCI USB controller"
+        depends on USB_EHCI_HCD && ARCH_AT91
+        default y
+        ---help---
+          Enables support for the on-chip EHCI controller on
+          Atmel chips.
+
 config USB_EHCI_MSM
 	bool "Support for MSM on-chip EHCI USB controller"
 	depends on USB_EHCI_HCD && ARCH_MSM
drivers/usb/host/Makefile +1 -0
index 3d895b5..368d3eb 100644
@@ -31,6 +31,7 @@ obj-$(CONFIG_USB_EHCI_HCD_OMAP)	+= ehci-omap.o
 obj-$(CONFIG_USB_EHCI_HCD_ORION)	+= ehci-orion.o
 obj-$(CONFIG_USB_EHCI_HCD_SPEAR)	+= ehci-spear.o
 obj-$(CONFIG_USB_EHCI_S5P)	+= ehci-s5p.o
+obj-$(CONFIG_USB_EHCI_HCD_AT91) += ehci-atmel.o
 
 obj-$(CONFIG_USB_OXU210HP_HCD)	+= oxu210hp-hcd.o
 obj-$(CONFIG_USB_ISP116X_HCD)	+= isp116x-hcd.o
drivers/usb/host/ehci-atmel.c +40 -45

112 lines not on this page · raw message

drivers/usb/host/ehci-hcd.c +1 -5
index 1c9aa17..efc641c 100644
@@ -1255,11 +1255,6 @@ MODULE_LICENSE ("GPL");
 #define	PLATFORM_DRIVER		ehci_hcd_w90x900_driver
 #endif
 
-#ifdef CONFIG_ARCH_AT91
-#include "ehci-atmel.c"
-#define	PLATFORM_DRIVER		ehci_atmel_driver
-#endif
-
 #ifdef CONFIG_USB_OCTEON_EHCI
 #include "ehci-octeon.c"
 #define PLATFORM_DRIVER		ehci_octeon_driver
@@ -1308,6 +1303,7 @@ MODULE_LICENSE ("GPL");
 	!IS_ENABLED(CONFIG_USB_EHCI_HCD_ORION) && \
 	!IS_ENABLED(CONFIG_USB_EHCI_HCD_SPEAR) && \
 	!IS_ENABLED(CONFIG_USB_EHCI_S5P) && \
+	!IS_ENABLED(CONFIG_USB_EHCI_HCD_AT91) && \
 	!defined(PLATFORM_DRIVER) && \
 	!defined(PS3_SYSTEM_BUS_DRIVER) && \
 	!defined(OF_PLATFORM_DRIVER) && \
Signature · 1 line
1.8.1.2
#21 lore raw

PATCH v3 6/7 USB: EHCI: make ehci-msm a separate driver

In reply to Arnd Bergmann

From: Manjunath Goudar <[email protected]>

Separate the Qualcomm QSD/MSM on-chip host controller driver from ehci-hcd host code so that it can be built as a separate driver module. This work is part of enabling multi-platform kernels on ARM; however, note that other changes are still needed before Qualcomm QSD/MSM can be booted with a multi-platform kernel, which is not expected before 3.11.

With the infrastructure added by Alan Stern in patch 3e0232039 "USB: EHCI: prepare to make ehci-hcd a library module", we can avoid this problem by turning a bus glue into a separate module, as we do here for the msm bus glue.

In V3:
1.Detail commit message added here,why this patch is required.
2.Arranged #include's in alphabetical order.
3.drive.name initialized hcd_name[] = "ehci-msm" in platform_driver structure initialization
instead of "msm-ehci",that is reason it was breaking in EHCI USB testing.this one fixed in V3.

In V2:
Tegra patch related changes removed from this patch.

Cc Greg KH <[email protected]>
Cc Alan Stern <[email protected]>
Cc David Brown <[email protected]>
Cc Daniel Walker <[email protected]>
Cc Bryan Huntsman <[email protected]>
Cc Brian Swetland <[email protected]>
Cc linux-usb at vger.kernel.org
Cc linux-kernel at vger.kernel.org
---
 drivers/usb/host/Kconfig    |  2 +-
 drivers/usb/host/Makefile   |  1 +
 drivers/usb/host/ehci-hcd.c |  6 +---
 drivers/usb/host/ehci-msm.c | 85 ++++++++++++++++++++-------------------------
 4 files changed, 40 insertions(+), 54 deletions(-)
drivers/usb/host/Kconfig +1 -1
index 8c564aa..35a5d3b 100644
@@ -190,7 +190,7 @@ config USB_EHCI_HCD_AT91
           Atmel chips.
 
 config USB_EHCI_MSM
-	bool "Support for MSM on-chip EHCI USB controller"
+	tristate "Support for Qualcomm QSD/MSM on-chip EHCI USB controller"
 	depends on USB_EHCI_HCD && ARCH_MSM
 	select USB_EHCI_ROOT_HUB_TT
 	select USB_MSM_OTG
drivers/usb/host/Makefile +1 -0
index 368d3eb..4fb73c1 100644
@@ -32,6 +32,7 @@ obj-$(CONFIG_USB_EHCI_HCD_ORION)	+= ehci-orion.o
 obj-$(CONFIG_USB_EHCI_HCD_SPEAR)	+= ehci-spear.o
 obj-$(CONFIG_USB_EHCI_S5P)	+= ehci-s5p.o
 obj-$(CONFIG_USB_EHCI_HCD_AT91) += ehci-atmel.o
+obj-$(CONFIG_USB_EHCI_MSM)	+= ehci-msm.o
 
 obj-$(CONFIG_USB_OXU210HP_HCD)	+= oxu210hp-hcd.o
 obj-$(CONFIG_USB_ISP116X_HCD)	+= isp116x-hcd.o
drivers/usb/host/ehci-hcd.c +1 -5
index efc641c..d5c4ae8 100644
@@ -1260,11 +1260,6 @@ MODULE_LICENSE ("GPL");
 #define PLATFORM_DRIVER		ehci_octeon_driver
 #endif
 
-#ifdef CONFIG_USB_EHCI_MSM
-#include "ehci-msm.c"
-#define PLATFORM_DRIVER		ehci_msm_driver
-#endif
-
 #ifdef CONFIG_TILE_USB
 #include "ehci-tilegx.c"
 #define	PLATFORM_DRIVER		ehci_hcd_tilegx_driver
@@ -1304,6 +1299,7 @@ MODULE_LICENSE ("GPL");
 	!IS_ENABLED(CONFIG_USB_EHCI_HCD_SPEAR) && \
 	!IS_ENABLED(CONFIG_USB_EHCI_S5P) && \
 	!IS_ENABLED(CONFIG_USB_EHCI_HCD_AT91) && \
+	!IS_ENABLED(CONFIG_USB_EHCI_MSM) && \
 	!defined(PLATFORM_DRIVER) && \
 	!defined(PS3_SYSTEM_BUS_DRIVER) && \
 	!defined(OF_PLATFORM_DRIVER) && \
drivers/usb/host/ehci-msm.c +37 -48

108 lines not on this page · raw message

Signature · 1 line
1.8.1.2
#5 lore raw

Re: [PATCH v3 2/7] USB: EHCI: make ehci-spear a separate driver

In reply to Arnd Bergmann
Quoted 23 lines · Arnd Bergmann

From: Manjunath Goudar <[email protected]>

Separate the SPEAr host controller driver from ehci-hcd host code so that it can be built as a separate driver module.
This work is part of enabling multi-platform kernels on ARM; however, note that other changes are still needed before SPEAr can be booted with a multi-platform kernel, but they are queued in the arm-soc tree for 3.10.

With the infrastructure added by Alan Stern in patch 3e0232039 "USB: EHCI: prepare to make ehci-hcd a library module", we can avoid this problem by turning a bus glue into a separate module, as we do here for the SPEAr bus glue.

In V3:
-Detailed commit message added here about why this patch is required. -Eliminated ehci_spear_setup routine beacuse hcd registers
directly setting in spear_ehci_hcd_drv_probe function.
-spear_overrides struct initialized.
-Eliminate struct ehci_hcd ehci from struct spear_ehci,to enable SPEAr clock
uses directly usb_hcd *hcd in spear_start_ehci function.
-to_spear_ehci() macro modified for spear_ehci.

Quoted 7 lines

In V2:
Replaced spear as SPEAr everywhere, leaving functions/variables/config options.

This version has changed from what i Acked, but it still looks fine.

Thanks.

Viresh

maintainer
#2 lore raw

Re: [PATCH v3 1/7] USB: EHCI: make ehci-orion a separate driver

In reply to Arnd Bergmann
Quoted 4 lines · Arnd Bergmann

From: Manjunath Goudar <[email protected]>

Separate the Orion host controller driver from ehci-hcd host code into its own driver module because of following reason.

...

On the whole this patch is good.

Quoted 5 lines
drivers/usb/host/Kconfig +0 -0
@@ -163,6 +163,16 @@ config USB_EHCI_HCD_OMAP
 	  Enables support for the on-chip EHCI controller on
 	  OMAP3 and later chips.

drivers/usb/host/Kconfig config USB_EHCI_HCD_OMAP · line 174

Quoted 10 lines
drivers/usb/host/Kconfig +9 -0
 
+config USB_EHCI_HCD_ORION
+	tristate  "Support for Marvell EBU on-chip EHCI USB controller"
+	depends on USB_EHCI_HCD && PLAT_ORION
+	default y
+	---help---
+	  Enables support for the on-chip EHCI controller on Marvell's
+	  embedded ARM SoCs, including Orion, Kirkwood, Dove, Armada XP,
+	  Armada 370.  This is different from the EHCI implementation
+	  on Marvell's mobile PXA and MMP SoC, see USB_EHCI_MV for those.

I don't know about this last phrase. When someone is running "make menuconfig", for example, what shows up is the symbol's description, not the symbol's name. That person would see "EHCI support for Marvell on-chip controller", not "USB_EHCI_MV".

In fact, shouldn't the description for USB_EHCI_MV be changed too, to make it more distinct from this one?

All the code changes are fine.

Alan Stern

maintainer
#6 lore raw

Re: [PATCH v3 2/7] USB: EHCI: make ehci-spear a separate driver

In reply to Arnd Bergmann
Quoted 14 lines · Arnd Bergmann

From: Manjunath Goudar <[email protected]>

Separate the SPEAr host controller driver from ehci-hcd host code so that it can be built as a separate driver module.
This work is part of enabling multi-platform kernels on ARM; however, note that other changes are still needed before SPEAr can be booted with a multi-platform kernel, but they are queued in the arm-soc tree for 3.10.

With the infrastructure added by Alan Stern in patch 3e0232039 "USB: EHCI: prepare to make ehci-hcd a library module", we can avoid this problem by turning a bus glue into a separate module, as we do here for the SPEAr bus glue.

Quoted 4 lines

In V3:
-Detailed commit message added here about why this patch is required. -Eliminated ehci_spear_setup routine beacuse hcd registers
directly setting in spear_ehci_hcd_drv_probe function.

Fix the grammar, please.

Quoted 7 lines

-spear_overrides struct initialized.
-Eliminate struct ehci_hcd ehci from struct spear_ehci,to enable SPEAr clock
uses directly usb_hcd *hcd in spear_start_ehci function.
-to_spear_ehci() macro modified for spear_ehci.

In V2:
Replaced spear as SPEAr everywhere, leaving functions/variables/config options.

...

drivers/usb/host/ehci-spear.c static void spear_stop_ehci(struct spear_ehci *ehci) · line 42

Quoted 10 lines
drivers/usb/host/ehci-spear.c +0 -6
@@ -34,49 +45,7 @@ static void spear_stop_ehci(struct spear_ehci *ehci)
 	clk_disable_unprepare(ehci->clk);
 }
 
-static int ehci_spear_setup(struct usb_hcd *hcd)
-{
-	struct ehci_hcd *ehci = hcd_to_ehci(hcd);
-
-	/* registers start at offset 0x0 */
-	ehci->caps = hcd->regs;

This line never got moved into spear_ehci_hcd_drv_probe().

drivers/usb/host/ehci-spear.c static int spear_ehci_hcd_drv_probe(struct platform_device *pdev) · line 134

Quoted 7 lines
drivers/usb/host/ehci-spear.c +1 -1
@@ -161,7 +130,7 @@ static int spear_ehci_hcd_drv_probe(struct platform_device *pdev)
 		goto err_put_hcd;
 	}
 
-	ehci = (struct spear_ehci *)hcd_to_ehci(hcd);
+	ehci = to_spear_ehci(hcd);
 	ehci->clk = usbh_clk;

I strongly believe that the name "ehci" should be reserved for variables of type struct ehci_hcd. Here and in the start, stop, and remove routines, please use "spear_ehci" as the name for a variable of type struct spear_ehci. Or whatever else you want -- just don't call it "ehci" or "ehci_p".

Alan Stern

maintainer
#11 lore raw

Re: [PATCH v3 3/7] USB: EHCI: make ehci-s5p a separate driver

In reply to Arnd Bergmann
Quoted 14 lines · Arnd Bergmann

From: Manjunath Goudar <[email protected]>

Separate the Samsung S5P/EXYNOS host controller driver from ehci-hcd host code so that it can be built as a separate driver module. This work is part of enabling multi-platform kernels on ARM; however, note that other changes are still needed before S5P/EXYNOS can be booted with a multi-platform kernel. We currently expect those to get merged for 3.10.

With the infrastructure added by Alan Stern in patch 3e0232039 "USB: EHCI: prepare to make ehci-hcd a library module", we can avoid this problem by turning a bus glue into a separate module, as we do here for the s5p bus glue.

Quoted 10 lines

In V3:
-Detail commit message added here,why this patch is required.
-MODULE_LICENSE is GPL v2.
-Added .extra_priv_size to eliminate the separate allocation of the s5p_ehci_hcd structure
and removed .reset function pointer initialization.
-Arranged #include's in alphabetical order.
-After using extra_priv_size initialization,struct usb_hcd *hcd is redundant that's why removed
from the prob function.
-Eliminated s5p_ehci_phy_enable,contents of statements moved into the s5p_ehci_probe -Eliminated s5p_ehci_phy_disable, contents of statements moved into the s5p_ehci_remove.

And several other places as well.

Personally, I would have left these two functions the way they were and relied on the compiler to inline them when appropriate. Eliminating them just makes the code more complicated.

...

drivers/usb/host/ehci-s5p.c static u64 ehci_s5p_dma_mask = DMA_BIT_MASK(32); · line 118

Quoted 9 lines
drivers/usb/host/ehci-s5p.c +2 -1
@@ -113,9 +76,10 @@ static u64 ehci_s5p_dma_mask = DMA_BIT_MASK(32);
 
 static int s5p_ehci_probe(struct platform_device *pdev)
 {
+	struct usb_hcd *hcd ;
 	struct s5p_ehci_platdata *pdata = pdev->dev.platform_data;
+	const struct hc_driver *driver = &s5p_ehci_hc_driver;
 	struct s5p_ehci_hcd *s5p_ehci;
-	struct usb_hcd *hcd;

What's the reason for these changes? There's no need for the "driver" variable, and improper whitespace was added to the declaration of "hcd".

drivers/usb/host/ehci-s5p.c static int s5p_ehci_probe(struct platform_device *pdev) · line 120

Quoted 9 lines
drivers/usb/host/ehci-s5p.c +1 -4
@@ -153,16 +117,12 @@ static int s5p_ehci_probe(struct platform_device *pdev)
 		s5p_ehci->otg = phy->otg;
 	}
 
-	s5p_ehci->dev = &pdev->dev;
-
-	hcd = usb_create_hcd(&s5p_ehci_hc_driver, &pdev->dev,
-					dev_name(&pdev->dev));
+	hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));

s5p_ehci is not initialized correctly. The devm_kzalloc() call was left in and to_s5p_ehci() was not called. Was anybody able to test this patch?

Alan Stern

maintainer
#14 lore raw

Re: [PATCH v3 4/7] USB: EHCI: export ehci_shutdown

In reply to Arnd Bergmann
Quoted 3 lines · Arnd Bergmann

The ehci_shutdown function is used by the platform specific ehci backends for at91, tegra and ps3. In order to turn any of these into separate modules, we need to make this function globally visible and export it.

Actually, I think this is not necessary. Instead those three glue files ought to be changed. They should not need to call ehci_shutdown() directly.

The references to ehci_shutdown() in ehci-atmel.c and ehci-ps3.c seem totally unnecesary. That routine does a hard shutdown -- but the calls are immediately followed by usb_remove_hcd(), which calls ehci_stop(), which does an orderly shutdown followed by a reset. While it certainly would be good to check with the authors of these drivers, it would be surprising if removing those calls led to any trouble.

The reference in ehci-tegra.c is there only so that tegra_ehci_shutdown() can call tegra_ehci_power_up() before doing its real work. Instead, tegra_ehci_power_up() should be called by tegra_ehci_hcd_shutdown(). Then there would be no need to have the tegra_ehci_shutdown() routine at all.

Alan Stern

maintainer
#18 lore raw

Re: [PATCH v3 5/7] USB: EHCI: make ehci-atmel a separate driver

In reply to Arnd Bergmann
Quoted 9 lines · Arnd Bergmann

From: Manjunath Goudar <[email protected]>

Separate the Atmel host controller driver from ehci-hcd host code so that it can be built as a separate driver module.
This work is part of enabling multi-platform kernels on ARM; however, note that other changes are still needed before Atmel can be booted with a multi-platform kernel. This is currently planned for Linux-3.11.

Quoted 4 lines

With the infrastructure added by Alan Stern in patch 3e0232039 "USB: EHCI: prepare to make ehci-hcd a library module", we can avoid this problem by turning a bus glue into a separate module, as we do here for the Atmel bus glue.

Generally okay.

Quoted 5 lines
drivers/usb/host/ehci-atmel.c +0 -0
index 01c1acb..8c564aa 100644

drivers/usb/host/ehci-atmel.c line 23

Quoted 9 lines
drivers/usb/host/ehci-atmel.c +6 -0
@@ -15,6 +15,19 @@
 #include <linux/platform_device.h>
 #include <linux/of.h>
 #include <linux/of_platform.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/usb.h>
+#include <linux/usb/hcd.h>
+#include <linux/io.h>
+#include <linux/dma-mapping.h>

While not absolutely necessary, it would be nice to have the #include files in alphabetical order.

drivers/usb/host/ehci-atmel.c line 27

Quoted 4 lines
drivers/usb/host/ehci-atmel.c +4 -0
+
+#include "ehci.h"
+
+#define DRIVER_DESC "EHCI atmel driver"

"atmel" should have a capital 'A'.

Alan Stern

maintainer
#22 lore raw

Re: [PATCH v3 6/7] USB: EHCI: make ehci-msm a separate driver

In reply to Arnd Bergmann
Quoted 9 lines · Arnd Bergmann

From: Manjunath Goudar <[email protected]>

Separate the Qualcomm QSD/MSM on-chip host controller driver from ehci-hcd host code so that it can be built as a separate driver module. This work is part of enabling multi-platform kernels on ARM; however, note that other changes are still needed before Qualcomm QSD/MSM can be booted with a multi-platform kernel, which is not expected before 3.11.

Quoted 4 lines

With the infrastructure added by Alan Stern in patch 3e0232039 "USB: EHCI: prepare to make ehci-hcd a library module", we can avoid this problem by turning a bus glue into a separate module, as we do here for the msm bus glue.

This patch is good. However the ehci-msm driver itself is not. While checking through the code, I was struck by the fact that it never calls usb_add_hcd() or usb_remove_hcd(). Obviously the driver cannot work properly.

In addition, it stores the PHY pointer in a global variable. (ehci-atmel does much the same thing for its clocks.) This means the driver cannot be used on a system having more than one EHCI controller. Maybe this doesn't matter, though.

Maybe somebody would like to fix and test it...

Alan Stern

maintainer
#26 lore raw

Re: [PATCH v3 7/7] USB: OHCI: avoid conflicting platform drivers

In reply to Arnd Bergmann
Quoted 16 lines · Arnd Bergmann

Like the EHCI driver, OHCI supports a large number of different platform glue drivers by directly including them, which causes problems with conflicting macro definitions in some cases. As more ARM architecture specific back-ends are required to coexist in a single build, we should split those out into separate drivers. Unfortunately, the infrastructure for that is still under development, so to give us more time, this uses a separate *_PLATFORM_DRIVER macro for each ARM specific OHCI backend, just like we already do on PowerPC and some of the other ARM platforms.

In linux-3.10, only the SPEAr and CNS3xxx back-ends would actually conflict without this patch, but over time we would get more of them, so this is a way to avoid having to patch the driver every time it breaks. We should still split out all back-ends into separate loadable modules, but that work is only needed to improve code size and cleanliness after this patch, not for correctness.

Quoted 3 lines

While we're here, this fixes the incorrectly sorted error path for the OMAP1 and OMAP3 backends to ensure we always unregister the exact set of drivers that were registered before erroring out.

I have not checked the details of all the changes; however, the basic idea is okay as a stop-gap measure.

I guess this means the onus is now on me to split up ohci-hcd into a central library and separate bus drivers, like ehci-hcd...

Alan Stern

#15 lore raw

Re: [PATCH v3 4/7] USB: EHCI: export ehci_shutdown

In reply to Alan Stern

Hi Alan,

Quoted 3 lines

Actually, I think this is not necessary. Instead those three glue files ought to be changed. They should not need to call ehci_shutdown() directly.

I sent out a separate patch that removes the ehci_shutdown() call in ps3_ehci_remove(). I tested it by removing and installing the ehci_hcd module and it seems to work OK.

-Geoff

maintainer
#16 lore raw

Re: [PATCH v3 4/7] USB: EHCI: export ehci_shutdown

Quoted 9 lines · Geoff Levand

Hi Alan,

Quoted 3 lines

Actually, I think this is not necessary. Instead those three glue files ought to be changed. They should not need to call ehci_shutdown() directly.

I sent out a separate patch that removes the ehci_shutdown() call in ps3_ehci_remove(). I tested it by removing and installing the ehci_hcd module and it seems to work OK.

Thanks! I'll send it on up.

Alan Stern

Acked-by
#19 lore raw

Re: [PATCH v3 5/7] USB: EHCI: make ehci-atmel a separate driver

In reply to Alan Stern

On 03/29/2013 09:02 PM, Alan Stern :

Quoted 16 lines · Arnd Bergmann
Quoted 10 lines

From: Manjunath Goudar <[email protected]>

Separate the Atmel host controller driver from ehci-hcd host code so that it can be built as a separate driver module.
This work is part of enabling multi-platform kernels on ARM; however, note that other changes are still needed before Atmel can be booted with a multi-platform kernel. This is currently planned for Linux-3.11.

Quoted 4 lines

With the infrastructure added by Alan Stern in patch 3e0232039 "USB: EHCI: prepare to make ehci-hcd a library module", we can avoid this problem by turning a bus glue into a separate module, as we do here for the Atmel bus glue.

Quoted 6 lines

Generally okay.

drivers/usb/host/ehci-atmel.c

Quoted 4 lines
drivers/usb/host/ehci-atmel.c +0 -0
index 01c1acb..8c564aa 100644

I missed the patch itself but I reviewed it on the mailing-list archive. So, here is my:

Thanks a lot for having taking care of this driver.

Best regards,

Quoted 25 lines

drivers/usb/host/ehci-atmel.c line 23

Quoted 10 lines
drivers/usb/host/ehci-atmel.c +6 -0
@@ -15,6 +15,19 @@
 #include <linux/platform_device.h>
 #include <linux/of.h>
 #include <linux/of_platform.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/usb.h>
+#include <linux/usb/hcd.h>
+#include <linux/io.h>
+#include <linux/dma-mapping.h>

While not absolutely necessary, it would be nice to have the #include files in alphabetical order.

drivers/usb/host/ehci-atmel.c line 27

Quoted 4 lines
drivers/usb/host/ehci-atmel.c +4 -0
+
+#include "ehci.h"
+
+#define DRIVER_DESC "EHCI atmel driver"

"atmel" should have a capital 'A'.

Alan Stern

Signature · 1 line
Nicolas Ferre
#3 lore raw

Re: [PATCH v3 1/7] USB: EHCI: make ehci-orion a separate driver

In reply to Alan Stern
Quoted 9 lines · Alan Stern

I don't know about this last phrase. When someone is running "make menuconfig", for example, what shows up is the symbol's description, not the symbol's name. That person would see "EHCI support for Marvell on-chip controller", not "USB_EHCI_MV".

In fact, shouldn't the description for USB_EHCI_MV be changed too, to make it more distinct from this one?

All the code changes are fine.

Ok, I've included these Kconfig changes. Originally, the text change for PXA/MMP was included in the patch for ehci-mv, but that one is deferred to 3.11 now because of dependencies for the platform code that we want to first merge in 3.10.

Arnd

#7 lore raw

Re: [PATCH v3 2/7] USB: EHCI: make ehci-spear a separate driver

In reply to Alan Stern
Quoted 16 lines · Alan Stern
Quoted 14 lines · Arnd Bergmann

From: Manjunath Goudar <[email protected]>

Separate the SPEAr host controller driver from ehci-hcd host code so that it can be built as a separate driver module.
This work is part of enabling multi-platform kernels on ARM; however, note that other changes are still needed before SPEAr can be booted with a multi-platform kernel, but they are queued in the arm-soc tree for 3.10.

With the infrastructure added by Alan Stern in patch 3e0232039 "USB: EHCI: prepare to make ehci-hcd a library module", we can avoid this problem by turning a bus glue into a separate module, as we do here for the SPEAr bus glue.

Quoted 6 lines
Quoted 4 lines

In V3:
-Detailed commit message added here about why this patch is required. -Eliminated ehci_spear_setup routine beacuse hcd registers
directly setting in spear_ehci_hcd_drv_probe function.

Fix the grammar, please.

Done. I agree some of this is hardly legible.

Manjunath, I can teach you about device drivers and submission procedures, but I cannot teach you basic English. If necessary, find someone to proofread your emails.

Quoted 8 lines

drivers/usb/host/ehci-spear.c static void spear_stop_ehci(struct spear_ehci *ehci) · line 42

Quoted 6 lines
drivers/usb/host/ehci-spear.c +0 -6
-static int ehci_spear_setup(struct usb_hcd *hcd)
-{
-	struct ehci_hcd *ehci = hcd_to_ehci(hcd);
-
-	/* registers start at offset 0x0 */
-	ehci->caps = hcd->regs;

This line never got moved into spear_ehci_hcd_drv_probe().

Ah, I missed it. Thanks for looking at this more carefully than I did.

Quoted 4 lines
Quoted 4 lines
drivers/usb/host/ehci-spear.c +0 -0
@@ -161,7 +130,7 @@ static int spear_ehci_hcd_drv_probe(struct platform_device *pdev)
 		goto err_put_hcd;
 	}
 
Quoted 9 lines

drivers/usb/host/ehci-spear.c static int spear_ehci_hcd_drv_probe(struct platform_device *pdev) · line 134

Quoted 3 lines
drivers/usb/host/ehci-spear.c +1 -1
-	ehci = (struct spear_ehci *)hcd_to_ehci(hcd);
+	ehci = to_spear_ehci(hcd);
 	ehci->clk = usbh_clk;

I strongly believe that the name "ehci" should be reserved for variables of type struct ehci_hcd. Here and in the start, stop, and remove routines, please use "spear_ehci" as the name for a variable of type struct spear_ehci. Or whatever else you want -- just don't call it "ehci" or "ehci_p".

Ok, renamed to "sehci" in lack of a better idea. I noticed this before, but I did not ask Manjunath to fix it because it was a preexisting mistake in the driver.

Arnd

#12 lore raw

Re: [PATCH v3 3/7] USB: EHCI: make ehci-s5p a separate driver

In reply to Alan Stern
Quoted 6 lines · Alan Stern

On Thu, 28 Mar 2013, Arnd Bergmann wrote:

Personally, I would have left these two functions the way they were and relied on the compiler to inline them when appropriate. Eliminating them just makes the code more complicated.

Yes, makes sense. I'm leaving the change in now, because I don't see a strong reason to undo the change, and the two functions will likely get collapsed into a single line each after the move to the phy subsystem is complete.

Quoted 11 lines

drivers/usb/host/ehci-s5p.c static u64 ehci_s5p_dma_mask = DMA_BIT_MASK(32); · line 118

Quoted 7 lines

static int s5p_ehci_probe(struct platform_device *pdev) {

drivers/usb/host/ehci-s5p.c +2 -1
+	struct usb_hcd *hcd ;
 	struct s5p_ehci_platdata *pdata = pdev->dev.platform_data;
+	const struct hc_driver *driver = &s5p_ehci_hc_driver;
 	struct s5p_ehci_hcd *s5p_ehci;
-	struct usb_hcd *hcd;

What's the reason for these changes? There's no need for the "driver" variable, and improper whitespace was added to the declaration of "hcd".

I'll let Manjunath answer this, I have no idea. My suspicion is that it was a misguided attempt to work around a checkpatch warning for an overly long line.

I've reverted the above changes now for v4.

Quoted 4 lines
Quoted 4 lines
drivers/usb/host/ehci-s5p.c +0 -0
@@ -153,16 +117,12 @@ static int s5p_ehci_probe(struct platform_device *pdev)
 		s5p_ehci->otg = phy->otg;
 	}
 
Quoted 8 lines

drivers/usb/host/ehci-s5p.c static int s5p_ehci_probe(struct platform_device *pdev) · line 120

Quoted 5 lines
drivers/usb/host/ehci-s5p.c +1 -4
-	s5p_ehci->dev = &pdev->dev;
-
-	hcd = usb_create_hcd(&s5p_ehci_hc_driver, &pdev->dev,
-					dev_name(&pdev->dev));
+	hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));

s5p_ehci is not initialized correctly. The devm_kzalloc() call was left in and to_s5p_ehci() was not called.

Oh crap.

I checked that Manjunath had fixed this bug in the other drivers, but missed it here. I updated it for v4 now.

Quoted 1 line

Was anybody able to test this patch?

I thought that Manjunath had received hardware for it now, but it's pretty evident that the patch was not tested. The Ack from Jingoo Han was for an older version that did not contain the change to .extra_priv_size.

Arnd

#20 lore raw

Re: [PATCH v3 5/7] USB: EHCI: make ehci-atmel a separate driver

In reply to Alan Stern
Quoted 10 lines · Alan Stern

While not absolutely necessary, it would be nice to have the #include files in alphabetical order.

drivers/usb/host/ehci-atmel.c line 27

Quoted 4 lines
drivers/usb/host/ehci-atmel.c +4 -0
+
+#include "ehci.h"
+
+#define DRIVER_DESC "EHCI atmel driver"

"atmel" should have a capital 'A'.

Ok, added these changes for v4 along with Nicolas' Ack, and removed the call to ehci_shutdown.

Arnd

#23 lore raw

Re: [PATCH v3 6/7] USB: EHCI: make ehci-msm a separate driver

In reply to Alan Stern
Quoted 7 lines · Alan Stern

On Thu, 28 Mar 2013, Arnd Bergmann wrote:

This patch is good. However the ehci-msm driver itself is not. While checking through the code, I was struck by the fact that it never calls usb_add_hcd() or usb_remove_hcd(). Obviously the driver cannot work properly.

Quoted 6 lines

In addition, it stores the PHY pointer in a global variable. (ehci-atmel does much the same thing for its clocks.) This means the driver cannot be used on a system having more than one EHCI controller. Maybe this doesn't matter, though.

Maybe somebody would like to fix and test it...

I'm not too surprised. The driver was added the last time that the MSM maintainers started a serious attempt to get a lot of their code mainlined, a little over two years ago. While there is some activity from Qualcomm in specific areas of the code every now and then, they literally have thousands of patches on top of the kernel that they use in actual products and I would not expect a mainline kernel to actually work on any recent Qualcomm hardware.

Arnd

#27 lore raw

Re: [PATCH v3 7/7] USB: OHCI: avoid conflicting platform drivers

In reply to Alan Stern
Quoted 2 lines · Alan Stern

I have not checked the details of all the changes; however, the basic idea is okay as a stop-gap measure.

Ok, thanks.

Quoted 2 lines

I guess this means the onus is now on me to split up ohci-hcd into a central library and separate bus drivers, like ehci-hcd...

The original plan in my teams was that Manjunath would do that after he was done with the simple conversion of the EHCI drivers. I think we can all agree now that it's better if you at least the groundwork instead.

Please let us know if you would like Manjunath to continue with splitting out the OHCI back-ends into separate drivers, or if you think that there is no point given the quality of the earlier patches.

Arnd

#8 lore raw

Re: [PATCH v3 2/7] USB: EHCI: make ehci-spear a separate driver

In reply to Arnd Bergmann
Quoted 9 lines · Arnd Bergmann
Quoted 6 lines
Quoted 4 lines

In V3:
-Detailed commit message added here about why this patch is required. -Eliminated ehci_spear_setup routine beacuse hcd registers
directly setting in spear_ehci_hcd_drv_probe function.

Fix the grammar, please.

Done. I agree some of this is hardly legible.

I realized later that the other patches have similarly screwed up changelogs. I'll send a new version once you've commented on v4, so in case there is anything else I missed I'm not spamming everyone another time.

Arnd

maintainer Acked-by
#9 lore raw

Re: [PATCH v3 2/7] USB: EHCI: make ehci-spear a separate driver

Quoted 8 lines · Arnd Bergmann
Quoted 7 lines · Arnd Bergmann
Quoted 6 lines
Quoted 4 lines

In V3:
-Detailed commit message added here about why this patch is required. -Eliminated ehci_spear_setup routine beacuse hcd registers
directly setting in spear_ehci_hcd_drv_probe function.

Fix the grammar, please.

Quoted 7 lines
Quoted 2 lines

Done. I agree some of this is hardly legible.

I realized later that the other patches have similarly screwed up changelogs. I'll send a new version once you've commented on v4, so in case there is anything else I missed I'm not spamming everyone another time.

I still haven't checked the details of the last patch in the series (the OHCI changes). However, for patches 1/6 - 5/6:

maintainer
#28 lore raw

Re: [PATCH v3 7/7] USB: OHCI: avoid conflicting platform drivers

In reply to Arnd Bergmann
Quoted 6 lines · Arnd Bergmann
Quoted 2 lines

I guess this means the onus is now on me to split up ohci-hcd into a central library and separate bus drivers, like ehci-hcd...

The original plan in my teams was that Manjunath would do that after he was done with the simple conversion of the EHCI drivers. I think we can all agree now that it's better if you at least the groundwork instead.

Yes, it would be better for me to prepare for the general split-up.

Quoted 3 lines

Please let us know if you would like Manjunath to continue with splitting out the OHCI back-ends into separate drivers, or if you think that there is no point given the quality of the earlier patches.

This is how people learn. After I have taken care of the initial steps and converted a couple of the drivers, Manjunath can work on the rest.

Alan Stern

Acked-by
#24 lore raw

Re: [PATCH v3 6/7] USB: EHCI: make ehci-msm a separate driver

In reply to Arnd Bergmann
Quoted 15 lines · Arnd Bergmann
Quoted 7 lines · Alan Stern

On Thu, 28 Mar 2013, Arnd Bergmann wrote:

This patch is good. However the ehci-msm driver itself is not. While checking through the code, I was struck by the fact that it never calls usb_add_hcd() or usb_remove_hcd(). Obviously the driver cannot work properly.

Quoted 6 lines

In addition, it stores the PHY pointer in a global variable. (ehci-atmel does much the same thing for its clocks.) This means the driver cannot be used on a system having more than one EHCI controller. Maybe this doesn't matter, though.

Maybe somebody would like to fix and test it...

Quoted 7 lines

I'm not too surprised. The driver was added the last time that the MSM maintainers started a serious attempt to get a lot of their code mainlined, a little over two years ago. While there is some activity from Qualcomm in specific areas of the code every now and then, they literally have thousands of patches on top of the kernel that they use in actual products and I would not expect a mainline kernel to actually work on any recent Qualcomm hardware.

As far as this patch goes, you can have an

for it.

I'm hoping things are going to get better as far as people working on things. EHCI is definitely an important one to get working (as is SD), but we've got to get clocks and regulators working first.

David

Signature · 3 lines
sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation