diff options
author | Felipe Balbi <balbi@ti.com> | 2011-05-11 05:44:08 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2011-05-13 07:34:04 -0400 |
commit | 5c8a86e10a7c164f44537fabdc169fd8b4e7a440 (patch) | |
tree | 96fe3eb08b9ae01f62e45b725049d3f2aa6b7bba /drivers/usb/musb/musb_gadget.c | |
parent | a0885924326f79e157847010a9aaf49b058b30dc (diff) |
usb: musb: drop unneeded musb_debug trickery
We have a generic way of enabling/disabling
different debug messages on a driver called
DYNAMIC_PRINTK. Anyone interested in enabling
just part of the debug messages, please read
the documentation under:
Documentation/dynamic-debug-howto.txt
for information on how to use that great
infrastructure.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/musb/musb_gadget.c')
-rw-r--r-- | drivers/usb/musb/musb_gadget.c | 110 |
1 files changed, 57 insertions, 53 deletions
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index cfbee4dcfc13..d34ff408c815 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
@@ -147,7 +147,8 @@ static inline void unmap_dma_buffer(struct musb_request *request, | |||
147 | return; | 147 | return; |
148 | 148 | ||
149 | if (request->request.dma == DMA_ADDR_INVALID) { | 149 | if (request->request.dma == DMA_ADDR_INVALID) { |
150 | DBG(20, "not unmapping a never mapped buffer\n"); | 150 | dev_vdbg(musb->controller, |
151 | "not unmapping a never mapped buffer\n"); | ||
151 | return; | 152 | return; |
152 | } | 153 | } |
153 | if (request->map_state == MUSB_MAPPED) { | 154 | if (request->map_state == MUSB_MAPPED) { |
@@ -198,11 +199,11 @@ __acquires(ep->musb->lock) | |||
198 | spin_unlock(&musb->lock); | 199 | spin_unlock(&musb->lock); |
199 | unmap_dma_buffer(req, musb); | 200 | unmap_dma_buffer(req, musb); |
200 | if (request->status == 0) | 201 | if (request->status == 0) |
201 | DBG(5, "%s done request %p, %d/%d\n", | 202 | dev_dbg(musb->controller, "%s done request %p, %d/%d\n", |
202 | ep->end_point.name, request, | 203 | ep->end_point.name, request, |
203 | req->request.actual, req->request.length); | 204 | req->request.actual, req->request.length); |
204 | else | 205 | else |
205 | DBG(2, "%s request %p, %d/%d fault %d\n", | 206 | dev_dbg(musb->controller, "%s request %p, %d/%d fault %d\n", |
206 | ep->end_point.name, request, | 207 | ep->end_point.name, request, |
207 | req->request.actual, req->request.length, | 208 | req->request.actual, req->request.length, |
208 | request->status); | 209 | request->status); |
@@ -219,6 +220,7 @@ __acquires(ep->musb->lock) | |||
219 | */ | 220 | */ |
220 | static void nuke(struct musb_ep *ep, const int status) | 221 | static void nuke(struct musb_ep *ep, const int status) |
221 | { | 222 | { |
223 | struct musb *musb = ep->musb; | ||
222 | struct musb_request *req = NULL; | 224 | struct musb_request *req = NULL; |
223 | void __iomem *epio = ep->musb->endpoints[ep->current_epnum].regs; | 225 | void __iomem *epio = ep->musb->endpoints[ep->current_epnum].regs; |
224 | 226 | ||
@@ -246,7 +248,8 @@ static void nuke(struct musb_ep *ep, const int status) | |||
246 | } | 248 | } |
247 | 249 | ||
248 | value = c->channel_abort(ep->dma); | 250 | value = c->channel_abort(ep->dma); |
249 | DBG(value ? 1 : 6, "%s: abort DMA --> %d\n", ep->name, value); | 251 | dev_dbg(musb->controller, "%s: abort DMA --> %d\n", |
252 | ep->name, value); | ||
250 | c->channel_release(ep->dma); | 253 | c->channel_release(ep->dma); |
251 | ep->dma = NULL; | 254 | ep->dma = NULL; |
252 | } | 255 | } |
@@ -329,7 +332,7 @@ static void txstate(struct musb *musb, struct musb_request *req) | |||
329 | 332 | ||
330 | /* we shouldn't get here while DMA is active ... but we do ... */ | 333 | /* we shouldn't get here while DMA is active ... but we do ... */ |
331 | if (dma_channel_status(musb_ep->dma) == MUSB_DMA_STATUS_BUSY) { | 334 | if (dma_channel_status(musb_ep->dma) == MUSB_DMA_STATUS_BUSY) { |
332 | DBG(4, "dma pending...\n"); | 335 | dev_dbg(musb->controller, "dma pending...\n"); |
333 | return; | 336 | return; |
334 | } | 337 | } |
335 | 338 | ||
@@ -341,18 +344,18 @@ static void txstate(struct musb *musb, struct musb_request *req) | |||
341 | (int)(request->length - request->actual)); | 344 | (int)(request->length - request->actual)); |
342 | 345 | ||
343 | if (csr & MUSB_TXCSR_TXPKTRDY) { | 346 | if (csr & MUSB_TXCSR_TXPKTRDY) { |
344 | DBG(5, "%s old packet still ready , txcsr %03x\n", | 347 | dev_dbg(musb->controller, "%s old packet still ready , txcsr %03x\n", |
345 | musb_ep->end_point.name, csr); | 348 | musb_ep->end_point.name, csr); |
346 | return; | 349 | return; |
347 | } | 350 | } |
348 | 351 | ||
349 | if (csr & MUSB_TXCSR_P_SENDSTALL) { | 352 | if (csr & MUSB_TXCSR_P_SENDSTALL) { |
350 | DBG(5, "%s stalling, txcsr %03x\n", | 353 | dev_dbg(musb->controller, "%s stalling, txcsr %03x\n", |
351 | musb_ep->end_point.name, csr); | 354 | musb_ep->end_point.name, csr); |
352 | return; | 355 | return; |
353 | } | 356 | } |
354 | 357 | ||
355 | DBG(4, "hw_ep%d, maxpacket %d, fifo count %d, txcsr %03x\n", | 358 | dev_dbg(musb->controller, "hw_ep%d, maxpacket %d, fifo count %d, txcsr %03x\n", |
356 | epnum, musb_ep->packet_sz, fifo_count, | 359 | epnum, musb_ep->packet_sz, fifo_count, |
357 | csr); | 360 | csr); |
358 | 361 | ||
@@ -469,7 +472,7 @@ static void txstate(struct musb *musb, struct musb_request *req) | |||
469 | } | 472 | } |
470 | 473 | ||
471 | /* host may already have the data when this message shows... */ | 474 | /* host may already have the data when this message shows... */ |
472 | DBG(3, "%s TX/IN %s len %d/%d, txcsr %04x, fifo %d/%d\n", | 475 | dev_dbg(musb->controller, "%s TX/IN %s len %d/%d, txcsr %04x, fifo %d/%d\n", |
473 | musb_ep->end_point.name, use_dma ? "dma" : "pio", | 476 | musb_ep->end_point.name, use_dma ? "dma" : "pio", |
474 | request->actual, request->length, | 477 | request->actual, request->length, |
475 | musb_readw(epio, MUSB_TXCSR), | 478 | musb_readw(epio, MUSB_TXCSR), |
@@ -496,7 +499,7 @@ void musb_g_tx(struct musb *musb, u8 epnum) | |||
496 | request = &req->request; | 499 | request = &req->request; |
497 | 500 | ||
498 | csr = musb_readw(epio, MUSB_TXCSR); | 501 | csr = musb_readw(epio, MUSB_TXCSR); |
499 | DBG(4, "<== %s, txcsr %04x\n", musb_ep->end_point.name, csr); | 502 | dev_dbg(musb->controller, "<== %s, txcsr %04x\n", musb_ep->end_point.name, csr); |
500 | 503 | ||
501 | dma = is_dma_capable() ? musb_ep->dma : NULL; | 504 | dma = is_dma_capable() ? musb_ep->dma : NULL; |
502 | 505 | ||
@@ -516,7 +519,8 @@ void musb_g_tx(struct musb *musb, u8 epnum) | |||
516 | csr |= MUSB_TXCSR_P_WZC_BITS; | 519 | csr |= MUSB_TXCSR_P_WZC_BITS; |
517 | csr &= ~(MUSB_TXCSR_P_UNDERRUN | MUSB_TXCSR_TXPKTRDY); | 520 | csr &= ~(MUSB_TXCSR_P_UNDERRUN | MUSB_TXCSR_TXPKTRDY); |
518 | musb_writew(epio, MUSB_TXCSR, csr); | 521 | musb_writew(epio, MUSB_TXCSR, csr); |
519 | DBG(20, "underrun on ep%d, req %p\n", epnum, request); | 522 | dev_vdbg(musb->controller, "underrun on ep%d, req %p\n", |
523 | epnum, request); | ||
520 | } | 524 | } |
521 | 525 | ||
522 | if (dma_channel_status(dma) == MUSB_DMA_STATUS_BUSY) { | 526 | if (dma_channel_status(dma) == MUSB_DMA_STATUS_BUSY) { |
@@ -524,7 +528,7 @@ void musb_g_tx(struct musb *musb, u8 epnum) | |||
524 | * SHOULD NOT HAPPEN... has with CPPI though, after | 528 | * SHOULD NOT HAPPEN... has with CPPI though, after |
525 | * changing SENDSTALL (and other cases); harmless? | 529 | * changing SENDSTALL (and other cases); harmless? |
526 | */ | 530 | */ |
527 | DBG(5, "%s dma still busy?\n", musb_ep->end_point.name); | 531 | dev_dbg(musb->controller, "%s dma still busy?\n", musb_ep->end_point.name); |
528 | return; | 532 | return; |
529 | } | 533 | } |
530 | 534 | ||
@@ -540,7 +544,7 @@ void musb_g_tx(struct musb *musb, u8 epnum) | |||
540 | /* Ensure writebuffer is empty. */ | 544 | /* Ensure writebuffer is empty. */ |
541 | csr = musb_readw(epio, MUSB_TXCSR); | 545 | csr = musb_readw(epio, MUSB_TXCSR); |
542 | request->actual += musb_ep->dma->actual_len; | 546 | request->actual += musb_ep->dma->actual_len; |
543 | DBG(4, "TXCSR%d %04x, DMA off, len %zu, req %p\n", | 547 | dev_dbg(musb->controller, "TXCSR%d %04x, DMA off, len %zu, req %p\n", |
544 | epnum, csr, musb_ep->dma->actual_len, request); | 548 | epnum, csr, musb_ep->dma->actual_len, request); |
545 | } | 549 | } |
546 | 550 | ||
@@ -564,7 +568,7 @@ void musb_g_tx(struct musb *musb, u8 epnum) | |||
564 | if (csr & MUSB_TXCSR_TXPKTRDY) | 568 | if (csr & MUSB_TXCSR_TXPKTRDY) |
565 | return; | 569 | return; |
566 | 570 | ||
567 | DBG(4, "sending zero pkt\n"); | 571 | dev_dbg(musb->controller, "sending zero pkt\n"); |
568 | musb_writew(epio, MUSB_TXCSR, MUSB_TXCSR_MODE | 572 | musb_writew(epio, MUSB_TXCSR, MUSB_TXCSR_MODE |
569 | | MUSB_TXCSR_TXPKTRDY); | 573 | | MUSB_TXCSR_TXPKTRDY); |
570 | request->zero = 0; | 574 | request->zero = 0; |
@@ -574,7 +578,7 @@ void musb_g_tx(struct musb *musb, u8 epnum) | |||
574 | musb_g_giveback(musb_ep, request, 0); | 578 | musb_g_giveback(musb_ep, request, 0); |
575 | req = musb_ep->desc ? next_request(musb_ep) : NULL; | 579 | req = musb_ep->desc ? next_request(musb_ep) : NULL; |
576 | if (!req) { | 580 | if (!req) { |
577 | DBG(4, "%s idle now\n", | 581 | dev_dbg(musb->controller, "%s idle now\n", |
578 | musb_ep->end_point.name); | 582 | musb_ep->end_point.name); |
579 | return; | 583 | return; |
580 | } | 584 | } |
@@ -640,12 +644,12 @@ static void rxstate(struct musb *musb, struct musb_request *req) | |||
640 | 644 | ||
641 | /* We shouldn't get here while DMA is active, but we do... */ | 645 | /* We shouldn't get here while DMA is active, but we do... */ |
642 | if (dma_channel_status(musb_ep->dma) == MUSB_DMA_STATUS_BUSY) { | 646 | if (dma_channel_status(musb_ep->dma) == MUSB_DMA_STATUS_BUSY) { |
643 | DBG(4, "DMA pending...\n"); | 647 | dev_dbg(musb->controller, "DMA pending...\n"); |
644 | return; | 648 | return; |
645 | } | 649 | } |
646 | 650 | ||
647 | if (csr & MUSB_RXCSR_P_SENDSTALL) { | 651 | if (csr & MUSB_RXCSR_P_SENDSTALL) { |
648 | DBG(5, "%s stalling, RXCSR %04x\n", | 652 | dev_dbg(musb->controller, "%s stalling, RXCSR %04x\n", |
649 | musb_ep->end_point.name, csr); | 653 | musb_ep->end_point.name, csr); |
650 | return; | 654 | return; |
651 | } | 655 | } |
@@ -757,7 +761,7 @@ static void rxstate(struct musb *musb, struct musb_request *req) | |||
757 | #endif /* Mentor's DMA */ | 761 | #endif /* Mentor's DMA */ |
758 | 762 | ||
759 | fifo_count = request->length - request->actual; | 763 | fifo_count = request->length - request->actual; |
760 | DBG(3, "%s OUT/RX pio fifo %d/%d, maxpacket %d\n", | 764 | dev_dbg(musb->controller, "%s OUT/RX pio fifo %d/%d, maxpacket %d\n", |
761 | musb_ep->end_point.name, | 765 | musb_ep->end_point.name, |
762 | len, fifo_count, | 766 | len, fifo_count, |
763 | musb_ep->packet_sz); | 767 | musb_ep->packet_sz); |
@@ -846,7 +850,7 @@ void musb_g_rx(struct musb *musb, u8 epnum) | |||
846 | csr = musb_readw(epio, MUSB_RXCSR); | 850 | csr = musb_readw(epio, MUSB_RXCSR); |
847 | dma = is_dma_capable() ? musb_ep->dma : NULL; | 851 | dma = is_dma_capable() ? musb_ep->dma : NULL; |
848 | 852 | ||
849 | DBG(4, "<== %s, rxcsr %04x%s %p\n", musb_ep->end_point.name, | 853 | dev_dbg(musb->controller, "<== %s, rxcsr %04x%s %p\n", musb_ep->end_point.name, |
850 | csr, dma ? " (dma)" : "", request); | 854 | csr, dma ? " (dma)" : "", request); |
851 | 855 | ||
852 | if (csr & MUSB_RXCSR_P_SENTSTALL) { | 856 | if (csr & MUSB_RXCSR_P_SENTSTALL) { |
@@ -861,19 +865,18 @@ void musb_g_rx(struct musb *musb, u8 epnum) | |||
861 | csr &= ~MUSB_RXCSR_P_OVERRUN; | 865 | csr &= ~MUSB_RXCSR_P_OVERRUN; |
862 | musb_writew(epio, MUSB_RXCSR, csr); | 866 | musb_writew(epio, MUSB_RXCSR, csr); |
863 | 867 | ||
864 | DBG(3, "%s iso overrun on %p\n", musb_ep->name, request); | 868 | dev_dbg(musb->controller, "%s iso overrun on %p\n", musb_ep->name, request); |
865 | if (request->status == -EINPROGRESS) | 869 | if (request->status == -EINPROGRESS) |
866 | request->status = -EOVERFLOW; | 870 | request->status = -EOVERFLOW; |
867 | } | 871 | } |
868 | if (csr & MUSB_RXCSR_INCOMPRX) { | 872 | if (csr & MUSB_RXCSR_INCOMPRX) { |
869 | /* REVISIT not necessarily an error */ | 873 | /* REVISIT not necessarily an error */ |
870 | DBG(4, "%s, incomprx\n", musb_ep->end_point.name); | 874 | dev_dbg(musb->controller, "%s, incomprx\n", musb_ep->end_point.name); |
871 | } | 875 | } |
872 | 876 | ||
873 | if (dma_channel_status(dma) == MUSB_DMA_STATUS_BUSY) { | 877 | if (dma_channel_status(dma) == MUSB_DMA_STATUS_BUSY) { |
874 | /* "should not happen"; likely RXPKTRDY pending for DMA */ | 878 | /* "should not happen"; likely RXPKTRDY pending for DMA */ |
875 | DBG((csr & MUSB_RXCSR_DMAENAB) ? 4 : 1, | 879 | dev_dbg(musb->controller, "%s busy, csr %04x\n", |
876 | "%s busy, csr %04x\n", | ||
877 | musb_ep->end_point.name, csr); | 880 | musb_ep->end_point.name, csr); |
878 | return; | 881 | return; |
879 | } | 882 | } |
@@ -887,7 +890,7 @@ void musb_g_rx(struct musb *musb, u8 epnum) | |||
887 | 890 | ||
888 | request->actual += musb_ep->dma->actual_len; | 891 | request->actual += musb_ep->dma->actual_len; |
889 | 892 | ||
890 | DBG(4, "RXCSR%d %04x, dma off, %04x, len %zu, req %p\n", | 893 | dev_dbg(musb->controller, "RXCSR%d %04x, dma off, %04x, len %zu, req %p\n", |
891 | epnum, csr, | 894 | epnum, csr, |
892 | musb_readw(epio, MUSB_RXCSR), | 895 | musb_readw(epio, MUSB_RXCSR), |
893 | musb_ep->dma->actual_len, request); | 896 | musb_ep->dma->actual_len, request); |
@@ -978,7 +981,7 @@ static int musb_gadget_enable(struct usb_ep *ep, | |||
978 | ok = musb->hb_iso_rx; | 981 | ok = musb->hb_iso_rx; |
979 | 982 | ||
980 | if (!ok) { | 983 | if (!ok) { |
981 | DBG(4, "no support for high bandwidth ISO\n"); | 984 | dev_dbg(musb->controller, "no support for high bandwidth ISO\n"); |
982 | goto fail; | 985 | goto fail; |
983 | } | 986 | } |
984 | musb_ep->hb_mult = (tmp >> 11) & 3; | 987 | musb_ep->hb_mult = (tmp >> 11) & 3; |
@@ -1002,7 +1005,7 @@ static int musb_gadget_enable(struct usb_ep *ep, | |||
1002 | goto fail; | 1005 | goto fail; |
1003 | 1006 | ||
1004 | if (tmp > hw_ep->max_packet_sz_tx) { | 1007 | if (tmp > hw_ep->max_packet_sz_tx) { |
1005 | DBG(4, "packet size beyond hardware FIFO size\n"); | 1008 | dev_dbg(musb->controller, "packet size beyond hardware FIFO size\n"); |
1006 | goto fail; | 1009 | goto fail; |
1007 | } | 1010 | } |
1008 | 1011 | ||
@@ -1042,7 +1045,7 @@ static int musb_gadget_enable(struct usb_ep *ep, | |||
1042 | goto fail; | 1045 | goto fail; |
1043 | 1046 | ||
1044 | if (tmp > hw_ep->max_packet_sz_rx) { | 1047 | if (tmp > hw_ep->max_packet_sz_rx) { |
1045 | DBG(4, "packet size beyond hardware FIFO size\n"); | 1048 | dev_dbg(musb->controller, "packet size beyond hardware FIFO size\n"); |
1046 | goto fail; | 1049 | goto fail; |
1047 | } | 1050 | } |
1048 | 1051 | ||
@@ -1155,7 +1158,7 @@ static int musb_gadget_disable(struct usb_ep *ep) | |||
1155 | 1158 | ||
1156 | spin_unlock_irqrestore(&(musb->lock), flags); | 1159 | spin_unlock_irqrestore(&(musb->lock), flags); |
1157 | 1160 | ||
1158 | DBG(2, "%s\n", musb_ep->end_point.name); | 1161 | dev_dbg(musb->controller, "%s\n", musb_ep->end_point.name); |
1159 | 1162 | ||
1160 | return status; | 1163 | return status; |
1161 | } | 1164 | } |
@@ -1167,11 +1170,12 @@ static int musb_gadget_disable(struct usb_ep *ep) | |||
1167 | struct usb_request *musb_alloc_request(struct usb_ep *ep, gfp_t gfp_flags) | 1170 | struct usb_request *musb_alloc_request(struct usb_ep *ep, gfp_t gfp_flags) |
1168 | { | 1171 | { |
1169 | struct musb_ep *musb_ep = to_musb_ep(ep); | 1172 | struct musb_ep *musb_ep = to_musb_ep(ep); |
1173 | struct musb *musb = musb_ep->musb; | ||
1170 | struct musb_request *request = NULL; | 1174 | struct musb_request *request = NULL; |
1171 | 1175 | ||
1172 | request = kzalloc(sizeof *request, gfp_flags); | 1176 | request = kzalloc(sizeof *request, gfp_flags); |
1173 | if (!request) { | 1177 | if (!request) { |
1174 | DBG(4, "not enough memory\n"); | 1178 | dev_dbg(musb->controller, "not enough memory\n"); |
1175 | return NULL; | 1179 | return NULL; |
1176 | } | 1180 | } |
1177 | 1181 | ||
@@ -1205,7 +1209,7 @@ struct free_record { | |||
1205 | */ | 1209 | */ |
1206 | void musb_ep_restart(struct musb *musb, struct musb_request *req) | 1210 | void musb_ep_restart(struct musb *musb, struct musb_request *req) |
1207 | { | 1211 | { |
1208 | DBG(3, "<== %s request %p len %u on hw_ep%d\n", | 1212 | dev_dbg(musb->controller, "<== %s request %p len %u on hw_ep%d\n", |
1209 | req->tx ? "TX/IN" : "RX/OUT", | 1213 | req->tx ? "TX/IN" : "RX/OUT", |
1210 | &req->request, req->request.length, req->epnum); | 1214 | &req->request, req->request.length, req->epnum); |
1211 | 1215 | ||
@@ -1239,7 +1243,7 @@ static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req, | |||
1239 | if (request->ep != musb_ep) | 1243 | if (request->ep != musb_ep) |
1240 | return -EINVAL; | 1244 | return -EINVAL; |
1241 | 1245 | ||
1242 | DBG(4, "<== to %s request=%p\n", ep->name, req); | 1246 | dev_dbg(musb->controller, "<== to %s request=%p\n", ep->name, req); |
1243 | 1247 | ||
1244 | /* request is mine now... */ | 1248 | /* request is mine now... */ |
1245 | request->request.actual = 0; | 1249 | request->request.actual = 0; |
@@ -1253,7 +1257,7 @@ static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req, | |||
1253 | 1257 | ||
1254 | /* don't queue if the ep is down */ | 1258 | /* don't queue if the ep is down */ |
1255 | if (!musb_ep->desc) { | 1259 | if (!musb_ep->desc) { |
1256 | DBG(4, "req %p queued to %s while ep %s\n", | 1260 | dev_dbg(musb->controller, "req %p queued to %s while ep %s\n", |
1257 | req, ep->name, "disabled"); | 1261 | req, ep->name, "disabled"); |
1258 | status = -ESHUTDOWN; | 1262 | status = -ESHUTDOWN; |
1259 | goto cleanup; | 1263 | goto cleanup; |
@@ -1290,7 +1294,7 @@ static int musb_gadget_dequeue(struct usb_ep *ep, struct usb_request *request) | |||
1290 | break; | 1294 | break; |
1291 | } | 1295 | } |
1292 | if (r != req) { | 1296 | if (r != req) { |
1293 | DBG(3, "request %p not queued to %s\n", request, ep->name); | 1297 | dev_dbg(musb->controller, "request %p not queued to %s\n", request, ep->name); |
1294 | status = -EINVAL; | 1298 | status = -EINVAL; |
1295 | goto done; | 1299 | goto done; |
1296 | } | 1300 | } |
@@ -1356,7 +1360,7 @@ static int musb_gadget_set_halt(struct usb_ep *ep, int value) | |||
1356 | request = next_request(musb_ep); | 1360 | request = next_request(musb_ep); |
1357 | if (value) { | 1361 | if (value) { |
1358 | if (request) { | 1362 | if (request) { |
1359 | DBG(3, "request in progress, cannot halt %s\n", | 1363 | dev_dbg(musb->controller, "request in progress, cannot halt %s\n", |
1360 | ep->name); | 1364 | ep->name); |
1361 | status = -EAGAIN; | 1365 | status = -EAGAIN; |
1362 | goto done; | 1366 | goto done; |
@@ -1365,7 +1369,7 @@ static int musb_gadget_set_halt(struct usb_ep *ep, int value) | |||
1365 | if (musb_ep->is_in) { | 1369 | if (musb_ep->is_in) { |
1366 | csr = musb_readw(epio, MUSB_TXCSR); | 1370 | csr = musb_readw(epio, MUSB_TXCSR); |
1367 | if (csr & MUSB_TXCSR_FIFONOTEMPTY) { | 1371 | if (csr & MUSB_TXCSR_FIFONOTEMPTY) { |
1368 | DBG(3, "FIFO busy, cannot halt %s\n", ep->name); | 1372 | dev_dbg(musb->controller, "FIFO busy, cannot halt %s\n", ep->name); |
1369 | status = -EAGAIN; | 1373 | status = -EAGAIN; |
1370 | goto done; | 1374 | goto done; |
1371 | } | 1375 | } |
@@ -1374,7 +1378,7 @@ static int musb_gadget_set_halt(struct usb_ep *ep, int value) | |||
1374 | musb_ep->wedged = 0; | 1378 | musb_ep->wedged = 0; |
1375 | 1379 | ||
1376 | /* set/clear the stall and toggle bits */ | 1380 | /* set/clear the stall and toggle bits */ |
1377 | DBG(2, "%s: %s stall\n", ep->name, value ? "set" : "clear"); | 1381 | dev_dbg(musb->controller, "%s: %s stall\n", ep->name, value ? "set" : "clear"); |
1378 | if (musb_ep->is_in) { | 1382 | if (musb_ep->is_in) { |
1379 | csr = musb_readw(epio, MUSB_TXCSR); | 1383 | csr = musb_readw(epio, MUSB_TXCSR); |
1380 | csr |= MUSB_TXCSR_P_WZC_BITS | 1384 | csr |= MUSB_TXCSR_P_WZC_BITS |
@@ -1401,7 +1405,7 @@ static int musb_gadget_set_halt(struct usb_ep *ep, int value) | |||
1401 | 1405 | ||
1402 | /* maybe start the first request in the queue */ | 1406 | /* maybe start the first request in the queue */ |
1403 | if (!musb_ep->busy && !value && request) { | 1407 | if (!musb_ep->busy && !value && request) { |
1404 | DBG(3, "restarting the request\n"); | 1408 | dev_dbg(musb->controller, "restarting the request\n"); |
1405 | musb_ep_restart(musb, request); | 1409 | musb_ep_restart(musb, request); |
1406 | } | 1410 | } |
1407 | 1411 | ||
@@ -1532,7 +1536,7 @@ static int musb_gadget_wakeup(struct usb_gadget *gadget) | |||
1532 | case OTG_STATE_B_IDLE: | 1536 | case OTG_STATE_B_IDLE: |
1533 | /* Start SRP ... OTG not required. */ | 1537 | /* Start SRP ... OTG not required. */ |
1534 | devctl = musb_readb(mregs, MUSB_DEVCTL); | 1538 | devctl = musb_readb(mregs, MUSB_DEVCTL); |
1535 | DBG(2, "Sending SRP: devctl: %02x\n", devctl); | 1539 | dev_dbg(musb->controller, "Sending SRP: devctl: %02x\n", devctl); |
1536 | devctl |= MUSB_DEVCTL_SESSION; | 1540 | devctl |= MUSB_DEVCTL_SESSION; |
1537 | musb_writeb(mregs, MUSB_DEVCTL, devctl); | 1541 | musb_writeb(mregs, MUSB_DEVCTL, devctl); |
1538 | devctl = musb_readb(mregs, MUSB_DEVCTL); | 1542 | devctl = musb_readb(mregs, MUSB_DEVCTL); |
@@ -1556,7 +1560,7 @@ static int musb_gadget_wakeup(struct usb_gadget *gadget) | |||
1556 | status = 0; | 1560 | status = 0; |
1557 | goto done; | 1561 | goto done; |
1558 | default: | 1562 | default: |
1559 | DBG(2, "Unhandled wake: %s\n", | 1563 | dev_dbg(musb->controller, "Unhandled wake: %s\n", |
1560 | otg_state_string(musb->xceiv->state)); | 1564 | otg_state_string(musb->xceiv->state)); |
1561 | goto done; | 1565 | goto done; |
1562 | } | 1566 | } |
@@ -1566,7 +1570,7 @@ static int musb_gadget_wakeup(struct usb_gadget *gadget) | |||
1566 | power = musb_readb(mregs, MUSB_POWER); | 1570 | power = musb_readb(mregs, MUSB_POWER); |
1567 | power |= MUSB_POWER_RESUME; | 1571 | power |= MUSB_POWER_RESUME; |
1568 | musb_writeb(mregs, MUSB_POWER, power); | 1572 | musb_writeb(mregs, MUSB_POWER, power); |
1569 | DBG(2, "issue wakeup\n"); | 1573 | dev_dbg(musb->controller, "issue wakeup\n"); |
1570 | 1574 | ||
1571 | /* FIXME do this next chunk in a timer callback, no udelay */ | 1575 | /* FIXME do this next chunk in a timer callback, no udelay */ |
1572 | mdelay(2); | 1576 | mdelay(2); |
@@ -1600,7 +1604,7 @@ static void musb_pullup(struct musb *musb, int is_on) | |||
1600 | 1604 | ||
1601 | /* FIXME if on, HdrcStart; if off, HdrcStop */ | 1605 | /* FIXME if on, HdrcStart; if off, HdrcStop */ |
1602 | 1606 | ||
1603 | DBG(3, "gadget %s D+ pullup %s\n", | 1607 | dev_dbg(musb->controller, "gadget %s D+ pullup %s\n", |
1604 | musb->gadget_driver->function, is_on ? "on" : "off"); | 1608 | musb->gadget_driver->function, is_on ? "on" : "off"); |
1605 | musb_writeb(musb->mregs, MUSB_POWER, power); | 1609 | musb_writeb(musb->mregs, MUSB_POWER, power); |
1606 | } | 1610 | } |
@@ -1608,7 +1612,7 @@ static void musb_pullup(struct musb *musb, int is_on) | |||
1608 | #if 0 | 1612 | #if 0 |
1609 | static int musb_gadget_vbus_session(struct usb_gadget *gadget, int is_active) | 1613 | static int musb_gadget_vbus_session(struct usb_gadget *gadget, int is_active) |
1610 | { | 1614 | { |
1611 | DBG(2, "<= %s =>\n", __func__); | 1615 | dev_dbg(musb->controller, "<= %s =>\n", __func__); |
1612 | 1616 | ||
1613 | /* | 1617 | /* |
1614 | * FIXME iff driver's softconnect flag is set (as it is during probe, | 1618 | * FIXME iff driver's softconnect flag is set (as it is during probe, |
@@ -1817,17 +1821,17 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | |||
1817 | 1821 | ||
1818 | /* driver must be initialized to support peripheral mode */ | 1822 | /* driver must be initialized to support peripheral mode */ |
1819 | if (!musb) { | 1823 | if (!musb) { |
1820 | DBG(1, "no dev??\n"); | 1824 | dev_dbg(musb->controller, "no dev??\n"); |
1821 | retval = -ENODEV; | 1825 | retval = -ENODEV; |
1822 | goto err0; | 1826 | goto err0; |
1823 | } | 1827 | } |
1824 | 1828 | ||
1825 | pm_runtime_get_sync(musb->controller); | 1829 | pm_runtime_get_sync(musb->controller); |
1826 | 1830 | ||
1827 | DBG(3, "registering driver %s\n", driver->function); | 1831 | dev_dbg(musb->controller, "registering driver %s\n", driver->function); |
1828 | 1832 | ||
1829 | if (musb->gadget_driver) { | 1833 | if (musb->gadget_driver) { |
1830 | DBG(1, "%s is already bound to %s\n", | 1834 | dev_dbg(musb->controller, "%s is already bound to %s\n", |
1831 | musb_driver_name, | 1835 | musb_driver_name, |
1832 | musb->gadget_driver->driver.name); | 1836 | musb->gadget_driver->driver.name); |
1833 | retval = -EBUSY; | 1837 | retval = -EBUSY; |
@@ -1843,7 +1847,7 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | |||
1843 | 1847 | ||
1844 | retval = bind(&musb->g); | 1848 | retval = bind(&musb->g); |
1845 | if (retval) { | 1849 | if (retval) { |
1846 | DBG(3, "bind to driver %s failed --> %d\n", | 1850 | dev_dbg(musb->controller, "bind to driver %s failed --> %d\n", |
1847 | driver->driver.name, retval); | 1851 | driver->driver.name, retval); |
1848 | goto err1; | 1852 | goto err1; |
1849 | } | 1853 | } |
@@ -1871,7 +1875,7 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | |||
1871 | if (is_otg_enabled(musb)) { | 1875 | if (is_otg_enabled(musb)) { |
1872 | struct usb_hcd *hcd = musb_to_hcd(musb); | 1876 | struct usb_hcd *hcd = musb_to_hcd(musb); |
1873 | 1877 | ||
1874 | DBG(3, "OTG startup...\n"); | 1878 | dev_dbg(musb->controller, "OTG startup...\n"); |
1875 | 1879 | ||
1876 | /* REVISIT: funcall to other code, which also | 1880 | /* REVISIT: funcall to other code, which also |
1877 | * handles power budgeting ... this way also | 1881 | * handles power budgeting ... this way also |
@@ -1879,7 +1883,7 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | |||
1879 | */ | 1883 | */ |
1880 | retval = usb_add_hcd(musb_to_hcd(musb), -1, 0); | 1884 | retval = usb_add_hcd(musb_to_hcd(musb), -1, 0); |
1881 | if (retval < 0) { | 1885 | if (retval < 0) { |
1882 | DBG(1, "add_hcd failed, %d\n", retval); | 1886 | dev_dbg(musb->controller, "add_hcd failed, %d\n", retval); |
1883 | goto err2; | 1887 | goto err2; |
1884 | } | 1888 | } |
1885 | 1889 | ||
@@ -1986,7 +1990,7 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | |||
1986 | stop_activity(musb, driver); | 1990 | stop_activity(musb, driver); |
1987 | otg_set_peripheral(musb->xceiv, NULL); | 1991 | otg_set_peripheral(musb->xceiv, NULL); |
1988 | 1992 | ||
1989 | DBG(3, "unregistering driver %s\n", driver->function); | 1993 | dev_dbg(musb->controller, "unregistering driver %s\n", driver->function); |
1990 | 1994 | ||
1991 | spin_unlock_irqrestore(&musb->lock, flags); | 1995 | spin_unlock_irqrestore(&musb->lock, flags); |
1992 | driver->unbind(&musb->g); | 1996 | driver->unbind(&musb->g); |
@@ -2048,7 +2052,7 @@ void musb_g_suspend(struct musb *musb) | |||
2048 | u8 devctl; | 2052 | u8 devctl; |
2049 | 2053 | ||
2050 | devctl = musb_readb(musb->mregs, MUSB_DEVCTL); | 2054 | devctl = musb_readb(musb->mregs, MUSB_DEVCTL); |
2051 | DBG(3, "devctl %02x\n", devctl); | 2055 | dev_dbg(musb->controller, "devctl %02x\n", devctl); |
2052 | 2056 | ||
2053 | switch (musb->xceiv->state) { | 2057 | switch (musb->xceiv->state) { |
2054 | case OTG_STATE_B_IDLE: | 2058 | case OTG_STATE_B_IDLE: |
@@ -2084,7 +2088,7 @@ void musb_g_disconnect(struct musb *musb) | |||
2084 | void __iomem *mregs = musb->mregs; | 2088 | void __iomem *mregs = musb->mregs; |
2085 | u8 devctl = musb_readb(mregs, MUSB_DEVCTL); | 2089 | u8 devctl = musb_readb(mregs, MUSB_DEVCTL); |
2086 | 2090 | ||
2087 | DBG(3, "devctl %02x\n", devctl); | 2091 | dev_dbg(musb->controller, "devctl %02x\n", devctl); |
2088 | 2092 | ||
2089 | /* clear HR */ | 2093 | /* clear HR */ |
2090 | musb_writeb(mregs, MUSB_DEVCTL, devctl & MUSB_DEVCTL_SESSION); | 2094 | musb_writeb(mregs, MUSB_DEVCTL, devctl & MUSB_DEVCTL_SESSION); |
@@ -2102,7 +2106,7 @@ void musb_g_disconnect(struct musb *musb) | |||
2102 | switch (musb->xceiv->state) { | 2106 | switch (musb->xceiv->state) { |
2103 | default: | 2107 | default: |
2104 | #ifdef CONFIG_USB_MUSB_OTG | 2108 | #ifdef CONFIG_USB_MUSB_OTG |
2105 | DBG(2, "Unhandled disconnect %s, setting a_idle\n", | 2109 | dev_dbg(musb->controller, "Unhandled disconnect %s, setting a_idle\n", |
2106 | otg_state_string(musb->xceiv->state)); | 2110 | otg_state_string(musb->xceiv->state)); |
2107 | musb->xceiv->state = OTG_STATE_A_IDLE; | 2111 | musb->xceiv->state = OTG_STATE_A_IDLE; |
2108 | MUSB_HST_MODE(musb); | 2112 | MUSB_HST_MODE(musb); |
@@ -2133,7 +2137,7 @@ __acquires(musb->lock) | |||
2133 | u8 devctl = musb_readb(mbase, MUSB_DEVCTL); | 2137 | u8 devctl = musb_readb(mbase, MUSB_DEVCTL); |
2134 | u8 power; | 2138 | u8 power; |
2135 | 2139 | ||
2136 | DBG(3, "<== %s addr=%x driver '%s'\n", | 2140 | dev_dbg(musb->controller, "<== %s addr=%x driver '%s'\n", |
2137 | (devctl & MUSB_DEVCTL_BDEVICE) | 2141 | (devctl & MUSB_DEVCTL_BDEVICE) |
2138 | ? "B-Device" : "A-Device", | 2142 | ? "B-Device" : "A-Device", |
2139 | musb_readb(mbase, MUSB_FADDR), | 2143 | musb_readb(mbase, MUSB_FADDR), |