aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>2014-05-20 12:30:11 -0400
committerFelipe Balbi <balbi@ti.com>2014-06-30 13:33:35 -0400
commite56e69cc0ff4905914695f20c927aa71597be94c (patch)
tree755a4d0a2b8ba83d780e75a326ab75887d65fce8
parentae8e530a7e5d87592cb23996bee7fd6f1eb202ed (diff)
usb: gadget: net2280: Use pr_* function
Driver was using custom functions WARNING, ERROR, DEBUG, instead of pr_err, pr_dgb... New ep_* macros have been created that use standard pr_* functions. Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r--drivers/usb/gadget/net2280.c121
-rw-r--r--drivers/usb/gadget/net2280.h36
2 files changed, 71 insertions, 86 deletions
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c
index d506c83d204a..9ced9ff901e9 100644
--- a/drivers/usb/gadget/net2280.c
+++ b/drivers/usb/gadget/net2280.c
@@ -42,9 +42,6 @@
42 * (at your option) any later version. 42 * (at your option) any later version.
43 */ 43 */
44 44
45#undef DEBUG /* messages on error and most fault paths */
46#undef VERBOSE /* extra debug messages (success too) */
47
48#include <linux/module.h> 45#include <linux/module.h>
49#include <linux/pci.h> 46#include <linux/pci.h>
50#include <linux/dma-mapping.h> 47#include <linux/dma-mapping.h>
@@ -210,7 +207,7 @@ net2280_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)
210 * use it instead of troublesome (non-bulk) multi-packet DMA. 207 * use it instead of troublesome (non-bulk) multi-packet DMA.
211 */ 208 */
212 if (ep->dma && (max % 4) != 0 && use_dma_chaining) { 209 if (ep->dma && (max % 4) != 0 && use_dma_chaining) {
213 DEBUG(ep->dev, "%s, no dma for maxpacket %d\n", 210 ep_dbg(ep->dev, "%s, no dma for maxpacket %d\n",
214 ep->ep.name, ep->ep.maxpacket); 211 ep->ep.name, ep->ep.maxpacket);
215 ep->dma = NULL; 212 ep->dma = NULL;
216 } 213 }
@@ -303,7 +300,7 @@ net2280_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)
303 } 300 }
304 301
305 tmp = desc->bEndpointAddress; 302 tmp = desc->bEndpointAddress;
306 DEBUG(dev, "enabled %s (ep%d%s-%s) %s max %04x\n", 303 ep_dbg(dev, "enabled %s (ep%d%s-%s) %s max %04x\n",
307 _ep->name, tmp & 0x0f, DIR_STRING(tmp), 304 _ep->name, tmp & 0x0f, DIR_STRING(tmp),
308 type_string(desc->bmAttributes), 305 type_string(desc->bmAttributes),
309 ep->dma ? "dma" : "pio", max); 306 ep->dma ? "dma" : "pio", max);
@@ -431,7 +428,7 @@ static void ep_reset_338x(struct net2280_regs __iomem *regs,
431 428
432 dmastat = readl(&ep->dma->dmastat); 429 dmastat = readl(&ep->dma->dmastat);
433 if (dmastat == 0x5002) { 430 if (dmastat == 0x5002) {
434 WARNING(ep->dev, "The dmastat return = %x!!\n", 431 ep_warn(ep->dev, "The dmastat return = %x!!\n",
435 dmastat); 432 dmastat);
436 writel(0x5a, &ep->dma->dmastat); 433 writel(0x5a, &ep->dma->dmastat);
437 } 434 }
@@ -476,7 +473,7 @@ static int net2280_disable(struct usb_ep *_ep)
476 else 473 else
477 ep_reset_228x(ep->dev->regs, ep); 474 ep_reset_228x(ep->dev->regs, ep);
478 475
479 VDEBUG(ep->dev, "disabled %s %s\n", 476 ep_vdbg(ep->dev, "disabled %s %s\n",
480 ep->dma ? "dma" : "pio", _ep->name); 477 ep->dma ? "dma" : "pio", _ep->name);
481 478
482 /* synch memory views with the device */ 479 /* synch memory views with the device */
@@ -572,7 +569,7 @@ static void write_fifo(struct net2280_ep *ep, struct usb_request *req)
572 if (count > total) /* min() cannot be used on a bitfield */ 569 if (count > total) /* min() cannot be used on a bitfield */
573 count = total; 570 count = total;
574 571
575 VDEBUG(ep->dev, "write %s fifo (IN) %d bytes%s req %p\n", 572 ep_vdbg(ep->dev, "write %s fifo (IN) %d bytes%s req %p\n",
576 ep->ep.name, count, 573 ep->ep.name, count,
577 (count != ep->ep.maxpacket) ? " (short)" : "", 574 (count != ep->ep.maxpacket) ? " (short)" : "",
578 req); 575 req);
@@ -684,7 +681,7 @@ static int read_fifo(struct net2280_ep *ep, struct net2280_request *req)
684 if (count > tmp) { 681 if (count > tmp) {
685 /* as with DMA, data overflow gets flushed */ 682 /* as with DMA, data overflow gets flushed */
686 if ((tmp % ep->ep.maxpacket) != 0) { 683 if ((tmp % ep->ep.maxpacket) != 0) {
687 ERROR(ep->dev, 684 ep_err(ep->dev,
688 "%s out fifo %d bytes, expected %d\n", 685 "%s out fifo %d bytes, expected %d\n",
689 ep->ep.name, count, tmp); 686 ep->ep.name, count, tmp);
690 req->req.status = -EOVERFLOW; 687 req->req.status = -EOVERFLOW;
@@ -699,7 +696,7 @@ static int read_fifo(struct net2280_ep *ep, struct net2280_request *req)
699 696
700 is_short = (count == 0) || ((count % ep->ep.maxpacket) != 0); 697 is_short = (count == 0) || ((count % ep->ep.maxpacket) != 0);
701 698
702 VDEBUG(ep->dev, "read %s fifo (OUT) %d bytes%s%s%s req %p %d/%d\n", 699 ep_vdbg(ep->dev, "read %s fifo (OUT) %d bytes%s%s%s req %p %d/%d\n",
703 ep->ep.name, count, is_short ? " (short)" : "", 700 ep->ep.name, count, is_short ? " (short)" : "",
704 cleanup ? " flush" : "", prevent ? " nak" : "", 701 cleanup ? " flush" : "", prevent ? " nak" : "",
705 req, req->req.actual, req->req.length); 702 req, req->req.actual, req->req.length);
@@ -925,7 +922,7 @@ done(struct net2280_ep *ep, struct net2280_request *req, int status)
925 usb_gadget_unmap_request(&dev->gadget, &req->req, ep->is_in); 922 usb_gadget_unmap_request(&dev->gadget, &req->req, ep->is_in);
926 923
927 if (status && status != -ESHUTDOWN) 924 if (status && status != -ESHUTDOWN)
928 VDEBUG(dev, "complete %s req %p stat %d len %u/%u\n", 925 ep_vdbg(dev, "complete %s req %p stat %d len %u/%u\n",
929 ep->ep.name, &req->req, status, 926 ep->ep.name, &req->req, status,
930 req->req.actual, req->req.length); 927 req->req.actual, req->req.length);
931 928
@@ -978,7 +975,7 @@ net2280_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
978 } 975 }
979 976
980#if 0 977#if 0
981 VDEBUG(dev, "%s queue req %p, len %d buf %p\n", 978 ep_vdbg(dev, "%s queue req %p, len %d buf %p\n",
982 _ep->name, _req, _req->length, _req->buf); 979 _ep->name, _req, _req->length, _req->buf);
983#endif 980#endif
984 981
@@ -1012,7 +1009,7 @@ net2280_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
1012 if (ep->num == 0 && _req->length == 0) { 1009 if (ep->num == 0 && _req->length == 0) {
1013 allow_status(ep); 1010 allow_status(ep);
1014 done(ep, req, 0); 1011 done(ep, req, 0);
1015 VDEBUG(dev, "%s status ack\n", ep->ep.name); 1012 ep_vdbg(dev, "%s status ack\n", ep->ep.name);
1016 goto done; 1013 goto done;
1017 } 1014 }
1018 1015
@@ -1131,7 +1128,7 @@ static void scan_dma_completions(struct net2280_ep *ep)
1131 * 0122, and 0124; not all cases trigger the warning. 1128 * 0122, and 0124; not all cases trigger the warning.
1132 */ 1129 */
1133 if ((tmp & BIT(NAK_OUT_PACKETS)) == 0) { 1130 if ((tmp & BIT(NAK_OUT_PACKETS)) == 0) {
1134 WARNING(ep->dev, "%s lost packet sync!\n", 1131 ep_warn(ep->dev, "%s lost packet sync!\n",
1135 ep->ep.name); 1132 ep->ep.name);
1136 req->req.status = -EOVERFLOW; 1133 req->req.status = -EOVERFLOW;
1137 } else { 1134 } else {
@@ -1139,7 +1136,7 @@ static void scan_dma_completions(struct net2280_ep *ep)
1139 if (tmp) { 1136 if (tmp) {
1140 /* fifo gets flushed later */ 1137 /* fifo gets flushed later */
1141 ep->out_overflow = 1; 1138 ep->out_overflow = 1;
1142 DEBUG(ep->dev, 1139 ep_dbg(ep->dev,
1143 "%s dma, discard %d len %d\n", 1140 "%s dma, discard %d len %d\n",
1144 ep->ep.name, tmp, 1141 ep->ep.name, tmp,
1145 req->req.length); 1142 req->req.length);
@@ -1175,7 +1172,7 @@ static void restart_dma(struct net2280_ep *ep)
1175 struct net2280_request *entry, *prev = NULL; 1172 struct net2280_request *entry, *prev = NULL;
1176 int reqmode, done = 0; 1173 int reqmode, done = 0;
1177 1174
1178 DEBUG(ep->dev, "%s dma hiccup td %p\n", ep->ep.name, req->td); 1175 ep_dbg(ep->dev, "%s dma hiccup td %p\n", ep->ep.name, req->td);
1179 ep->in_fifo_validate = likely(req->req.zero || 1176 ep->in_fifo_validate = likely(req->req.zero ||
1180 (req->req.length % ep->ep.maxpacket) != 0); 1177 (req->req.length % ep->ep.maxpacket) != 0);
1181 if (ep->in_fifo_validate) 1178 if (ep->in_fifo_validate)
@@ -1295,7 +1292,7 @@ static int net2280_dequeue(struct usb_ep *_ep, struct usb_request *_req)
1295 /* queue head may be partially complete. */ 1292 /* queue head may be partially complete. */
1296 if (ep->queue.next == &req->queue) { 1293 if (ep->queue.next == &req->queue) {
1297 if (ep->dma) { 1294 if (ep->dma) {
1298 DEBUG(ep->dev, "unlink (%s) dma\n", _ep->name); 1295 ep_dbg(ep->dev, "unlink (%s) dma\n", _ep->name);
1299 _req->status = -ECONNRESET; 1296 _req->status = -ECONNRESET;
1300 abort_dma(ep); 1297 abort_dma(ep);
1301 if (likely(ep->queue.next == &req->queue)) { 1298 if (likely(ep->queue.next == &req->queue)) {
@@ -1306,7 +1303,7 @@ static int net2280_dequeue(struct usb_ep *_ep, struct usb_request *_req)
1306 -ECONNRESET); 1303 -ECONNRESET);
1307 } 1304 }
1308 } else { 1305 } else {
1309 DEBUG(ep->dev, "unlink (%s) pio\n", _ep->name); 1306 ep_dbg(ep->dev, "unlink (%s) pio\n", _ep->name);
1310 done(ep, req, -ECONNRESET); 1307 done(ep, req, -ECONNRESET);
1311 } 1308 }
1312 req = NULL; 1309 req = NULL;
@@ -1379,7 +1376,7 @@ net2280_set_halt_and_wedge(struct usb_ep *_ep, int value, int wedged)
1379 else if (ep->is_in && value && net2280_fifo_status(_ep) != 0) 1376 else if (ep->is_in && value && net2280_fifo_status(_ep) != 0)
1380 retval = -EAGAIN; 1377 retval = -EAGAIN;
1381 else { 1378 else {
1382 VDEBUG(ep->dev, "%s %s %s\n", _ep->name, 1379 ep_vdbg(ep->dev, "%s %s %s\n", _ep->name,
1383 value ? "set" : "clear", 1380 value ? "set" : "clear",
1384 wedged ? "wedge" : "halt"); 1381 wedged ? "wedge" : "halt");
1385 /* set/clear, then synch memory views with the device */ 1382 /* set/clear, then synch memory views with the device */
@@ -1566,7 +1563,7 @@ static const struct usb_gadget_ops net2280_ops = {
1566 1563
1567/*-------------------------------------------------------------------------*/ 1564/*-------------------------------------------------------------------------*/
1568 1565
1569#ifdef CONFIG_USB_GADGET_DEBUG_FILES 1566#ifdef CONFIG_USB_GADGET_PDEBUG_FILES
1570 1567
1571/* FIXME move these into procfs, and use seq_file. 1568/* FIXME move these into procfs, and use seq_file.
1572 * Sysfs _still_ doesn't behave for arbitrarily sized files, 1569 * Sysfs _still_ doesn't behave for arbitrarily sized files,
@@ -1928,8 +1925,8 @@ static void defect7374_enable_data_eps_zero(struct net2280 *dev)
1928 1925
1929 /*See if firmware needs to set up for workaround*/ 1926 /*See if firmware needs to set up for workaround*/
1930 if (fsmvalue != DEFECT7374_FSM_SS_CONTROL_READ) { 1927 if (fsmvalue != DEFECT7374_FSM_SS_CONTROL_READ) {
1931 WARNING(dev, "Operate Defect 7374 workaround soft this time"); 1928 ep_warn(dev, "Operate Defect 7374 workaround soft this time");
1932 WARNING(dev, "It will operate on cold-reboot and SS connect"); 1929 ep_warn(dev, "It will operate on cold-reboot and SS connect");
1933 1930
1934 /*GPEPs:*/ 1931 /*GPEPs:*/
1935 tmp = ((0 << ENDPOINT_NUMBER) | BIT(ENDPOINT_DIRECTION) | 1932 tmp = ((0 << ENDPOINT_NUMBER) | BIT(ENDPOINT_DIRECTION) |
@@ -1985,8 +1982,8 @@ static void defect7374_enable_data_eps_zero(struct net2280 *dev)
1985 set_idx_reg(dev->regs, SCRATCH, scratch); 1982 set_idx_reg(dev->regs, SCRATCH, scratch);
1986 1983
1987 } else{ 1984 } else{
1988 WARNING(dev, "Defect 7374 workaround soft will NOT operate"); 1985 ep_warn(dev, "Defect 7374 workaround soft will NOT operate");
1989 WARNING(dev, "It will operate on cold-reboot and SS connect"); 1986 ep_warn(dev, "It will operate on cold-reboot and SS connect");
1990 } 1987 }
1991} 1988}
1992 1989
@@ -2050,7 +2047,7 @@ static void usb_reset_338x(struct net2280 *dev)
2050 2047
2051 /* See if firmware needs to set up for workaround: */ 2048 /* See if firmware needs to set up for workaround: */
2052 if (fsmvalue != DEFECT7374_FSM_SS_CONTROL_READ) { 2049 if (fsmvalue != DEFECT7374_FSM_SS_CONTROL_READ) {
2053 INFO(dev, "%s: Defect 7374 FsmValue 0x%08x\n", __func__, 2050 ep_info(dev, "%s: Defect 7374 FsmValue 0x%08x\n", __func__,
2054 fsmvalue); 2051 fsmvalue);
2055 } else { 2052 } else {
2056 /* disable automatic responses, and irqs */ 2053 /* disable automatic responses, and irqs */
@@ -2187,7 +2184,7 @@ static void usb_reinit_338x(struct net2280 *dev)
2187 2184
2188 /* See if driver needs to set up for workaround: */ 2185 /* See if driver needs to set up for workaround: */
2189 if (fsmvalue != DEFECT7374_FSM_SS_CONTROL_READ) 2186 if (fsmvalue != DEFECT7374_FSM_SS_CONTROL_READ)
2190 INFO(dev, "%s: Defect 7374 FsmValue %08x\n", 2187 ep_info(dev, "%s: Defect 7374 FsmValue %08x\n",
2191 __func__, fsmvalue); 2188 __func__, fsmvalue);
2192 else { 2189 else {
2193 tmp = readl(&dev->usb_ext->usbctl2) & 2190 tmp = readl(&dev->usb_ext->usbctl2) &
@@ -2302,7 +2299,7 @@ static void ep0_start_338x(struct net2280 *dev)
2302 (0xf << DEFECT7374_FSM_FIELD); 2299 (0xf << DEFECT7374_FSM_FIELD);
2303 2300
2304 if (fsmvalue != DEFECT7374_FSM_SS_CONTROL_READ) 2301 if (fsmvalue != DEFECT7374_FSM_SS_CONTROL_READ)
2305 INFO(dev, "%s: Defect 7374 FsmValue %08x\n", __func__, 2302 ep_info(dev, "%s: Defect 7374 FsmValue %08x\n", __func__,
2306 fsmvalue); 2303 fsmvalue);
2307 else 2304 else
2308 writel(BIT(CLEAR_NAK_OUT_PACKETS_MODE) | 2305 writel(BIT(CLEAR_NAK_OUT_PACKETS_MODE) |
@@ -2401,7 +2398,7 @@ static int net2280_start(struct usb_gadget *_gadget,
2401 2398
2402 ep0_start(dev); 2399 ep0_start(dev);
2403 2400
2404 DEBUG(dev, "%s ready, usbctl %08x stdrsp %08x\n", 2401 ep_dbg(dev, "%s ready, usbctl %08x stdrsp %08x\n",
2405 driver->driver.name, 2402 driver->driver.name,
2406 readl(&dev->usb->usbctl), 2403 readl(&dev->usb->usbctl),
2407 readl(&dev->usb->stdrsp)); 2404 readl(&dev->usb->stdrsp));
@@ -2464,7 +2461,7 @@ static int net2280_stop(struct usb_gadget *_gadget,
2464 device_remove_file(&dev->pdev->dev, &dev_attr_function); 2461 device_remove_file(&dev->pdev->dev, &dev_attr_function);
2465 device_remove_file(&dev->pdev->dev, &dev_attr_queues); 2462 device_remove_file(&dev->pdev->dev, &dev_attr_queues);
2466 2463
2467 DEBUG(dev, "unregistered driver '%s'\n", 2464 ep_dbg(dev, "unregistered driver '%s'\n",
2468 driver ? driver->driver.name : ""); 2465 driver ? driver->driver.name : "");
2469 2466
2470 return 0; 2467 return 0;
@@ -2493,7 +2490,7 @@ static void handle_ep_small(struct net2280_ep *ep)
2493 t = readl(&ep->regs->ep_stat); 2490 t = readl(&ep->regs->ep_stat);
2494 ep->irqs++; 2491 ep->irqs++;
2495#if 0 2492#if 0
2496 VDEBUG(ep->dev, "%s ack ep_stat %08x, req %p\n", 2493 ep_vdbg(ep->dev, "%s ack ep_stat %08x, req %p\n",
2497 ep->ep.name, t, req ? &req->req : 0); 2494 ep->ep.name, t, req ? &req->req : 0);
2498#endif 2495#endif
2499 if (!ep->is_in || ep->dev->pdev->device == 0x2280) 2496 if (!ep->is_in || ep->dev->pdev->device == 0x2280)
@@ -2624,7 +2621,7 @@ static void handle_ep_small(struct net2280_ep *ep)
2624 if (!list_empty(&ep->queue)) 2621 if (!list_empty(&ep->queue))
2625 restart_dma(ep); 2622 restart_dma(ep);
2626 } else 2623 } else
2627 DEBUG(ep->dev, "%s dma ep_stat %08x ??\n", 2624 ep_dbg(ep->dev, "%s dma ep_stat %08x ??\n",
2628 ep->ep.name, t); 2625 ep->ep.name, t);
2629 return; 2626 return;
2630 2627
@@ -2758,12 +2755,12 @@ static void defect7374_workaround(struct net2280 *dev, struct usb_ctrlrequest r)
2758 2755
2759 2756
2760 if (ack_wait_timeout >= DEFECT_7374_NUMBEROF_MAX_WAIT_LOOPS) { 2757 if (ack_wait_timeout >= DEFECT_7374_NUMBEROF_MAX_WAIT_LOOPS) {
2761 ERROR(dev, "FAIL: Defect 7374 workaround waited but failed " 2758 ep_err(dev, "FAIL: Defect 7374 workaround waited but failed "
2762 "to detect SS host's data phase ACK."); 2759 "to detect SS host's data phase ACK.");
2763 ERROR(dev, "PL_EP_STATUS_1(23:16):.Expected from 0x11 to 0x16" 2760 ep_err(dev, "PL_EP_STATUS_1(23:16):.Expected from 0x11 to 0x16"
2764 "got 0x%2.2x.\n", state >> STATE); 2761 "got 0x%2.2x.\n", state >> STATE);
2765 } else { 2762 } else {
2766 WARNING(dev, "INFO: Defect 7374 workaround waited about\n" 2763 ep_warn(dev, "INFO: Defect 7374 workaround waited about\n"
2767 "%duSec for Control Read Data Phase ACK\n", 2764 "%duSec for Control Read Data Phase ACK\n",
2768 DEFECT_7374_PROCESSOR_WAIT_TIME * ack_wait_timeout); 2765 DEFECT_7374_PROCESSOR_WAIT_TIME * ack_wait_timeout);
2769 } 2766 }
@@ -2953,7 +2950,7 @@ static void handle_stat0_irqs_superspeed(struct net2280 *dev,
2953 goto do_stall3; 2950 goto do_stall3;
2954 if (w_value != USB_ENDPOINT_HALT) 2951 if (w_value != USB_ENDPOINT_HALT)
2955 goto do_stall3; 2952 goto do_stall3;
2956 VDEBUG(dev, "%s clear halt\n", e->ep.name); 2953 ep_vdbg(dev, "%s clear halt\n", e->ep.name);
2957 ep_stall(e, false); 2954 ep_stall(e, false);
2958 if (!list_empty(&e->queue) && e->td_dma) 2955 if (!list_empty(&e->queue) && e->td_dma)
2959 restart_dma(e); 2956 restart_dma(e);
@@ -3024,7 +3021,7 @@ static void handle_stat0_irqs_superspeed(struct net2280 *dev,
3024 default: 3021 default:
3025 3022
3026usb3_delegate: 3023usb3_delegate:
3027 VDEBUG(dev, "setup %02x.%02x v%04x i%04x l%04x ep_cfg %08x\n", 3024 ep_vdbg(dev, "setup %02x.%02x v%04x i%04x l%04x ep_cfg %08x\n",
3028 r.bRequestType, r.bRequest, 3025 r.bRequestType, r.bRequest,
3029 w_value, w_index, w_length, 3026 w_value, w_index, w_length,
3030 readl(&ep->cfg->ep_cfg)); 3027 readl(&ep->cfg->ep_cfg));
@@ -3036,7 +3033,7 @@ usb3_delegate:
3036 } 3033 }
3037do_stall3: 3034do_stall3:
3038 if (tmp < 0) { 3035 if (tmp < 0) {
3039 VDEBUG(dev, "req %02x.%02x protocol STALL; stat %d\n", 3036 ep_vdbg(dev, "req %02x.%02x protocol STALL; stat %d\n",
3040 r.bRequestType, r.bRequest, tmp); 3037 r.bRequestType, r.bRequest, tmp);
3041 dev->protocol_stall = 1; 3038 dev->protocol_stall = 1;
3042 /* TD 9.9 Halt Endpoint test. TD 9.22 Set feature test */ 3039 /* TD 9.9 Halt Endpoint test. TD 9.22 Set feature test */
@@ -3061,7 +3058,7 @@ static void handle_stat0_irqs(struct net2280 *dev, u32 stat)
3061 stat &= ~BIT(INTA_ASSERTED); 3058 stat &= ~BIT(INTA_ASSERTED);
3062 if (!stat) 3059 if (!stat)
3063 return; 3060 return;
3064 /* DEBUG(dev, "irqstat0 %04x\n", stat); */ 3061 /* ep_dbg(dev, "irqstat0 %04x\n", stat); */
3065 3062
3066 /* starting a control request? */ 3063 /* starting a control request? */
3067 if (unlikely(stat & BIT(SETUP_PACKET_INTERRUPT))) { 3064 if (unlikely(stat & BIT(SETUP_PACKET_INTERRUPT))) {
@@ -3088,7 +3085,7 @@ static void handle_stat0_irqs(struct net2280 *dev, u32 stat)
3088 EP0_HS_MAX_PACKET_SIZE); 3085 EP0_HS_MAX_PACKET_SIZE);
3089 } 3086 }
3090 net2280_led_speed(dev, dev->gadget.speed); 3087 net2280_led_speed(dev, dev->gadget.speed);
3091 DEBUG(dev, "%s\n", 3088 ep_dbg(dev, "%s\n",
3092 usb_speed_string(dev->gadget.speed)); 3089 usb_speed_string(dev->gadget.speed));
3093 } 3090 }
3094 3091
@@ -3196,7 +3193,7 @@ static void handle_stat0_irqs(struct net2280 *dev, u32 stat)
3196 set_fifo_bytecount(ep, w_length); 3193 set_fifo_bytecount(ep, w_length);
3197 writel((__force u32)status, &dev->epregs[0].ep_data); 3194 writel((__force u32)status, &dev->epregs[0].ep_data);
3198 allow_status(ep); 3195 allow_status(ep);
3199 VDEBUG(dev, "%s stat %02x\n", ep->ep.name, status); 3196 ep_vdbg(dev, "%s stat %02x\n", ep->ep.name, status);
3200 goto next_endpoints; 3197 goto next_endpoints;
3201 } 3198 }
3202 break; 3199 break;
@@ -3212,10 +3209,10 @@ static void handle_stat0_irqs(struct net2280 *dev, u32 stat)
3212 if (!e) 3209 if (!e)
3213 goto do_stall; 3210 goto do_stall;
3214 if (e->wedged) { 3211 if (e->wedged) {
3215 VDEBUG(dev, "%s wedged, halt not cleared\n", 3212 ep_vdbg(dev, "%s wedged, halt not cleared\n",
3216 ep->ep.name); 3213 ep->ep.name);
3217 } else { 3214 } else {
3218 VDEBUG(dev, "%s clear halt\n", e->ep.name); 3215 ep_vdbg(dev, "%s clear halt\n", e->ep.name);
3219 clear_halt(e); 3216 clear_halt(e);
3220 if (ep->dev->pdev->vendor == 3217 if (ep->dev->pdev->vendor ==
3221 PCI_VENDOR_ID_PLX && 3218 PCI_VENDOR_ID_PLX &&
@@ -3243,13 +3240,13 @@ static void handle_stat0_irqs(struct net2280 *dev, u32 stat)
3243 if (dev->pdev->vendor == PCI_VENDOR_ID_PLX && e->dma) 3240 if (dev->pdev->vendor == PCI_VENDOR_ID_PLX && e->dma)
3244 abort_dma(e); 3241 abort_dma(e);
3245 allow_status(ep); 3242 allow_status(ep);
3246 VDEBUG(dev, "%s set halt\n", ep->ep.name); 3243 ep_vdbg(dev, "%s set halt\n", ep->ep.name);
3247 goto next_endpoints; 3244 goto next_endpoints;
3248 } 3245 }
3249 break; 3246 break;
3250 default: 3247 default:
3251delegate: 3248delegate:
3252 VDEBUG(dev, "setup %02x.%02x v%04x i%04x l%04x " 3249 ep_vdbg(dev, "setup %02x.%02x v%04x i%04x l%04x "
3253 "ep_cfg %08x\n", 3250 "ep_cfg %08x\n",
3254 u.r.bRequestType, u.r.bRequest, 3251 u.r.bRequestType, u.r.bRequest,
3255 w_value, w_index, w_length, 3252 w_value, w_index, w_length,
@@ -3263,7 +3260,7 @@ delegate:
3263 /* stall ep0 on error */ 3260 /* stall ep0 on error */
3264 if (tmp < 0) { 3261 if (tmp < 0) {
3265do_stall: 3262do_stall:
3266 VDEBUG(dev, "req %02x.%02x protocol STALL; stat %d\n", 3263 ep_vdbg(dev, "req %02x.%02x protocol STALL; stat %d\n",
3267 u.r.bRequestType, u.r.bRequest, tmp); 3264 u.r.bRequestType, u.r.bRequest, tmp);
3268 dev->protocol_stall = 1; 3265 dev->protocol_stall = 1;
3269 } 3266 }
@@ -3296,7 +3293,7 @@ next_endpoints:
3296 } 3293 }
3297 3294
3298 if (stat) 3295 if (stat)
3299 DEBUG(dev, "unhandled irqstat0 %08x\n", stat); 3296 ep_dbg(dev, "unhandled irqstat0 %08x\n", stat);
3300} 3297}
3301 3298
3302#define DMA_INTERRUPTS (BIT(DMA_D_INTERRUPT) | \ 3299#define DMA_INTERRUPTS (BIT(DMA_D_INTERRUPT) | \
@@ -3329,7 +3326,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat)
3329 ((readl(&dev->usb->usbctl) & 3326 ((readl(&dev->usb->usbctl) &
3330 BIT(VBUS_PIN)) == 0)) && 3327 BIT(VBUS_PIN)) == 0)) &&
3331 (dev->gadget.speed != USB_SPEED_UNKNOWN)) { 3328 (dev->gadget.speed != USB_SPEED_UNKNOWN)) {
3332 DEBUG(dev, "disconnect %s\n", 3329 ep_dbg(dev, "disconnect %s\n",
3333 dev->driver->driver.name); 3330 dev->driver->driver.name);
3334 stop_activity(dev, dev->driver); 3331 stop_activity(dev, dev->driver);
3335 ep0_start(dev); 3332 ep0_start(dev);
@@ -3381,7 +3378,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat)
3381 3378
3382 if (!stat) 3379 if (!stat)
3383 return; 3380 return;
3384 /* DEBUG(dev, "irqstat1 %08x\n", stat);*/ 3381 /* ep_dbg(dev, "irqstat1 %08x\n", stat);*/
3385 3382
3386 /* DMA status, for ep-{a,b,c,d} */ 3383 /* DMA status, for ep-{a,b,c,d} */
3387 scratch = stat & DMA_INTERRUPTS; 3384 scratch = stat & DMA_INTERRUPTS;
@@ -3418,7 +3415,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat)
3418 */ 3415 */
3419 if (!use_dma_chaining) { 3416 if (!use_dma_chaining) {
3420 if (!(tmp & BIT(DMA_TRANSACTION_DONE_INTERRUPT))) { 3417 if (!(tmp & BIT(DMA_TRANSACTION_DONE_INTERRUPT))) {
3421 DEBUG(ep->dev, "%s no xact done? %08x\n", 3418 ep_dbg(ep->dev, "%s no xact done? %08x\n",
3422 ep->ep.name, tmp); 3419 ep->ep.name, tmp);
3423 continue; 3420 continue;
3424 } 3421 }
@@ -3470,7 +3467,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat)
3470 * if they appear very often, here's where to try recovering. 3467 * if they appear very often, here's where to try recovering.
3471 */ 3468 */
3472 if (stat & PCI_ERROR_INTERRUPTS) { 3469 if (stat & PCI_ERROR_INTERRUPTS) {
3473 ERROR(dev, "pci dma error; stat %08x\n", stat); 3470 ep_err(dev, "pci dma error; stat %08x\n", stat);
3474 stat &= ~PCI_ERROR_INTERRUPTS; 3471 stat &= ~PCI_ERROR_INTERRUPTS;
3475 /* these are fatal errors, but "maybe" they won't 3472 /* these are fatal errors, but "maybe" they won't
3476 * happen again ... 3473 * happen again ...
@@ -3481,7 +3478,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat)
3481 } 3478 }
3482 3479
3483 if (stat) 3480 if (stat)
3484 DEBUG(dev, "unhandled irqstat1 %08x\n", stat); 3481 ep_dbg(dev, "unhandled irqstat1 %08x\n", stat);
3485} 3482}
3486 3483
3487static irqreturn_t net2280_irq(int irq, void *_dev) 3484static irqreturn_t net2280_irq(int irq, void *_dev)
@@ -3557,7 +3554,7 @@ static void net2280_remove(struct pci_dev *pdev)
3557 pci_disable_device(pdev); 3554 pci_disable_device(pdev);
3558 device_remove_file(&pdev->dev, &dev_attr_registers); 3555 device_remove_file(&pdev->dev, &dev_attr_registers);
3559 3556
3560 INFO(dev, "unbind\n"); 3557 ep_info(dev, "unbind\n");
3561} 3558}
3562 3559
3563/* wrap this driver around the specified device, but 3560/* wrap this driver around the specified device, but
@@ -3605,7 +3602,7 @@ static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id)
3605 resource = pci_resource_start(pdev, 0); 3602 resource = pci_resource_start(pdev, 0);
3606 len = pci_resource_len(pdev, 0); 3603 len = pci_resource_len(pdev, 0);
3607 if (!request_mem_region(resource, len, driver_name)) { 3604 if (!request_mem_region(resource, len, driver_name)) {
3608 DEBUG(dev, "controller already in use\n"); 3605 ep_dbg(dev, "controller already in use\n");
3609 retval = -EBUSY; 3606 retval = -EBUSY;
3610 goto done; 3607 goto done;
3611 } 3608 }
@@ -3617,7 +3614,7 @@ static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id)
3617 3614
3618 base = ioremap_nocache(resource, len); 3615 base = ioremap_nocache(resource, len);
3619 if (base == NULL) { 3616 if (base == NULL) {
3620 DEBUG(dev, "can't map memory\n"); 3617 ep_dbg(dev, "can't map memory\n");
3621 retval = -EFAULT; 3618 retval = -EFAULT;
3622 goto done; 3619 goto done;
3623 } 3620 }
@@ -3666,18 +3663,18 @@ static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id)
3666 3663
3667 /* irq setup after old hardware is cleaned up */ 3664 /* irq setup after old hardware is cleaned up */
3668 if (!pdev->irq) { 3665 if (!pdev->irq) {
3669 ERROR(dev, "No IRQ. Check PCI setup!\n"); 3666 ep_err(dev, "No IRQ. Check PCI setup!\n");
3670 retval = -ENODEV; 3667 retval = -ENODEV;
3671 goto done; 3668 goto done;
3672 } 3669 }
3673 3670
3674 if (use_msi && dev->pdev->vendor == PCI_VENDOR_ID_PLX) 3671 if (use_msi && dev->pdev->vendor == PCI_VENDOR_ID_PLX)
3675 if (pci_enable_msi(pdev)) 3672 if (pci_enable_msi(pdev))
3676 ERROR(dev, "Failed to enable MSI mode\n"); 3673 ep_err(dev, "Failed to enable MSI mode\n");
3677 3674
3678 if (request_irq(pdev->irq, net2280_irq, IRQF_SHARED, 3675 if (request_irq(pdev->irq, net2280_irq, IRQF_SHARED,
3679 driver_name, dev)) { 3676 driver_name, dev)) {
3680 ERROR(dev, "request interrupt %d failed\n", pdev->irq); 3677 ep_err(dev, "request interrupt %d failed\n", pdev->irq);
3681 retval = -EBUSY; 3678 retval = -EBUSY;
3682 goto done; 3679 goto done;
3683 } 3680 }
@@ -3690,7 +3687,7 @@ static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id)
3690 0 /* no alignment requirements */, 3687 0 /* no alignment requirements */,
3691 0 /* or page-crossing issues */); 3688 0 /* or page-crossing issues */);
3692 if (!dev->requests) { 3689 if (!dev->requests) {
3693 DEBUG(dev, "can't get request pool\n"); 3690 ep_dbg(dev, "can't get request pool\n");
3694 retval = -ENOMEM; 3691 retval = -ENOMEM;
3695 goto done; 3692 goto done;
3696 } 3693 }
@@ -3700,7 +3697,7 @@ static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id)
3700 td = pci_pool_alloc(dev->requests, GFP_KERNEL, 3697 td = pci_pool_alloc(dev->requests, GFP_KERNEL,
3701 &dev->ep[i].td_dma); 3698 &dev->ep[i].td_dma);
3702 if (!td) { 3699 if (!td) {
3703 DEBUG(dev, "can't get dummy %d\n", i); 3700 ep_dbg(dev, "can't get dummy %d\n", i);
3704 retval = -ENOMEM; 3701 retval = -ENOMEM;
3705 goto done; 3702 goto done;
3706 } 3703 }
@@ -3727,10 +3724,10 @@ static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id)
3727 dev->chiprev = get_idx_reg(dev->regs, REG_CHIPREV) & 0xffff; 3724 dev->chiprev = get_idx_reg(dev->regs, REG_CHIPREV) & 0xffff;
3728 3725
3729 /* done */ 3726 /* done */
3730 INFO(dev, "%s\n", driver_desc); 3727 ep_info(dev, "%s\n", driver_desc);
3731 INFO(dev, "irq %d, pci mem %p, chip rev %04x\n", 3728 ep_info(dev, "irq %d, pci mem %p, chip rev %04x\n",
3732 pdev->irq, base, dev->chiprev); 3729 pdev->irq, base, dev->chiprev);
3733 INFO(dev, "version: " DRIVER_VERSION "; dma %s %s\n", 3730 ep_info(dev, "version: " DRIVER_VERSION "; dma %s %s\n",
3734 use_dma ? (use_dma_chaining ? "chaining" : "enabled") 3731 use_dma ? (use_dma_chaining ? "chaining" : "enabled")
3735 : "disabled", 3732 : "disabled",
3736 dev->enhanced_mode ? "enhanced mode" : "legacy mode"); 3733 dev->enhanced_mode ? "enhanced mode" : "legacy mode");
diff --git a/drivers/usb/gadget/net2280.h b/drivers/usb/gadget/net2280.h
index 77c39d9f6d8a..dc9ca1d5dc8e 100644
--- a/drivers/usb/gadget/net2280.h
+++ b/drivers/usb/gadget/net2280.h
@@ -314,32 +314,20 @@ static inline void net2280_led_shutdown(struct net2280 *dev)
314 314
315/*-------------------------------------------------------------------------*/ 315/*-------------------------------------------------------------------------*/
316 316
317#define xprintk(dev, level, fmt, args...) \ 317#define ep_dbg(ndev, fmt, args...) \
318 printk(level "%s %s: " fmt, driver_name, \ 318 dev_dbg((&((ndev)->pdev->dev)), fmt, ##args)
319 pci_name(dev->pdev), ## args)
320 319
321#ifdef DEBUG 320#define ep_vdbg(ndev, fmt, args...) \
322#undef DEBUG 321 dev_vdbg((&((ndev)->pdev->dev)), fmt, ##args)
323#define DEBUG(dev, fmt, args...) \
324 xprintk(dev, KERN_DEBUG, fmt, ## args)
325#else
326#define DEBUG(dev, fmt, args...) \
327 do { } while (0)
328#endif /* DEBUG*/
329 322
330#ifdef VERBOSE 323#define ep_info(ndev, fmt, args...) \
331#define VDEBUG DEBUG 324 dev_info((&((ndev)->pdev->dev)), fmt, ##args)
332#else 325
333#define VDEBUG(dev, fmt, args...) \ 326#define ep_warn(ndev, fmt, args...) \
334 do { } while (0) 327 dev_warn((&((ndev)->pdev->dev)), fmt, ##args)
335#endif /* VERBOSE */
336 328
337#define ERROR(dev, fmt, args...) \ 329#define ep_err(ndev, fmt, args...) \
338 xprintk(dev, KERN_ERR, fmt, ## args) 330 dev_err((&((ndev)->pdev->dev)), fmt, ##args)
339#define WARNING(dev, fmt, args...) \
340 xprintk(dev, KERN_WARNING, fmt, ## args)
341#define INFO(dev, fmt, args...) \
342 xprintk(dev, KERN_INFO, fmt, ## args)
343 331
344/*-------------------------------------------------------------------------*/ 332/*-------------------------------------------------------------------------*/
345 333
@@ -368,7 +356,7 @@ static inline void assert_out_naking(struct net2280_ep *ep, const char *where)
368 u32 tmp = readl(&ep->regs->ep_stat); 356 u32 tmp = readl(&ep->regs->ep_stat);
369 357
370 if ((tmp & BIT(NAK_OUT_PACKETS)) == 0) { 358 if ((tmp & BIT(NAK_OUT_PACKETS)) == 0) {
371 DEBUG(ep->dev, "%s %s %08x !NAK\n", 359 ep_dbg(ep->dev, "%s %s %08x !NAK\n",
372 ep->ep.name, where, tmp); 360 ep->ep.name, where, tmp);
373 writel(BIT(SET_NAK_OUT_PACKETS), 361 writel(BIT(SET_NAK_OUT_PACKETS),
374 &ep->regs->ep_rsp); 362 &ep->regs->ep_rsp);