Commit 46823498 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge tag 'musb-for-v3.9' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

Felipe writes:
	usb: musb: patches for v3.9 merge window

	Mostly fixes all over which weren't urgent enough for
	the late -rc cycle.

	There is a Double Buffering fix for Host Mode TX,
	a dependency fix for the transceiver driver, some
	fixes to the error path and a fix for the use of
	omap_musb_maibox.

	Other than these fixes, there a removal duplicate
	headers from the dsps glue layer and removal of
	redundant assignments in omap2430_probe().
parents 6e247777 b37457d8
......@@ -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);
......
......@@ -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);
......
......@@ -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)
......
......@@ -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 @@ static int davinci_musb_init(struct musb *musb)
usb_put_phy(musb->xceiv);
unregister:
usb_nop_xceiv_unregister();
return -ENODEV;
return ret;
}
static int davinci_musb_exit(struct musb *musb)
......
......@@ -1993,6 +1993,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
musb_platform_exit(musb);
fail1:
pm_runtime_disable(musb->controller);
dev_err(musb->controller,
"musb_init_controller failed with status %d\n", status);
......
......@@ -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);
......
......@@ -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)
......
......@@ -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,6 +756,12 @@ static void musb_ep_program(struct musb *musb, u8 epnum,
/* general endpoint setup */
if (epnum) {
/* flush all old state, set default */
/*
* We could be flushing valid
* packets in double buffering
* case
*/
if (!hw_ep->tx_double_buffered)
musb_h_tx_flush_fifo(hw_ep);
/*
......@@ -763,11 +779,13 @@ static void musb_ep_program(struct musb *musb, u8 epnum,
);
csr |= MUSB_TXCSR_MODE;
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);
......
......@@ -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);
if (glue && glue_to_musb(glue)) {
glue->status = status;
if (!musb) {
dev_err(glue->dev, "musb core is not yet ready\n");
} 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,7 +532,6 @@ 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;
}
......@@ -540,12 +539,11 @@ static int omap2430_probe(struct platform_device *pdev)
if (!data) {
dev_err(&pdev->dev,
"failed to allocate musb board data\n");
ret = -ENOMEM;
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;
......
......@@ -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);
......
......@@ -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;
......
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