From 4ca6dc72c57300647cd5c655980774be669c43a1 Mon Sep 17 00:00:00 2001 From: juhosg Date: Mon, 14 Jan 2013 17:47:23 +0000 Subject: [PATCH] generic: add EHCI|OHCI platform driver fix from the cns21xx target Signed-off-by: Gabor Juhos git-svn-id: svn://svn.openwrt.org/openwrt/trunk@35159 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../patches-3.7/103-cns21xx-usb-ohci-support.patch | 61 +------------------ .../patches-3.7/104-cns21xx-usb-ehci-support.patch | 71 +++++----------------- ...800-usb-ohci-multiple-platform-driver-fix.patch | 51 ++++++++++++++++ ...801-usb-ehci-multiple-platform-driver-fix.patch | 47 ++++++++++++++ ...800-usb-ohci-multiple-platform-driver-fix.patch | 51 ++++++++++++++++ ...801-usb-ehci-multiple-platform-driver-fix.patch | 47 ++++++++++++++ 6 files changed, 212 insertions(+), 116 deletions(-) create mode 100644 target/linux/generic/patches-3.7/800-usb-ohci-multiple-platform-driver-fix.patch create mode 100644 target/linux/generic/patches-3.7/801-usb-ehci-multiple-platform-driver-fix.patch create mode 100644 target/linux/generic/patches-3.8/800-usb-ohci-multiple-platform-driver-fix.patch create mode 100644 target/linux/generic/patches-3.8/801-usb-ehci-multiple-platform-driver-fix.patch diff --git a/target/linux/cns21xx/patches-3.7/103-cns21xx-usb-ohci-support.patch b/target/linux/cns21xx/patches-3.7/103-cns21xx-usb-ohci-support.patch index 24a65ac216..92e585810f 100644 --- a/target/linux/cns21xx/patches-3.7/103-cns21xx-usb-ohci-support.patch +++ b/target/linux/cns21xx/patches-3.7/103-cns21xx-usb-ohci-support.patch @@ -1,14 +1,6 @@ --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c -@@ -579,7 +579,6 @@ static int ohci_run (struct ohci_hcd *oh - - /* boot firmware should have set this up (5.1.1.3.1) */ - if (first) { -- - val = ohci_readl (ohci, &ohci->regs->fminterval); - ohci->fminterval = val & 0x3fff; - if (ohci->fminterval != FI) -@@ -663,6 +662,9 @@ retry: +@@ -663,6 +663,9 @@ retry: periodic_reinit (ohci); @@ -18,7 +10,7 @@ /* some OHCI implementations are finicky about how they init. * bogus values here mean not even enumeration could work. */ -@@ -1105,6 +1107,11 @@ MODULE_LICENSE ("GPL"); +@@ -1105,6 +1108,11 @@ MODULE_LICENSE ("GPL"); #define PLATFORM_DRIVER ohci_hcd_tilegx_driver #endif @@ -30,55 +22,6 @@ #ifdef CONFIG_USB_CNS3XXX_OHCI #include "ohci-cns3xxx.c" #define PLATFORM_DRIVER ohci_hcd_cns3xxx_driver -@@ -1117,7 +1124,7 @@ MODULE_LICENSE ("GPL"); - - #ifdef CONFIG_USB_OHCI_HCD_PLATFORM - #include "ohci-platform.c" --#define PLATFORM_DRIVER ohci_platform_driver -+#define OHCI_PLATFORM_DRIVER ohci_platform_driver - #endif - - #if !defined(PCI_DRIVER) && \ -@@ -1128,7 +1135,8 @@ MODULE_LICENSE ("GPL"); - !defined(SA1111_DRIVER) && \ - !defined(PS3_SYSTEM_BUS_DRIVER) && \ - !defined(SM501_OHCI_DRIVER) && \ -- !defined(TMIO_OHCI_DRIVER) -+ !defined(TMIO_OHCI_DRIVER) && \ -+ !defined(OHCI_PLATFORM_DRIVER) - #error "missing bus glue for ohci-hcd" - #endif - -@@ -1206,9 +1214,19 @@ static int __init ohci_hcd_mod_init(void - goto error_tmio; - #endif - -+#ifdef OHCI_PLATFORM_DRIVER -+ retval = platform_driver_register(&OHCI_PLATFORM_DRIVER); -+ if (retval < 0) -+ goto error_ohci; -+#endif -+ - return retval; - - /* Error path */ -+#ifdef OHCI_PLATFORM_DRIVER -+ platform_driver_unregister(&OHCI_PLATFORM_DRIVER); -+ error_ohci: -+#endif - #ifdef TMIO_OHCI_DRIVER - platform_driver_unregister(&TMIO_OHCI_DRIVER); - error_tmio: -@@ -1258,6 +1276,9 @@ module_init(ohci_hcd_mod_init); - - static void __exit ohci_hcd_mod_exit(void) - { -+#ifdef OHCI_PLATFORM_DRIVER -+ platform_driver_unregister(&OHCI_PLATFORM_DRIVER); -+#endif - #ifdef TMIO_OHCI_DRIVER - platform_driver_unregister(&TMIO_OHCI_DRIVER); - #endif --- /dev/null +++ b/drivers/usb/host/ohci-cns21xx.c @@ -0,0 +1,176 @@ diff --git a/target/linux/cns21xx/patches-3.7/104-cns21xx-usb-ehci-support.patch b/target/linux/cns21xx/patches-3.7/104-cns21xx-usb-ehci-support.patch index 93f3c18b27..36fcd46179 100644 --- a/target/linux/cns21xx/patches-3.7/104-cns21xx-usb-ehci-support.patch +++ b/target/linux/cns21xx/patches-3.7/104-cns21xx-usb-ehci-support.patch @@ -1,3 +1,17 @@ +--- a/drivers/usb/host/ehci-hcd.c ++++ b/drivers/usb/host/ehci-hcd.c +@@ -1269,6 +1269,11 @@ MODULE_LICENSE ("GPL"); + #define PLATFORM_DRIVER ehci_octeon_driver + #endif + ++#ifdef CONFIG_ARCH_CNS21XX ++#include "ehci-cns21xx.c" ++#define PLATFORM_DRIVER ehci_cns21xx_driver ++#endif ++ + #ifdef CONFIG_USB_CNS3XXX_EHCI + #include "ehci-cns3xxx.c" + #define PLATFORM_DRIVER cns3xxx_ehci_driver --- /dev/null +++ b/drivers/usb/host/ehci-cns21xx.c @@ -0,0 +1,186 @@ @@ -187,63 +201,6 @@ +}; + +MODULE_ALIAS("platform:" DRIVER_NAME); ---- a/drivers/usb/host/ehci-hcd.c -+++ b/drivers/usb/host/ehci-hcd.c -@@ -1334,14 +1334,19 @@ MODULE_LICENSE ("GPL"); - #define PLATFORM_DRIVER ehci_hcd_sead3_driver - #endif - -+#ifdef CONFIG_ARCH_CNS21XX -+#include "ehci-cns21xx.c" -+#define PLATFORM_DRIVER ehci_cns21xx_driver -+#endif -+ - #ifdef CONFIG_USB_EHCI_HCD_PLATFORM - #include "ehci-platform.c" --#define PLATFORM_DRIVER ehci_platform_driver -+#define EHCI_PLATFORM_DRIVER ehci_platform_driver - #endif - - #if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) && \ - !defined(PS3_SYSTEM_BUS_DRIVER) && !defined(OF_PLATFORM_DRIVER) && \ -- !defined(XILINX_OF_PLATFORM_DRIVER) -+ !defined(XILINX_OF_PLATFORM_DRIVER) && !defined(EHCI_PLATFORM_DRIVER) - #error "missing bus glue for ehci-hcd" - #endif - -@@ -1401,10 +1406,21 @@ static int __init ehci_hcd_init(void) - if (retval < 0) - goto clean4; - #endif -+ -+#ifdef EHCI_PLATFORM_DRIVER -+ retval = platform_driver_register(&EHCI_PLATFORM_DRIVER); -+ if (retval < 0) -+ goto clean5; -+#endif -+ - return retval; - -+#ifdef EHCI_PLATFORM_DRIVER -+ platform_driver_unregister(&EHCI_PLATFORM_DRIVER); -+clean5: -+#endif - #ifdef XILINX_OF_PLATFORM_DRIVER -- /* platform_driver_unregister(&XILINX_OF_PLATFORM_DRIVER); */ -+ platform_driver_unregister(&XILINX_OF_PLATFORM_DRIVER); - clean4: - #endif - #ifdef OF_PLATFORM_DRIVER -@@ -1435,6 +1451,9 @@ module_init(ehci_hcd_init); - - static void __exit ehci_hcd_cleanup(void) - { -+#ifdef EHCI_PLATFORM_DRIVER -+ platform_driver_unregister(&EHCI_PLATFORM_DRIVER); -+#endif - #ifdef XILINX_OF_PLATFORM_DRIVER - platform_driver_unregister(&XILINX_OF_PLATFORM_DRIVER); - #endif --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -376,6 +376,7 @@ config ARCH_CNS21XX diff --git a/target/linux/generic/patches-3.7/800-usb-ohci-multiple-platform-driver-fix.patch b/target/linux/generic/patches-3.7/800-usb-ohci-multiple-platform-driver-fix.patch new file mode 100644 index 0000000000..11075d5795 --- /dev/null +++ b/target/linux/generic/patches-3.7/800-usb-ohci-multiple-platform-driver-fix.patch @@ -0,0 +1,51 @@ +--- a/drivers/usb/host/ohci-hcd.c ++++ b/drivers/usb/host/ohci-hcd.c +@@ -1117,7 +1117,7 @@ MODULE_LICENSE ("GPL"); + + #ifdef CONFIG_USB_OHCI_HCD_PLATFORM + #include "ohci-platform.c" +-#define PLATFORM_DRIVER ohci_platform_driver ++#define OHCI_PLATFORM_DRIVER ohci_platform_driver + #endif + + #if !defined(PCI_DRIVER) && \ +@@ -1128,7 +1128,8 @@ MODULE_LICENSE ("GPL"); + !defined(SA1111_DRIVER) && \ + !defined(PS3_SYSTEM_BUS_DRIVER) && \ + !defined(SM501_OHCI_DRIVER) && \ +- !defined(TMIO_OHCI_DRIVER) ++ !defined(TMIO_OHCI_DRIVER) && \ ++ !defined(OHCI_PLATFORM_DRIVER) + #error "missing bus glue for ohci-hcd" + #endif + +@@ -1206,9 +1207,19 @@ static int __init ohci_hcd_mod_init(void + goto error_tmio; + #endif + ++#ifdef OHCI_PLATFORM_DRIVER ++ retval = platform_driver_register(&OHCI_PLATFORM_DRIVER); ++ if (retval < 0) ++ goto error_ohci; ++#endif ++ + return retval; + + /* Error path */ ++#ifdef OHCI_PLATFORM_DRIVER ++ platform_driver_unregister(&OHCI_PLATFORM_DRIVER); ++ error_ohci: ++#endif + #ifdef TMIO_OHCI_DRIVER + platform_driver_unregister(&TMIO_OHCI_DRIVER); + error_tmio: +@@ -1258,6 +1269,9 @@ module_init(ohci_hcd_mod_init); + + static void __exit ohci_hcd_mod_exit(void) + { ++#ifdef OHCI_PLATFORM_DRIVER ++ platform_driver_unregister(&OHCI_PLATFORM_DRIVER); ++#endif + #ifdef TMIO_OHCI_DRIVER + platform_driver_unregister(&TMIO_OHCI_DRIVER); + #endif diff --git a/target/linux/generic/patches-3.7/801-usb-ehci-multiple-platform-driver-fix.patch b/target/linux/generic/patches-3.7/801-usb-ehci-multiple-platform-driver-fix.patch new file mode 100644 index 0000000000..e803044475 --- /dev/null +++ b/target/linux/generic/patches-3.7/801-usb-ehci-multiple-platform-driver-fix.patch @@ -0,0 +1,47 @@ +--- a/drivers/usb/host/ehci-hcd.c ++++ b/drivers/usb/host/ehci-hcd.c +@@ -1336,12 +1336,12 @@ MODULE_LICENSE ("GPL"); + + #ifdef CONFIG_USB_EHCI_HCD_PLATFORM + #include "ehci-platform.c" +-#define PLATFORM_DRIVER ehci_platform_driver ++#define EHCI_PLATFORM_DRIVER ehci_platform_driver + #endif + + #if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) && \ + !defined(PS3_SYSTEM_BUS_DRIVER) && !defined(OF_PLATFORM_DRIVER) && \ +- !defined(XILINX_OF_PLATFORM_DRIVER) ++ !defined(XILINX_OF_PLATFORM_DRIVER) && !defined(EHCI_PLATFORM_DRIVER) + #error "missing bus glue for ehci-hcd" + #endif + +@@ -1401,8 +1401,19 @@ static int __init ehci_hcd_init(void) + if (retval < 0) + goto clean4; + #endif ++ ++#ifdef EHCI_PLATFORM_DRIVER ++ retval = platform_driver_register(&EHCI_PLATFORM_DRIVER); ++ if (retval < 0) ++ goto clean5; ++#endif ++ + return retval; + ++#ifdef EHCI_PLATFORM_DRIVER ++ platform_driver_unregister(&EHCI_PLATFORM_DRIVER); ++clean5: ++#endif + #ifdef XILINX_OF_PLATFORM_DRIVER + /* platform_driver_unregister(&XILINX_OF_PLATFORM_DRIVER); */ + clean4: +@@ -1435,6 +1446,9 @@ module_init(ehci_hcd_init); + + static void __exit ehci_hcd_cleanup(void) + { ++#ifdef EHCI_PLATFORM_DRIVER ++ platform_driver_unregister(&EHCI_PLATFORM_DRIVER); ++#endif + #ifdef XILINX_OF_PLATFORM_DRIVER + platform_driver_unregister(&XILINX_OF_PLATFORM_DRIVER); + #endif diff --git a/target/linux/generic/patches-3.8/800-usb-ohci-multiple-platform-driver-fix.patch b/target/linux/generic/patches-3.8/800-usb-ohci-multiple-platform-driver-fix.patch new file mode 100644 index 0000000000..d691c5156a --- /dev/null +++ b/target/linux/generic/patches-3.8/800-usb-ohci-multiple-platform-driver-fix.patch @@ -0,0 +1,51 @@ +--- a/drivers/usb/host/ohci-hcd.c ++++ b/drivers/usb/host/ohci-hcd.c +@@ -1188,7 +1188,7 @@ MODULE_LICENSE ("GPL"); + + #ifdef CONFIG_USB_OHCI_HCD_PLATFORM + #include "ohci-platform.c" +-#define PLATFORM_DRIVER ohci_platform_driver ++#define OHCI_PLATFORM_DRIVER ohci_platform_driver + #endif + + #if !defined(PCI_DRIVER) && \ +@@ -1199,7 +1199,8 @@ MODULE_LICENSE ("GPL"); + !defined(SA1111_DRIVER) && \ + !defined(PS3_SYSTEM_BUS_DRIVER) && \ + !defined(SM501_OHCI_DRIVER) && \ +- !defined(TMIO_OHCI_DRIVER) ++ !defined(TMIO_OHCI_DRIVER) && \ ++ !defined(OHCI_PLATFORM_DRIVER) + #error "missing bus glue for ohci-hcd" + #endif + +@@ -1277,9 +1278,19 @@ static int __init ohci_hcd_mod_init(void + goto error_tmio; + #endif + ++#ifdef OHCI_PLATFORM_DRIVER ++ retval = platform_driver_register(&OHCI_PLATFORM_DRIVER); ++ if (retval < 0) ++ goto error_ohci; ++#endif ++ + return retval; + + /* Error path */ ++#ifdef OHCI_PLATFORM_DRIVER ++ platform_driver_unregister(&OHCI_PLATFORM_DRIVER); ++ error_ohci: ++#endif + #ifdef TMIO_OHCI_DRIVER + platform_driver_unregister(&TMIO_OHCI_DRIVER); + error_tmio: +@@ -1329,6 +1340,9 @@ module_init(ohci_hcd_mod_init); + + static void __exit ohci_hcd_mod_exit(void) + { ++#ifdef OHCI_PLATFORM_DRIVER ++ platform_driver_unregister(&OHCI_PLATFORM_DRIVER); ++#endif + #ifdef TMIO_OHCI_DRIVER + platform_driver_unregister(&TMIO_OHCI_DRIVER); + #endif diff --git a/target/linux/generic/patches-3.8/801-usb-ehci-multiple-platform-driver-fix.patch b/target/linux/generic/patches-3.8/801-usb-ehci-multiple-platform-driver-fix.patch new file mode 100644 index 0000000000..e803044475 --- /dev/null +++ b/target/linux/generic/patches-3.8/801-usb-ehci-multiple-platform-driver-fix.patch @@ -0,0 +1,47 @@ +--- a/drivers/usb/host/ehci-hcd.c ++++ b/drivers/usb/host/ehci-hcd.c +@@ -1336,12 +1336,12 @@ MODULE_LICENSE ("GPL"); + + #ifdef CONFIG_USB_EHCI_HCD_PLATFORM + #include "ehci-platform.c" +-#define PLATFORM_DRIVER ehci_platform_driver ++#define EHCI_PLATFORM_DRIVER ehci_platform_driver + #endif + + #if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) && \ + !defined(PS3_SYSTEM_BUS_DRIVER) && !defined(OF_PLATFORM_DRIVER) && \ +- !defined(XILINX_OF_PLATFORM_DRIVER) ++ !defined(XILINX_OF_PLATFORM_DRIVER) && !defined(EHCI_PLATFORM_DRIVER) + #error "missing bus glue for ehci-hcd" + #endif + +@@ -1401,8 +1401,19 @@ static int __init ehci_hcd_init(void) + if (retval < 0) + goto clean4; + #endif ++ ++#ifdef EHCI_PLATFORM_DRIVER ++ retval = platform_driver_register(&EHCI_PLATFORM_DRIVER); ++ if (retval < 0) ++ goto clean5; ++#endif ++ + return retval; + ++#ifdef EHCI_PLATFORM_DRIVER ++ platform_driver_unregister(&EHCI_PLATFORM_DRIVER); ++clean5: ++#endif + #ifdef XILINX_OF_PLATFORM_DRIVER + /* platform_driver_unregister(&XILINX_OF_PLATFORM_DRIVER); */ + clean4: +@@ -1435,6 +1446,9 @@ module_init(ehci_hcd_init); + + static void __exit ehci_hcd_cleanup(void) + { ++#ifdef EHCI_PLATFORM_DRIVER ++ platform_driver_unregister(&EHCI_PLATFORM_DRIVER); ++#endif + #ifdef XILINX_OF_PLATFORM_DRIVER + platform_driver_unregister(&XILINX_OF_PLATFORM_DRIVER); + #endif -- 2.11.0