diff mbox

[10/15] usb: musb: Don't set d+ high before enable for 2430 glue layer

Message ID 20160513223540.GH5995@atomide.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tony Lindgren May 13, 2016, 10:35 p.m. UTC
* Tony Lindgren <tony@atomide.com> [160513 14:19]:
> * Bin Liu <b-liu@ti.com> [160513 14:05]:
> > In stead of removing it, session bit should only be set when musb_mode
> > == MUSB_HOST, will this fix the D+ pullup problem?
> 
> Good point, I forgot about it being specific to host mode. I'll check.

Yeah good call, the patch below fixes the issue. Then we can remove the
set_mode later if the generic approach looks OK to you.

Regards,

Tony

8< ----------------------
From: Tony Lindgren <tony@atomide.com>
Date: Fri, 13 May 2016 07:59:35 -0700
Subject: [PATCH] usb: musb: Don't set d+ high before enable for 2430 glue
 layer

At least 2430 glue layer pulls d+ high on start up even if there are
no gadgets configured. This is bad at least for anything using a separate
battery charger chip as it can confuse the charger detection.

Let's fix the issue by only setting the SESSION bit in host mode
as suggested by Bin Liu <b-liu@ti.com>.

Signed-off-by: Tony Lindgren <tony@atomide.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" 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 May 15, 2016, 4:47 a.m. UTC | #1
Hi,

On Fri, May 13, 2016 at 03:35:40PM -0700, Tony Lindgren wrote:
> * Tony Lindgren <tony@atomide.com> [160513 14:19]:
> > * Bin Liu <b-liu@ti.com> [160513 14:05]:
> > > In stead of removing it, session bit should only be set when musb_mode
> > > == MUSB_HOST, will this fix the D+ pullup problem?
> > 
> > Good point, I forgot about it being specific to host mode. I'll check.
> 
> Yeah good call, the patch below fixes the issue. Then we can remove the

Good to know it fixes the issue.

> set_mode later if the generic approach looks OK to you.

I don't think we need to add the generic approach which sets session bit
in core set_mode(), at least for now, because only omap2430 glue needs
to set the session bit in its set_mode(), no one else does so.

Regards,
-Bin.

> 
> Regards,
> 
> Tony
> 
> 8< ----------------------
> From: Tony Lindgren <tony@atomide.com>
> Date: Fri, 13 May 2016 07:59:35 -0700
> Subject: [PATCH] usb: musb: Don't set d+ high before enable for 2430 glue
>  layer
> 
> At least 2430 glue layer pulls d+ high on start up even if there are
> no gadgets configured. This is bad at least for anything using a separate
> battery charger chip as it can confuse the charger detection.
> 
> Let's fix the issue by only setting the SESSION bit in host mode
> as suggested by Bin Liu <b-liu@ti.com>.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> 
> --- a/drivers/usb/musb/omap2430.c
> +++ b/drivers/usb/musb/omap2430.c
> @@ -124,8 +124,12 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
>  
>  static int omap2430_musb_set_mode(struct musb *musb, u8 musb_mode)
>  {
> -	u8	devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
> +	u8 devctl;
>  
> +	if (musb_mode != MUSB_HOST)
> +		return 0;
> +
> +	devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
>  	devctl |= MUSB_DEVCTL_SESSION;
>  	musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
>  
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" 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

--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -124,8 +124,12 @@  static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
 
 static int omap2430_musb_set_mode(struct musb *musb, u8 musb_mode)
 {
-	u8	devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
+	u8 devctl;
 
+	if (musb_mode != MUSB_HOST)
+		return 0;
+
+	devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
 	devctl |= MUSB_DEVCTL_SESSION;
 	musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);