From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Aswath Govindraju <a-govindraju@ti.com>
Cc: Kishon Vijay Abraham I <kishon@ti.com>,
Vignesh Raghavendra <vigneshr@ti.com>,
Felipe Balbi <balbi@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Andrey Smirnov <andrew.smirnov@gmail.com>
Subject: Re: [PATCH] usb: dwc3: drd: Add support for extcon drd notifier even with usb role switch config enabled
Date: Wed, 23 Feb 2022 01:03:24 +0000 [thread overview]
Message-ID: <273c9e6d-4fa3-52d9-e978-8f2be81dd6f6@synopsys.com> (raw)
In-Reply-To: <20220218093348.1098-1-a-govindraju@ti.com>
Hi,
Aswath Govindraju wrote:
> In AM62x SoC, the USB controller supports USB role switching by using the
> extcon drd notifiers. The current implementation does not accommodate this.
> If usb role switching is enabled then drd notifiers are not added. If usb
> role switching is not enabled then the dr_mode is forced to peripheral
> (dwc3_get_dr_mode) and role switching will not be possible(dwc3_set_mode).
>
> Therefore, rearrange the "if else" logic such that extcon drd notifiers can
> be added even with usb role switching enabled.
>
> Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
> ---
> drivers/usb/dwc3/drd.c | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c
> index b919ea3d87f2..0e86b1d8b50c 100644
> --- a/drivers/usb/dwc3/drd.c
> +++ b/drivers/usb/dwc3/drd.c
> @@ -583,12 +583,7 @@ int dwc3_drd_init(struct dwc3 *dwc)
> if (IS_ERR(dwc->edev))
> return PTR_ERR(dwc->edev);
>
> - if (ROLE_SWITCH &&
> - device_property_read_bool(dwc->dev, "usb-role-switch")) {
> - ret = dwc3_setup_role_switch(dwc);
> - if (ret < 0)
> - return ret;
> - } else if (dwc->edev) {
> + if (dwc->edev) {
> dwc->edev_nb.notifier_call = dwc3_drd_notifier;
> ret = extcon_register_notifier(dwc->edev, EXTCON_USB_HOST,
> &dwc->edev_nb);
> @@ -598,7 +593,14 @@ int dwc3_drd_init(struct dwc3 *dwc)
> }
>
> dwc3_drd_update(dwc);
> - } else {
> + }
> +
> + if (ROLE_SWITCH &&
> + device_property_read_bool(dwc->dev, "usb-role-switch")) {
> + ret = dwc3_setup_role_switch(dwc);
> + if (ret < 0)
> + return ret;
> + } else if (!dwc->edev) {
> dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_OTG);
>
> /* use OTG block to get ID event */
Please check the patch by Andrey Smirnov and see if it works for you:
https://lore.kernel.org/linux-usb/20220221192020.346622-1-andrew.smirnov@gmail.com/
Thanks,
Thinh
next prev parent reply other threads:[~2022-02-23 1:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-18 9:33 Aswath Govindraju
2022-02-23 1:03 ` Thinh Nguyen [this message]
2022-02-23 7:34 ` Aswath Govindraju
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=273c9e6d-4fa3-52d9-e978-8f2be81dd6f6@synopsys.com \
--to=thinh.nguyen@synopsys.com \
--cc=a-govindraju@ti.com \
--cc=andrew.smirnov@gmail.com \
--cc=balbi@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=kishon@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=vigneshr@ti.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
all inboxes | Powered by JetHome®