Message ID | 20230627110353.1879477-3-xu.yang_2@nxp.com |
---|---|
State | New |
Headers | show |
Series | [1/3] usb: chipidea: add USB PHY event | expand |
On 23-06-27 19:03:53, Xu Yang wrote: > For mxs PHY, if there is a vbus but the bus is not enumerated, we need > to force the dp/dm as SE0 from the controller side. If not, there is > possible USB wakeup due to unstable dp/dm, since there is possible no > pull on dp/dm, such as there is a USB charger on the port. > > Signed-off-by: Xu Yang <xu.yang_2@nxp.com> Acked-by: Peter Chen <peter.chen@kernel.org> Peter > --- > drivers/usb/phy/phy-mxs-usb.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c > index f484c79efa6c..619411aab86c 100644 > --- a/drivers/usb/phy/phy-mxs-usb.c > +++ b/drivers/usb/phy/phy-mxs-usb.c > @@ -395,6 +395,7 @@ static bool mxs_phy_is_otg_host(struct mxs_phy *mxs_phy) > static void mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool on) > { > bool vbus_is_on = false; > + enum usb_phy_events last_event = mxs_phy->phy.last_event; > > /* If the SoCs don't need to disconnect line without vbus, quit */ > if (!(mxs_phy->data->flags & MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS)) > @@ -406,7 +407,8 @@ static void mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool on) > > vbus_is_on = mxs_phy_get_vbus_status(mxs_phy); > > - if (on && !vbus_is_on && !mxs_phy_is_otg_host(mxs_phy)) > + if (on && ((!vbus_is_on && !mxs_phy_is_otg_host(mxs_phy)) > + || (last_event == USB_EVENT_VBUS))) > __mxs_phy_disconnect_line(mxs_phy, true); > else > __mxs_phy_disconnect_line(mxs_phy, false); > -- > 2.34.1 >
diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index f484c79efa6c..619411aab86c 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -395,6 +395,7 @@ static bool mxs_phy_is_otg_host(struct mxs_phy *mxs_phy) static void mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool on) { bool vbus_is_on = false; + enum usb_phy_events last_event = mxs_phy->phy.last_event; /* If the SoCs don't need to disconnect line without vbus, quit */ if (!(mxs_phy->data->flags & MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS)) @@ -406,7 +407,8 @@ static void mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool on) vbus_is_on = mxs_phy_get_vbus_status(mxs_phy); - if (on && !vbus_is_on && !mxs_phy_is_otg_host(mxs_phy)) + if (on && ((!vbus_is_on && !mxs_phy_is_otg_host(mxs_phy)) + || (last_event == USB_EVENT_VBUS))) __mxs_phy_disconnect_line(mxs_phy, true); else __mxs_phy_disconnect_line(mxs_phy, false);
For mxs PHY, if there is a vbus but the bus is not enumerated, we need to force the dp/dm as SE0 from the controller side. If not, there is possible USB wakeup due to unstable dp/dm, since there is possible no pull on dp/dm, such as there is a USB charger on the port. Signed-off-by: Xu Yang <xu.yang_2@nxp.com> --- drivers/usb/phy/phy-mxs-usb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)