diff options
author | David S. Miller <davem@davemloft.net> | 2010-01-23 01:45:46 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-01-23 01:45:46 -0500 |
commit | 6be325719b3e54624397e413efd4b33a997e55a3 (patch) | |
tree | 57f321a56794cab2222e179b16731e0d76a4a68a /drivers/usb/host | |
parent | 26d92f9276a56d55511a427fb70bd70886af647a (diff) | |
parent | 92dcffb916d309aa01778bf8963a6932e4014d07 (diff) |
Merge branch 'master' of /home/davem/src/GIT/linux-2.6/
Diffstat (limited to 'drivers/usb/host')
-rw-r--r-- | drivers/usb/host/ehci-au1xxx.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/ehci-hcd.c | 5 | ||||
-rw-r--r-- | drivers/usb/host/ehci-hub.c | 20 | ||||
-rw-r--r-- | drivers/usb/host/ehci-omap.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/ehci-q.c | 11 | ||||
-rw-r--r-- | drivers/usb/host/fhci-hcd.c | 3 | ||||
-rw-r--r-- | drivers/usb/host/fhci-sched.c | 10 | ||||
-rw-r--r-- | drivers/usb/host/fhci-tds.c | 35 | ||||
-rw-r--r-- | drivers/usb/host/fhci.h | 16 | ||||
-rw-r--r-- | drivers/usb/host/isp1362-hcd.c | 51 | ||||
-rw-r--r-- | drivers/usb/host/isp1760-hcd.c | 6 | ||||
-rw-r--r-- | drivers/usb/host/ohci-au1xxx.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/ohci-pxa27x.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/r8a66597-hcd.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/uhci-hcd.c | 15 | ||||
-rw-r--r-- | drivers/usb/host/uhci-hub.c | 2 |
16 files changed, 107 insertions, 77 deletions
diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c index ed77be76d6bb..dbfb482a94e3 100644 --- a/drivers/usb/host/ehci-au1xxx.c +++ b/drivers/usb/host/ehci-au1xxx.c | |||
@@ -297,7 +297,7 @@ static int ehci_hcd_au1xxx_drv_resume(struct device *dev) | |||
297 | return 0; | 297 | return 0; |
298 | } | 298 | } |
299 | 299 | ||
300 | static struct dev_pm_ops au1xxx_ehci_pmops = { | 300 | static const struct dev_pm_ops au1xxx_ehci_pmops = { |
301 | .suspend = ehci_hcd_au1xxx_drv_suspend, | 301 | .suspend = ehci_hcd_au1xxx_drv_suspend, |
302 | .resume = ehci_hcd_au1xxx_drv_resume, | 302 | .resume = ehci_hcd_au1xxx_drv_resume, |
303 | }; | 303 | }; |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 5859522d6edd..1ec3857f22e6 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -787,9 +787,10 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
787 | 787 | ||
788 | /* start 20 msec resume signaling from this port, | 788 | /* start 20 msec resume signaling from this port, |
789 | * and make khubd collect PORT_STAT_C_SUSPEND to | 789 | * and make khubd collect PORT_STAT_C_SUSPEND to |
790 | * stop that signaling. | 790 | * stop that signaling. Use 5 ms extra for safety, |
791 | * like usb_port_resume() does. | ||
791 | */ | 792 | */ |
792 | ehci->reset_done [i] = jiffies + msecs_to_jiffies (20); | 793 | ehci->reset_done[i] = jiffies + msecs_to_jiffies(25); |
793 | ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); | 794 | ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); |
794 | mod_timer(&hcd->rh_timer, ehci->reset_done[i]); | 795 | mod_timer(&hcd->rh_timer, ehci->reset_done[i]); |
795 | } | 796 | } |
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 2c6571c05f35..c75d9270c752 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
@@ -120,9 +120,26 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) | |||
120 | del_timer_sync(&ehci->watchdog); | 120 | del_timer_sync(&ehci->watchdog); |
121 | del_timer_sync(&ehci->iaa_watchdog); | 121 | del_timer_sync(&ehci->iaa_watchdog); |
122 | 122 | ||
123 | port = HCS_N_PORTS (ehci->hcs_params); | ||
124 | spin_lock_irq (&ehci->lock); | 123 | spin_lock_irq (&ehci->lock); |
125 | 124 | ||
125 | /* Once the controller is stopped, port resumes that are already | ||
126 | * in progress won't complete. Hence if remote wakeup is enabled | ||
127 | * for the root hub and any ports are in the middle of a resume or | ||
128 | * remote wakeup, we must fail the suspend. | ||
129 | */ | ||
130 | if (hcd->self.root_hub->do_remote_wakeup) { | ||
131 | port = HCS_N_PORTS(ehci->hcs_params); | ||
132 | while (port--) { | ||
133 | if (ehci->reset_done[port] != 0) { | ||
134 | spin_unlock_irq(&ehci->lock); | ||
135 | ehci_dbg(ehci, "suspend failed because " | ||
136 | "port %d is resuming\n", | ||
137 | port + 1); | ||
138 | return -EBUSY; | ||
139 | } | ||
140 | } | ||
141 | } | ||
142 | |||
126 | /* stop schedules, clean any completed work */ | 143 | /* stop schedules, clean any completed work */ |
127 | if (HC_IS_RUNNING(hcd->state)) { | 144 | if (HC_IS_RUNNING(hcd->state)) { |
128 | ehci_quiesce (ehci); | 145 | ehci_quiesce (ehci); |
@@ -138,6 +155,7 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) | |||
138 | */ | 155 | */ |
139 | ehci->bus_suspended = 0; | 156 | ehci->bus_suspended = 0; |
140 | ehci->owned_ports = 0; | 157 | ehci->owned_ports = 0; |
158 | port = HCS_N_PORTS(ehci->hcs_params); | ||
141 | while (port--) { | 159 | while (port--) { |
142 | u32 __iomem *reg = &ehci->regs->port_status [port]; | 160 | u32 __iomem *reg = &ehci->regs->port_status [port]; |
143 | u32 t1 = ehci_readl(ehci, reg) & ~PORT_RWC_BITS; | 161 | u32 t1 = ehci_readl(ehci, reg) & ~PORT_RWC_BITS; |
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c index 12f1ad2fd0e8..74d07f4e8b7d 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #include <linux/platform_device.h> | 37 | #include <linux/platform_device.h> |
38 | #include <linux/clk.h> | 38 | #include <linux/clk.h> |
39 | #include <linux/gpio.h> | 39 | #include <linux/gpio.h> |
40 | #include <mach/usb.h> | 40 | #include <plat/usb.h> |
41 | 41 | ||
42 | /* | 42 | /* |
43 | * OMAP USBHOST Register addresses: VIRTUAL ADDRESSES | 43 | * OMAP USBHOST Register addresses: VIRTUAL ADDRESSES |
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index a427d3b00634..89521775c567 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c | |||
@@ -849,9 +849,10 @@ qh_make ( | |||
849 | * But interval 1 scheduling is simpler, and | 849 | * But interval 1 scheduling is simpler, and |
850 | * includes high bandwidth. | 850 | * includes high bandwidth. |
851 | */ | 851 | */ |
852 | dbg ("intr period %d uframes, NYET!", | 852 | urb->interval = 1; |
853 | urb->interval); | 853 | } else if (qh->period > ehci->periodic_size) { |
854 | goto done; | 854 | qh->period = ehci->periodic_size; |
855 | urb->interval = qh->period << 3; | ||
855 | } | 856 | } |
856 | } else { | 857 | } else { |
857 | int think_time; | 858 | int think_time; |
@@ -874,6 +875,10 @@ qh_make ( | |||
874 | usb_calc_bus_time (urb->dev->speed, | 875 | usb_calc_bus_time (urb->dev->speed, |
875 | is_input, 0, max_packet (maxp))); | 876 | is_input, 0, max_packet (maxp))); |
876 | qh->period = urb->interval; | 877 | qh->period = urb->interval; |
878 | if (qh->period > ehci->periodic_size) { | ||
879 | qh->period = ehci->periodic_size; | ||
880 | urb->interval = qh->period; | ||
881 | } | ||
877 | } | 882 | } |
878 | } | 883 | } |
879 | 884 | ||
diff --git a/drivers/usb/host/fhci-hcd.c b/drivers/usb/host/fhci-hcd.c index 0951818ef93b..78e7c3cfcb72 100644 --- a/drivers/usb/host/fhci-hcd.c +++ b/drivers/usb/host/fhci-hcd.c | |||
@@ -242,9 +242,10 @@ err: | |||
242 | static void fhci_usb_free(void *lld) | 242 | static void fhci_usb_free(void *lld) |
243 | { | 243 | { |
244 | struct fhci_usb *usb = lld; | 244 | struct fhci_usb *usb = lld; |
245 | struct fhci_hcd *fhci = usb->fhci; | 245 | struct fhci_hcd *fhci; |
246 | 246 | ||
247 | if (usb) { | 247 | if (usb) { |
248 | fhci = usb->fhci; | ||
248 | fhci_config_transceiver(fhci, FHCI_PORT_POWER_OFF); | 249 | fhci_config_transceiver(fhci, FHCI_PORT_POWER_OFF); |
249 | fhci_ep0_free(usb); | 250 | fhci_ep0_free(usb); |
250 | kfree(usb->actual_frame); | 251 | kfree(usb->actual_frame); |
diff --git a/drivers/usb/host/fhci-sched.c b/drivers/usb/host/fhci-sched.c index 00a29855d0c4..ff43747a614f 100644 --- a/drivers/usb/host/fhci-sched.c +++ b/drivers/usb/host/fhci-sched.c | |||
@@ -37,7 +37,7 @@ static void recycle_frame(struct fhci_usb *usb, struct packet *pkt) | |||
37 | pkt->info = 0; | 37 | pkt->info = 0; |
38 | pkt->priv_data = NULL; | 38 | pkt->priv_data = NULL; |
39 | 39 | ||
40 | cq_put(usb->ep0->empty_frame_Q, pkt); | 40 | cq_put(&usb->ep0->empty_frame_Q, pkt); |
41 | } | 41 | } |
42 | 42 | ||
43 | /* confirm submitted packet */ | 43 | /* confirm submitted packet */ |
@@ -57,7 +57,7 @@ void fhci_transaction_confirm(struct fhci_usb *usb, struct packet *pkt) | |||
57 | if ((td->data + td->actual_len) && trans_len) | 57 | if ((td->data + td->actual_len) && trans_len) |
58 | memcpy(td->data + td->actual_len, pkt->data, | 58 | memcpy(td->data + td->actual_len, pkt->data, |
59 | trans_len); | 59 | trans_len); |
60 | cq_put(usb->ep0->dummy_packets_Q, pkt->data); | 60 | cq_put(&usb->ep0->dummy_packets_Q, pkt->data); |
61 | } | 61 | } |
62 | 62 | ||
63 | recycle_frame(usb, pkt); | 63 | recycle_frame(usb, pkt); |
@@ -213,7 +213,7 @@ static int add_packet(struct fhci_usb *usb, struct ed *ed, struct td *td) | |||
213 | } | 213 | } |
214 | 214 | ||
215 | /* update frame object fields before transmitting */ | 215 | /* update frame object fields before transmitting */ |
216 | pkt = cq_get(usb->ep0->empty_frame_Q); | 216 | pkt = cq_get(&usb->ep0->empty_frame_Q); |
217 | if (!pkt) { | 217 | if (!pkt) { |
218 | fhci_dbg(usb->fhci, "there is no empty frame\n"); | 218 | fhci_dbg(usb->fhci, "there is no empty frame\n"); |
219 | return -1; | 219 | return -1; |
@@ -222,7 +222,7 @@ static int add_packet(struct fhci_usb *usb, struct ed *ed, struct td *td) | |||
222 | 222 | ||
223 | pkt->info = 0; | 223 | pkt->info = 0; |
224 | if (data == NULL) { | 224 | if (data == NULL) { |
225 | data = cq_get(usb->ep0->dummy_packets_Q); | 225 | data = cq_get(&usb->ep0->dummy_packets_Q); |
226 | BUG_ON(!data); | 226 | BUG_ON(!data); |
227 | pkt->info = PKT_DUMMY_PACKET; | 227 | pkt->info = PKT_DUMMY_PACKET; |
228 | } | 228 | } |
@@ -246,7 +246,7 @@ static int add_packet(struct fhci_usb *usb, struct ed *ed, struct td *td) | |||
246 | list_del_init(&td->frame_lh); | 246 | list_del_init(&td->frame_lh); |
247 | td->status = USB_TD_OK; | 247 | td->status = USB_TD_OK; |
248 | if (pkt->info & PKT_DUMMY_PACKET) | 248 | if (pkt->info & PKT_DUMMY_PACKET) |
249 | cq_put(usb->ep0->dummy_packets_Q, pkt->data); | 249 | cq_put(&usb->ep0->dummy_packets_Q, pkt->data); |
250 | recycle_frame(usb, pkt); | 250 | recycle_frame(usb, pkt); |
251 | usb->actual_frame->total_bytes -= (len + PROTOCOL_OVERHEAD); | 251 | usb->actual_frame->total_bytes -= (len + PROTOCOL_OVERHEAD); |
252 | fhci_err(usb->fhci, "host transaction failed\n"); | 252 | fhci_err(usb->fhci, "host transaction failed\n"); |
diff --git a/drivers/usb/host/fhci-tds.c b/drivers/usb/host/fhci-tds.c index b40332290319..d224ab467a40 100644 --- a/drivers/usb/host/fhci-tds.c +++ b/drivers/usb/host/fhci-tds.c | |||
@@ -106,33 +106,33 @@ void fhci_ep0_free(struct fhci_usb *usb) | |||
106 | cpm_muram_free(cpm_muram_offset(ep->td_base)); | 106 | cpm_muram_free(cpm_muram_offset(ep->td_base)); |
107 | 107 | ||
108 | if (ep->conf_frame_Q) { | 108 | if (ep->conf_frame_Q) { |
109 | size = cq_howmany(ep->conf_frame_Q); | 109 | size = cq_howmany(&ep->conf_frame_Q); |
110 | for (; size; size--) { | 110 | for (; size; size--) { |
111 | struct packet *pkt = cq_get(ep->conf_frame_Q); | 111 | struct packet *pkt = cq_get(&ep->conf_frame_Q); |
112 | 112 | ||
113 | kfree(pkt); | 113 | kfree(pkt); |
114 | } | 114 | } |
115 | cq_delete(ep->conf_frame_Q); | 115 | cq_delete(&ep->conf_frame_Q); |
116 | } | 116 | } |
117 | 117 | ||
118 | if (ep->empty_frame_Q) { | 118 | if (ep->empty_frame_Q) { |
119 | size = cq_howmany(ep->empty_frame_Q); | 119 | size = cq_howmany(&ep->empty_frame_Q); |
120 | for (; size; size--) { | 120 | for (; size; size--) { |
121 | struct packet *pkt = cq_get(ep->empty_frame_Q); | 121 | struct packet *pkt = cq_get(&ep->empty_frame_Q); |
122 | 122 | ||
123 | kfree(pkt); | 123 | kfree(pkt); |
124 | } | 124 | } |
125 | cq_delete(ep->empty_frame_Q); | 125 | cq_delete(&ep->empty_frame_Q); |
126 | } | 126 | } |
127 | 127 | ||
128 | if (ep->dummy_packets_Q) { | 128 | if (ep->dummy_packets_Q) { |
129 | size = cq_howmany(ep->dummy_packets_Q); | 129 | size = cq_howmany(&ep->dummy_packets_Q); |
130 | for (; size; size--) { | 130 | for (; size; size--) { |
131 | u8 *buff = cq_get(ep->dummy_packets_Q); | 131 | u8 *buff = cq_get(&ep->dummy_packets_Q); |
132 | 132 | ||
133 | kfree(buff); | 133 | kfree(buff); |
134 | } | 134 | } |
135 | cq_delete(ep->dummy_packets_Q); | 135 | cq_delete(&ep->dummy_packets_Q); |
136 | } | 136 | } |
137 | 137 | ||
138 | kfree(ep); | 138 | kfree(ep); |
@@ -175,10 +175,9 @@ u32 fhci_create_ep(struct fhci_usb *usb, enum fhci_mem_alloc data_mem, | |||
175 | ep->td_base = cpm_muram_addr(ep_offset); | 175 | ep->td_base = cpm_muram_addr(ep_offset); |
176 | 176 | ||
177 | /* zero all queue pointers */ | 177 | /* zero all queue pointers */ |
178 | ep->conf_frame_Q = cq_new(ring_len + 2); | 178 | if (cq_new(&ep->conf_frame_Q, ring_len + 2) || |
179 | ep->empty_frame_Q = cq_new(ring_len + 2); | 179 | cq_new(&ep->empty_frame_Q, ring_len + 2) || |
180 | ep->dummy_packets_Q = cq_new(ring_len + 2); | 180 | cq_new(&ep->dummy_packets_Q, ring_len + 2)) { |
181 | if (!ep->conf_frame_Q || !ep->empty_frame_Q || !ep->dummy_packets_Q) { | ||
182 | err_for = "frame_queues"; | 181 | err_for = "frame_queues"; |
183 | goto err; | 182 | goto err; |
184 | } | 183 | } |
@@ -199,8 +198,8 @@ u32 fhci_create_ep(struct fhci_usb *usb, enum fhci_mem_alloc data_mem, | |||
199 | err_for = "buffer"; | 198 | err_for = "buffer"; |
200 | goto err; | 199 | goto err; |
201 | } | 200 | } |
202 | cq_put(ep->empty_frame_Q, pkt); | 201 | cq_put(&ep->empty_frame_Q, pkt); |
203 | cq_put(ep->dummy_packets_Q, buff); | 202 | cq_put(&ep->dummy_packets_Q, buff); |
204 | } | 203 | } |
205 | 204 | ||
206 | /* we put the endpoint parameter RAM right behind the TD ring */ | 205 | /* we put the endpoint parameter RAM right behind the TD ring */ |
@@ -319,7 +318,7 @@ static void fhci_td_transaction_confirm(struct fhci_usb *usb) | |||
319 | if ((buf == DUMMY2_BD_BUFFER) && !(td_status & ~TD_W)) | 318 | if ((buf == DUMMY2_BD_BUFFER) && !(td_status & ~TD_W)) |
320 | continue; | 319 | continue; |
321 | 320 | ||
322 | pkt = cq_get(ep->conf_frame_Q); | 321 | pkt = cq_get(&ep->conf_frame_Q); |
323 | if (!pkt) | 322 | if (!pkt) |
324 | fhci_err(usb->fhci, "no frame to confirm\n"); | 323 | fhci_err(usb->fhci, "no frame to confirm\n"); |
325 | 324 | ||
@@ -460,9 +459,9 @@ u32 fhci_host_transaction(struct fhci_usb *usb, | |||
460 | out_be16(&td->length, pkt->len); | 459 | out_be16(&td->length, pkt->len); |
461 | 460 | ||
462 | /* put the frame to the confirmation queue */ | 461 | /* put the frame to the confirmation queue */ |
463 | cq_put(ep->conf_frame_Q, pkt); | 462 | cq_put(&ep->conf_frame_Q, pkt); |
464 | 463 | ||
465 | if (cq_howmany(ep->conf_frame_Q) == 1) | 464 | if (cq_howmany(&ep->conf_frame_Q) == 1) |
466 | out_8(&usb->fhci->regs->usb_comm, USB_CMD_STR_FIFO); | 465 | out_8(&usb->fhci->regs->usb_comm, USB_CMD_STR_FIFO); |
467 | 466 | ||
468 | return 0; | 467 | return 0; |
diff --git a/drivers/usb/host/fhci.h b/drivers/usb/host/fhci.h index 7116284ed21a..72dae1c5ab38 100644 --- a/drivers/usb/host/fhci.h +++ b/drivers/usb/host/fhci.h | |||
@@ -423,9 +423,9 @@ struct endpoint { | |||
423 | struct usb_td __iomem *td_base; /* first TD in the ring */ | 423 | struct usb_td __iomem *td_base; /* first TD in the ring */ |
424 | struct usb_td __iomem *conf_td; /* next TD for confirm after transac */ | 424 | struct usb_td __iomem *conf_td; /* next TD for confirm after transac */ |
425 | struct usb_td __iomem *empty_td;/* next TD for new transaction req. */ | 425 | struct usb_td __iomem *empty_td;/* next TD for new transaction req. */ |
426 | struct kfifo *empty_frame_Q; /* Empty frames list to use */ | 426 | struct kfifo empty_frame_Q; /* Empty frames list to use */ |
427 | struct kfifo *conf_frame_Q; /* frames passed to TDs,waiting for tx */ | 427 | struct kfifo conf_frame_Q; /* frames passed to TDs,waiting for tx */ |
428 | struct kfifo *dummy_packets_Q;/* dummy packets for the CRC overun */ | 428 | struct kfifo dummy_packets_Q;/* dummy packets for the CRC overun */ |
429 | 429 | ||
430 | bool already_pushed_dummy_bd; | 430 | bool already_pushed_dummy_bd; |
431 | }; | 431 | }; |
@@ -493,9 +493,9 @@ static inline struct usb_hcd *fhci_to_hcd(struct fhci_hcd *fhci) | |||
493 | } | 493 | } |
494 | 494 | ||
495 | /* fifo of pointers */ | 495 | /* fifo of pointers */ |
496 | static inline struct kfifo *cq_new(int size) | 496 | static inline int cq_new(struct kfifo *fifo, int size) |
497 | { | 497 | { |
498 | return kfifo_alloc(size * sizeof(void *), GFP_KERNEL, NULL); | 498 | return kfifo_alloc(fifo, size * sizeof(void *), GFP_KERNEL); |
499 | } | 499 | } |
500 | 500 | ||
501 | static inline void cq_delete(struct kfifo *kfifo) | 501 | static inline void cq_delete(struct kfifo *kfifo) |
@@ -505,19 +505,19 @@ static inline void cq_delete(struct kfifo *kfifo) | |||
505 | 505 | ||
506 | static inline unsigned int cq_howmany(struct kfifo *kfifo) | 506 | static inline unsigned int cq_howmany(struct kfifo *kfifo) |
507 | { | 507 | { |
508 | return __kfifo_len(kfifo) / sizeof(void *); | 508 | return kfifo_len(kfifo) / sizeof(void *); |
509 | } | 509 | } |
510 | 510 | ||
511 | static inline int cq_put(struct kfifo *kfifo, void *p) | 511 | static inline int cq_put(struct kfifo *kfifo, void *p) |
512 | { | 512 | { |
513 | return __kfifo_put(kfifo, (void *)&p, sizeof(p)); | 513 | return kfifo_in(kfifo, (void *)&p, sizeof(p)); |
514 | } | 514 | } |
515 | 515 | ||
516 | static inline void *cq_get(struct kfifo *kfifo) | 516 | static inline void *cq_get(struct kfifo *kfifo) |
517 | { | 517 | { |
518 | void *p = NULL; | 518 | void *p = NULL; |
519 | 519 | ||
520 | __kfifo_get(kfifo, (void *)&p, sizeof(p)); | 520 | kfifo_out(kfifo, (void *)&p, sizeof(p)); |
521 | return p; | 521 | return p; |
522 | } | 522 | } |
523 | 523 | ||
diff --git a/drivers/usb/host/isp1362-hcd.c b/drivers/usb/host/isp1362-hcd.c index 5c774ab98252..42971657fde2 100644 --- a/drivers/usb/host/isp1362-hcd.c +++ b/drivers/usb/host/isp1362-hcd.c | |||
@@ -80,7 +80,7 @@ | |||
80 | #include <linux/platform_device.h> | 80 | #include <linux/platform_device.h> |
81 | #include <linux/pm.h> | 81 | #include <linux/pm.h> |
82 | #include <linux/io.h> | 82 | #include <linux/io.h> |
83 | #include <linux/bitops.h> | 83 | #include <linux/bitmap.h> |
84 | 84 | ||
85 | #include <asm/irq.h> | 85 | #include <asm/irq.h> |
86 | #include <asm/system.h> | 86 | #include <asm/system.h> |
@@ -190,10 +190,8 @@ static int claim_ptd_buffers(struct isp1362_ep_queue *epq, | |||
190 | struct isp1362_ep *ep, u16 len) | 190 | struct isp1362_ep *ep, u16 len) |
191 | { | 191 | { |
192 | int ptd_offset = -EINVAL; | 192 | int ptd_offset = -EINVAL; |
193 | int index; | ||
194 | int num_ptds = ((len + PTD_HEADER_SIZE - 1) / epq->blk_size) + 1; | 193 | int num_ptds = ((len + PTD_HEADER_SIZE - 1) / epq->blk_size) + 1; |
195 | int found = -1; | 194 | int found; |
196 | int last = -1; | ||
197 | 195 | ||
198 | BUG_ON(len > epq->buf_size); | 196 | BUG_ON(len > epq->buf_size); |
199 | 197 | ||
@@ -205,20 +203,9 @@ static int claim_ptd_buffers(struct isp1362_ep_queue *epq, | |||
205 | epq->name, len, epq->blk_size, num_ptds, epq->buf_map, epq->skip_map); | 203 | epq->name, len, epq->blk_size, num_ptds, epq->buf_map, epq->skip_map); |
206 | BUG_ON(ep->num_ptds != 0); | 204 | BUG_ON(ep->num_ptds != 0); |
207 | 205 | ||
208 | for (index = 0; index <= epq->buf_count - num_ptds; index++) { | 206 | found = bitmap_find_next_zero_area(&epq->buf_map, epq->buf_count, 0, |
209 | if (test_bit(index, &epq->buf_map)) | 207 | num_ptds, 0); |
210 | continue; | 208 | if (found >= epq->buf_count) |
211 | found = index; | ||
212 | for (last = index + 1; last < index + num_ptds; last++) { | ||
213 | if (test_bit(last, &epq->buf_map)) { | ||
214 | found = -1; | ||
215 | break; | ||
216 | } | ||
217 | } | ||
218 | if (found >= 0) | ||
219 | break; | ||
220 | } | ||
221 | if (found < 0) | ||
222 | return -EOVERFLOW; | 209 | return -EOVERFLOW; |
223 | 210 | ||
224 | DBG(1, "%s: Found %d PTDs[%d] for %d/%d byte\n", __func__, | 211 | DBG(1, "%s: Found %d PTDs[%d] for %d/%d byte\n", __func__, |
@@ -230,8 +217,7 @@ static int claim_ptd_buffers(struct isp1362_ep_queue *epq, | |||
230 | epq->buf_avail -= num_ptds; | 217 | epq->buf_avail -= num_ptds; |
231 | BUG_ON(epq->buf_avail > epq->buf_count); | 218 | BUG_ON(epq->buf_avail > epq->buf_count); |
232 | ep->ptd_index = found; | 219 | ep->ptd_index = found; |
233 | for (index = found; index < last; index++) | 220 | bitmap_set(&epq->buf_map, found, num_ptds); |
234 | __set_bit(index, &epq->buf_map); | ||
235 | DBG(1, "%s: Done %s PTD[%d] $%04x, avail %d count %d claimed %d %08lx:%08lx\n", | 221 | DBG(1, "%s: Done %s PTD[%d] $%04x, avail %d count %d claimed %d %08lx:%08lx\n", |
236 | __func__, epq->name, ep->ptd_index, ep->ptd_offset, | 222 | __func__, epq->name, ep->ptd_index, ep->ptd_offset, |
237 | epq->buf_avail, epq->buf_count, num_ptds, epq->buf_map, epq->skip_map); | 223 | epq->buf_avail, epq->buf_count, num_ptds, epq->buf_map, epq->skip_map); |
@@ -2284,10 +2270,10 @@ static int isp1362_mem_config(struct usb_hcd *hcd) | |||
2284 | dev_info(hcd->self.controller, "ISP1362 Memory usage:\n"); | 2270 | dev_info(hcd->self.controller, "ISP1362 Memory usage:\n"); |
2285 | dev_info(hcd->self.controller, " ISTL: 2 * %4d: %4d @ $%04x:$%04x\n", | 2271 | dev_info(hcd->self.controller, " ISTL: 2 * %4d: %4d @ $%04x:$%04x\n", |
2286 | istl_size / 2, istl_size, 0, istl_size / 2); | 2272 | istl_size / 2, istl_size, 0, istl_size / 2); |
2287 | dev_info(hcd->self.controller, " INTL: %4d * (%3lu+8): %4d @ $%04x\n", | 2273 | dev_info(hcd->self.controller, " INTL: %4d * (%3zu+8): %4d @ $%04x\n", |
2288 | ISP1362_INTL_BUFFERS, intl_blksize - PTD_HEADER_SIZE, | 2274 | ISP1362_INTL_BUFFERS, intl_blksize - PTD_HEADER_SIZE, |
2289 | intl_size, istl_size); | 2275 | intl_size, istl_size); |
2290 | dev_info(hcd->self.controller, " ATL : %4d * (%3lu+8): %4d @ $%04x\n", | 2276 | dev_info(hcd->self.controller, " ATL : %4d * (%3zu+8): %4d @ $%04x\n", |
2291 | atl_buffers, atl_blksize - PTD_HEADER_SIZE, | 2277 | atl_buffers, atl_blksize - PTD_HEADER_SIZE, |
2292 | atl_size, istl_size + intl_size); | 2278 | atl_size, istl_size + intl_size); |
2293 | dev_info(hcd->self.controller, " USED/FREE: %4d %4d\n", total, | 2279 | dev_info(hcd->self.controller, " USED/FREE: %4d %4d\n", total, |
@@ -2711,6 +2697,8 @@ static int __init isp1362_probe(struct platform_device *pdev) | |||
2711 | void __iomem *data_reg; | 2697 | void __iomem *data_reg; |
2712 | int irq; | 2698 | int irq; |
2713 | int retval = 0; | 2699 | int retval = 0; |
2700 | struct resource *irq_res; | ||
2701 | unsigned int irq_flags = 0; | ||
2714 | 2702 | ||
2715 | /* basic sanity checks first. board-specific init logic should | 2703 | /* basic sanity checks first. board-specific init logic should |
2716 | * have initialized this the three resources and probably board | 2704 | * have initialized this the three resources and probably board |
@@ -2724,11 +2712,12 @@ static int __init isp1362_probe(struct platform_device *pdev) | |||
2724 | 2712 | ||
2725 | data = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 2713 | data = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
2726 | addr = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 2714 | addr = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
2727 | irq = platform_get_irq(pdev, 0); | 2715 | irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
2728 | if (!addr || !data || irq < 0) { | 2716 | if (!addr || !data || !irq_res) { |
2729 | retval = -ENODEV; | 2717 | retval = -ENODEV; |
2730 | goto err1; | 2718 | goto err1; |
2731 | } | 2719 | } |
2720 | irq = irq_res->start; | ||
2732 | 2721 | ||
2733 | #ifdef CONFIG_USB_HCD_DMA | 2722 | #ifdef CONFIG_USB_HCD_DMA |
2734 | if (pdev->dev.dma_mask) { | 2723 | if (pdev->dev.dma_mask) { |
@@ -2795,12 +2784,16 @@ static int __init isp1362_probe(struct platform_device *pdev) | |||
2795 | } | 2784 | } |
2796 | #endif | 2785 | #endif |
2797 | 2786 | ||
2798 | #ifdef CONFIG_ARM | 2787 | if (irq_res->flags & IORESOURCE_IRQ_HIGHEDGE) |
2799 | if (isp1362_hcd->board) | 2788 | irq_flags |= IRQF_TRIGGER_RISING; |
2800 | set_irq_type(irq, isp1362_hcd->board->int_act_high ? IRQT_RISING : IRQT_FALLING); | 2789 | if (irq_res->flags & IORESOURCE_IRQ_LOWEDGE) |
2801 | #endif | 2790 | irq_flags |= IRQF_TRIGGER_FALLING; |
2791 | if (irq_res->flags & IORESOURCE_IRQ_HIGHLEVEL) | ||
2792 | irq_flags |= IRQF_TRIGGER_HIGH; | ||
2793 | if (irq_res->flags & IORESOURCE_IRQ_LOWLEVEL) | ||
2794 | irq_flags |= IRQF_TRIGGER_LOW; | ||
2802 | 2795 | ||
2803 | retval = usb_add_hcd(hcd, irq, IRQF_TRIGGER_LOW | IRQF_DISABLED | IRQF_SHARED); | 2796 | retval = usb_add_hcd(hcd, irq, irq_flags | IRQF_DISABLED | IRQF_SHARED); |
2804 | if (retval != 0) | 2797 | if (retval != 0) |
2805 | goto err6; | 2798 | goto err6; |
2806 | pr_info("%s, irq %d\n", hcd->product_desc, irq); | 2799 | pr_info("%s, irq %d\n", hcd->product_desc, irq); |
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c index 9600a58299db..27b8f7cb4471 100644 --- a/drivers/usb/host/isp1760-hcd.c +++ b/drivers/usb/host/isp1760-hcd.c | |||
@@ -1039,12 +1039,12 @@ static void do_atl_int(struct usb_hcd *usb_hcd) | |||
1039 | if (!nakcount && (dw3 & DW3_QTD_ACTIVE)) { | 1039 | if (!nakcount && (dw3 & DW3_QTD_ACTIVE)) { |
1040 | u32 buffstatus; | 1040 | u32 buffstatus; |
1041 | 1041 | ||
1042 | /* XXX | 1042 | /* |
1043 | * NAKs are handled in HW by the chip. Usually if the | 1043 | * NAKs are handled in HW by the chip. Usually if the |
1044 | * device is not able to send data fast enough. | 1044 | * device is not able to send data fast enough. |
1045 | * This did not trigger for a long time now. | 1045 | * This happens mostly on slower hardware. |
1046 | */ | 1046 | */ |
1047 | printk(KERN_ERR "Reloading ptd %p/%p... qh %p readed: " | 1047 | printk(KERN_NOTICE "Reloading ptd %p/%p... qh %p read: " |
1048 | "%d of %zu done: %08x cur: %08x\n", qtd, | 1048 | "%d of %zu done: %08x cur: %08x\n", qtd, |
1049 | urb, qh, PTD_XFERRED_LENGTH(dw3), | 1049 | urb, qh, PTD_XFERRED_LENGTH(dw3), |
1050 | qtd->length, done_map, | 1050 | qtd->length, done_map, |
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c index e4380082ebb1..17a6043c1fa0 100644 --- a/drivers/usb/host/ohci-au1xxx.c +++ b/drivers/usb/host/ohci-au1xxx.c | |||
@@ -294,7 +294,7 @@ static int ohci_hcd_au1xxx_drv_resume(struct device *dev) | |||
294 | return 0; | 294 | return 0; |
295 | } | 295 | } |
296 | 296 | ||
297 | static struct dev_pm_ops au1xxx_ohci_pmops = { | 297 | static const struct dev_pm_ops au1xxx_ohci_pmops = { |
298 | .suspend = ohci_hcd_au1xxx_drv_suspend, | 298 | .suspend = ohci_hcd_au1xxx_drv_suspend, |
299 | .resume = ohci_hcd_au1xxx_drv_resume, | 299 | .resume = ohci_hcd_au1xxx_drv_resume, |
300 | }; | 300 | }; |
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index f1c06202fdf2..a18debdd79b8 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c | |||
@@ -518,7 +518,7 @@ static int ohci_hcd_pxa27x_drv_resume(struct device *dev) | |||
518 | return 0; | 518 | return 0; |
519 | } | 519 | } |
520 | 520 | ||
521 | static struct dev_pm_ops ohci_hcd_pxa27x_pm_ops = { | 521 | static const struct dev_pm_ops ohci_hcd_pxa27x_pm_ops = { |
522 | .suspend = ohci_hcd_pxa27x_drv_suspend, | 522 | .suspend = ohci_hcd_pxa27x_drv_suspend, |
523 | .resume = ohci_hcd_pxa27x_drv_resume, | 523 | .resume = ohci_hcd_pxa27x_drv_resume, |
524 | }; | 524 | }; |
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c index 41dbc70ae752..b7a661c02bcd 100644 --- a/drivers/usb/host/r8a66597-hcd.c +++ b/drivers/usb/host/r8a66597-hcd.c | |||
@@ -2353,7 +2353,7 @@ static int r8a66597_resume(struct device *dev) | |||
2353 | return 0; | 2353 | return 0; |
2354 | } | 2354 | } |
2355 | 2355 | ||
2356 | static struct dev_pm_ops r8a66597_dev_pm_ops = { | 2356 | static const struct dev_pm_ops r8a66597_dev_pm_ops = { |
2357 | .suspend = r8a66597_suspend, | 2357 | .suspend = r8a66597_suspend, |
2358 | .resume = r8a66597_resume, | 2358 | .resume = r8a66597_resume, |
2359 | .poweroff = r8a66597_suspend, | 2359 | .poweroff = r8a66597_suspend, |
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c index 5cd0e48f67fb..99cd00fd3514 100644 --- a/drivers/usb/host/uhci-hcd.c +++ b/drivers/usb/host/uhci-hcd.c | |||
@@ -749,7 +749,20 @@ static int uhci_rh_suspend(struct usb_hcd *hcd) | |||
749 | spin_lock_irq(&uhci->lock); | 749 | spin_lock_irq(&uhci->lock); |
750 | if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) | 750 | if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) |
751 | rc = -ESHUTDOWN; | 751 | rc = -ESHUTDOWN; |
752 | else if (!uhci->dead) | 752 | else if (uhci->dead) |
753 | ; /* Dead controllers tell no tales */ | ||
754 | |||
755 | /* Once the controller is stopped, port resumes that are already | ||
756 | * in progress won't complete. Hence if remote wakeup is enabled | ||
757 | * for the root hub and any ports are in the middle of a resume or | ||
758 | * remote wakeup, we must fail the suspend. | ||
759 | */ | ||
760 | else if (hcd->self.root_hub->do_remote_wakeup && | ||
761 | uhci->resuming_ports) { | ||
762 | dev_dbg(uhci_dev(uhci), "suspend failed because a port " | ||
763 | "is resuming\n"); | ||
764 | rc = -EBUSY; | ||
765 | } else | ||
753 | suspend_rh(uhci, UHCI_RH_SUSPENDED); | 766 | suspend_rh(uhci, UHCI_RH_SUSPENDED); |
754 | spin_unlock_irq(&uhci->lock); | 767 | spin_unlock_irq(&uhci->lock); |
755 | return rc; | 768 | return rc; |
diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c index 885b585360b9..8270055848ca 100644 --- a/drivers/usb/host/uhci-hub.c +++ b/drivers/usb/host/uhci-hub.c | |||
@@ -167,7 +167,7 @@ static void uhci_check_ports(struct uhci_hcd *uhci) | |||
167 | /* Port received a wakeup request */ | 167 | /* Port received a wakeup request */ |
168 | set_bit(port, &uhci->resuming_ports); | 168 | set_bit(port, &uhci->resuming_ports); |
169 | uhci->ports_timeout = jiffies + | 169 | uhci->ports_timeout = jiffies + |
170 | msecs_to_jiffies(20); | 170 | msecs_to_jiffies(25); |
171 | 171 | ||
172 | /* Make sure we see the port again | 172 | /* Make sure we see the port again |
173 | * after the resuming period is over. */ | 173 | * after the resuming period is over. */ |