diff mbox

[3/3] usb: musb: da8xx: Fix host mode suspend

Message ID 1480350381-26151-4-git-send-email-abailon@baylibre.com
State New
Headers show

Commit Message

Alexandre Bailon Nov. 28, 2016, 4:26 p.m. UTC
On da8xx, VBUS is not maintained during suspend when musb is in host mode.
On resume, all the connected devices will be disconnected and then will
be enumerated again.
This happens because MUSB_DEVCTL is cleared during suspend.
MUSB_DEVCTL is clear twice: once by da8xx_musb_disable()
and once musb_generic_disable().

Don't clear MUSB_DEVCTL in da8xx_musb_disable() and use the quirk
MUSB_PRESERVE_DEVCTL to preseve MUSB_DEVCTL during suspend.

Signed-off-by: Alexandre Bailon <abailon@baylibre.com>

---
 drivers/usb/musb/da8xx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.7.3

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Bin Liu Dec. 16, 2016, 2:39 a.m. UTC | #1
On Mon, Nov 28, 2016 at 05:26:21PM +0100, Alexandre Bailon wrote:
> On da8xx, VBUS is not maintained during suspend when musb is in host mode.

> On resume, all the connected devices will be disconnected and then will

> be enumerated again.

> This happens because MUSB_DEVCTL is cleared during suspend.

> MUSB_DEVCTL is clear twice: once by da8xx_musb_disable()

> and once musb_generic_disable().

> 

> Don't clear MUSB_DEVCTL in da8xx_musb_disable() and use the quirk

> MUSB_PRESERVE_DEVCTL to preseve MUSB_DEVCTL during suspend.

> 

> Signed-off-by: Alexandre Bailon <abailon@baylibre.com>

> ---

>  drivers/usb/musb/da8xx.c | 4 ++--

>  1 file changed, 2 insertions(+), 2 deletions(-)

> 

> diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c

> index 905f0d9..90f0c06 100644

> --- a/drivers/usb/musb/da8xx.c

> +++ b/drivers/usb/musb/da8xx.c

> @@ -125,7 +125,6 @@ static void da8xx_musb_disable(struct musb *musb)

>  	musb_writel(reg_base, DA8XX_USB_INTR_MASK_CLEAR_REG,

>  		    DA8XX_INTR_USB_MASK |

>  		    DA8XX_INTR_TX_MASK | DA8XX_INTR_RX_MASK);

> -	musb_writeb(musb->mregs, MUSB_DEVCTL, 0);

>  	musb_writel(reg_base, DA8XX_USB_END_OF_INTR_REG, 0);

>  }


This would be in a separate patch. I have cleaned it up as in [1].

>  

> @@ -458,7 +457,8 @@ static inline u8 get_vbus_power(struct device *dev)

>  }

>  

>  static const struct musb_platform_ops da8xx_ops = {

> -	.quirks		= MUSB_DMA_CPPI | MUSB_INDEXED_EP,

> +	.quirks		= MUSB_DMA_CPPI | MUSB_INDEXED_EP |

> +			  MUSB_PRESERVE_DEVCTL,


MUSB_PRESERVE_SESSION would be a better name.

>  	.init		= da8xx_musb_init,

>  	.exit		= da8xx_musb_exit,

>  


[1] http://www.spinics.net/lists/linux-usb/msg150857.html

Regards,
-Bin.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
index 905f0d9..90f0c06 100644
--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.c
@@ -125,7 +125,6 @@  static void da8xx_musb_disable(struct musb *musb)
 	musb_writel(reg_base, DA8XX_USB_INTR_MASK_CLEAR_REG,
 		    DA8XX_INTR_USB_MASK |
 		    DA8XX_INTR_TX_MASK | DA8XX_INTR_RX_MASK);
-	musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
 	musb_writel(reg_base, DA8XX_USB_END_OF_INTR_REG, 0);
 }
 
@@ -458,7 +457,8 @@  static inline u8 get_vbus_power(struct device *dev)
 }
 
 static const struct musb_platform_ops da8xx_ops = {
-	.quirks		= MUSB_DMA_CPPI | MUSB_INDEXED_EP,
+	.quirks		= MUSB_DMA_CPPI | MUSB_INDEXED_EP |
+			  MUSB_PRESERVE_DEVCTL,
 	.init		= da8xx_musb_init,
 	.exit		= da8xx_musb_exit,