aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan T. Ivanov <iivanov@mm-sol.com>2014-04-28 09:34:16 -0400
committerFelipe Balbi <balbi@ti.com>2014-04-30 12:28:45 -0400
commita27345434134080273e0597e1d9721ff9e6ca67f (patch)
tree14d28a96a945c76da3b257de3fe2fec24195a276
parent8364f9af237f47fa128bd4e4f7b45beef890c994 (diff)
usb: phy: msm: Use reset framework for LINK and PHY resets
Using reset framework eliminate need of platform specific callbacks and enable reset lines to be specified in DT files. Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r--drivers/usb/phy/phy-msm-usb.c29
-rw-r--r--include/linux/usb/msm_hsusb.h3
2 files changed, 24 insertions, 8 deletions
diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 1bf2d4ee29d2..a6abb1b3a7f0 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -32,6 +32,7 @@
32#include <linux/pm_runtime.h> 32#include <linux/pm_runtime.h>
33#include <linux/of.h> 33#include <linux/of.h>
34#include <linux/of_device.h> 34#include <linux/of_device.h>
35#include <linux/reset.h>
35 36
36#include <linux/usb.h> 37#include <linux/usb.h>
37#include <linux/usb/otg.h> 38#include <linux/usb/otg.h>
@@ -235,12 +236,15 @@ static void ulpi_init(struct msm_otg *motg)
235 236
236static int msm_otg_link_clk_reset(struct msm_otg *motg, bool assert) 237static int msm_otg_link_clk_reset(struct msm_otg *motg, bool assert)
237{ 238{
238 int ret = 0; 239 int ret;
239 240
240 if (!motg->pdata->link_clk_reset) 241 if (motg->pdata->link_clk_reset)
241 return ret; 242 ret = motg->pdata->link_clk_reset(motg->clk, assert);
243 else if (assert)
244 ret = reset_control_assert(motg->link_rst);
245 else
246 ret = reset_control_deassert(motg->link_rst);
242 247
243 ret = motg->pdata->link_clk_reset(motg->clk, assert);
244 if (ret) 248 if (ret)
245 dev_err(motg->phy.dev, "usb link clk reset %s failed\n", 249 dev_err(motg->phy.dev, "usb link clk reset %s failed\n",
246 assert ? "assert" : "deassert"); 250 assert ? "assert" : "deassert");
@@ -250,12 +254,13 @@ static int msm_otg_link_clk_reset(struct msm_otg *motg, bool assert)
250 254
251static int msm_otg_phy_clk_reset(struct msm_otg *motg) 255static int msm_otg_phy_clk_reset(struct msm_otg *motg)
252{ 256{
253 int ret = 0; 257 int ret;
254 258
255 if (!motg->pdata->phy_clk_reset) 259 if (motg->pdata->phy_clk_reset)
256 return ret; 260 ret = motg->pdata->phy_clk_reset(motg->phy_reset_clk);
261 else
262 ret = reset_control_reset(motg->phy_rst);
257 263
258 ret = motg->pdata->phy_clk_reset(motg->phy_reset_clk);
259 if (ret) 264 if (ret)
260 dev_err(motg->phy.dev, "usb phy clk reset failed\n"); 265 dev_err(motg->phy.dev, "usb phy clk reset failed\n");
261 266
@@ -1377,6 +1382,14 @@ static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg)
1377 id = of_match_device(msm_otg_dt_match, &pdev->dev); 1382 id = of_match_device(msm_otg_dt_match, &pdev->dev);
1378 pdata->phy_type = (int) id->data; 1383 pdata->phy_type = (int) id->data;
1379 1384
1385 motg->link_rst = devm_reset_control_get(&pdev->dev, "link");
1386 if (IS_ERR(motg->link_rst))
1387 return PTR_ERR(motg->link_rst);
1388
1389 motg->phy_rst = devm_reset_control_get(&pdev->dev, "phy");
1390 if (IS_ERR(motg->phy_rst))
1391 return PTR_ERR(motg->phy_rst);
1392
1380 pdata->mode = of_usb_get_dr_mode(node); 1393 pdata->mode = of_usb_get_dr_mode(node);
1381 if (pdata->mode == USB_DR_MODE_UNKNOWN) 1394 if (pdata->mode == USB_DR_MODE_UNKNOWN)
1382 pdata->mode = USB_DR_MODE_OTG; 1395 pdata->mode = USB_DR_MODE_OTG;
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index bd68299c278e..4e5d9168f52e 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -165,6 +165,9 @@ struct msm_otg {
165 struct regulator *v3p3; 165 struct regulator *v3p3;
166 struct regulator *v1p8; 166 struct regulator *v1p8;
167 struct regulator *vddcx; 167 struct regulator *vddcx;
168
169 struct reset_control *phy_rst;
170 struct reset_control *link_rst;
168}; 171};
169 172
170#endif 173#endif