mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 19:08:57 +09:00
usb: phy: mxs: fix getting wrong state with mxs_phy_is_otg_host()
[ Upstream commit5eda42aebb] The function mxs_phy_is_otg_host() will return true if OTG_ID_VALUE is 0 at USBPHY_CTRL register. However, OTG_ID_VALUE will not reflect the real state if the ID pin is float, such as Host-only or Type-C cases. The value of OTG_ID_VALUE is always 1 which means device mode. This patch will fix the issue by judging the current mode based on last_event. The controller will update last_event in time. Fixes:7b09e67639("usb: phy: mxs: refine mxs_phy_disconnect_line") Signed-off-by: Xu Yang <xu.yang_2@nxp.com> Acked-by: Peter Chen <peter.chen@kernel.org> Link: https://lore.kernel.org/r/20230627110353.1879477-2-xu.yang_2@nxp.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
5a6f480b2e
commit
cc2d5cdb19
@@ -388,14 +388,8 @@ static void __mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool disconnect)
|
|||||||
|
|
||||||
static bool mxs_phy_is_otg_host(struct mxs_phy *mxs_phy)
|
static bool mxs_phy_is_otg_host(struct mxs_phy *mxs_phy)
|
||||||
{
|
{
|
||||||
void __iomem *base = mxs_phy->phy.io_priv;
|
return IS_ENABLED(CONFIG_USB_OTG) &&
|
||||||
u32 phyctrl = readl(base + HW_USBPHY_CTRL);
|
mxs_phy->phy.last_event == USB_EVENT_ID;
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_USB_OTG) &&
|
|
||||||
!(phyctrl & BM_USBPHY_CTRL_OTG_ID_VALUE))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool on)
|
static void mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool on)
|
||||||
|
|||||||
Reference in New Issue
Block a user