aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan T. Ivanov <iivanov@mm-sol.com>2014-04-28 09:34:22 -0400
committerFelipe Balbi <balbi@ti.com>2014-04-30 12:29:58 -0400
commit01799b622217ffebdc95e8e0aedbd4cff6a35a50 (patch)
tree663c54b0af31fa88756fdc969e3e49460b4cd068
parent349907c262ad5e698c24565658ae489fb69fee53 (diff)
usb: phy: msm: Vote for corner of VDD CX instead of voltage of VDD CX
New platform uses RBCPR hardware feature, with that voting for absolute voltage of VDD CX is not required. Hence vote for corner of VDD CX which uses nominal corner voltage on VDD CX. Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com> Cc: Mayank Rana <mrana@codeaurora.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r--Documentation/devicetree/bindings/usb/msm-hsusb.txt5
-rw-r--r--drivers/usb/phy/phy-msm-usb.c35
-rw-r--r--include/linux/usb/msm_hsusb.h1
3 files changed, 33 insertions, 8 deletions
diff --git a/Documentation/devicetree/bindings/usb/msm-hsusb.txt b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
index 066966706ca1..2826f2af503a 100644
--- a/Documentation/devicetree/bindings/usb/msm-hsusb.txt
+++ b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
@@ -65,6 +65,10 @@ Optional properties:
65 Some platforms may have configuration to allow USB 65 Some platforms may have configuration to allow USB
66 controller work with any of the two HSPHYs present. 66 controller work with any of the two HSPHYs present.
67 67
68- qcom,vdd-levels: This property must be a list of three integer values
69 (no, min, max) where each value represents either a voltage
70 in microvolts or a value corresponding to voltage corner.
71
68Example HSUSB OTG controller device node: 72Example HSUSB OTG controller device node:
69 73
70 usb@f9a55000 { 74 usb@f9a55000 {
@@ -87,4 +91,5 @@ Example HSUSB OTG controller device node:
87 91
88 qcom,otg-control = <1>; 92 qcom,otg-control = <1>;
89 qcom,phy-init-sequence = < -1 0x63 >; 93 qcom,phy-init-sequence = < -1 0x63 >;
94 qcom,vdd-levels = <1 5 7>;
90 }; 95 };
diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 366527ecbdd1..8e7956eb8a77 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -62,6 +62,13 @@
62 62
63#define USB_PHY_VDD_DIG_VOL_MIN 1000000 /* uV */ 63#define USB_PHY_VDD_DIG_VOL_MIN 1000000 /* uV */
64#define USB_PHY_VDD_DIG_VOL_MAX 1320000 /* uV */ 64#define USB_PHY_VDD_DIG_VOL_MAX 1320000 /* uV */
65#define USB_PHY_SUSP_DIG_VOL 500000 /* uV */
66
67enum vdd_levels {
68 VDD_LEVEL_NONE = 0,
69 VDD_LEVEL_MIN,
70 VDD_LEVEL_MAX,
71};
65 72
66static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init) 73static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init)
67{ 74{
@@ -69,8 +76,8 @@ static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init)
69 76
70 if (init) { 77 if (init) {
71 ret = regulator_set_voltage(motg->vddcx, 78 ret = regulator_set_voltage(motg->vddcx,
72 USB_PHY_VDD_DIG_VOL_MIN, 79 motg->vdd_levels[VDD_LEVEL_MIN],
73 USB_PHY_VDD_DIG_VOL_MAX); 80 motg->vdd_levels[VDD_LEVEL_MAX]);
74 if (ret) { 81 if (ret) {
75 dev_err(motg->phy.dev, "Cannot set vddcx voltage\n"); 82 dev_err(motg->phy.dev, "Cannot set vddcx voltage\n");
76 return ret; 83 return ret;
@@ -81,7 +88,7 @@ static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init)
81 dev_err(motg->phy.dev, "unable to enable hsusb vddcx\n"); 88 dev_err(motg->phy.dev, "unable to enable hsusb vddcx\n");
82 } else { 89 } else {
83 ret = regulator_set_voltage(motg->vddcx, 0, 90 ret = regulator_set_voltage(motg->vddcx, 0,
84 USB_PHY_VDD_DIG_VOL_MAX); 91 motg->vdd_levels[VDD_LEVEL_MAX]);
85 if (ret) 92 if (ret)
86 dev_err(motg->phy.dev, "Cannot set vddcx voltage\n"); 93 dev_err(motg->phy.dev, "Cannot set vddcx voltage\n");
87 ret = regulator_disable(motg->vddcx); 94 ret = regulator_disable(motg->vddcx);
@@ -435,17 +442,16 @@ static int msm_phy_init(struct usb_phy *phy)
435 442
436#ifdef CONFIG_PM 443#ifdef CONFIG_PM
437 444
438#define USB_PHY_SUSP_DIG_VOL 500000
439static int msm_hsusb_config_vddcx(struct msm_otg *motg, int high) 445static int msm_hsusb_config_vddcx(struct msm_otg *motg, int high)
440{ 446{
441 int max_vol = USB_PHY_VDD_DIG_VOL_MAX; 447 int max_vol = motg->vdd_levels[VDD_LEVEL_MAX];
442 int min_vol; 448 int min_vol;
443 int ret; 449 int ret;
444 450
445 if (high) 451 if (high)
446 min_vol = USB_PHY_VDD_DIG_VOL_MIN; 452 min_vol = motg->vdd_levels[VDD_LEVEL_MIN];
447 else 453 else
448 min_vol = USB_PHY_SUSP_DIG_VOL; 454 min_vol = motg->vdd_levels[VDD_LEVEL_NONE];
449 455
450 ret = regulator_set_voltage(motg->vddcx, min_vol, max_vol); 456 ret = regulator_set_voltage(motg->vddcx, min_vol, max_vol);
451 if (ret) { 457 if (ret) {
@@ -1441,7 +1447,7 @@ static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg)
1441 struct device_node *node = pdev->dev.of_node; 1447 struct device_node *node = pdev->dev.of_node;
1442 struct property *prop; 1448 struct property *prop;
1443 int len, ret, words; 1449 int len, ret, words;
1444 u32 val; 1450 u32 val, tmp[3];
1445 1451
1446 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 1452 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
1447 if (!pdata) 1453 if (!pdata)
@@ -1472,6 +1478,19 @@ static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg)
1472 if (!of_property_read_u32(node, "qcom,phy-num", &val) && val < 2) 1478 if (!of_property_read_u32(node, "qcom,phy-num", &val) && val < 2)
1473 motg->phy_number = val; 1479 motg->phy_number = val;
1474 1480
1481 motg->vdd_levels[VDD_LEVEL_NONE] = USB_PHY_SUSP_DIG_VOL;
1482 motg->vdd_levels[VDD_LEVEL_MIN] = USB_PHY_VDD_DIG_VOL_MIN;
1483 motg->vdd_levels[VDD_LEVEL_MAX] = USB_PHY_VDD_DIG_VOL_MAX;
1484
1485 if (of_get_property(node, "qcom,vdd-levels", &len) &&
1486 len == sizeof(tmp)) {
1487 of_property_read_u32_array(node, "qcom,vdd-levels",
1488 tmp, len / sizeof(*tmp));
1489 motg->vdd_levels[VDD_LEVEL_NONE] = tmp[VDD_LEVEL_NONE];
1490 motg->vdd_levels[VDD_LEVEL_MIN] = tmp[VDD_LEVEL_MIN];
1491 motg->vdd_levels[VDD_LEVEL_MAX] = tmp[VDD_LEVEL_MAX];
1492 }
1493
1475 prop = of_find_property(node, "qcom,phy-init-sequence", &len); 1494 prop = of_find_property(node, "qcom,phy-init-sequence", &len);
1476 if (!prop || !len) 1495 if (!prop || !len)
1477 return 0; 1496 return 0;
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 4628f1a4713e..b0a39243295a 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -169,6 +169,7 @@ struct msm_otg {
169 169
170 struct reset_control *phy_rst; 170 struct reset_control *phy_rst;
171 struct reset_control *link_rst; 171 struct reset_control *link_rst;
172 int vdd_levels[3];
172}; 173};
173 174
174#endif 175#endif