From: Greg KH <gregkh@linuxfoundation.org>
To: "周琰杰 (Zhou Yanjie)" <zhouyanjie@wanyeetech.com>
Cc: robh+dt@kernel.org, hminas@synopsys.com, paul@crapouillou.net,
devicetree@vger.kernel.org, linux-usb@vger.kernel.org,
linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
dongsheng.qiu@ingenic.com, aric.pzqi@ingenic.com,
rick.tyliu@ingenic.com, sihui.liu@ingenic.com,
jun.jiang@ingenic.com, sernia.zhou@foxmail.com,
"Dragan Čečavac" <dragancecavac@yahoo.com>
Subject: Re: [PATCH 2/2] USB: dwc2: Add OTG support for Ingenic SoCs.
Date: Tue, 27 Jul 2021 16:27:03 +0200 [thread overview]
Message-ID: <YQAXt1pCFZqRm2ud@kroah.com> (raw)
In-Reply-To: <1627116521-124612-3-git-send-email-zhouyanjie@wanyeetech.com>
On Sat, Jul 24, 2021 at 04:48:41PM +0800, 周琰杰 (Zhou Yanjie) wrote:
> Add OTG support for the JZ4775 SoC, the JZ4780 SoC, the X1000
> SoC, the X1600 SoC, the X1830 SoC, and the X2000 SoC. Introduce
> support for disable Ingenic overcurrent detection, once selected
> it enables GOTGCTL register bits VbvalidOvEn and VbvalidOvVal to
> disable the VBUS overcurrent detection.
>
> This patch is derived from Dragan Čečavac (in the kernel 3.18.3
> tree of CI20). It is very useful for the MIPS Creator CI20 (r1).
> Without this patch, OTG port of CI20 has a great probability to
> face overcurrent warning, which breaks the OTG functionality.
>
> Signed-off-by: Dragan Čečavac <dragancecavac@yahoo.com>
> Signed-off-by: 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>
> ---
> drivers/usb/dwc2/core.c | 9 +++++++++
> drivers/usb/dwc2/core.h | 5 +++++
> drivers/usb/dwc2/params.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++-
> 3 files changed, 62 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
> index 272ae57..c35b2e2 100644
> --- a/drivers/usb/dwc2/core.c
> +++ b/drivers/usb/dwc2/core.c
> @@ -1153,6 +1153,7 @@ static void dwc2_set_turnaround_time(struct dwc2_hsotg *hsotg)
> int dwc2_phy_init(struct dwc2_hsotg *hsotg, bool select_phy)
> {
> u32 usbcfg;
> + u32 otgctl;
> int retval = 0;
>
> if ((hsotg->params.speed == DWC2_SPEED_PARAM_FULL ||
> @@ -1187,6 +1188,14 @@ int dwc2_phy_init(struct dwc2_hsotg *hsotg, bool select_phy)
> dwc2_writel(hsotg, usbcfg, GUSBCFG);
> }
>
> + if (hsotg->params.deactivate_ingenic_overcurrent_detection) {
> + if (dwc2_is_host_mode(hsotg)) {
> + otgctl = readl(hsotg->regs + GOTGCTL);
> + otgctl |= GOTGCTL_VBVALOEN | GOTGCTL_VBVALOVAL;
> + writel(otgctl, hsotg->regs + GOTGCTL);
> + }
> + }
> +
> return retval;
> }
>
> diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
> index ab6b815..e026d13 100644
> --- a/drivers/usb/dwc2/core.h
> +++ b/drivers/usb/dwc2/core.h
> @@ -418,6 +418,10 @@ enum dwc2_ep0_state {
> * detection using GGPIO register.
> * 0 - Deactivate the external level detection (default)
> * 1 - Activate the external level detection
> + * @deactivate_ingenic_overcurrent_detection: Deactivate Ingenic overcurrent
> + * detection.
> + * 0 - Activate the overcurrent detection (default)
Having 0 as "active" is rough to handle over time.
All of the other options are "activate", so please, keep them the same
if at all possible.
thanks,
greg k-h
next prev parent reply other threads:[~2021-07-27 14:27 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-24 8:48 [PATCH 0/2] Add OTG support for Ingenic SoCs 周琰杰 (Zhou Yanjie)
2021-07-24 8:48 ` [PATCH 1/2] dt-bindings: dwc2: Add bindings for new " 周琰杰 (Zhou Yanjie)
2021-07-24 10:46 ` Paul Cercueil
2021-07-24 12:52 ` Zhou Yanjie
2021-07-25 10:31 ` Paul Cercueil
2021-07-30 9:33 ` Zhou Yanjie
2021-07-29 21:38 ` Rob Herring
2021-07-24 8:48 ` [PATCH 2/2] USB: dwc2: Add OTG support for " 周琰杰 (Zhou Yanjie)
2021-07-24 10:49 ` Paul Cercueil
2021-07-24 13:05 ` Zhou Yanjie
2021-07-24 13:24 ` Felipe Balbi
2022-04-12 16:45 ` Zhou Yanjie
2021-07-27 14:27 ` Greg KH [this message]
2021-07-30 9:34 ` Zhou Yanjie
2021-07-30 6:33 ` Minas Harutyunyan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YQAXt1pCFZqRm2ud@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=aric.pzqi@ingenic.com \
--cc=devicetree@vger.kernel.org \
--cc=dongsheng.qiu@ingenic.com \
--cc=dragancecavac@yahoo.com \
--cc=hminas@synopsys.com \
--cc=jun.jiang@ingenic.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=paul@crapouillou.net \
--cc=rick.tyliu@ingenic.com \
--cc=robh+dt@kernel.org \
--cc=sernia.zhou@foxmail.com \
--cc=sihui.liu@ingenic.com \
--cc=zhouyanjie@wanyeetech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).