From: Xu Yang <xu.yang_2@nxp.com>
To: "Pu, Hui" <Hui.Pu@gehealthcare.com>
Cc: "peter.chen@kernel.org" <peter.chen@kernel.org>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"shawnguo@kernel.org" <shawnguo@kernel.org>,
"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
"kernel@pengutronix.de" <kernel@pengutronix.de>,
"festevam@gmail.com" <festevam@gmail.com>,
"linux-imx@nxp.com" <linux-imx@nxp.com>,
"balbi@ti.com" <balbi@ti.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"jun.li@nxp.com" <jun.li@nxp.com>,
"Ray, Ian" <ian.ray@gehealthcare.com>
Subject: Re: [PATCH 1/3] usb: chipidea: add USB PHY event
Date: Thu, 29 Aug 2024 17:17:27 +0800 [thread overview]
Message-ID: <20240829091727.plsxzsvkevziitfi@hippo> (raw)
In-Reply-To: <PH0PR22MB3884EF3CBE887E4CF59654CFE1942@PH0PR22MB3884.namprd22.prod.outlook.com>
Hi Paul,
On Tue, Aug 27, 2024 at 06:10:09AM +0000, Pu, Hui wrote:
> > Add USB PHY event for below situation:
> > - usb role changed
> > - vbus connect
> > - vbus disconnect
> > - gadget driver is enumerated
> >
> > USB PHY driver can get the last event after above situation occurs and deal with
> > different situations.
> >
> > Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> > ---
> > drivers/usb/chipidea/ci.h | 18 ++++++++++++++++--
> > drivers/usb/chipidea/udc.c | 10 ++++++++++
> > 2 files changed, 26 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h index
> > f210b7489fd5..d262b9df7b3d 100644
> > --- a/drivers/usb/chipidea/ci.h
> > +++ b/drivers/usb/chipidea/ci.h
> > @@ -281,8 +281,19 @@ static inline int ci_role_start(struct ci_hdrc *ci, enum
> > ci_role role)
> > return -ENXIO;
> >
> > ret = ci->roles[role]->start(ci);
> > - if (!ret)
> > - ci->role = role;
> > + if (ret)
> > + return ret;
> > +
> > + ci->role = role;
> > +
> > + if (ci->usb_phy) {
> > + if (role == CI_ROLE_HOST)
> > + usb_phy_set_event(ci->usb_phy, USB_EVENT_ID);
> > + else
> > + /* in device mode but vbus is invalid*/
> > + usb_phy_set_event(ci->usb_phy, USB_EVENT_NONE);
> > + }
> > +
> > return ret;
> > }
> >
> > @@ -296,6 +307,9 @@ static inline void ci_role_stop(struct ci_hdrc *ci)
> > ci->role = CI_ROLE_END;
> >
> > ci->roles[role]->stop(ci);
> > +
> > + if (ci->usb_phy)
> > + usb_phy_set_event(ci->usb_phy, USB_EVENT_NONE);
> > }
> >
> > static inline enum usb_role ci_role_to_usb_role(struct ci_hdrc *ci) diff --git
> > a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index
> > 54c09245ad05..d58355427eeb 100644
> > --- a/drivers/usb/chipidea/udc.c
> > +++ b/drivers/usb/chipidea/udc.c
> > @@ -1718,6 +1718,13 @@ static int ci_udc_vbus_session(struct usb_gadget
> > *_gadget, int is_active)
> > ret = ci->platdata->notify_event(ci,
> > CI_HDRC_CONTROLLER_VBUS_EVENT);
> >
> > + if (ci->usb_phy) {
> > + if (is_active)
> > + usb_phy_set_event(ci->usb_phy, USB_EVENT_VBUS);
> > + else
> > + usb_phy_set_event(ci->usb_phy, USB_EVENT_NONE);
> > + }
> > +
> > if (ci->driver)
> > ci_hdrc_gadget_connect(_gadget, is_active);
> >
> > @@ -2034,6 +2041,9 @@ static irqreturn_t udc_irq(struct ci_hdrc *ci)
> > if (USBi_PCI & intr) {
> > ci->gadget.speed = hw_port_is_high_speed(ci) ?
> > USB_SPEED_HIGH : USB_SPEED_FULL;
> > + if (ci->usb_phy)
> > + usb_phy_set_event(ci->usb_phy,
> > + USB_EVENT_ENUMERATED);
> > if (ci->suspended) {
> > if (ci->driver->resume) {
> > spin_unlock(&ci->lock);
> > --
> > 2.34.1
>
>
> Hi guys,
>
> I'm not sure if I'm replying correctly, please correct me if any mistake.
> (I didn't find the cover letter in this thread.)
>
> This patchset has been merged on master branch, but only the 2/3 patch on linux-5.15.y and linux-6.1.y.
> So, on 5.15.y and 6.1.y, there's a degradation on the i.MX6 devices that the usb hub cannot work well.
Thanks for reporting this.
Could the usb hub work well if you apply patch 1 and patch 3 to your kernel?
Thanks,
Xu Yang
>
> - Paul
next prev parent reply other threads:[~2024-08-29 9:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-27 11:03 [PATCH 1/3] usb: chipidea: add USB PHY event Xu Yang
2023-06-27 11:03 ` [PATCH 2/3] usb: phy: mxs: fix getting wrong state with mxs_phy_is_otg_host() Xu Yang
2023-07-10 3:20 ` Peter Chen
2023-07-26 6:08 ` Francesco Dolcini
2023-07-26 6:40 ` [EXT] " Xu Yang
2023-06-27 11:03 ` [PATCH 3/3] usb: phy: mxs: disconnect line when USB charger is attached Xu Yang
2023-07-10 3:21 ` Peter Chen
2023-07-10 3:19 ` [PATCH 1/3] usb: chipidea: add USB PHY event Peter Chen
2023-07-18 12:27 ` Luca Ceresoli
2024-08-27 6:10 ` Pu, Hui
2024-08-29 9:17 ` Xu Yang [this message]
2024-08-29 9:59 ` Pu, Hui
2024-09-02 7:59 ` Xu Yang
2024-09-02 8:49 ` Greg KH
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=20240829091727.plsxzsvkevziitfi@hippo \
--to=xu.yang_2@nxp.com \
--cc=Hui.Pu@gehealthcare.com \
--cc=balbi@ti.com \
--cc=festevam@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=ian.ray@gehealthcare.com \
--cc=jun.li@nxp.com \
--cc=kernel@pengutronix.de \
--cc=linux-imx@nxp.com \
--cc=linux-usb@vger.kernel.org \
--cc=peter.chen@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
/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