Check the transceiver state before checking udc->stopped
Enable/disable the PHY and the clock on cable events
Change-Id: Id5a8a1b94f83da8060786f31181014dd1d546fc7
Signed-off-by: Benoit Goby <benoit@android.com>
void fsl_udc_clk_suspend(void)
{
void fsl_udc_clk_suspend(void)
{
+ tegra_usb_phy_power_off(phy);
+ clk_disable(udc_clk);
}
void fsl_udc_clk_resume(void)
{
}
void fsl_udc_clk_resume(void)
{
+ clk_enable(udc_clk);
+ tegra_usb_phy_power_on(phy);
- /* Disable ISR for OTG host mode */
- if (udc->stopped)
- return IRQ_NONE;
spin_lock_irqsave(&udc->lock, flags);
spin_lock_irqsave(&udc->lock, flags);
- irq_src = fsl_readl(&dr_regs->usbsts) & fsl_readl(&dr_regs->usbintr);
- /* Clear notification bits */
- fsl_writel(irq_src, &dr_regs->usbsts);
-
- /* VDBG("irq_src [0x%8x]", irq_src); */
#ifdef CONFIG_ARCH_TEGRA
if (udc->transceiver) {
#ifdef CONFIG_ARCH_TEGRA
if (udc->transceiver) {
spin_unlock_irqrestore(&udc->lock, flags);
return IRQ_HANDLED;
}
spin_unlock_irqrestore(&udc->lock, flags);
return IRQ_HANDLED;
}
+ }
+#endif
+
+ /* Disable ISR for OTG host mode */
+ if (udc->stopped) {
+ spin_unlock_irqrestore(&udc->lock, flags);
+ return IRQ_NONE;
+ }
+
+ irq_src = fsl_readl(&dr_regs->usbsts) & fsl_readl(&dr_regs->usbintr);
+ /* Clear notification bits */
+ fsl_writel(irq_src, &dr_regs->usbsts);
+
+ /* VDBG("irq_src [0x%8x]", irq_src); */
+
+#ifdef CONFIG_ARCH_TEGRA
+ if (!udc->transceiver) {
/* VBUS A session detection interrupts. When the interrupt is received,
* the mark the vbus active shadow.
*/
/* VBUS A session detection interrupts. When the interrupt is received,
* the mark the vbus active shadow.
*/
#ifdef CONFIG_USB_OTG_UTILS
udc_controller->transceiver = otg_get_transceiver();
#ifdef CONFIG_USB_OTG_UTILS
udc_controller->transceiver = otg_get_transceiver();
+ if (udc_controller->transceiver)
+ udc_controller->vbus_active = 1;
#else
#ifdef CONFIG_ARCH_TEGRA
/* Power down the phy if cable is not connected */
#else
#ifdef CONFIG_ARCH_TEGRA
/* Power down the phy if cable is not connected */