diff options
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/musb/am35x.c | 2 | ||||
-rw-r--r-- | drivers/usb/musb/blackfin.c | 2 | ||||
-rw-r--r-- | drivers/usb/musb/da8xx.c | 7 | ||||
-rw-r--r-- | drivers/usb/musb/davinci.c | 7 | ||||
-rw-r--r-- | drivers/usb/musb/musb_core.c | 1 | ||||
-rw-r--r-- | drivers/usb/musb/musb_dsps.c | 3 | ||||
-rw-r--r-- | drivers/usb/musb/musb_gadget.c | 22 | ||||
-rw-r--r-- | drivers/usb/musb/musb_host.c | 44 | ||||
-rw-r--r-- | drivers/usb/musb/omap2430.c | 16 | ||||
-rw-r--r-- | drivers/usb/musb/tusb6010.c | 2 | ||||
-rw-r--r-- | drivers/usb/musb/ux500.c | 12 |
11 files changed, 79 insertions, 39 deletions
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c index c107d7cdfa69..59eea219034a 100644 --- a/drivers/usb/musb/am35x.c +++ b/drivers/usb/musb/am35x.c @@ -365,7 +365,7 @@ static int am35x_musb_init(struct musb *musb) usb_nop_xceiv_register(); musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); if (IS_ERR_OR_NULL(musb->xceiv)) - return -ENODEV; + return -EPROBE_DEFER; setup_timer(&otg_workaround, otg_timer, (unsigned long) musb); diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c index 14dab9f9b3d0..dbb31b30c7fa 100644 --- a/drivers/usb/musb/blackfin.c +++ b/drivers/usb/musb/blackfin.c @@ -406,7 +406,7 @@ static int bfin_musb_init(struct musb *musb) musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); if (IS_ERR_OR_NULL(musb->xceiv)) { gpio_free(musb->config->gpio_vrsel); - return -ENODEV; + return -EPROBE_DEFER; } bfin_musb_reg_init(musb); diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index 97996af2646e..7c71769d71ff 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c @@ -410,6 +410,7 @@ static int da8xx_musb_init(struct musb *musb) { void __iomem *reg_base = musb->ctrl_base; u32 rev; + int ret = -ENODEV; musb->mregs += DA8XX_MENTOR_CORE_OFFSET; @@ -420,8 +421,10 @@ static int da8xx_musb_init(struct musb *musb) usb_nop_xceiv_register(); musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); - if (IS_ERR_OR_NULL(musb->xceiv)) + if (IS_ERR_OR_NULL(musb->xceiv)) { + ret = -EPROBE_DEFER; goto fail; + } setup_timer(&otg_workaround, otg_timer, (unsigned long)musb); @@ -441,7 +444,7 @@ static int da8xx_musb_init(struct musb *musb) musb->isr = da8xx_musb_interrupt; return 0; fail: - return -ENODEV; + return ret; } static int da8xx_musb_exit(struct musb *musb) diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c index b1c01cad28b2..e040d9103735 100644 --- a/drivers/usb/musb/davinci.c +++ b/drivers/usb/musb/davinci.c @@ -380,11 +380,14 @@ static int davinci_musb_init(struct musb *musb) { void __iomem *tibase = musb->ctrl_base; u32 revision; + int ret = -ENODEV; usb_nop_xceiv_register(); musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); - if (IS_ERR_OR_NULL(musb->xceiv)) + if (IS_ERR_OR_NULL(musb->xceiv)) { + ret = -EPROBE_DEFER; goto unregister; + } musb->mregs += DAVINCI_BASE_OFFSET; @@ -438,7 +441,7 @@ fail: usb_put_phy(musb->xceiv); unregister: usb_nop_xceiv_unregister(); - return -ENODEV; + return ret; } static int davinci_musb_exit(struct musb *musb) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index fd3486745e64..60b41cc28da4 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -1993,6 +1993,7 @@ fail2: musb_platform_exit(musb); fail1: + pm_runtime_disable(musb->controller); dev_err(musb->controller, "musb_init_controller failed with status %d\n", status); diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index f7d764de6fda..7f5c215e560c 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -31,7 +31,6 @@ #include <linux/init.h> #include <linux/io.h> -#include <linux/of.h> #include <linux/err.h> #include <linux/platform_device.h> #include <linux/dma-mapping.h> @@ -419,7 +418,7 @@ static int dsps_musb_init(struct musb *musb) usb_nop_xceiv_register(); musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); if (IS_ERR_OR_NULL(musb->xceiv)) - return -ENODEV; + return -EPROBE_DEFER; /* Returns zero if e.g. not clocked */ rev = dsps_readl(reg_base, wrp->revision); diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 876787438c2f..be18537c5f14 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -408,7 +408,19 @@ static void txstate(struct musb *musb, struct musb_request *req) csr |= (MUSB_TXCSR_DMAENAB | MUSB_TXCSR_DMAMODE | MUSB_TXCSR_MODE); - if (!musb_ep->hb_mult) + /* + * Enable Autoset according to table + * below + * bulk_split hb_mult Autoset_Enable + * 0 0 Yes(Normal) + * 0 >0 No(High BW ISO) + * 1 0 Yes(HS bulk) + * 1 >0 Yes(FS bulk) + */ + if (!musb_ep->hb_mult || + (musb_ep->hb_mult && + can_bulk_split(musb, + musb_ep->type))) csr |= MUSB_TXCSR_AUTOSET; } csr &= ~MUSB_TXCSR_P_UNDERRUN; @@ -1110,11 +1122,15 @@ static int musb_gadget_enable(struct usb_ep *ep, /* Set TXMAXP with the FIFO size of the endpoint * to disable double buffering mode. */ - if (musb->double_buffer_not_ok) + if (musb->double_buffer_not_ok) { musb_writew(regs, MUSB_TXMAXP, hw_ep->max_packet_sz_tx); - else + } else { + if (can_bulk_split(musb, musb_ep->type)) + musb_ep->hb_mult = (hw_ep->max_packet_sz_tx / + musb_ep->packet_sz) - 1; musb_writew(regs, MUSB_TXMAXP, musb_ep->packet_sz | (musb_ep->hb_mult << 11)); + } csr = MUSB_TXCSR_MODE | MUSB_TXCSR_CLRDATATOG; if (musb_readw(regs, MUSB_TXCSR) diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index e9f0fd9ddd2d..1ce1fcf3f3e7 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c @@ -634,7 +634,17 @@ static bool musb_tx_dma_program(struct dma_controller *dma, mode = 1; csr |= MUSB_TXCSR_DMAMODE | MUSB_TXCSR_DMAENAB; /* autoset shouldn't be set in high bandwidth */ - if (qh->hb_mult == 1) + /* + * Enable Autoset according to table + * below + * bulk_split hb_mult Autoset_Enable + * 0 1 Yes(Normal) + * 0 >1 No(High BW ISO) + * 1 1 Yes(HS bulk) + * 1 >1 Yes(FS bulk) + */ + if (qh->hb_mult == 1 || (qh->hb_mult > 1 && + can_bulk_split(hw_ep->musb, qh->type))) csr |= MUSB_TXCSR_AUTOSET; } else { mode = 0; @@ -746,7 +756,13 @@ static void musb_ep_program(struct musb *musb, u8 epnum, /* general endpoint setup */ if (epnum) { /* flush all old state, set default */ - musb_h_tx_flush_fifo(hw_ep); + /* + * We could be flushing valid + * packets in double buffering + * case + */ + if (!hw_ep->tx_double_buffered) + musb_h_tx_flush_fifo(hw_ep); /* * We must not clear the DMAMODE bit before or in @@ -763,11 +779,13 @@ static void musb_ep_program(struct musb *musb, u8 epnum, ); csr |= MUSB_TXCSR_MODE; - if (usb_gettoggle(urb->dev, qh->epnum, 1)) - csr |= MUSB_TXCSR_H_WR_DATATOGGLE - | MUSB_TXCSR_H_DATATOGGLE; - else - csr |= MUSB_TXCSR_CLRDATATOG; + if (!hw_ep->tx_double_buffered) { + if (usb_gettoggle(urb->dev, qh->epnum, 1)) + csr |= MUSB_TXCSR_H_WR_DATATOGGLE + | MUSB_TXCSR_H_DATATOGGLE; + else + csr |= MUSB_TXCSR_CLRDATATOG; + } musb_writew(epio, MUSB_TXCSR, csr); /* REVISIT may need to clear FLUSHFIFO ... */ @@ -791,17 +809,19 @@ static void musb_ep_program(struct musb *musb, u8 epnum, /* protocol/endpoint/interval/NAKlimit */ if (epnum) { musb_writeb(epio, MUSB_TXTYPE, qh->type_reg); - if (musb->double_buffer_not_ok) + if (musb->double_buffer_not_ok) { musb_writew(epio, MUSB_TXMAXP, hw_ep->max_packet_sz_tx); - else if (can_bulk_split(musb, qh->type)) + } else if (can_bulk_split(musb, qh->type)) { + qh->hb_mult = hw_ep->max_packet_sz_tx + / packet_sz; musb_writew(epio, MUSB_TXMAXP, packet_sz - | ((hw_ep->max_packet_sz_tx / - packet_sz) - 1) << 11); - else + | ((qh->hb_mult) - 1) << 11); + } else { musb_writew(epio, MUSB_TXMAXP, qh->maxpacket | ((qh->hb_mult - 1) << 11)); + } musb_writeb(epio, MUSB_TXINTERVAL, qh->intv_reg); } else { musb_writeb(epio, MUSB_NAKLIMIT0, qh->intv_reg); diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index da00af460794..bb48796e5213 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c @@ -255,11 +255,11 @@ static inline void omap2430_low_level_init(struct musb *musb) void omap_musb_mailbox(enum omap_musb_vbus_id_status status) { struct omap2430_glue *glue = _glue; - struct musb *musb = glue_to_musb(glue); - glue->status = status; - if (!musb) { - dev_err(glue->dev, "musb core is not yet ready\n"); + if (glue && glue_to_musb(glue)) { + glue->status = status; + } else { + pr_err("%s: musb core is not yet ready\n", __func__); return; } @@ -369,7 +369,7 @@ static int omap2430_musb_init(struct musb *musb) musb->xceiv = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); if (IS_ERR_OR_NULL(musb->xceiv)) { pr_err("HS USB OTG: no transceiver configured\n"); - return -ENODEV; + return -EPROBE_DEFER; } musb->isr = omap2430_musb_interrupt; @@ -532,20 +532,18 @@ static int omap2430_probe(struct platform_device *pdev) if (!pdata) { dev_err(&pdev->dev, "failed to allocate musb platfrom data\n"); - ret = -ENOMEM; goto err2; } data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); if (!data) { dev_err(&pdev->dev, - "failed to allocate musb board data\n"); - ret = -ENOMEM; + "failed to allocate musb board data\n"); goto err2; } config = devm_kzalloc(&pdev->dev, sizeof(*config), GFP_KERNEL); - if (!data) { + if (!config) { dev_err(&pdev->dev, "failed to allocate musb hdrc config\n"); goto err2; diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index 3969813c217d..464bd23cccda 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c @@ -1069,7 +1069,7 @@ static int tusb_musb_init(struct musb *musb) usb_nop_xceiv_register(); musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); if (IS_ERR_OR_NULL(musb->xceiv)) - return -ENODEV; + return -EPROBE_DEFER; pdev = to_platform_device(musb->controller); diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c index a27ca1a9c994..13a392913769 100644 --- a/drivers/usb/musb/ux500.c +++ b/drivers/usb/musb/ux500.c @@ -61,7 +61,7 @@ static int ux500_musb_init(struct musb *musb) musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); if (IS_ERR_OR_NULL(musb->xceiv)) { pr_err("HS USB OTG: no transceiver configured\n"); - return -ENODEV; + return -EPROBE_DEFER; } musb->isr = ux500_musb_interrupt; @@ -108,7 +108,7 @@ static int ux500_probe(struct platform_device *pdev) goto err3; } - ret = clk_enable(clk); + ret = clk_prepare_enable(clk); if (ret) { dev_err(&pdev->dev, "failed to enable clock\n"); goto err4; @@ -148,7 +148,7 @@ static int ux500_probe(struct platform_device *pdev) return 0; err5: - clk_disable(clk); + clk_disable_unprepare(clk); err4: clk_put(clk); @@ -168,7 +168,7 @@ static int ux500_remove(struct platform_device *pdev) struct ux500_glue *glue = platform_get_drvdata(pdev); platform_device_unregister(glue->musb); - clk_disable(glue->clk); + clk_disable_unprepare(glue->clk); clk_put(glue->clk); kfree(glue); @@ -182,7 +182,7 @@ static int ux500_suspend(struct device *dev) struct musb *musb = glue_to_musb(glue); usb_phy_set_suspend(musb->xceiv, 1); - clk_disable(glue->clk); + clk_disable_unprepare(glue->clk); return 0; } @@ -193,7 +193,7 @@ static int ux500_resume(struct device *dev) struct musb *musb = glue_to_musb(glue); int ret; - ret = clk_enable(glue->clk); + ret = clk_prepare_enable(glue->clk); if (ret) { dev_err(dev, "failed to enable clock\n"); return ret; |