static int omap2430_runtime_resume(struct device *dev) { struct omap2430_glue *glue = dev_get_drvdata(dev); struct musb *musb = glue_to_musb(glue); omap2430_low_level_init(musb); otg_set_suspend(musb->xceiv, 0); return 0; }
static int omap2430_runtime_resume(struct device *dev) { struct omap2430_glue *glue = dev_get_drvdata(dev); struct musb *musb = glue_to_musb(glue); omap2430_low_level_init(musb); musb_writel(musb->mregs, OTG_INTERFSEL, musb->context.otg_interfsel); otg_set_suspend(musb->xceiv, 0); return 0; }
int omap2430_async_resume(struct musb *musb) { struct device *dev = musb->controller; struct musb_hdrc_platform_data *pdata = dev->platform_data; struct omap_musb_board_data *data = pdata->board_data; struct platform_device *pdev = to_platform_device(musb->controller->parent); unsigned long flags = 0; u32 val = 0; int ret = 0; if (!pdev) { pr_err("%s pdev is null error\n", __func__); return -ENODEV; } dev_info(&pdev->dev, "%s async_resume=%d +\n", __func__, musb->async_resume); mutex_lock(&musb->async_musb_lock); if (musb->async_resume > 0) musb->async_resume++; else { ret = omap_device_enable(pdev); if (ret < 0) { dev_err(&pdev->dev, "%s omap_device_enable error ret=%d\n", __func__, ret); mutex_unlock(&musb->async_musb_lock); return ret; } spin_lock_irqsave(&musb->lock, flags); otg_set_suspend(musb->xceiv, 0); omap2430_low_level_init(musb); val = musb_readl(musb->mregs, OTG_INTERFSEL); if (data->interface_type == MUSB_INTERFACE_UTMI) { val &= ~ULPI_12PIN; val |= UTMI_8BIT; } else { val |= ULPI_12PIN; } musb_writel(musb->mregs, OTG_INTERFSEL, val); musb_async_resume(musb); spin_unlock_irqrestore(&musb->lock, flags); musb->async_resume++; } mutex_unlock(&musb->async_musb_lock); dev_info(&pdev->dev, "%s async_resume %d -\n", __func__, musb->async_resume); return 0; }
static int omap2430_runtime_resume(struct device *dev) { struct omap2430_glue *glue = dev_get_drvdata(dev); struct musb *musb = glue_to_musb(glue); if (musb) { omap2430_low_level_init(musb); musb_writel(musb->mregs, OTG_INTERFSEL, musb->context.otg_interfsel); phy_power_on(musb->phy); } return 0; }
static int omap2430_resume(struct device *dev) { struct omap2430_glue *glue = dev_get_drvdata(dev); struct musb *musb = glue_to_musb(glue); int ret; ret = clk_enable(glue->clk); if (ret) { dev_err(dev, "faled to enable clock\n"); return ret; } omap2430_low_level_init(musb); omap2430_restore_context(musb); otg_set_suspend(musb->xceiv, 0); return 0; }
static int omap2430_musb_init(struct musb *musb) { u32 l, status = 0; struct device *dev = musb->controller; struct musb_hdrc_platform_data *plat = dev->platform_data; struct omap_musb_board_data *data = plat->board_data; /* We require some kind of external transceiver, hooked * up through ULPI. TWL4030-family PMICs include one, * which needs a driver, drivers aren't always needed. */ musb->xceiv = otg_get_transceiver(); if (!musb->xceiv) { pr_err("HS USB OTG: no transceiver configured\n"); return -ENODEV; } omap2430_low_level_init(musb); l = musb_readl(musb->mregs, OTG_SYSCONFIG); l &= ~ENABLEWAKEUP; /* disable wakeup */ l &= ~NOSTDBY; /* remove possible nostdby */ l |= SMARTSTDBY; /* enable smart standby */ l &= ~AUTOIDLE; /* disable auto idle */ l &= ~NOIDLE; /* remove possible noidle */ l |= SMARTIDLE; /* enable smart idle */ /* * MUSB AUTOIDLE don't work in 3430. * Workaround by Richard Woodruff/TI */ if (!cpu_is_omap3430()) l |= AUTOIDLE; /* enable auto idle */ musb_writel(musb->mregs, OTG_SYSCONFIG, l); l = musb_readl(musb->mregs, OTG_INTERFSEL); if (data->interface_type == MUSB_INTERFACE_UTMI) { /* OMAP4 uses Internal PHY GS70 which uses UTMI interface */ l &= ~ULPI_12PIN; /* Disable ULPI */ l |= UTMI_8BIT; /* Enable UTMI */ } else { l |= ULPI_12PIN; } musb_writel(musb->mregs, OTG_INTERFSEL, l); pr_debug("HS USB OTG: revision 0x%x, sysconfig 0x%02x, " "sysstatus 0x%x, intrfsel 0x%x, simenable 0x%x\n", musb_readl(musb->mregs, OTG_REVISION), musb_readl(musb->mregs, OTG_SYSCONFIG), musb_readl(musb->mregs, OTG_SYSSTATUS), musb_readl(musb->mregs, OTG_INTERFSEL), musb_readl(musb->mregs, OTG_SIMENABLE)); musb->nb.notifier_call = musb_otg_notifications; status = otg_register_notifier(musb->xceiv, &musb->nb); if (status) DBG(1, "notification register failed\n"); /* check whether cable is already connected */ if (musb->xceiv->state ==OTG_STATE_B_IDLE) musb_otg_notifications(&musb->nb, 1, musb->xceiv->gadget); setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb); return 0; }