/* #undef DEBUG */
-/* #undef VERBOSE */
+/* #undef VERBOSE_DEBUG */
#if defined(CONFIG_USB_LANGWELL_OTG)
#define OTG_TRANSCEIVER
/*-------------------------------------------------------------------------*/
/* debugging */
-#ifdef DEBUG
-#define DBG(dev, fmt, args...) \
- pr_debug("%s %s: " fmt , driver_name, \
- pci_name(dev->pdev), ## args)
-#else
-#define DBG(dev, fmt, args...) \
- do { } while (0)
-#endif /* DEBUG */
-
-
-#ifdef VERBOSE
-#define VDBG DBG
-#else
-#define VDBG(dev, fmt, args...) \
- do { } while (0)
-#endif /* VERBOSE */
-
-
-#define ERROR(dev, fmt, args...) \
- pr_err("%s %s: " fmt , driver_name, \
- pci_name(dev->pdev), ## args)
-
-#define WARNING(dev, fmt, args...) \
- pr_warning("%s %s: " fmt , driver_name, \
- pci_name(dev->pdev), ## args)
-
-#define INFO(dev, fmt, args...) \
- pr_info("%s %s: " fmt , driver_name, \
- pci_name(dev->pdev), ## args)
-
-
-#ifdef VERBOSE
+#ifdef VERBOSE_DEBUG
static inline void print_all_registers(struct langwell_udc *dev)
{
int i;
/* Capability Registers */
- printk(KERN_DEBUG "Capability Registers (offset: "
- "0x%04x, length: 0x%08x)\n",
- CAP_REG_OFFSET,
- (u32)sizeof(struct langwell_cap_regs));
- printk(KERN_DEBUG "caplength=0x%02x\n",
+ dev_dbg(&dev->pdev->dev,
+ "Capability Registers (offset: 0x%04x, length: 0x%08x)\n",
+ CAP_REG_OFFSET, (u32)sizeof(struct langwell_cap_regs));
+ dev_dbg(&dev->pdev->dev, "caplength=0x%02x\n",
readb(&dev->cap_regs->caplength));
- printk(KERN_DEBUG "hciversion=0x%04x\n",
+ dev_dbg(&dev->pdev->dev, "hciversion=0x%04x\n",
readw(&dev->cap_regs->hciversion));
- printk(KERN_DEBUG "hcsparams=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "hcsparams=0x%08x\n",
readl(&dev->cap_regs->hcsparams));
- printk(KERN_DEBUG "hccparams=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "hccparams=0x%08x\n",
readl(&dev->cap_regs->hccparams));
- printk(KERN_DEBUG "dciversion=0x%04x\n",
+ dev_dbg(&dev->pdev->dev, "dciversion=0x%04x\n",
readw(&dev->cap_regs->dciversion));
- printk(KERN_DEBUG "dccparams=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "dccparams=0x%08x\n",
readl(&dev->cap_regs->dccparams));
/* Operational Registers */
- printk(KERN_DEBUG "Operational Registers (offset: "
- "0x%04x, length: 0x%08x)\n",
- OP_REG_OFFSET,
- (u32)sizeof(struct langwell_op_regs));
- printk(KERN_DEBUG "extsts=0x%08x\n",
+ dev_dbg(&dev->pdev->dev,
+ "Operational Registers (offset: 0x%04x, length: 0x%08x)\n",
+ OP_REG_OFFSET, (u32)sizeof(struct langwell_op_regs));
+ dev_dbg(&dev->pdev->dev, "extsts=0x%08x\n",
readl(&dev->op_regs->extsts));
- printk(KERN_DEBUG "extintr=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "extintr=0x%08x\n",
readl(&dev->op_regs->extintr));
- printk(KERN_DEBUG "usbcmd=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "usbcmd=0x%08x\n",
readl(&dev->op_regs->usbcmd));
- printk(KERN_DEBUG "usbsts=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "usbsts=0x%08x\n",
readl(&dev->op_regs->usbsts));
- printk(KERN_DEBUG "usbintr=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "usbintr=0x%08x\n",
readl(&dev->op_regs->usbintr));
- printk(KERN_DEBUG "frindex=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "frindex=0x%08x\n",
readl(&dev->op_regs->frindex));
- printk(KERN_DEBUG "ctrldssegment=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "ctrldssegment=0x%08x\n",
readl(&dev->op_regs->ctrldssegment));
- printk(KERN_DEBUG "deviceaddr=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "deviceaddr=0x%08x\n",
readl(&dev->op_regs->deviceaddr));
- printk(KERN_DEBUG "endpointlistaddr=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "endpointlistaddr=0x%08x\n",
readl(&dev->op_regs->endpointlistaddr));
- printk(KERN_DEBUG "ttctrl=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "ttctrl=0x%08x\n",
readl(&dev->op_regs->ttctrl));
- printk(KERN_DEBUG "burstsize=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "burstsize=0x%08x\n",
readl(&dev->op_regs->burstsize));
- printk(KERN_DEBUG "txfilltuning=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "txfilltuning=0x%08x\n",
readl(&dev->op_regs->txfilltuning));
- printk(KERN_DEBUG "txttfilltuning=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "txttfilltuning=0x%08x\n",
readl(&dev->op_regs->txttfilltuning));
- printk(KERN_DEBUG "ic_usb=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "ic_usb=0x%08x\n",
readl(&dev->op_regs->ic_usb));
- printk(KERN_DEBUG "ulpi_viewport=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "ulpi_viewport=0x%08x\n",
readl(&dev->op_regs->ulpi_viewport));
- printk(KERN_DEBUG "configflag=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "configflag=0x%08x\n",
readl(&dev->op_regs->configflag));
- printk(KERN_DEBUG "portsc1=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "portsc1=0x%08x\n",
readl(&dev->op_regs->portsc1));
- printk(KERN_DEBUG "devlc=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "devlc=0x%08x\n",
readl(&dev->op_regs->devlc));
- printk(KERN_DEBUG "otgsc=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "otgsc=0x%08x\n",
readl(&dev->op_regs->otgsc));
- printk(KERN_DEBUG "usbmode=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "usbmode=0x%08x\n",
readl(&dev->op_regs->usbmode));
- printk(KERN_DEBUG "endptnak=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "endptnak=0x%08x\n",
readl(&dev->op_regs->endptnak));
- printk(KERN_DEBUG "endptnaken=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "endptnaken=0x%08x\n",
readl(&dev->op_regs->endptnaken));
- printk(KERN_DEBUG "endptsetupstat=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "endptsetupstat=0x%08x\n",
readl(&dev->op_regs->endptsetupstat));
- printk(KERN_DEBUG "endptprime=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "endptprime=0x%08x\n",
readl(&dev->op_regs->endptprime));
- printk(KERN_DEBUG "endptflush=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "endptflush=0x%08x\n",
readl(&dev->op_regs->endptflush));
- printk(KERN_DEBUG "endptstat=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "endptstat=0x%08x\n",
readl(&dev->op_regs->endptstat));
- printk(KERN_DEBUG "endptcomplete=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "endptcomplete=0x%08x\n",
readl(&dev->op_regs->endptcomplete));
for (i = 0; i < dev->ep_max / 2; i++) {
- printk(KERN_DEBUG "endptctrl[%d]=0x%08x\n",
+ dev_dbg(&dev->pdev->dev, "endptctrl[%d]=0x%08x\n",
i, readl(&dev->op_regs->endptctrl[i]));
}
}
-#endif /* VERBOSE */
+#else
+
+#define print_all_registers(dev) do { } while (0)
+
+#endif /* VERBOSE_DEBUG */
/*-------------------------------------------------------------------------*/
-#define DIR_STRING(bAddress) (((bAddress) & USB_DIR_IN) ? "in" : "out")
+#define is_in(ep) (((ep)->ep_num == 0) ? ((ep)->dev->ep0_dir == \
+ USB_DIR_IN) : (usb_endpoint_dir_in((ep)->desc)))
-#define is_in(ep) (((ep)->ep_num == 0) ? ((ep)->dev->ep0_dir == \
- USB_DIR_IN) : ((ep)->desc->bEndpointAddress \
- & USB_DIR_IN) == USB_DIR_IN)
+#define DIR_STRING(ep) (is_in(ep) ? "in" : "out")
-#ifdef DEBUG
-static char *type_string(u8 bmAttributes)
+static char *type_string(const struct usb_endpoint_descriptor *desc)
{
- switch ((bmAttributes) & USB_ENDPOINT_XFERTYPE_MASK) {
+ switch (usb_endpoint_type(desc)) {
case USB_ENDPOINT_XFER_BULK:
return "bulk";
case USB_ENDPOINT_XFER_ISOC:
return "control";
}
-#endif
/* configure endpoint control registers */
u32 endptctrl;
dev = ep->dev;
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
endptctrl = readl(&dev->op_regs->endptctrl[ep_num]);
if (is_in) { /* TX */
writel(endptctrl, &dev->op_regs->endptctrl[ep_num]);
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
}
struct langwell_ep *ep;
int i;
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
/* ep0 in and out */
for (i = 0; i < 2; i++) {
ep_reset(&dev->ep[0], 0, i, USB_ENDPOINT_XFER_CONTROL);
}
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return;
}
ep = container_of(_ep, struct langwell_ep, ep);
dev = ep->dev;
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
if (!_ep || !desc || ep->desc
|| desc->bDescriptorType != USB_DT_ENDPOINT)
* sanity check type, direction, address, and then
* initialize the endpoint capabilities fields in dQH
*/
- switch (desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) {
+ switch (usb_endpoint_type(desc)) {
case USB_ENDPOINT_XFER_CONTROL:
ios = 1;
break;
ep->ep.maxpacket = max;
ep->desc = desc;
ep->stopped = 0;
- ep->ep_num = desc->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
+ ep->ep_num = usb_endpoint_num(desc);
/* ep_type */
- ep->ep_type = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
+ ep->ep_type = usb_endpoint_type(desc);
/* configure endpoint control registers */
ep_reset(ep, ep->ep_num, is_in(ep), ep->ep_type);
- DBG(dev, "enabled %s (ep%d%s-%s), max %04x\n",
+ dev_dbg(&dev->pdev->dev, "enabled %s (ep%d%s-%s), max %04x\n",
_ep->name,
ep->ep_num,
- DIR_STRING(desc->bEndpointAddress),
- type_string(desc->bmAttributes),
+ DIR_STRING(ep),
+ type_string(desc),
max);
spin_unlock_irqrestore(&dev->lock, flags);
done:
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return retval;
}
struct langwell_dtd *curr_dtd, *next_dtd;
int i;
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
/* remove the req from ep->queue */
list_del_init(&req->queue);
}
if (req->mapped) {
- dma_unmap_single(&dev->pdev->dev, req->req.dma, req->req.length,
+ dma_unmap_single(&dev->pdev->dev,
+ req->req.dma, req->req.length,
is_in(ep) ? PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE);
req->req.dma = DMA_ADDR_INVALID;
req->mapped = 0;
is_in(ep) ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
if (status != -ESHUTDOWN)
- DBG(dev, "complete %s, req %p, stat %d, len %u/%u\n",
- ep->ep.name, &req->req, status,
- req->req.actual, req->req.length);
+ dev_dbg(&dev->pdev->dev,
+ "complete %s, req %p, stat %d, len %u/%u\n",
+ ep->ep.name, &req->req, status,
+ req->req.actual, req->req.length);
/* don't modify queue heads during completion callback */
ep->stopped = 1;
spin_lock(&dev->lock);
ep->stopped = stopped;
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
}
ep = container_of(_ep, struct langwell_ep, ep);
dev = ep->dev;
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
if (!_ep || !ep->desc)
return -EINVAL;
spin_unlock_irqrestore(&dev->lock, flags);
- DBG(dev, "disabled %s\n", _ep->name);
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_dbg(&dev->pdev->dev, "disabled %s\n", _ep->name);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return 0;
}
ep = container_of(_ep, struct langwell_ep, ep);
dev = ep->dev;
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
req = kzalloc(sizeof(*req), gfp_flags);
if (!req)
req->req.dma = DMA_ADDR_INVALID;
INIT_LIST_HEAD(&req->queue);
- VDBG(dev, "alloc request for %s\n", _ep->name);
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "alloc request for %s\n", _ep->name);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return &req->req;
}
ep = container_of(_ep, struct langwell_ep, ep);
dev = ep->dev;
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
if (!_ep || !_req)
return;
if (_req)
kfree(req);
- VDBG(dev, "free request for %s\n", _ep->name);
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "free request for %s\n", _ep->name);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
}
struct langwell_udc *dev;
dev = ep->dev;
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
i = ep->ep_num * 2 + is_in(ep);
dqh = &dev->ep_dqh[i];
if (ep->ep_num)
- VDBG(dev, "%s\n", ep->name);
+ dev_vdbg(&dev->pdev->dev, "%s\n", ep->name);
else
/* ep0 */
- VDBG(dev, "%s-%s\n", ep->name, is_in(ep) ? "in" : "out");
+ dev_vdbg(&dev->pdev->dev, "%s-%s\n", ep->name, DIR_STRING(ep));
- VDBG(dev, "ep_dqh[%d] addr: 0x%08x\n", i, (u32)&(dev->ep_dqh[i]));
+ dev_vdbg(&dev->pdev->dev, "ep_dqh[%d] addr: 0x%08x\n",
+ i, (u32)&(dev->ep_dqh[i]));
bit_mask = is_in(ep) ?
(1 << (ep->ep_num + 16)) : (1 << (ep->ep_num));
- VDBG(dev, "bit_mask = 0x%08x\n", bit_mask);
+ dev_vdbg(&dev->pdev->dev, "bit_mask = 0x%08x\n", bit_mask);
/* check if the pipe is empty */
if (!(list_empty(&ep->queue))) {
/* clear active and halt bit */
dtd_status = (u8) ~(DTD_STS_ACTIVE | DTD_STS_HALTED);
dqh->dtd_status &= dtd_status;
- VDBG(dev, "dqh->dtd_status = 0x%x\n", dqh->dtd_status);
+ dev_vdbg(&dev->pdev->dev, "dqh->dtd_status = 0x%x\n", dqh->dtd_status);
+
+ /* ensure that updates to the dQH will occure before priming */
+ wmb();
/* write 1 to endptprime register to PRIME endpoint */
bit_mask = is_in(ep) ? (1 << (ep->ep_num + 16)) : (1 << ep->ep_num);
- VDBG(dev, "endprime bit_mask = 0x%08x\n", bit_mask);
+ dev_vdbg(&dev->pdev->dev, "endprime bit_mask = 0x%08x\n", bit_mask);
writel(bit_mask, &dev->op_regs->endptprime);
out:
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return 0;
}
int i;
dev = req->ep->dev;
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
/* the maximum transfer length, up to 16k bytes */
*length = min(req->req.length - req->req.actual,
/* fill in total bytes with transfer size */
dtd->dtd_total = cpu_to_le16(*length);
- VDBG(dev, "dtd->dtd_total = %d\n", dtd->dtd_total);
+ dev_vdbg(&dev->pdev->dev, "dtd->dtd_total = %d\n", dtd->dtd_total);
/* set is_last flag if req->req.zero is set or not */
if (req->req.zero) {
*is_last = 0;
if (*is_last == 0)
- VDBG(dev, "multi-dtd request!\n");
+ dev_vdbg(&dev->pdev->dev, "multi-dtd request!\n");
/* set interrupt on complete bit for the last dTD */
if (*is_last && !req->req.no_interrupt)
/* set the active bit of status field to 1 */
dtd->dtd_status = DTD_STS_ACTIVE;
- VDBG(dev, "dtd->dtd_status = 0x%02x\n", dtd->dtd_status);
+ dev_vdbg(&dev->pdev->dev, "dtd->dtd_status = 0x%02x\n",
+ dtd->dtd_status);
- VDBG(dev, "length = %d, dma addr= 0x%08x\n", *length, (int)*dma);
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "length = %d, dma addr= 0x%08x\n",
+ *length, (int)*dma);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return dtd;
}
dma_addr_t dma;
dev = req->ep->dev;
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
do {
dtd = build_dtd(req, &count, &dma, &is_last);
if (dtd == NULL)
req->tail = dtd;
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return 0;
}
dev = ep->dev;
req->ep = ep;
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
- if (ep->desc->bmAttributes == USB_ENDPOINT_XFER_ISOC) {
+ if (usb_endpoint_xfer_isoc(ep->desc)) {
if (req->req.length > ep->ep.maxpacket)
return -EMSGSIZE;
is_iso = 1;
if (_req->dma == DMA_ADDR_INVALID) {
/* WORKAROUND: WARN_ON(size == 0) */
if (_req->length == 0) {
- VDBG(dev, "req->length: 0->1\n");
+ dev_vdbg(&dev->pdev->dev, "req->length: 0->1\n");
zlflag = 1;
_req->length++;
}
_req->buf, _req->length,
is_in(ep) ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
if (zlflag && (_req->length == 1)) {
- VDBG(dev, "req->length: 1->0\n");
+ dev_vdbg(&dev->pdev->dev, "req->length: 1->0\n");
zlflag = 0;
_req->length = 0;
}
req->mapped = 1;
- VDBG(dev, "req->mapped = 1\n");
+ dev_vdbg(&dev->pdev->dev, "req->mapped = 1\n");
} else {
dma_sync_single_for_device(&dev->pdev->dev,
_req->dma, _req->length,
is_in(ep) ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
req->mapped = 0;
- VDBG(dev, "req->mapped = 0\n");
+ dev_vdbg(&dev->pdev->dev, "req->mapped = 0\n");
}
- DBG(dev, "%s queue req %p, len %u, buf %p, dma 0x%08llx\n",
- _ep->name,
- _req, _req->length, _req->buf, (unsigned long long)_req->dma);
+ dev_dbg(&dev->pdev->dev,
+ "%s queue req %p, len %u, buf %p, dma 0x%08x\n",
+ _ep->name,
+ _req, _req->length, _req->buf, (int)_req->dma);
_req->status = -EINPROGRESS;
_req->actual = 0;
if (likely(req != NULL)) {
list_add_tail(&req->queue, &ep->queue);
- VDBG(dev, "list_add_tail() \n");
+ dev_vdbg(&dev->pdev->dev, "list_add_tail()\n");
}
spin_unlock_irqrestore(&dev->lock, flags);
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return 0;
}
ep = container_of(_ep, struct langwell_ep, ep);
dev = ep->dev;
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
if (!_ep || !ep->desc || !_req)
return -EINVAL;
/* queue head may be partially complete. */
if (ep->queue.next == &req->queue) {
- DBG(dev, "unlink (%s) dma\n", _ep->name);
+ dev_dbg(&dev->pdev->dev, "unlink (%s) dma\n", _ep->name);
_req->status = -ECONNRESET;
langwell_ep_fifo_flush(&ep->ep);
ep->stopped = stopped;
spin_unlock_irqrestore(&dev->lock, flags);
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return retval;
}
u32 endptctrl = 0;
int ep_num;
struct langwell_udc *dev = ep->dev;
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
ep_num = ep->ep_num;
endptctrl = readl(&dev->op_regs->endptctrl[ep_num]);
writel(endptctrl, &dev->op_regs->endptctrl[ep_num]);
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
}
ep = container_of(_ep, struct langwell_ep, ep);
dev = ep->dev;
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
if (!_ep || !ep->desc)
return -EINVAL;
if (!dev->driver || dev->gadget.speed == USB_SPEED_UNKNOWN)
return -ESHUTDOWN;
- if (ep->desc && (ep->desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
- == USB_ENDPOINT_XFER_ISOC)
+ if (usb_endpoint_xfer_isoc(ep->desc))
return -EOPNOTSUPP;
spin_lock_irqsave(&dev->lock, flags);
*/
if (!list_empty(&ep->queue) && is_in(ep) && value) {
/* IN endpoint FIFO holds bytes */
- DBG(dev, "%s FIFO holds bytes\n", _ep->name);
+ dev_dbg(&dev->pdev->dev, "%s FIFO holds bytes\n", _ep->name);
retval = -EAGAIN;
goto done;
}
}
done:
spin_unlock_irqrestore(&dev->lock, flags);
- DBG(dev, "%s %s halt\n", _ep->name, value ? "set" : "clear");
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_dbg(&dev->pdev->dev, "%s %s halt\n",
+ _ep->name, value ? "set" : "clear");
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return retval;
}
ep = container_of(_ep, struct langwell_ep, ep);
dev = ep->dev;
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
if (!_ep || !ep->desc)
return -EINVAL;
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return usb_ep_set_halt(_ep);
}
ep = container_of(_ep, struct langwell_ep, ep);
dev = ep->dev;
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
if (!_ep || !ep->desc) {
- VDBG(dev, "ep or ep->desc is NULL\n");
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "ep or ep->desc is NULL\n");
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return;
}
- VDBG(dev, "%s-%s fifo flush\n", _ep->name, is_in(ep) ? "in" : "out");
+ dev_vdbg(&dev->pdev->dev, "%s-%s fifo flush\n",
+ _ep->name, DIR_STRING(ep));
/* flush endpoint buffer */
if (ep->ep_num == 0)
writel(flush_bit, &dev->op_regs->endptflush);
while (readl(&dev->op_regs->endptflush)) {
if (time_after(jiffies, timeout)) {
- ERROR(dev, "ep flush timeout\n");
+ dev_err(&dev->pdev->dev, "ep flush timeout\n");
goto done;
}
cpu_relax();
}
} while (readl(&dev->op_regs->endptstat) & flush_bit);
done:
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
}
return -ENODEV;
dev = container_of(_gadget, struct langwell_udc, gadget);
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
retval = readl(&dev->op_regs->frindex) & FRINDEX_MASK;
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return retval;
}
static int langwell_wakeup(struct usb_gadget *_gadget)
{
struct langwell_udc *dev;
- u32 portsc1, devlc;
- unsigned long flags;
+ u32 portsc1, devlc;
+ unsigned long flags;
if (!_gadget)
return 0;
dev = container_of(_gadget, struct langwell_udc, gadget);
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
- /* Remote Wakeup feature not enabled by host */
- if (!dev->remote_wakeup)
+ /* remote wakeup feature not enabled by host */
+ if (!dev->remote_wakeup) {
+ dev_info(&dev->pdev->dev, "remote wakeup is disabled\n");
return -ENOTSUPP;
+ }
spin_lock_irqsave(&dev->lock, flags);
/* exit PHY low power suspend */
devlc = readl(&dev->op_regs->devlc);
- VDBG(dev, "devlc = 0x%08x\n", devlc);
devlc &= ~LPM_PHCD;
writel(devlc, &dev->op_regs->devlc);
spin_unlock_irqrestore(&dev->lock, flags);
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return 0;
}
{
struct langwell_udc *dev;
unsigned long flags;
- u32 usbcmd;
+ u32 usbcmd;
if (!_gadget)
return -ENODEV;
dev = container_of(_gadget, struct langwell_udc, gadget);
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
spin_lock_irqsave(&dev->lock, flags);
- VDBG(dev, "VBUS status: %s\n", is_active ? "on" : "off");
+ dev_vdbg(&dev->pdev->dev, "VBUS status: %s\n",
+ is_active ? "on" : "off");
dev->vbus_active = (is_active != 0);
if (dev->driver && dev->softconnected && dev->vbus_active) {
spin_unlock_irqrestore(&dev->lock, flags);
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return 0;
}
return -ENODEV;
dev = container_of(_gadget, struct langwell_udc, gadget);
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
if (dev->transceiver) {
- VDBG(dev, "otg_set_power\n");
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "otg_set_power\n");
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return otg_set_power(dev->transceiver, mA);
}
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return -ENOTSUPP;
}
static int langwell_pullup(struct usb_gadget *_gadget, int is_on)
{
struct langwell_udc *dev;
- u32 usbcmd;
- unsigned long flags;
+ u32 usbcmd;
+ unsigned long flags;
if (!_gadget)
return -ENODEV;
dev = container_of(_gadget, struct langwell_udc, gadget);
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
spin_lock_irqsave(&dev->lock, flags);
dev->softconnected = (is_on != 0);
}
spin_unlock_irqrestore(&dev->lock, flags);
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return 0;
}
if (!dev)
return -EINVAL;
- DBG(dev, "---> %s()\n", __func__);
+ dev_dbg(&dev->pdev->dev, "---> %s()\n", __func__);
/* set controller to stop state */
usbcmd = readl(&dev->op_regs->usbcmd);
timeout = jiffies + RESET_TIMEOUT;
while (readl(&dev->op_regs->usbcmd) & CMD_RST) {
if (time_after(jiffies, timeout)) {
- ERROR(dev, "device reset timeout\n");
+ dev_err(&dev->pdev->dev, "device reset timeout\n");
return -ETIMEDOUT;
}
cpu_relax();
writel(usbmode, &dev->op_regs->usbmode);
usbmode = readl(&dev->op_regs->usbmode);
- VDBG(dev, "usbmode=0x%08x\n", usbmode);
+ dev_vdbg(&dev->pdev->dev, "usbmode=0x%08x\n", usbmode);
/* Write-Clear setup status */
writel(0, &dev->op_regs->usbsts);
endpointlistaddr &= ENDPOINTLISTADDR_MASK;
writel(endpointlistaddr, &dev->op_regs->endpointlistaddr);
- VDBG(dev, "dQH base (vir: %p, phy: 0x%08x), endpointlistaddr=0x%08x\n",
- dev->ep_dqh, endpointlistaddr,
- readl(&dev->op_regs->endpointlistaddr));
- DBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev,
+ "dQH base (vir: %p, phy: 0x%08x), endpointlistaddr=0x%08x\n",
+ dev->ep_dqh, endpointlistaddr,
+ readl(&dev->op_regs->endpointlistaddr));
+ dev_dbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return 0;
}
char name[14];
int i;
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
/* initialize ep0 */
ep = &dev->ep[0];
ep->dqh = &dev->ep_dqh[i];
}
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return 0;
}
static void langwell_udc_start(struct langwell_udc *dev)
{
u32 usbintr, usbcmd;
- DBG(dev, "---> %s()\n", __func__);
+ dev_dbg(&dev->pdev->dev, "---> %s()\n", __func__);
/* enable interrupts */
usbintr = INTR_ULPIE /* ULPI */
usbcmd |= CMD_RUNSTOP;
writel(usbcmd, &dev->op_regs->usbcmd);
- DBG(dev, "<--- %s()\n", __func__);
+ dev_dbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return;
}
{
u32 usbcmd;
- DBG(dev, "---> %s()\n", __func__);
+ dev_dbg(&dev->pdev->dev, "---> %s()\n", __func__);
/* disable all interrupts */
writel(0, &dev->op_regs->usbintr);
usbcmd &= ~CMD_RUNSTOP;
writel(usbcmd, &dev->op_regs->usbcmd);
- DBG(dev, "<--- %s()\n", __func__);
+ dev_dbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return;
}
struct usb_gadget_driver *driver)
{
struct langwell_ep *ep;
- DBG(dev, "---> %s()\n", __func__);
+ dev_dbg(&dev->pdev->dev, "---> %s()\n", __func__);
nuke(&dev->ep[0], -ESHUTDOWN);
spin_lock(&dev->lock);
}
- DBG(dev, "<--- %s()\n", __func__);
+ dev_dbg(&dev->pdev->dev, "<--- %s()\n", __func__);
}
"Over-current Change: %s\n"
"Port Enable/Disable Change: %s\n"
"Port Enabled/Disabled: %s\n"
- "Current Connect Status: %s\n\n",
+ "Current Connect Status: %s\n"
+ "LPM Suspend Status: %s\n\n",
(tmp_reg & PORTS_PR) ? "Reset" : "Not Reset",
(tmp_reg & PORTS_SUSP) ? "Suspend " : "Not Suspend",
(tmp_reg & PORTS_OCC) ? "Detected" : "No",
(tmp_reg & PORTS_PEC) ? "Changed" : "Not Changed",
(tmp_reg & PORTS_PE) ? "Enable" : "Not Correct",
- (tmp_reg & PORTS_CCS) ? "Attached" : "Not Attached");
+ (tmp_reg & PORTS_CCS) ? "Attached" : "Not Attached",
+ (tmp_reg & PORTS_SLP) ? "LPM L1" : "LPM L0");
size -= t;
next += t;
"Serial Transceiver : %d\n"
"Port Speed: %s\n"
"Port Force Full Speed Connenct: %s\n"
- "PHY Low Power Suspend Clock Disable: %s\n"
+ "PHY Low Power Suspend Clock: %s\n"
"BmAttributes: %d\n\n",
LPM_PTS(tmp_reg),
(tmp_reg & LPM_STS) ? 1 : 0,
if (!dev)
return -ENODEV;
- DBG(dev, "---> %s()\n", __func__);
+ dev_dbg(&dev->pdev->dev, "---> %s()\n", __func__);
if (dev->driver)
return -EBUSY;
retval = driver->bind(&dev->gadget);
if (retval) {
- DBG(dev, "bind to driver %s --> %d\n",
+ dev_dbg(&dev->pdev->dev, "bind to driver %s --> %d\n",
driver->driver.name, retval);
dev->driver = NULL;
dev->gadget.dev.driver = NULL;
if (dev->got_irq)
langwell_udc_start(dev);
- VDBG(dev, "After langwell_udc_start(), print all registers:\n");
-#ifdef VERBOSE
+ dev_vdbg(&dev->pdev->dev,
+ "After langwell_udc_start(), print all registers:\n");
print_all_registers(dev);
-#endif
- INFO(dev, "register driver: %s\n", driver->driver.name);
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_info(&dev->pdev->dev, "register driver: %s\n",
+ driver->driver.name);
+ dev_dbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return 0;
err_unbind:
dev->gadget.dev.driver = NULL;
dev->driver = NULL;
- DBG(dev, "<--- %s()\n", __func__);
+ dev_dbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return retval;
}
EXPORT_SYMBOL(usb_gadget_register_driver);
if (!dev)
return -ENODEV;
- DBG(dev, "---> %s()\n", __func__);
+ dev_dbg(&dev->pdev->dev, "---> %s()\n", __func__);
if (unlikely(!driver || !driver->bind || !driver->unbind))
return -EINVAL;
device_remove_file(&dev->pdev->dev, &dev_attr_function);
- INFO(dev, "unregistered driver '%s'\n", driver->driver.name);
- DBG(dev, "<--- %s()\n", __func__);
+ dev_info(&dev->pdev->dev, "unregistered driver '%s'\n",
+ driver->driver.name);
+ dev_dbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return 0;
}
EXPORT_SYMBOL(usb_gadget_unregister_driver);
unsigned long timeout;
struct langwell_dqh *dqh;
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
/* ep0 OUT dQH */
dqh = &dev->ep_dqh[EP_DIR_OUT];
timeout = jiffies + SETUPSTAT_TIMEOUT;
while (readl(&dev->op_regs->endptsetupstat)) {
if (time_after(jiffies, timeout)) {
- ERROR(dev, "setup_tripwire timeout\n");
+ dev_err(&dev->pdev->dev, "setup_tripwire timeout\n");
break;
}
cpu_relax();
usbcmd = readl(&dev->op_regs->usbcmd);
writel(usbcmd & ~CMD_SUTW, &dev->op_regs->usbcmd);
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
}
{
u32 endptctrl;
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
/* set TX and RX to stall */
endptctrl = readl(&dev->op_regs->endptctrl[0]);
dev->ep0_state = WAIT_FOR_SETUP;
dev->ep0_dir = USB_DIR_OUT;
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
}
struct langwell_ep *ep;
int status = 0;
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
if (dir == EP_DIR_IN)
dev->ep0_dir = USB_DIR_IN;
return -ENOMEM;
if (status)
- ERROR(dev, "can't queue ep0 status request\n");
+ dev_err(&dev->pdev->dev, "can't queue ep0 status request\n");
list_add_tail(&req->queue, &ep->queue);
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return status;
}
static void set_address(struct langwell_udc *dev, u16 value,
u16 index, u16 length)
{
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
/* save the new address to device struct */
dev->dev_addr = (u8) value;
- VDBG(dev, "dev->dev_addr = %d\n", dev->dev_addr);
+ dev_vdbg(&dev->pdev->dev, "dev->dev_addr = %d\n", dev->dev_addr);
/* update usb state */
dev->usb_state = USB_STATE_ADDRESS;
if (prime_status_phase(dev, EP_DIR_IN))
ep0_stall(dev);
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
}
u16 wIndex)
{
struct langwell_ep *ep;
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
if ((wIndex & USB_ENDPOINT_NUMBER_MASK) == 0)
return &dev->ep[0];
return ep;
}
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return NULL;
}
u32 endptctrl;
int retval;
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
endptctrl = readl(&dev->op_regs->endptctrl[ep->ep_num]);
if (is_in(ep))
else
retval = endptctrl & EPCTRL_RXS ? 1 : 0;
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return retval;
}
u16 status_data = 0; /* 16 bits cpu view status data */
int status = 0;
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
ep = &dev->ep[0];
status_data = ep_is_stall(epn) << USB_ENDPOINT_HALT;
}
+ dev_dbg(&dev->pdev->dev, "get status data: 0x%04x\n", status_data);
+
dev->ep0_dir = USB_DIR_IN;
/* borrow the per device status_req */
goto stall;
if (status) {
- ERROR(dev, "response error on GET_STATUS request\n");
+ dev_err(&dev->pdev->dev,
+ "response error on GET_STATUS request\n");
goto stall;
}
list_add_tail(&req->queue, &ep->queue);
dev->ep0_state = DATA_STATE_XMIT;
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return;
stall:
ep0_stall(dev);
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
}
u16 wIndex = le16_to_cpu(setup->wIndex);
u16 wLength = le16_to_cpu(setup->wLength);
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
/* ep0 fifo flush */
nuke(&dev->ep[0], -ESHUTDOWN);
- DBG(dev, "SETUP %02x.%02x v%04x i%04x l%04x\n",
+ dev_dbg(&dev->pdev->dev, "SETUP %02x.%02x v%04x i%04x l%04x\n",
setup->bRequestType, setup->bRequest,
wValue, wIndex, wLength);
/* We process some stardard setup requests here */
switch (setup->bRequest) {
case USB_REQ_GET_STATUS:
- DBG(dev, "SETUP: USB_REQ_GET_STATUS\n");
+ dev_dbg(&dev->pdev->dev, "SETUP: USB_REQ_GET_STATUS\n");
/* get status, DATA and STATUS phase */
if ((setup->bRequestType & (USB_DIR_IN | USB_TYPE_MASK))
!= (USB_DIR_IN | USB_TYPE_STANDARD))
goto end;
case USB_REQ_SET_ADDRESS:
- DBG(dev, "SETUP: USB_REQ_SET_ADDRESS\n");
+ dev_dbg(&dev->pdev->dev, "SETUP: USB_REQ_SET_ADDRESS\n");
/* STATUS phase */
if (setup->bRequestType != (USB_DIR_OUT | USB_TYPE_STANDARD
| USB_RECIP_DEVICE))
{
int rc = -EOPNOTSUPP;
if (setup->bRequest == USB_REQ_SET_FEATURE)
- DBG(dev, "SETUP: USB_REQ_SET_FEATURE\n");
+ dev_dbg(&dev->pdev->dev,
+ "SETUP: USB_REQ_SET_FEATURE\n");
else if (setup->bRequest == USB_REQ_CLEAR_FEATURE)
- DBG(dev, "SETUP: USB_REQ_CLEAR_FEATURE\n");
+ dev_dbg(&dev->pdev->dev,
+ "SETUP: USB_REQ_CLEAR_FEATURE\n");
if ((setup->bRequestType & (USB_RECIP_MASK | USB_TYPE_MASK))
== (USB_RECIP_ENDPOINT | USB_TYPE_STANDARD)) {
spin_unlock(&dev->lock);
rc = langwell_ep_set_halt(&epn->ep,
- (setup->bRequest == USB_REQ_SET_FEATURE)
- ? 1 : 0);
+ (setup->bRequest == USB_REQ_SET_FEATURE)
+ ? 1 : 0);
spin_lock(&dev->lock);
} else if ((setup->bRequestType & (USB_RECIP_MASK
}
case USB_REQ_GET_DESCRIPTOR:
- DBG(dev, "SETUP: USB_REQ_GET_DESCRIPTOR\n");
+ dev_dbg(&dev->pdev->dev,
+ "SETUP: USB_REQ_GET_DESCRIPTOR\n");
goto delegate;
case USB_REQ_SET_DESCRIPTOR:
- DBG(dev, "SETUP: USB_REQ_SET_DESCRIPTOR unsupported\n");
+ dev_dbg(&dev->pdev->dev,
+ "SETUP: USB_REQ_SET_DESCRIPTOR unsupported\n");
goto delegate;
case USB_REQ_GET_CONFIGURATION:
- DBG(dev, "SETUP: USB_REQ_GET_CONFIGURATION\n");
+ dev_dbg(&dev->pdev->dev,
+ "SETUP: USB_REQ_GET_CONFIGURATION\n");
goto delegate;
case USB_REQ_SET_CONFIGURATION:
- DBG(dev, "SETUP: USB_REQ_SET_CONFIGURATION\n");
+ dev_dbg(&dev->pdev->dev,
+ "SETUP: USB_REQ_SET_CONFIGURATION\n");
goto delegate;
case USB_REQ_GET_INTERFACE:
- DBG(dev, "SETUP: USB_REQ_GET_INTERFACE\n");
+ dev_dbg(&dev->pdev->dev,
+ "SETUP: USB_REQ_GET_INTERFACE\n");
goto delegate;
case USB_REQ_SET_INTERFACE:
- DBG(dev, "SETUP: USB_REQ_SET_INTERFACE\n");
+ dev_dbg(&dev->pdev->dev,
+ "SETUP: USB_REQ_SET_INTERFACE\n");
goto delegate;
case USB_REQ_SYNCH_FRAME:
- DBG(dev, "SETUP: USB_REQ_SYNCH_FRAME unsupported\n");
+ dev_dbg(&dev->pdev->dev,
+ "SETUP: USB_REQ_SYNCH_FRAME unsupported\n");
goto delegate;
default:
/* DATA phase from gadget, STATUS phase from udc */
dev->ep0_dir = (setup->bRequestType & USB_DIR_IN)
? USB_DIR_IN : USB_DIR_OUT;
- VDBG(dev, "dev->ep0_dir = 0x%x, wLength = %d\n",
+ dev_vdbg(&dev->pdev->dev,
+ "dev->ep0_dir = 0x%x, wLength = %d\n",
dev->ep0_dir, wLength);
spin_unlock(&dev->lock);
if (dev->driver->setup(&dev->gadget,
} else {
/* no DATA phase, IN STATUS phase from gadget */
dev->ep0_dir = USB_DIR_IN;
- VDBG(dev, "dev->ep0_dir = 0x%x, wLength = %d\n",
+ dev_vdbg(&dev->pdev->dev,
+ "dev->ep0_dir = 0x%x, wLength = %d\n",
dev->ep0_dir, wLength);
spin_unlock(&dev->lock);
if (dev->driver->setup(&dev->gadget,
break;
}
end:
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return;
}
td_complete = 0;
actual = curr_req->req.length;
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
for (i = 0; i < curr_req->dtd_count; i++) {
remaining_length = le16_to_cpu(curr_dtd->dtd_total);
/* transfers completed successfully */
if (!remaining_length) {
td_complete++;
- VDBG(dev, "dTD transmitted successfully\n");
+ dev_vdbg(&dev->pdev->dev,
+ "dTD transmitted successfully\n");
} else {
if (dir) {
- VDBG(dev, "TX dTD remains data\n");
+ dev_vdbg(&dev->pdev->dev,
+ "TX dTD remains data\n");
retval = -EPROTO;
break;
} else {
/* transfers completed with errors */
if (dtd_status & DTD_STS_ACTIVE) {
- DBG(dev, "request not completed\n");
+ dev_dbg(&dev->pdev->dev,
+ "dTD status ACTIVE dQH[%d]\n", index);
retval = 1;
return retval;
} else if (dtd_status & DTD_STS_HALTED) {
- ERROR(dev, "dTD error %08x dQH[%d]\n",
- dtd_status, index);
+ dev_err(&dev->pdev->dev,
+ "dTD error %08x dQH[%d]\n",
+ dtd_status, index);
/* clear the errors and halt condition */
curr_dqh->dtd_status = 0;
retval = -EPIPE;
break;
} else if (dtd_status & DTD_STS_DBE) {
- DBG(dev, "data buffer (overflow) error\n");
+ dev_dbg(&dev->pdev->dev,
+ "data buffer (overflow) error\n");
retval = -EPROTO;
break;
} else if (dtd_status & DTD_STS_TRE) {
- DBG(dev, "transaction(ISO) error\n");
+ dev_dbg(&dev->pdev->dev,
+ "transaction(ISO) error\n");
retval = -EILSEQ;
break;
} else
- ERROR(dev, "unknown error (0x%x)!\n",
- dtd_status);
+ dev_err(&dev->pdev->dev,
+ "unknown error (0x%x)!\n",
+ dtd_status);
}
if (i != curr_req->dtd_count - 1)
curr_req->req.actual = actual;
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return 0;
}
struct langwell_ep *ep0, struct langwell_request *req)
{
u32 new_addr;
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
if (dev->usb_state == USB_STATE_ADDRESS) {
/* set the new address */
writel(new_addr << USBADR_SHIFT, &dev->op_regs->deviceaddr);
new_addr = USBADR(readl(&dev->op_regs->deviceaddr));
- VDBG(dev, "new_addr = %d\n", new_addr);
+ dev_vdbg(&dev->pdev->dev, "new_addr = %d\n", new_addr);
}
done(ep0, req, 0);
dev->ep0_state = WAIT_FOR_SETUP;
break;
case WAIT_FOR_SETUP:
- ERROR(dev, "unexpect ep0 packets\n");
+ dev_err(&dev->pdev->dev, "unexpect ep0 packets\n");
break;
default:
ep0_stall(dev);
break;
}
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
}
struct langwell_ep *epn;
struct langwell_request *curr_req, *temp_req;
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
complete_bits = readl(&dev->op_regs->endptcomplete);
- VDBG(dev, "endptcomplete register: 0x%08x\n", complete_bits);
+ dev_vdbg(&dev->pdev->dev, "endptcomplete register: 0x%08x\n",
+ complete_bits);
/* Write-Clear the bits in endptcomplete register */
writel(complete_bits, &dev->op_regs->endptcomplete);
if (!complete_bits) {
- DBG(dev, "complete_bits = 0\n");
+ dev_dbg(&dev->pdev->dev, "complete_bits = 0\n");
goto done;
}
epn = &dev->ep[i];
if (epn->name == NULL) {
- WARNING(dev, "invalid endpoint\n");
+ dev_warn(&dev->pdev->dev, "invalid endpoint\n");
continue;
}
if (i < 2)
/* ep0 in and out */
- DBG(dev, "%s-%s transfer completed\n",
+ dev_dbg(&dev->pdev->dev, "%s-%s transfer completed\n",
epn->name,
is_in(epn) ? "in" : "out");
else
- DBG(dev, "%s transfer completed\n", epn->name);
+ dev_dbg(&dev->pdev->dev, "%s transfer completed\n",
+ epn->name);
/* process the req queue until an uncomplete request */
list_for_each_entry_safe(curr_req, temp_req,
&epn->queue, queue) {
status = process_ep_req(dev, i, curr_req);
- VDBG(dev, "%s req status: %d\n", epn->name, status);
+ dev_vdbg(&dev->pdev->dev, "%s req status: %d\n",
+ epn->name, status);
if (status)
break;
}
}
done:
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return;
}
u32 portsc1, devlc;
u32 speed;
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
if (dev->bus_reset)
dev->bus_reset = 0;
portsc1 = readl(&dev->op_regs->portsc1);
devlc = readl(&dev->op_regs->devlc);
- VDBG(dev, "portsc1 = 0x%08x, devlc = 0x%08x\n",
+ dev_vdbg(&dev->pdev->dev, "portsc1 = 0x%08x, devlc = 0x%08x\n",
portsc1, devlc);
/* bus reset is finished */
dev->gadget.speed = USB_SPEED_UNKNOWN;
break;
}
- VDBG(dev, "speed = %d, dev->gadget.speed = %d\n",
+ dev_vdbg(&dev->pdev->dev,
+ "speed = %d, dev->gadget.speed = %d\n",
speed, dev->gadget.speed);
}
/* LPM L0 to L1 */
if (dev->lpm && dev->lpm_state == LPM_L0)
if (portsc1 & PORTS_SUSP && portsc1 & PORTS_SLP) {
- INFO(dev, "LPM L0 to L1\n");
- dev->lpm_state = LPM_L1;
+ dev_info(&dev->pdev->dev, "LPM L0 to L1\n");
+ dev->lpm_state = LPM_L1;
}
/* LPM L1 to L0, force resume or remote wakeup finished */
if (dev->lpm && dev->lpm_state == LPM_L1)
if (!(portsc1 & PORTS_SUSP)) {
- if (portsc1 & PORTS_SLP)
- INFO(dev, "LPM L1 to L0, force resume\n");
- else
- INFO(dev, "LPM L1 to L0, remote wakeup\n");
-
+ dev_info(&dev->pdev->dev, "LPM L1 to L0\n");
dev->lpm_state = LPM_L0;
}
if (!dev->resume_state)
dev->usb_state = USB_STATE_DEFAULT;
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
}
endptcomplete;
unsigned long timeout;
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
/* Write-Clear the device address */
deviceaddr = readl(&dev->op_regs->deviceaddr);
timeout = jiffies + PRIME_TIMEOUT;
while (readl(&dev->op_regs->endptprime)) {
if (time_after(jiffies, timeout)) {
- ERROR(dev, "USB reset timeout\n");
+ dev_err(&dev->pdev->dev, "USB reset timeout\n");
break;
}
cpu_relax();
writel((u32) ~0, &dev->op_regs->endptflush);
if (readl(&dev->op_regs->portsc1) & PORTS_PR) {
- VDBG(dev, "USB bus reset\n");
+ dev_vdbg(&dev->pdev->dev, "USB bus reset\n");
/* bus is reseting */
dev->bus_reset = 1;
stop_activity(dev, dev->driver);
dev->usb_state = USB_STATE_DEFAULT;
} else {
- VDBG(dev, "device controller reset\n");
+ dev_vdbg(&dev->pdev->dev, "device controller reset\n");
/* controller reset */
langwell_udc_reset(dev);
dev->lotg->hsm.b_hnp_enable = 0;
#endif
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
}
static void handle_bus_suspend(struct langwell_udc *dev)
{
u32 devlc;
- DBG(dev, "---> %s()\n", __func__);
+ dev_dbg(&dev->pdev->dev, "---> %s()\n", __func__);
dev->resume_state = dev->usb_state;
dev->usb_state = USB_STATE_SUSPENDED;
spin_unlock(&dev->lock);
dev->driver->suspend(&dev->gadget);
spin_lock(&dev->lock);
- DBG(dev, "suspend %s\n", dev->driver->driver.name);
+ dev_dbg(&dev->pdev->dev, "suspend %s\n",
+ dev->driver->driver.name);
}
}
/* enter PHY low power suspend */
devlc = readl(&dev->op_regs->devlc);
- VDBG(dev, "devlc = 0x%08x\n", devlc);
devlc |= LPM_PHCD;
writel(devlc, &dev->op_regs->devlc);
- DBG(dev, "<--- %s()\n", __func__);
+ dev_dbg(&dev->pdev->dev, "<--- %s()\n", __func__);
}
static void handle_bus_resume(struct langwell_udc *dev)
{
u32 devlc;
- DBG(dev, "---> %s()\n", __func__);
+ dev_dbg(&dev->pdev->dev, "---> %s()\n", __func__);
dev->usb_state = dev->resume_state;
dev->resume_state = 0;
/* exit PHY low power suspend */
devlc = readl(&dev->op_regs->devlc);
- VDBG(dev, "devlc = 0x%08x\n", devlc);
devlc &= ~LPM_PHCD;
writel(devlc, &dev->op_regs->devlc);
spin_unlock(&dev->lock);
dev->driver->resume(&dev->gadget);
spin_lock(&dev->lock);
- DBG(dev, "resume %s\n", dev->driver->driver.name);
+ dev_dbg(&dev->pdev->dev, "resume %s\n",
+ dev->driver->driver.name);
}
}
- DBG(dev, "<--- %s()\n", __func__);
+ dev_dbg(&dev->pdev->dev, "<--- %s()\n", __func__);
}
irq_sts,
portsc1;
- VDBG(dev, "---> %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__);
if (dev->stopped) {
- VDBG(dev, "handle IRQ_NONE\n");
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "handle IRQ_NONE\n");
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return IRQ_NONE;
}
usbintr = readl(&dev->op_regs->usbintr);
irq_sts = usbsts & usbintr;
- VDBG(dev, "usbsts = 0x%08x, usbintr = 0x%08x, irq_sts = 0x%08x\n",
+ dev_vdbg(&dev->pdev->dev,
+ "usbsts = 0x%08x, usbintr = 0x%08x, irq_sts = 0x%08x\n",
usbsts, usbintr, irq_sts);
if (!irq_sts) {
- VDBG(dev, "handle IRQ_NONE\n");
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "handle IRQ_NONE\n");
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
spin_unlock(&dev->lock);
return IRQ_NONE;
}
/* USB interrupt */
if (irq_sts & STS_UI) {
- VDBG(dev, "USB interrupt\n");
+ dev_vdbg(&dev->pdev->dev, "USB interrupt\n");
/* setup packet received from ep0 */
if (readl(&dev->op_regs->endptsetupstat)
& EP0SETUPSTAT_MASK) {
- VDBG(dev, "USB SETUP packet received interrupt\n");
+ dev_vdbg(&dev->pdev->dev,
+ "USB SETUP packet received interrupt\n");
/* setup tripwire semaphone */
setup_tripwire(dev);
handle_setup_packet(dev, &dev->local_setup_buff);
/* USB transfer completion */
if (readl(&dev->op_regs->endptcomplete)) {
- VDBG(dev, "USB transfer completion interrupt\n");
+ dev_vdbg(&dev->pdev->dev,
+ "USB transfer completion interrupt\n");
handle_trans_complete(dev);
}
}
/* SOF received interrupt (for ISO transfer) */
if (irq_sts & STS_SRI) {
/* FIXME */
- /* VDBG(dev, "SOF received interrupt\n"); */
+ /* dev_vdbg(&dev->pdev->dev, "SOF received interrupt\n"); */
}
/* port change detect interrupt */
if (irq_sts & STS_PCI) {
- VDBG(dev, "port change detect interrupt\n");
+ dev_vdbg(&dev->pdev->dev, "port change detect interrupt\n");
handle_port_change(dev);
}
/* suspend interrrupt */
if (irq_sts & STS_SLI) {
- VDBG(dev, "suspend interrupt\n");
+ dev_vdbg(&dev->pdev->dev, "suspend interrupt\n");
handle_bus_suspend(dev);
}
/* USB reset interrupt */
if (irq_sts & STS_URI) {
- VDBG(dev, "USB reset interrupt\n");
+ dev_vdbg(&dev->pdev->dev, "USB reset interrupt\n");
handle_usb_reset(dev);
}
/* USB error or system error interrupt */
if (irq_sts & (STS_UEI | STS_SEI)) {
/* FIXME */
- WARNING(dev, "error IRQ, irq_sts: %x\n", irq_sts);
+ dev_warn(&dev->pdev->dev, "error IRQ, irq_sts: %x\n", irq_sts);
}
spin_unlock(&dev->lock);
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return IRQ_HANDLED;
}
{
struct langwell_udc *dev = the_controller;
- DBG(dev, "---> %s()\n", __func__);
+ dev_dbg(&dev->pdev->dev, "---> %s()\n", __func__);
complete(dev->done);
- DBG(dev, "<--- %s()\n", __func__);
+ dev_dbg(&dev->pdev->dev, "<--- %s()\n", __func__);
kfree(dev);
}
DECLARE_COMPLETION(done);
BUG_ON(dev->driver);
- DBG(dev, "---> %s()\n", __func__);
+ dev_dbg(&dev->pdev->dev, "---> %s()\n", __func__);
dev->done = &done;
dev->cap_regs = NULL;
- INFO(dev, "unbind\n");
- DBG(dev, "<--- %s()\n", __func__);
+ dev_info(&dev->pdev->dev, "unbind\n");
+ dev_dbg(&dev->pdev->dev, "<--- %s()\n", __func__);
device_unregister(&dev->gadget.dev);
device_remove_file(&pdev->dev, &dev_attr_langwell_udc);
spin_lock_init(&dev->lock);
dev->pdev = pdev;
- DBG(dev, "---> %s()\n", __func__);
+ dev_dbg(&dev->pdev->dev, "---> %s()\n", __func__);
#ifdef OTG_TRANSCEIVER
/* PCI device is already enabled by otg_transceiver driver */
resource = pci_resource_start(pdev, 0);
len = pci_resource_len(pdev, 0);
if (!request_mem_region(resource, len, driver_name)) {
- ERROR(dev, "controller already in use\n");
+ dev_err(&dev->pdev->dev, "controller already in use\n");
retval = -EBUSY;
goto error;
}
base = ioremap_nocache(resource, len);
#endif
if (base == NULL) {
- ERROR(dev, "can't map memory\n");
+ dev_err(&dev->pdev->dev, "can't map memory\n");
retval = -EFAULT;
goto error;
}
dev->cap_regs = (struct langwell_cap_regs __iomem *) base;
- VDBG(dev, "dev->cap_regs: %p\n", dev->cap_regs);
+ dev_vdbg(&dev->pdev->dev, "dev->cap_regs: %p\n", dev->cap_regs);
dev->op_regs = (struct langwell_op_regs __iomem *)
(base + OP_REG_OFFSET);
- VDBG(dev, "dev->op_regs: %p\n", dev->op_regs);
+ dev_vdbg(&dev->pdev->dev, "dev->op_regs: %p\n", dev->op_regs);
/* irq setup after old hardware is cleaned up */
if (!pdev->irq) {
- ERROR(dev, "No IRQ. Check PCI setup!\n");
+ dev_err(&dev->pdev->dev, "No IRQ. Check PCI setup!\n");
retval = -ENODEV;
goto error;
}
#ifndef OTG_TRANSCEIVER
- INFO(dev, "irq %d, io mem: 0x%08lx, len: 0x%08lx, pci mem 0x%p\n",
+ dev_info(&dev->pdev->dev,
+ "irq %d, io mem: 0x%08lx, len: 0x%08lx, pci mem 0x%p\n",
pdev->irq, resource, len, base);
/* enables bus-mastering for device dev */
pci_set_master(pdev);
if (request_irq(pdev->irq, langwell_irq, IRQF_SHARED,
driver_name, dev) != 0) {
- ERROR(dev, "request interrupt %d failed\n", pdev->irq);
+ dev_err(&dev->pdev->dev,
+ "request interrupt %d failed\n", pdev->irq);
retval = -EBUSY;
goto error;
}
dev->lpm = (readl(&dev->cap_regs->hccparams) & HCC_LEN) ? 1 : 0;
dev->dciversion = readw(&dev->cap_regs->dciversion);
dev->devcap = (readl(&dev->cap_regs->dccparams) & DEVCAP) ? 1 : 0;
- VDBG(dev, "dev->lpm: %d\n", dev->lpm);
- VDBG(dev, "dev->dciversion: 0x%04x\n", dev->dciversion);
- VDBG(dev, "dccparams: 0x%08x\n", readl(&dev->cap_regs->dccparams));
- VDBG(dev, "dev->devcap: %d\n", dev->devcap);
+ dev_vdbg(&dev->pdev->dev, "dev->lpm: %d\n", dev->lpm);
+ dev_vdbg(&dev->pdev->dev, "dev->dciversion: 0x%04x\n",
+ dev->dciversion);
+ dev_vdbg(&dev->pdev->dev, "dccparams: 0x%08x\n",
+ readl(&dev->cap_regs->dccparams));
+ dev_vdbg(&dev->pdev->dev, "dev->devcap: %d\n", dev->devcap);
if (!dev->devcap) {
- ERROR(dev, "can't support device mode\n");
+ dev_err(&dev->pdev->dev, "can't support device mode\n");
retval = -ENODEV;
goto error;
}
/* a pair of endpoints (out/in) for each address */
dev->ep_max = DEN(readl(&dev->cap_regs->dccparams)) * 2;
- VDBG(dev, "dev->ep_max: %d\n", dev->ep_max);
+ dev_vdbg(&dev->pdev->dev, "dev->ep_max: %d\n", dev->ep_max);
/* allocate endpoints memory */
dev->ep = kzalloc(sizeof(struct langwell_ep) * dev->ep_max,
GFP_KERNEL);
if (!dev->ep) {
- ERROR(dev, "allocate endpoints memory failed\n");
+ dev_err(&dev->pdev->dev, "allocate endpoints memory failed\n");
retval = -ENOMEM;
goto error;
}
/* allocate device dQH memory */
size = dev->ep_max * sizeof(struct langwell_dqh);
- VDBG(dev, "orig size = %d\n", size);
+ dev_vdbg(&dev->pdev->dev, "orig size = %d\n", size);
if (size < DQH_ALIGNMENT)
size = DQH_ALIGNMENT;
else if ((size % DQH_ALIGNMENT) != 0) {
dev->ep_dqh = dma_alloc_coherent(&pdev->dev, size,
&dev->ep_dqh_dma, GFP_KERNEL);
if (!dev->ep_dqh) {
- ERROR(dev, "allocate dQH memory failed\n");
+ dev_err(&dev->pdev->dev, "allocate dQH memory failed\n");
retval = -ENOMEM;
goto error;
}
dev->ep_dqh_size = size;
- VDBG(dev, "ep_dqh_size = %d\n", dev->ep_dqh_size);
+ dev_vdbg(&dev->pdev->dev, "ep_dqh_size = %d\n", dev->ep_dqh_size);
/* initialize ep0 status request structure */
dev->status_req = kzalloc(sizeof(struct langwell_request), GFP_KERNEL);
if (!dev->status_req) {
- ERROR(dev, "allocate status_req memory failed\n");
+ dev_err(&dev->pdev->dev,
+ "allocate status_req memory failed\n");
retval = -ENOMEM;
goto error;
}
}
/* done */
- INFO(dev, "%s\n", driver_desc);
- INFO(dev, "irq %d, pci mem %p\n", pdev->irq, base);
- INFO(dev, "Driver version: " DRIVER_VERSION "\n");
- INFO(dev, "Support (max) %d endpoints\n", dev->ep_max);
- INFO(dev, "Device interface version: 0x%04x\n", dev->dciversion);
- INFO(dev, "Controller mode: %s\n", dev->devcap ? "Device" : "Host");
- INFO(dev, "Support USB LPM: %s\n", dev->lpm ? "Yes" : "No");
-
- VDBG(dev, "After langwell_udc_probe(), print all registers:\n");
-#ifdef VERBOSE
+ dev_info(&dev->pdev->dev, "%s\n", driver_desc);
+ dev_info(&dev->pdev->dev, "irq %d, pci mem %p\n", pdev->irq, base);
+ dev_info(&dev->pdev->dev, "Driver version: " DRIVER_VERSION "\n");
+ dev_info(&dev->pdev->dev, "Support (max) %d endpoints\n", dev->ep_max);
+ dev_info(&dev->pdev->dev, "Device interface version: 0x%04x\n",
+ dev->dciversion);
+ dev_info(&dev->pdev->dev, "Controller mode: %s\n",
+ dev->devcap ? "Device" : "Host");
+ dev_info(&dev->pdev->dev, "Support USB LPM: %s\n",
+ dev->lpm ? "Yes" : "No");
+
+ dev_vdbg(&dev->pdev->dev,
+ "After langwell_udc_probe(), print all registers:\n");
print_all_registers(dev);
-#endif
the_controller = dev;
if (retval)
goto error;
- VDBG(dev, "<--- %s()\n", __func__);
+ dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return 0;
error:
if (dev) {
- DBG(dev, "<--- %s()\n", __func__);
+ dev_dbg(&dev->pdev->dev, "<--- %s()\n", __func__);
langwell_udc_remove(pdev);
}
struct langwell_udc *dev = the_controller;
u32 devlc;
- DBG(dev, "---> %s()\n", __func__);
+ dev_dbg(&dev->pdev->dev, "---> %s()\n", __func__);
/* disable interrupt and set controller to stop state */
langwell_udc_stop(dev);
free_irq(pdev->irq, dev);
dev->got_irq = 0;
-
/* save PCI state */
pci_save_state(pdev);
/* enter PHY low power suspend */
devlc = readl(&dev->op_regs->devlc);
- VDBG(dev, "devlc = 0x%08x\n", devlc);
devlc |= LPM_PHCD;
writel(devlc, &dev->op_regs->devlc);
- DBG(dev, "<--- %s()\n", __func__);
+ dev_dbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return 0;
}
struct langwell_udc *dev = the_controller;
u32 devlc;
- DBG(dev, "---> %s()\n", __func__);
+ dev_dbg(&dev->pdev->dev, "---> %s()\n", __func__);
/* exit PHY low power suspend */
devlc = readl(&dev->op_regs->devlc);
- VDBG(dev, "devlc = 0x%08x\n", devlc);
devlc &= ~LPM_PHCD;
writel(devlc, &dev->op_regs->devlc);
pci_restore_state(pdev);
/* enable IRQ handler */
- if (request_irq(pdev->irq, langwell_irq, IRQF_SHARED, driver_name, dev)
- != 0) {
- ERROR(dev, "request interrupt %d failed\n", pdev->irq);
- return -1;
+ if (request_irq(pdev->irq, langwell_irq, IRQF_SHARED,
+ driver_name, dev) != 0) {
+ dev_err(&dev->pdev->dev, "request interrupt %d failed\n",
+ pdev->irq);
+ return -EBUSY;
}
dev->got_irq = 1;
dev->ep0_state = WAIT_FOR_SETUP;
dev->ep0_dir = USB_DIR_OUT;
- DBG(dev, "<--- %s()\n", __func__);
+ dev_dbg(&dev->pdev->dev, "<--- %s()\n", __func__);
return 0;
}
struct langwell_udc *dev = the_controller;
u32 usbmode;
- DBG(dev, "---> %s()\n", __func__);
+ dev_dbg(&dev->pdev->dev, "---> %s()\n", __func__);
/* reset controller mode to IDLE */
usbmode = readl(&dev->op_regs->usbmode);
- DBG(dev, "usbmode = 0x%08x\n", usbmode);
+ dev_dbg(&dev->pdev->dev, "usbmode = 0x%08x\n", usbmode);
usbmode &= (~3 | MODE_IDLE);
writel(usbmode, &dev->op_regs->usbmode);
- DBG(dev, "<--- %s()\n", __func__);
+ dev_dbg(&dev->pdev->dev, "<--- %s()\n", __func__);
}
/*-------------------------------------------------------------------------*/
}, { /* end: all zeroes */ }
};
-
MODULE_DEVICE_TABLE(pci, pci_ids);
};
-MODULE_DESCRIPTION(DRIVER_DESC);
-MODULE_AUTHOR("Xiaochen Shen <xiaochen.shen@intel.com>");
-MODULE_VERSION(DRIVER_VERSION);
-MODULE_LICENSE("GPL");
-
-
static int __init init(void)
{
#ifdef OTG_TRANSCEIVER
}
module_exit(cleanup);
+
+MODULE_DESCRIPTION(DRIVER_DESC);
+MODULE_AUTHOR("Xiaochen Shen <xiaochen.shen@intel.com>");
+MODULE_VERSION(DRIVER_VERSION);
+MODULE_LICENSE("GPL");
+