aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/phy
diff options
context:
space:
mode:
authorIvan T. Ivanov <iivanov@mm-sol.com>2014-04-28 09:34:17 -0400
committerFelipe Balbi <balbi@ti.com>2014-04-30 12:28:45 -0400
commitcfa3ff5dfe6a11ac8bc4a080416984ab00b0980c (patch)
treefb70e18473d587789aecd5e22fc162e8d2ae498c /drivers/usb/phy
parenta27345434134080273e0597e1d9721ff9e6ca67f (diff)
usb: phy: msm: Add support for secondary PHY control
Allow support to use 2nd HSPHY with USB2 Core. Some platforms may have configuration to allow USB controller work with any of the two HSPHYs present. By default driver configures USB core to use primary HSPHY. Add support to allow user select 2nd HSPHY using DT parameter. Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com> Cc: Manu Gautam <mgautam@codeaurora.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/phy')
-rw-r--r--drivers/usb/phy/phy-msm-usb.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index a6abb1b3a7f0..8d57045ac938 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -314,6 +314,9 @@ static int msm_otg_phy_reset(struct msm_otg *motg)
314 if (!retries) 314 if (!retries)
315 return -ETIMEDOUT; 315 return -ETIMEDOUT;
316 316
317 if (motg->phy_number)
318 writel(readl(USB_PHY_CTRL2) | BIT(16), USB_PHY_CTRL2);
319
317 dev_info(motg->phy.dev, "phy_reset: success\n"); 320 dev_info(motg->phy.dev, "phy_reset: success\n");
318 return 0; 321 return 0;
319} 322}
@@ -368,6 +371,9 @@ static int msm_otg_reset(struct usb_phy *phy)
368 ulpi_write(phy, ulpi_val, ULPI_USB_INT_EN_FALL); 371 ulpi_write(phy, ulpi_val, ULPI_USB_INT_EN_FALL);
369 } 372 }
370 373
374 if (motg->phy_number)
375 writel(readl(USB_PHY_CTRL2) | BIT(16), USB_PHY_CTRL2);
376
371 return 0; 377 return 0;
372} 378}
373 379
@@ -404,6 +410,7 @@ static int msm_otg_suspend(struct msm_otg *motg)
404 struct usb_phy *phy = &motg->phy; 410 struct usb_phy *phy = &motg->phy;
405 struct usb_bus *bus = phy->otg->host; 411 struct usb_bus *bus = phy->otg->host;
406 struct msm_otg_platform_data *pdata = motg->pdata; 412 struct msm_otg_platform_data *pdata = motg->pdata;
413 void __iomem *addr;
407 int cnt = 0; 414 int cnt = 0;
408 415
409 if (atomic_read(&motg->in_lpm)) 416 if (atomic_read(&motg->in_lpm))
@@ -463,9 +470,13 @@ static int msm_otg_suspend(struct msm_otg *motg)
463 */ 470 */
464 writel(readl(USB_USBCMD) | ASYNC_INTR_CTRL | ULPI_STP_CTRL, USB_USBCMD); 471 writel(readl(USB_USBCMD) | ASYNC_INTR_CTRL | ULPI_STP_CTRL, USB_USBCMD);
465 472
473 addr = USB_PHY_CTRL;
474 if (motg->phy_number)
475 addr = USB_PHY_CTRL2;
476
466 if (motg->pdata->phy_type == SNPS_28NM_INTEGRATED_PHY && 477 if (motg->pdata->phy_type == SNPS_28NM_INTEGRATED_PHY &&
467 motg->pdata->otg_control == OTG_PMIC_CONTROL) 478 motg->pdata->otg_control == OTG_PMIC_CONTROL)
468 writel(readl(USB_PHY_CTRL) | PHY_RETEN, USB_PHY_CTRL); 479 writel(readl(addr) | PHY_RETEN, addr);
469 480
470 clk_disable_unprepare(motg->pclk); 481 clk_disable_unprepare(motg->pclk);
471 clk_disable_unprepare(motg->clk); 482 clk_disable_unprepare(motg->clk);
@@ -495,6 +506,7 @@ static int msm_otg_resume(struct msm_otg *motg)
495{ 506{
496 struct usb_phy *phy = &motg->phy; 507 struct usb_phy *phy = &motg->phy;
497 struct usb_bus *bus = phy->otg->host; 508 struct usb_bus *bus = phy->otg->host;
509 void __iomem *addr;
498 int cnt = 0; 510 int cnt = 0;
499 unsigned temp; 511 unsigned temp;
500 512
@@ -508,9 +520,14 @@ static int msm_otg_resume(struct msm_otg *motg)
508 520
509 if (motg->pdata->phy_type == SNPS_28NM_INTEGRATED_PHY && 521 if (motg->pdata->phy_type == SNPS_28NM_INTEGRATED_PHY &&
510 motg->pdata->otg_control == OTG_PMIC_CONTROL) { 522 motg->pdata->otg_control == OTG_PMIC_CONTROL) {
523
524 addr = USB_PHY_CTRL;
525 if (motg->phy_number)
526 addr = USB_PHY_CTRL2;
527
511 msm_hsusb_ldo_set_mode(motg, 1); 528 msm_hsusb_ldo_set_mode(motg, 1);
512 msm_hsusb_config_vddcx(motg, 1); 529 msm_hsusb_config_vddcx(motg, 1);
513 writel(readl(USB_PHY_CTRL) & ~PHY_RETEN, USB_PHY_CTRL); 530 writel(readl(addr) & ~PHY_RETEN, addr);
514 } 531 }
515 532
516 temp = readl(USB_USBCMD); 533 temp = readl(USB_USBCMD);
@@ -1399,6 +1416,9 @@ static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg)
1399 if (val == OTG_PMIC_CONTROL) 1416 if (val == OTG_PMIC_CONTROL)
1400 pdata->otg_control = val; 1417 pdata->otg_control = val;
1401 1418
1419 if (!of_property_read_u32(node, "qcom,phy-num", &val) && val < 2)
1420 motg->phy_number = val;
1421
1402 prop = of_find_property(node, "qcom,phy-init-sequence", &len); 1422 prop = of_find_property(node, "qcom,phy-init-sequence", &len);
1403 if (!prop || !len) 1423 if (!prop || !len)
1404 return 0; 1424 return 0;