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

Bin Liu
2016-05-13T22:02:32Z

Hi,

On Fri, May 13, 2016 at 02:39:01PM -0700, Tony Lindgren wrote:
> * Bin Liu <b-liu-l0cyMroinI0@public.gmane.org> [160513 14:24]:
> > Hi,
> >
> > On Fri, May 13, 2016 at 02:17:39PM -0700, Tony Lindgren wrote:
> > > * Bin Liu <b-liu-l0cyMroinI0@public.gmane.org> [160513 14:05]:
> > > > Hi,
> > > >
> > > > On Wed, May 11, 2016 at 05:53:11PM -0700, Tony Lindgren wrote:
> > > > > 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 getting rid of omap2430_musb_set_mode() and only
> > > >
> > > > By doing so, you lost the feature of switching mode from sysfs, I am not
> > > > sure if there is anyone using it though, still, it is a regression.
> > >
> > > Oh right, that's a good point.
> > >
> > > How about we change musb_core to call the optional set_mode() if implemented,
> >
> > The core already does so. Please check musb_core.h.
>
> Oh do you have some pending patches for this already not yet
> in Linux next?

No.

>
> > > and then set the session bit in host mode only? That way we can get rid of
> > > the musb core tinkering in the glue layer drivers eventually?
>
> So currently we have this in musb_core.h:
>
> static inline int musb_platform_set_mode(struct musb *musb, u8 mode)
> {
> if (!musb->ops->set_mode)
> return 0;
>
> return musb->ops->set_mode(musb, mode);
> }
>
> What I meant is we could add generic support for the session bit:
>
> static inline int musb_platform_set_mode(struct musb *musb, u8 mode)
> {
> if (!musb->ops->set_mode)
> return musb_default_set_mode(musb, mode);
>
> return musb->ops->set_mode(musb, mode);
> }

But what would be in musb_default_set_mode()? Currently only am35x,
da8xx, dsps, and omap2430 glues implement _set_mode(), but they don't
have any in common. Only omap2430 sets session bit in _set_mode(), no
one else does so.

Regards,
-Bin.

>
> Regards,
>
> Tony