Commit 26910f97 authored by Minda Chen's avatar Minda Chen Committed by Greg Kroah-Hartman

usb: cdns3: Add PHY mode switch to usb2 PHY

cdns3 just set PHY mode switch for USB3.0 PHY.
If USB 2.0 PHY contains PHY mode switch setting,
USB 2.0 PHY mode function can't be called.
So add PHY mode switch function for USB 2.0 PHY.
Signed-off-by: default avatarMinda Chen <minda.chen@starfivetech.com>
Reviewed-by: default avatarRoger Quadros <rogerq@kernel.org>
Link: https://lore.kernel.org/r/20230721095923.20445-1-minda.chen@starfivetech.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3bd442e4
...@@ -196,6 +196,7 @@ int cdns_drd_host_on(struct cdns *cdns) ...@@ -196,6 +196,7 @@ int cdns_drd_host_on(struct cdns *cdns)
if (ret) if (ret)
dev_err(cdns->dev, "timeout waiting for xhci_ready\n"); dev_err(cdns->dev, "timeout waiting for xhci_ready\n");
phy_set_mode(cdns->usb2_phy, PHY_MODE_USB_HOST);
phy_set_mode(cdns->usb3_phy, PHY_MODE_USB_HOST); phy_set_mode(cdns->usb3_phy, PHY_MODE_USB_HOST);
return ret; return ret;
} }
...@@ -216,6 +217,7 @@ void cdns_drd_host_off(struct cdns *cdns) ...@@ -216,6 +217,7 @@ void cdns_drd_host_off(struct cdns *cdns)
readl_poll_timeout_atomic(&cdns->otg_regs->state, val, readl_poll_timeout_atomic(&cdns->otg_regs->state, val,
!(val & OTGSTATE_HOST_STATE_MASK), !(val & OTGSTATE_HOST_STATE_MASK),
1, 2000000); 1, 2000000);
phy_set_mode(cdns->usb2_phy, PHY_MODE_INVALID);
phy_set_mode(cdns->usb3_phy, PHY_MODE_INVALID); phy_set_mode(cdns->usb3_phy, PHY_MODE_INVALID);
} }
...@@ -248,6 +250,7 @@ int cdns_drd_gadget_on(struct cdns *cdns) ...@@ -248,6 +250,7 @@ int cdns_drd_gadget_on(struct cdns *cdns)
return ret; return ret;
} }
phy_set_mode(cdns->usb2_phy, PHY_MODE_USB_DEVICE);
phy_set_mode(cdns->usb3_phy, PHY_MODE_USB_DEVICE); phy_set_mode(cdns->usb3_phy, PHY_MODE_USB_DEVICE);
return 0; return 0;
} }
...@@ -273,6 +276,7 @@ void cdns_drd_gadget_off(struct cdns *cdns) ...@@ -273,6 +276,7 @@ void cdns_drd_gadget_off(struct cdns *cdns)
readl_poll_timeout_atomic(&cdns->otg_regs->state, val, readl_poll_timeout_atomic(&cdns->otg_regs->state, val,
!(val & OTGSTATE_DEV_STATE_MASK), !(val & OTGSTATE_DEV_STATE_MASK),
1, 2000000); 1, 2000000);
phy_set_mode(cdns->usb2_phy, PHY_MODE_INVALID);
phy_set_mode(cdns->usb3_phy, PHY_MODE_INVALID); phy_set_mode(cdns->usb3_phy, PHY_MODE_INVALID);
} }
EXPORT_SYMBOL_GPL(cdns_drd_gadget_off); EXPORT_SYMBOL_GPL(cdns_drd_gadget_off);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment