aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/usb/ehci-omap.txt32
-rw-r--r--Documentation/devicetree/bindings/usb/ohci-omap3.txt15
-rw-r--r--drivers/staging/Kconfig2
-rw-r--r--drivers/staging/Makefile1
-rw-r--r--drivers/usb/chipidea/usbmisc_imx6q.c4
-rw-r--r--drivers/usb/class/cdc-acm.c8
-rw-r--r--drivers/usb/host/Kconfig3
-rw-r--r--drivers/usb/host/Makefile1
-rw-r--r--drivers/usb/host/ehci-hcd.c10
-rw-r--r--drivers/usb/host/ehci-hub.c20
-rw-r--r--drivers/usb/host/ehci-mv.c2
-rw-r--r--drivers/usb/host/ehci-mxc.c8
-rw-r--r--drivers/usb/host/ehci-omap.c331
-rw-r--r--drivers/usb/host/ehci-orion.c4
-rw-r--r--drivers/usb/host/ehci-s5p.c11
-rw-r--r--drivers/usb/host/ehci-sh.c4
-rw-r--r--drivers/usb/host/ehci-timer.c61
-rw-r--r--drivers/usb/host/ohci-omap3.c24
-rw-r--r--drivers/usb/misc/sisusbvga/sisusb.c2
-rw-r--r--drivers/usb/misc/usb3503.c13
-rw-r--r--drivers/usb/otg/isp1301_omap.c4
-rw-r--r--drivers/usb/otg/twl4030-usb.c4
-rw-r--r--drivers/usb/otg/twl6030-usb.c4
-rw-r--r--drivers/usb/phy/mv_u3d_phy.c2
-rw-r--r--drivers/usb/serial/mos7840.c3
-rw-r--r--drivers/usb/serial/quatech2.c7
-rw-r--r--drivers/usb/serial/usb-serial.c14
-rw-r--r--drivers/usb/storage/isd200.c3
-rw-r--r--drivers/usb/storage/onetouch.c4
-rw-r--r--include/linux/usb.h4
30 files changed, 292 insertions, 313 deletions
diff --git a/Documentation/devicetree/bindings/usb/ehci-omap.txt b/Documentation/devicetree/bindings/usb/ehci-omap.txt
new file mode 100644
index 000000000000..485a9a1efa7a
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/ehci-omap.txt
@@ -0,0 +1,32 @@
1OMAP HS USB EHCI controller
2
3This device is usually the child of the omap-usb-host
4Documentation/devicetree/bindings/mfd/omap-usb-host.txt
5
6Required properties:
7
8- compatible: should be "ti,ehci-omap"
9- reg: should contain one register range i.e. start and length
10- interrupts: description of the interrupt line
11
12Optional properties:
13
14- phys: list of phandles to PHY nodes.
15 This property is required if at least one of the ports are in
16 PHY mode i.e. OMAP_EHCI_PORT_MODE_PHY
17
18To specify the port mode, see
19Documentation/devicetree/bindings/mfd/omap-usb-host.txt
20
21Example for OMAP4:
22
23usbhsehci: ehci@4a064c00 {
24 compatible = "ti,ehci-omap", "usb-ehci";
25 reg = <0x4a064c00 0x400>;
26 interrupts = <0 77 0x4>;
27};
28
29&usbhsehci {
30 phys = <&hsusb1_phy 0 &hsusb3_phy>;
31};
32
diff --git a/Documentation/devicetree/bindings/usb/ohci-omap3.txt b/Documentation/devicetree/bindings/usb/ohci-omap3.txt
new file mode 100644
index 000000000000..14ab42812a8e
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/ohci-omap3.txt
@@ -0,0 +1,15 @@
1OMAP HS USB OHCI controller (OMAP3 and later)
2
3Required properties:
4
5- compatible: should be "ti,ohci-omap3"
6- reg: should contain one register range i.e. start and length
7- interrupts: description of the interrupt line
8
9Example for OMAP4:
10
11usbhsohci: ohci@4a064800 {
12 compatible = "ti,ohci-omap3", "usb-ohci";
13 reg = <0x4a064800 0x400>;
14 interrupts = <0 76 0x4>;
15};
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index 093f10c88cce..659855cecda5 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -116,8 +116,6 @@ source "drivers/staging/android/Kconfig"
116 116
117source "drivers/staging/ozwpan/Kconfig" 117source "drivers/staging/ozwpan/Kconfig"
118 118
119source "drivers/staging/ccg/Kconfig"
120
121source "drivers/staging/gdm72xx/Kconfig" 119source "drivers/staging/gdm72xx/Kconfig"
122 120
123source "drivers/staging/csr/Kconfig" 121source "drivers/staging/csr/Kconfig"
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index fa41b04cf4cb..b367ea876854 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -50,7 +50,6 @@ obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4) += ste_rmi4/
50obj-$(CONFIG_MFD_NVEC) += nvec/ 50obj-$(CONFIG_MFD_NVEC) += nvec/
51obj-$(CONFIG_ANDROID) += android/ 51obj-$(CONFIG_ANDROID) += android/
52obj-$(CONFIG_USB_WPAN_HCD) += ozwpan/ 52obj-$(CONFIG_USB_WPAN_HCD) += ozwpan/
53obj-$(CONFIG_USB_G_CCG) += ccg/
54obj-$(CONFIG_WIMAX_GDM72XX) += gdm72xx/ 53obj-$(CONFIG_WIMAX_GDM72XX) += gdm72xx/
55obj-$(CONFIG_CSR_WIFI) += csr/ 54obj-$(CONFIG_CSR_WIFI) += csr/
56obj-$(CONFIG_OMAP_BANDGAP) += omap-thermal/ 55obj-$(CONFIG_OMAP_BANDGAP) += omap-thermal/
diff --git a/drivers/usb/chipidea/usbmisc_imx6q.c b/drivers/usb/chipidea/usbmisc_imx6q.c
index a1bce391e825..113fcea77bdf 100644
--- a/drivers/usb/chipidea/usbmisc_imx6q.c
+++ b/drivers/usb/chipidea/usbmisc_imx6q.c
@@ -144,13 +144,13 @@ static struct platform_driver usbmisc_imx6q_driver = {
144 }, 144 },
145}; 145};
146 146
147int __init usbmisc_imx6q_drv_init(void) 147static int __init usbmisc_imx6q_drv_init(void)
148{ 148{
149 return platform_driver_register(&usbmisc_imx6q_driver); 149 return platform_driver_register(&usbmisc_imx6q_driver);
150} 150}
151subsys_initcall(usbmisc_imx6q_drv_init); 151subsys_initcall(usbmisc_imx6q_drv_init);
152 152
153void __exit usbmisc_imx6q_drv_exit(void) 153static void __exit usbmisc_imx6q_drv_exit(void)
154{ 154{
155 platform_driver_unregister(&usbmisc_imx6q_driver); 155 platform_driver_unregister(&usbmisc_imx6q_driver);
156} 156}
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 387dc6c8ad25..6d4e0b96f89d 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -839,14 +839,6 @@ static int acm_tty_ioctl(struct tty_struct *tty,
839 return rv; 839 return rv;
840} 840}
841 841
842static const __u32 acm_tty_speed[] = {
843 0, 50, 75, 110, 134, 150, 200, 300, 600,
844 1200, 1800, 2400, 4800, 9600, 19200, 38400,
845 57600, 115200, 230400, 460800, 500000, 576000,
846 921600, 1000000, 1152000, 1500000, 2000000,
847 2500000, 3000000, 3500000, 4000000
848};
849
850static void acm_tty_set_termios(struct tty_struct *tty, 842static void acm_tty_set_termios(struct tty_struct *tty,
851 struct ktermios *termios_old) 843 struct ktermios *termios_old)
852{ 844{
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index c59a1126926f..2f682219e257 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -155,8 +155,9 @@ config USB_EHCI_MXC
155 Variation of ARC USB block used in some Freescale chips. 155 Variation of ARC USB block used in some Freescale chips.
156 156
157config USB_EHCI_HCD_OMAP 157config USB_EHCI_HCD_OMAP
158 bool "EHCI support for OMAP3 and later chips" 158 tristate "EHCI support for OMAP3 and later chips"
159 depends on USB_EHCI_HCD && ARCH_OMAP 159 depends on USB_EHCI_HCD && ARCH_OMAP
160 select NOP_USB_XCEIV
160 default y 161 default y
161 ---help--- 162 ---help---
162 Enables support for the on-chip EHCI controller on 163 Enables support for the on-chip EHCI controller on
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 001fbff2fdef..56de4106c8b3 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -27,6 +27,7 @@ obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o
27obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o 27obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o
28obj-$(CONFIG_USB_EHCI_HCD_PLATFORM) += ehci-platform.o 28obj-$(CONFIG_USB_EHCI_HCD_PLATFORM) += ehci-platform.o
29obj-$(CONFIG_USB_EHCI_MXC) += ehci-mxc.o 29obj-$(CONFIG_USB_EHCI_MXC) += ehci-mxc.o
30obj-$(CONFIG_USB_EHCI_HCD_OMAP) += ehci-omap.o
30 31
31obj-$(CONFIG_USB_OXU210HP_HCD) += oxu210hp-hcd.o 32obj-$(CONFIG_USB_OXU210HP_HCD) += oxu210hp-hcd.o
32obj-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o 33obj-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 416a6dce5e11..0c3314c41363 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -757,7 +757,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
757 /* remote wakeup [4.3.1] */ 757 /* remote wakeup [4.3.1] */
758 if (status & STS_PCD) { 758 if (status & STS_PCD) {
759 unsigned i = HCS_N_PORTS (ehci->hcs_params); 759 unsigned i = HCS_N_PORTS (ehci->hcs_params);
760 u32 ppcd = 0; 760 u32 ppcd = ~0;
761 761
762 /* kick root hub later */ 762 /* kick root hub later */
763 pcd_status = status; 763 pcd_status = status;
@@ -774,7 +774,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
774 int pstatus; 774 int pstatus;
775 775
776 /* leverage per-port change bits feature */ 776 /* leverage per-port change bits feature */
777 if (ehci->has_ppcd && !(ppcd & (1 << i))) 777 if (!(ppcd & (1 << i)))
778 continue; 778 continue;
779 pstatus = ehci_readl(ehci, 779 pstatus = ehci_readl(ehci,
780 &ehci->regs->port_status[i]); 780 &ehci->regs->port_status[i]);
@@ -1251,11 +1251,6 @@ MODULE_LICENSE ("GPL");
1251#define PLATFORM_DRIVER ehci_hcd_sh_driver 1251#define PLATFORM_DRIVER ehci_hcd_sh_driver
1252#endif 1252#endif
1253 1253
1254#ifdef CONFIG_USB_EHCI_HCD_OMAP
1255#include "ehci-omap.c"
1256#define PLATFORM_DRIVER ehci_hcd_omap_driver
1257#endif
1258
1259#ifdef CONFIG_PPC_PS3 1254#ifdef CONFIG_PPC_PS3
1260#include "ehci-ps3.c" 1255#include "ehci-ps3.c"
1261#define PS3_SYSTEM_BUS_DRIVER ps3_ehci_driver 1256#define PS3_SYSTEM_BUS_DRIVER ps3_ehci_driver
@@ -1345,6 +1340,7 @@ MODULE_LICENSE ("GPL");
1345 !IS_ENABLED(CONFIG_USB_EHCI_HCD_PLATFORM) && \ 1340 !IS_ENABLED(CONFIG_USB_EHCI_HCD_PLATFORM) && \
1346 !IS_ENABLED(CONFIG_USB_CHIPIDEA_HOST) && \ 1341 !IS_ENABLED(CONFIG_USB_CHIPIDEA_HOST) && \
1347 !IS_ENABLED(CONFIG_USB_EHCI_MXC) && \ 1342 !IS_ENABLED(CONFIG_USB_EHCI_MXC) && \
1343 !IS_ENABLED(CONFIG_USB_EHCI_HCD_OMAP) && \
1348 !defined(PLATFORM_DRIVER) && \ 1344 !defined(PLATFORM_DRIVER) && \
1349 !defined(PS3_SYSTEM_BUS_DRIVER) && \ 1345 !defined(PS3_SYSTEM_BUS_DRIVER) && \
1350 !defined(OF_PLATFORM_DRIVER) && \ 1346 !defined(OF_PLATFORM_DRIVER) && \
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 7d06e77f6c4f..7b04ca96b585 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -464,7 +464,7 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
464 while (i--) { 464 while (i--) {
465 temp = ehci_readl(ehci, &ehci->regs->port_status [i]); 465 temp = ehci_readl(ehci, &ehci->regs->port_status [i]);
466 if (test_bit(i, &resume_needed)) { 466 if (test_bit(i, &resume_needed)) {
467 temp &= ~(PORT_RWC_BITS | PORT_RESUME); 467 temp &= ~(PORT_RWC_BITS | PORT_SUSPEND | PORT_RESUME);
468 ehci_writel(ehci, temp, &ehci->regs->port_status [i]); 468 ehci_writel(ehci, temp, &ehci->regs->port_status [i]);
469 ehci_vdbg (ehci, "resumed port %d\n", i + 1); 469 ehci_vdbg (ehci, "resumed port %d\n", i + 1);
470 } 470 }
@@ -590,7 +590,7 @@ ehci_hub_status_data (struct usb_hcd *hcd, char *buf)
590 u32 mask; 590 u32 mask;
591 int ports, i, retval = 1; 591 int ports, i, retval = 1;
592 unsigned long flags; 592 unsigned long flags;
593 u32 ppcd = 0; 593 u32 ppcd = ~0;
594 594
595 /* init status to no-changes */ 595 /* init status to no-changes */
596 buf [0] = 0; 596 buf [0] = 0;
@@ -628,9 +628,10 @@ ehci_hub_status_data (struct usb_hcd *hcd, char *buf)
628 628
629 for (i = 0; i < ports; i++) { 629 for (i = 0; i < ports; i++) {
630 /* leverage per-port change bits feature */ 630 /* leverage per-port change bits feature */
631 if (ehci->has_ppcd && !(ppcd & (1 << i))) 631 if (ppcd & (1 << i))
632 continue; 632 temp = ehci_readl(ehci, &ehci->regs->port_status[i]);
633 temp = ehci_readl(ehci, &ehci->regs->port_status [i]); 633 else
634 temp = 0;
634 635
635 /* 636 /*
636 * Return status information even for ports with OWNER set. 637 * Return status information even for ports with OWNER set.
@@ -870,10 +871,9 @@ static int ehci_hub_control (
870 usb_hcd_end_port_resume(&hcd->self, wIndex); 871 usb_hcd_end_port_resume(&hcd->self, wIndex);
871 872
872 /* stop resume signaling */ 873 /* stop resume signaling */
873 temp = ehci_readl(ehci, status_reg); 874 temp &= ~(PORT_RWC_BITS |
874 ehci_writel(ehci, 875 PORT_SUSPEND | PORT_RESUME);
875 temp & ~(PORT_RWC_BITS | PORT_RESUME), 876 ehci_writel(ehci, temp, status_reg);
876 status_reg);
877 clear_bit(wIndex, &ehci->resuming_ports); 877 clear_bit(wIndex, &ehci->resuming_ports);
878 retval = handshake(ehci, status_reg, 878 retval = handshake(ehci, status_reg,
879 PORT_RESUME, 0, 2000 /* 2msec */); 879 PORT_RESUME, 0, 2000 /* 2msec */);
@@ -883,7 +883,7 @@ static int ehci_hub_control (
883 wIndex + 1, retval); 883 wIndex + 1, retval);
884 goto error; 884 goto error;
885 } 885 }
886 temp &= ~(PORT_SUSPEND|PORT_RESUME|(3<<10)); 886 temp = ehci_readl(ehci, status_reg);
887 } 887 }
888 } 888 }
889 889
diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c
index 3065809546b1..5cd9f96ed92d 100644
--- a/drivers/usb/host/ehci-mv.c
+++ b/drivers/usb/host/ehci-mv.c
@@ -225,7 +225,7 @@ static int mv_ehci_probe(struct platform_device *pdev)
225 (void __iomem *) ((unsigned long) ehci_mv->cap_regs + offset); 225 (void __iomem *) ((unsigned long) ehci_mv->cap_regs + offset);
226 226
227 hcd->rsrc_start = r->start; 227 hcd->rsrc_start = r->start;
228 hcd->rsrc_len = r->end - r->start + 1; 228 hcd->rsrc_len = resource_size(r);
229 hcd->regs = ehci_mv->op_regs; 229 hcd->regs = ehci_mv->op_regs;
230 230
231 hcd->irq = platform_get_irq(pdev, 0); 231 hcd->irq = platform_get_irq(pdev, 0);
diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c
index e9301fb97eaa..a38c8c8e5b0d 100644
--- a/drivers/usb/host/ehci-mxc.c
+++ b/drivers/usb/host/ehci-mxc.c
@@ -28,11 +28,7 @@
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/usb.h> 29#include <linux/usb.h>
30#include <linux/usb/hcd.h> 30#include <linux/usb/hcd.h>
31
32#include <linux/platform_data/usb-ehci-mxc.h> 31#include <linux/platform_data/usb-ehci-mxc.h>
33
34#include <asm/mach-types.h>
35
36#include "ehci.h" 32#include "ehci.h"
37 33
38#define DRIVER_DESC "Freescale On-Chip EHCI Host driver" 34#define DRIVER_DESC "Freescale On-Chip EHCI Host driver"
@@ -61,8 +57,6 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev)
61 struct device *dev = &pdev->dev; 57 struct device *dev = &pdev->dev;
62 struct ehci_hcd *ehci; 58 struct ehci_hcd *ehci;
63 59
64 dev_info(&pdev->dev, "initializing i.MX USB Controller\n");
65
66 if (!pdata) { 60 if (!pdata) {
67 dev_err(dev, "No platform data given, bailing out.\n"); 61 dev_err(dev, "No platform data given, bailing out.\n");
68 return -EINVAL; 62 return -EINVAL;
@@ -178,7 +172,7 @@ err_alloc:
178 return ret; 172 return ret;
179} 173}
180 174
181static int __exit ehci_mxc_drv_remove(struct platform_device *pdev) 175static int ehci_mxc_drv_remove(struct platform_device *pdev)
182{ 176{
183 struct mxc_usbh_platform_data *pdata = pdev->dev.platform_data; 177 struct mxc_usbh_platform_data *pdata = pdev->dev.platform_data;
184 struct usb_hcd *hcd = platform_get_drvdata(pdev); 178 struct usb_hcd *hcd = platform_get_drvdata(pdev);
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 0555ee42d7cb..5de3e43ded50 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -4,10 +4,11 @@
4 * Bus Glue for the EHCI controllers in OMAP3/4 4 * Bus Glue for the EHCI controllers in OMAP3/4
5 * Tested on several OMAP3 boards, and OMAP4 Pandaboard 5 * Tested on several OMAP3 boards, and OMAP4 Pandaboard
6 * 6 *
7 * Copyright (C) 2007-2011 Texas Instruments, Inc. 7 * Copyright (C) 2007-2013 Texas Instruments, Inc.
8 * Author: Vikram Pandita <vikram.pandita@ti.com> 8 * Author: Vikram Pandita <vikram.pandita@ti.com>
9 * Author: Anand Gadiyar <gadiyar@ti.com> 9 * Author: Anand Gadiyar <gadiyar@ti.com>
10 * Author: Keshava Munegowda <keshava_mgowda@ti.com> 10 * Author: Keshava Munegowda <keshava_mgowda@ti.com>
11 * Author: Roger Quadros <rogerq@ti.com>
11 * 12 *
12 * Copyright (C) 2009 Nokia Corporation 13 * Copyright (C) 2009 Nokia Corporation
13 * Contact: Felipe Balbi <felipe.balbi@nokia.com> 14 * Contact: Felipe Balbi <felipe.balbi@nokia.com>
@@ -28,21 +29,23 @@
28 * along with this program; if not, write to the Free Software 29 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 * 31 *
31 * TODO (last updated Feb 27, 2010):
32 * - add kernel-doc
33 * - enable AUTOIDLE
34 * - add suspend/resume
35 * - add HSIC and TLL support
36 * - convert to use hwmod and runtime PM
37 */ 32 */
38 33
34#include <linux/kernel.h>
35#include <linux/module.h>
36#include <linux/io.h>
39#include <linux/platform_device.h> 37#include <linux/platform_device.h>
40#include <linux/slab.h> 38#include <linux/slab.h>
41#include <linux/usb/ulpi.h> 39#include <linux/usb/ulpi.h>
42#include <linux/regulator/consumer.h>
43#include <linux/pm_runtime.h> 40#include <linux/pm_runtime.h>
44#include <linux/gpio.h> 41#include <linux/gpio.h>
45#include <linux/clk.h> 42#include <linux/clk.h>
43#include <linux/usb.h>
44#include <linux/usb/hcd.h>
45#include <linux/of.h>
46#include <linux/dma-mapping.h>
47
48#include "ehci.h"
46 49
47#include <linux/platform_data/usb-omap.h> 50#include <linux/platform_data/usb-omap.h>
48 51
@@ -57,10 +60,16 @@
57#define EHCI_INSNREG05_ULPI_EXTREGADD_SHIFT 8 60#define EHCI_INSNREG05_ULPI_EXTREGADD_SHIFT 8
58#define EHCI_INSNREG05_ULPI_WRDATA_SHIFT 0 61#define EHCI_INSNREG05_ULPI_WRDATA_SHIFT 0
59 62
60/*-------------------------------------------------------------------------*/ 63#define DRIVER_DESC "OMAP-EHCI Host Controller driver"
64
65static const char hcd_name[] = "ehci-omap";
61 66
62static const struct hc_driver ehci_omap_hc_driver; 67/*-------------------------------------------------------------------------*/
63 68
69struct omap_hcd {
70 struct usb_phy *phy[OMAP3_HS_USB_PORTS]; /* one PHY for each port */
71 int nports;
72};
64 73
65static inline void ehci_write(void __iomem *base, u32 reg, u32 val) 74static inline void ehci_write(void __iomem *base, u32 reg, u32 val)
66{ 75{
@@ -72,99 +81,16 @@ static inline u32 ehci_read(void __iomem *base, u32 reg)
72 return __raw_readl(base + reg); 81 return __raw_readl(base + reg);
73} 82}
74 83
84/* configure so an HC device and id are always provided */
85/* always called with process context; sleeping is OK */
75 86
76static void omap_ehci_soft_phy_reset(struct usb_hcd *hcd, u8 port) 87static struct hc_driver __read_mostly ehci_omap_hc_driver;
77{
78 unsigned long timeout = jiffies + msecs_to_jiffies(1000);
79 unsigned reg = 0;
80
81 reg = ULPI_FUNC_CTRL_RESET
82 /* FUNCTION_CTRL_SET register */
83 | (ULPI_SET(ULPI_FUNC_CTRL) << EHCI_INSNREG05_ULPI_REGADD_SHIFT)
84 /* Write */
85 | (2 << EHCI_INSNREG05_ULPI_OPSEL_SHIFT)
86 /* PORTn */
87 | ((port + 1) << EHCI_INSNREG05_ULPI_PORTSEL_SHIFT)
88 /* start ULPI access*/
89 | (1 << EHCI_INSNREG05_ULPI_CONTROL_SHIFT);
90
91 ehci_write(hcd->regs, EHCI_INSNREG05_ULPI, reg);
92
93 /* Wait for ULPI access completion */
94 while ((ehci_read(hcd->regs, EHCI_INSNREG05_ULPI)
95 & (1 << EHCI_INSNREG05_ULPI_CONTROL_SHIFT))) {
96 cpu_relax();
97
98 if (time_after(jiffies, timeout)) {
99 dev_dbg(hcd->self.controller,
100 "phy reset operation timed out\n");
101 break;
102 }
103 }
104}
105
106static int omap_ehci_init(struct usb_hcd *hcd)
107{
108 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
109 int rc;
110 struct usbhs_omap_platform_data *pdata;
111
112 pdata = hcd->self.controller->platform_data;
113
114 /* Hold PHYs in reset while initializing EHCI controller */
115 if (pdata->phy_reset) {
116 if (gpio_is_valid(pdata->reset_gpio_port[0]))
117 gpio_set_value_cansleep(pdata->reset_gpio_port[0], 0);
118
119 if (gpio_is_valid(pdata->reset_gpio_port[1]))
120 gpio_set_value_cansleep(pdata->reset_gpio_port[1], 0);
121
122 /* Hold the PHY in RESET for enough time till DIR is high */
123 udelay(10);
124 }
125
126 /* Soft reset the PHY using PHY reset command over ULPI */
127 if (pdata->port_mode[0] == OMAP_EHCI_PORT_MODE_PHY)
128 omap_ehci_soft_phy_reset(hcd, 0);
129 if (pdata->port_mode[1] == OMAP_EHCI_PORT_MODE_PHY)
130 omap_ehci_soft_phy_reset(hcd, 1);
131
132 /* we know this is the memory we want, no need to ioremap again */
133 ehci->caps = hcd->regs;
134
135 rc = ehci_setup(hcd);
136
137 if (pdata->phy_reset) {
138 /* Hold the PHY in RESET for enough time till
139 * PHY is settled and ready
140 */
141 udelay(10);
142
143 if (gpio_is_valid(pdata->reset_gpio_port[0]))
144 gpio_set_value_cansleep(pdata->reset_gpio_port[0], 1);
145
146 if (gpio_is_valid(pdata->reset_gpio_port[1]))
147 gpio_set_value_cansleep(pdata->reset_gpio_port[1], 1);
148 }
149
150 return rc;
151}
152 88
153static void disable_put_regulator( 89static const struct ehci_driver_overrides ehci_omap_overrides __initdata = {
154 struct usbhs_omap_platform_data *pdata) 90 .extra_priv_size = sizeof(struct omap_hcd),
155{ 91};
156 int i;
157
158 for (i = 0 ; i < OMAP3_HS_USB_PORTS ; i++) {
159 if (pdata->regulator[i]) {
160 regulator_disable(pdata->regulator[i]);
161 regulator_put(pdata->regulator[i]);
162 }
163 }
164}
165 92
166/* configure so an HC device and id are always provided */ 93static u64 omap_ehci_dma_mask = DMA_BIT_MASK(32);
167/* always called with process context; sleeping is OK */
168 94
169/** 95/**
170 * ehci_hcd_omap_probe - initialize TI-based HCDs 96 * ehci_hcd_omap_probe - initialize TI-based HCDs
@@ -175,15 +101,15 @@ static void disable_put_regulator(
175 */ 101 */
176static int ehci_hcd_omap_probe(struct platform_device *pdev) 102static int ehci_hcd_omap_probe(struct platform_device *pdev)
177{ 103{
178 struct device *dev = &pdev->dev; 104 struct device *dev = &pdev->dev;
179 struct usbhs_omap_platform_data *pdata = dev->platform_data; 105 struct usbhs_omap_platform_data *pdata = dev->platform_data;
180 struct resource *res; 106 struct resource *res;
181 struct usb_hcd *hcd; 107 struct usb_hcd *hcd;
182 void __iomem *regs; 108 void __iomem *regs;
183 int ret = -ENODEV; 109 int ret = -ENODEV;
184 int irq; 110 int irq;
185 int i; 111 int i;
186 char supply[7]; 112 struct omap_hcd *omap;
187 113
188 if (usb_disabled()) 114 if (usb_disabled())
189 return -ENODEV; 115 return -ENODEV;
@@ -193,52 +119,74 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
193 return -ENODEV; 119 return -ENODEV;
194 } 120 }
195 121
196 irq = platform_get_irq_byname(pdev, "ehci-irq"); 122 /* For DT boot, get platform data from parent. i.e. usbhshost */
197 if (irq < 0) { 123 if (dev->of_node) {
198 dev_err(dev, "EHCI irq failed\n"); 124 pdata = dev->parent->platform_data;
199 return -ENODEV; 125 dev->platform_data = pdata;
200 } 126 }
201 127
202 res = platform_get_resource_byname(pdev, 128 if (!pdata) {
203 IORESOURCE_MEM, "ehci"); 129 dev_err(dev, "Missing platform data\n");
204 if (!res) {
205 dev_err(dev, "UHH EHCI get resource failed\n");
206 return -ENODEV; 130 return -ENODEV;
207 } 131 }
208 132
209 regs = ioremap(res->start, resource_size(res)); 133 irq = platform_get_irq(pdev, 0);
210 if (!regs) { 134 if (irq < 0) {
211 dev_err(dev, "UHH EHCI ioremap failed\n"); 135 dev_err(dev, "EHCI irq failed\n");
212 return -ENOMEM; 136 return -ENODEV;
213 } 137 }
214 138
139 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
140 regs = devm_ioremap_resource(dev, res);
141 if (IS_ERR(regs))
142 return PTR_ERR(regs);
143
144 /*
145 * Right now device-tree probed devices don't get dma_mask set.
146 * Since shared usb code relies on it, set it here for now.
147 * Once we have dma capability bindings this can go away.
148 */
149 if (!pdev->dev.dma_mask)
150 pdev->dev.dma_mask = &omap_ehci_dma_mask;
151
215 hcd = usb_create_hcd(&ehci_omap_hc_driver, dev, 152 hcd = usb_create_hcd(&ehci_omap_hc_driver, dev,
216 dev_name(dev)); 153 dev_name(dev));
217 if (!hcd) { 154 if (!hcd) {
218 dev_err(dev, "failed to create hcd with err %d\n", ret); 155 dev_err(dev, "Failed to create HCD\n");
219 ret = -ENOMEM; 156 return -ENOMEM;
220 goto err_io;
221 } 157 }
222 158
223 hcd->rsrc_start = res->start; 159 hcd->rsrc_start = res->start;
224 hcd->rsrc_len = resource_size(res); 160 hcd->rsrc_len = resource_size(res);
225 hcd->regs = regs; 161 hcd->regs = regs;
226 162 hcd_to_ehci(hcd)->caps = regs;
227 /* get ehci regulator and enable */ 163
228 for (i = 0 ; i < OMAP3_HS_USB_PORTS ; i++) { 164 omap = (struct omap_hcd *)hcd_to_ehci(hcd)->priv;
229 if (pdata->port_mode[i] != OMAP_EHCI_PORT_MODE_PHY) { 165 omap->nports = pdata->nports;
230 pdata->regulator[i] = NULL; 166
231 continue; 167 platform_set_drvdata(pdev, hcd);
232 } 168
233 snprintf(supply, sizeof(supply), "hsusb%d", i); 169 /* get the PHY devices if needed */
234 pdata->regulator[i] = regulator_get(dev, supply); 170 for (i = 0 ; i < omap->nports ; i++) {
235 if (IS_ERR(pdata->regulator[i])) { 171 struct usb_phy *phy;
236 pdata->regulator[i] = NULL; 172
237 dev_dbg(dev, 173 /* get the PHY device */
238 "failed to get ehci port%d regulator\n", i); 174 if (dev->of_node)
239 } else { 175 phy = devm_usb_get_phy_by_phandle(dev, "phys", i);
240 regulator_enable(pdata->regulator[i]); 176 else
177 phy = devm_usb_get_phy_dev(dev, i);
178 if (IS_ERR(phy) || !phy) {
179 /* Don't bail out if PHY is not absolutely necessary */
180 if (pdata->port_mode[i] != OMAP_EHCI_PORT_MODE_PHY)
181 continue;
182
183 ret = IS_ERR(phy) ? PTR_ERR(phy) : -ENODEV;
184 dev_err(dev, "Can't get PHY device for port %d: %d\n",
185 i, ret);
186 goto err_phy;
241 } 187 }
188
189 omap->phy[i] = phy;
242 } 190 }
243 191
244 pm_runtime_enable(dev); 192 pm_runtime_enable(dev);
@@ -262,16 +210,34 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
262 goto err_pm_runtime; 210 goto err_pm_runtime;
263 } 211 }
264 212
213 /*
214 * Bring PHYs out of reset.
215 * Even though HSIC mode is a PHY-less mode, the reset
216 * line exists between the chips and can be modelled
217 * as a PHY device for reset control.
218 */
219 for (i = 0; i < omap->nports; i++) {
220 if (!omap->phy[i])
221 continue;
222
223 usb_phy_init(omap->phy[i]);
224 /* bring PHY out of suspend */
225 usb_phy_set_suspend(omap->phy[i], 0);
226 }
265 227
266 return 0; 228 return 0;
267 229
268err_pm_runtime: 230err_pm_runtime:
269 disable_put_regulator(pdata);
270 pm_runtime_put_sync(dev); 231 pm_runtime_put_sync(dev);
232
233err_phy:
234 for (i = 0; i < omap->nports; i++) {
235 if (omap->phy[i])
236 usb_phy_shutdown(omap->phy[i]);
237 }
238
271 usb_put_hcd(hcd); 239 usb_put_hcd(hcd);
272 240
273err_io:
274 iounmap(regs);
275 return ret; 241 return ret;
276} 242}
277 243
@@ -286,14 +252,19 @@ err_io:
286 */ 252 */
287static int ehci_hcd_omap_remove(struct platform_device *pdev) 253static int ehci_hcd_omap_remove(struct platform_device *pdev)
288{ 254{
289 struct device *dev = &pdev->dev; 255 struct device *dev = &pdev->dev;
290 struct usb_hcd *hcd = dev_get_drvdata(dev); 256 struct usb_hcd *hcd = dev_get_drvdata(dev);
257 struct omap_hcd *omap = (struct omap_hcd *)hcd_to_ehci(hcd)->priv;
258 int i;
291 259
292 usb_remove_hcd(hcd); 260 usb_remove_hcd(hcd);
293 disable_put_regulator(dev->platform_data);
294 iounmap(hcd->regs);
295 usb_put_hcd(hcd);
296 261
262 for (i = 0; i < omap->nports; i++) {
263 if (omap->phy[i])
264 usb_phy_shutdown(omap->phy[i]);
265 }
266
267 usb_put_hcd(hcd);
297 pm_runtime_put_sync(dev); 268 pm_runtime_put_sync(dev);
298 pm_runtime_disable(dev); 269 pm_runtime_disable(dev);
299 270
@@ -308,6 +279,13 @@ static void ehci_hcd_omap_shutdown(struct platform_device *pdev)
308 hcd->driver->shutdown(hcd); 279 hcd->driver->shutdown(hcd);
309} 280}
310 281
282static const struct of_device_id omap_ehci_dt_ids[] = {
283 { .compatible = "ti,ehci-omap" },
284 { }
285};
286
287MODULE_DEVICE_TABLE(of, omap_ehci_dt_ids);
288
311static struct platform_driver ehci_hcd_omap_driver = { 289static struct platform_driver ehci_hcd_omap_driver = {
312 .probe = ehci_hcd_omap_probe, 290 .probe = ehci_hcd_omap_probe,
313 .remove = ehci_hcd_omap_remove, 291 .remove = ehci_hcd_omap_remove,
@@ -315,56 +293,35 @@ static struct platform_driver ehci_hcd_omap_driver = {
315 /*.suspend = ehci_hcd_omap_suspend, */ 293 /*.suspend = ehci_hcd_omap_suspend, */
316 /*.resume = ehci_hcd_omap_resume, */ 294 /*.resume = ehci_hcd_omap_resume, */
317 .driver = { 295 .driver = {
318 .name = "ehci-omap", 296 .name = hcd_name,
297 .of_match_table = of_match_ptr(omap_ehci_dt_ids),
319 } 298 }
320}; 299};
321 300
322/*-------------------------------------------------------------------------*/ 301/*-------------------------------------------------------------------------*/
323 302
324static const struct hc_driver ehci_omap_hc_driver = { 303static int __init ehci_omap_init(void)
325 .description = hcd_name, 304{
326 .product_desc = "OMAP-EHCI Host Controller", 305 if (usb_disabled())
327 .hcd_priv_size = sizeof(struct ehci_hcd), 306 return -ENODEV;
328
329 /*
330 * generic hardware linkage
331 */
332 .irq = ehci_irq,
333 .flags = HCD_MEMORY | HCD_USB2,
334
335 /*
336 * basic lifecycle operations
337 */
338 .reset = omap_ehci_init,
339 .start = ehci_run,
340 .stop = ehci_stop,
341 .shutdown = ehci_shutdown,
342
343 /*
344 * managing i/o requests and associated device resources
345 */
346 .urb_enqueue = ehci_urb_enqueue,
347 .urb_dequeue = ehci_urb_dequeue,
348 .endpoint_disable = ehci_endpoint_disable,
349 .endpoint_reset = ehci_endpoint_reset,
350 307
351 /* 308 pr_info("%s: " DRIVER_DESC "\n", hcd_name);
352 * scheduling support
353 */
354 .get_frame_number = ehci_get_frame,
355 309
356 /* 310 ehci_init_driver(&ehci_omap_hc_driver, &ehci_omap_overrides);
357 * root hub support 311 return platform_driver_register(&ehci_hcd_omap_driver);
358 */ 312}
359 .hub_status_data = ehci_hub_status_data, 313module_init(ehci_omap_init);
360 .hub_control = ehci_hub_control,
361 .bus_suspend = ehci_bus_suspend,
362 .bus_resume = ehci_bus_resume,
363 314
364 .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, 315static void __exit ehci_omap_cleanup(void)
365}; 316{
317 platform_driver_unregister(&ehci_hcd_omap_driver);
318}
319module_exit(ehci_omap_cleanup);
366 320
367MODULE_ALIAS("platform:ehci-omap"); 321MODULE_ALIAS("platform:ehci-omap");
368MODULE_AUTHOR("Texas Instruments, Inc."); 322MODULE_AUTHOR("Texas Instruments, Inc.");
369MODULE_AUTHOR("Felipe Balbi <felipe.balbi@nokia.com>"); 323MODULE_AUTHOR("Felipe Balbi <felipe.balbi@nokia.com>");
324MODULE_AUTHOR("Roger Quadros <rogerq@ti.com>");
370 325
326MODULE_DESCRIPTION(DRIVER_DESC);
327MODULE_LICENSE("GPL");
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c
index 914a3ecfb5d3..38c45fb3357e 100644
--- a/drivers/usb/host/ehci-orion.c
+++ b/drivers/usb/host/ehci-orion.c
@@ -305,7 +305,7 @@ err1:
305 return err; 305 return err;
306} 306}
307 307
308static int __exit ehci_orion_drv_remove(struct platform_device *pdev) 308static int ehci_orion_drv_remove(struct platform_device *pdev)
309{ 309{
310 struct usb_hcd *hcd = platform_get_drvdata(pdev); 310 struct usb_hcd *hcd = platform_get_drvdata(pdev);
311 struct clk *clk; 311 struct clk *clk;
@@ -333,7 +333,7 @@ MODULE_DEVICE_TABLE(of, ehci_orion_dt_ids);
333 333
334static struct platform_driver ehci_orion_driver = { 334static struct platform_driver ehci_orion_driver = {
335 .probe = ehci_orion_drv_probe, 335 .probe = ehci_orion_drv_probe,
336 .remove = __exit_p(ehci_orion_drv_remove), 336 .remove = ehci_orion_drv_remove,
337 .shutdown = usb_hcd_platform_shutdown, 337 .shutdown = usb_hcd_platform_shutdown,
338 .driver = { 338 .driver = {
339 .name = "orion-ehci", 339 .name = "orion-ehci",
diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
index 20ebf6a8b7f4..738490e6d429 100644
--- a/drivers/usb/host/ehci-s5p.c
+++ b/drivers/usb/host/ehci-s5p.c
@@ -92,20 +92,21 @@ static void s5p_ehci_phy_disable(struct s5p_ehci_hcd *s5p_ehci)
92 92
93static void s5p_setup_vbus_gpio(struct platform_device *pdev) 93static void s5p_setup_vbus_gpio(struct platform_device *pdev)
94{ 94{
95 struct device *dev = &pdev->dev;
95 int err; 96 int err;
96 int gpio; 97 int gpio;
97 98
98 if (!pdev->dev.of_node) 99 if (!dev->of_node)
99 return; 100 return;
100 101
101 gpio = of_get_named_gpio(pdev->dev.of_node, 102 gpio = of_get_named_gpio(dev->of_node, "samsung,vbus-gpio", 0);
102 "samsung,vbus-gpio", 0);
103 if (!gpio_is_valid(gpio)) 103 if (!gpio_is_valid(gpio))
104 return; 104 return;
105 105
106 err = gpio_request_one(gpio, GPIOF_OUT_INIT_HIGH, "ehci_vbus_gpio"); 106 err = devm_gpio_request_one(dev, gpio, GPIOF_OUT_INIT_HIGH,
107 "ehci_vbus_gpio");
107 if (err) 108 if (err)
108 dev_err(&pdev->dev, "can't request ehci vbus gpio %d", gpio); 109 dev_err(dev, "can't request ehci vbus gpio %d", gpio);
109} 110}
110 111
111static u64 ehci_s5p_dma_mask = DMA_BIT_MASK(32); 112static u64 ehci_s5p_dma_mask = DMA_BIT_MASK(32);
diff --git a/drivers/usb/host/ehci-sh.c b/drivers/usb/host/ehci-sh.c
index 3565a300f401..e30e39672027 100644
--- a/drivers/usb/host/ehci-sh.c
+++ b/drivers/usb/host/ehci-sh.c
@@ -170,7 +170,7 @@ fail_create_hcd:
170 return ret; 170 return ret;
171} 171}
172 172
173static int __exit ehci_hcd_sh_remove(struct platform_device *pdev) 173static int ehci_hcd_sh_remove(struct platform_device *pdev)
174{ 174{
175 struct ehci_sh_priv *priv = platform_get_drvdata(pdev); 175 struct ehci_sh_priv *priv = platform_get_drvdata(pdev);
176 struct usb_hcd *hcd = priv->hcd; 176 struct usb_hcd *hcd = priv->hcd;
@@ -196,7 +196,7 @@ static void ehci_hcd_sh_shutdown(struct platform_device *pdev)
196 196
197static struct platform_driver ehci_hcd_sh_driver = { 197static struct platform_driver ehci_hcd_sh_driver = {
198 .probe = ehci_hcd_sh_probe, 198 .probe = ehci_hcd_sh_probe,
199 .remove = __exit_p(ehci_hcd_sh_remove), 199 .remove = ehci_hcd_sh_remove
200 .shutdown = ehci_hcd_sh_shutdown, 200 .shutdown = ehci_hcd_sh_shutdown,
201 .driver = { 201 .driver = {
202 .name = "sh_ehci", 202 .name = "sh_ehci",
diff --git a/drivers/usb/host/ehci-timer.c b/drivers/usb/host/ehci-timer.c
index c3fa1305f830..e7363332887e 100644
--- a/drivers/usb/host/ehci-timer.c
+++ b/drivers/usb/host/ehci-timer.c
@@ -113,8 +113,8 @@ static void ehci_poll_ASS(struct ehci_hcd *ehci)
113 113
114 if (want != actual) { 114 if (want != actual) {
115 115
116 /* Poll again later, but give up after about 20 ms */ 116 /* Poll again later, but give up after about 2-4 ms */
117 if (ehci->ASS_poll_count++ < 20) { 117 if (ehci->ASS_poll_count++ < 2) {
118 ehci_enable_event(ehci, EHCI_HRTIMER_POLL_ASS, true); 118 ehci_enable_event(ehci, EHCI_HRTIMER_POLL_ASS, true);
119 return; 119 return;
120 } 120 }
@@ -159,8 +159,8 @@ static void ehci_poll_PSS(struct ehci_hcd *ehci)
159 159
160 if (want != actual) { 160 if (want != actual) {
161 161
162 /* Poll again later, but give up after about 20 ms */ 162 /* Poll again later, but give up after about 2-4 ms */
163 if (ehci->PSS_poll_count++ < 20) { 163 if (ehci->PSS_poll_count++ < 2) {
164 ehci_enable_event(ehci, EHCI_HRTIMER_POLL_PSS, true); 164 ehci_enable_event(ehci, EHCI_HRTIMER_POLL_PSS, true);
165 return; 165 return;
166 } 166 }
@@ -295,8 +295,7 @@ static void end_free_itds(struct ehci_hcd *ehci)
295/* Handle lost (or very late) IAA interrupts */ 295/* Handle lost (or very late) IAA interrupts */
296static void ehci_iaa_watchdog(struct ehci_hcd *ehci) 296static void ehci_iaa_watchdog(struct ehci_hcd *ehci)
297{ 297{
298 if (ehci->rh_state != EHCI_RH_RUNNING) 298 u32 cmd, status;
299 return;
300 299
301 /* 300 /*
302 * Lost IAA irqs wedge things badly; seen first with a vt8235. 301 * Lost IAA irqs wedge things badly; seen first with a vt8235.
@@ -304,34 +303,32 @@ static void ehci_iaa_watchdog(struct ehci_hcd *ehci)
304 * (a) SMP races against real IAA firing and retriggering, and 303 * (a) SMP races against real IAA firing and retriggering, and
305 * (b) clean HC shutdown, when IAA watchdog was pending. 304 * (b) clean HC shutdown, when IAA watchdog was pending.
306 */ 305 */
307 if (1) { 306 if (ehci->rh_state != EHCI_RH_RUNNING)
308 u32 cmd, status; 307 return;
309
310 /* If we get here, IAA is *REALLY* late. It's barely
311 * conceivable that the system is so busy that CMD_IAAD
312 * is still legitimately set, so let's be sure it's
313 * clear before we read STS_IAA. (The HC should clear
314 * CMD_IAAD when it sets STS_IAA.)
315 */
316 cmd = ehci_readl(ehci, &ehci->regs->command);
317
318 /*
319 * If IAA is set here it either legitimately triggered
320 * after the watchdog timer expired (_way_ late, so we'll
321 * still count it as lost) ... or a silicon erratum:
322 * - VIA seems to set IAA without triggering the IRQ;
323 * - IAAD potentially cleared without setting IAA.
324 */
325 status = ehci_readl(ehci, &ehci->regs->status);
326 if ((status & STS_IAA) || !(cmd & CMD_IAAD)) {
327 COUNT(ehci->stats.lost_iaa);
328 ehci_writel(ehci, STS_IAA, &ehci->regs->status);
329 }
330 308
331 ehci_vdbg(ehci, "IAA watchdog: status %x cmd %x\n", 309 /* If we get here, IAA is *REALLY* late. It's barely
332 status, cmd); 310 * conceivable that the system is so busy that CMD_IAAD
333 end_unlink_async(ehci); 311 * is still legitimately set, so let's be sure it's
312 * clear before we read STS_IAA. (The HC should clear
313 * CMD_IAAD when it sets STS_IAA.)
314 */
315 cmd = ehci_readl(ehci, &ehci->regs->command);
316
317 /*
318 * If IAA is set here it either legitimately triggered
319 * after the watchdog timer expired (_way_ late, so we'll
320 * still count it as lost) ... or a silicon erratum:
321 * - VIA seems to set IAA without triggering the IRQ;
322 * - IAAD potentially cleared without setting IAA.
323 */
324 status = ehci_readl(ehci, &ehci->regs->status);
325 if ((status & STS_IAA) || !(cmd & CMD_IAAD)) {
326 COUNT(ehci->stats.lost_iaa);
327 ehci_writel(ehci, STS_IAA, &ehci->regs->status);
334 } 328 }
329
330 ehci_dbg(ehci, "IAA watchdog: status %x cmd %x\n", status, cmd);
331 end_unlink_async(ehci);
335} 332}
336 333
337 334
diff --git a/drivers/usb/host/ohci-omap3.c b/drivers/usb/host/ohci-omap3.c
index eb35d9630237..ddfc31427bc0 100644
--- a/drivers/usb/host/ohci-omap3.c
+++ b/drivers/usb/host/ohci-omap3.c
@@ -31,6 +31,8 @@
31 31
32#include <linux/platform_device.h> 32#include <linux/platform_device.h>
33#include <linux/pm_runtime.h> 33#include <linux/pm_runtime.h>
34#include <linux/of.h>
35#include <linux/dma-mapping.h>
34 36
35/*-------------------------------------------------------------------------*/ 37/*-------------------------------------------------------------------------*/
36 38
@@ -112,6 +114,8 @@ static const struct hc_driver ohci_omap3_hc_driver = {
112 114
113/*-------------------------------------------------------------------------*/ 115/*-------------------------------------------------------------------------*/
114 116
117static u64 omap_ohci_dma_mask = DMA_BIT_MASK(32);
118
115/* 119/*
116 * configure so an HC device and id are always provided 120 * configure so an HC device and id are always provided
117 * always called with process context; sleeping is OK 121 * always called with process context; sleeping is OK
@@ -141,14 +145,13 @@ static int ohci_hcd_omap3_probe(struct platform_device *pdev)
141 return -ENODEV; 145 return -ENODEV;
142 } 146 }
143 147
144 irq = platform_get_irq_byname(pdev, "ohci-irq"); 148 irq = platform_get_irq(pdev, 0);
145 if (irq < 0) { 149 if (irq < 0) {
146 dev_err(dev, "OHCI irq failed\n"); 150 dev_err(dev, "OHCI irq failed\n");
147 return -ENODEV; 151 return -ENODEV;
148 } 152 }
149 153
150 res = platform_get_resource_byname(pdev, 154 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
151 IORESOURCE_MEM, "ohci");
152 if (!res) { 155 if (!res) {
153 dev_err(dev, "UHH OHCI get resource failed\n"); 156 dev_err(dev, "UHH OHCI get resource failed\n");
154 return -ENOMEM; 157 return -ENOMEM;
@@ -160,6 +163,13 @@ static int ohci_hcd_omap3_probe(struct platform_device *pdev)
160 return -ENOMEM; 163 return -ENOMEM;
161 } 164 }
162 165
166 /*
167 * Right now device-tree probed devices don't get dma_mask set.
168 * Since shared usb code relies on it, set it here for now.
169 * Once we have dma capability bindings this can go away.
170 */
171 if (!pdev->dev.dma_mask)
172 pdev->dev.dma_mask = &omap_ohci_dma_mask;
163 173
164 hcd = usb_create_hcd(&ohci_omap3_hc_driver, dev, 174 hcd = usb_create_hcd(&ohci_omap3_hc_driver, dev,
165 dev_name(dev)); 175 dev_name(dev));
@@ -229,12 +239,20 @@ static void ohci_hcd_omap3_shutdown(struct platform_device *pdev)
229 hcd->driver->shutdown(hcd); 239 hcd->driver->shutdown(hcd);
230} 240}
231 241
242static const struct of_device_id omap_ohci_dt_ids[] = {
243 { .compatible = "ti,ohci-omap3" },
244 { }
245};
246
247MODULE_DEVICE_TABLE(of, omap_ohci_dt_ids);
248
232static struct platform_driver ohci_hcd_omap3_driver = { 249static struct platform_driver ohci_hcd_omap3_driver = {
233 .probe = ohci_hcd_omap3_probe, 250 .probe = ohci_hcd_omap3_probe,
234 .remove = ohci_hcd_omap3_remove, 251 .remove = ohci_hcd_omap3_remove,
235 .shutdown = ohci_hcd_omap3_shutdown, 252 .shutdown = ohci_hcd_omap3_shutdown,
236 .driver = { 253 .driver = {
237 .name = "ohci-omap3", 254 .name = "ohci-omap3",
255 .of_match_table = of_match_ptr(omap_ohci_dt_ids),
238 }, 256 },
239}; 257};
240 258
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c
index dd573abd2d1e..c21386ec5d35 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.c
+++ b/drivers/usb/misc/sisusbvga/sisusb.c
@@ -3084,7 +3084,7 @@ static int sisusb_probe(struct usb_interface *intf,
3084 3084
3085 /* Allocate memory for our private */ 3085 /* Allocate memory for our private */
3086 if (!(sisusb = kzalloc(sizeof(*sisusb), GFP_KERNEL))) { 3086 if (!(sisusb = kzalloc(sizeof(*sisusb), GFP_KERNEL))) {
3087 dev_err(&sisusb->sisusb_dev->dev, "Failed to allocate memory for private data\n"); 3087 dev_err(&dev->dev, "Failed to allocate memory for private data\n");
3088 return -ENOMEM; 3088 return -ENOMEM;
3089 } 3089 }
3090 kref_init(&sisusb->kref); 3090 kref_init(&sisusb->kref);
diff --git a/drivers/usb/misc/usb3503.c b/drivers/usb/misc/usb3503.c
index f713f6aeb6e5..d3a1cce1bf9c 100644
--- a/drivers/usb/misc/usb3503.c
+++ b/drivers/usb/misc/usb3503.c
@@ -307,18 +307,7 @@ static struct i2c_driver usb3503_driver = {
307 .id_table = usb3503_id, 307 .id_table = usb3503_id,
308}; 308};
309 309
310static int __init usb3503_init(void) 310module_i2c_driver(usb3503_driver);
311{
312 return i2c_add_driver(&usb3503_driver);
313}
314
315static void __exit usb3503_exit(void)
316{
317 i2c_del_driver(&usb3503_driver);
318}
319
320module_init(usb3503_init);
321module_exit(usb3503_exit);
322 311
323MODULE_AUTHOR("Dongjin Kim <tobetter@gmail.com>"); 312MODULE_AUTHOR("Dongjin Kim <tobetter@gmail.com>");
324MODULE_DESCRIPTION("USB3503 USB HUB driver"); 313MODULE_DESCRIPTION("USB3503 USB HUB driver");
diff --git a/drivers/usb/otg/isp1301_omap.c b/drivers/usb/otg/isp1301_omap.c
index af9cb11626b2..8b9de9581319 100644
--- a/drivers/usb/otg/isp1301_omap.c
+++ b/drivers/usb/otg/isp1301_omap.c
@@ -1212,7 +1212,7 @@ static void isp1301_release(struct device *dev)
1212 1212
1213static struct isp1301 *the_transceiver; 1213static struct isp1301 *the_transceiver;
1214 1214
1215static int __exit isp1301_remove(struct i2c_client *i2c) 1215static int isp1301_remove(struct i2c_client *i2c)
1216{ 1216{
1217 struct isp1301 *isp; 1217 struct isp1301 *isp;
1218 1218
@@ -1634,7 +1634,7 @@ static struct i2c_driver isp1301_driver = {
1634 .name = "isp1301_omap", 1634 .name = "isp1301_omap",
1635 }, 1635 },
1636 .probe = isp1301_probe, 1636 .probe = isp1301_probe,
1637 .remove = __exit_p(isp1301_remove), 1637 .remove = isp1301_remove,
1638 .id_table = isp1301_id, 1638 .id_table = isp1301_id,
1639}; 1639};
1640 1640
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index a994715a3101..24d573a134b1 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -658,7 +658,7 @@ static int twl4030_usb_probe(struct platform_device *pdev)
658 return 0; 658 return 0;
659} 659}
660 660
661static int __exit twl4030_usb_remove(struct platform_device *pdev) 661static int twl4030_usb_remove(struct platform_device *pdev)
662{ 662{
663 struct twl4030_usb *twl = platform_get_drvdata(pdev); 663 struct twl4030_usb *twl = platform_get_drvdata(pdev);
664 int val; 664 int val;
@@ -702,7 +702,7 @@ MODULE_DEVICE_TABLE(of, twl4030_usb_id_table);
702 702
703static struct platform_driver twl4030_usb_driver = { 703static struct platform_driver twl4030_usb_driver = {
704 .probe = twl4030_usb_probe, 704 .probe = twl4030_usb_probe,
705 .remove = __exit_p(twl4030_usb_remove), 705 .remove = twl4030_usb_remove,
706 .driver = { 706 .driver = {
707 .name = "twl4030_usb", 707 .name = "twl4030_usb",
708 .owner = THIS_MODULE, 708 .owner = THIS_MODULE,
diff --git a/drivers/usb/otg/twl6030-usb.c b/drivers/usb/otg/twl6030-usb.c
index 8cd6cf49bdbd..7f3c5b0e3f66 100644
--- a/drivers/usb/otg/twl6030-usb.c
+++ b/drivers/usb/otg/twl6030-usb.c
@@ -393,7 +393,7 @@ static int twl6030_usb_probe(struct platform_device *pdev)
393 return 0; 393 return 0;
394} 394}
395 395
396static int __exit twl6030_usb_remove(struct platform_device *pdev) 396static int twl6030_usb_remove(struct platform_device *pdev)
397{ 397{
398 struct twl6030_usb *twl = platform_get_drvdata(pdev); 398 struct twl6030_usb *twl = platform_get_drvdata(pdev);
399 399
@@ -420,7 +420,7 @@ MODULE_DEVICE_TABLE(of, twl6030_usb_id_table);
420 420
421static struct platform_driver twl6030_usb_driver = { 421static struct platform_driver twl6030_usb_driver = {
422 .probe = twl6030_usb_probe, 422 .probe = twl6030_usb_probe,
423 .remove = __exit_p(twl6030_usb_remove), 423 .remove = twl6030_usb_remove,
424 .driver = { 424 .driver = {
425 .name = "twl6030_usb", 425 .name = "twl6030_usb",
426 .owner = THIS_MODULE, 426 .owner = THIS_MODULE,
diff --git a/drivers/usb/phy/mv_u3d_phy.c b/drivers/usb/phy/mv_u3d_phy.c
index 9d8599122aa9..bafd67f1f134 100644
--- a/drivers/usb/phy/mv_u3d_phy.c
+++ b/drivers/usb/phy/mv_u3d_phy.c
@@ -313,7 +313,7 @@ err:
313 return ret; 313 return ret;
314} 314}
315 315
316static int __exit mv_u3d_phy_remove(struct platform_device *pdev) 316static int mv_u3d_phy_remove(struct platform_device *pdev)
317{ 317{
318 struct mv_u3d_phy *mv_u3d_phy = platform_get_drvdata(pdev); 318 struct mv_u3d_phy *mv_u3d_phy = platform_get_drvdata(pdev);
319 319
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index b8051fa61911..316ad5f0d1a2 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -1253,8 +1253,7 @@ static void mos7840_close(struct usb_serial_port *port)
1253 1253
1254 if (mos7840_port->write_urb) { 1254 if (mos7840_port->write_urb) {
1255 /* if this urb had a transfer buffer already (old tx) free it */ 1255 /* if this urb had a transfer buffer already (old tx) free it */
1256 if (mos7840_port->write_urb->transfer_buffer != NULL) 1256 kfree(mos7840_port->write_urb->transfer_buffer);
1257 kfree(mos7840_port->write_urb->transfer_buffer);
1258 usb_free_urb(mos7840_port->write_urb); 1257 usb_free_urb(mos7840_port->write_urb);
1259 } 1258 }
1260 1259
diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c
index 75f125ddb0c9..80a8bc30a871 100644
--- a/drivers/usb/serial/quatech2.c
+++ b/drivers/usb/serial/quatech2.c
@@ -664,9 +664,7 @@ void qt2_process_read_urb(struct urb *urb)
664 __func__); 664 __func__);
665 break; 665 break;
666 } 666 }
667 667 tty_flip_buffer_push(&port->port);
668 if (port_priv->is_open)
669 tty_flip_buffer_push(&port->port);
670 668
671 newport = *(ch + 3); 669 newport = *(ch + 3);
672 670
@@ -709,8 +707,7 @@ void qt2_process_read_urb(struct urb *urb)
709 tty_insert_flip_string(&port->port, ch, 1); 707 tty_insert_flip_string(&port->port, ch, 1);
710 } 708 }
711 709
712 if (port_priv->is_open) 710 tty_flip_buffer_push(&port->port);
713 tty_flip_buffer_push(&port->port);
714} 711}
715 712
716static void qt2_write_bulk_callback(struct urb *urb) 713static void qt2_write_bulk_callback(struct urb *urb)
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 2e70efa08b77..bbe7f2eb8160 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -257,22 +257,18 @@ static int serial_open(struct tty_struct *tty, struct file *filp)
257 * serial_down - shut down hardware 257 * serial_down - shut down hardware
258 * @tport: tty port to shut down 258 * @tport: tty port to shut down
259 * 259 *
260 * Shut down a USB serial port unless it is the console. We never 260 * Shut down a USB serial port. Serialized against activate by the
261 * shut down the console hardware as it will always be in use. Serialized 261 * tport mutex and kept to matching open/close pairs
262 * against activate by the tport mutex and kept to matching open/close pairs
263 * of calls by the ASYNCB_INITIALIZED flag. 262 * of calls by the ASYNCB_INITIALIZED flag.
263 *
264 * Not called if tty is console.
264 */ 265 */
265static void serial_down(struct tty_port *tport) 266static void serial_down(struct tty_port *tport)
266{ 267{
267 struct usb_serial_port *port = 268 struct usb_serial_port *port =
268 container_of(tport, struct usb_serial_port, port); 269 container_of(tport, struct usb_serial_port, port);
269 struct usb_serial_driver *drv = port->serial->type; 270 struct usb_serial_driver *drv = port->serial->type;
270 /* 271
271 * The console is magical. Do not hang up the console hardware
272 * or there will be tears.
273 */
274 if (port->port.console)
275 return;
276 if (drv->close) 272 if (drv->close)
277 drv->close(port); 273 drv->close(port);
278} 274}
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c
index ecea47877364..06a3d22db685 100644
--- a/drivers/usb/storage/isd200.c
+++ b/drivers/usb/storage/isd200.c
@@ -1457,8 +1457,7 @@ static int isd200_init_info(struct us_data *us)
1457 retStatus = ISD200_ERROR; 1457 retStatus = ISD200_ERROR;
1458 else { 1458 else {
1459 info->id = kzalloc(ATA_ID_WORDS * 2, GFP_KERNEL); 1459 info->id = kzalloc(ATA_ID_WORDS * 2, GFP_KERNEL);
1460 info->RegsBuf = (unsigned char *) 1460 info->RegsBuf = kmalloc(sizeof(info->ATARegs), GFP_KERNEL);
1461 kmalloc(sizeof(info->ATARegs), GFP_KERNEL);
1462 info->srb.sense_buffer = 1461 info->srb.sense_buffer =
1463 kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL); 1462 kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL);
1464 if (!info->id || !info->RegsBuf || !info->srb.sense_buffer) { 1463 if (!info->id || !info->RegsBuf || !info->srb.sense_buffer) {
diff --git a/drivers/usb/storage/onetouch.c b/drivers/usb/storage/onetouch.c
index cb79de61f4c8..26964895c88b 100644
--- a/drivers/usb/storage/onetouch.c
+++ b/drivers/usb/storage/onetouch.c
@@ -195,6 +195,7 @@ static int onetouch_connect_input(struct us_data *ss)
195 195
196 pipe = usb_rcvintpipe(udev, endpoint->bEndpointAddress); 196 pipe = usb_rcvintpipe(udev, endpoint->bEndpointAddress);
197 maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe)); 197 maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe));
198 maxp = min(maxp, ONETOUCH_PKT_LEN);
198 199
199 onetouch = kzalloc(sizeof(struct usb_onetouch), GFP_KERNEL); 200 onetouch = kzalloc(sizeof(struct usb_onetouch), GFP_KERNEL);
200 input_dev = input_allocate_device(); 201 input_dev = input_allocate_device();
@@ -245,8 +246,7 @@ static int onetouch_connect_input(struct us_data *ss)
245 input_dev->open = usb_onetouch_open; 246 input_dev->open = usb_onetouch_open;
246 input_dev->close = usb_onetouch_close; 247 input_dev->close = usb_onetouch_close;
247 248
248 usb_fill_int_urb(onetouch->irq, udev, pipe, onetouch->data, 249 usb_fill_int_urb(onetouch->irq, udev, pipe, onetouch->data, maxp,
249 (maxp > 8 ? 8 : maxp),
250 usb_onetouch_irq, onetouch, endpoint->bInterval); 250 usb_onetouch_irq, onetouch, endpoint->bInterval);
251 onetouch->irq->transfer_dma = onetouch->data_dma; 251 onetouch->irq->transfer_dma = onetouch->data_dma;
252 onetouch->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 252 onetouch->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 4d22d0f6167a..52464fb2389b 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -469,14 +469,12 @@ struct usb3_lpm_parameters {
469 * @lpm_capable: device supports LPM 469 * @lpm_capable: device supports LPM
470 * @usb2_hw_lpm_capable: device can perform USB2 hardware LPM 470 * @usb2_hw_lpm_capable: device can perform USB2 hardware LPM
471 * @usb2_hw_lpm_enabled: USB2 hardware LPM enabled 471 * @usb2_hw_lpm_enabled: USB2 hardware LPM enabled
472 * @usb3_lpm_enabled: USB3 hardware LPM enabled
472 * @string_langid: language ID for strings 473 * @string_langid: language ID for strings
473 * @product: iProduct string, if present (static) 474 * @product: iProduct string, if present (static)
474 * @manufacturer: iManufacturer string, if present (static) 475 * @manufacturer: iManufacturer string, if present (static)
475 * @serial: iSerialNumber string, if present (static) 476 * @serial: iSerialNumber string, if present (static)
476 * @filelist: usbfs files that are open to this device 477 * @filelist: usbfs files that are open to this device
477 * @usb_classdev: USB class device that was created for usbfs device
478 * access from userspace
479 * @usbfs_dentry: usbfs dentry entry for the device
480 * @maxchild: number of ports if hub 478 * @maxchild: number of ports if hub
481 * @quirks: quirks of the whole device 479 * @quirks: quirks of the whole device
482 * @urbnum: number of URBs submitted for the whole device 480 * @urbnum: number of URBs submitted for the whole device