Commit e56e69cc authored by Ricardo Ribalda Delgado's avatar Ricardo Ribalda Delgado Committed by Felipe Balbi

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: default avatarRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent ae8e530a
...@@ -42,9 +42,6 @@ ...@@ -42,9 +42,6 @@
* (at your option) any later version. * (at your option) any later version.
*/ */
#undef DEBUG /* messages on error and most fault paths */
#undef VERBOSE /* extra debug messages (success too) */
#include <linux/module.h> #include <linux/module.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
...@@ -210,7 +207,7 @@ net2280_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) ...@@ -210,7 +207,7 @@ net2280_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)
* use it instead of troublesome (non-bulk) multi-packet DMA. * use it instead of troublesome (non-bulk) multi-packet DMA.
*/ */
if (ep->dma && (max % 4) != 0 && use_dma_chaining) { if (ep->dma && (max % 4) != 0 && use_dma_chaining) {
DEBUG(ep->dev, "%s, no dma for maxpacket %d\n", ep_dbg(ep->dev, "%s, no dma for maxpacket %d\n",
ep->ep.name, ep->ep.maxpacket); ep->ep.name, ep->ep.maxpacket);
ep->dma = NULL; ep->dma = NULL;
} }
...@@ -303,7 +300,7 @@ net2280_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) ...@@ -303,7 +300,7 @@ net2280_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)
} }
tmp = desc->bEndpointAddress; tmp = desc->bEndpointAddress;
DEBUG(dev, "enabled %s (ep%d%s-%s) %s max %04x\n", ep_dbg(dev, "enabled %s (ep%d%s-%s) %s max %04x\n",
_ep->name, tmp & 0x0f, DIR_STRING(tmp), _ep->name, tmp & 0x0f, DIR_STRING(tmp),
type_string(desc->bmAttributes), type_string(desc->bmAttributes),
ep->dma ? "dma" : "pio", max); ep->dma ? "dma" : "pio", max);
...@@ -431,7 +428,7 @@ static void ep_reset_338x(struct net2280_regs __iomem *regs, ...@@ -431,7 +428,7 @@ static void ep_reset_338x(struct net2280_regs __iomem *regs,
dmastat = readl(&ep->dma->dmastat); dmastat = readl(&ep->dma->dmastat);
if (dmastat == 0x5002) { if (dmastat == 0x5002) {
WARNING(ep->dev, "The dmastat return = %x!!\n", ep_warn(ep->dev, "The dmastat return = %x!!\n",
dmastat); dmastat);
writel(0x5a, &ep->dma->dmastat); writel(0x5a, &ep->dma->dmastat);
} }
...@@ -476,7 +473,7 @@ static int net2280_disable(struct usb_ep *_ep) ...@@ -476,7 +473,7 @@ static int net2280_disable(struct usb_ep *_ep)
else else
ep_reset_228x(ep->dev->regs, ep); ep_reset_228x(ep->dev->regs, ep);
VDEBUG(ep->dev, "disabled %s %s\n", ep_vdbg(ep->dev, "disabled %s %s\n",
ep->dma ? "dma" : "pio", _ep->name); ep->dma ? "dma" : "pio", _ep->name);
/* synch memory views with the device */ /* synch memory views with the device */
...@@ -572,7 +569,7 @@ static void write_fifo(struct net2280_ep *ep, struct usb_request *req) ...@@ -572,7 +569,7 @@ static void write_fifo(struct net2280_ep *ep, struct usb_request *req)
if (count > total) /* min() cannot be used on a bitfield */ if (count > total) /* min() cannot be used on a bitfield */
count = total; count = total;
VDEBUG(ep->dev, "write %s fifo (IN) %d bytes%s req %p\n", ep_vdbg(ep->dev, "write %s fifo (IN) %d bytes%s req %p\n",
ep->ep.name, count, ep->ep.name, count,
(count != ep->ep.maxpacket) ? " (short)" : "", (count != ep->ep.maxpacket) ? " (short)" : "",
req); req);
...@@ -684,7 +681,7 @@ static int read_fifo(struct net2280_ep *ep, struct net2280_request *req) ...@@ -684,7 +681,7 @@ static int read_fifo(struct net2280_ep *ep, struct net2280_request *req)
if (count > tmp) { if (count > tmp) {
/* as with DMA, data overflow gets flushed */ /* as with DMA, data overflow gets flushed */
if ((tmp % ep->ep.maxpacket) != 0) { if ((tmp % ep->ep.maxpacket) != 0) {
ERROR(ep->dev, ep_err(ep->dev,
"%s out fifo %d bytes, expected %d\n", "%s out fifo %d bytes, expected %d\n",
ep->ep.name, count, tmp); ep->ep.name, count, tmp);
req->req.status = -EOVERFLOW; req->req.status = -EOVERFLOW;
...@@ -699,7 +696,7 @@ static int read_fifo(struct net2280_ep *ep, struct net2280_request *req) ...@@ -699,7 +696,7 @@ static int read_fifo(struct net2280_ep *ep, struct net2280_request *req)
is_short = (count == 0) || ((count % ep->ep.maxpacket) != 0); is_short = (count == 0) || ((count % ep->ep.maxpacket) != 0);
VDEBUG(ep->dev, "read %s fifo (OUT) %d bytes%s%s%s req %p %d/%d\n", ep_vdbg(ep->dev, "read %s fifo (OUT) %d bytes%s%s%s req %p %d/%d\n",
ep->ep.name, count, is_short ? " (short)" : "", ep->ep.name, count, is_short ? " (short)" : "",
cleanup ? " flush" : "", prevent ? " nak" : "", cleanup ? " flush" : "", prevent ? " nak" : "",
req, req->req.actual, req->req.length); req, req->req.actual, req->req.length);
...@@ -925,7 +922,7 @@ done(struct net2280_ep *ep, struct net2280_request *req, int status) ...@@ -925,7 +922,7 @@ done(struct net2280_ep *ep, struct net2280_request *req, int status)
usb_gadget_unmap_request(&dev->gadget, &req->req, ep->is_in); usb_gadget_unmap_request(&dev->gadget, &req->req, ep->is_in);
if (status && status != -ESHUTDOWN) if (status && status != -ESHUTDOWN)
VDEBUG(dev, "complete %s req %p stat %d len %u/%u\n", ep_vdbg(dev, "complete %s req %p stat %d len %u/%u\n",
ep->ep.name, &req->req, status, ep->ep.name, &req->req, status,
req->req.actual, req->req.length); req->req.actual, req->req.length);
...@@ -978,7 +975,7 @@ net2280_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) ...@@ -978,7 +975,7 @@ net2280_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
} }
#if 0 #if 0
VDEBUG(dev, "%s queue req %p, len %d buf %p\n", ep_vdbg(dev, "%s queue req %p, len %d buf %p\n",
_ep->name, _req, _req->length, _req->buf); _ep->name, _req, _req->length, _req->buf);
#endif #endif
...@@ -1012,7 +1009,7 @@ net2280_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) ...@@ -1012,7 +1009,7 @@ net2280_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
if (ep->num == 0 && _req->length == 0) { if (ep->num == 0 && _req->length == 0) {
allow_status(ep); allow_status(ep);
done(ep, req, 0); done(ep, req, 0);
VDEBUG(dev, "%s status ack\n", ep->ep.name); ep_vdbg(dev, "%s status ack\n", ep->ep.name);
goto done; goto done;
} }
...@@ -1131,7 +1128,7 @@ static void scan_dma_completions(struct net2280_ep *ep) ...@@ -1131,7 +1128,7 @@ static void scan_dma_completions(struct net2280_ep *ep)
* 0122, and 0124; not all cases trigger the warning. * 0122, and 0124; not all cases trigger the warning.
*/ */
if ((tmp & BIT(NAK_OUT_PACKETS)) == 0) { if ((tmp & BIT(NAK_OUT_PACKETS)) == 0) {
WARNING(ep->dev, "%s lost packet sync!\n", ep_warn(ep->dev, "%s lost packet sync!\n",
ep->ep.name); ep->ep.name);
req->req.status = -EOVERFLOW; req->req.status = -EOVERFLOW;
} else { } else {
...@@ -1139,7 +1136,7 @@ static void scan_dma_completions(struct net2280_ep *ep) ...@@ -1139,7 +1136,7 @@ static void scan_dma_completions(struct net2280_ep *ep)
if (tmp) { if (tmp) {
/* fifo gets flushed later */ /* fifo gets flushed later */
ep->out_overflow = 1; ep->out_overflow = 1;
DEBUG(ep->dev, ep_dbg(ep->dev,
"%s dma, discard %d len %d\n", "%s dma, discard %d len %d\n",
ep->ep.name, tmp, ep->ep.name, tmp,
req->req.length); req->req.length);
...@@ -1175,7 +1172,7 @@ static void restart_dma(struct net2280_ep *ep) ...@@ -1175,7 +1172,7 @@ static void restart_dma(struct net2280_ep *ep)
struct net2280_request *entry, *prev = NULL; struct net2280_request *entry, *prev = NULL;
int reqmode, done = 0; int reqmode, done = 0;
DEBUG(ep->dev, "%s dma hiccup td %p\n", ep->ep.name, req->td); ep_dbg(ep->dev, "%s dma hiccup td %p\n", ep->ep.name, req->td);
ep->in_fifo_validate = likely(req->req.zero || ep->in_fifo_validate = likely(req->req.zero ||
(req->req.length % ep->ep.maxpacket) != 0); (req->req.length % ep->ep.maxpacket) != 0);
if (ep->in_fifo_validate) if (ep->in_fifo_validate)
...@@ -1295,7 +1292,7 @@ static int net2280_dequeue(struct usb_ep *_ep, struct usb_request *_req) ...@@ -1295,7 +1292,7 @@ static int net2280_dequeue(struct usb_ep *_ep, struct usb_request *_req)
/* queue head may be partially complete. */ /* queue head may be partially complete. */
if (ep->queue.next == &req->queue) { if (ep->queue.next == &req->queue) {
if (ep->dma) { if (ep->dma) {
DEBUG(ep->dev, "unlink (%s) dma\n", _ep->name); ep_dbg(ep->dev, "unlink (%s) dma\n", _ep->name);
_req->status = -ECONNRESET; _req->status = -ECONNRESET;
abort_dma(ep); abort_dma(ep);
if (likely(ep->queue.next == &req->queue)) { if (likely(ep->queue.next == &req->queue)) {
...@@ -1306,7 +1303,7 @@ static int net2280_dequeue(struct usb_ep *_ep, struct usb_request *_req) ...@@ -1306,7 +1303,7 @@ static int net2280_dequeue(struct usb_ep *_ep, struct usb_request *_req)
-ECONNRESET); -ECONNRESET);
} }
} else { } else {
DEBUG(ep->dev, "unlink (%s) pio\n", _ep->name); ep_dbg(ep->dev, "unlink (%s) pio\n", _ep->name);
done(ep, req, -ECONNRESET); done(ep, req, -ECONNRESET);
} }
req = NULL; req = NULL;
...@@ -1379,7 +1376,7 @@ net2280_set_halt_and_wedge(struct usb_ep *_ep, int value, int wedged) ...@@ -1379,7 +1376,7 @@ net2280_set_halt_and_wedge(struct usb_ep *_ep, int value, int wedged)
else if (ep->is_in && value && net2280_fifo_status(_ep) != 0) else if (ep->is_in && value && net2280_fifo_status(_ep) != 0)
retval = -EAGAIN; retval = -EAGAIN;
else { else {
VDEBUG(ep->dev, "%s %s %s\n", _ep->name, ep_vdbg(ep->dev, "%s %s %s\n", _ep->name,
value ? "set" : "clear", value ? "set" : "clear",
wedged ? "wedge" : "halt"); wedged ? "wedge" : "halt");
/* set/clear, then synch memory views with the device */ /* set/clear, then synch memory views with the device */
...@@ -1566,7 +1563,7 @@ static const struct usb_gadget_ops net2280_ops = { ...@@ -1566,7 +1563,7 @@ static const struct usb_gadget_ops net2280_ops = {
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
#ifdef CONFIG_USB_GADGET_DEBUG_FILES #ifdef CONFIG_USB_GADGET_PDEBUG_FILES
/* FIXME move these into procfs, and use seq_file. /* FIXME move these into procfs, and use seq_file.
* Sysfs _still_ doesn't behave for arbitrarily sized files, * Sysfs _still_ doesn't behave for arbitrarily sized files,
...@@ -1928,8 +1925,8 @@ static void defect7374_enable_data_eps_zero(struct net2280 *dev) ...@@ -1928,8 +1925,8 @@ static void defect7374_enable_data_eps_zero(struct net2280 *dev)
/*See if firmware needs to set up for workaround*/ /*See if firmware needs to set up for workaround*/
if (fsmvalue != DEFECT7374_FSM_SS_CONTROL_READ) { if (fsmvalue != DEFECT7374_FSM_SS_CONTROL_READ) {
WARNING(dev, "Operate Defect 7374 workaround soft this time"); ep_warn(dev, "Operate Defect 7374 workaround soft this time");
WARNING(dev, "It will operate on cold-reboot and SS connect"); ep_warn(dev, "It will operate on cold-reboot and SS connect");
/*GPEPs:*/ /*GPEPs:*/
tmp = ((0 << ENDPOINT_NUMBER) | BIT(ENDPOINT_DIRECTION) | tmp = ((0 << ENDPOINT_NUMBER) | BIT(ENDPOINT_DIRECTION) |
...@@ -1985,8 +1982,8 @@ static void defect7374_enable_data_eps_zero(struct net2280 *dev) ...@@ -1985,8 +1982,8 @@ static void defect7374_enable_data_eps_zero(struct net2280 *dev)
set_idx_reg(dev->regs, SCRATCH, scratch); set_idx_reg(dev->regs, SCRATCH, scratch);
} else{ } else{
WARNING(dev, "Defect 7374 workaround soft will NOT operate"); ep_warn(dev, "Defect 7374 workaround soft will NOT operate");
WARNING(dev, "It will operate on cold-reboot and SS connect"); ep_warn(dev, "It will operate on cold-reboot and SS connect");
} }
} }
...@@ -2050,7 +2047,7 @@ static void usb_reset_338x(struct net2280 *dev) ...@@ -2050,7 +2047,7 @@ static void usb_reset_338x(struct net2280 *dev)
/* See if firmware needs to set up for workaround: */ /* See if firmware needs to set up for workaround: */
if (fsmvalue != DEFECT7374_FSM_SS_CONTROL_READ) { if (fsmvalue != DEFECT7374_FSM_SS_CONTROL_READ) {
INFO(dev, "%s: Defect 7374 FsmValue 0x%08x\n", __func__, ep_info(dev, "%s: Defect 7374 FsmValue 0x%08x\n", __func__,
fsmvalue); fsmvalue);
} else { } else {
/* disable automatic responses, and irqs */ /* disable automatic responses, and irqs */
...@@ -2187,7 +2184,7 @@ static void usb_reinit_338x(struct net2280 *dev) ...@@ -2187,7 +2184,7 @@ static void usb_reinit_338x(struct net2280 *dev)
/* See if driver needs to set up for workaround: */ /* See if driver needs to set up for workaround: */
if (fsmvalue != DEFECT7374_FSM_SS_CONTROL_READ) if (fsmvalue != DEFECT7374_FSM_SS_CONTROL_READ)
INFO(dev, "%s: Defect 7374 FsmValue %08x\n", ep_info(dev, "%s: Defect 7374 FsmValue %08x\n",
__func__, fsmvalue); __func__, fsmvalue);
else { else {
tmp = readl(&dev->usb_ext->usbctl2) & tmp = readl(&dev->usb_ext->usbctl2) &
...@@ -2302,7 +2299,7 @@ static void ep0_start_338x(struct net2280 *dev) ...@@ -2302,7 +2299,7 @@ static void ep0_start_338x(struct net2280 *dev)
(0xf << DEFECT7374_FSM_FIELD); (0xf << DEFECT7374_FSM_FIELD);
if (fsmvalue != DEFECT7374_FSM_SS_CONTROL_READ) if (fsmvalue != DEFECT7374_FSM_SS_CONTROL_READ)
INFO(dev, "%s: Defect 7374 FsmValue %08x\n", __func__, ep_info(dev, "%s: Defect 7374 FsmValue %08x\n", __func__,
fsmvalue); fsmvalue);
else else
writel(BIT(CLEAR_NAK_OUT_PACKETS_MODE) | writel(BIT(CLEAR_NAK_OUT_PACKETS_MODE) |
...@@ -2401,7 +2398,7 @@ static int net2280_start(struct usb_gadget *_gadget, ...@@ -2401,7 +2398,7 @@ static int net2280_start(struct usb_gadget *_gadget,
ep0_start(dev); ep0_start(dev);
DEBUG(dev, "%s ready, usbctl %08x stdrsp %08x\n", ep_dbg(dev, "%s ready, usbctl %08x stdrsp %08x\n",
driver->driver.name, driver->driver.name,
readl(&dev->usb->usbctl), readl(&dev->usb->usbctl),
readl(&dev->usb->stdrsp)); readl(&dev->usb->stdrsp));
...@@ -2464,7 +2461,7 @@ static int net2280_stop(struct usb_gadget *_gadget, ...@@ -2464,7 +2461,7 @@ static int net2280_stop(struct usb_gadget *_gadget,
device_remove_file(&dev->pdev->dev, &dev_attr_function); device_remove_file(&dev->pdev->dev, &dev_attr_function);
device_remove_file(&dev->pdev->dev, &dev_attr_queues); device_remove_file(&dev->pdev->dev, &dev_attr_queues);
DEBUG(dev, "unregistered driver '%s'\n", ep_dbg(dev, "unregistered driver '%s'\n",
driver ? driver->driver.name : ""); driver ? driver->driver.name : "");
return 0; return 0;
...@@ -2493,7 +2490,7 @@ static void handle_ep_small(struct net2280_ep *ep) ...@@ -2493,7 +2490,7 @@ static void handle_ep_small(struct net2280_ep *ep)
t = readl(&ep->regs->ep_stat); t = readl(&ep->regs->ep_stat);
ep->irqs++; ep->irqs++;
#if 0 #if 0
VDEBUG(ep->dev, "%s ack ep_stat %08x, req %p\n", ep_vdbg(ep->dev, "%s ack ep_stat %08x, req %p\n",
ep->ep.name, t, req ? &req->req : 0); ep->ep.name, t, req ? &req->req : 0);
#endif #endif
if (!ep->is_in || ep->dev->pdev->device == 0x2280) if (!ep->is_in || ep->dev->pdev->device == 0x2280)
...@@ -2624,7 +2621,7 @@ static void handle_ep_small(struct net2280_ep *ep) ...@@ -2624,7 +2621,7 @@ static void handle_ep_small(struct net2280_ep *ep)
if (!list_empty(&ep->queue)) if (!list_empty(&ep->queue))
restart_dma(ep); restart_dma(ep);
} else } else
DEBUG(ep->dev, "%s dma ep_stat %08x ??\n", ep_dbg(ep->dev, "%s dma ep_stat %08x ??\n",
ep->ep.name, t); ep->ep.name, t);
return; return;
...@@ -2758,12 +2755,12 @@ static void defect7374_workaround(struct net2280 *dev, struct usb_ctrlrequest r) ...@@ -2758,12 +2755,12 @@ static void defect7374_workaround(struct net2280 *dev, struct usb_ctrlrequest r)
if (ack_wait_timeout >= DEFECT_7374_NUMBEROF_MAX_WAIT_LOOPS) { if (ack_wait_timeout >= DEFECT_7374_NUMBEROF_MAX_WAIT_LOOPS) {
ERROR(dev, "FAIL: Defect 7374 workaround waited but failed " ep_err(dev, "FAIL: Defect 7374 workaround waited but failed "
"to detect SS host's data phase ACK."); "to detect SS host's data phase ACK.");
ERROR(dev, "PL_EP_STATUS_1(23:16):.Expected from 0x11 to 0x16" ep_err(dev, "PL_EP_STATUS_1(23:16):.Expected from 0x11 to 0x16"
"got 0x%2.2x.\n", state >> STATE); "got 0x%2.2x.\n", state >> STATE);
} else { } else {
WARNING(dev, "INFO: Defect 7374 workaround waited about\n" ep_warn(dev, "INFO: Defect 7374 workaround waited about\n"
"%duSec for Control Read Data Phase ACK\n", "%duSec for Control Read Data Phase ACK\n",
DEFECT_7374_PROCESSOR_WAIT_TIME * ack_wait_timeout); DEFECT_7374_PROCESSOR_WAIT_TIME * ack_wait_timeout);
} }
...@@ -2953,7 +2950,7 @@ static void handle_stat0_irqs_superspeed(struct net2280 *dev, ...@@ -2953,7 +2950,7 @@ static void handle_stat0_irqs_superspeed(struct net2280 *dev,
goto do_stall3; goto do_stall3;
if (w_value != USB_ENDPOINT_HALT) if (w_value != USB_ENDPOINT_HALT)
goto do_stall3; goto do_stall3;
VDEBUG(dev, "%s clear halt\n", e->ep.name); ep_vdbg(dev, "%s clear halt\n", e->ep.name);
ep_stall(e, false); ep_stall(e, false);
if (!list_empty(&e->queue) && e->td_dma) if (!list_empty(&e->queue) && e->td_dma)
restart_dma(e); restart_dma(e);
...@@ -3024,7 +3021,7 @@ static void handle_stat0_irqs_superspeed(struct net2280 *dev, ...@@ -3024,7 +3021,7 @@ static void handle_stat0_irqs_superspeed(struct net2280 *dev,
default: default:
usb3_delegate: usb3_delegate:
VDEBUG(dev, "setup %02x.%02x v%04x i%04x l%04x ep_cfg %08x\n", ep_vdbg(dev, "setup %02x.%02x v%04x i%04x l%04x ep_cfg %08x\n",
r.bRequestType, r.bRequest, r.bRequestType, r.bRequest,
w_value, w_index, w_length, w_value, w_index, w_length,
readl(&ep->cfg->ep_cfg)); readl(&ep->cfg->ep_cfg));
...@@ -3036,7 +3033,7 @@ static void handle_stat0_irqs_superspeed(struct net2280 *dev, ...@@ -3036,7 +3033,7 @@ static void handle_stat0_irqs_superspeed(struct net2280 *dev,
} }
do_stall3: do_stall3:
if (tmp < 0) { if (tmp < 0) {
VDEBUG(dev, "req %02x.%02x protocol STALL; stat %d\n", ep_vdbg(dev, "req %02x.%02x protocol STALL; stat %d\n",
r.bRequestType, r.bRequest, tmp); r.bRequestType, r.bRequest, tmp);
dev->protocol_stall = 1; dev->protocol_stall = 1;
/* TD 9.9 Halt Endpoint test. TD 9.22 Set feature test */ /* 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,7 +3058,7 @@ static void handle_stat0_irqs(struct net2280 *dev, u32 stat)
stat &= ~BIT(INTA_ASSERTED); stat &= ~BIT(INTA_ASSERTED);
if (!stat) if (!stat)
return; return;
/* DEBUG(dev, "irqstat0 %04x\n", stat); */ /* ep_dbg(dev, "irqstat0 %04x\n", stat); */
/* starting a control request? */ /* starting a control request? */
if (unlikely(stat & BIT(SETUP_PACKET_INTERRUPT))) { if (unlikely(stat & BIT(SETUP_PACKET_INTERRUPT))) {
...@@ -3088,7 +3085,7 @@ static void handle_stat0_irqs(struct net2280 *dev, u32 stat) ...@@ -3088,7 +3085,7 @@ static void handle_stat0_irqs(struct net2280 *dev, u32 stat)
EP0_HS_MAX_PACKET_SIZE); EP0_HS_MAX_PACKET_SIZE);
} }
net2280_led_speed(dev, dev->gadget.speed); net2280_led_speed(dev, dev->gadget.speed);
DEBUG(dev, "%s\n", ep_dbg(dev, "%s\n",
usb_speed_string(dev->gadget.speed)); usb_speed_string(dev->gadget.speed));
} }
...@@ -3196,7 +3193,7 @@ static void handle_stat0_irqs(struct net2280 *dev, u32 stat) ...@@ -3196,7 +3193,7 @@ static void handle_stat0_irqs(struct net2280 *dev, u32 stat)
set_fifo_bytecount(ep, w_length); set_fifo_bytecount(ep, w_length);
writel((__force u32)status, &dev->epregs[0].ep_data); writel((__force u32)status, &dev->epregs[0].ep_data);
allow_status(ep); allow_status(ep);
VDEBUG(dev, "%s stat %02x\n", ep->ep.name, status); ep_vdbg(dev, "%s stat %02x\n", ep->ep.name, status);
goto next_endpoints; goto next_endpoints;
} }
break; break;
...@@ -3212,10 +3209,10 @@ static void handle_stat0_irqs(struct net2280 *dev, u32 stat) ...@@ -3212,10 +3209,10 @@ static void handle_stat0_irqs(struct net2280 *dev, u32 stat)
if (!e) if (!e)
goto do_stall; goto do_stall;
if (e->wedged) { if (e->wedged) {
VDEBUG(dev, "%s wedged, halt not cleared\n", ep_vdbg(dev, "%s wedged, halt not cleared\n",
ep->ep.name); ep->ep.name);
} else { } else {
VDEBUG(dev, "%s clear halt\n", e->ep.name); ep_vdbg(dev, "%s clear halt\n", e->ep.name);
clear_halt(e); clear_halt(e);
if (ep->dev->pdev->vendor == if (ep->dev->pdev->vendor ==
PCI_VENDOR_ID_PLX && PCI_VENDOR_ID_PLX &&
...@@ -3243,13 +3240,13 @@ static void handle_stat0_irqs(struct net2280 *dev, u32 stat) ...@@ -3243,13 +3240,13 @@ static void handle_stat0_irqs(struct net2280 *dev, u32 stat)
if (dev->pdev->vendor == PCI_VENDOR_ID_PLX && e->dma) if (dev->pdev->vendor == PCI_VENDOR_ID_PLX && e->dma)
abort_dma(e); abort_dma(e);
allow_status(ep); allow_status(ep);
VDEBUG(dev, "%s set halt\n", ep->ep.name); ep_vdbg(dev, "%s set halt\n", ep->ep.name);
goto next_endpoints; goto next_endpoints;
} }
break; break;
default: default:
delegate: delegate:
VDEBUG(dev, "setup %02x.%02x v%04x i%04x l%04x " ep_vdbg(dev, "setup %02x.%02x v%04x i%04x l%04x "
"ep_cfg %08x\n", "ep_cfg %08x\n",
u.r.bRequestType, u.r.bRequest, u.r.bRequestType, u.r.bRequest,
w_value, w_index, w_length, w_value, w_index, w_length,
...@@ -3263,7 +3260,7 @@ static void handle_stat0_irqs(struct net2280 *dev, u32 stat) ...@@ -3263,7 +3260,7 @@ static void handle_stat0_irqs(struct net2280 *dev, u32 stat)
/* stall ep0 on error */ /* stall ep0 on error */
if (tmp < 0) { if (tmp < 0) {
do_stall: do_stall:
VDEBUG(dev, "req %02x.%02x protocol STALL; stat %d\n", ep_vdbg(dev, "req %02x.%02x protocol STALL; stat %d\n",
u.r.bRequestType, u.r.bRequest, tmp); u.r.bRequestType, u.r.bRequest, tmp);
dev->protocol_stall = 1; dev->protocol_stall = 1;
} }
...@@ -3296,7 +3293,7 @@ static void handle_stat0_irqs(struct net2280 *dev, u32 stat) ...@@ -3296,7 +3293,7 @@ static void handle_stat0_irqs(struct net2280 *dev, u32 stat)
} }
if (stat) if (stat)
DEBUG(dev, "unhandled irqstat0 %08x\n", stat); ep_dbg(dev, "unhandled irqstat0 %08x\n", stat);
} }
#define DMA_INTERRUPTS (BIT(DMA_D_INTERRUPT) | \ #define DMA_INTERRUPTS (BIT(DMA_D_INTERRUPT) | \
...@@ -3329,7 +3326,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat) ...@@ -3329,7 +3326,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat)
((readl(&dev->usb->usbctl) & ((readl(&dev->usb->usbctl) &
BIT(VBUS_PIN)) == 0)) && BIT(VBUS_PIN)) == 0)) &&
(dev->gadget.speed != USB_SPEED_UNKNOWN)) { (dev->gadget.speed != USB_SPEED_UNKNOWN)) {
DEBUG(dev, "disconnect %s\n", ep_dbg(dev, "disconnect %s\n",
dev->driver->driver.name); dev->driver->driver.name);
stop_activity(dev, dev->driver); stop_activity(dev, dev->driver);
ep0_start(dev); ep0_start(dev);
...@@ -3381,7 +3378,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat) ...@@ -3381,7 +3378,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat)
if (!stat) if (!stat)
return; return;
/* DEBUG(dev, "irqstat1 %08x\n", stat);*/ /* ep_dbg(dev, "irqstat1 %08x\n", stat);*/
/* DMA status, for ep-{a,b,c,d} */ /* DMA status, for ep-{a,b,c,d} */
scratch = stat & DMA_INTERRUPTS; scratch = stat & DMA_INTERRUPTS;
...@@ -3418,7 +3415,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat) ...@@ -3418,7 +3415,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat)
*/ */
if (!use_dma_chaining) { if (!use_dma_chaining) {
if (!(tmp & BIT(DMA_TRANSACTION_DONE_INTERRUPT))) { if (!(tmp & BIT(DMA_TRANSACTION_DONE_INTERRUPT))) {
DEBUG(ep->dev, "%s no xact done? %08x\n", ep_dbg(ep->dev, "%s no xact done? %08x\n",
ep->ep.name, tmp); ep->ep.name, tmp);
continue; continue;
} }
...@@ -3470,7 +3467,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat) ...@@ -3470,7 +3467,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat)
* if they appear very often, here's where to try recovering. * if they appear very often, here's where to try recovering.
*/ */
if (stat & PCI_ERROR_INTERRUPTS) { if (stat & PCI_ERROR_INTERRUPTS) {
ERROR(dev, "pci dma error; stat %08x\n", stat); ep_err(dev, "pci dma error; stat %08x\n", stat);
stat &= ~PCI_ERROR_INTERRUPTS; stat &= ~PCI_ERROR_INTERRUPTS;
/* these are fatal errors, but "maybe" they won't /* these are fatal errors, but "maybe" they won't
* happen again ... * happen again ...
...@@ -3481,7 +3478,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat) ...@@ -3481,7 +3478,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat)
} }
if (stat) if (stat)
DEBUG(dev, "unhandled irqstat1 %08x\n", stat); ep_dbg(dev, "unhandled irqstat1 %08x\n", stat);
} }
static irqreturn_t net2280_irq(int irq, void *_dev) static irqreturn_t net2280_irq(int irq, void *_dev)
...@@ -3557,7 +3554,7 @@ static void net2280_remove(struct pci_dev *pdev) ...@@ -3557,7 +3554,7 @@ static void net2280_remove(struct pci_dev *pdev)
pci_disable_device(pdev); pci_disable_device(pdev);
device_remove_file(&pdev->dev, &dev_attr_registers); device_remove_file(&pdev->dev, &dev_attr_registers);
INFO(dev, "unbind\n"); ep_info(dev, "unbind\n");
} }
/* wrap this driver around the specified device, but /* 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,7 +3602,7 @@ static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id)
resource = pci_resource_start(pdev, 0); resource = pci_resource_start(pdev, 0);
len = pci_resource_len(pdev, 0); len = pci_resource_len(pdev, 0);
if (!request_mem_region(resource, len, driver_name)) { if (!request_mem_region(resource, len, driver_name)) {
DEBUG(dev, "controller already in use\n"); ep_dbg(dev, "controller already in use\n");
retval = -EBUSY; retval = -EBUSY;
goto done; goto done;
} }
...@@ -3617,7 +3614,7 @@ static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -3617,7 +3614,7 @@ static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id)
base = ioremap_nocache(resource, len); base = ioremap_nocache(resource, len);
if (base == NULL) { if (base == NULL) {
DEBUG(dev, "can't map memory\n"); ep_dbg(dev, "can't map memory\n");
retval = -EFAULT; retval = -EFAULT;
goto done; goto done;
} }
...@@ -3666,18 +3663,18 @@ static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -3666,18 +3663,18 @@ static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id)
/* irq setup after old hardware is cleaned up */ /* irq setup after old hardware is cleaned up */
if (!pdev->irq) { if (!pdev->irq) {
ERROR(dev, "No IRQ. Check PCI setup!\n"); ep_err(dev, "No IRQ. Check PCI setup!\n");
retval = -ENODEV; retval = -ENODEV;
goto done; goto done;
} }
if (use_msi && dev->pdev->vendor == PCI_VENDOR_ID_PLX) if (use_msi && dev->pdev->vendor == PCI_VENDOR_ID_PLX)
if (pci_enable_msi(pdev)) if (pci_enable_msi(pdev))
ERROR(dev, "Failed to enable MSI mode\n"); ep_err(dev, "Failed to enable MSI mode\n");
if (request_irq(pdev->irq, net2280_irq, IRQF_SHARED, if (request_irq(pdev->irq, net2280_irq, IRQF_SHARED,
driver_name, dev)) { driver_name, dev)) {
ERROR(dev, "request interrupt %d failed\n", pdev->irq); ep_err(dev, "request interrupt %d failed\n", pdev->irq);
retval = -EBUSY; retval = -EBUSY;
goto done; goto done;
} }
...@@ -3690,7 +3687,7 @@ static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -3690,7 +3687,7 @@ static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id)
0 /* no alignment requirements */, 0 /* no alignment requirements */,
0 /* or page-crossing issues */); 0 /* or page-crossing issues */);
if (!dev->requests) { if (!dev->requests) {
DEBUG(dev, "can't get request pool\n"); ep_dbg(dev, "can't get request pool\n");
retval = -ENOMEM; retval = -ENOMEM;
goto done; goto done;
} }
...@@ -3700,7 +3697,7 @@ static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -3700,7 +3697,7 @@ static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id)
td = pci_pool_alloc(dev->requests, GFP_KERNEL, td = pci_pool_alloc(dev->requests, GFP_KERNEL,
&dev->ep[i].td_dma); &dev->ep[i].td_dma);
if (!td) { if (!td) {
DEBUG(dev, "can't get dummy %d\n", i); ep_dbg(dev, "can't get dummy %d\n", i);
retval = -ENOMEM; retval = -ENOMEM;
goto done; goto done;
} }
...@@ -3727,10 +3724,10 @@ static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -3727,10 +3724,10 @@ static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id)
dev->chiprev = get_idx_reg(dev->regs, REG_CHIPREV) & 0xffff; dev->chiprev = get_idx_reg(dev->regs, REG_CHIPREV) & 0xffff;
/* done */ /* done */
INFO(dev, "%s\n", driver_desc); ep_info(dev, "%s\n", driver_desc);
INFO(dev, "irq %d, pci mem %p, chip rev %04x\n", ep_info(dev, "irq %d, pci mem %p, chip rev %04x\n",
pdev->irq, base, dev->chiprev); pdev->irq, base, dev->chiprev);
INFO(dev, "version: " DRIVER_VERSION "; dma %s %s\n", ep_info(dev, "version: " DRIVER_VERSION "; dma %s %s\n",
use_dma ? (use_dma_chaining ? "chaining" : "enabled") use_dma ? (use_dma_chaining ? "chaining" : "enabled")
: "disabled", : "disabled",
dev->enhanced_mode ? "enhanced mode" : "legacy mode"); dev->enhanced_mode ? "enhanced mode" : "legacy mode");
......
...@@ -314,32 +314,20 @@ static inline void net2280_led_shutdown(struct net2280 *dev) ...@@ -314,32 +314,20 @@ static inline void net2280_led_shutdown(struct net2280 *dev)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
#define xprintk(dev, level, fmt, args...) \ #define ep_dbg(ndev, fmt, args...) \
printk(level "%s %s: " fmt, driver_name, \ dev_dbg((&((ndev)->pdev->dev)), fmt, ##args)
pci_name(dev->pdev), ## args)
#ifdef DEBUG #define ep_vdbg(ndev, fmt, args...) \
#undef DEBUG dev_vdbg((&((ndev)->pdev->dev)), fmt, ##args)
#define DEBUG(dev, fmt, args...) \
xprintk(dev, KERN_DEBUG, fmt, ## args)
#else
#define DEBUG(dev, fmt, args...) \
do { } while (0)
#endif /* DEBUG*/
#ifdef VERBOSE #define ep_info(ndev, fmt, args...) \
#define VDEBUG DEBUG dev_info((&((ndev)->pdev->dev)), fmt, ##args)
#else
#define VDEBUG(dev, fmt, args...) \ #define ep_warn(ndev, fmt, args...) \
do { } while (0) dev_warn((&((ndev)->pdev->dev)), fmt, ##args)
#endif /* VERBOSE */
#define ERROR(dev, fmt, args...) \ #define ep_err(ndev, fmt, args...) \
xprintk(dev, KERN_ERR, fmt, ## args) dev_err((&((ndev)->pdev->dev)), fmt, ##args)
#define WARNING(dev, fmt, args...) \
xprintk(dev, KERN_WARNING, fmt, ## args)
#define INFO(dev, fmt, args...) \
xprintk(dev, KERN_INFO, fmt, ## args)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
...@@ -368,7 +356,7 @@ static inline void assert_out_naking(struct net2280_ep *ep, const char *where) ...@@ -368,7 +356,7 @@ static inline void assert_out_naking(struct net2280_ep *ep, const char *where)
u32 tmp = readl(&ep->regs->ep_stat); u32 tmp = readl(&ep->regs->ep_stat);
if ((tmp & BIT(NAK_OUT_PACKETS)) == 0) { if ((tmp & BIT(NAK_OUT_PACKETS)) == 0) {
DEBUG(ep->dev, "%s %s %08x !NAK\n", ep_dbg(ep->dev, "%s %s %08x !NAK\n",
ep->ep.name, where, tmp); ep->ep.name, where, tmp);
writel(BIT(SET_NAK_OUT_PACKETS), writel(BIT(SET_NAK_OUT_PACKETS),
&ep->regs->ep_rsp); &ep->regs->ep_rsp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment