aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/host')
-rw-r--r--drivers/usb/host/ehci-hcd.c26
-rw-r--r--drivers/usb/host/ehci-ixp4xx.c2
-rw-r--r--drivers/usb/host/ehci-orion.c2
-rw-r--r--drivers/usb/host/ehci-q.c2
-rw-r--r--drivers/usb/host/ehci-sched.c32
-rw-r--r--drivers/usb/host/ehci.h138
-rw-r--r--drivers/usb/host/isp1760-hcd.c53
-rw-r--r--drivers/usb/host/isp1760-hcd.h5
-rw-r--r--drivers/usb/host/ohci-at91.c8
-rw-r--r--drivers/usb/host/ohci-au1xxx.c1
-rw-r--r--drivers/usb/host/ohci-ep93xx.c4
-rw-r--r--drivers/usb/host/ohci-hcd.c23
-rw-r--r--drivers/usb/host/ohci-hub.c64
-rw-r--r--drivers/usb/host/ohci-lh7a404.c3
-rw-r--r--drivers/usb/host/ohci-omap.c18
-rw-r--r--drivers/usb/host/ohci-pci.c133
-rw-r--r--drivers/usb/host/ohci-pnx4008.c10
-rw-r--r--drivers/usb/host/ohci-pnx8550.c1
-rw-r--r--drivers/usb/host/ohci-ppc-of.c1
-rw-r--r--drivers/usb/host/ohci-ppc-soc.c1
-rw-r--r--drivers/usb/host/ohci-ps3.c1
-rw-r--r--drivers/usb/host/ohci-pxa27x.c261
-rw-r--r--drivers/usb/host/ohci-q.c6
-rw-r--r--drivers/usb/host/ohci-s3c2410.c5
-rw-r--r--drivers/usb/host/ohci-sa1111.c7
-rw-r--r--drivers/usb/host/ohci-sh.c1
-rw-r--r--drivers/usb/host/ohci-sm501.c1
-rw-r--r--drivers/usb/host/ohci-ssb.c1
-rw-r--r--drivers/usb/host/ohci.h11
-rw-r--r--drivers/usb/host/r8a66597-hcd.c49
-rw-r--r--drivers/usb/host/u132-hcd.c11
31 files changed, 538 insertions, 343 deletions
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index d9d53f289caf..8409e0705d63 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -145,16 +145,6 @@ static int handshake (struct ehci_hcd *ehci, void __iomem *ptr,
145 return -ETIMEDOUT; 145 return -ETIMEDOUT;
146} 146}
147 147
148static int handshake_on_error_set_halt(struct ehci_hcd *ehci, void __iomem *ptr,
149 u32 mask, u32 done, int usec)
150{
151 int error = handshake(ehci, ptr, mask, done, usec);
152 if (error)
153 ehci_to_hcd(ehci)->state = HC_STATE_HALT;
154
155 return error;
156}
157
158/* force HC to halt state from unknown (EHCI spec section 2.3) */ 148/* force HC to halt state from unknown (EHCI spec section 2.3) */
159static int ehci_halt (struct ehci_hcd *ehci) 149static int ehci_halt (struct ehci_hcd *ehci)
160{ 150{
@@ -173,6 +163,22 @@ static int ehci_halt (struct ehci_hcd *ehci)
173 STS_HALT, STS_HALT, 16 * 125); 163 STS_HALT, STS_HALT, 16 * 125);
174} 164}
175 165
166static int handshake_on_error_set_halt(struct ehci_hcd *ehci, void __iomem *ptr,
167 u32 mask, u32 done, int usec)
168{
169 int error;
170
171 error = handshake(ehci, ptr, mask, done, usec);
172 if (error) {
173 ehci_halt(ehci);
174 ehci_to_hcd(ehci)->state = HC_STATE_HALT;
175 ehci_err(ehci, "force halt; handhake %p %08x %08x -> %d\n",
176 ptr, mask, done, error);
177 }
178
179 return error;
180}
181
176/* put TDI/ARC silicon into EHCI mode */ 182/* put TDI/ARC silicon into EHCI mode */
177static void tdi_reset (struct ehci_hcd *ehci) 183static void tdi_reset (struct ehci_hcd *ehci)
178{ 184{
diff --git a/drivers/usb/host/ehci-ixp4xx.c b/drivers/usb/host/ehci-ixp4xx.c
index f9575c409124..9c32063a0c2f 100644
--- a/drivers/usb/host/ehci-ixp4xx.c
+++ b/drivers/usb/host/ehci-ixp4xx.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * IXP4XX EHCI Host Controller Driver 2 * IXP4XX EHCI Host Controller Driver
3 * 3 *
4 * Author: Vladimir Barinov <vbarinov@ru.mvista.com> 4 * Author: Vladimir Barinov <vbarinov@embeddedalley.com>
5 * 5 *
6 * Based on "ehci-fsl.c" by Randy Vinson <rvinson@mvista.com> 6 * Based on "ehci-fsl.c" by Randy Vinson <rvinson@mvista.com>
7 * 7 *
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c
index 5fbdc14e63b3..5416cf969005 100644
--- a/drivers/usb/host/ehci-orion.c
+++ b/drivers/usb/host/ehci-orion.c
@@ -12,7 +12,7 @@
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/mbus.h> 14#include <linux/mbus.h>
15#include <asm/plat-orion/ehci-orion.h> 15#include <plat/ehci-orion.h>
16 16
17#define rdl(off) __raw_readl(hcd->regs + (off)) 17#define rdl(off) __raw_readl(hcd->regs + (off))
18#define wrl(off, val) __raw_writel((val), hcd->regs + (off)) 18#define wrl(off, val) __raw_writel((val), hcd->regs + (off))
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index 2622b6596d7c..3712b925b315 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -932,7 +932,7 @@ static struct ehci_qh *qh_append_tds (
932 932
933 list_del (&qtd->qtd_list); 933 list_del (&qtd->qtd_list);
934 list_add (&dummy->qtd_list, qtd_list); 934 list_add (&dummy->qtd_list, qtd_list);
935 __list_splice (qtd_list, qh->qtd_list.prev); 935 list_splice_tail(qtd_list, &qh->qtd_list);
936 936
937 ehci_qtd_init(ehci, qtd, qtd->qtd_dma); 937 ehci_qtd_init(ehci, qtd, qtd->qtd_dma);
938 qh->dummy = qtd; 938 qh->dummy = qtd;
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index b7853c8bac0f..4a0c5a78b2ed 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -437,6 +437,9 @@ static int enable_periodic (struct ehci_hcd *ehci)
437 u32 cmd; 437 u32 cmd;
438 int status; 438 int status;
439 439
440 if (ehci->periodic_sched++)
441 return 0;
442
440 /* did clearing PSE did take effect yet? 443 /* did clearing PSE did take effect yet?
441 * takes effect only at frame boundaries... 444 * takes effect only at frame boundaries...
442 */ 445 */
@@ -461,6 +464,9 @@ static int disable_periodic (struct ehci_hcd *ehci)
461 u32 cmd; 464 u32 cmd;
462 int status; 465 int status;
463 466
467 if (--ehci->periodic_sched)
468 return 0;
469
464 /* did setting PSE not take effect yet? 470 /* did setting PSE not take effect yet?
465 * takes effect only at frame boundaries... 471 * takes effect only at frame boundaries...
466 */ 472 */
@@ -544,13 +550,10 @@ static int qh_link_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh)
544 : (qh->usecs * 8); 550 : (qh->usecs * 8);
545 551
546 /* maybe enable periodic schedule processing */ 552 /* maybe enable periodic schedule processing */
547 if (!ehci->periodic_sched++) 553 return enable_periodic(ehci);
548 return enable_periodic (ehci);
549
550 return 0;
551} 554}
552 555
553static void qh_unlink_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh) 556static int qh_unlink_periodic(struct ehci_hcd *ehci, struct ehci_qh *qh)
554{ 557{
555 unsigned i; 558 unsigned i;
556 unsigned period; 559 unsigned period;
@@ -586,9 +589,7 @@ static void qh_unlink_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh)
586 qh_put (qh); 589 qh_put (qh);
587 590
588 /* maybe turn off periodic schedule */ 591 /* maybe turn off periodic schedule */
589 ehci->periodic_sched--; 592 return disable_periodic(ehci);
590 if (!ehci->periodic_sched)
591 (void) disable_periodic (ehci);
592} 593}
593 594
594static void intr_deschedule (struct ehci_hcd *ehci, struct ehci_qh *qh) 595static void intr_deschedule (struct ehci_hcd *ehci, struct ehci_qh *qh)
@@ -1562,9 +1563,7 @@ itd_link_urb (
1562 urb->hcpriv = NULL; 1563 urb->hcpriv = NULL;
1563 1564
1564 timer_action (ehci, TIMER_IO_WATCHDOG); 1565 timer_action (ehci, TIMER_IO_WATCHDOG);
1565 if (unlikely (!ehci->periodic_sched++)) 1566 return enable_periodic(ehci);
1566 return enable_periodic (ehci);
1567 return 0;
1568} 1567}
1569 1568
1570#define ISO_ERRS (EHCI_ISOC_BUF_ERR | EHCI_ISOC_BABBLE | EHCI_ISOC_XACTERR) 1569#define ISO_ERRS (EHCI_ISOC_BUF_ERR | EHCI_ISOC_BABBLE | EHCI_ISOC_XACTERR)
@@ -1642,7 +1641,7 @@ itd_complete (
1642 ehci_urb_done(ehci, urb, 0); 1641 ehci_urb_done(ehci, urb, 0);
1643 retval = true; 1642 retval = true;
1644 urb = NULL; 1643 urb = NULL;
1645 ehci->periodic_sched--; 1644 (void) disable_periodic(ehci);
1646 ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--; 1645 ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--;
1647 1646
1648 if (unlikely (list_empty (&stream->td_list))) { 1647 if (unlikely (list_empty (&stream->td_list))) {
@@ -1951,9 +1950,7 @@ sitd_link_urb (
1951 urb->hcpriv = NULL; 1950 urb->hcpriv = NULL;
1952 1951
1953 timer_action (ehci, TIMER_IO_WATCHDOG); 1952 timer_action (ehci, TIMER_IO_WATCHDOG);
1954 if (!ehci->periodic_sched++) 1953 return enable_periodic(ehci);
1955 return enable_periodic (ehci);
1956 return 0;
1957} 1954}
1958 1955
1959/*-------------------------------------------------------------------------*/ 1956/*-------------------------------------------------------------------------*/
@@ -2019,7 +2016,7 @@ sitd_complete (
2019 ehci_urb_done(ehci, urb, 0); 2016 ehci_urb_done(ehci, urb, 0);
2020 retval = true; 2017 retval = true;
2021 urb = NULL; 2018 urb = NULL;
2022 ehci->periodic_sched--; 2019 (void) disable_periodic(ehci);
2023 ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--; 2020 ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--;
2024 2021
2025 if (list_empty (&stream->td_list)) { 2022 if (list_empty (&stream->td_list)) {
@@ -2243,8 +2240,7 @@ restart:
2243 if (unlikely (modified)) { 2240 if (unlikely (modified)) {
2244 if (likely(ehci->periodic_sched > 0)) 2241 if (likely(ehci->periodic_sched > 0))
2245 goto restart; 2242 goto restart;
2246 /* maybe we can short-circuit this scan! */ 2243 /* short-circuit this scan */
2247 disable_periodic(ehci);
2248 now_uframe = clock; 2244 now_uframe = clock;
2249 break; 2245 break;
2250 } 2246 }
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 5799298364fb..b697a13364ec 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -210,143 +210,7 @@ timer_action (struct ehci_hcd *ehci, enum ehci_timer_action action)
210 210
211/*-------------------------------------------------------------------------*/ 211/*-------------------------------------------------------------------------*/
212 212
213/* EHCI register interface, corresponds to EHCI Revision 0.95 specification */ 213#include <linux/usb/ehci_def.h>
214
215/* Section 2.2 Host Controller Capability Registers */
216struct ehci_caps {
217 /* these fields are specified as 8 and 16 bit registers,
218 * but some hosts can't perform 8 or 16 bit PCI accesses.
219 */
220 u32 hc_capbase;
221#define HC_LENGTH(p) (((p)>>00)&0x00ff) /* bits 7:0 */
222#define HC_VERSION(p) (((p)>>16)&0xffff) /* bits 31:16 */
223 u32 hcs_params; /* HCSPARAMS - offset 0x4 */
224#define HCS_DEBUG_PORT(p) (((p)>>20)&0xf) /* bits 23:20, debug port? */
225#define HCS_INDICATOR(p) ((p)&(1 << 16)) /* true: has port indicators */
226#define HCS_N_CC(p) (((p)>>12)&0xf) /* bits 15:12, #companion HCs */
227#define HCS_N_PCC(p) (((p)>>8)&0xf) /* bits 11:8, ports per CC */
228#define HCS_PORTROUTED(p) ((p)&(1 << 7)) /* true: port routing */
229#define HCS_PPC(p) ((p)&(1 << 4)) /* true: port power control */
230#define HCS_N_PORTS(p) (((p)>>0)&0xf) /* bits 3:0, ports on HC */
231
232 u32 hcc_params; /* HCCPARAMS - offset 0x8 */
233#define HCC_EXT_CAPS(p) (((p)>>8)&0xff) /* for pci extended caps */
234#define HCC_ISOC_CACHE(p) ((p)&(1 << 7)) /* true: can cache isoc frame */
235#define HCC_ISOC_THRES(p) (((p)>>4)&0x7) /* bits 6:4, uframes cached */
236#define HCC_CANPARK(p) ((p)&(1 << 2)) /* true: can park on async qh */
237#define HCC_PGM_FRAMELISTLEN(p) ((p)&(1 << 1)) /* true: periodic_size changes*/
238#define HCC_64BIT_ADDR(p) ((p)&(1)) /* true: can use 64-bit addr */
239 u8 portroute [8]; /* nibbles for routing - offset 0xC */
240} __attribute__ ((packed));
241
242
243/* Section 2.3 Host Controller Operational Registers */
244struct ehci_regs {
245
246 /* USBCMD: offset 0x00 */
247 u32 command;
248/* 23:16 is r/w intr rate, in microframes; default "8" == 1/msec */
249#define CMD_PARK (1<<11) /* enable "park" on async qh */
250#define CMD_PARK_CNT(c) (((c)>>8)&3) /* how many transfers to park for */
251#define CMD_LRESET (1<<7) /* partial reset (no ports, etc) */
252#define CMD_IAAD (1<<6) /* "doorbell" interrupt async advance */
253#define CMD_ASE (1<<5) /* async schedule enable */
254#define CMD_PSE (1<<4) /* periodic schedule enable */
255/* 3:2 is periodic frame list size */
256#define CMD_RESET (1<<1) /* reset HC not bus */
257#define CMD_RUN (1<<0) /* start/stop HC */
258
259 /* USBSTS: offset 0x04 */
260 u32 status;
261#define STS_ASS (1<<15) /* Async Schedule Status */
262#define STS_PSS (1<<14) /* Periodic Schedule Status */
263#define STS_RECL (1<<13) /* Reclamation */
264#define STS_HALT (1<<12) /* Not running (any reason) */
265/* some bits reserved */
266 /* these STS_* flags are also intr_enable bits (USBINTR) */
267#define STS_IAA (1<<5) /* Interrupted on async advance */
268#define STS_FATAL (1<<4) /* such as some PCI access errors */
269#define STS_FLR (1<<3) /* frame list rolled over */
270#define STS_PCD (1<<2) /* port change detect */
271#define STS_ERR (1<<1) /* "error" completion (overflow, ...) */
272#define STS_INT (1<<0) /* "normal" completion (short, ...) */
273
274 /* USBINTR: offset 0x08 */
275 u32 intr_enable;
276
277 /* FRINDEX: offset 0x0C */
278 u32 frame_index; /* current microframe number */
279 /* CTRLDSSEGMENT: offset 0x10 */
280 u32 segment; /* address bits 63:32 if needed */
281 /* PERIODICLISTBASE: offset 0x14 */
282 u32 frame_list; /* points to periodic list */
283 /* ASYNCLISTADDR: offset 0x18 */
284 u32 async_next; /* address of next async queue head */
285
286 u32 reserved [9];
287
288 /* CONFIGFLAG: offset 0x40 */
289 u32 configured_flag;
290#define FLAG_CF (1<<0) /* true: we'll support "high speed" */
291
292 /* PORTSC: offset 0x44 */
293 u32 port_status [0]; /* up to N_PORTS */
294/* 31:23 reserved */
295#define PORT_WKOC_E (1<<22) /* wake on overcurrent (enable) */
296#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */
297#define PORT_WKCONN_E (1<<20) /* wake on connect (enable) */
298/* 19:16 for port testing */
299#define PORT_LED_OFF (0<<14)
300#define PORT_LED_AMBER (1<<14)
301#define PORT_LED_GREEN (2<<14)
302#define PORT_LED_MASK (3<<14)
303#define PORT_OWNER (1<<13) /* true: companion hc owns this port */
304#define PORT_POWER (1<<12) /* true: has power (see PPC) */
305#define PORT_USB11(x) (((x)&(3<<10))==(1<<10)) /* USB 1.1 device */
306/* 11:10 for detecting lowspeed devices (reset vs release ownership) */
307/* 9 reserved */
308#define PORT_RESET (1<<8) /* reset port */
309#define PORT_SUSPEND (1<<7) /* suspend port */
310#define PORT_RESUME (1<<6) /* resume it */
311#define PORT_OCC (1<<5) /* over current change */
312#define PORT_OC (1<<4) /* over current active */
313#define PORT_PEC (1<<3) /* port enable change */
314#define PORT_PE (1<<2) /* port enable */
315#define PORT_CSC (1<<1) /* connect status change */
316#define PORT_CONNECT (1<<0) /* device connected */
317#define PORT_RWC_BITS (PORT_CSC | PORT_PEC | PORT_OCC)
318} __attribute__ ((packed));
319
320#define USBMODE 0x68 /* USB Device mode */
321#define USBMODE_SDIS (1<<3) /* Stream disable */
322#define USBMODE_BE (1<<2) /* BE/LE endianness select */
323#define USBMODE_CM_HC (3<<0) /* host controller mode */
324#define USBMODE_CM_IDLE (0<<0) /* idle state */
325
326/* Appendix C, Debug port ... intended for use with special "debug devices"
327 * that can help if there's no serial console. (nonstandard enumeration.)
328 */
329struct ehci_dbg_port {
330 u32 control;
331#define DBGP_OWNER (1<<30)
332#define DBGP_ENABLED (1<<28)
333#define DBGP_DONE (1<<16)
334#define DBGP_INUSE (1<<10)
335#define DBGP_ERRCODE(x) (((x)>>7)&0x07)
336# define DBGP_ERR_BAD 1
337# define DBGP_ERR_SIGNAL 2
338#define DBGP_ERROR (1<<6)
339#define DBGP_GO (1<<5)
340#define DBGP_OUT (1<<4)
341#define DBGP_LEN(x) (((x)>>0)&0x0f)
342 u32 pids;
343#define DBGP_PID_GET(x) (((x)>>16)&0xff)
344#define DBGP_PID_SET(data,tok) (((data)<<8)|(tok))
345 u32 data03;
346 u32 data47;
347 u32 address;
348#define DBGP_EPADDR(dev,ep) (((dev)<<8)|(ep))
349} __attribute__ ((packed));
350 214
351/*-------------------------------------------------------------------------*/ 215/*-------------------------------------------------------------------------*/
352 216
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c
index c858f2adb929..8017f1cf78e2 100644
--- a/drivers/usb/host/isp1760-hcd.c
+++ b/drivers/usb/host/isp1760-hcd.c
@@ -126,9 +126,8 @@ static void isp1760_writel(const unsigned int val, __u32 __iomem *regs)
126 * doesn't quite work because some people have to enforce 32-bit access 126 * doesn't quite work because some people have to enforce 32-bit access
127 */ 127 */
128static void priv_read_copy(struct isp1760_hcd *priv, u32 *src, 128static void priv_read_copy(struct isp1760_hcd *priv, u32 *src,
129 __u32 __iomem *dst, u32 offset, u32 len) 129 __u32 __iomem *dst, u32 len)
130{ 130{
131 struct usb_hcd *hcd = priv_to_hcd(priv);
132 u32 val; 131 u32 val;
133 u8 *buff8; 132 u8 *buff8;
134 133
@@ -136,11 +135,6 @@ static void priv_read_copy(struct isp1760_hcd *priv, u32 *src,
136 printk(KERN_ERR "ERROR: buffer: %p len: %d\n", src, len); 135 printk(KERN_ERR "ERROR: buffer: %p len: %d\n", src, len);
137 return; 136 return;
138 } 137 }
139 isp1760_writel(offset, hcd->regs + HC_MEMORY_REG);
140 /* XXX
141 * 90nsec delay, the spec says something how this could be avoided.
142 */
143 mdelay(1);
144 138
145 while (len >= 4) { 139 while (len >= 4) {
146 *src = __raw_readl(dst); 140 *src = __raw_readl(dst);
@@ -987,8 +981,20 @@ static void do_atl_int(struct usb_hcd *usb_hcd)
987 printk(KERN_ERR "qh is 0\n"); 981 printk(KERN_ERR "qh is 0\n");
988 continue; 982 continue;
989 } 983 }
990 priv_read_copy(priv, (u32 *)&ptd, usb_hcd->regs + atl_regs, 984 isp1760_writel(atl_regs + ISP_BANK(0), usb_hcd->regs +
991 atl_regs, sizeof(ptd)); 985 HC_MEMORY_REG);
986 isp1760_writel(payload + ISP_BANK(1), usb_hcd->regs +
987 HC_MEMORY_REG);
988 /*
989 * write bank1 address twice to ensure the 90ns delay (time
990 * between BANK0 write and the priv_read_copy() call is at
991 * least 3*t_WHWL + 2*t_w11 = 3*25ns + 2*17ns = 109ns)
992 */
993 isp1760_writel(payload + ISP_BANK(1), usb_hcd->regs +
994 HC_MEMORY_REG);
995
996 priv_read_copy(priv, (u32 *)&ptd, usb_hcd->regs + atl_regs +
997 ISP_BANK(0), sizeof(ptd));
992 998
993 dw1 = le32_to_cpu(ptd.dw1); 999 dw1 = le32_to_cpu(ptd.dw1);
994 dw2 = le32_to_cpu(ptd.dw2); 1000 dw2 = le32_to_cpu(ptd.dw2);
@@ -1091,7 +1097,7 @@ static void do_atl_int(struct usb_hcd *usb_hcd)
1091 case IN_PID: 1097 case IN_PID:
1092 priv_read_copy(priv, 1098 priv_read_copy(priv,
1093 priv->atl_ints[queue_entry].data_buffer, 1099 priv->atl_ints[queue_entry].data_buffer,
1094 usb_hcd->regs + payload, payload, 1100 usb_hcd->regs + payload + ISP_BANK(1),
1095 length); 1101 length);
1096 1102
1097 case OUT_PID: 1103 case OUT_PID:
@@ -1122,11 +1128,11 @@ static void do_atl_int(struct usb_hcd *usb_hcd)
1122 } else if (usb_pipebulk(urb->pipe) && (length < qtd->length)) { 1128 } else if (usb_pipebulk(urb->pipe) && (length < qtd->length)) {
1123 /* short BULK received */ 1129 /* short BULK received */
1124 1130
1125 printk(KERN_ERR "short bulk, %d instead %zu\n", length,
1126 qtd->length);
1127 if (urb->transfer_flags & URB_SHORT_NOT_OK) { 1131 if (urb->transfer_flags & URB_SHORT_NOT_OK) {
1128 urb->status = -EREMOTEIO; 1132 urb->status = -EREMOTEIO;
1129 printk(KERN_ERR "not okey\n"); 1133 isp1760_dbg(priv, "short bulk, %d instead %zu "
1134 "with URB_SHORT_NOT_OK flag.\n",
1135 length, qtd->length);
1130 } 1136 }
1131 1137
1132 if (urb->status == -EINPROGRESS) 1138 if (urb->status == -EINPROGRESS)
@@ -1206,8 +1212,20 @@ static void do_intl_int(struct usb_hcd *usb_hcd)
1206 continue; 1212 continue;
1207 } 1213 }
1208 1214
1209 priv_read_copy(priv, (u32 *)&ptd, usb_hcd->regs + int_regs, 1215 isp1760_writel(int_regs + ISP_BANK(0), usb_hcd->regs +
1210 int_regs, sizeof(ptd)); 1216 HC_MEMORY_REG);
1217 isp1760_writel(payload + ISP_BANK(1), usb_hcd->regs +
1218 HC_MEMORY_REG);
1219 /*
1220 * write bank1 address twice to ensure the 90ns delay (time
1221 * between BANK0 write and the priv_read_copy() call is at
1222 * least 3*t_WHWL + 2*t_w11 = 3*25ns + 2*17ns = 92ns)
1223 */
1224 isp1760_writel(payload + ISP_BANK(1), usb_hcd->regs +
1225 HC_MEMORY_REG);
1226
1227 priv_read_copy(priv, (u32 *)&ptd, usb_hcd->regs + int_regs +
1228 ISP_BANK(0), sizeof(ptd));
1211 dw1 = le32_to_cpu(ptd.dw1); 1229 dw1 = le32_to_cpu(ptd.dw1);
1212 dw3 = le32_to_cpu(ptd.dw3); 1230 dw3 = le32_to_cpu(ptd.dw3);
1213 check_int_err_status(le32_to_cpu(ptd.dw4)); 1231 check_int_err_status(le32_to_cpu(ptd.dw4));
@@ -1242,7 +1260,7 @@ static void do_intl_int(struct usb_hcd *usb_hcd)
1242 case IN_PID: 1260 case IN_PID:
1243 priv_read_copy(priv, 1261 priv_read_copy(priv,
1244 priv->int_ints[queue_entry].data_buffer, 1262 priv->int_ints[queue_entry].data_buffer,
1245 usb_hcd->regs + payload , payload, 1263 usb_hcd->regs + payload + ISP_BANK(1),
1246 length); 1264 length);
1247 case OUT_PID: 1265 case OUT_PID:
1248 1266
@@ -1615,8 +1633,7 @@ static int isp1760_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
1615 return -EPIPE; 1633 return -EPIPE;
1616 } 1634 }
1617 1635
1618 isp1760_prepare_enqueue(priv, urb, &qtd_list, mem_flags, pe); 1636 return isp1760_prepare_enqueue(priv, urb, &qtd_list, mem_flags, pe);
1619 return 0;
1620} 1637}
1621 1638
1622static int isp1760_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, 1639static int isp1760_urb_dequeue(struct usb_hcd *hcd, struct urb *urb,
diff --git a/drivers/usb/host/isp1760-hcd.h b/drivers/usb/host/isp1760-hcd.h
index 6473dd86993c..4377277667d9 100644
--- a/drivers/usb/host/isp1760-hcd.h
+++ b/drivers/usb/host/isp1760-hcd.h
@@ -54,6 +54,8 @@ void deinit_kmem_cache(void);
54#define BUFFER_MAP 0x7 54#define BUFFER_MAP 0x7
55 55
56#define HC_MEMORY_REG 0x33c 56#define HC_MEMORY_REG 0x33c
57#define ISP_BANK(x) ((x) << 16)
58
57#define HC_PORT1_CTRL 0x374 59#define HC_PORT1_CTRL 0x374
58#define PORT1_POWER (3 << 3) 60#define PORT1_POWER (3 << 3)
59#define PORT1_INIT1 (1 << 7) 61#define PORT1_INIT1 (1 << 7)
@@ -119,6 +121,9 @@ struct inter_packet_info {
119typedef void (packet_enqueue)(struct usb_hcd *hcd, struct isp1760_qh *qh, 121typedef void (packet_enqueue)(struct usb_hcd *hcd, struct isp1760_qh *qh,
120 struct isp1760_qtd *qtd); 122 struct isp1760_qtd *qtd);
121 123
124#define isp1760_dbg(priv, fmt, args...) \
125 dev_dbg(priv_to_hcd(priv)->self.controller, fmt, ##args)
126
122#define isp1760_info(priv, fmt, args...) \ 127#define isp1760_info(priv, fmt, args...) \
123 dev_info(priv_to_hcd(priv)->self.controller, fmt, ##args) 128 dev_info(priv_to_hcd(priv)->self.controller, fmt, ##args)
124 129
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index a5d8e550d897..4ed228a89943 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -15,12 +15,11 @@
15#include <linux/clk.h> 15#include <linux/clk.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17 17
18#include <asm/mach-types.h> 18#include <mach/hardware.h>
19#include <asm/hardware.h>
20#include <asm/gpio.h> 19#include <asm/gpio.h>
21 20
22#include <asm/arch/board.h> 21#include <mach/board.h>
23#include <asm/arch/cpu.h> 22#include <mach/cpu.h>
24 23
25#ifndef CONFIG_ARCH_AT91 24#ifndef CONFIG_ARCH_AT91
26#error "CONFIG_ARCH_AT91 must be defined." 25#error "CONFIG_ARCH_AT91 must be defined."
@@ -261,7 +260,6 @@ static const struct hc_driver ohci_at91_hc_driver = {
261 */ 260 */
262 .hub_status_data = ohci_hub_status_data, 261 .hub_status_data = ohci_hub_status_data,
263 .hub_control = ohci_hub_control, 262 .hub_control = ohci_hub_control,
264 .hub_irq_enable = ohci_rhsc_enable,
265#ifdef CONFIG_PM 263#ifdef CONFIG_PM
266 .bus_suspend = ohci_bus_suspend, 264 .bus_suspend = ohci_bus_suspend,
267 .bus_resume = ohci_bus_resume, 265 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c
index c0948008fe3d..2ac4e022a13f 100644
--- a/drivers/usb/host/ohci-au1xxx.c
+++ b/drivers/usb/host/ohci-au1xxx.c
@@ -163,7 +163,6 @@ static const struct hc_driver ohci_au1xxx_hc_driver = {
163 */ 163 */
164 .hub_status_data = ohci_hub_status_data, 164 .hub_status_data = ohci_hub_status_data,
165 .hub_control = ohci_hub_control, 165 .hub_control = ohci_hub_control,
166 .hub_irq_enable = ohci_rhsc_enable,
167#ifdef CONFIG_PM 166#ifdef CONFIG_PM
168 .bus_suspend = ohci_bus_suspend, 167 .bus_suspend = ohci_bus_suspend,
169 .bus_resume = ohci_bus_resume, 168 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c
index 5adaf36e47d0..fb3055f084b5 100644
--- a/drivers/usb/host/ohci-ep93xx.c
+++ b/drivers/usb/host/ohci-ep93xx.c
@@ -28,8 +28,7 @@
28#include <linux/signal.h> 28#include <linux/signal.h>
29#include <linux/platform_device.h> 29#include <linux/platform_device.h>
30 30
31#include <asm/mach-types.h> 31#include <mach/hardware.h>
32#include <asm/hardware.h>
33 32
34static struct clk *usb_host_clock; 33static struct clk *usb_host_clock;
35 34
@@ -135,7 +134,6 @@ static struct hc_driver ohci_ep93xx_hc_driver = {
135 .get_frame_number = ohci_get_frame, 134 .get_frame_number = ohci_get_frame,
136 .hub_status_data = ohci_hub_status_data, 135 .hub_status_data = ohci_hub_status_data,
137 .hub_control = ohci_hub_control, 136 .hub_control = ohci_hub_control,
138 .hub_irq_enable = ohci_rhsc_enable,
139#ifdef CONFIG_PM 137#ifdef CONFIG_PM
140 .bus_suspend = ohci_bus_suspend, 138 .bus_suspend = ohci_bus_suspend,
141 .bus_resume = ohci_bus_resume, 139 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 26bc47941d01..89901962cbfd 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -86,6 +86,21 @@ static void ohci_stop (struct usb_hcd *hcd);
86static int ohci_restart (struct ohci_hcd *ohci); 86static int ohci_restart (struct ohci_hcd *ohci);
87#endif 87#endif
88 88
89#ifdef CONFIG_PCI
90static void quirk_amd_pll(int state);
91static void amd_iso_dev_put(void);
92#else
93static inline void quirk_amd_pll(int state)
94{
95 return;
96}
97static inline void amd_iso_dev_put(void)
98{
99 return;
100}
101#endif
102
103
89#include "ohci-hub.c" 104#include "ohci-hub.c"
90#include "ohci-dbg.c" 105#include "ohci-dbg.c"
91#include "ohci-mem.c" 106#include "ohci-mem.c"
@@ -483,6 +498,9 @@ static int ohci_init (struct ohci_hcd *ohci)
483 int ret; 498 int ret;
484 struct usb_hcd *hcd = ohci_to_hcd(ohci); 499 struct usb_hcd *hcd = ohci_to_hcd(ohci);
485 500
501 if (distrust_firmware)
502 ohci->flags |= OHCI_QUIRK_HUB_POWER;
503
486 disable (ohci); 504 disable (ohci);
487 ohci->regs = hcd->regs; 505 ohci->regs = hcd->regs;
488 506
@@ -689,7 +707,8 @@ retry:
689 temp |= RH_A_NOCP; 707 temp |= RH_A_NOCP;
690 temp &= ~(RH_A_POTPGT | RH_A_NPS); 708 temp &= ~(RH_A_POTPGT | RH_A_NPS);
691 ohci_writel (ohci, temp, &ohci->regs->roothub.a); 709 ohci_writel (ohci, temp, &ohci->regs->roothub.a);
692 } else if ((ohci->flags & OHCI_QUIRK_AMD756) || distrust_firmware) { 710 } else if ((ohci->flags & OHCI_QUIRK_AMD756) ||
711 (ohci->flags & OHCI_QUIRK_HUB_POWER)) {
693 /* hub power always on; required for AMD-756 and some 712 /* hub power always on; required for AMD-756 and some
694 * Mac platforms. ganged overcurrent reporting, if any. 713 * Mac platforms. ganged overcurrent reporting, if any.
695 */ 714 */
@@ -882,6 +901,8 @@ static void ohci_stop (struct usb_hcd *hcd)
882 901
883 if (quirk_zfmicro(ohci)) 902 if (quirk_zfmicro(ohci))
884 del_timer(&ohci->unlink_watchdog); 903 del_timer(&ohci->unlink_watchdog);
904 if (quirk_amdiso(ohci))
905 amd_iso_dev_put();
885 906
886 remove_debug_files (ohci); 907 remove_debug_files (ohci);
887 ohci_mem_cleanup (ohci); 908 ohci_mem_cleanup (ohci);
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
index b56739221d11..7ea9a7b31155 100644
--- a/drivers/usb/host/ohci-hub.c
+++ b/drivers/usb/host/ohci-hub.c
@@ -36,18 +36,6 @@
36 36
37/*-------------------------------------------------------------------------*/ 37/*-------------------------------------------------------------------------*/
38 38
39/* hcd->hub_irq_enable() */
40static void ohci_rhsc_enable (struct usb_hcd *hcd)
41{
42 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
43
44 spin_lock_irq(&ohci->lock);
45 if (!ohci->autostop)
46 del_timer(&hcd->rh_timer); /* Prevent next poll */
47 ohci_writel(ohci, OHCI_INTR_RHSC, &ohci->regs->intrenable);
48 spin_unlock_irq(&ohci->lock);
49}
50
51#define OHCI_SCHED_ENABLES \ 39#define OHCI_SCHED_ENABLES \
52 (OHCI_CTRL_CLE|OHCI_CTRL_BLE|OHCI_CTRL_PLE|OHCI_CTRL_IE) 40 (OHCI_CTRL_CLE|OHCI_CTRL_BLE|OHCI_CTRL_PLE|OHCI_CTRL_IE)
53 41
@@ -374,18 +362,28 @@ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
374 int any_connected) 362 int any_connected)
375{ 363{
376 int poll_rh = 1; 364 int poll_rh = 1;
365 int rhsc;
377 366
367 rhsc = ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC;
378 switch (ohci->hc_control & OHCI_CTRL_HCFS) { 368 switch (ohci->hc_control & OHCI_CTRL_HCFS) {
379 369
380 case OHCI_USB_OPER: 370 case OHCI_USB_OPER:
381 /* keep on polling until we know a device is connected 371 /* If no status changes are pending, enable status-change
382 * and RHSC is enabled */ 372 * interrupts.
373 */
374 if (!rhsc && !changed) {
375 rhsc = OHCI_INTR_RHSC;
376 ohci_writel(ohci, rhsc, &ohci->regs->intrenable);
377 }
378
379 /* Keep on polling until we know a device is connected
380 * and RHSC is enabled, or until we autostop.
381 */
383 if (!ohci->autostop) { 382 if (!ohci->autostop) {
384 if (any_connected || 383 if (any_connected ||
385 !device_may_wakeup(&ohci_to_hcd(ohci) 384 !device_may_wakeup(&ohci_to_hcd(ohci)
386 ->self.root_hub->dev)) { 385 ->self.root_hub->dev)) {
387 if (ohci_readl(ohci, &ohci->regs->intrenable) & 386 if (rhsc)
388 OHCI_INTR_RHSC)
389 poll_rh = 0; 387 poll_rh = 0;
390 } else { 388 } else {
391 ohci->autostop = 1; 389 ohci->autostop = 1;
@@ -398,12 +396,13 @@ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
398 ohci->autostop = 0; 396 ohci->autostop = 0;
399 ohci->next_statechange = jiffies + 397 ohci->next_statechange = jiffies +
400 STATECHANGE_DELAY; 398 STATECHANGE_DELAY;
401 } else if (time_after_eq(jiffies, 399 } else if (rhsc && time_after_eq(jiffies,
402 ohci->next_statechange) 400 ohci->next_statechange)
403 && !ohci->ed_rm_list 401 && !ohci->ed_rm_list
404 && !(ohci->hc_control & 402 && !(ohci->hc_control &
405 OHCI_SCHED_ENABLES)) { 403 OHCI_SCHED_ENABLES)) {
406 ohci_rh_suspend(ohci, 1); 404 ohci_rh_suspend(ohci, 1);
405 poll_rh = 0;
407 } 406 }
408 } 407 }
409 break; 408 break;
@@ -417,6 +416,12 @@ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
417 else 416 else
418 usb_hcd_resume_root_hub(ohci_to_hcd(ohci)); 417 usb_hcd_resume_root_hub(ohci_to_hcd(ohci));
419 } else { 418 } else {
419 if (!rhsc && (ohci->autostop ||
420 ohci_to_hcd(ohci)->self.root_hub->
421 do_remote_wakeup))
422 ohci_writel(ohci, OHCI_INTR_RHSC,
423 &ohci->regs->intrenable);
424
420 /* everything is idle, no need for polling */ 425 /* everything is idle, no need for polling */
421 poll_rh = 0; 426 poll_rh = 0;
422 } 427 }
@@ -438,12 +443,16 @@ static inline int ohci_rh_resume(struct ohci_hcd *ohci)
438static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, 443static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
439 int any_connected) 444 int any_connected)
440{ 445{
441 int poll_rh = 1; 446 /* If RHSC is enabled, don't poll */
442
443 /* keep on polling until RHSC is enabled */
444 if (ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC) 447 if (ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC)
445 poll_rh = 0; 448 return 0;
446 return poll_rh; 449
450 /* If no status changes are pending, enable status-change interrupts */
451 if (!changed) {
452 ohci_writel(ohci, OHCI_INTR_RHSC, &ohci->regs->intrenable);
453 return 0;
454 }
455 return 1;
447} 456}
448 457
449#endif /* CONFIG_PM */ 458#endif /* CONFIG_PM */
@@ -483,6 +492,13 @@ ohci_hub_status_data (struct usb_hcd *hcd, char *buf)
483 length++; 492 length++;
484 } 493 }
485 494
495 /* Some broken controllers never turn off RHCS in the interrupt
496 * status register. For their sake we won't re-enable RHSC
497 * interrupts if the flag is already set.
498 */
499 if (ohci_readl(ohci, &ohci->regs->intrstatus) & OHCI_INTR_RHSC)
500 changed = 1;
501
486 /* look at each port */ 502 /* look at each port */
487 for (i = 0; i < ohci->num_ports; i++) { 503 for (i = 0; i < ohci->num_ports; i++) {
488 u32 status = roothub_portstatus (ohci, i); 504 u32 status = roothub_portstatus (ohci, i);
@@ -572,8 +588,6 @@ static int ohci_start_port_reset (struct usb_hcd *hcd, unsigned port)
572 return 0; 588 return 0;
573} 589}
574 590
575static void start_hnp(struct ohci_hcd *ohci);
576
577#else 591#else
578 592
579#define ohci_start_port_reset NULL 593#define ohci_start_port_reset NULL
@@ -760,7 +774,7 @@ static int ohci_hub_control (
760#ifdef CONFIG_USB_OTG 774#ifdef CONFIG_USB_OTG
761 if (hcd->self.otg_port == (wIndex + 1) 775 if (hcd->self.otg_port == (wIndex + 1)
762 && hcd->self.b_hnp_enable) 776 && hcd->self.b_hnp_enable)
763 start_hnp(ohci); 777 ohci->start_hnp(ohci);
764 else 778 else
765#endif 779#endif
766 ohci_writel (ohci, RH_PS_PSS, 780 ohci_writel (ohci, RH_PS_PSS,
diff --git a/drivers/usb/host/ohci-lh7a404.c b/drivers/usb/host/ohci-lh7a404.c
index 1ef5d482c145..de42283149c7 100644
--- a/drivers/usb/host/ohci-lh7a404.c
+++ b/drivers/usb/host/ohci-lh7a404.c
@@ -19,7 +19,7 @@
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/signal.h> 20#include <linux/signal.h>
21 21
22#include <asm/hardware.h> 22#include <mach/hardware.h>
23 23
24 24
25extern int usb_disabled(void); 25extern int usb_disabled(void);
@@ -193,7 +193,6 @@ static const struct hc_driver ohci_lh7a404_hc_driver = {
193 */ 193 */
194 .hub_status_data = ohci_hub_status_data, 194 .hub_status_data = ohci_hub_status_data,
195 .hub_control = ohci_hub_control, 195 .hub_control = ohci_hub_control,
196 .hub_irq_enable = ohci_rhsc_enable,
197#ifdef CONFIG_PM 196#ifdef CONFIG_PM
198 .bus_suspend = ohci_bus_suspend, 197 .bus_suspend = ohci_bus_suspend,
199 .bus_resume = ohci_bus_resume, 198 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index 6e5e5f81ac90..95b3ec89c126 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -19,15 +19,15 @@
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/clk.h> 20#include <linux/clk.h>
21 21
22#include <asm/hardware.h> 22#include <mach/hardware.h>
23#include <asm/io.h> 23#include <asm/io.h>
24#include <asm/mach-types.h> 24#include <asm/mach-types.h>
25 25
26#include <asm/arch/mux.h> 26#include <mach/mux.h>
27#include <asm/arch/irqs.h> 27#include <mach/irqs.h>
28#include <asm/arch/gpio.h> 28#include <mach/gpio.h>
29#include <asm/arch/fpga.h> 29#include <mach/fpga.h>
30#include <asm/arch/usb.h> 30#include <mach/usb.h>
31 31
32 32
33/* OMAP-1510 OHCI has its own MMU for DMA */ 33/* OMAP-1510 OHCI has its own MMU for DMA */
@@ -208,7 +208,7 @@ static int ohci_omap_init(struct usb_hcd *hcd)
208 if (cpu_is_omap16xx()) 208 if (cpu_is_omap16xx())
209 ocpi_enable(); 209 ocpi_enable();
210 210
211#ifdef CONFIG_ARCH_OMAP_OTG 211#ifdef CONFIG_USB_OTG
212 if (need_transceiver) { 212 if (need_transceiver) {
213 ohci->transceiver = otg_get_transceiver(); 213 ohci->transceiver = otg_get_transceiver();
214 if (ohci->transceiver) { 214 if (ohci->transceiver) {
@@ -225,6 +225,7 @@ static int ohci_omap_init(struct usb_hcd *hcd)
225 dev_err(hcd->self.controller, "can't find transceiver\n"); 225 dev_err(hcd->self.controller, "can't find transceiver\n");
226 return -ENODEV; 226 return -ENODEV;
227 } 227 }
228 ohci->start_hnp = start_hnp;
228 } 229 }
229#endif 230#endif
230 231
@@ -260,7 +261,7 @@ static int ohci_omap_init(struct usb_hcd *hcd)
260 omap_cfg_reg(W4_USB_HIGHZ); 261 omap_cfg_reg(W4_USB_HIGHZ);
261 } 262 }
262 ohci_writel(ohci, rh, &ohci->regs->roothub.a); 263 ohci_writel(ohci, rh, &ohci->regs->roothub.a);
263 distrust_firmware = 0; 264 ohci->flags &= ~OHCI_QUIRK_HUB_POWER;
264 } else if (machine_is_nokia770()) { 265 } else if (machine_is_nokia770()) {
265 /* We require a self-powered hub, which should have 266 /* We require a self-powered hub, which should have
266 * plenty of power. */ 267 * plenty of power. */
@@ -469,7 +470,6 @@ static const struct hc_driver ohci_omap_hc_driver = {
469 */ 470 */
470 .hub_status_data = ohci_hub_status_data, 471 .hub_status_data = ohci_hub_status_data,
471 .hub_control = ohci_hub_control, 472 .hub_control = ohci_hub_control,
472 .hub_irq_enable = ohci_rhsc_enable,
473#ifdef CONFIG_PM 473#ifdef CONFIG_PM
474 .bus_suspend = ohci_bus_suspend, 474 .bus_suspend = ohci_bus_suspend,
475 .bus_resume = ohci_bus_resume, 475 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c
index 4696cc912e16..a9c2ae36c7ad 100644
--- a/drivers/usb/host/ohci-pci.c
+++ b/drivers/usb/host/ohci-pci.c
@@ -18,6 +18,28 @@
18#error "This file is PCI bus glue. CONFIG_PCI must be defined." 18#error "This file is PCI bus glue. CONFIG_PCI must be defined."
19#endif 19#endif
20 20
21#include <linux/pci.h>
22#include <linux/io.h>
23
24
25/* constants used to work around PM-related transfer
26 * glitches in some AMD 700 series southbridges
27 */
28#define AB_REG_BAR 0xf0
29#define AB_INDX(addr) ((addr) + 0x00)
30#define AB_DATA(addr) ((addr) + 0x04)
31#define AX_INDXC 0X30
32#define AX_DATAC 0x34
33
34#define NB_PCIE_INDX_ADDR 0xe0
35#define NB_PCIE_INDX_DATA 0xe4
36#define PCIE_P_CNTL 0x10040
37#define BIF_NB 0x10002
38
39static struct pci_dev *amd_smbus_dev;
40static struct pci_dev *amd_hb_dev;
41static int amd_ohci_iso_count;
42
21/*-------------------------------------------------------------------------*/ 43/*-------------------------------------------------------------------------*/
22 44
23static int broken_suspend(struct usb_hcd *hcd) 45static int broken_suspend(struct usb_hcd *hcd)
@@ -143,6 +165,103 @@ static int ohci_quirk_nec(struct usb_hcd *hcd)
143 return 0; 165 return 0;
144} 166}
145 167
168static int ohci_quirk_amd700(struct usb_hcd *hcd)
169{
170 struct ohci_hcd *ohci = hcd_to_ohci(hcd);
171 u8 rev = 0;
172
173 if (!amd_smbus_dev)
174 amd_smbus_dev = pci_get_device(PCI_VENDOR_ID_ATI,
175 PCI_DEVICE_ID_ATI_SBX00_SMBUS, NULL);
176 if (!amd_smbus_dev)
177 return 0;
178
179 pci_read_config_byte(amd_smbus_dev, PCI_REVISION_ID, &rev);
180 if ((rev > 0x3b) || (rev < 0x30)) {
181 pci_dev_put(amd_smbus_dev);
182 amd_smbus_dev = NULL;
183 return 0;
184 }
185
186 amd_ohci_iso_count++;
187
188 if (!amd_hb_dev)
189 amd_hb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x9600, NULL);
190
191 ohci->flags |= OHCI_QUIRK_AMD_ISO;
192 ohci_dbg(ohci, "enabled AMD ISO transfers quirk\n");
193
194 return 0;
195}
196
197/*
198 * The hardware normally enables the A-link power management feature, which
199 * lets the system lower the power consumption in idle states.
200 *
201 * Assume the system is configured to have USB 1.1 ISO transfers going
202 * to or from a USB device. Without this quirk, that stream may stutter
203 * or have breaks occasionally. For transfers going to speakers, this
204 * makes a very audible mess...
205 *
206 * That audio playback corruption is due to the audio stream getting
207 * interrupted occasionally when the link goes in lower power state
208 * This USB quirk prevents the link going into that lower power state
209 * during audio playback or other ISO operations.
210 */
211static void quirk_amd_pll(int on)
212{
213 u32 addr;
214 u32 val;
215 u32 bit = (on > 0) ? 1 : 0;
216
217 pci_read_config_dword(amd_smbus_dev, AB_REG_BAR, &addr);
218
219 /* BIT names/meanings are NDA-protected, sorry ... */
220
221 outl(AX_INDXC, AB_INDX(addr));
222 outl(0x40, AB_DATA(addr));
223 outl(AX_DATAC, AB_INDX(addr));
224 val = inl(AB_DATA(addr));
225 val &= ~((1 << 3) | (1 << 4) | (1 << 9));
226 val |= (bit << 3) | ((!bit) << 4) | ((!bit) << 9);
227 outl(val, AB_DATA(addr));
228
229 if (amd_hb_dev) {
230 addr = PCIE_P_CNTL;
231 pci_write_config_dword(amd_hb_dev, NB_PCIE_INDX_ADDR, addr);
232
233 pci_read_config_dword(amd_hb_dev, NB_PCIE_INDX_DATA, &val);
234 val &= ~(1 | (1 << 3) | (1 << 4) | (1 << 9) | (1 << 12));
235 val |= bit | (bit << 3) | (bit << 12);
236 val |= ((!bit) << 4) | ((!bit) << 9);
237 pci_write_config_dword(amd_hb_dev, NB_PCIE_INDX_DATA, val);
238
239 addr = BIF_NB;
240 pci_write_config_dword(amd_hb_dev, NB_PCIE_INDX_ADDR, addr);
241
242 pci_read_config_dword(amd_hb_dev, NB_PCIE_INDX_DATA, &val);
243 val &= ~(1 << 8);
244 val |= bit << 8;
245 pci_write_config_dword(amd_hb_dev, NB_PCIE_INDX_DATA, val);
246 }
247}
248
249static void amd_iso_dev_put(void)
250{
251 amd_ohci_iso_count--;
252 if (amd_ohci_iso_count == 0) {
253 if (amd_smbus_dev) {
254 pci_dev_put(amd_smbus_dev);
255 amd_smbus_dev = NULL;
256 }
257 if (amd_hb_dev) {
258 pci_dev_put(amd_hb_dev);
259 amd_hb_dev = NULL;
260 }
261 }
262
263}
264
146/* List of quirks for OHCI */ 265/* List of quirks for OHCI */
147static const struct pci_device_id ohci_pci_quirks[] = { 266static const struct pci_device_id ohci_pci_quirks[] = {
148 { 267 {
@@ -181,6 +300,19 @@ static const struct pci_device_id ohci_pci_quirks[] = {
181 PCI_DEVICE(PCI_VENDOR_ID_ITE, 0x8152), 300 PCI_DEVICE(PCI_VENDOR_ID_ITE, 0x8152),
182 .driver_data = (unsigned long) broken_suspend, 301 .driver_data = (unsigned long) broken_suspend,
183 }, 302 },
303 {
304 PCI_DEVICE(PCI_VENDOR_ID_ATI, 0x4397),
305 .driver_data = (unsigned long)ohci_quirk_amd700,
306 },
307 {
308 PCI_DEVICE(PCI_VENDOR_ID_ATI, 0x4398),
309 .driver_data = (unsigned long)ohci_quirk_amd700,
310 },
311 {
312 PCI_DEVICE(PCI_VENDOR_ID_ATI, 0x4399),
313 .driver_data = (unsigned long)ohci_quirk_amd700,
314 },
315
184 /* FIXME for some of the early AMD 760 southbridges, OHCI 316 /* FIXME for some of the early AMD 760 southbridges, OHCI
185 * won't work at all. blacklist them. 317 * won't work at all. blacklist them.
186 */ 318 */
@@ -327,7 +459,6 @@ static const struct hc_driver ohci_pci_hc_driver = {
327 */ 459 */
328 .hub_status_data = ohci_hub_status_data, 460 .hub_status_data = ohci_hub_status_data,
329 .hub_control = ohci_hub_control, 461 .hub_control = ohci_hub_control,
330 .hub_irq_enable = ohci_rhsc_enable,
331#ifdef CONFIG_PM 462#ifdef CONFIG_PM
332 .bus_suspend = ohci_bus_suspend, 463 .bus_suspend = ohci_bus_suspend,
333 .bus_resume = ohci_bus_resume, 464 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-pnx4008.c b/drivers/usb/host/ohci-pnx4008.c
index 6ad8f2fc57b9..658a2a978c32 100644
--- a/drivers/usb/host/ohci-pnx4008.c
+++ b/drivers/usb/host/ohci-pnx4008.c
@@ -21,13 +21,12 @@
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/i2c.h> 22#include <linux/i2c.h>
23 23
24#include <asm/hardware.h> 24#include <mach/hardware.h>
25#include <asm/io.h> 25#include <asm/io.h>
26#include <asm/mach-types.h>
27 26
28#include <asm/arch/platform.h> 27#include <mach/platform.h>
29#include <asm/arch/irqs.h> 28#include <mach/irqs.h>
30#include <asm/arch/gpio.h> 29#include <mach/gpio.h>
31 30
32#define USB_CTRL IO_ADDRESS(PNX4008_PWRMAN_BASE + 0x64) 31#define USB_CTRL IO_ADDRESS(PNX4008_PWRMAN_BASE + 0x64)
33 32
@@ -278,7 +277,6 @@ static const struct hc_driver ohci_pnx4008_hc_driver = {
278 */ 277 */
279 .hub_status_data = ohci_hub_status_data, 278 .hub_status_data = ohci_hub_status_data,
280 .hub_control = ohci_hub_control, 279 .hub_control = ohci_hub_control,
281 .hub_irq_enable = ohci_rhsc_enable,
282#ifdef CONFIG_PM 280#ifdef CONFIG_PM
283 .bus_suspend = ohci_bus_suspend, 281 .bus_suspend = ohci_bus_suspend,
284 .bus_resume = ohci_bus_resume, 282 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-pnx8550.c b/drivers/usb/host/ohci-pnx8550.c
index 605d59cba28e..28467e288a93 100644
--- a/drivers/usb/host/ohci-pnx8550.c
+++ b/drivers/usb/host/ohci-pnx8550.c
@@ -201,7 +201,6 @@ static const struct hc_driver ohci_pnx8550_hc_driver = {
201 */ 201 */
202 .hub_status_data = ohci_hub_status_data, 202 .hub_status_data = ohci_hub_status_data,
203 .hub_control = ohci_hub_control, 203 .hub_control = ohci_hub_control,
204 .hub_irq_enable = ohci_rhsc_enable,
205#ifdef CONFIG_PM 204#ifdef CONFIG_PM
206 .bus_suspend = ohci_bus_suspend, 205 .bus_suspend = ohci_bus_suspend,
207 .bus_resume = ohci_bus_resume, 206 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-ppc-of.c b/drivers/usb/host/ohci-ppc-of.c
index 91e6e101a4cc..7ac53264ead3 100644
--- a/drivers/usb/host/ohci-ppc-of.c
+++ b/drivers/usb/host/ohci-ppc-of.c
@@ -72,7 +72,6 @@ static const struct hc_driver ohci_ppc_of_hc_driver = {
72 */ 72 */
73 .hub_status_data = ohci_hub_status_data, 73 .hub_status_data = ohci_hub_status_data,
74 .hub_control = ohci_hub_control, 74 .hub_control = ohci_hub_control,
75 .hub_irq_enable = ohci_rhsc_enable,
76#ifdef CONFIG_PM 75#ifdef CONFIG_PM
77 .bus_suspend = ohci_bus_suspend, 76 .bus_suspend = ohci_bus_suspend,
78 .bus_resume = ohci_bus_resume, 77 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-ppc-soc.c b/drivers/usb/host/ohci-ppc-soc.c
index 523c30125577..cd3398b675b2 100644
--- a/drivers/usb/host/ohci-ppc-soc.c
+++ b/drivers/usb/host/ohci-ppc-soc.c
@@ -172,7 +172,6 @@ static const struct hc_driver ohci_ppc_soc_hc_driver = {
172 */ 172 */
173 .hub_status_data = ohci_hub_status_data, 173 .hub_status_data = ohci_hub_status_data,
174 .hub_control = ohci_hub_control, 174 .hub_control = ohci_hub_control,
175 .hub_irq_enable = ohci_rhsc_enable,
176#ifdef CONFIG_PM 175#ifdef CONFIG_PM
177 .bus_suspend = ohci_bus_suspend, 176 .bus_suspend = ohci_bus_suspend,
178 .bus_resume = ohci_bus_resume, 177 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-ps3.c b/drivers/usb/host/ohci-ps3.c
index 55c95647f008..2089d8a46c4b 100644
--- a/drivers/usb/host/ohci-ps3.c
+++ b/drivers/usb/host/ohci-ps3.c
@@ -68,7 +68,6 @@ static const struct hc_driver ps3_ohci_hc_driver = {
68 .get_frame_number = ohci_get_frame, 68 .get_frame_number = ohci_get_frame,
69 .hub_status_data = ohci_hub_status_data, 69 .hub_status_data = ohci_hub_status_data,
70 .hub_control = ohci_hub_control, 70 .hub_control = ohci_hub_control,
71 .hub_irq_enable = ohci_rhsc_enable,
72 .start_port_reset = ohci_start_port_reset, 71 .start_port_reset = ohci_start_port_reset,
73#if defined(CONFIG_PM) 72#if defined(CONFIG_PM)
74 .bus_suspend = ohci_bus_suspend, 73 .bus_suspend = ohci_bus_suspend,
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index 127b15799024..e294d430733b 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -23,18 +23,90 @@
23#include <linux/signal.h> 23#include <linux/signal.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/clk.h> 25#include <linux/clk.h>
26#include <mach/ohci.h>
26 27
27#include <asm/mach-types.h> 28/*
28#include <asm/hardware.h> 29 * UHC: USB Host Controller (OHCI-like) register definitions
29#include <asm/arch/pxa-regs.h> 30 */
30#include <asm/arch/pxa2xx-regs.h> /* FIXME: for PSSR */ 31#define UHCREV (0x0000) /* UHC HCI Spec Revision */
31#include <asm/arch/ohci.h> 32#define UHCHCON (0x0004) /* UHC Host Control Register */
33#define UHCCOMS (0x0008) /* UHC Command Status Register */
34#define UHCINTS (0x000C) /* UHC Interrupt Status Register */
35#define UHCINTE (0x0010) /* UHC Interrupt Enable */
36#define UHCINTD (0x0014) /* UHC Interrupt Disable */
37#define UHCHCCA (0x0018) /* UHC Host Controller Comm. Area */
38#define UHCPCED (0x001C) /* UHC Period Current Endpt Descr */
39#define UHCCHED (0x0020) /* UHC Control Head Endpt Descr */
40#define UHCCCED (0x0024) /* UHC Control Current Endpt Descr */
41#define UHCBHED (0x0028) /* UHC Bulk Head Endpt Descr */
42#define UHCBCED (0x002C) /* UHC Bulk Current Endpt Descr */
43#define UHCDHEAD (0x0030) /* UHC Done Head */
44#define UHCFMI (0x0034) /* UHC Frame Interval */
45#define UHCFMR (0x0038) /* UHC Frame Remaining */
46#define UHCFMN (0x003C) /* UHC Frame Number */
47#define UHCPERS (0x0040) /* UHC Periodic Start */
48#define UHCLS (0x0044) /* UHC Low Speed Threshold */
49
50#define UHCRHDA (0x0048) /* UHC Root Hub Descriptor A */
51#define UHCRHDA_NOCP (1 << 12) /* No over current protection */
52#define UHCRHDA_OCPM (1 << 11) /* Over Current Protection Mode */
53#define UHCRHDA_POTPGT(x) \
54 (((x) & 0xff) << 24) /* Power On To Power Good Time */
55
56#define UHCRHDB (0x004C) /* UHC Root Hub Descriptor B */
57#define UHCRHS (0x0050) /* UHC Root Hub Status */
58#define UHCRHPS1 (0x0054) /* UHC Root Hub Port 1 Status */
59#define UHCRHPS2 (0x0058) /* UHC Root Hub Port 2 Status */
60#define UHCRHPS3 (0x005C) /* UHC Root Hub Port 3 Status */
61
62#define UHCSTAT (0x0060) /* UHC Status Register */
63#define UHCSTAT_UPS3 (1 << 16) /* USB Power Sense Port3 */
64#define UHCSTAT_SBMAI (1 << 15) /* System Bus Master Abort Interrupt*/
65#define UHCSTAT_SBTAI (1 << 14) /* System Bus Target Abort Interrupt*/
66#define UHCSTAT_UPRI (1 << 13) /* USB Port Resume Interrupt */
67#define UHCSTAT_UPS2 (1 << 12) /* USB Power Sense Port 2 */
68#define UHCSTAT_UPS1 (1 << 11) /* USB Power Sense Port 1 */
69#define UHCSTAT_HTA (1 << 10) /* HCI Target Abort */
70#define UHCSTAT_HBA (1 << 8) /* HCI Buffer Active */
71#define UHCSTAT_RWUE (1 << 7) /* HCI Remote Wake Up Event */
72
73#define UHCHR (0x0064) /* UHC Reset Register */
74#define UHCHR_SSEP3 (1 << 11) /* Sleep Standby Enable for Port3 */
75#define UHCHR_SSEP2 (1 << 10) /* Sleep Standby Enable for Port2 */
76#define UHCHR_SSEP1 (1 << 9) /* Sleep Standby Enable for Port1 */
77#define UHCHR_PCPL (1 << 7) /* Power control polarity low */
78#define UHCHR_PSPL (1 << 6) /* Power sense polarity low */
79#define UHCHR_SSE (1 << 5) /* Sleep Standby Enable */
80#define UHCHR_UIT (1 << 4) /* USB Interrupt Test */
81#define UHCHR_SSDC (1 << 3) /* Simulation Scale Down Clock */
82#define UHCHR_CGR (1 << 2) /* Clock Generation Reset */
83#define UHCHR_FHR (1 << 1) /* Force Host Controller Reset */
84#define UHCHR_FSBIR (1 << 0) /* Force System Bus Iface Reset */
85
86#define UHCHIE (0x0068) /* UHC Interrupt Enable Register*/
87#define UHCHIE_UPS3IE (1 << 14) /* Power Sense Port3 IntEn */
88#define UHCHIE_UPRIE (1 << 13) /* Port Resume IntEn */
89#define UHCHIE_UPS2IE (1 << 12) /* Power Sense Port2 IntEn */
90#define UHCHIE_UPS1IE (1 << 11) /* Power Sense Port1 IntEn */
91#define UHCHIE_TAIE (1 << 10) /* HCI Interface Transfer Abort
92 Interrupt Enable*/
93#define UHCHIE_HBAIE (1 << 8) /* HCI Buffer Active IntEn */
94#define UHCHIE_RWIE (1 << 7) /* Remote Wake-up IntEn */
95
96#define UHCHIT (0x006C) /* UHC Interrupt Test register */
32 97
33#define PXA_UHC_MAX_PORTNUM 3 98#define PXA_UHC_MAX_PORTNUM 3
34 99
35#define UHCRHPS(x) __REG2( 0x4C000050, (x)<<2 ) 100struct pxa27x_ohci {
101 /* must be 1st member here for hcd_to_ohci() to work */
102 struct ohci_hcd ohci;
36 103
37static struct clk *usb_clk; 104 struct device *dev;
105 struct clk *clk;
106 void __iomem *mmio_base;
107};
108
109#define to_pxa27x_ohci(hcd) (struct pxa27x_ohci *)hcd_to_ohci(hcd)
38 110
39/* 111/*
40 PMM_NPS_MODE -- PMM Non-power switching mode 112 PMM_NPS_MODE -- PMM Non-power switching mode
@@ -46,30 +118,35 @@ static struct clk *usb_clk;
46 PMM_PERPORT_MODE -- PMM per port switching mode 118 PMM_PERPORT_MODE -- PMM per port switching mode
47 Ports are powered individually. 119 Ports are powered individually.
48 */ 120 */
49static int pxa27x_ohci_select_pmm( int mode ) 121static int pxa27x_ohci_select_pmm(struct pxa27x_ohci *ohci, int mode)
50{ 122{
51 switch ( mode ) { 123 uint32_t uhcrhda = __raw_readl(ohci->mmio_base + UHCRHDA);
124 uint32_t uhcrhdb = __raw_readl(ohci->mmio_base + UHCRHDB);
125
126 switch (mode) {
52 case PMM_NPS_MODE: 127 case PMM_NPS_MODE:
53 UHCRHDA |= RH_A_NPS; 128 uhcrhda |= RH_A_NPS;
54 break; 129 break;
55 case PMM_GLOBAL_MODE: 130 case PMM_GLOBAL_MODE:
56 UHCRHDA &= ~(RH_A_NPS & RH_A_PSM); 131 uhcrhda &= ~(RH_A_NPS & RH_A_PSM);
57 break; 132 break;
58 case PMM_PERPORT_MODE: 133 case PMM_PERPORT_MODE:
59 UHCRHDA &= ~(RH_A_NPS); 134 uhcrhda &= ~(RH_A_NPS);
60 UHCRHDA |= RH_A_PSM; 135 uhcrhda |= RH_A_PSM;
61 136
62 /* Set port power control mask bits, only 3 ports. */ 137 /* Set port power control mask bits, only 3 ports. */
63 UHCRHDB |= (0x7<<17); 138 uhcrhdb |= (0x7<<17);
64 break; 139 break;
65 default: 140 default:
66 printk( KERN_ERR 141 printk( KERN_ERR
67 "Invalid mode %d, set to non-power switch mode.\n", 142 "Invalid mode %d, set to non-power switch mode.\n",
68 mode ); 143 mode );
69 144
70 UHCRHDA |= RH_A_NPS; 145 uhcrhda |= RH_A_NPS;
71 } 146 }
72 147
148 __raw_writel(uhcrhda, ohci->mmio_base + UHCRHDA);
149 __raw_writel(uhcrhdb, ohci->mmio_base + UHCRHDB);
73 return 0; 150 return 0;
74} 151}
75 152
@@ -77,57 +154,110 @@ extern int usb_disabled(void);
77 154
78/*-------------------------------------------------------------------------*/ 155/*-------------------------------------------------------------------------*/
79 156
80static int pxa27x_start_hc(struct device *dev) 157static inline void pxa27x_setup_hc(struct pxa27x_ohci *ohci,
158 struct pxaohci_platform_data *inf)
159{
160 uint32_t uhchr = __raw_readl(ohci->mmio_base + UHCHR);
161 uint32_t uhcrhda = __raw_readl(ohci->mmio_base + UHCRHDA);
162
163 if (inf->flags & ENABLE_PORT1)
164 uhchr &= ~UHCHR_SSEP1;
165
166 if (inf->flags & ENABLE_PORT2)
167 uhchr &= ~UHCHR_SSEP2;
168
169 if (inf->flags & ENABLE_PORT3)
170 uhchr &= ~UHCHR_SSEP3;
171
172 if (inf->flags & POWER_CONTROL_LOW)
173 uhchr |= UHCHR_PCPL;
174
175 if (inf->flags & POWER_SENSE_LOW)
176 uhchr |= UHCHR_PSPL;
177
178 if (inf->flags & NO_OC_PROTECTION)
179 uhcrhda |= UHCRHDA_NOCP;
180
181 if (inf->flags & OC_MODE_PERPORT)
182 uhcrhda |= UHCRHDA_OCPM;
183
184 if (inf->power_on_delay) {
185 uhcrhda &= ~UHCRHDA_POTPGT(0xff);
186 uhcrhda |= UHCRHDA_POTPGT(inf->power_on_delay / 2);
187 }
188
189 __raw_writel(uhchr, ohci->mmio_base + UHCHR);
190 __raw_writel(uhcrhda, ohci->mmio_base + UHCRHDA);
191}
192
193static inline void pxa27x_reset_hc(struct pxa27x_ohci *ohci)
194{
195 uint32_t uhchr = __raw_readl(ohci->mmio_base + UHCHR);
196
197 __raw_writel(uhchr | UHCHR_FHR, ohci->mmio_base + UHCHR);
198 udelay(11);
199 __raw_writel(uhchr & ~UHCHR_FHR, ohci->mmio_base + UHCHR);
200}
201
202#ifdef CONFIG_CPU_PXA27x
203extern void pxa27x_clear_otgph(void);
204#else
205#define pxa27x_clear_otgph() do {} while (0)
206#endif
207
208static int pxa27x_start_hc(struct pxa27x_ohci *ohci, struct device *dev)
81{ 209{
82 int retval = 0; 210 int retval = 0;
83 struct pxaohci_platform_data *inf; 211 struct pxaohci_platform_data *inf;
212 uint32_t uhchr;
84 213
85 inf = dev->platform_data; 214 inf = dev->platform_data;
86 215
87 clk_enable(usb_clk); 216 clk_enable(ohci->clk);
88 217
89 UHCHR |= UHCHR_FHR; 218 pxa27x_reset_hc(ohci);
90 udelay(11); 219
91 UHCHR &= ~UHCHR_FHR; 220 uhchr = __raw_readl(ohci->mmio_base + UHCHR) | UHCHR_FSBIR;
221 __raw_writel(uhchr, ohci->mmio_base + UHCHR);
92 222
93 UHCHR |= UHCHR_FSBIR; 223 while (__raw_readl(ohci->mmio_base + UHCHR) & UHCHR_FSBIR)
94 while (UHCHR & UHCHR_FSBIR)
95 cpu_relax(); 224 cpu_relax();
96 225
226 pxa27x_setup_hc(ohci, inf);
227
97 if (inf->init) 228 if (inf->init)
98 retval = inf->init(dev); 229 retval = inf->init(dev);
99 230
100 if (retval < 0) 231 if (retval < 0)
101 return retval; 232 return retval;
102 233
103 UHCHR &= ~UHCHR_SSE; 234 uhchr = __raw_readl(ohci->mmio_base + UHCHR) & ~UHCHR_SSE;
104 235 __raw_writel(uhchr, ohci->mmio_base + UHCHR);
105 UHCHIE = (UHCHIE_UPRIE | UHCHIE_RWIE); 236 __raw_writel(UHCHIE_UPRIE | UHCHIE_RWIE, ohci->mmio_base + UHCHIE);
106 237
107 /* Clear any OTG Pin Hold */ 238 /* Clear any OTG Pin Hold */
108 if (cpu_is_pxa27x() && (PSSR & PSSR_OTGPH)) 239 pxa27x_clear_otgph();
109 PSSR |= PSSR_OTGPH;
110
111 return 0; 240 return 0;
112} 241}
113 242
114static void pxa27x_stop_hc(struct device *dev) 243static void pxa27x_stop_hc(struct pxa27x_ohci *ohci, struct device *dev)
115{ 244{
116 struct pxaohci_platform_data *inf; 245 struct pxaohci_platform_data *inf;
246 uint32_t uhccoms;
117 247
118 inf = dev->platform_data; 248 inf = dev->platform_data;
119 249
120 if (inf->exit) 250 if (inf->exit)
121 inf->exit(dev); 251 inf->exit(dev);
122 252
123 UHCHR |= UHCHR_FHR; 253 pxa27x_reset_hc(ohci);
124 udelay(11);
125 UHCHR &= ~UHCHR_FHR;
126 254
127 UHCCOMS |= 1; 255 /* Host Controller Reset */
256 uhccoms = __raw_readl(ohci->mmio_base + UHCCOMS) | 0x01;
257 __raw_writel(uhccoms, ohci->mmio_base + UHCCOMS);
128 udelay(10); 258 udelay(10);
129 259
130 clk_disable(usb_clk); 260 clk_disable(ohci->clk);
131} 261}
132 262
133 263
@@ -148,18 +278,22 @@ static void pxa27x_stop_hc(struct device *dev)
148 */ 278 */
149int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device *pdev) 279int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device *pdev)
150{ 280{
151 int retval; 281 int retval, irq;
152 struct usb_hcd *hcd; 282 struct usb_hcd *hcd;
153 struct pxaohci_platform_data *inf; 283 struct pxaohci_platform_data *inf;
284 struct pxa27x_ohci *ohci;
285 struct resource *r;
286 struct clk *usb_clk;
154 287
155 inf = pdev->dev.platform_data; 288 inf = pdev->dev.platform_data;
156 289
157 if (!inf) 290 if (!inf)
158 return -ENODEV; 291 return -ENODEV;
159 292
160 if (pdev->resource[1].flags != IORESOURCE_IRQ) { 293 irq = platform_get_irq(pdev, 0);
161 pr_debug ("resource[1] is not IORESOURCE_IRQ"); 294 if (irq < 0) {
162 return -ENOMEM; 295 pr_err("no resource of IORESOURCE_IRQ");
296 return -ENXIO;
163 } 297 }
164 298
165 usb_clk = clk_get(&pdev->dev, "USBCLK"); 299 usb_clk = clk_get(&pdev->dev, "USBCLK");
@@ -169,8 +303,16 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device
169 hcd = usb_create_hcd (driver, &pdev->dev, "pxa27x"); 303 hcd = usb_create_hcd (driver, &pdev->dev, "pxa27x");
170 if (!hcd) 304 if (!hcd)
171 return -ENOMEM; 305 return -ENOMEM;
172 hcd->rsrc_start = pdev->resource[0].start; 306
173 hcd->rsrc_len = pdev->resource[0].end - pdev->resource[0].start + 1; 307 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
308 if (!r) {
309 pr_err("no resource of IORESOURCE_MEM");
310 retval = -ENXIO;
311 goto err1;
312 }
313
314 hcd->rsrc_start = r->start;
315 hcd->rsrc_len = resource_size(r);
174 316
175 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { 317 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
176 pr_debug("request_mem_region failed"); 318 pr_debug("request_mem_region failed");
@@ -185,24 +327,30 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device
185 goto err2; 327 goto err2;
186 } 328 }
187 329
188 if ((retval = pxa27x_start_hc(&pdev->dev)) < 0) { 330 /* initialize "struct pxa27x_ohci" */
331 ohci = (struct pxa27x_ohci *)hcd_to_ohci(hcd);
332 ohci->dev = &pdev->dev;
333 ohci->clk = usb_clk;
334 ohci->mmio_base = (void __iomem *)hcd->regs;
335
336 if ((retval = pxa27x_start_hc(ohci, &pdev->dev)) < 0) {
189 pr_debug("pxa27x_start_hc failed"); 337 pr_debug("pxa27x_start_hc failed");
190 goto err3; 338 goto err3;
191 } 339 }
192 340
193 /* Select Power Management Mode */ 341 /* Select Power Management Mode */
194 pxa27x_ohci_select_pmm(inf->port_mode); 342 pxa27x_ohci_select_pmm(ohci, inf->port_mode);
195 343
196 if (inf->power_budget) 344 if (inf->power_budget)
197 hcd->power_budget = inf->power_budget; 345 hcd->power_budget = inf->power_budget;
198 346
199 ohci_hcd_init(hcd_to_ohci(hcd)); 347 ohci_hcd_init(hcd_to_ohci(hcd));
200 348
201 retval = usb_add_hcd(hcd, pdev->resource[1].start, IRQF_DISABLED); 349 retval = usb_add_hcd(hcd, irq, IRQF_DISABLED);
202 if (retval == 0) 350 if (retval == 0)
203 return retval; 351 return retval;
204 352
205 pxa27x_stop_hc(&pdev->dev); 353 pxa27x_stop_hc(ohci, &pdev->dev);
206 err3: 354 err3:
207 iounmap(hcd->regs); 355 iounmap(hcd->regs);
208 err2: 356 err2:
@@ -229,12 +377,14 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device
229 */ 377 */
230void usb_hcd_pxa27x_remove (struct usb_hcd *hcd, struct platform_device *pdev) 378void usb_hcd_pxa27x_remove (struct usb_hcd *hcd, struct platform_device *pdev)
231{ 379{
380 struct pxa27x_ohci *ohci = to_pxa27x_ohci(hcd);
381
232 usb_remove_hcd(hcd); 382 usb_remove_hcd(hcd);
233 pxa27x_stop_hc(&pdev->dev); 383 pxa27x_stop_hc(ohci, &pdev->dev);
234 iounmap(hcd->regs); 384 iounmap(hcd->regs);
235 release_mem_region(hcd->rsrc_start, hcd->rsrc_len); 385 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
236 usb_put_hcd(hcd); 386 usb_put_hcd(hcd);
237 clk_put(usb_clk); 387 clk_put(ohci->clk);
238} 388}
239 389
240/*-------------------------------------------------------------------------*/ 390/*-------------------------------------------------------------------------*/
@@ -267,7 +417,7 @@ ohci_pxa27x_start (struct usb_hcd *hcd)
267static const struct hc_driver ohci_pxa27x_hc_driver = { 417static const struct hc_driver ohci_pxa27x_hc_driver = {
268 .description = hcd_name, 418 .description = hcd_name,
269 .product_desc = "PXA27x OHCI", 419 .product_desc = "PXA27x OHCI",
270 .hcd_priv_size = sizeof(struct ohci_hcd), 420 .hcd_priv_size = sizeof(struct pxa27x_ohci),
271 421
272 /* 422 /*
273 * generic hardware linkage 423 * generic hardware linkage
@@ -299,7 +449,6 @@ static const struct hc_driver ohci_pxa27x_hc_driver = {
299 */ 449 */
300 .hub_status_data = ohci_hub_status_data, 450 .hub_status_data = ohci_hub_status_data,
301 .hub_control = ohci_hub_control, 451 .hub_control = ohci_hub_control,
302 .hub_irq_enable = ohci_rhsc_enable,
303#ifdef CONFIG_PM 452#ifdef CONFIG_PM
304 .bus_suspend = ohci_bus_suspend, 453 .bus_suspend = ohci_bus_suspend,
305 .bus_resume = ohci_bus_resume, 454 .bus_resume = ohci_bus_resume,
@@ -332,13 +481,13 @@ static int ohci_hcd_pxa27x_drv_remove(struct platform_device *pdev)
332static int ohci_hcd_pxa27x_drv_suspend(struct platform_device *pdev, pm_message_t state) 481static int ohci_hcd_pxa27x_drv_suspend(struct platform_device *pdev, pm_message_t state)
333{ 482{
334 struct usb_hcd *hcd = platform_get_drvdata(pdev); 483 struct usb_hcd *hcd = platform_get_drvdata(pdev);
335 struct ohci_hcd *ohci = hcd_to_ohci(hcd); 484 struct pxa27x_ohci *ohci = to_pxa27x_ohci(hcd);
336 485
337 if (time_before(jiffies, ohci->next_statechange)) 486 if (time_before(jiffies, ohci->ohci.next_statechange))
338 msleep(5); 487 msleep(5);
339 ohci->next_statechange = jiffies; 488 ohci->ohci.next_statechange = jiffies;
340 489
341 pxa27x_stop_hc(&pdev->dev); 490 pxa27x_stop_hc(ohci, &pdev->dev);
342 hcd->state = HC_STATE_SUSPENDED; 491 hcd->state = HC_STATE_SUSPENDED;
343 492
344 return 0; 493 return 0;
@@ -347,14 +496,14 @@ static int ohci_hcd_pxa27x_drv_suspend(struct platform_device *pdev, pm_message_
347static int ohci_hcd_pxa27x_drv_resume(struct platform_device *pdev) 496static int ohci_hcd_pxa27x_drv_resume(struct platform_device *pdev)
348{ 497{
349 struct usb_hcd *hcd = platform_get_drvdata(pdev); 498 struct usb_hcd *hcd = platform_get_drvdata(pdev);
350 struct ohci_hcd *ohci = hcd_to_ohci(hcd); 499 struct pxa27x_ohci *ohci = to_pxa27x_ohci(hcd);
351 int status; 500 int status;
352 501
353 if (time_before(jiffies, ohci->next_statechange)) 502 if (time_before(jiffies, ohci->ohci.next_statechange))
354 msleep(5); 503 msleep(5);
355 ohci->next_statechange = jiffies; 504 ohci->ohci.next_statechange = jiffies;
356 505
357 if ((status = pxa27x_start_hc(&pdev->dev)) < 0) 506 if ((status = pxa27x_start_hc(ohci, &pdev->dev)) < 0)
358 return status; 507 return status;
359 508
360 ohci_finish_controller_resume(hcd); 509 ohci_finish_controller_resume(hcd);
diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c
index 6a9b4c557953..c2d80f80448b 100644
--- a/drivers/usb/host/ohci-q.c
+++ b/drivers/usb/host/ohci-q.c
@@ -49,6 +49,9 @@ __acquires(ohci->lock)
49 switch (usb_pipetype (urb->pipe)) { 49 switch (usb_pipetype (urb->pipe)) {
50 case PIPE_ISOCHRONOUS: 50 case PIPE_ISOCHRONOUS:
51 ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs--; 51 ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs--;
52 if (ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs == 0
53 && quirk_amdiso(ohci))
54 quirk_amd_pll(1);
52 break; 55 break;
53 case PIPE_INTERRUPT: 56 case PIPE_INTERRUPT:
54 ohci_to_hcd(ohci)->self.bandwidth_int_reqs--; 57 ohci_to_hcd(ohci)->self.bandwidth_int_reqs--;
@@ -677,6 +680,9 @@ static void td_submit_urb (
677 data + urb->iso_frame_desc [cnt].offset, 680 data + urb->iso_frame_desc [cnt].offset,
678 urb->iso_frame_desc [cnt].length, urb, cnt); 681 urb->iso_frame_desc [cnt].length, urb, cnt);
679 } 682 }
683 if (ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs == 0
684 && quirk_amdiso(ohci))
685 quirk_amd_pll(0);
680 periodic = ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs++ == 0 686 periodic = ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs++ == 0
681 && ohci_to_hcd(ohci)->self.bandwidth_int_reqs == 0; 687 && ohci_to_hcd(ohci)->self.bandwidth_int_reqs == 0;
682 break; 688 break;
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c
index 3c7a740cfe0c..f46af7a718d4 100644
--- a/drivers/usb/host/ohci-s3c2410.c
+++ b/drivers/usb/host/ohci-s3c2410.c
@@ -22,8 +22,8 @@
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/clk.h> 23#include <linux/clk.h>
24 24
25#include <asm/hardware.h> 25#include <mach/hardware.h>
26#include <asm/arch/usb-control.h> 26#include <mach/usb-control.h>
27 27
28#define valid_port(idx) ((idx) == 1 || (idx) == 2) 28#define valid_port(idx) ((idx) == 1 || (idx) == 2)
29 29
@@ -466,7 +466,6 @@ static const struct hc_driver ohci_s3c2410_hc_driver = {
466 */ 466 */
467 .hub_status_data = ohci_s3c2410_hub_status_data, 467 .hub_status_data = ohci_s3c2410_hub_status_data,
468 .hub_control = ohci_s3c2410_hub_control, 468 .hub_control = ohci_s3c2410_hub_control,
469 .hub_irq_enable = ohci_rhsc_enable,
470#ifdef CONFIG_PM 469#ifdef CONFIG_PM
471 .bus_suspend = ohci_bus_suspend, 470 .bus_suspend = ohci_bus_suspend,
472 .bus_resume = ohci_bus_resume, 471 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-sa1111.c b/drivers/usb/host/ohci-sa1111.c
index 2e9dceb9bb99..e4bbe8e188e4 100644
--- a/drivers/usb/host/ohci-sa1111.c
+++ b/drivers/usb/host/ohci-sa1111.c
@@ -13,10 +13,10 @@
13 * This file is licenced under the GPL. 13 * This file is licenced under the GPL.
14 */ 14 */
15 15
16#include <asm/hardware.h> 16#include <mach/hardware.h>
17#include <asm/mach-types.h> 17#include <asm/mach-types.h>
18#include <asm/arch/assabet.h> 18#include <mach/assabet.h>
19#include <asm/arch/badge4.h> 19#include <mach/badge4.h>
20#include <asm/hardware/sa1111.h> 20#include <asm/hardware/sa1111.h>
21 21
22#ifndef CONFIG_SA1111 22#ifndef CONFIG_SA1111
@@ -231,7 +231,6 @@ static const struct hc_driver ohci_sa1111_hc_driver = {
231 */ 231 */
232 .hub_status_data = ohci_hub_status_data, 232 .hub_status_data = ohci_hub_status_data,
233 .hub_control = ohci_hub_control, 233 .hub_control = ohci_hub_control,
234 .hub_irq_enable = ohci_rhsc_enable,
235#ifdef CONFIG_PM 234#ifdef CONFIG_PM
236 .bus_suspend = ohci_bus_suspend, 235 .bus_suspend = ohci_bus_suspend,
237 .bus_resume = ohci_bus_resume, 236 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-sh.c b/drivers/usb/host/ohci-sh.c
index e7ee607278fe..60f03cc7ec4f 100644
--- a/drivers/usb/host/ohci-sh.c
+++ b/drivers/usb/host/ohci-sh.c
@@ -68,7 +68,6 @@ static const struct hc_driver ohci_sh_hc_driver = {
68 */ 68 */
69 .hub_status_data = ohci_hub_status_data, 69 .hub_status_data = ohci_hub_status_data,
70 .hub_control = ohci_hub_control, 70 .hub_control = ohci_hub_control,
71 .hub_irq_enable = ohci_rhsc_enable,
72#ifdef CONFIG_PM 71#ifdef CONFIG_PM
73 .bus_suspend = ohci_bus_suspend, 72 .bus_suspend = ohci_bus_suspend,
74 .bus_resume = ohci_bus_resume, 73 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c
index 21b164e4abeb..cff23637cfcc 100644
--- a/drivers/usb/host/ohci-sm501.c
+++ b/drivers/usb/host/ohci-sm501.c
@@ -75,7 +75,6 @@ static const struct hc_driver ohci_sm501_hc_driver = {
75 */ 75 */
76 .hub_status_data = ohci_hub_status_data, 76 .hub_status_data = ohci_hub_status_data,
77 .hub_control = ohci_hub_control, 77 .hub_control = ohci_hub_control,
78 .hub_irq_enable = ohci_rhsc_enable,
79#ifdef CONFIG_PM 78#ifdef CONFIG_PM
80 .bus_suspend = ohci_bus_suspend, 79 .bus_suspend = ohci_bus_suspend,
81 .bus_resume = ohci_bus_resume, 80 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-ssb.c b/drivers/usb/host/ohci-ssb.c
index 3660c83d80af..23fd6a886bdd 100644
--- a/drivers/usb/host/ohci-ssb.c
+++ b/drivers/usb/host/ohci-ssb.c
@@ -81,7 +81,6 @@ static const struct hc_driver ssb_ohci_hc_driver = {
81 81
82 .hub_status_data = ohci_hub_status_data, 82 .hub_status_data = ohci_hub_status_data,
83 .hub_control = ohci_hub_control, 83 .hub_control = ohci_hub_control,
84 .hub_irq_enable = ohci_rhsc_enable,
85#ifdef CONFIG_PM 84#ifdef CONFIG_PM
86 .bus_suspend = ohci_bus_suspend, 85 .bus_suspend = ohci_bus_suspend,
87 .bus_resume = ohci_bus_resume, 86 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h
index dc544ddc7849..faf622eafce7 100644
--- a/drivers/usb/host/ohci.h
+++ b/drivers/usb/host/ohci.h
@@ -371,6 +371,7 @@ struct ohci_hcd {
371 * other external transceivers should be software-transparent 371 * other external transceivers should be software-transparent
372 */ 372 */
373 struct otg_transceiver *transceiver; 373 struct otg_transceiver *transceiver;
374 void (*start_hnp)(struct ohci_hcd *ohci);
374 375
375 /* 376 /*
376 * memory management for queue data structures 377 * memory management for queue data structures
@@ -399,6 +400,8 @@ struct ohci_hcd {
399#define OHCI_QUIRK_ZFMICRO 0x20 /* Compaq ZFMicro chipset*/ 400#define OHCI_QUIRK_ZFMICRO 0x20 /* Compaq ZFMicro chipset*/
400#define OHCI_QUIRK_NEC 0x40 /* lost interrupts */ 401#define OHCI_QUIRK_NEC 0x40 /* lost interrupts */
401#define OHCI_QUIRK_FRAME_NO 0x80 /* no big endian frame_no shift */ 402#define OHCI_QUIRK_FRAME_NO 0x80 /* no big endian frame_no shift */
403#define OHCI_QUIRK_HUB_POWER 0x100 /* distrust firmware power/oc setup */
404#define OHCI_QUIRK_AMD_ISO 0x200 /* ISO transfers*/
402 // there are also chip quirks/bugs in init logic 405 // there are also chip quirks/bugs in init logic
403 406
404 struct work_struct nec_work; /* Worker for NEC quirk */ 407 struct work_struct nec_work; /* Worker for NEC quirk */
@@ -426,6 +429,10 @@ static inline int quirk_zfmicro(struct ohci_hcd *ohci)
426{ 429{
427 return ohci->flags & OHCI_QUIRK_ZFMICRO; 430 return ohci->flags & OHCI_QUIRK_ZFMICRO;
428} 431}
432static inline int quirk_amdiso(struct ohci_hcd *ohci)
433{
434 return ohci->flags & OHCI_QUIRK_AMD_ISO;
435}
429#else 436#else
430static inline int quirk_nec(struct ohci_hcd *ohci) 437static inline int quirk_nec(struct ohci_hcd *ohci)
431{ 438{
@@ -435,6 +442,10 @@ static inline int quirk_zfmicro(struct ohci_hcd *ohci)
435{ 442{
436 return 0; 443 return 0;
437} 444}
445static inline int quirk_amdiso(struct ohci_hcd *ohci)
446{
447 return 0;
448}
438#endif 449#endif
439 450
440/* convert between an hcd pointer and the corresponding ohci_hcd */ 451/* convert between an hcd pointer and the corresponding ohci_hcd */
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index d5f02dddb120..ea7126f99cab 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -964,11 +964,34 @@ static void pipe_irq_disable(struct r8a66597 *r8a66597, u16 pipenum)
964 disable_irq_nrdy(r8a66597, pipenum); 964 disable_irq_nrdy(r8a66597, pipenum);
965} 965}
966 966
967static void r8a66597_root_hub_start_polling(struct r8a66597 *r8a66597)
968{
969 mod_timer(&r8a66597->rh_timer,
970 jiffies + msecs_to_jiffies(R8A66597_RH_POLL_TIME));
971}
972
973static void start_root_hub_sampling(struct r8a66597 *r8a66597, int port,
974 int connect)
975{
976 struct r8a66597_root_hub *rh = &r8a66597->root_hub[port];
977
978 rh->old_syssts = r8a66597_read(r8a66597, get_syssts_reg(port)) & LNST;
979 rh->scount = R8A66597_MAX_SAMPLING;
980 if (connect)
981 rh->port |= 1 << USB_PORT_FEAT_CONNECTION;
982 else
983 rh->port &= ~(1 << USB_PORT_FEAT_CONNECTION);
984 rh->port |= 1 << USB_PORT_FEAT_C_CONNECTION;
985
986 r8a66597_root_hub_start_polling(r8a66597);
987}
988
967/* this function must be called with interrupt disabled */ 989/* this function must be called with interrupt disabled */
968static void r8a66597_check_syssts(struct r8a66597 *r8a66597, int port, 990static void r8a66597_check_syssts(struct r8a66597 *r8a66597, int port,
969 u16 syssts) 991 u16 syssts)
970{ 992{
971 if (syssts == SE0) { 993 if (syssts == SE0) {
994 r8a66597_write(r8a66597, ~ATTCH, get_intsts_reg(port));
972 r8a66597_bset(r8a66597, ATTCHE, get_intenb_reg(port)); 995 r8a66597_bset(r8a66597, ATTCHE, get_intenb_reg(port));
973 return; 996 return;
974 } 997 }
@@ -1002,13 +1025,10 @@ static void r8a66597_usb_disconnect(struct r8a66597 *r8a66597, int port)
1002{ 1025{
1003 struct r8a66597_device *dev = r8a66597->root_hub[port].dev; 1026 struct r8a66597_device *dev = r8a66597->root_hub[port].dev;
1004 1027
1005 r8a66597->root_hub[port].port &= ~(1 << USB_PORT_FEAT_CONNECTION);
1006 r8a66597->root_hub[port].port |= (1 << USB_PORT_FEAT_C_CONNECTION);
1007
1008 disable_r8a66597_pipe_all(r8a66597, dev); 1028 disable_r8a66597_pipe_all(r8a66597, dev);
1009 free_usb_address(r8a66597, dev); 1029 free_usb_address(r8a66597, dev);
1010 1030
1011 r8a66597_bset(r8a66597, ATTCHE, get_intenb_reg(port)); 1031 start_root_hub_sampling(r8a66597, port, 0);
1012} 1032}
1013 1033
1014/* this function must be called with interrupt disabled */ 1034/* this function must be called with interrupt disabled */
@@ -1551,23 +1571,6 @@ static void irq_pipe_nrdy(struct r8a66597 *r8a66597)
1551 } 1571 }
1552} 1572}
1553 1573
1554static void r8a66597_root_hub_start_polling(struct r8a66597 *r8a66597)
1555{
1556 mod_timer(&r8a66597->rh_timer,
1557 jiffies + msecs_to_jiffies(R8A66597_RH_POLL_TIME));
1558}
1559
1560static void start_root_hub_sampling(struct r8a66597 *r8a66597, int port)
1561{
1562 struct r8a66597_root_hub *rh = &r8a66597->root_hub[port];
1563
1564 rh->old_syssts = r8a66597_read(r8a66597, get_syssts_reg(port)) & LNST;
1565 rh->scount = R8A66597_MAX_SAMPLING;
1566 r8a66597->root_hub[port].port |= (1 << USB_PORT_FEAT_CONNECTION)
1567 | (1 << USB_PORT_FEAT_C_CONNECTION);
1568 r8a66597_root_hub_start_polling(r8a66597);
1569}
1570
1571static irqreturn_t r8a66597_irq(struct usb_hcd *hcd) 1574static irqreturn_t r8a66597_irq(struct usb_hcd *hcd)
1572{ 1575{
1573 struct r8a66597 *r8a66597 = hcd_to_r8a66597(hcd); 1576 struct r8a66597 *r8a66597 = hcd_to_r8a66597(hcd);
@@ -1594,7 +1597,7 @@ static irqreturn_t r8a66597_irq(struct usb_hcd *hcd)
1594 r8a66597_bclr(r8a66597, ATTCHE, INTENB2); 1597 r8a66597_bclr(r8a66597, ATTCHE, INTENB2);
1595 1598
1596 /* start usb bus sampling */ 1599 /* start usb bus sampling */
1597 start_root_hub_sampling(r8a66597, 1); 1600 start_root_hub_sampling(r8a66597, 1, 1);
1598 } 1601 }
1599 if (mask2 & DTCH) { 1602 if (mask2 & DTCH) {
1600 r8a66597_write(r8a66597, ~DTCH, INTSTS2); 1603 r8a66597_write(r8a66597, ~DTCH, INTSTS2);
@@ -1609,7 +1612,7 @@ static irqreturn_t r8a66597_irq(struct usb_hcd *hcd)
1609 r8a66597_bclr(r8a66597, ATTCHE, INTENB1); 1612 r8a66597_bclr(r8a66597, ATTCHE, INTENB1);
1610 1613
1611 /* start usb bus sampling */ 1614 /* start usb bus sampling */
1612 start_root_hub_sampling(r8a66597, 0); 1615 start_root_hub_sampling(r8a66597, 0, 1);
1613 } 1616 }
1614 if (mask1 & DTCH) { 1617 if (mask1 & DTCH) {
1615 r8a66597_write(r8a66597, ~DTCH, INTSTS1); 1618 r8a66597_write(r8a66597, ~DTCH, INTSTS1);
diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c
index 20ad3c48fcb2..228f2b070f2b 100644
--- a/drivers/usb/host/u132-hcd.c
+++ b/drivers/usb/host/u132-hcd.c
@@ -2934,16 +2934,6 @@ static int u132_start_port_reset(struct usb_hcd *hcd, unsigned port_num)
2934 return 0; 2934 return 0;
2935} 2935}
2936 2936
2937static void u132_hub_irq_enable(struct usb_hcd *hcd)
2938{
2939 struct u132 *u132 = hcd_to_u132(hcd);
2940 if (u132->going > 1) {
2941 dev_err(&u132->platform_dev->dev, "device has been removed %d\n"
2942 , u132->going);
2943 } else if (u132->going > 0)
2944 dev_err(&u132->platform_dev->dev, "device is being removed\n");
2945}
2946
2947 2937
2948#ifdef CONFIG_PM 2938#ifdef CONFIG_PM
2949static int u132_bus_suspend(struct usb_hcd *hcd) 2939static int u132_bus_suspend(struct usb_hcd *hcd)
@@ -2995,7 +2985,6 @@ static struct hc_driver u132_hc_driver = {
2995 .bus_suspend = u132_bus_suspend, 2985 .bus_suspend = u132_bus_suspend,
2996 .bus_resume = u132_bus_resume, 2986 .bus_resume = u132_bus_resume,
2997 .start_port_reset = u132_start_port_reset, 2987 .start_port_reset = u132_start_port_reset,
2998 .hub_irq_enable = u132_hub_irq_enable,
2999}; 2988};
3000 2989
3001/* 2990/*