Commit 9f650135 authored by Peter Chen's avatar Peter Chen Committed by Felipe Balbi

usb: cdns3: drd: call PHY .set_mode accordingly

Some PHYs may need to enter related mode, and do some settings.
Signed-off-by: default avatarPeter Chen <peter.chen@nxp.com>
Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
parent 0eeda059
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/iopoll.h> #include <linux/iopoll.h>
#include <linux/usb/otg.h> #include <linux/usb/otg.h>
#include <linux/phy/phy.h>
#include "gadget.h" #include "gadget.h"
#include "drd.h" #include "drd.h"
...@@ -157,6 +158,7 @@ int cdns3_drd_host_on(struct cdns3 *cdns) ...@@ -157,6 +158,7 @@ int cdns3_drd_host_on(struct cdns3 *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->usb3_phy, PHY_MODE_USB_HOST);
return ret; return ret;
} }
...@@ -176,6 +178,7 @@ void cdns3_drd_host_off(struct cdns3 *cdns) ...@@ -176,6 +178,7 @@ void cdns3_drd_host_off(struct cdns3 *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->usb3_phy, PHY_MODE_INVALID);
} }
/** /**
...@@ -202,6 +205,7 @@ int cdns3_drd_gadget_on(struct cdns3 *cdns) ...@@ -202,6 +205,7 @@ int cdns3_drd_gadget_on(struct cdns3 *cdns)
return ret; return ret;
} }
phy_set_mode(cdns->usb3_phy, PHY_MODE_USB_DEVICE);
return 0; return 0;
} }
...@@ -225,6 +229,7 @@ void cdns3_drd_gadget_off(struct cdns3 *cdns) ...@@ -225,6 +229,7 @@ void cdns3_drd_gadget_off(struct cdns3 *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->usb3_phy, PHY_MODE_INVALID);
} }
/** /**
......
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