aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLi Jun <b47624@freescale.com>2014-06-29 02:16:03 -0400
committerLi Jun <B47624@freescale.com>2014-06-30 04:37:52 -0400
commita7d025f0f9494294b057fb4a2e89d5ace41c76e8 (patch)
tree15ca3974187381379404dce4780cc760595da076
parent0b2b7c9b4005035cb7e62520c4d87a76004aea07 (diff)
ENGR00320439-9 usb: phy: mxs: refine mxs_phy_disconnect_line
For non-otg mode, we keep the usage of disconnect line between phy analog and digital unchanging; for otg mode, at peripheral role, we keep the usage unchanging too, at host role, the digital part needs to know dp/dm change to respond device's data pulse when it is at low power mode. Signed-off-by: Peter Chen <peter.chen@freescale.com>
-rw-r--r--drivers/usb/phy/phy-mxs-usb.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
index 305a3134bfa9..56602e905dc0 100644
--- a/drivers/usb/phy/phy-mxs-usb.c
+++ b/drivers/usb/phy/phy-mxs-usb.c
@@ -40,6 +40,7 @@
40 40
41#define BM_USBPHY_CTRL_SFTRST BIT(31) 41#define BM_USBPHY_CTRL_SFTRST BIT(31)
42#define BM_USBPHY_CTRL_CLKGATE BIT(30) 42#define BM_USBPHY_CTRL_CLKGATE BIT(30)
43#define BM_USBPHY_CTRL_OTG_ID_VALUE BIT(27)
43#define BM_USBPHY_CTRL_ENAUTOSET_USBCLKS BIT(26) 44#define BM_USBPHY_CTRL_ENAUTOSET_USBCLKS BIT(26)
44#define BM_USBPHY_CTRL_ENAUTOCLR_USBCLKGATE BIT(25) 45#define BM_USBPHY_CTRL_ENAUTOCLR_USBCLKGATE BIT(25)
45#define BM_USBPHY_CTRL_ENVBUSCHG_WKUP BIT(23) 46#define BM_USBPHY_CTRL_ENVBUSCHG_WKUP BIT(23)
@@ -129,7 +130,8 @@ static const struct mxs_phy_data imx6sl_phy_data = {
129}; 130};
130 131
131static const struct mxs_phy_data imx6sx_phy_data = { 132static const struct mxs_phy_data imx6sx_phy_data = {
132 .flags = MXS_PHY_HAS_ANATOP, 133 .flags = MXS_PHY_HAS_ANATOP |
134 MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS,
133}; 135};
134 136
135static const struct of_device_id mxs_phy_dt_ids[] = { 137static const struct of_device_id mxs_phy_dt_ids[] = {
@@ -221,11 +223,6 @@ static bool mxs_phy_get_vbus_status(struct mxs_phy *mxs_phy)
221 return false; 223 return false;
222} 224}
223 225
224#ifdef CONFIG_USB_OTG_FSM
225static void mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool on)
226{
227}
228#else
229static void __mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool disconnect) 226static void __mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool disconnect)
230{ 227{
231 void __iomem *base = mxs_phy->phy.io_priv; 228 void __iomem *base = mxs_phy->phy.io_priv;
@@ -258,6 +255,18 @@ static void __mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool disconnect)
258 usleep_range(500, 1000); 255 usleep_range(500, 1000);
259} 256}
260 257
258static bool mxs_phy_is_otg_host(struct mxs_phy *mxs_phy)
259{
260 void __iomem *base = mxs_phy->phy.io_priv;
261 u32 phyctrl = readl(base + HW_USBPHY_CTRL);
262
263 if (IS_ENABLED(CONFIG_USB_OTG) &&
264 !(phyctrl & BM_USBPHY_CTRL_OTG_ID_VALUE))
265 return true;
266
267 return false;
268}
269
261static void mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool on) 270static void mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool on)
262{ 271{
263 bool vbus_is_on = false; 272 bool vbus_is_on = false;
@@ -272,13 +281,12 @@ static void mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool on)
272 281
273 vbus_is_on = mxs_phy_get_vbus_status(mxs_phy); 282 vbus_is_on = mxs_phy_get_vbus_status(mxs_phy);
274 283
275 if (on && !vbus_is_on) 284 if (on && !vbus_is_on && !mxs_phy_is_otg_host(mxs_phy))
276 __mxs_phy_disconnect_line(mxs_phy, true); 285 __mxs_phy_disconnect_line(mxs_phy, true);
277 else 286 else
278 __mxs_phy_disconnect_line(mxs_phy, false); 287 __mxs_phy_disconnect_line(mxs_phy, false);
279 288
280} 289}
281#endif
282 290
283static void mxs_phy_enable_ldo_in_suspend(struct mxs_phy *mxs_phy, bool on) 291static void mxs_phy_enable_ldo_in_suspend(struct mxs_phy *mxs_phy, bool on)
284{ 292{