aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb/blackfin.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-11 13:56:29 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-11 13:56:29 -0700
commit1cd572fc0c5f6887ea0542e2d3ec26625e2cdfb7 (patch)
tree9b987397f34f685edbb4b1f282a32d229c15a1bd /drivers/usb/musb/blackfin.c
parentMerge tag 'dwc3-for-v3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next (diff)
parentusb: musb: dsps: remove explicit NOP device creation (diff)
downloadlinux-dev-1cd572fc0c5f6887ea0542e2d3ec26625e2cdfb7.tar.xz
linux-dev-1cd572fc0c5f6887ea0542e2d3ec26625e2cdfb7.zip
Merge tag 'musb-for-v3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next
usb: musb: patches for v3.7 merge window Here we have a bunch of miscellaneous cleanups and fixes to the musb driver. It fixes a bunch of mistakes errors which nobody has triggered before, so I'm not Ccing stable tree. We are finally improving OMAP's VBUS/ID Mailbox usage so that we can introduce our PHY drivers properly. Also, we're adding support for multiple instances of the MUSB IP in the same SoC, as seen on some platforms from TI which have 2 MUSB instances. Other than that, we have some small fixes like not kicking DMA for a zero byte transfer, or properly handling NAK timeout on MUSB's host side, and the enabling of DMA Mode1 for any transfers which are aligned to wMaxPacketSize. All patches have been pending on mailing list for a long time and I don't expect any big surprises with this pull request.
Diffstat (limited to 'drivers/usb/musb/blackfin.c')
-rw-r--r--drivers/usb/musb/blackfin.c63
1 files changed, 30 insertions, 33 deletions
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index b562623a8971..e8cff9bb9d23 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -185,8 +185,8 @@ static irqreturn_t blackfin_interrupt(int irq, void *__hci)
}
/* Start sampling ID pin, when plug is removed from MUSB */
- if ((is_otg_enabled(musb) && (musb->xceiv->state == OTG_STATE_B_IDLE
- || musb->xceiv->state == OTG_STATE_A_WAIT_BCON)) ||
+ if ((musb->xceiv->state == OTG_STATE_B_IDLE
+ || musb->xceiv->state == OTG_STATE_A_WAIT_BCON) ||
(musb->int_usb & MUSB_INTR_DISCONNECT && is_host_active(musb))) {
mod_timer(&musb_conn_timer, jiffies + TIMER_DELAY);
musb->a_wait_bcon = TIMER_DELAY;
@@ -229,18 +229,13 @@ static void musb_conn_timer_handler(unsigned long _musb)
val = MUSB_INTR_SUSPEND | MUSB_INTR_VBUSERROR;
musb_writeb(musb->mregs, MUSB_INTRUSB, val);
- if (is_otg_enabled(musb))
- musb->xceiv->state = OTG_STATE_B_IDLE;
- else
- musb_writeb(musb->mregs, MUSB_POWER, MUSB_POWER_HSENAB);
+ musb->xceiv->state = OTG_STATE_B_IDLE;
}
mod_timer(&musb_conn_timer, jiffies + TIMER_DELAY);
break;
case OTG_STATE_B_IDLE:
-
- if (!is_peripheral_enabled(musb))
- break;
- /* Start a new session. It seems that MUSB needs taking
+ /*
+ * Start a new session. It seems that MUSB needs taking
* some time to recognize the type of the plug inserted?
*/
val = musb_readw(musb->mregs, MUSB_DEVCTL);
@@ -296,10 +291,7 @@ static void musb_conn_timer_handler(unsigned long _musb)
static void bfin_musb_enable(struct musb *musb)
{
- if (!is_otg_enabled(musb) && is_host_enabled(musb)) {
- mod_timer(&musb_conn_timer, jiffies + TIMER_DELAY);
- musb->a_wait_bcon = TIMER_DELAY;
- }
+ /* REVISIT is this really correct ? */
}
static void bfin_musb_disable(struct musb *musb)
@@ -324,12 +316,6 @@ static int bfin_musb_set_power(struct usb_phy *x, unsigned mA)
return 0;
}
-static void bfin_musb_try_idle(struct musb *musb, unsigned long timeout)
-{
- if (!is_otg_enabled(musb) && is_host_enabled(musb))
- mod_timer(&musb_conn_timer, jiffies + TIMER_DELAY);
-}
-
static int bfin_musb_vbus_status(struct musb *musb)
{
return 0;
@@ -425,12 +411,10 @@ static int bfin_musb_init(struct musb *musb)
bfin_musb_reg_init(musb);
- if (is_host_enabled(musb)) {
- setup_timer(&musb_conn_timer,
- musb_conn_timer_handler, (unsigned long) musb);
- }
- if (is_peripheral_enabled(musb))
- musb->xceiv->set_power = bfin_musb_set_power;
+ setup_timer(&musb_conn_timer, musb_conn_timer_handler,
+ (unsigned long) musb);
+
+ musb->xceiv->set_power = bfin_musb_set_power;
musb->isr = blackfin_interrupt;
musb->double_buffer_not_ok = true;
@@ -455,7 +439,6 @@ static const struct musb_platform_ops bfin_ops = {
.disable = bfin_musb_disable,
.set_mode = bfin_musb_set_mode,
- .try_idle = bfin_musb_try_idle,
.vbus_status = bfin_musb_vbus_status,
.set_vbus = bfin_musb_set_vbus,
@@ -472,6 +455,7 @@ static int __devinit bfin_probe(struct platform_device *pdev)
struct bfin_glue *glue;
int ret = -ENOMEM;
+ int musbid;
glue = kzalloc(sizeof(*glue), GFP_KERNEL);
if (!glue) {
@@ -479,12 +463,21 @@ static int __devinit bfin_probe(struct platform_device *pdev)
goto err0;
}
- musb = platform_device_alloc("musb-hdrc", -1);
+ /* get the musb id */
+ musbid = musb_get_id(&pdev->dev, GFP_KERNEL);
+ if (musbid < 0) {
+ dev_err(&pdev->dev, "failed to allocate musb id\n");
+ ret = -ENOMEM;
+ goto err1;
+ }
+
+ musb = platform_device_alloc("musb-hdrc", musbid);
if (!musb) {
dev_err(&pdev->dev, "failed to allocate musb device\n");
- goto err1;
+ goto err2;
}
+ musb->id = musbid;
musb->dev.parent = &pdev->dev;
musb->dev.dma_mask = &bfin_dmamask;
musb->dev.coherent_dma_mask = bfin_dmamask;
@@ -500,26 +493,29 @@ static int __devinit bfin_probe(struct platform_device *pdev)
pdev->num_resources);
if (ret) {
dev_err(&pdev->dev, "failed to add resources\n");
- goto err2;
+ goto err3;
}
ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
if (ret) {
dev_err(&pdev->dev, "failed to add platform_data\n");
- goto err2;
+ goto err3;
}
ret = platform_device_add(musb);
if (ret) {
dev_err(&pdev->dev, "failed to register musb device\n");
- goto err2;
+ goto err3;
}
return 0;
-err2:
+err3:
platform_device_put(musb);
+err2:
+ musb_put_id(&pdev->dev, musbid);
+
err1:
kfree(glue);
@@ -531,6 +527,7 @@ static int __devexit bfin_remove(struct platform_device *pdev)
{
struct bfin_glue *glue = platform_get_drvdata(pdev);
+ musb_put_id(&pdev->dev, glue->musb->id);
platform_device_del(glue->musb);
platform_device_put(glue->musb);
kfree(glue);