diff mbox series

usb: chipidea: imx: enable OTG overcurrent in case USB subsystem is already started

Message ID 1535378396-9328-1-git-send-email-nicolas.adell@actia.fr (mailing list archive)
State New, archived
Headers show
Series usb: chipidea: imx: enable OTG overcurrent in case USB subsystem is already started | expand

Commit Message

Nicolas Adell Aug. 27, 2018, 1:59 p.m. UTC
When initializing the USB subsystem before starting the kernel,
OTG overcurrent detection is disabled. In case the OTG polarity of
overcurrent is low active, the overcurrent detection is never enabled
again and events cannot be reported as expected. Because imx usb
overcurrent polarity is low active by default, only detection needs
to be enable in usbmisc init function.

Signed-off-by: Nicolas Adell <nicolas.adell@actia.fr>
---
 drivers/usb/chipidea/usbmisc_imx.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Peter Chen Sept. 12, 2018, 8:07 a.m. UTC | #1
On Tue, Sep 11, 2018 at 5:39 PM Nicolas Adell <nicolas.adell@actia.fr> wrote:
>
> On Thursday 30 Aug 2018 à 16:44:01 (+0800), Peter Chen wrote:
> > On Wed, Aug 29, 2018 at 8:22 PM Nicolas Adell <nicolas.adell@actia.fr>
> > wrote:
> >
> > > On Wednesday 29 Aug 2018 ą 17:37:19 (+0800), Peter Chen wrote:
> > > > On Mon, Aug 27, 2018 at 10:01 PM Nicolas Adell <nicolas.adell@actia.fr>
> > > > wrote:
> > > >
> > > > > When initializing the USB subsystem before starting the kernel,
> > > > > OTG overcurrent detection is disabled. In case the OTG polarity of
> > > > > overcurrent is low active, the overcurrent detection is never enabled
> > > > > again and events cannot be reported as expected. Because imx usb
> > > > > overcurrent polarity is low active by default, only detection needs
> > > > > to be enable in usbmisc init function.
> > > > >
> > > > > Signed-off-by: Nicolas Adell <nicolas.adell@actia.fr>
> > > > > ---
> > > > >  drivers/usb/chipidea/usbmisc_imx.c | 2 ++
> > > > >  1 file changed, 2 insertions(+)
> > > > >
> > > > > diff --git a/drivers/usb/chipidea/usbmisc_imx.c
> > > > > b/drivers/usb/chipidea/usbmisc_imx.c
> > > > > index 34ad5bf..424ecb1 100644
> > > > > --- a/drivers/usb/chipidea/usbmisc_imx.c
> > > > > +++ b/drivers/usb/chipidea/usbmisc_imx.c
> > > > > @@ -343,6 +343,8 @@ static int usbmisc_imx6q_init(struct
> > > imx_usbmisc_data
> > > > > *data)
> > > > >         } else if (data->oc_polarity == 1) {
> > > > >                 /* High active */
> > > > >                 reg &= ~(MX6_BM_OVER_CUR_DIS |
> > > MX6_BM_OVER_CUR_POLARITY);
> > > > > +       } else {
> > > > > +               reg &= ~(MX6_BM_OVER_CUR_DIS);
> > > > >         }
> > > > >         writel(reg, usbmisc->base + data->index * 4);
> > > > >
> > > > >
> > > > The Over-Current detection is enabled by default for imx6, is it not true
> > > > for your system?
> > > >
> > > > Peter
> > >
> > > Indeed, overcurrent detection is enabled by default.
> > > But the issue appeared when I have had to enable USB subsystem in u-boot,
> > > using
> > > 'usb start' command, in order to boot over an USB ethernet dongle.
> > > In this specific case, the detection was disabled and never enabled again.
> > >
> > >
> > Get it ,will apply it.
> >
> > Thanks.
> Hi Peter,
>
> Because patch has not been integrated yet,
> did you succeed in reproducing the issue ?
>
> Thanks.
> >
> >
> > > Nicolas
> > >


It is already at my next tree, will send to Greg for next rc1 in future.

https://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb.git/commit/?h=ci-for-usb-next&id=1657ebedd025fcf93c9e7ac6c8adda400774f955

Peter
diff mbox series

Patch

diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c
index 34ad5bf..424ecb1 100644
--- a/drivers/usb/chipidea/usbmisc_imx.c
+++ b/drivers/usb/chipidea/usbmisc_imx.c
@@ -343,6 +343,8 @@  static int usbmisc_imx6q_init(struct imx_usbmisc_data *data)
 	} else if (data->oc_polarity == 1) {
 		/* High active */
 		reg &= ~(MX6_BM_OVER_CUR_DIS | MX6_BM_OVER_CUR_POLARITY);
+	} else {
+		reg &= ~(MX6_BM_OVER_CUR_DIS);
 	}
 	writel(reg, usbmisc->base + data->index * 4);