diff options
-rw-r--r-- | drivers/usb/host/sl811-hcd.c | 69 | ||||
-rw-r--r-- | drivers/usb/host/sl811.h | 19 |
2 files changed, 42 insertions, 46 deletions
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c index b2ec7fe758dd..c11c5d8f94e0 100644 --- a/drivers/usb/host/sl811-hcd.c +++ b/drivers/usb/host/sl811-hcd.c | |||
@@ -100,7 +100,8 @@ static void port_power(struct sl811 *sl811, int is_on) | |||
100 | 100 | ||
101 | if (sl811->board && sl811->board->port_power) { | 101 | if (sl811->board && sl811->board->port_power) { |
102 | /* switch VBUS, at 500mA unless hub power budget gets set */ | 102 | /* switch VBUS, at 500mA unless hub power budget gets set */ |
103 | DBG("power %s\n", is_on ? "on" : "off"); | 103 | dev_dbg(hcd->self.controller, "power %s\n", |
104 | is_on ? "on" : "off"); | ||
104 | sl811->board->port_power(hcd->self.controller, is_on); | 105 | sl811->board->port_power(hcd->self.controller, is_on); |
105 | } | 106 | } |
106 | 107 | ||
@@ -282,7 +283,7 @@ static inline void sofirq_on(struct sl811 *sl811) | |||
282 | { | 283 | { |
283 | if (sl811->irq_enable & SL11H_INTMASK_SOFINTR) | 284 | if (sl811->irq_enable & SL11H_INTMASK_SOFINTR) |
284 | return; | 285 | return; |
285 | VDBG("sof irq on\n"); | 286 | dev_dbg(sl811_to_hcd(sl811)->self.controller, "sof irq on\n"); |
286 | sl811->irq_enable |= SL11H_INTMASK_SOFINTR; | 287 | sl811->irq_enable |= SL11H_INTMASK_SOFINTR; |
287 | } | 288 | } |
288 | 289 | ||
@@ -290,7 +291,7 @@ static inline void sofirq_off(struct sl811 *sl811) | |||
290 | { | 291 | { |
291 | if (!(sl811->irq_enable & SL11H_INTMASK_SOFINTR)) | 292 | if (!(sl811->irq_enable & SL11H_INTMASK_SOFINTR)) |
292 | return; | 293 | return; |
293 | VDBG("sof irq off\n"); | 294 | dev_dbg(sl811_to_hcd(sl811)->self.controller, "sof irq off\n"); |
294 | sl811->irq_enable &= ~SL11H_INTMASK_SOFINTR; | 295 | sl811->irq_enable &= ~SL11H_INTMASK_SOFINTR; |
295 | } | 296 | } |
296 | 297 | ||
@@ -338,7 +339,8 @@ static struct sl811h_ep *start(struct sl811 *sl811, u8 bank) | |||
338 | } | 339 | } |
339 | 340 | ||
340 | if (unlikely(list_empty(&ep->hep->urb_list))) { | 341 | if (unlikely(list_empty(&ep->hep->urb_list))) { |
341 | DBG("empty %p queue?\n", ep); | 342 | dev_dbg(sl811_to_hcd(sl811)->self.controller, |
343 | "empty %p queue?\n", ep); | ||
342 | return NULL; | 344 | return NULL; |
343 | } | 345 | } |
344 | 346 | ||
@@ -391,7 +393,8 @@ static struct sl811h_ep *start(struct sl811 *sl811, u8 bank) | |||
391 | status_packet(sl811, ep, urb, bank, control); | 393 | status_packet(sl811, ep, urb, bank, control); |
392 | break; | 394 | break; |
393 | default: | 395 | default: |
394 | DBG("bad ep%p pid %02x\n", ep, ep->nextpid); | 396 | dev_dbg(sl811_to_hcd(sl811)->self.controller, |
397 | "bad ep%p pid %02x\n", ep, ep->nextpid); | ||
395 | ep = NULL; | 398 | ep = NULL; |
396 | } | 399 | } |
397 | return ep; | 400 | return ep; |
@@ -447,7 +450,8 @@ static void finish_request( | |||
447 | } | 450 | } |
448 | 451 | ||
449 | /* periodic deschedule */ | 452 | /* periodic deschedule */ |
450 | DBG("deschedule qh%d/%p branch %d\n", ep->period, ep, ep->branch); | 453 | dev_dbg(sl811_to_hcd(sl811)->self.controller, |
454 | "deschedule qh%d/%p branch %d\n", ep->period, ep, ep->branch); | ||
451 | for (i = ep->branch; i < PERIODIC_SIZE; i += ep->period) { | 455 | for (i = ep->branch; i < PERIODIC_SIZE; i += ep->period) { |
452 | struct sl811h_ep *temp; | 456 | struct sl811h_ep *temp; |
453 | struct sl811h_ep **prev = &sl811->periodic[i]; | 457 | struct sl811h_ep **prev = &sl811->periodic[i]; |
@@ -593,7 +597,8 @@ static inline u8 checkdone(struct sl811 *sl811) | |||
593 | ctl = sl811_read(sl811, SL811_EP_A(SL11H_HOSTCTLREG)); | 597 | ctl = sl811_read(sl811, SL811_EP_A(SL11H_HOSTCTLREG)); |
594 | if (ctl & SL11H_HCTLMASK_ARM) | 598 | if (ctl & SL11H_HCTLMASK_ARM) |
595 | sl811_write(sl811, SL811_EP_A(SL11H_HOSTCTLREG), 0); | 599 | sl811_write(sl811, SL811_EP_A(SL11H_HOSTCTLREG), 0); |
596 | DBG("%s DONE_A: ctrl %02x sts %02x\n", | 600 | dev_dbg(sl811_to_hcd(sl811)->self.controller, |
601 | "%s DONE_A: ctrl %02x sts %02x\n", | ||
597 | (ctl & SL11H_HCTLMASK_ARM) ? "timeout" : "lost", | 602 | (ctl & SL11H_HCTLMASK_ARM) ? "timeout" : "lost", |
598 | ctl, | 603 | ctl, |
599 | sl811_read(sl811, SL811_EP_A(SL11H_PKTSTATREG))); | 604 | sl811_read(sl811, SL811_EP_A(SL11H_PKTSTATREG))); |
@@ -604,7 +609,8 @@ static inline u8 checkdone(struct sl811 *sl811) | |||
604 | ctl = sl811_read(sl811, SL811_EP_B(SL11H_HOSTCTLREG)); | 609 | ctl = sl811_read(sl811, SL811_EP_B(SL11H_HOSTCTLREG)); |
605 | if (ctl & SL11H_HCTLMASK_ARM) | 610 | if (ctl & SL11H_HCTLMASK_ARM) |
606 | sl811_write(sl811, SL811_EP_B(SL11H_HOSTCTLREG), 0); | 611 | sl811_write(sl811, SL811_EP_B(SL11H_HOSTCTLREG), 0); |
607 | DBG("%s DONE_B: ctrl %02x sts %02x\n", | 612 | dev_dbg(sl811_to_hcd(sl811)->self.controller, |
613 | "%s DONE_B: ctrl %02x sts %02x\n", | ||
608 | (ctl & SL11H_HCTLMASK_ARM) ? "timeout" : "lost", | 614 | (ctl & SL11H_HCTLMASK_ARM) ? "timeout" : "lost", |
609 | ctl, | 615 | ctl, |
610 | sl811_read(sl811, SL811_EP_B(SL11H_PKTSTATREG))); | 616 | sl811_read(sl811, SL811_EP_B(SL11H_PKTSTATREG))); |
@@ -665,7 +671,7 @@ retry: | |||
665 | * this one has nothing scheduled. | 671 | * this one has nothing scheduled. |
666 | */ | 672 | */ |
667 | if (sl811->next_periodic) { | 673 | if (sl811->next_periodic) { |
668 | // ERR("overrun to slot %d\n", index); | 674 | // dev_err(hcd->self.controller, "overrun to slot %d\n", index); |
669 | sl811->stat_overrun++; | 675 | sl811->stat_overrun++; |
670 | } | 676 | } |
671 | if (sl811->periodic[index]) | 677 | if (sl811->periodic[index]) |
@@ -723,7 +729,7 @@ retry: | |||
723 | 729 | ||
724 | } else if (irqstat & SL11H_INTMASK_RD) { | 730 | } else if (irqstat & SL11H_INTMASK_RD) { |
725 | if (sl811->port1 & USB_PORT_STAT_SUSPEND) { | 731 | if (sl811->port1 & USB_PORT_STAT_SUSPEND) { |
726 | DBG("wakeup\n"); | 732 | dev_dbg(hcd->self.controller, "wakeup\n"); |
727 | sl811->port1 |= USB_PORT_STAT_C_SUSPEND << 16; | 733 | sl811->port1 |= USB_PORT_STAT_C_SUSPEND << 16; |
728 | sl811->stat_wake++; | 734 | sl811->stat_wake++; |
729 | } else | 735 | } else |
@@ -852,8 +858,9 @@ static int sl811h_urb_enqueue( | |||
852 | 858 | ||
853 | if (ep->maxpacket > H_MAXPACKET) { | 859 | if (ep->maxpacket > H_MAXPACKET) { |
854 | /* iso packets up to 240 bytes could work... */ | 860 | /* iso packets up to 240 bytes could work... */ |
855 | DBG("dev %d ep%d maxpacket %d\n", | 861 | dev_dbg(hcd->self.controller, |
856 | udev->devnum, epnum, ep->maxpacket); | 862 | "dev %d ep%d maxpacket %d\n", udev->devnum, |
863 | epnum, ep->maxpacket); | ||
857 | retval = -EINVAL; | 864 | retval = -EINVAL; |
858 | kfree(ep); | 865 | kfree(ep); |
859 | goto fail; | 866 | goto fail; |
@@ -917,7 +924,8 @@ static int sl811h_urb_enqueue( | |||
917 | * to share the faster parts of the tree without needing | 924 | * to share the faster parts of the tree without needing |
918 | * dummy/placeholder nodes | 925 | * dummy/placeholder nodes |
919 | */ | 926 | */ |
920 | DBG("schedule qh%d/%p branch %d\n", ep->period, ep, ep->branch); | 927 | dev_dbg(hcd->self.controller, "schedule qh%d/%p branch %d\n", |
928 | ep->period, ep, ep->branch); | ||
921 | for (i = ep->branch; i < PERIODIC_SIZE; i += ep->period) { | 929 | for (i = ep->branch; i < PERIODIC_SIZE; i += ep->period) { |
922 | struct sl811h_ep **prev = &sl811->periodic[i]; | 930 | struct sl811h_ep **prev = &sl811->periodic[i]; |
923 | struct sl811h_ep *here = *prev; | 931 | struct sl811h_ep *here = *prev; |
@@ -976,7 +984,8 @@ static int sl811h_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) | |||
976 | } else if (sl811->active_a == ep) { | 984 | } else if (sl811->active_a == ep) { |
977 | if (time_before_eq(sl811->jiffies_a, jiffies)) { | 985 | if (time_before_eq(sl811->jiffies_a, jiffies)) { |
978 | /* happens a lot with lowspeed?? */ | 986 | /* happens a lot with lowspeed?? */ |
979 | DBG("giveup on DONE_A: ctrl %02x sts %02x\n", | 987 | dev_dbg(hcd->self.controller, |
988 | "giveup on DONE_A: ctrl %02x sts %02x\n", | ||
980 | sl811_read(sl811, | 989 | sl811_read(sl811, |
981 | SL811_EP_A(SL11H_HOSTCTLREG)), | 990 | SL811_EP_A(SL11H_HOSTCTLREG)), |
982 | sl811_read(sl811, | 991 | sl811_read(sl811, |
@@ -990,7 +999,8 @@ static int sl811h_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) | |||
990 | } else if (sl811->active_b == ep) { | 999 | } else if (sl811->active_b == ep) { |
991 | if (time_before_eq(sl811->jiffies_a, jiffies)) { | 1000 | if (time_before_eq(sl811->jiffies_a, jiffies)) { |
992 | /* happens a lot with lowspeed?? */ | 1001 | /* happens a lot with lowspeed?? */ |
993 | DBG("giveup on DONE_B: ctrl %02x sts %02x\n", | 1002 | dev_dbg(hcd->self.controller, |
1003 | "giveup on DONE_B: ctrl %02x sts %02x\n", | ||
994 | sl811_read(sl811, | 1004 | sl811_read(sl811, |
995 | SL811_EP_B(SL11H_HOSTCTLREG)), | 1005 | SL811_EP_B(SL11H_HOSTCTLREG)), |
996 | sl811_read(sl811, | 1006 | sl811_read(sl811, |
@@ -1008,7 +1018,8 @@ static int sl811h_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) | |||
1008 | if (urb) | 1018 | if (urb) |
1009 | finish_request(sl811, ep, urb, 0); | 1019 | finish_request(sl811, ep, urb, 0); |
1010 | else | 1020 | else |
1011 | VDBG("dequeue, urb %p active %s; wait4irq\n", urb, | 1021 | dev_dbg(sl811_to_hcd(sl811)->self.controller, |
1022 | "dequeue, urb %p active %s; wait4irq\n", urb, | ||
1012 | (sl811->active_a == ep) ? "A" : "B"); | 1023 | (sl811->active_a == ep) ? "A" : "B"); |
1013 | } else | 1024 | } else |
1014 | retval = -EINVAL; | 1025 | retval = -EINVAL; |
@@ -1029,7 +1040,7 @@ sl811h_endpoint_disable(struct usb_hcd *hcd, struct usb_host_endpoint *hep) | |||
1029 | if (!list_empty(&hep->urb_list)) | 1040 | if (!list_empty(&hep->urb_list)) |
1030 | msleep(3); | 1041 | msleep(3); |
1031 | if (!list_empty(&hep->urb_list)) | 1042 | if (!list_empty(&hep->urb_list)) |
1032 | WARNING("ep %p not empty?\n", ep); | 1043 | dev_warn(hcd->self.controller, "ep %p not empty?\n", ep); |
1033 | 1044 | ||
1034 | kfree(ep); | 1045 | kfree(ep); |
1035 | hep->hcpriv = NULL; | 1046 | hep->hcpriv = NULL; |
@@ -1132,7 +1143,7 @@ sl811h_timer(unsigned long _sl811) | |||
1132 | 1143 | ||
1133 | switch (signaling) { | 1144 | switch (signaling) { |
1134 | case SL11H_CTL1MASK_SE0: | 1145 | case SL11H_CTL1MASK_SE0: |
1135 | DBG("end reset\n"); | 1146 | dev_dbg(sl811_to_hcd(sl811)->self.controller, "end reset\n"); |
1136 | sl811->port1 = (USB_PORT_STAT_C_RESET << 16) | 1147 | sl811->port1 = (USB_PORT_STAT_C_RESET << 16) |
1137 | | USB_PORT_STAT_POWER; | 1148 | | USB_PORT_STAT_POWER; |
1138 | sl811->ctrl1 = 0; | 1149 | sl811->ctrl1 = 0; |
@@ -1141,11 +1152,12 @@ sl811h_timer(unsigned long _sl811) | |||
1141 | irqstat &= ~SL11H_INTMASK_RD; | 1152 | irqstat &= ~SL11H_INTMASK_RD; |
1142 | break; | 1153 | break; |
1143 | case SL11H_CTL1MASK_K: | 1154 | case SL11H_CTL1MASK_K: |
1144 | DBG("end resume\n"); | 1155 | dev_dbg(sl811_to_hcd(sl811)->self.controller, "end resume\n"); |
1145 | sl811->port1 &= ~USB_PORT_STAT_SUSPEND; | 1156 | sl811->port1 &= ~USB_PORT_STAT_SUSPEND; |
1146 | break; | 1157 | break; |
1147 | default: | 1158 | default: |
1148 | DBG("odd timer signaling: %02x\n", signaling); | 1159 | dev_dbg(sl811_to_hcd(sl811)->self.controller, |
1160 | "odd timer signaling: %02x\n", signaling); | ||
1149 | break; | 1161 | break; |
1150 | } | 1162 | } |
1151 | sl811_write(sl811, SL11H_IRQ_STATUS, irqstat); | 1163 | sl811_write(sl811, SL11H_IRQ_STATUS, irqstat); |
@@ -1243,7 +1255,7 @@ sl811h_hub_control( | |||
1243 | break; | 1255 | break; |
1244 | 1256 | ||
1245 | /* 20 msec of resume/K signaling, other irqs blocked */ | 1257 | /* 20 msec of resume/K signaling, other irqs blocked */ |
1246 | DBG("start resume...\n"); | 1258 | dev_dbg(hcd->self.controller, "start resume...\n"); |
1247 | sl811->irq_enable = 0; | 1259 | sl811->irq_enable = 0; |
1248 | sl811_write(sl811, SL11H_IRQ_ENABLE, | 1260 | sl811_write(sl811, SL11H_IRQ_ENABLE, |
1249 | sl811->irq_enable); | 1261 | sl811->irq_enable); |
@@ -1281,7 +1293,8 @@ sl811h_hub_control( | |||
1281 | #ifndef VERBOSE | 1293 | #ifndef VERBOSE |
1282 | if (*(u16*)(buf+2)) /* only if wPortChange is interesting */ | 1294 | if (*(u16*)(buf+2)) /* only if wPortChange is interesting */ |
1283 | #endif | 1295 | #endif |
1284 | DBG("GetPortStatus %08x\n", sl811->port1); | 1296 | dev_dbg(hcd->self.controller, "GetPortStatus %08x\n", |
1297 | sl811->port1); | ||
1285 | break; | 1298 | break; |
1286 | case SetPortFeature: | 1299 | case SetPortFeature: |
1287 | if (wIndex != 1 || wLength != 0) | 1300 | if (wIndex != 1 || wLength != 0) |
@@ -1293,7 +1306,7 @@ sl811h_hub_control( | |||
1293 | if (!(sl811->port1 & USB_PORT_STAT_ENABLE)) | 1306 | if (!(sl811->port1 & USB_PORT_STAT_ENABLE)) |
1294 | goto error; | 1307 | goto error; |
1295 | 1308 | ||
1296 | DBG("suspend...\n"); | 1309 | dev_dbg(hcd->self.controller,"suspend...\n"); |
1297 | sl811->ctrl1 &= ~SL11H_CTL1MASK_SOF_ENA; | 1310 | sl811->ctrl1 &= ~SL11H_CTL1MASK_SOF_ENA; |
1298 | sl811_write(sl811, SL11H_CTLREG1, sl811->ctrl1); | 1311 | sl811_write(sl811, SL11H_CTLREG1, sl811->ctrl1); |
1299 | break; | 1312 | break; |
@@ -1338,7 +1351,7 @@ static int | |||
1338 | sl811h_bus_suspend(struct usb_hcd *hcd) | 1351 | sl811h_bus_suspend(struct usb_hcd *hcd) |
1339 | { | 1352 | { |
1340 | // SOFs off | 1353 | // SOFs off |
1341 | DBG("%s\n", __func__); | 1354 | dev_dbg(hcd->self.controller, "%s\n", __func__); |
1342 | return 0; | 1355 | return 0; |
1343 | } | 1356 | } |
1344 | 1357 | ||
@@ -1346,7 +1359,7 @@ static int | |||
1346 | sl811h_bus_resume(struct usb_hcd *hcd) | 1359 | sl811h_bus_resume(struct usb_hcd *hcd) |
1347 | { | 1360 | { |
1348 | // SOFs on | 1361 | // SOFs on |
1349 | DBG("%s\n", __func__); | 1362 | dev_dbg(hcd->self.controller, "%s\n", __func__); |
1350 | return 0; | 1363 | return 0; |
1351 | } | 1364 | } |
1352 | 1365 | ||
@@ -1648,7 +1661,7 @@ sl811h_probe(struct platform_device *dev) | |||
1648 | 1661 | ||
1649 | /* refuse to confuse usbcore */ | 1662 | /* refuse to confuse usbcore */ |
1650 | if (dev->dev.dma_mask) { | 1663 | if (dev->dev.dma_mask) { |
1651 | DBG("no we won't dma\n"); | 1664 | dev_dbg(&dev->dev, "no we won't dma\n"); |
1652 | return -EINVAL; | 1665 | return -EINVAL; |
1653 | } | 1666 | } |
1654 | 1667 | ||
@@ -1716,7 +1729,7 @@ sl811h_probe(struct platform_device *dev) | |||
1716 | break; | 1729 | break; |
1717 | default: | 1730 | default: |
1718 | /* reject case 0, SL11S is less functional */ | 1731 | /* reject case 0, SL11S is less functional */ |
1719 | DBG("chiprev %02x\n", tmp); | 1732 | dev_dbg(&dev->dev, "chiprev %02x\n", tmp); |
1720 | retval = -ENXIO; | 1733 | retval = -ENXIO; |
1721 | goto err6; | 1734 | goto err6; |
1722 | } | 1735 | } |
@@ -1747,7 +1760,7 @@ sl811h_probe(struct platform_device *dev) | |||
1747 | if (!ioaddr) | 1760 | if (!ioaddr) |
1748 | iounmap(addr_reg); | 1761 | iounmap(addr_reg); |
1749 | err2: | 1762 | err2: |
1750 | DBG("init error, %d\n", retval); | 1763 | dev_dbg(&dev->dev, "init error, %d\n", retval); |
1751 | return retval; | 1764 | return retval; |
1752 | } | 1765 | } |
1753 | 1766 | ||
diff --git a/drivers/usb/host/sl811.h b/drivers/usb/host/sl811.h index b6b8c1f233dd..7ac5c5ee4a3e 100644 --- a/drivers/usb/host/sl811.h +++ b/drivers/usb/host/sl811.h | |||
@@ -242,25 +242,8 @@ sl811_read_buf(struct sl811 *sl811, int addr, void *buf, size_t count) | |||
242 | 242 | ||
243 | /*-------------------------------------------------------------------------*/ | 243 | /*-------------------------------------------------------------------------*/ |
244 | 244 | ||
245 | #ifdef DEBUG | ||
246 | #define DBG(stuff...) printk(KERN_DEBUG "sl811: " stuff) | ||
247 | #else | ||
248 | #define DBG(stuff...) do{}while(0) | ||
249 | #endif | ||
250 | |||
251 | #ifdef VERBOSE | ||
252 | # define VDBG DBG | ||
253 | #else | ||
254 | # define VDBG(stuff...) do{}while(0) | ||
255 | #endif | ||
256 | |||
257 | #ifdef PACKET_TRACE | 245 | #ifdef PACKET_TRACE |
258 | # define PACKET VDBG | 246 | # define PACKET pr_debug("sl811: "stuff) |
259 | #else | 247 | #else |
260 | # define PACKET(stuff...) do{}while(0) | 248 | # define PACKET(stuff...) do{}while(0) |
261 | #endif | 249 | #endif |
262 | |||
263 | #define ERR(stuff...) printk(KERN_ERR "sl811: " stuff) | ||
264 | #define WARNING(stuff...) printk(KERN_WARNING "sl811: " stuff) | ||
265 | #define INFO(stuff...) printk(KERN_INFO "sl811: " stuff) | ||
266 | |||