diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-09-11 22:56:29 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-09-11 22:56:29 +0200 |
commit | 1cd572fc0c5f6887ea0542e2d3ec26625e2cdfb7 (patch) | |
tree | 9b987397f34f685edbb4b1f282a32d229c15a1bd /drivers/usb/musb/tusb6010.c | |
parent | Merge tag 'dwc3-for-v3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/ba... (diff) | |
parent | usb: musb: dsps: remove explicit NOP device creation (diff) | |
download | linux-1cd572fc0c5f6887ea0542e2d3ec26625e2cdfb7.tar.xz linux-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/tusb6010.c')
-rw-r--r-- | drivers/usb/musb/tusb6010.c | 56 |
1 files changed, 27 insertions, 29 deletions
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index 00f21dfee5d7..dc4d75ea13ad 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c @@ -154,7 +154,7 @@ tusb_fifo_write_unaligned(void __iomem *fifo, const u8 *buf, u16 len) } static inline void tusb_fifo_read_unaligned(void __iomem *fifo, - void __iomem *buf, u16 len) + void *buf, u16 len) { u32 val; int i; @@ -438,14 +438,13 @@ static void musb_do_idle(unsigned long _musb) if (is_host_active(musb) && (musb->port1_status >> 16)) goto done; - if (is_peripheral_enabled(musb) && !musb->gadget_driver) { + if (!musb->gadget_driver) { wakeups = 0; } else { wakeups = TUSB_PRCM_WHOSTDISCON | TUSB_PRCM_WBUS | TUSB_PRCM_WVBUS; - if (is_otg_enabled(musb)) - wakeups |= TUSB_PRCM_WID; + wakeups |= TUSB_PRCM_WID; } tusb_allow_idle(musb, wakeups); } @@ -583,21 +582,12 @@ static void tusb_musb_set_vbus(struct musb *musb, int is_on) * * Note that if a mini-A cable is plugged in the ID line will stay down as * the weak ID pull-up is not able to pull the ID up. - * - * REVISIT: It would be possible to add support for changing between host - * and peripheral modes in non-OTG configurations by reconfiguring hardware - * and then setting musb->board_mode. For now, only support OTG mode. */ static int tusb_musb_set_mode(struct musb *musb, u8 musb_mode) { void __iomem *tbase = musb->ctrl_base; u32 otg_stat, phy_otg_ctrl, phy_otg_ena, dev_conf; - if (musb->board_mode != MUSB_OTG) { - ERR("Changing mode currently only supported in OTG mode\n"); - return -EINVAL; - } - otg_stat = musb_readl(tbase, TUSB_DEV_OTG_STAT); phy_otg_ctrl = musb_readl(tbase, TUSB_PHY_OTG_CTRL); phy_otg_ena = musb_readl(tbase, TUSB_PHY_OTG_CTRL_ENABLE); @@ -653,10 +643,7 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase) if ((int_src & TUSB_INT_SRC_ID_STATUS_CHNG)) { int default_a; - if (is_otg_enabled(musb)) - default_a = !(otg_stat & TUSB_DEV_OTG_STAT_ID_STATUS); - else - default_a = is_host_enabled(musb); + default_a = !(otg_stat & TUSB_DEV_OTG_STAT_ID_STATUS); dev_dbg(musb->controller, "Default-%c\n", default_a ? 'A' : 'B'); otg->default_a = default_a; tusb_musb_set_vbus(musb, default_a); @@ -670,8 +657,7 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase) if (int_src & TUSB_INT_SRC_VBUS_SENSE_CHNG) { /* B-dev state machine: no vbus ~= disconnect */ - if ((is_otg_enabled(musb) && !otg->default_a) - || !is_host_enabled(musb)) { + if (!otg->default_a) { /* ? musb_root_disconnect(musb); */ musb->port1_status &= ~(USB_PORT_STAT_CONNECTION @@ -1120,10 +1106,8 @@ static int tusb_musb_init(struct musb *musb) } musb->isr = tusb_musb_interrupt; - if (is_peripheral_enabled(musb)) { - musb->xceiv->set_power = tusb_draw_power; - the_musb = musb; - } + musb->xceiv->set_power = tusb_draw_power; + the_musb = musb; setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb); @@ -1176,6 +1160,7 @@ static int __devinit tusb_probe(struct platform_device *pdev) struct tusb6010_glue *glue; int ret = -ENOMEM; + int musbid; glue = kzalloc(sizeof(*glue), GFP_KERNEL); if (!glue) { @@ -1183,12 +1168,21 @@ static int __devinit tusb_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 = &tusb_dmamask; musb->dev.coherent_dma_mask = tusb_dmamask; @@ -1204,26 +1198,29 @@ static int __devinit tusb_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 err1; + goto err3; } return 0; -err2: +err3: platform_device_put(musb); +err2: + musb_put_id(&pdev->dev, musbid); + err1: kfree(glue); @@ -1235,6 +1232,7 @@ static int __devexit tusb_remove(struct platform_device *pdev) { struct tusb6010_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); |