All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 00/19] usb: phy: msm: Fixes, cleanups and DT support
@ 2014-04-22  9:20 Ivan T. Ivanov
  2014-04-22  9:20 ` [PATCH v6 01/19] usb: phy: msm: Make driver selectable on ARCH_QCOM Ivan T. Ivanov
                   ` (13 more replies)
  0 siblings, 14 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22  9:20 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Ivan T. Ivanov, Greg Kroah-Hartman,
	Tim Bird linux-kernel @ vger . kernel . org, linux-arm-msm,
	linux-usb

From: "Ivan T. Ivanov" <iivanov@mm-sol.com>

Hi,

This is a sixth version of patches posted earlier here [1].

Changes since v5.

0001 - Enables driver on new ARCH_QCOM arches
0002 - Fixes section mismatch warning
0012 - Fix coding style error - pointer by Sergei
0014 - usleep_range() replaced with udelay(), in msm_phy_reset(),
       this eliminate "scheduling while atomic" warning - Thanks Tim.
0015 - Fix PTS definitions for MSM USB
0016 - Driver is now working even after cold boot. Earlier versions relied
       on fastboot to select proper PHY port on the dragonboard - Thanks Tim.
0019 - Use correct function to register USB2.0 PHY

[1] https://lkml.org/lkml/2014/3/5/792


Ivan T. Ivanov (17):
  usb: phy: msm: Make driver selectable on ARCH_QCOM
  usb: phy: msm: Remove __init macro from driver probe method
  usb: phy: msm: Move global regulators variables to driver state
  usb: phy: msm: Migrate to Managed Device Resource allocation
  usb: phy: msm: Remove unnecessarily check for valid regulators.
  usb: phy: msm: Fix checkpatch.pl warnings
  usb: phy: msm: Replace custom enum usb_mode_type with enum usb_dr_mode
  usb: phy: msm: Remove unused pclk_src_name
  usb: phy: msm: Remove HSUSB prefix from regulator names
  usb: phy: msm: Properly check result from platform_get_irq()
  usb: phy: msm: Add device tree support and binding information
  usb: phy: msm: Use reset framework for LINK and PHY resets
  usb: phy: msm: Add support for secondary PHY control
  usb: phy: msm: Correct USB PHY Reset sequence for newer platform
  usb: phy: msm: Handle disconnect events
  usb: phy: msm: Vote for corner of VDD CX instead of voltage of VDD CX
  usb: phy: msm: Use usb_add_phy_dev() to register device

Tim Bird (2):
  usb: phy: msm: Fix PTS definitions for MSM USB controller
  usb: phy: msm: Select secondary PHY via TCSR

 .../devicetree/bindings/usb/msm-hsusb.txt          |  78 +++
 arch/arm/mach-msm/board-msm7x30.c                  |   2 +-
 arch/arm/mach-msm/board-qsd8x50.c                  |   2 +-
 drivers/usb/phy/Kconfig                            |   6 +-
 drivers/usb/phy/phy-msm-usb.c                      | 698 ++++++++++++---------
 include/linux/usb/msm_hsusb.h                      |  39 +-
 include/linux/usb/msm_hsusb_hw.h                   |  14 +-
 7 files changed, 502 insertions(+), 337 deletions(-)

--
1.8.3.2

^ permalink raw reply	[flat|nested] 60+ messages in thread

* [PATCH v6 01/19] usb: phy: msm: Make driver selectable on ARCH_QCOM
  2014-04-22  9:20 [PATCH v6 00/19] usb: phy: msm: Fixes, cleanups and DT support Ivan T. Ivanov
@ 2014-04-22  9:20 ` Ivan T. Ivanov
       [not found]   ` <1398158438-21579-2-git-send-email-iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
  2014-04-22  9:20 ` [PATCH v6 02/19] usb: phy: msm: Remove __init macro from driver probe method Ivan T. Ivanov
                   ` (12 subsequent siblings)
  13 siblings, 1 reply; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22  9:20 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Ivan T. Ivanov, Greg Kroah-Hartman, linux-usb, linux-kernel,
	linux-arm-msm

From: "Ivan T. Ivanov" <iivanov@mm-sol.com>

Controller could be found on APQ and MSM platforms,
make configuration description more generic.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
---
 drivers/usb/phy/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 416e0c8..0c668a3 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -171,11 +171,11 @@ config USB_ISP1301
 	  module will be called phy-isp1301.

 config USB_MSM_OTG
-	tristate "OTG support for Qualcomm on-chip USB controller"
-	depends on (USB || USB_GADGET) && ARCH_MSM
+	tristate "Qualcomm on-chip USB OTG controller support"
+	depends on (USB || USB_GADGET) && (ARCH_MSM || ARCH_QCOM)
 	select USB_PHY
 	help
-	  Enable this to support the USB OTG transceiver on MSM chips. It
+	  Enable this to support the USB OTG transceiver on Qualcomm chips. It
 	  handles PHY initialization, clock management, and workarounds
 	  required after resetting the hardware and power management.
 	  This driver is required even for peripheral only or host only
--
1.8.3.2

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v6 02/19] usb: phy: msm: Remove __init macro from driver probe method
  2014-04-22  9:20 [PATCH v6 00/19] usb: phy: msm: Fixes, cleanups and DT support Ivan T. Ivanov
  2014-04-22  9:20 ` [PATCH v6 01/19] usb: phy: msm: Make driver selectable on ARCH_QCOM Ivan T. Ivanov
@ 2014-04-22  9:20 ` Ivan T. Ivanov
  2014-04-22  9:20 ` [PATCH v6 06/19] usb: phy: msm: Fix checkpatch.pl warnings Ivan T. Ivanov
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22  9:20 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Ivan T. Ivanov, Greg Kroah-Hartman, linux-usb, linux-kernel,
	linux-arm-msm

From: "Ivan T. Ivanov" <iivanov@mm-sol.com>

This fixes following:

WARNING: drivers/usb/phy/built-in.o(.data+0x68): Section mismatch in reference from the variable msm_otg_driver to the function .init.text:msm_otg_probe()
The variable msm_otg_driver references
the function __init msm_otg_probe()

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
---
 drivers/usb/phy/phy-msm-usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 5b37b81..6ae4d2f 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -1406,7 +1406,7 @@ static void msm_otg_debugfs_cleanup(void)
 	debugfs_remove(msm_otg_dbg_root);
 }

-static int __init msm_otg_probe(struct platform_device *pdev)
+static int msm_otg_probe(struct platform_device *pdev)
 {
 	int ret = 0;
 	struct resource *res;
--
1.8.3.2

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v6 03/19] usb: phy: msm: Move global regulators variables to driver state
  2014-04-22  9:20 [PATCH v6 00/19] usb: phy: msm: Fixes, cleanups and DT support Ivan T. Ivanov
@ 2014-04-22  9:20     ` Ivan T. Ivanov
  2014-04-22  9:20 ` [PATCH v6 02/19] usb: phy: msm: Remove __init macro from driver probe method Ivan T. Ivanov
                       ` (12 subsequent siblings)
  13 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22  9:20 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Ivan T. Ivanov, Greg Kroah-Hartman,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA

From: "Ivan T. Ivanov" <iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>

Signed-off-by: Ivan T. Ivanov <iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
---
 drivers/usb/phy/phy-msm-usb.c | 82 ++++++++++++++++++++-----------------------
 include/linux/usb/msm_hsusb.h |  3 ++
 2 files changed, 42 insertions(+), 43 deletions(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 6ae4d2f..6bae936 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -58,47 +58,43 @@
 #define USB_PHY_VDD_DIG_VOL_MIN	1000000 /* uV */
 #define USB_PHY_VDD_DIG_VOL_MAX	1320000 /* uV */

-static struct regulator *hsusb_3p3;
-static struct regulator *hsusb_1p8;
-static struct regulator *hsusb_vddcx;
-
 static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init)
 {
 	int ret = 0;

 	if (init) {
-		hsusb_vddcx = regulator_get(motg->phy.dev, "HSUSB_VDDCX");
-		if (IS_ERR(hsusb_vddcx)) {
+		motg->vddcx = regulator_get(motg->phy.dev, "HSUSB_VDDCX");
+		if (IS_ERR(motg->vddcx)) {
 			dev_err(motg->phy.dev, "unable to get hsusb vddcx\n");
-			return PTR_ERR(hsusb_vddcx);
+			return PTR_ERR(motg->vddcx);
 		}

-		ret = regulator_set_voltage(hsusb_vddcx,
+		ret = regulator_set_voltage(motg->vddcx,
 				USB_PHY_VDD_DIG_VOL_MIN,
 				USB_PHY_VDD_DIG_VOL_MAX);
 		if (ret) {
 			dev_err(motg->phy.dev, "unable to set the voltage "
 					"for hsusb vddcx\n");
-			regulator_put(hsusb_vddcx);
+			regulator_put(motg->vddcx);
 			return ret;
 		}

-		ret = regulator_enable(hsusb_vddcx);
+		ret = regulator_enable(motg->vddcx);
 		if (ret) {
 			dev_err(motg->phy.dev, "unable to enable hsusb vddcx\n");
-			regulator_put(hsusb_vddcx);
+			regulator_put(motg->vddcx);
 		}
 	} else {
-		ret = regulator_set_voltage(hsusb_vddcx, 0,
+		ret = regulator_set_voltage(motg->vddcx, 0,
 			USB_PHY_VDD_DIG_VOL_MAX);
 		if (ret)
 			dev_err(motg->phy.dev, "unable to set the voltage "
 					"for hsusb vddcx\n");
-		ret = regulator_disable(hsusb_vddcx);
+		ret = regulator_disable(motg->vddcx);
 		if (ret)
 			dev_err(motg->phy.dev, "unable to disable hsusb vddcx\n");

-		regulator_put(hsusb_vddcx);
+		regulator_put(motg->vddcx);
 	}

 	return ret;
@@ -109,38 +105,38 @@ static int msm_hsusb_ldo_init(struct msm_otg *motg, int init)
 	int rc = 0;

 	if (init) {
-		hsusb_3p3 = regulator_get(motg->phy.dev, "HSUSB_3p3");
-		if (IS_ERR(hsusb_3p3)) {
+		motg->v3p3 = regulator_get(motg->phy.dev, "HSUSB_3p3");
+		if (IS_ERR(motg->v3p3)) {
 			dev_err(motg->phy.dev, "unable to get hsusb 3p3\n");
-			return PTR_ERR(hsusb_3p3);
+			return PTR_ERR(motg->v3p3);
 		}

-		rc = regulator_set_voltage(hsusb_3p3, USB_PHY_3P3_VOL_MIN,
+		rc = regulator_set_voltage(motg->v3p3, USB_PHY_3P3_VOL_MIN,
 				USB_PHY_3P3_VOL_MAX);
 		if (rc) {
 			dev_err(motg->phy.dev, "unable to set voltage level "
 					"for hsusb 3p3\n");
 			goto put_3p3;
 		}
-		rc = regulator_enable(hsusb_3p3);
+		rc = regulator_enable(motg->v3p3);
 		if (rc) {
 			dev_err(motg->phy.dev, "unable to enable the hsusb 3p3\n");
 			goto put_3p3;
 		}
-		hsusb_1p8 = regulator_get(motg->phy.dev, "HSUSB_1p8");
-		if (IS_ERR(hsusb_1p8)) {
+		motg->v1p8 = regulator_get(motg->phy.dev, "HSUSB_1p8");
+		if (IS_ERR(motg->v1p8)) {
 			dev_err(motg->phy.dev, "unable to get hsusb 1p8\n");
-			rc = PTR_ERR(hsusb_1p8);
+			rc = PTR_ERR(motg->v1p8);
 			goto disable_3p3;
 		}
-		rc = regulator_set_voltage(hsusb_1p8, USB_PHY_1P8_VOL_MIN,
+		rc = regulator_set_voltage(motg->v1p8, USB_PHY_1P8_VOL_MIN,
 				USB_PHY_1P8_VOL_MAX);
 		if (rc) {
 			dev_err(motg->phy.dev, "unable to set voltage level "
 					"for hsusb 1p8\n");
 			goto put_1p8;
 		}
-		rc = regulator_enable(hsusb_1p8);
+		rc = regulator_enable(motg->v1p8);
 		if (rc) {
 			dev_err(motg->phy.dev, "unable to enable the hsusb 1p8\n");
 			goto put_1p8;
@@ -149,54 +145,54 @@ static int msm_hsusb_ldo_init(struct msm_otg *motg, int init)
 		return 0;
 	}

-	regulator_disable(hsusb_1p8);
+	regulator_disable(motg->v1p8);
 put_1p8:
-	regulator_put(hsusb_1p8);
+	regulator_put(motg->v1p8);
 disable_3p3:
-	regulator_disable(hsusb_3p3);
+	regulator_disable(motg->v3p3);
 put_3p3:
-	regulator_put(hsusb_3p3);
+	regulator_put(motg->v3p3);
 	return rc;
 }

-static int msm_hsusb_ldo_set_mode(int on)
+static int msm_hsusb_ldo_set_mode(struct msm_otg *motg, int on)
 {
 	int ret = 0;

-	if (!hsusb_1p8 || IS_ERR(hsusb_1p8)) {
+	if (!motg->v1p8 || IS_ERR(motg->v1p8)) {
 		pr_err("%s: HSUSB_1p8 is not initialized\n", __func__);
 		return -ENODEV;
 	}

-	if (!hsusb_3p3 || IS_ERR(hsusb_3p3)) {
+	if (!motg->v3p3 || IS_ERR(motg->v3p3)) {
 		pr_err("%s: HSUSB_3p3 is not initialized\n", __func__);
 		return -ENODEV;
 	}

 	if (on) {
-		ret = regulator_set_optimum_mode(hsusb_1p8,
+		ret = regulator_set_optimum_mode(motg->v1p8,
 				USB_PHY_1P8_HPM_LOAD);
 		if (ret < 0) {
 			pr_err("%s: Unable to set HPM of the regulator "
 				"HSUSB_1p8\n", __func__);
 			return ret;
 		}
-		ret = regulator_set_optimum_mode(hsusb_3p3,
+		ret = regulator_set_optimum_mode(motg->v3p3,
 				USB_PHY_3P3_HPM_LOAD);
 		if (ret < 0) {
 			pr_err("%s: Unable to set HPM of the regulator "
 				"HSUSB_3p3\n", __func__);
-			regulator_set_optimum_mode(hsusb_1p8,
+			regulator_set_optimum_mode(motg->v1p8,
 				USB_PHY_1P8_LPM_LOAD);
 			return ret;
 		}
 	} else {
-		ret = regulator_set_optimum_mode(hsusb_1p8,
+		ret = regulator_set_optimum_mode(motg->v1p8,
 				USB_PHY_1P8_LPM_LOAD);
 		if (ret < 0)
 			pr_err("%s: Unable to set LPM of the regulator "
 				"HSUSB_1p8\n", __func__);
-		ret = regulator_set_optimum_mode(hsusb_3p3,
+		ret = regulator_set_optimum_mode(motg->v3p3,
 				USB_PHY_3P3_LPM_LOAD);
 		if (ret < 0)
 			pr_err("%s: Unable to set LPM of the regulator "
@@ -417,7 +413,7 @@ static int msm_otg_reset(struct usb_phy *phy)
 #ifdef CONFIG_PM

 #define USB_PHY_SUSP_DIG_VOL  500000
-static int msm_hsusb_config_vddcx(int high)
+static int msm_hsusb_config_vddcx(struct msm_otg *motg, int high)
 {
 	int max_vol = USB_PHY_VDD_DIG_VOL_MAX;
 	int min_vol;
@@ -428,7 +424,7 @@ static int msm_hsusb_config_vddcx(int high)
 	else
 		min_vol = USB_PHY_SUSP_DIG_VOL;

-	ret = regulator_set_voltage(hsusb_vddcx, min_vol, max_vol);
+	ret = regulator_set_voltage(motg->vddcx, min_vol, max_vol);
 	if (ret) {
 		pr_err("%s: unable to set the voltage for regulator "
 			"HSUSB_VDDCX\n", __func__);
@@ -518,8 +514,8 @@ static int msm_otg_suspend(struct msm_otg *motg)

 	if (motg->pdata->phy_type == SNPS_28NM_INTEGRATED_PHY &&
 			motg->pdata->otg_control == OTG_PMIC_CONTROL) {
-		msm_hsusb_ldo_set_mode(0);
-		msm_hsusb_config_vddcx(0);
+		msm_hsusb_ldo_set_mode(motg, 0);
+		msm_hsusb_config_vddcx(motg, 0);
 	}

 	if (device_may_wakeup(phy->dev))
@@ -555,8 +551,8 @@ static int msm_otg_resume(struct msm_otg *motg)

 	if (motg->pdata->phy_type == SNPS_28NM_INTEGRATED_PHY &&
 			motg->pdata->otg_control == OTG_PMIC_CONTROL) {
-		msm_hsusb_ldo_set_mode(1);
-		msm_hsusb_config_vddcx(1);
+		msm_hsusb_ldo_set_mode(motg, 1);
+		msm_hsusb_config_vddcx(motg, 1);
 		writel(readl(USB_PHY_CTRL) & ~PHY_RETEN, USB_PHY_CTRL);
 	}

@@ -1521,7 +1517,7 @@ static int msm_otg_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "hsusb vreg configuration failed\n");
 		goto vddcx_exit;
 	}
-	ret = msm_hsusb_ldo_set_mode(1);
+	ret = msm_hsusb_ldo_set_mode(motg, 1);
 	if (ret) {
 		dev_err(&pdev->dev, "hsusb vreg enable failed\n");
 		goto ldo_exit;
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 3275483..8705b01 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -183,6 +183,9 @@ struct msm_otg {
 	enum usb_chg_state chg_state;
 	enum usb_chg_type chg_type;
 	u8 dcd_retries;
+	struct regulator *v3p3;
+	struct regulator *v1p8;
+	struct regulator *vddcx;
 };

 #endif
--
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v6 03/19] usb: phy: msm: Move global regulators variables to driver state
@ 2014-04-22  9:20     ` Ivan T. Ivanov
  0 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22  9:20 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Ivan T. Ivanov, Greg Kroah-Hartman, linux-usb, linux-kernel,
	linux-arm-msm

From: "Ivan T. Ivanov" <iivanov@mm-sol.com>

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
---
 drivers/usb/phy/phy-msm-usb.c | 82 ++++++++++++++++++++-----------------------
 include/linux/usb/msm_hsusb.h |  3 ++
 2 files changed, 42 insertions(+), 43 deletions(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 6ae4d2f..6bae936 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -58,47 +58,43 @@
 #define USB_PHY_VDD_DIG_VOL_MIN	1000000 /* uV */
 #define USB_PHY_VDD_DIG_VOL_MAX	1320000 /* uV */

-static struct regulator *hsusb_3p3;
-static struct regulator *hsusb_1p8;
-static struct regulator *hsusb_vddcx;
-
 static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init)
 {
 	int ret = 0;

 	if (init) {
-		hsusb_vddcx = regulator_get(motg->phy.dev, "HSUSB_VDDCX");
-		if (IS_ERR(hsusb_vddcx)) {
+		motg->vddcx = regulator_get(motg->phy.dev, "HSUSB_VDDCX");
+		if (IS_ERR(motg->vddcx)) {
 			dev_err(motg->phy.dev, "unable to get hsusb vddcx\n");
-			return PTR_ERR(hsusb_vddcx);
+			return PTR_ERR(motg->vddcx);
 		}

-		ret = regulator_set_voltage(hsusb_vddcx,
+		ret = regulator_set_voltage(motg->vddcx,
 				USB_PHY_VDD_DIG_VOL_MIN,
 				USB_PHY_VDD_DIG_VOL_MAX);
 		if (ret) {
 			dev_err(motg->phy.dev, "unable to set the voltage "
 					"for hsusb vddcx\n");
-			regulator_put(hsusb_vddcx);
+			regulator_put(motg->vddcx);
 			return ret;
 		}

-		ret = regulator_enable(hsusb_vddcx);
+		ret = regulator_enable(motg->vddcx);
 		if (ret) {
 			dev_err(motg->phy.dev, "unable to enable hsusb vddcx\n");
-			regulator_put(hsusb_vddcx);
+			regulator_put(motg->vddcx);
 		}
 	} else {
-		ret = regulator_set_voltage(hsusb_vddcx, 0,
+		ret = regulator_set_voltage(motg->vddcx, 0,
 			USB_PHY_VDD_DIG_VOL_MAX);
 		if (ret)
 			dev_err(motg->phy.dev, "unable to set the voltage "
 					"for hsusb vddcx\n");
-		ret = regulator_disable(hsusb_vddcx);
+		ret = regulator_disable(motg->vddcx);
 		if (ret)
 			dev_err(motg->phy.dev, "unable to disable hsusb vddcx\n");

-		regulator_put(hsusb_vddcx);
+		regulator_put(motg->vddcx);
 	}

 	return ret;
@@ -109,38 +105,38 @@ static int msm_hsusb_ldo_init(struct msm_otg *motg, int init)
 	int rc = 0;

 	if (init) {
-		hsusb_3p3 = regulator_get(motg->phy.dev, "HSUSB_3p3");
-		if (IS_ERR(hsusb_3p3)) {
+		motg->v3p3 = regulator_get(motg->phy.dev, "HSUSB_3p3");
+		if (IS_ERR(motg->v3p3)) {
 			dev_err(motg->phy.dev, "unable to get hsusb 3p3\n");
-			return PTR_ERR(hsusb_3p3);
+			return PTR_ERR(motg->v3p3);
 		}

-		rc = regulator_set_voltage(hsusb_3p3, USB_PHY_3P3_VOL_MIN,
+		rc = regulator_set_voltage(motg->v3p3, USB_PHY_3P3_VOL_MIN,
 				USB_PHY_3P3_VOL_MAX);
 		if (rc) {
 			dev_err(motg->phy.dev, "unable to set voltage level "
 					"for hsusb 3p3\n");
 			goto put_3p3;
 		}
-		rc = regulator_enable(hsusb_3p3);
+		rc = regulator_enable(motg->v3p3);
 		if (rc) {
 			dev_err(motg->phy.dev, "unable to enable the hsusb 3p3\n");
 			goto put_3p3;
 		}
-		hsusb_1p8 = regulator_get(motg->phy.dev, "HSUSB_1p8");
-		if (IS_ERR(hsusb_1p8)) {
+		motg->v1p8 = regulator_get(motg->phy.dev, "HSUSB_1p8");
+		if (IS_ERR(motg->v1p8)) {
 			dev_err(motg->phy.dev, "unable to get hsusb 1p8\n");
-			rc = PTR_ERR(hsusb_1p8);
+			rc = PTR_ERR(motg->v1p8);
 			goto disable_3p3;
 		}
-		rc = regulator_set_voltage(hsusb_1p8, USB_PHY_1P8_VOL_MIN,
+		rc = regulator_set_voltage(motg->v1p8, USB_PHY_1P8_VOL_MIN,
 				USB_PHY_1P8_VOL_MAX);
 		if (rc) {
 			dev_err(motg->phy.dev, "unable to set voltage level "
 					"for hsusb 1p8\n");
 			goto put_1p8;
 		}
-		rc = regulator_enable(hsusb_1p8);
+		rc = regulator_enable(motg->v1p8);
 		if (rc) {
 			dev_err(motg->phy.dev, "unable to enable the hsusb 1p8\n");
 			goto put_1p8;
@@ -149,54 +145,54 @@ static int msm_hsusb_ldo_init(struct msm_otg *motg, int init)
 		return 0;
 	}

-	regulator_disable(hsusb_1p8);
+	regulator_disable(motg->v1p8);
 put_1p8:
-	regulator_put(hsusb_1p8);
+	regulator_put(motg->v1p8);
 disable_3p3:
-	regulator_disable(hsusb_3p3);
+	regulator_disable(motg->v3p3);
 put_3p3:
-	regulator_put(hsusb_3p3);
+	regulator_put(motg->v3p3);
 	return rc;
 }

-static int msm_hsusb_ldo_set_mode(int on)
+static int msm_hsusb_ldo_set_mode(struct msm_otg *motg, int on)
 {
 	int ret = 0;

-	if (!hsusb_1p8 || IS_ERR(hsusb_1p8)) {
+	if (!motg->v1p8 || IS_ERR(motg->v1p8)) {
 		pr_err("%s: HSUSB_1p8 is not initialized\n", __func__);
 		return -ENODEV;
 	}

-	if (!hsusb_3p3 || IS_ERR(hsusb_3p3)) {
+	if (!motg->v3p3 || IS_ERR(motg->v3p3)) {
 		pr_err("%s: HSUSB_3p3 is not initialized\n", __func__);
 		return -ENODEV;
 	}

 	if (on) {
-		ret = regulator_set_optimum_mode(hsusb_1p8,
+		ret = regulator_set_optimum_mode(motg->v1p8,
 				USB_PHY_1P8_HPM_LOAD);
 		if (ret < 0) {
 			pr_err("%s: Unable to set HPM of the regulator "
 				"HSUSB_1p8\n", __func__);
 			return ret;
 		}
-		ret = regulator_set_optimum_mode(hsusb_3p3,
+		ret = regulator_set_optimum_mode(motg->v3p3,
 				USB_PHY_3P3_HPM_LOAD);
 		if (ret < 0) {
 			pr_err("%s: Unable to set HPM of the regulator "
 				"HSUSB_3p3\n", __func__);
-			regulator_set_optimum_mode(hsusb_1p8,
+			regulator_set_optimum_mode(motg->v1p8,
 				USB_PHY_1P8_LPM_LOAD);
 			return ret;
 		}
 	} else {
-		ret = regulator_set_optimum_mode(hsusb_1p8,
+		ret = regulator_set_optimum_mode(motg->v1p8,
 				USB_PHY_1P8_LPM_LOAD);
 		if (ret < 0)
 			pr_err("%s: Unable to set LPM of the regulator "
 				"HSUSB_1p8\n", __func__);
-		ret = regulator_set_optimum_mode(hsusb_3p3,
+		ret = regulator_set_optimum_mode(motg->v3p3,
 				USB_PHY_3P3_LPM_LOAD);
 		if (ret < 0)
 			pr_err("%s: Unable to set LPM of the regulator "
@@ -417,7 +413,7 @@ static int msm_otg_reset(struct usb_phy *phy)
 #ifdef CONFIG_PM

 #define USB_PHY_SUSP_DIG_VOL  500000
-static int msm_hsusb_config_vddcx(int high)
+static int msm_hsusb_config_vddcx(struct msm_otg *motg, int high)
 {
 	int max_vol = USB_PHY_VDD_DIG_VOL_MAX;
 	int min_vol;
@@ -428,7 +424,7 @@ static int msm_hsusb_config_vddcx(int high)
 	else
 		min_vol = USB_PHY_SUSP_DIG_VOL;

-	ret = regulator_set_voltage(hsusb_vddcx, min_vol, max_vol);
+	ret = regulator_set_voltage(motg->vddcx, min_vol, max_vol);
 	if (ret) {
 		pr_err("%s: unable to set the voltage for regulator "
 			"HSUSB_VDDCX\n", __func__);
@@ -518,8 +514,8 @@ static int msm_otg_suspend(struct msm_otg *motg)

 	if (motg->pdata->phy_type == SNPS_28NM_INTEGRATED_PHY &&
 			motg->pdata->otg_control == OTG_PMIC_CONTROL) {
-		msm_hsusb_ldo_set_mode(0);
-		msm_hsusb_config_vddcx(0);
+		msm_hsusb_ldo_set_mode(motg, 0);
+		msm_hsusb_config_vddcx(motg, 0);
 	}

 	if (device_may_wakeup(phy->dev))
@@ -555,8 +551,8 @@ static int msm_otg_resume(struct msm_otg *motg)

 	if (motg->pdata->phy_type == SNPS_28NM_INTEGRATED_PHY &&
 			motg->pdata->otg_control == OTG_PMIC_CONTROL) {
-		msm_hsusb_ldo_set_mode(1);
-		msm_hsusb_config_vddcx(1);
+		msm_hsusb_ldo_set_mode(motg, 1);
+		msm_hsusb_config_vddcx(motg, 1);
 		writel(readl(USB_PHY_CTRL) & ~PHY_RETEN, USB_PHY_CTRL);
 	}

@@ -1521,7 +1517,7 @@ static int msm_otg_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "hsusb vreg configuration failed\n");
 		goto vddcx_exit;
 	}
-	ret = msm_hsusb_ldo_set_mode(1);
+	ret = msm_hsusb_ldo_set_mode(motg, 1);
 	if (ret) {
 		dev_err(&pdev->dev, "hsusb vreg enable failed\n");
 		goto ldo_exit;
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 3275483..8705b01 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -183,6 +183,9 @@ struct msm_otg {
 	enum usb_chg_state chg_state;
 	enum usb_chg_type chg_type;
 	u8 dcd_retries;
+	struct regulator *v3p3;
+	struct regulator *v1p8;
+	struct regulator *vddcx;
 };

 #endif
--
1.8.3.2


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v6 04/19] usb: phy: msm: Migrate to Managed Device Resource allocation
  2014-04-22  9:20 [PATCH v6 00/19] usb: phy: msm: Fixes, cleanups and DT support Ivan T. Ivanov
@ 2014-04-22  9:20     ` Ivan T. Ivanov
  2014-04-22  9:20 ` [PATCH v6 02/19] usb: phy: msm: Remove __init macro from driver probe method Ivan T. Ivanov
                       ` (12 subsequent siblings)
  13 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22  9:20 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Ivan T. Ivanov, Greg Kroah-Hartman,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA

From: "Ivan T. Ivanov" <iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>

Move memory, regulators, clocks and irq allocation to
devm_* variants. Properly check for valid clk handles.

Signed-off-by: Ivan T. Ivanov <iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
---
 drivers/usb/phy/phy-msm-usb.c | 195 ++++++++++++++++--------------------------
 1 file changed, 75 insertions(+), 120 deletions(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 6bae936..67cac96 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -63,27 +63,18 @@ static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init)
 	int ret = 0;

 	if (init) {
-		motg->vddcx = regulator_get(motg->phy.dev, "HSUSB_VDDCX");
-		if (IS_ERR(motg->vddcx)) {
-			dev_err(motg->phy.dev, "unable to get hsusb vddcx\n");
-			return PTR_ERR(motg->vddcx);
-		}
-
 		ret = regulator_set_voltage(motg->vddcx,
 				USB_PHY_VDD_DIG_VOL_MIN,
 				USB_PHY_VDD_DIG_VOL_MAX);
 		if (ret) {
 			dev_err(motg->phy.dev, "unable to set the voltage "
 					"for hsusb vddcx\n");
-			regulator_put(motg->vddcx);
 			return ret;
 		}

 		ret = regulator_enable(motg->vddcx);
-		if (ret) {
+		if (ret)
 			dev_err(motg->phy.dev, "unable to enable hsusb vddcx\n");
-			regulator_put(motg->vddcx);
-		}
 	} else {
 		ret = regulator_set_voltage(motg->vddcx, 0,
 			USB_PHY_VDD_DIG_VOL_MAX);
@@ -93,8 +84,6 @@ static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init)
 		ret = regulator_disable(motg->vddcx);
 		if (ret)
 			dev_err(motg->phy.dev, "unable to disable hsusb vddcx\n");
-
-		regulator_put(motg->vddcx);
 	}

 	return ret;
@@ -105,53 +94,38 @@ static int msm_hsusb_ldo_init(struct msm_otg *motg, int init)
 	int rc = 0;

 	if (init) {
-		motg->v3p3 = regulator_get(motg->phy.dev, "HSUSB_3p3");
-		if (IS_ERR(motg->v3p3)) {
-			dev_err(motg->phy.dev, "unable to get hsusb 3p3\n");
-			return PTR_ERR(motg->v3p3);
-		}
-
 		rc = regulator_set_voltage(motg->v3p3, USB_PHY_3P3_VOL_MIN,
 				USB_PHY_3P3_VOL_MAX);
 		if (rc) {
 			dev_err(motg->phy.dev, "unable to set voltage level "
 					"for hsusb 3p3\n");
-			goto put_3p3;
+			goto exit;
 		}
 		rc = regulator_enable(motg->v3p3);
 		if (rc) {
 			dev_err(motg->phy.dev, "unable to enable the hsusb 3p3\n");
-			goto put_3p3;
-		}
-		motg->v1p8 = regulator_get(motg->phy.dev, "HSUSB_1p8");
-		if (IS_ERR(motg->v1p8)) {
-			dev_err(motg->phy.dev, "unable to get hsusb 1p8\n");
-			rc = PTR_ERR(motg->v1p8);
-			goto disable_3p3;
+			goto exit;
 		}
 		rc = regulator_set_voltage(motg->v1p8, USB_PHY_1P8_VOL_MIN,
 				USB_PHY_1P8_VOL_MAX);
 		if (rc) {
 			dev_err(motg->phy.dev, "unable to set voltage level "
 					"for hsusb 1p8\n");
-			goto put_1p8;
+			goto disable_3p3;
 		}
 		rc = regulator_enable(motg->v1p8);
 		if (rc) {
 			dev_err(motg->phy.dev, "unable to enable the hsusb 1p8\n");
-			goto put_1p8;
+			goto disable_3p3;
 		}

 		return 0;
 	}

 	regulator_disable(motg->v1p8);
-put_1p8:
-	regulator_put(motg->v1p8);
 disable_3p3:
 	regulator_disable(motg->v3p3);
-put_3p3:
-	regulator_put(motg->v3p3);
+exit:
 	return rc;
 }

@@ -506,7 +480,7 @@ static int msm_otg_suspend(struct msm_otg *motg)

 	clk_disable_unprepare(motg->pclk);
 	clk_disable_unprepare(motg->clk);
-	if (motg->core_clk)
+	if (!IS_ERR(motg->core_clk))
 		clk_disable_unprepare(motg->core_clk);

 	if (!IS_ERR(motg->pclk_src))
@@ -546,7 +520,7 @@ static int msm_otg_resume(struct msm_otg *motg)

 	clk_prepare_enable(motg->pclk);
 	clk_prepare_enable(motg->clk);
-	if (motg->core_clk)
+	if (!IS_ERR(motg->core_clk))
 		clk_prepare_enable(motg->core_clk);

 	if (motg->pdata->phy_type == SNPS_28NM_INTEGRATED_PHY &&
@@ -1415,37 +1389,34 @@ static int msm_otg_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}

-	motg = kzalloc(sizeof(struct msm_otg), GFP_KERNEL);
+	motg = devm_kzalloc(&pdev->dev, sizeof(struct msm_otg), GFP_KERNEL);
 	if (!motg) {
 		dev_err(&pdev->dev, "unable to allocate msm_otg\n");
 		return -ENOMEM;
 	}

-	motg->phy.otg = kzalloc(sizeof(struct usb_otg), GFP_KERNEL);
+	motg->phy.otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg),
+				     GFP_KERNEL);
 	if (!motg->phy.otg) {
 		dev_err(&pdev->dev, "unable to allocate msm_otg\n");
-		ret = -ENOMEM;
-		goto free_motg;
+		return -ENOMEM;
 	}

 	motg->pdata = dev_get_platdata(&pdev->dev);
 	phy = &motg->phy;
 	phy->dev = &pdev->dev;

-	motg->phy_reset_clk = clk_get(&pdev->dev, "usb_phy_clk");
+	motg->phy_reset_clk = devm_clk_get(&pdev->dev, "usb_phy_clk");
 	if (IS_ERR(motg->phy_reset_clk)) {
 		dev_err(&pdev->dev, "failed to get usb_phy_clk\n");
-		ret = PTR_ERR(motg->phy_reset_clk);
-		goto free_motg;
+		return PTR_ERR(motg->phy_reset_clk);
 	}

-	motg->clk = clk_get(&pdev->dev, "usb_hs_clk");
+	motg->clk = devm_clk_get(&pdev->dev, "usb_hs_clk");
 	if (IS_ERR(motg->clk)) {
 		dev_err(&pdev->dev, "failed to get usb_hs_clk\n");
-		ret = PTR_ERR(motg->clk);
-		goto put_phy_reset_clk;
+		return PTR_ERR(motg->clk);
 	}
-	clk_set_rate(motg->clk, 60000000);

 	/*
 	 * If USB Core is running its protocol engine based on CORE CLK,
@@ -1454,22 +1425,18 @@ static int msm_otg_probe(struct platform_device *pdev)
 	 * CORE CLK. For such USB cores, vote for maximum clk frequency
 	 * on pclk source
 	 */
+	 motg->pclk_src = ERR_PTR(-ENOENT);
 	 if (motg->pdata->pclk_src_name) {
-		motg->pclk_src = clk_get(&pdev->dev,
-			motg->pdata->pclk_src_name);
+		motg->pclk_src = devm_clk_get(&pdev->dev,
+					motg->pdata->pclk_src_name);
 		if (IS_ERR(motg->pclk_src))
-			goto put_clk;
-		clk_set_rate(motg->pclk_src, INT_MAX);
-		clk_prepare_enable(motg->pclk_src);
-	} else
-		motg->pclk_src = ERR_PTR(-ENOENT);
-
+			return PTR_ERR(motg->pclk_src);
+	}

-	motg->pclk = clk_get(&pdev->dev, "usb_hs_pclk");
+	motg->pclk = devm_clk_get(&pdev->dev, "usb_hs_pclk");
 	if (IS_ERR(motg->pclk)) {
 		dev_err(&pdev->dev, "failed to get usb_hs_pclk\n");
-		ret = PTR_ERR(motg->pclk);
-		goto put_pclk_src;
+		return PTR_ERR(motg->pclk);
 	}

 	/*
@@ -1477,65 +1444,78 @@ static int msm_otg_probe(struct platform_device *pdev)
 	 * clock is introduced to remove the dependency on AXI
 	 * bus frequency.
 	 */
-	motg->core_clk = clk_get(&pdev->dev, "usb_hs_core_clk");
-	if (IS_ERR(motg->core_clk))
-		motg->core_clk = NULL;
+	motg->core_clk = devm_clk_get(&pdev->dev, "usb_hs_core_clk");

 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		dev_err(&pdev->dev, "failed to get platform resource mem\n");
-		ret = -ENODEV;
-		goto put_core_clk;
-	}
+	motg->regs = devm_ioremap(&pdev->dev, res->start, resource_size(res));
+	if (IS_ERR(motg->regs))
+		return PTR_ERR(motg->regs);

-	motg->regs = ioremap(res->start, resource_size(res));
-	if (!motg->regs) {
-		dev_err(&pdev->dev, "ioremap failed\n");
-		ret = -ENOMEM;
-		goto put_core_clk;
-	}
 	dev_info(&pdev->dev, "OTG regs = %p\n", motg->regs);

 	motg->irq = platform_get_irq(pdev, 0);
 	if (!motg->irq) {
 		dev_err(&pdev->dev, "platform_get_irq failed\n");
-		ret = -ENODEV;
-		goto free_regs;
+		return motg->irq;
+	}
+
+	motg->vddcx = devm_regulator_get(motg->phy.dev, "HSUSB_VDDCX");
+	if (IS_ERR(motg->vddcx)) {
+		dev_err(motg->phy.dev, "unable to get hsusb vddcx\n");
+		return PTR_ERR(motg->vddcx);
+	}
+
+	motg->v3p3 = devm_regulator_get(motg->phy.dev, "HSUSB_3p3");
+	if (IS_ERR(motg->v3p3)) {
+		dev_err(motg->phy.dev, "unable to get hsusb 3p3\n");
+		return PTR_ERR(motg->v3p3);
+	}
+
+	motg->v1p8 = devm_regulator_get(motg->phy.dev, "HSUSB_1p8");
+	if (IS_ERR(motg->v1p8)) {
+		dev_err(motg->phy.dev, "unable to get hsusb 1p8\n");
+		return PTR_ERR(motg->v1p8);
+	}
+
+	clk_set_rate(motg->clk, 60000000);
+	if (!IS_ERR(motg->pclk_src)) {
+		clk_set_rate(motg->pclk_src, INT_MAX);
+		clk_prepare_enable(motg->pclk_src);
 	}

 	clk_prepare_enable(motg->clk);
 	clk_prepare_enable(motg->pclk);

+	if (!IS_ERR(motg->core_clk))
+		clk_prepare_enable(motg->core_clk);
+
 	ret = msm_hsusb_init_vddcx(motg, 1);
 	if (ret) {
 		dev_err(&pdev->dev, "hsusb vddcx configuration failed\n");
-		goto free_regs;
+		goto disable_clks;
 	}

 	ret = msm_hsusb_ldo_init(motg, 1);
 	if (ret) {
 		dev_err(&pdev->dev, "hsusb vreg configuration failed\n");
-		goto vddcx_exit;
+		goto disable_vddcx;
 	}
 	ret = msm_hsusb_ldo_set_mode(motg, 1);
 	if (ret) {
 		dev_err(&pdev->dev, "hsusb vreg enable failed\n");
-		goto ldo_exit;
+		goto disable_ldo;
 	}

-	if (motg->core_clk)
-		clk_prepare_enable(motg->core_clk);
-
 	writel(0, USB_USBINTR);
 	writel(0, USB_OTGSC);

 	INIT_WORK(&motg->sm_work, msm_otg_sm_work);
 	INIT_DELAYED_WORK(&motg->chg_work, msm_chg_detect_work);
-	ret = request_irq(motg->irq, msm_otg_irq, IRQF_SHARED,
+	ret = devm_request_irq(&pdev->dev, motg->irq, msm_otg_irq, IRQF_SHARED,
 					"msm_otg", motg);
 	if (ret) {
 		dev_err(&pdev->dev, "request irq failed\n");
-		goto disable_clks;
+		goto disable_ldo;
 	}

 	phy->init = msm_otg_reset;
@@ -1550,7 +1530,7 @@ static int msm_otg_probe(struct platform_device *pdev)
 	ret = usb_add_phy(&motg->phy, USB_PHY_TYPE_USB2);
 	if (ret) {
 		dev_err(&pdev->dev, "usb_add_phy failed\n");
-		goto free_irq;
+		goto disable_ldo;
 	}

 	platform_set_drvdata(pdev, motg);
@@ -1568,33 +1548,18 @@ static int msm_otg_probe(struct platform_device *pdev)
 	pm_runtime_enable(&pdev->dev);

 	return 0;
-free_irq:
-	free_irq(motg->irq, motg);
+
+disable_ldo:
+	msm_hsusb_ldo_init(motg, 0);
+disable_vddcx:
+	msm_hsusb_init_vddcx(motg, 0);
 disable_clks:
 	clk_disable_unprepare(motg->pclk);
 	clk_disable_unprepare(motg->clk);
-ldo_exit:
-	msm_hsusb_ldo_init(motg, 0);
-vddcx_exit:
-	msm_hsusb_init_vddcx(motg, 0);
-free_regs:
-	iounmap(motg->regs);
-put_core_clk:
-	if (motg->core_clk)
-		clk_put(motg->core_clk);
-	clk_put(motg->pclk);
-put_pclk_src:
-	if (!IS_ERR(motg->pclk_src)) {
+	if (!IS_ERR(motg->core_clk))
+		clk_disable_unprepare(motg->core_clk);
+	if (!IS_ERR(motg->pclk_src))
 		clk_disable_unprepare(motg->pclk_src);
-		clk_put(motg->pclk_src);
-	}
-put_clk:
-	clk_put(motg->clk);
-put_phy_reset_clk:
-	clk_put(motg->phy_reset_clk);
-free_motg:
-	kfree(motg->phy.otg);
-	kfree(motg);
 	return ret;
 }

@@ -1617,7 +1582,7 @@ static int msm_otg_remove(struct platform_device *pdev)
 	pm_runtime_disable(&pdev->dev);

 	usb_remove_phy(phy);
-	free_irq(motg->irq, motg);
+	disable_irq(motg->irq);

 	/*
 	 * Put PHY in low power mode.
@@ -1637,26 +1602,15 @@ static int msm_otg_remove(struct platform_device *pdev)

 	clk_disable_unprepare(motg->pclk);
 	clk_disable_unprepare(motg->clk);
-	if (motg->core_clk)
+	if (!IS_ERR(motg->core_clk))
 		clk_disable_unprepare(motg->core_clk);
-	if (!IS_ERR(motg->pclk_src)) {
+	if (!IS_ERR(motg->pclk_src))
 		clk_disable_unprepare(motg->pclk_src);
-		clk_put(motg->pclk_src);
-	}
+
 	msm_hsusb_ldo_init(motg, 0);

-	iounmap(motg->regs);
 	pm_runtime_set_suspended(&pdev->dev);

-	clk_put(motg->phy_reset_clk);
-	clk_put(motg->pclk);
-	clk_put(motg->clk);
-	if (motg->core_clk)
-		clk_put(motg->core_clk);
-
-	kfree(motg->phy.otg);
-	kfree(motg);

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v6 04/19] usb: phy: msm: Migrate to Managed Device Resource allocation
@ 2014-04-22  9:20     ` Ivan T. Ivanov
  0 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22  9:20 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Ivan T. Ivanov, Greg Kroah-Hartman, linux-usb, linux-kernel,
	linux-arm-msm

From: "Ivan T. Ivanov" <iivanov@mm-sol.com>

Move memory, regulators, clocks and irq allocation to
devm_* variants. Properly check for valid clk handles.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
---
 drivers/usb/phy/phy-msm-usb.c | 195 ++++++++++++++++--------------------------
 1 file changed, 75 insertions(+), 120 deletions(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 6bae936..67cac96 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -63,27 +63,18 @@ static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init)
 	int ret = 0;

 	if (init) {
-		motg->vddcx = regulator_get(motg->phy.dev, "HSUSB_VDDCX");
-		if (IS_ERR(motg->vddcx)) {
-			dev_err(motg->phy.dev, "unable to get hsusb vddcx\n");
-			return PTR_ERR(motg->vddcx);
-		}
-
 		ret = regulator_set_voltage(motg->vddcx,
 				USB_PHY_VDD_DIG_VOL_MIN,
 				USB_PHY_VDD_DIG_VOL_MAX);
 		if (ret) {
 			dev_err(motg->phy.dev, "unable to set the voltage "
 					"for hsusb vddcx\n");
-			regulator_put(motg->vddcx);
 			return ret;
 		}

 		ret = regulator_enable(motg->vddcx);
-		if (ret) {
+		if (ret)
 			dev_err(motg->phy.dev, "unable to enable hsusb vddcx\n");
-			regulator_put(motg->vddcx);
-		}
 	} else {
 		ret = regulator_set_voltage(motg->vddcx, 0,
 			USB_PHY_VDD_DIG_VOL_MAX);
@@ -93,8 +84,6 @@ static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init)
 		ret = regulator_disable(motg->vddcx);
 		if (ret)
 			dev_err(motg->phy.dev, "unable to disable hsusb vddcx\n");
-
-		regulator_put(motg->vddcx);
 	}

 	return ret;
@@ -105,53 +94,38 @@ static int msm_hsusb_ldo_init(struct msm_otg *motg, int init)
 	int rc = 0;

 	if (init) {
-		motg->v3p3 = regulator_get(motg->phy.dev, "HSUSB_3p3");
-		if (IS_ERR(motg->v3p3)) {
-			dev_err(motg->phy.dev, "unable to get hsusb 3p3\n");
-			return PTR_ERR(motg->v3p3);
-		}
-
 		rc = regulator_set_voltage(motg->v3p3, USB_PHY_3P3_VOL_MIN,
 				USB_PHY_3P3_VOL_MAX);
 		if (rc) {
 			dev_err(motg->phy.dev, "unable to set voltage level "
 					"for hsusb 3p3\n");
-			goto put_3p3;
+			goto exit;
 		}
 		rc = regulator_enable(motg->v3p3);
 		if (rc) {
 			dev_err(motg->phy.dev, "unable to enable the hsusb 3p3\n");
-			goto put_3p3;
-		}
-		motg->v1p8 = regulator_get(motg->phy.dev, "HSUSB_1p8");
-		if (IS_ERR(motg->v1p8)) {
-			dev_err(motg->phy.dev, "unable to get hsusb 1p8\n");
-			rc = PTR_ERR(motg->v1p8);
-			goto disable_3p3;
+			goto exit;
 		}
 		rc = regulator_set_voltage(motg->v1p8, USB_PHY_1P8_VOL_MIN,
 				USB_PHY_1P8_VOL_MAX);
 		if (rc) {
 			dev_err(motg->phy.dev, "unable to set voltage level "
 					"for hsusb 1p8\n");
-			goto put_1p8;
+			goto disable_3p3;
 		}
 		rc = regulator_enable(motg->v1p8);
 		if (rc) {
 			dev_err(motg->phy.dev, "unable to enable the hsusb 1p8\n");
-			goto put_1p8;
+			goto disable_3p3;
 		}

 		return 0;
 	}

 	regulator_disable(motg->v1p8);
-put_1p8:
-	regulator_put(motg->v1p8);
 disable_3p3:
 	regulator_disable(motg->v3p3);
-put_3p3:
-	regulator_put(motg->v3p3);
+exit:
 	return rc;
 }

@@ -506,7 +480,7 @@ static int msm_otg_suspend(struct msm_otg *motg)

 	clk_disable_unprepare(motg->pclk);
 	clk_disable_unprepare(motg->clk);
-	if (motg->core_clk)
+	if (!IS_ERR(motg->core_clk))
 		clk_disable_unprepare(motg->core_clk);

 	if (!IS_ERR(motg->pclk_src))
@@ -546,7 +520,7 @@ static int msm_otg_resume(struct msm_otg *motg)

 	clk_prepare_enable(motg->pclk);
 	clk_prepare_enable(motg->clk);
-	if (motg->core_clk)
+	if (!IS_ERR(motg->core_clk))
 		clk_prepare_enable(motg->core_clk);

 	if (motg->pdata->phy_type == SNPS_28NM_INTEGRATED_PHY &&
@@ -1415,37 +1389,34 @@ static int msm_otg_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}

-	motg = kzalloc(sizeof(struct msm_otg), GFP_KERNEL);
+	motg = devm_kzalloc(&pdev->dev, sizeof(struct msm_otg), GFP_KERNEL);
 	if (!motg) {
 		dev_err(&pdev->dev, "unable to allocate msm_otg\n");
 		return -ENOMEM;
 	}

-	motg->phy.otg = kzalloc(sizeof(struct usb_otg), GFP_KERNEL);
+	motg->phy.otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg),
+				     GFP_KERNEL);
 	if (!motg->phy.otg) {
 		dev_err(&pdev->dev, "unable to allocate msm_otg\n");
-		ret = -ENOMEM;
-		goto free_motg;
+		return -ENOMEM;
 	}

 	motg->pdata = dev_get_platdata(&pdev->dev);
 	phy = &motg->phy;
 	phy->dev = &pdev->dev;

-	motg->phy_reset_clk = clk_get(&pdev->dev, "usb_phy_clk");
+	motg->phy_reset_clk = devm_clk_get(&pdev->dev, "usb_phy_clk");
 	if (IS_ERR(motg->phy_reset_clk)) {
 		dev_err(&pdev->dev, "failed to get usb_phy_clk\n");
-		ret = PTR_ERR(motg->phy_reset_clk);
-		goto free_motg;
+		return PTR_ERR(motg->phy_reset_clk);
 	}

-	motg->clk = clk_get(&pdev->dev, "usb_hs_clk");
+	motg->clk = devm_clk_get(&pdev->dev, "usb_hs_clk");
 	if (IS_ERR(motg->clk)) {
 		dev_err(&pdev->dev, "failed to get usb_hs_clk\n");
-		ret = PTR_ERR(motg->clk);
-		goto put_phy_reset_clk;
+		return PTR_ERR(motg->clk);
 	}
-	clk_set_rate(motg->clk, 60000000);

 	/*
 	 * If USB Core is running its protocol engine based on CORE CLK,
@@ -1454,22 +1425,18 @@ static int msm_otg_probe(struct platform_device *pdev)
 	 * CORE CLK. For such USB cores, vote for maximum clk frequency
 	 * on pclk source
 	 */
+	 motg->pclk_src = ERR_PTR(-ENOENT);
 	 if (motg->pdata->pclk_src_name) {
-		motg->pclk_src = clk_get(&pdev->dev,
-			motg->pdata->pclk_src_name);
+		motg->pclk_src = devm_clk_get(&pdev->dev,
+					motg->pdata->pclk_src_name);
 		if (IS_ERR(motg->pclk_src))
-			goto put_clk;
-		clk_set_rate(motg->pclk_src, INT_MAX);
-		clk_prepare_enable(motg->pclk_src);
-	} else
-		motg->pclk_src = ERR_PTR(-ENOENT);
-
+			return PTR_ERR(motg->pclk_src);
+	}

-	motg->pclk = clk_get(&pdev->dev, "usb_hs_pclk");
+	motg->pclk = devm_clk_get(&pdev->dev, "usb_hs_pclk");
 	if (IS_ERR(motg->pclk)) {
 		dev_err(&pdev->dev, "failed to get usb_hs_pclk\n");
-		ret = PTR_ERR(motg->pclk);
-		goto put_pclk_src;
+		return PTR_ERR(motg->pclk);
 	}

 	/*
@@ -1477,65 +1444,78 @@ static int msm_otg_probe(struct platform_device *pdev)
 	 * clock is introduced to remove the dependency on AXI
 	 * bus frequency.
 	 */
-	motg->core_clk = clk_get(&pdev->dev, "usb_hs_core_clk");
-	if (IS_ERR(motg->core_clk))
-		motg->core_clk = NULL;
+	motg->core_clk = devm_clk_get(&pdev->dev, "usb_hs_core_clk");

 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		dev_err(&pdev->dev, "failed to get platform resource mem\n");
-		ret = -ENODEV;
-		goto put_core_clk;
-	}
+	motg->regs = devm_ioremap(&pdev->dev, res->start, resource_size(res));
+	if (IS_ERR(motg->regs))
+		return PTR_ERR(motg->regs);

-	motg->regs = ioremap(res->start, resource_size(res));
-	if (!motg->regs) {
-		dev_err(&pdev->dev, "ioremap failed\n");
-		ret = -ENOMEM;
-		goto put_core_clk;
-	}
 	dev_info(&pdev->dev, "OTG regs = %p\n", motg->regs);

 	motg->irq = platform_get_irq(pdev, 0);
 	if (!motg->irq) {
 		dev_err(&pdev->dev, "platform_get_irq failed\n");
-		ret = -ENODEV;
-		goto free_regs;
+		return motg->irq;
+	}
+
+	motg->vddcx = devm_regulator_get(motg->phy.dev, "HSUSB_VDDCX");
+	if (IS_ERR(motg->vddcx)) {
+		dev_err(motg->phy.dev, "unable to get hsusb vddcx\n");
+		return PTR_ERR(motg->vddcx);
+	}
+
+	motg->v3p3 = devm_regulator_get(motg->phy.dev, "HSUSB_3p3");
+	if (IS_ERR(motg->v3p3)) {
+		dev_err(motg->phy.dev, "unable to get hsusb 3p3\n");
+		return PTR_ERR(motg->v3p3);
+	}
+
+	motg->v1p8 = devm_regulator_get(motg->phy.dev, "HSUSB_1p8");
+	if (IS_ERR(motg->v1p8)) {
+		dev_err(motg->phy.dev, "unable to get hsusb 1p8\n");
+		return PTR_ERR(motg->v1p8);
+	}
+
+	clk_set_rate(motg->clk, 60000000);
+	if (!IS_ERR(motg->pclk_src)) {
+		clk_set_rate(motg->pclk_src, INT_MAX);
+		clk_prepare_enable(motg->pclk_src);
 	}

 	clk_prepare_enable(motg->clk);
 	clk_prepare_enable(motg->pclk);

+	if (!IS_ERR(motg->core_clk))
+		clk_prepare_enable(motg->core_clk);
+
 	ret = msm_hsusb_init_vddcx(motg, 1);
 	if (ret) {
 		dev_err(&pdev->dev, "hsusb vddcx configuration failed\n");
-		goto free_regs;
+		goto disable_clks;
 	}

 	ret = msm_hsusb_ldo_init(motg, 1);
 	if (ret) {
 		dev_err(&pdev->dev, "hsusb vreg configuration failed\n");
-		goto vddcx_exit;
+		goto disable_vddcx;
 	}
 	ret = msm_hsusb_ldo_set_mode(motg, 1);
 	if (ret) {
 		dev_err(&pdev->dev, "hsusb vreg enable failed\n");
-		goto ldo_exit;
+		goto disable_ldo;
 	}

-	if (motg->core_clk)
-		clk_prepare_enable(motg->core_clk);
-
 	writel(0, USB_USBINTR);
 	writel(0, USB_OTGSC);

 	INIT_WORK(&motg->sm_work, msm_otg_sm_work);
 	INIT_DELAYED_WORK(&motg->chg_work, msm_chg_detect_work);
-	ret = request_irq(motg->irq, msm_otg_irq, IRQF_SHARED,
+	ret = devm_request_irq(&pdev->dev, motg->irq, msm_otg_irq, IRQF_SHARED,
 					"msm_otg", motg);
 	if (ret) {
 		dev_err(&pdev->dev, "request irq failed\n");
-		goto disable_clks;
+		goto disable_ldo;
 	}

 	phy->init = msm_otg_reset;
@@ -1550,7 +1530,7 @@ static int msm_otg_probe(struct platform_device *pdev)
 	ret = usb_add_phy(&motg->phy, USB_PHY_TYPE_USB2);
 	if (ret) {
 		dev_err(&pdev->dev, "usb_add_phy failed\n");
-		goto free_irq;
+		goto disable_ldo;
 	}

 	platform_set_drvdata(pdev, motg);
@@ -1568,33 +1548,18 @@ static int msm_otg_probe(struct platform_device *pdev)
 	pm_runtime_enable(&pdev->dev);

 	return 0;
-free_irq:
-	free_irq(motg->irq, motg);
+
+disable_ldo:
+	msm_hsusb_ldo_init(motg, 0);
+disable_vddcx:
+	msm_hsusb_init_vddcx(motg, 0);
 disable_clks:
 	clk_disable_unprepare(motg->pclk);
 	clk_disable_unprepare(motg->clk);
-ldo_exit:
-	msm_hsusb_ldo_init(motg, 0);
-vddcx_exit:
-	msm_hsusb_init_vddcx(motg, 0);
-free_regs:
-	iounmap(motg->regs);
-put_core_clk:
-	if (motg->core_clk)
-		clk_put(motg->core_clk);
-	clk_put(motg->pclk);
-put_pclk_src:
-	if (!IS_ERR(motg->pclk_src)) {
+	if (!IS_ERR(motg->core_clk))
+		clk_disable_unprepare(motg->core_clk);
+	if (!IS_ERR(motg->pclk_src))
 		clk_disable_unprepare(motg->pclk_src);
-		clk_put(motg->pclk_src);
-	}
-put_clk:
-	clk_put(motg->clk);
-put_phy_reset_clk:
-	clk_put(motg->phy_reset_clk);
-free_motg:
-	kfree(motg->phy.otg);
-	kfree(motg);
 	return ret;
 }

@@ -1617,7 +1582,7 @@ static int msm_otg_remove(struct platform_device *pdev)
 	pm_runtime_disable(&pdev->dev);

 	usb_remove_phy(phy);
-	free_irq(motg->irq, motg);
+	disable_irq(motg->irq);

 	/*
 	 * Put PHY in low power mode.
@@ -1637,26 +1602,15 @@ static int msm_otg_remove(struct platform_device *pdev)

 	clk_disable_unprepare(motg->pclk);
 	clk_disable_unprepare(motg->clk);
-	if (motg->core_clk)
+	if (!IS_ERR(motg->core_clk))
 		clk_disable_unprepare(motg->core_clk);
-	if (!IS_ERR(motg->pclk_src)) {
+	if (!IS_ERR(motg->pclk_src))
 		clk_disable_unprepare(motg->pclk_src);
-		clk_put(motg->pclk_src);
-	}
+
 	msm_hsusb_ldo_init(motg, 0);

-	iounmap(motg->regs);
 	pm_runtime_set_suspended(&pdev->dev);

-	clk_put(motg->phy_reset_clk);
-	clk_put(motg->pclk);
-	clk_put(motg->clk);
-	if (motg->core_clk)
-		clk_put(motg->core_clk);
-
-	kfree(motg->phy.otg);
-	kfree(motg);
-
 	return 0;
 }

@@ -1736,6 +1690,7 @@ static const struct dev_pm_ops msm_otg_dev_pm_ops = {
 };

 static struct platform_driver msm_otg_driver = {
+	.probe = msm_otg_probe,
 	.remove = msm_otg_remove,
 	.driver = {
 		.name = DRIVER_NAME,
@@ -1744,7 +1699,7 @@ static struct platform_driver msm_otg_driver = {
 	},
 };

-module_platform_driver_probe(msm_otg_driver, msm_otg_probe);
+module_platform_driver(msm_otg_driver);

 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("MSM USB transceiver driver");
--
1.8.3.2


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v6 05/19] usb: phy: msm: Remove unnecessarily check for valid regulators.
  2014-04-22  9:20 [PATCH v6 00/19] usb: phy: msm: Fixes, cleanups and DT support Ivan T. Ivanov
@ 2014-04-22  9:20     ` Ivan T. Ivanov
  2014-04-22  9:20 ` [PATCH v6 02/19] usb: phy: msm: Remove __init macro from driver probe method Ivan T. Ivanov
                       ` (12 subsequent siblings)
  13 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22  9:20 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Ivan T. Ivanov, Greg Kroah-Hartman,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA

From: "Ivan T. Ivanov" <iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>

Whether regulators are available or not is checked at driver
probe. If they are not available driver will refuse to load,
so no need to check them again.

Signed-off-by: Ivan T. Ivanov <iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
---
 drivers/usb/phy/phy-msm-usb.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 67cac96..4045301 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -133,16 +133,6 @@ static int msm_hsusb_ldo_set_mode(struct msm_otg *motg, int on)
 {
 	int ret = 0;

-	if (!motg->v1p8 || IS_ERR(motg->v1p8)) {
-		pr_err("%s: HSUSB_1p8 is not initialized\n", __func__);
-		return -ENODEV;
-	}
-
-	if (!motg->v3p3 || IS_ERR(motg->v3p3)) {
-		pr_err("%s: HSUSB_3p3 is not initialized\n", __func__);
-		return -ENODEV;
-	}

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v6 05/19] usb: phy: msm: Remove unnecessarily check for valid regulators.
@ 2014-04-22  9:20     ` Ivan T. Ivanov
  0 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22  9:20 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Ivan T. Ivanov, Greg Kroah-Hartman, linux-usb, linux-kernel,
	linux-arm-msm

From: "Ivan T. Ivanov" <iivanov@mm-sol.com>

Whether regulators are available or not is checked at driver
probe. If they are not available driver will refuse to load,
so no need to check them again.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
---
 drivers/usb/phy/phy-msm-usb.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 67cac96..4045301 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -133,16 +133,6 @@ static int msm_hsusb_ldo_set_mode(struct msm_otg *motg, int on)
 {
 	int ret = 0;

-	if (!motg->v1p8 || IS_ERR(motg->v1p8)) {
-		pr_err("%s: HSUSB_1p8 is not initialized\n", __func__);
-		return -ENODEV;
-	}
-
-	if (!motg->v3p3 || IS_ERR(motg->v3p3)) {
-		pr_err("%s: HSUSB_3p3 is not initialized\n", __func__);
-		return -ENODEV;
-	}
-
 	if (on) {
 		ret = regulator_set_optimum_mode(motg->v1p8,
 				USB_PHY_1P8_HPM_LOAD);
--
1.8.3.2


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v6 06/19] usb: phy: msm: Fix checkpatch.pl warnings
  2014-04-22  9:20 [PATCH v6 00/19] usb: phy: msm: Fixes, cleanups and DT support Ivan T. Ivanov
  2014-04-22  9:20 ` [PATCH v6 01/19] usb: phy: msm: Make driver selectable on ARCH_QCOM Ivan T. Ivanov
  2014-04-22  9:20 ` [PATCH v6 02/19] usb: phy: msm: Remove __init macro from driver probe method Ivan T. Ivanov
@ 2014-04-22  9:20 ` Ivan T. Ivanov
  2014-04-22 15:30   ` Srinivas Kandagatla
  2014-04-22  9:20 ` [PATCH v6 07/19] usb: phy: msm: Replace custom enum usb_mode_type with enum usb_dr_mode Ivan T. Ivanov
                   ` (10 subsequent siblings)
  13 siblings, 1 reply; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22  9:20 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Ivan T. Ivanov, Greg Kroah-Hartman, linux-usb, linux-kernel,
	linux-arm-msm

From: "Ivan T. Ivanov" <iivanov@mm-sol.com>

This fixes following:

WARNING: quoted string split across lines
WARNING: Prefer seq_puts to seq_printf

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
---
 drivers/usb/phy/phy-msm-usb.c | 39 ++++++++++++++-------------------------
 1 file changed, 14 insertions(+), 25 deletions(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 4045301..1629247 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -67,8 +67,7 @@ static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init)
 				USB_PHY_VDD_DIG_VOL_MIN,
 				USB_PHY_VDD_DIG_VOL_MAX);
 		if (ret) {
-			dev_err(motg->phy.dev, "unable to set the voltage "
-					"for hsusb vddcx\n");
+			dev_err(motg->phy.dev, "Cannot set vddcx voltage\n");
 			return ret;
 		}

@@ -79,8 +78,7 @@ static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init)
 		ret = regulator_set_voltage(motg->vddcx, 0,
 			USB_PHY_VDD_DIG_VOL_MAX);
 		if (ret)
-			dev_err(motg->phy.dev, "unable to set the voltage "
-					"for hsusb vddcx\n");
+			dev_err(motg->phy.dev, "Cannot set vddcx voltage\n");
 		ret = regulator_disable(motg->vddcx);
 		if (ret)
 			dev_err(motg->phy.dev, "unable to disable hsusb vddcx\n");
@@ -97,8 +95,7 @@ static int msm_hsusb_ldo_init(struct msm_otg *motg, int init)
 		rc = regulator_set_voltage(motg->v3p3, USB_PHY_3P3_VOL_MIN,
 				USB_PHY_3P3_VOL_MAX);
 		if (rc) {
-			dev_err(motg->phy.dev, "unable to set voltage level "
-					"for hsusb 3p3\n");
+			dev_err(motg->phy.dev, "Cannot set v3p3 voltage\n");
 			goto exit;
 		}
 		rc = regulator_enable(motg->v3p3);
@@ -109,8 +106,7 @@ static int msm_hsusb_ldo_init(struct msm_otg *motg, int init)
 		rc = regulator_set_voltage(motg->v1p8, USB_PHY_1P8_VOL_MIN,
 				USB_PHY_1P8_VOL_MAX);
 		if (rc) {
-			dev_err(motg->phy.dev, "unable to set voltage level "
-					"for hsusb 1p8\n");
+			dev_err(motg->phy.dev, "Cannot set v1p8 voltage\n");
 			goto disable_3p3;
 		}
 		rc = regulator_enable(motg->v1p8);
@@ -137,15 +133,13 @@ static int msm_hsusb_ldo_set_mode(struct msm_otg *motg, int on)
 		ret = regulator_set_optimum_mode(motg->v1p8,
 				USB_PHY_1P8_HPM_LOAD);
 		if (ret < 0) {
-			pr_err("%s: Unable to set HPM of the regulator "
-				"HSUSB_1p8\n", __func__);
+			pr_err("Could not set HPM for v1p8\n");
 			return ret;
 		}
 		ret = regulator_set_optimum_mode(motg->v3p3,
 				USB_PHY_3P3_HPM_LOAD);
 		if (ret < 0) {
-			pr_err("%s: Unable to set HPM of the regulator "
-				"HSUSB_3p3\n", __func__);
+			pr_err("Could not set HPM for v3p3\n");
 			regulator_set_optimum_mode(motg->v1p8,
 				USB_PHY_1P8_LPM_LOAD);
 			return ret;
@@ -154,13 +148,11 @@ static int msm_hsusb_ldo_set_mode(struct msm_otg *motg, int on)
 		ret = regulator_set_optimum_mode(motg->v1p8,
 				USB_PHY_1P8_LPM_LOAD);
 		if (ret < 0)
-			pr_err("%s: Unable to set LPM of the regulator "
-				"HSUSB_1p8\n", __func__);
+			pr_err("Could not set LPM for v1p8\n");
 		ret = regulator_set_optimum_mode(motg->v3p3,
 				USB_PHY_3P3_LPM_LOAD);
 		if (ret < 0)
-			pr_err("%s: Unable to set LPM of the regulator "
-				"HSUSB_3p3\n", __func__);
+			pr_err("Could not set LPM for v3p3\n");
 	}

 	pr_debug("reg (%s)\n", on ? "HPM" : "LPM");
@@ -390,8 +382,7 @@ static int msm_hsusb_config_vddcx(struct msm_otg *motg, int high)

 	ret = regulator_set_voltage(motg->vddcx, min_vol, max_vol);
 	if (ret) {
-		pr_err("%s: unable to set the voltage for regulator "
-			"HSUSB_VDDCX\n", __func__);
+		dev_err(motg->phy.dev, "Cannot set vddcx voltage\n");
 		return ret;
 	}

@@ -546,8 +537,7 @@ static int msm_otg_resume(struct msm_otg *motg)
 		 * PHY. USB state can not be restored. Re-insertion
 		 * of USB cable is the only way to get USB working.
 		 */
-		dev_err(phy->dev, "Unable to resume USB."
-				"Re-plugin the cable\n");
+		dev_err(phy->dev, "Unable to resume USB. Re-plugin the cable\n");
 		msm_otg_reset(phy);
 	}

@@ -1242,13 +1232,13 @@ static int msm_otg_mode_show(struct seq_file *s, void *unused)

 	switch (otg->phy->state) {
 	case OTG_STATE_A_HOST:
-		seq_printf(s, "host\n");
+		seq_puts(s, "host\n");
 		break;
 	case OTG_STATE_B_PERIPHERAL:
-		seq_printf(s, "peripheral\n");
+		seq_puts(s, "peripheral\n");
 		break;
 	default:
-		seq_printf(s, "none\n");
+		seq_puts(s, "none\n");
 		break;
 	}

@@ -1530,8 +1520,7 @@ static int msm_otg_probe(struct platform_device *pdev)
 			motg->pdata->otg_control == OTG_USER_CONTROL) {
 		ret = msm_otg_debugfs_init(motg);
 		if (ret)
-			dev_dbg(&pdev->dev, "mode debugfs file is"
-					"not available\n");
+			dev_dbg(&pdev->dev, "Can not create mode change file\n");
 	}

 	pm_runtime_set_active(&pdev->dev);
--
1.8.3.2

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v6 07/19] usb: phy: msm: Replace custom enum usb_mode_type with enum usb_dr_mode
  2014-04-22  9:20 [PATCH v6 00/19] usb: phy: msm: Fixes, cleanups and DT support Ivan T. Ivanov
                   ` (2 preceding siblings ...)
  2014-04-22  9:20 ` [PATCH v6 06/19] usb: phy: msm: Fix checkpatch.pl warnings Ivan T. Ivanov
@ 2014-04-22  9:20 ` Ivan T. Ivanov
  2014-04-22  9:20 ` [PATCH v6 08/19] usb: phy: msm: Remove unused pclk_src_name Ivan T. Ivanov
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22  9:20 UTC (permalink / raw)
  To: David Brown, Daniel Walker, Russell King, Felipe Balbi
  Cc: Ivan T. Ivanov, Greg Kroah-Hartman, linux-arm-msm, linux-kernel,
	linux-usb

From: "Ivan T. Ivanov" <iivanov@mm-sol.com>

Use enum usb_dr_mode and drop default usb_dr_mode from platform data.

USB DT bindings states: dr_mode: "...In case this attribute isn't
passed via DT, USB DRD controllers should default to OTG...",
so remove redundand field.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
Acked-by: David Brown <davidb@codeaurora.org>
---
 arch/arm/mach-msm/board-msm7x30.c |  2 +-
 arch/arm/mach-msm/board-qsd8x50.c |  2 +-
 drivers/usb/phy/phy-msm-usb.c     | 41 ++++++++++++++++-----------------------
 include/linux/usb/msm_hsusb.h     | 20 +------------------
 4 files changed, 20 insertions(+), 45 deletions(-)

diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c
index 46de789..0c4c200 100644
--- a/arch/arm/mach-msm/board-msm7x30.c
+++ b/arch/arm/mach-msm/board-msm7x30.c
@@ -95,7 +95,7 @@ static int hsusb_phy_clk_reset(struct clk *phy_clk)

 static struct msm_otg_platform_data msm_otg_pdata = {
 	.phy_init_seq		= hsusb_phy_init_seq,
-	.mode                   = USB_PERIPHERAL,
+	.mode                   = USB_DR_MODE_PERIPHERAL,
 	.otg_control		= OTG_PHY_CONTROL,
 	.link_clk_reset		= hsusb_link_clk_reset,
 	.phy_clk_reset		= hsusb_phy_clk_reset,
diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c
index 9169ec3..4c74861 100644
--- a/arch/arm/mach-msm/board-qsd8x50.c
+++ b/arch/arm/mach-msm/board-qsd8x50.c
@@ -116,7 +116,7 @@ static int hsusb_phy_clk_reset(struct clk *phy_clk)

 static struct msm_otg_platform_data msm_otg_pdata = {
 	.phy_init_seq		= hsusb_phy_init_seq,
-	.mode                   = USB_PERIPHERAL,
+	.mode                   = USB_DR_MODE_PERIPHERAL,
 	.otg_control		= OTG_PHY_CONTROL,
 	.link_clk_reset		= hsusb_link_clk_reset,
 	.phy_clk_reset		= hsusb_phy_clk_reset,
diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 1629247..b87f33a 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -348,10 +348,10 @@ static int msm_otg_reset(struct usb_phy *phy)

 	if (pdata->otg_control == OTG_PHY_CONTROL) {
 		val = readl(USB_OTGSC);
-		if (pdata->mode == USB_OTG) {
+		if (pdata->mode == USB_DR_MODE_OTG) {
 			ulpi_val = ULPI_INT_IDGRD | ULPI_INT_SESS_VALID;
 			val |= OTGSC_IDIE | OTGSC_BSVIE;
-		} else if (pdata->mode == USB_PERIPHERAL) {
+		} else if (pdata->mode == USB_DR_MODE_PERIPHERAL) {
 			ulpi_val = ULPI_INT_SESS_VALID;
 			val |= OTGSC_BSVIE;
 		}
@@ -637,7 +637,7 @@ static int msm_otg_set_host(struct usb_otg *otg, struct usb_bus *host)
 	 * Fail host registration if this board can support
 	 * only peripheral configuration.
 	 */
-	if (motg->pdata->mode == USB_PERIPHERAL) {
+	if (motg->pdata->mode == USB_DR_MODE_PERIPHERAL) {
 		dev_info(otg->phy->dev, "Host mode is not supported\n");
 		return -ENODEV;
 	}
@@ -666,7 +666,7 @@ static int msm_otg_set_host(struct usb_otg *otg, struct usb_bus *host)
 	 * Kick the state machine work, if peripheral is not supported
 	 * or peripheral is already registered with us.
 	 */
-	if (motg->pdata->mode == USB_HOST || otg->gadget) {
+	if (motg->pdata->mode == USB_DR_MODE_HOST || otg->gadget) {
 		pm_runtime_get_sync(otg->phy->dev);
 		schedule_work(&motg->sm_work);
 	}
@@ -710,7 +710,7 @@ static int msm_otg_set_peripheral(struct usb_otg *otg,
 	 * Fail peripheral registration if this board can support
 	 * only host configuration.
 	 */
-	if (motg->pdata->mode == USB_HOST) {
+	if (motg->pdata->mode == USB_DR_MODE_HOST) {
 		dev_info(otg->phy->dev, "Peripheral mode is not supported\n");
 		return -ENODEV;
 	}
@@ -735,7 +735,7 @@ static int msm_otg_set_peripheral(struct usb_otg *otg,
 	 * Kick the state machine work, if host is not supported
 	 * or host is already registered with us.
 	 */
-	if (motg->pdata->mode == USB_PERIPHERAL || otg->host) {
+	if (motg->pdata->mode == USB_DR_MODE_PERIPHERAL || otg->host) {
 		pm_runtime_get_sync(otg->phy->dev);
 		schedule_work(&motg->sm_work);
 	}
@@ -1056,7 +1056,7 @@ static void msm_otg_init_sm(struct msm_otg *motg)
 	u32 otgsc = readl(USB_OTGSC);

 	switch (pdata->mode) {
-	case USB_OTG:
+	case USB_DR_MODE_OTG:
 		if (pdata->otg_control == OTG_PHY_CONTROL) {
 			if (otgsc & OTGSC_ID)
 				set_bit(ID, &motg->inputs);
@@ -1068,21 +1068,14 @@ static void msm_otg_init_sm(struct msm_otg *motg)
 			else
 				clear_bit(B_SESS_VLD, &motg->inputs);
 		} else if (pdata->otg_control == OTG_USER_CONTROL) {
-			if (pdata->default_mode == USB_HOST) {
-				clear_bit(ID, &motg->inputs);
-			} else if (pdata->default_mode == USB_PERIPHERAL) {
-				set_bit(ID, &motg->inputs);
-				set_bit(B_SESS_VLD, &motg->inputs);
-			} else {
 				set_bit(ID, &motg->inputs);
 				clear_bit(B_SESS_VLD, &motg->inputs);
-			}
 		}
 		break;
-	case USB_HOST:
+	case USB_DR_MODE_HOST:
 		clear_bit(ID, &motg->inputs);
 		break;
-	case USB_PERIPHERAL:
+	case USB_DR_MODE_PERIPHERAL:
 		set_bit(ID, &motg->inputs);
 		if (otgsc & OTGSC_BSV)
 			set_bit(B_SESS_VLD, &motg->inputs);
@@ -1258,7 +1251,7 @@ static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf,
 	char buf[16];
 	struct usb_otg *otg = motg->phy.otg;
 	int status = count;
-	enum usb_mode_type req_mode;
+	enum usb_dr_mode req_mode;

 	memset(buf, 0x00, sizeof(buf));

@@ -1268,18 +1261,18 @@ static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf,
 	}

 	if (!strncmp(buf, "host", 4)) {
-		req_mode = USB_HOST;
+		req_mode = USB_DR_MODE_HOST;
 	} else if (!strncmp(buf, "peripheral", 10)) {
-		req_mode = USB_PERIPHERAL;
+		req_mode = USB_DR_MODE_PERIPHERAL;
 	} else if (!strncmp(buf, "none", 4)) {
-		req_mode = USB_NONE;
+		req_mode = USB_DR_MODE_UNKNOWN;
 	} else {
 		status = -EINVAL;
 		goto out;
 	}

 	switch (req_mode) {
-	case USB_NONE:
+	case USB_DR_MODE_UNKNOWN:
 		switch (otg->phy->state) {
 		case OTG_STATE_A_HOST:
 		case OTG_STATE_B_PERIPHERAL:
@@ -1290,7 +1283,7 @@ static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf,
 			goto out;
 		}
 		break;
-	case USB_PERIPHERAL:
+	case USB_DR_MODE_PERIPHERAL:
 		switch (otg->phy->state) {
 		case OTG_STATE_B_IDLE:
 		case OTG_STATE_A_HOST:
@@ -1301,7 +1294,7 @@ static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf,
 			goto out;
 		}
 		break;
-	case USB_HOST:
+	case USB_DR_MODE_HOST:
 		switch (otg->phy->state) {
 		case OTG_STATE_B_IDLE:
 		case OTG_STATE_B_PERIPHERAL:
@@ -1516,7 +1509,7 @@ static int msm_otg_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, motg);
 	device_init_wakeup(&pdev->dev, 1);

-	if (motg->pdata->mode == USB_OTG &&
+	if (motg->pdata->mode == USB_DR_MODE_OTG &&
 			motg->pdata->otg_control == OTG_USER_CONTROL) {
 		ret = msm_otg_debugfs_init(motg);
 		if (ret)
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 8705b01..72c5830 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -23,21 +23,6 @@
 #include <linux/clk.h>

 /**
- * Supported USB modes
- *
- * USB_PERIPHERAL       Only peripheral mode is supported.
- * USB_HOST             Only host mode is supported.
- * USB_OTG              OTG mode is supported.
- *
- */
-enum usb_mode_type {
-	USB_NONE = 0,
-	USB_PERIPHERAL,
-	USB_HOST,
-	USB_OTG,
-};
-
-/**
  * OTG control
  *
  * OTG_NO_CONTROL	Id/VBUS notifications not required. Useful in host
@@ -121,8 +106,6 @@ enum usb_chg_type {
  * @power_budget: VBUS power budget in mA (0 will be treated as 500mA).
  * @mode: Supported mode (OTG/peripheral/host).
  * @otg_control: OTG switch controlled by user/Id pin
- * @default_mode: Default operational mode. Applicable only if
- *              OTG switch is controller by user.
  * @pclk_src_name: pclk is derived from ebi1_usb_clk in case of 7x27 and 8k
  *              dfab_usb_hs_clk in case of 8660 and 8960.
  */
@@ -130,9 +113,8 @@ struct msm_otg_platform_data {
 	int *phy_init_seq;
 	void (*vbus_power)(bool on);
 	unsigned power_budget;
-	enum usb_mode_type mode;
+	enum usb_dr_mode mode;
 	enum otg_control_type otg_control;
-	enum usb_mode_type default_mode;
 	enum msm_usb_phy_type phy_type;
 	void (*setup_gpio)(enum usb_otg_state state);
 	char *pclk_src_name;
--
1.8.3.2

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v6 08/19] usb: phy: msm: Remove unused pclk_src_name
  2014-04-22  9:20 [PATCH v6 00/19] usb: phy: msm: Fixes, cleanups and DT support Ivan T. Ivanov
                   ` (3 preceding siblings ...)
  2014-04-22  9:20 ` [PATCH v6 07/19] usb: phy: msm: Replace custom enum usb_mode_type with enum usb_dr_mode Ivan T. Ivanov
@ 2014-04-22  9:20 ` Ivan T. Ivanov
  2014-04-22  9:20 ` [PATCH v6 10/19] usb: phy: msm: Properly check result from platform_get_irq() Ivan T. Ivanov
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22  9:20 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Ivan T. Ivanov, Greg Kroah-Hartman, linux-usb, linux-kernel,
	linux-arm-msm

From: "Ivan T. Ivanov" <iivanov@mm-sol.com>

There are no references to 'pclk_src_name' in plaform code,
so it is unused.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
---
 drivers/usb/phy/phy-msm-usb.c | 26 +-------------------------
 include/linux/usb/msm_hsusb.h |  5 -----
 2 files changed, 1 insertion(+), 30 deletions(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index b87f33a..9b0f683 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -464,9 +464,6 @@ static int msm_otg_suspend(struct msm_otg *motg)
 	if (!IS_ERR(motg->core_clk))
 		clk_disable_unprepare(motg->core_clk);

-	if (!IS_ERR(motg->pclk_src))
-		clk_disable_unprepare(motg->pclk_src);
-
 	if (motg->pdata->phy_type == SNPS_28NM_INTEGRATED_PHY &&
 			motg->pdata->otg_control == OTG_PMIC_CONTROL) {
 		msm_hsusb_ldo_set_mode(motg, 0);
@@ -496,9 +493,6 @@ static int msm_otg_resume(struct msm_otg *motg)
 	if (!atomic_read(&motg->in_lpm))
 		return 0;

-	if (!IS_ERR(motg->pclk_src))
-		clk_prepare_enable(motg->pclk_src);
-
 	clk_prepare_enable(motg->pclk);
 	clk_prepare_enable(motg->clk);
 	if (!IS_ERR(motg->core_clk))
@@ -1395,17 +1389,8 @@ static int msm_otg_probe(struct platform_device *pdev)
 	 * If USB Core is running its protocol engine based on CORE CLK,
 	 * CORE CLK  must be running at >55Mhz for correct HSUSB
 	 * operation and USB core cannot tolerate frequency changes on
-	 * CORE CLK. For such USB cores, vote for maximum clk frequency
-	 * on pclk source
+	 * CORE CLK.
 	 */
-	 motg->pclk_src = ERR_PTR(-ENOENT);
-	 if (motg->pdata->pclk_src_name) {
-		motg->pclk_src = devm_clk_get(&pdev->dev,
-					motg->pdata->pclk_src_name);
-		if (IS_ERR(motg->pclk_src))
-			return PTR_ERR(motg->pclk_src);
-	}
-
 	motg->pclk = devm_clk_get(&pdev->dev, "usb_hs_pclk");
 	if (IS_ERR(motg->pclk)) {
 		dev_err(&pdev->dev, "failed to get usb_hs_pclk\n");
@@ -1451,10 +1436,6 @@ static int msm_otg_probe(struct platform_device *pdev)
 	}

 	clk_set_rate(motg->clk, 60000000);
-	if (!IS_ERR(motg->pclk_src)) {
-		clk_set_rate(motg->pclk_src, INT_MAX);
-		clk_prepare_enable(motg->pclk_src);
-	}

 	clk_prepare_enable(motg->clk);
 	clk_prepare_enable(motg->pclk);
@@ -1530,8 +1511,6 @@ disable_clks:
 	clk_disable_unprepare(motg->clk);
 	if (!IS_ERR(motg->core_clk))
 		clk_disable_unprepare(motg->core_clk);
-	if (!IS_ERR(motg->pclk_src))
-		clk_disable_unprepare(motg->pclk_src);
 	return ret;
 }

@@ -1576,9 +1555,6 @@ static int msm_otg_remove(struct platform_device *pdev)
 	clk_disable_unprepare(motg->clk);
 	if (!IS_ERR(motg->core_clk))
 		clk_disable_unprepare(motg->core_clk);
-	if (!IS_ERR(motg->pclk_src))
-		clk_disable_unprepare(motg->pclk_src);
-
 	msm_hsusb_ldo_init(motg, 0);

 	pm_runtime_set_suspended(&pdev->dev);
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 72c5830..262ed80 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -106,8 +106,6 @@ enum usb_chg_type {
  * @power_budget: VBUS power budget in mA (0 will be treated as 500mA).
  * @mode: Supported mode (OTG/peripheral/host).
  * @otg_control: OTG switch controlled by user/Id pin
- * @pclk_src_name: pclk is derived from ebi1_usb_clk in case of 7x27 and 8k
- *              dfab_usb_hs_clk in case of 8660 and 8960.
  */
 struct msm_otg_platform_data {
 	int *phy_init_seq;
@@ -117,7 +115,6 @@ struct msm_otg_platform_data {
 	enum otg_control_type otg_control;
 	enum msm_usb_phy_type phy_type;
 	void (*setup_gpio)(enum usb_otg_state state);
-	char *pclk_src_name;
 	int (*link_clk_reset)(struct clk *link_clk, bool assert);
 	int (*phy_clk_reset)(struct clk *phy_clk);
 };
@@ -129,7 +126,6 @@ struct msm_otg_platform_data {
  * @irq: IRQ number assigned for HSUSB controller.
  * @clk: clock struct of usb_hs_clk.
  * @pclk: clock struct of usb_hs_pclk.
- * @pclk_src: pclk source for voting.
  * @phy_reset_clk: clock struct of usb_phy_clk.
  * @core_clk: clock struct of usb_hs_core_clk.
  * @regs: ioremapped register base address.
@@ -150,7 +146,6 @@ struct msm_otg {
 	int irq;
 	struct clk *clk;
 	struct clk *pclk;
-	struct clk *pclk_src;
 	struct clk *phy_reset_clk;
 	struct clk *core_clk;
 	void __iomem *regs;
--
1.8.3.2

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v6 09/19] usb: phy: msm: Remove HSUSB prefix from regulator names
  2014-04-22  9:20 [PATCH v6 00/19] usb: phy: msm: Fixes, cleanups and DT support Ivan T. Ivanov
@ 2014-04-22  9:20     ` Ivan T. Ivanov
  2014-04-22  9:20 ` [PATCH v6 02/19] usb: phy: msm: Remove __init macro from driver probe method Ivan T. Ivanov
                       ` (12 subsequent siblings)
  13 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22  9:20 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Ivan T. Ivanov, Greg Kroah-Hartman,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA

From: "Ivan T. Ivanov" <iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>

Prefix did not bring any useful information. Currently none
of the MSM platforms define these regulators, so it is safe
to rename them.

Signed-off-by: Ivan T. Ivanov <iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
---
 drivers/usb/phy/phy-msm-usb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 9b0f683..6b44826 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -1417,19 +1417,19 @@ static int msm_otg_probe(struct platform_device *pdev)
 		return motg->irq;
 	}

-	motg->vddcx = devm_regulator_get(motg->phy.dev, "HSUSB_VDDCX");
+	motg->vddcx = devm_regulator_get(motg->phy.dev, "vddcx");
 	if (IS_ERR(motg->vddcx)) {
 		dev_err(motg->phy.dev, "unable to get hsusb vddcx\n");
 		return PTR_ERR(motg->vddcx);
 	}

-	motg->v3p3 = devm_regulator_get(motg->phy.dev, "HSUSB_3p3");
+	motg->v3p3 = devm_regulator_get(motg->phy.dev, "v3p3");
 	if (IS_ERR(motg->v3p3)) {
 		dev_err(motg->phy.dev, "unable to get hsusb 3p3\n");
 		return PTR_ERR(motg->v3p3);
 	}

-	motg->v1p8 = devm_regulator_get(motg->phy.dev, "HSUSB_1p8");
+	motg->v1p8 = devm_regulator_get(motg->phy.dev, "v1p8");
 	if (IS_ERR(motg->v1p8)) {
 		dev_err(motg->phy.dev, "unable to get hsusb 1p8\n");
 		return PTR_ERR(motg->v1p8);
--
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v6 09/19] usb: phy: msm: Remove HSUSB prefix from regulator names
@ 2014-04-22  9:20     ` Ivan T. Ivanov
  0 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22  9:20 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Ivan T. Ivanov, Greg Kroah-Hartman, linux-usb, linux-kernel,
	linux-arm-msm

From: "Ivan T. Ivanov" <iivanov@mm-sol.com>

Prefix did not bring any useful information. Currently none
of the MSM platforms define these regulators, so it is safe
to rename them.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
---
 drivers/usb/phy/phy-msm-usb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 9b0f683..6b44826 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -1417,19 +1417,19 @@ static int msm_otg_probe(struct platform_device *pdev)
 		return motg->irq;
 	}

-	motg->vddcx = devm_regulator_get(motg->phy.dev, "HSUSB_VDDCX");
+	motg->vddcx = devm_regulator_get(motg->phy.dev, "vddcx");
 	if (IS_ERR(motg->vddcx)) {
 		dev_err(motg->phy.dev, "unable to get hsusb vddcx\n");
 		return PTR_ERR(motg->vddcx);
 	}

-	motg->v3p3 = devm_regulator_get(motg->phy.dev, "HSUSB_3p3");
+	motg->v3p3 = devm_regulator_get(motg->phy.dev, "v3p3");
 	if (IS_ERR(motg->v3p3)) {
 		dev_err(motg->phy.dev, "unable to get hsusb 3p3\n");
 		return PTR_ERR(motg->v3p3);
 	}

-	motg->v1p8 = devm_regulator_get(motg->phy.dev, "HSUSB_1p8");
+	motg->v1p8 = devm_regulator_get(motg->phy.dev, "v1p8");
 	if (IS_ERR(motg->v1p8)) {
 		dev_err(motg->phy.dev, "unable to get hsusb 1p8\n");
 		return PTR_ERR(motg->v1p8);
--
1.8.3.2


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v6 10/19] usb: phy: msm: Properly check result from platform_get_irq()
  2014-04-22  9:20 [PATCH v6 00/19] usb: phy: msm: Fixes, cleanups and DT support Ivan T. Ivanov
                   ` (4 preceding siblings ...)
  2014-04-22  9:20 ` [PATCH v6 08/19] usb: phy: msm: Remove unused pclk_src_name Ivan T. Ivanov
@ 2014-04-22  9:20 ` Ivan T. Ivanov
  2014-04-22  9:20 ` [PATCH v6 11/19] usb: phy: msm: Add device tree support and binding information Ivan T. Ivanov
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22  9:20 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Ivan T. Ivanov, Greg Kroah-Hartman, linux-usb, linux-kernel,
	linux-arm-msm

From: "Ivan T. Ivanov" <iivanov@mm-sol.com>

Function return negative code on error.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
---
 drivers/usb/phy/phy-msm-usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 6b44826..2dc7948 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -1412,7 +1412,7 @@ static int msm_otg_probe(struct platform_device *pdev)
 	dev_info(&pdev->dev, "OTG regs = %p\n", motg->regs);

 	motg->irq = platform_get_irq(pdev, 0);
-	if (!motg->irq) {
+	if (motg->irq < 0) {
 		dev_err(&pdev->dev, "platform_get_irq failed\n");
 		return motg->irq;
 	}
--
1.8.3.2

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v6 11/19] usb: phy: msm: Add device tree support and binding information
  2014-04-22  9:20 [PATCH v6 00/19] usb: phy: msm: Fixes, cleanups and DT support Ivan T. Ivanov
                   ` (5 preceding siblings ...)
  2014-04-22  9:20 ` [PATCH v6 10/19] usb: phy: msm: Properly check result from platform_get_irq() Ivan T. Ivanov
@ 2014-04-22  9:20 ` Ivan T. Ivanov
       [not found]   ` <1398158438-21579-12-git-send-email-iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
  2014-04-22  9:20 ` [PATCH v6 12/19] usb: phy: msm: Use reset framework for LINK and PHY resets Ivan T. Ivanov
                   ` (6 subsequent siblings)
  13 siblings, 1 reply; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22  9:20 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Randy Dunlap, Felipe Balbi, Grant Likely
  Cc: Ivan T. Ivanov, Greg Kroah-Hartman, David Brown, devicetree,
	linux-doc, linux-kernel, linux-usb, linux-arm-msm

From: "Ivan T. Ivanov" <iivanov@mm-sol.com>

Allows MSM OTG controller to be specified via device tree.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
---
 .../devicetree/bindings/usb/msm-hsusb.txt          |  67 +++++++++++++
 drivers/usb/phy/phy-msm-usb.c                      | 108 +++++++++++++++++----
 include/linux/usb/msm_hsusb.h                      |   6 +-
 3 files changed, 159 insertions(+), 22 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/msm-hsusb.txt b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
index 5ea26c6..ee4123d 100644
--- a/Documentation/devicetree/bindings/usb/msm-hsusb.txt
+++ b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
@@ -15,3 +15,70 @@ Example EHCI controller device node:
 		usb-phy = <&usb_otg>;
 	};

+USB PHY with optional OTG:
+
+Required properties:
+- compatible:   Should contain:
+  "qcom,usb-otg-ci" for chipsets with ChipIdea 45nm PHY
+  "qcom,usb-otg-snps" for chipsets with Synopsys 28nm PHY
+
+- regs:         Offset and length of the register set in the memory map
+- interrupts:   interrupt-specifier for the OTG interrupt.
+
+- clocks:       A list of phandle + clock-specifier pairs for the
+                clocks listed in clock-names
+- clock-names:  Should contain the following:
+  "phy"         USB PHY reference clock
+  "core"        Protocol engine clock
+  "iface"       Interface bus clock
+  "alt_core"    Protocol engine clock for targets with asynchronous
+                reset methodology. (optional)
+
+- vdccx-supply: phandle to the regulator for the vdd supply for
+                digital circuit operation.
+- v1p8-supply:  phandle to the regulator for the 1.8V supply
+- v3p3-supply:  phandle to the regulator for the 3.3V supply
+
+- resets:       A list of phandle + reset-specifier pairs for the
+                resets listed in reset-names
+- reset-names:  Should contain the following:
+  "phy"         USB PHY controller reset
+  "link"        USB LINK controller reset
+
+- qcom,otg-control: OTG control (VBUS and ID notifications) can be one of
+                1 - PHY control
+                2 - PMIC control
+
+Optional properties:
+- dr_mode:      One of "host", "peripheral" or "otg". Defaults to "otg"
+
+- qcom,phy-init-sequence: PHY configuration sequence values. This is related to Device
+                Mode Eye Diagram test. Start address at which these values will be
+                written is ULPI_EXT_VENDOR_SPECIFIC. Value of -1 is reserved as
+                "do not overwrite default value at this address".
+                For example: qcom,phy-init-sequence = < -1 0x63 >;
+                Will update only value at address ULPI_EXT_VENDOR_SPECIFIC + 1.
+
+Example HSUSB OTG controller device node:
+
+    usb@f9a55000 {
+        compatible = "qcom,usb-otg-snps";
+        reg = <0xf9a55000 0x400>;
+        interrupts = <0 134 0>;
+        dr_mode = "peripheral";
+
+        clocks = <&gcc GCC_XO_CLK>, <&gcc GCC_USB_HS_SYSTEM_CLK>,
+                <&gcc GCC_USB_HS_AHB_CLK>;
+
+        clock-names = "phy", "core", "iface";
+
+        vddcx-supply = <&pm8841_s2_corner>;
+        v1p8-supply = <&pm8941_l6>;
+        v3p3-supply = <&pm8941_l24>;
+
+        resets = <&gcc GCC_USB2A_PHY_BCR>, <&gcc GCC_USB_HS_BCR>;
+        reset-names = "phy", "link";
+
+        qcom,otg-control = <1>;
+        qcom,phy-init-sequence = <-1 0x63>;
+	};
diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 2dc7948..7619b3f 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -30,9 +30,12 @@
 #include <linux/debugfs.h>
 #include <linux/seq_file.h>
 #include <linux/pm_runtime.h>
+#include <linux/of.h>
+#include <linux/of_device.h>

 #include <linux/usb.h>
 #include <linux/usb/otg.h>
+#include <linux/usb/of.h>
 #include <linux/usb/ulpi.h>
 #include <linux/usb/gadget.h>
 #include <linux/usb/hcd.h>
@@ -217,16 +220,16 @@ static struct usb_phy_io_ops msm_otg_io_ops = {
 static void ulpi_init(struct msm_otg *motg)
 {
 	struct msm_otg_platform_data *pdata = motg->pdata;
-	int *seq = pdata->phy_init_seq;
+	int *seq = pdata->phy_init_seq, idx;
+	u32 addr = ULPI_EXT_VENDOR_SPECIFIC;

-	if (!seq)
-		return;
+	for (idx = 0; idx < pdata->phy_init_sz; idx++) {
+		if (seq[idx] == -1)
+			continue;

-	while (seq[0] >= 0) {
 		dev_vdbg(motg->phy.dev, "ulpi: write 0x%02x to 0x%02x\n",
-				seq[0], seq[1]);
-		ulpi_write(&motg->phy, seq[0], seq[1]);
-		seq += 2;
+				seq[idx], addr + idx);
+		ulpi_write(&motg->phy, seq[idx], addr + idx);
 	}
 }

@@ -1343,25 +1346,87 @@ static void msm_otg_debugfs_cleanup(void)
 	debugfs_remove(msm_otg_dbg_root);
 }

+static struct of_device_id msm_otg_dt_match[] = {
+	{
+		.compatible = "qcom,usb-otg-ci",
+		.data = (void *) CI_45NM_INTEGRATED_PHY
+	}, {
+		.compatible = "qcom,usb-otg-snps",
+		.data = (void *) SNPS_28NM_INTEGRATED_PHY
+	}, {}
+};
+
+static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg)
+{
+	struct msm_otg_platform_data *pdata;
+	const struct of_device_id *id;
+	struct device_node *node = pdev->dev.of_node;
+	struct property *prop;
+	int len, ret;
+	u32 val;
+
+	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+	if (!pdata)
+		return -ENOMEM;
+
+	motg->pdata = pdata;
+
+	id = of_match_device(msm_otg_dt_match, &pdev->dev);
+	pdata->phy_type = (int) id->data;
+
+	pdata->mode = of_usb_get_dr_mode(node);
+	if (pdata->mode == USB_DR_MODE_UNKNOWN)
+		pdata->mode = USB_DR_MODE_OTG;
+
+	pdata->otg_control = OTG_PHY_CONTROL;
+	if (!of_property_read_u32(node, "qcom,otg-control", &val))
+		if (val == OTG_PMIC_CONTROL)
+			pdata->otg_control = val;
+
+	prop = of_find_property(node, "qcom,phy-init-sequence", &len);
+	if (!prop || !len)
+		return 0;
+
+	pdata->phy_init_seq = devm_kzalloc(&pdev->dev, len, GFP_KERNEL);
+	if (!pdata->phy_init_seq)
+		return 0;
+
+	len /= sizeof(u32);
+
+	if (len >= ULPI_EXT_VENDOR_SPECIFIC) {
+		dev_warn(&pdev->dev, "Too big PHY init sequence %d\n", len);
+		return 0;
+	}
+
+	ret = of_property_read_u32_array(node, "qcom,phy-init-sequence",
+					 pdata->phy_init_seq, len);
+	if (!ret)
+		pdata->phy_init_sz = len;
+	return 0;
+}
+
 static int msm_otg_probe(struct platform_device *pdev)
 {
 	int ret = 0;
+	struct device_node *np = pdev->dev.of_node;
+	struct msm_otg_platform_data *pdata;
 	struct resource *res;
 	struct msm_otg *motg;
 	struct usb_phy *phy;

-	dev_info(&pdev->dev, "msm_otg probe\n");
-	if (!dev_get_platdata(&pdev->dev)) {
-		dev_err(&pdev->dev, "No platform data given. Bailing out\n");
-		return -ENODEV;
-	}
-
 	motg = devm_kzalloc(&pdev->dev, sizeof(struct msm_otg), GFP_KERNEL);
 	if (!motg) {
 		dev_err(&pdev->dev, "unable to allocate msm_otg\n");
 		return -ENOMEM;
 	}

+	pdata = dev_get_platdata(&pdev->dev);
+	if (!pdata) {
+		ret = msm_otg_read_dt(pdev, motg);
+		if (ret)
+			return ret;
+	}
+
 	motg->phy.otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg),
 				     GFP_KERNEL);
 	if (!motg->phy.otg) {
@@ -1369,17 +1434,17 @@ static int msm_otg_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}

-	motg->pdata = dev_get_platdata(&pdev->dev);
 	phy = &motg->phy;
 	phy->dev = &pdev->dev;

-	motg->phy_reset_clk = devm_clk_get(&pdev->dev, "usb_phy_clk");
+	motg->phy_reset_clk = devm_clk_get(&pdev->dev,
+					   np ? "phy" : "usb_phy_clk");
 	if (IS_ERR(motg->phy_reset_clk)) {
 		dev_err(&pdev->dev, "failed to get usb_phy_clk\n");
 		return PTR_ERR(motg->phy_reset_clk);
 	}

-	motg->clk = devm_clk_get(&pdev->dev, "usb_hs_clk");
+	motg->clk = devm_clk_get(&pdev->dev, np ? "core" : "usb_hs_clk");
 	if (IS_ERR(motg->clk)) {
 		dev_err(&pdev->dev, "failed to get usb_hs_clk\n");
 		return PTR_ERR(motg->clk);
@@ -1391,7 +1456,7 @@ static int msm_otg_probe(struct platform_device *pdev)
 	 * operation and USB core cannot tolerate frequency changes on
 	 * CORE CLK.
 	 */
-	motg->pclk = devm_clk_get(&pdev->dev, "usb_hs_pclk");
+	motg->pclk = devm_clk_get(&pdev->dev, np ? "iface" : "usb_hs_pclk");
 	if (IS_ERR(motg->pclk)) {
 		dev_err(&pdev->dev, "failed to get usb_hs_pclk\n");
 		return PTR_ERR(motg->pclk);
@@ -1402,7 +1467,8 @@ static int msm_otg_probe(struct platform_device *pdev)
 	 * clock is introduced to remove the dependency on AXI
 	 * bus frequency.
 	 */
-	motg->core_clk = devm_clk_get(&pdev->dev, "usb_hs_core_clk");
+	motg->core_clk = devm_clk_get(&pdev->dev,
+				      np ? "alt_core" : "usb_hs_core_clk");

 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	motg->regs = devm_ioremap(&pdev->dev, res->start, resource_size(res));
@@ -1490,8 +1556,7 @@ static int msm_otg_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, motg);
 	device_init_wakeup(&pdev->dev, 1);

-	if (motg->pdata->mode == USB_DR_MODE_OTG &&
-			motg->pdata->otg_control == OTG_USER_CONTROL) {
+	if (motg->pdata->mode == USB_DR_MODE_OTG) {
 		ret = msm_otg_debugfs_init(motg);
 		if (ret)
 			dev_dbg(&pdev->dev, "Can not create mode change file\n");
@@ -1637,6 +1702,8 @@ static const struct dev_pm_ops msm_otg_dev_pm_ops = {
 				msm_otg_runtime_idle)
 };

+MODULE_DEVICE_TABLE(of, msm_otg_dt_match);
+
 static struct platform_driver msm_otg_driver = {
 	.probe = msm_otg_probe,
 	.remove = msm_otg_remove,
@@ -1644,6 +1711,7 @@ static struct platform_driver msm_otg_driver = {
 		.name = DRIVER_NAME,
 		.owner = THIS_MODULE,
 		.pm = &msm_otg_dev_pm_ops,
+		.of_match_table = msm_otg_dt_match,
 	},
 };

diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 262ed80..bd68299 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -100,8 +100,9 @@ enum usb_chg_type {
 /**
  * struct msm_otg_platform_data - platform device data
  *              for msm_otg driver.
- * @phy_init_seq: PHY configuration sequence. val, reg pairs
- *              terminated by -1.
+ * @phy_init_seq: PHY configuration sequence values. Value of -1 is reserved as
+ *              "do not overwrite default vaule at this address".
+ * @phy_init_sz: PHY configuration sequence size.
  * @vbus_power: VBUS power on/off routine.
  * @power_budget: VBUS power budget in mA (0 will be treated as 500mA).
  * @mode: Supported mode (OTG/peripheral/host).
@@ -109,6 +110,7 @@ enum usb_chg_type {
  */
 struct msm_otg_platform_data {
 	int *phy_init_seq;
+	int phy_init_sz;
 	void (*vbus_power)(bool on);
 	unsigned power_budget;
 	enum usb_dr_mode mode;
--
1.8.3.2


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v6 12/19] usb: phy: msm: Use reset framework for LINK and PHY resets
  2014-04-22  9:20 [PATCH v6 00/19] usb: phy: msm: Fixes, cleanups and DT support Ivan T. Ivanov
                   ` (6 preceding siblings ...)
  2014-04-22  9:20 ` [PATCH v6 11/19] usb: phy: msm: Add device tree support and binding information Ivan T. Ivanov
@ 2014-04-22  9:20 ` Ivan T. Ivanov
  2014-04-22  9:20 ` [PATCH v6 13/19] usb: phy: msm: Add support for secondary PHY control Ivan T. Ivanov
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22  9:20 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Ivan T. Ivanov, Greg Kroah-Hartman, linux-usb, linux-kernel,
	linux-arm-msm

From: "Ivan T. Ivanov" <iivanov@mm-sol.com>

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
---
 drivers/usb/phy/phy-msm-usb.c | 29 +++++++++++++++++++++--------
 include/linux/usb/msm_hsusb.h |  3 +++
 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 7619b3f..d47d940 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -32,6 +32,7 @@
 #include <linux/pm_runtime.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/reset.h>

 #include <linux/usb.h>
 #include <linux/usb/otg.h>
@@ -235,12 +236,15 @@ static void ulpi_init(struct msm_otg *motg)

 static int msm_otg_link_clk_reset(struct msm_otg *motg, bool assert)
 {
-	int ret = 0;
+	int ret;

-	if (!motg->pdata->link_clk_reset)
-		return ret;
+	if (motg->pdata->link_clk_reset)
+		ret = motg->pdata->link_clk_reset(motg->clk, assert);
+	else if (assert)
+		ret = reset_control_assert(motg->link_rst);
+	else
+		ret = reset_control_deassert(motg->link_rst);

-	ret = motg->pdata->link_clk_reset(motg->clk, assert);
 	if (ret)
 		dev_err(motg->phy.dev, "usb link clk reset %s failed\n",
 			assert ? "assert" : "deassert");
@@ -250,12 +254,13 @@ static int msm_otg_link_clk_reset(struct msm_otg *motg, bool assert)

 static int msm_otg_phy_clk_reset(struct msm_otg *motg)
 {
-	int ret = 0;
+	int ret;

-	if (!motg->pdata->phy_clk_reset)
-		return ret;
+	if (motg->pdata->phy_clk_reset)
+		ret = motg->pdata->phy_clk_reset(motg->phy_reset_clk);
+	else
+		ret = reset_control_reset(motg->phy_rst);

-	ret = motg->pdata->phy_clk_reset(motg->phy_reset_clk);
 	if (ret)
 		dev_err(motg->phy.dev, "usb phy clk reset failed\n");

@@ -1374,6 +1379,14 @@ static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg)
 	id = of_match_device(msm_otg_dt_match, &pdev->dev);
 	pdata->phy_type = (int) id->data;

+	motg->link_rst = devm_reset_control_get(&pdev->dev, "link");
+	if (IS_ERR(motg->link_rst))
+		return PTR_ERR(motg->link_rst);
+
+	motg->phy_rst = devm_reset_control_get(&pdev->dev, "phy");
+	if (IS_ERR(motg->phy_rst))
+		return PTR_ERR(motg->phy_rst);
+
 	pdata->mode = of_usb_get_dr_mode(node);
 	if (pdata->mode == USB_DR_MODE_UNKNOWN)
 		pdata->mode = USB_DR_MODE_OTG;
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index bd68299..4e5d916 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -165,6 +165,9 @@ struct msm_otg {
 	struct regulator *v3p3;
 	struct regulator *v1p8;
 	struct regulator *vddcx;
+
+	struct reset_control *phy_rst;
+	struct reset_control *link_rst;
 };

 #endif
--
1.8.3.2

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v6 13/19] usb: phy: msm: Add support for secondary PHY control
  2014-04-22  9:20 [PATCH v6 00/19] usb: phy: msm: Fixes, cleanups and DT support Ivan T. Ivanov
                   ` (7 preceding siblings ...)
  2014-04-22  9:20 ` [PATCH v6 12/19] usb: phy: msm: Use reset framework for LINK and PHY resets Ivan T. Ivanov
@ 2014-04-22  9:20 ` Ivan T. Ivanov
  2014-04-22  9:20 ` [PATCH v6 14/19] usb: phy: msm: Correct USB PHY Reset sequence for newer platform Ivan T. Ivanov
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22  9:20 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Randy Dunlap, Felipe Balbi
  Cc: Ivan T. Ivanov, Greg Kroah-Hartman, David Brown, devicetree,
	linux-doc, linux-kernel, linux-usb, linux-arm-msm, Manu Gautam

From: "Ivan T. Ivanov" <iivanov@mm-sol.com>

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>
---
 .../devicetree/bindings/usb/msm-hsusb.txt          |  6 ++++++
 drivers/usb/phy/phy-msm-usb.c                      | 24 ++++++++++++++++++++--
 include/linux/usb/msm_hsusb.h                      |  1 +
 include/linux/usb/msm_hsusb_hw.h                   |  1 +
 4 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/msm-hsusb.txt b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
index ee4123d..0669667 100644
--- a/Documentation/devicetree/bindings/usb/msm-hsusb.txt
+++ b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
@@ -59,6 +59,12 @@ Optional properties:
                 For example: qcom,phy-init-sequence = < -1 0x63 >;
                 Will update only value at address ULPI_EXT_VENDOR_SPECIFIC + 1.

+- qcom,phy-num: Select number of pyco-phy to use, can be one of
+                0 - PHY one, default
+                1 - Second PHY
+                Some platforms may have configuration to allow USB
+                controller work with any of the two HSPHYs present.
+
 Example HSUSB OTG controller device node:

     usb@f9a55000 {
diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index d47d940..b03d7f1 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)
 	if (!retries)
 		return -ETIMEDOUT;

+	if (motg->phy_number)
+		writel(readl(USB_PHY_CTRL2) | BIT(16), USB_PHY_CTRL2);
+
 	dev_info(motg->phy.dev, "phy_reset: success\n");
 	return 0;
 }
@@ -368,6 +371,9 @@ static int msm_otg_reset(struct usb_phy *phy)
 		ulpi_write(phy, ulpi_val, ULPI_USB_INT_EN_FALL);
 	}

+	if (motg->phy_number)
+		writel(readl(USB_PHY_CTRL2) | BIT(16), USB_PHY_CTRL2);
+
 	return 0;
 }

@@ -404,6 +410,7 @@ static int msm_otg_suspend(struct msm_otg *motg)
 	struct usb_phy *phy = &motg->phy;
 	struct usb_bus *bus = phy->otg->host;
 	struct msm_otg_platform_data *pdata = motg->pdata;
+	void __iomem *addr;
 	int cnt = 0;

 	if (atomic_read(&motg->in_lpm))
@@ -463,9 +470,13 @@ static int msm_otg_suspend(struct msm_otg *motg)
 	 */
 	writel(readl(USB_USBCMD) | ASYNC_INTR_CTRL | ULPI_STP_CTRL, USB_USBCMD);

+	addr = USB_PHY_CTRL;
+	if (motg->phy_number)
+		addr = USB_PHY_CTRL2;
+
 	if (motg->pdata->phy_type == SNPS_28NM_INTEGRATED_PHY &&
 			motg->pdata->otg_control == OTG_PMIC_CONTROL)
-		writel(readl(USB_PHY_CTRL) | PHY_RETEN, USB_PHY_CTRL);
+		writel(readl(addr) | PHY_RETEN, addr);

 	clk_disable_unprepare(motg->pclk);
 	clk_disable_unprepare(motg->clk);
@@ -495,6 +506,7 @@ static int msm_otg_resume(struct msm_otg *motg)
 {
 	struct usb_phy *phy = &motg->phy;
 	struct usb_bus *bus = phy->otg->host;
+	void __iomem *addr;
 	int cnt = 0;
 	unsigned temp;

@@ -508,9 +520,14 @@ static int msm_otg_resume(struct msm_otg *motg)

 	if (motg->pdata->phy_type == SNPS_28NM_INTEGRATED_PHY &&
 			motg->pdata->otg_control == OTG_PMIC_CONTROL) {
+
+		addr = USB_PHY_CTRL;
+		if (motg->phy_number)
+			addr = USB_PHY_CTRL2;
+
 		msm_hsusb_ldo_set_mode(motg, 1);
 		msm_hsusb_config_vddcx(motg, 1);
-		writel(readl(USB_PHY_CTRL) & ~PHY_RETEN, USB_PHY_CTRL);
+		writel(readl(addr) & ~PHY_RETEN, addr);
 	}

 	temp = readl(USB_USBCMD);
@@ -1396,6 +1413,9 @@ static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg)
 		if (val == OTG_PMIC_CONTROL)
 			pdata->otg_control = val;

+	if (!of_property_read_u32(node, "qcom,phy-num", &val) && val < 2)
+		motg->phy_number = val;
+
 	prop = of_find_property(node, "qcom,phy-init-sequence", &len);
 	if (!prop || !len)
 		return 0;
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 4e5d916..4628f1a 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -158,6 +158,7 @@ struct msm_otg {
 	atomic_t in_lpm;
 	int async_int;
 	unsigned cur_power;
+	int phy_number;
 	struct delayed_work chg_work;
 	enum usb_chg_state chg_state;
 	enum usb_chg_type chg_type;
diff --git a/include/linux/usb/msm_hsusb_hw.h b/include/linux/usb/msm_hsusb_hw.h
index 6e97a2d..e6d7035 100644
--- a/include/linux/usb/msm_hsusb_hw.h
+++ b/include/linux/usb/msm_hsusb_hw.h
@@ -25,6 +25,7 @@
 #define USB_OTGSC            (MSM_USB_BASE + 0x01A4)
 #define USB_USBMODE          (MSM_USB_BASE + 0x01A8)
 #define USB_PHY_CTRL         (MSM_USB_BASE + 0x0240)
+#define USB_PHY_CTRL2        (MSM_USB_BASE + 0x0278)

 #define USBCMD_RESET   2
 #define USB_USBINTR          (MSM_USB_BASE + 0x0148)
--
1.8.3.2

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v6 14/19] usb: phy: msm: Correct USB PHY Reset sequence for newer platform
  2014-04-22  9:20 [PATCH v6 00/19] usb: phy: msm: Fixes, cleanups and DT support Ivan T. Ivanov
                   ` (8 preceding siblings ...)
  2014-04-22  9:20 ` [PATCH v6 13/19] usb: phy: msm: Add support for secondary PHY control Ivan T. Ivanov
@ 2014-04-22  9:20 ` Ivan T. Ivanov
  2014-04-22  9:20 ` [PATCH v6 15/19] usb: phy: msm: Fix PTS definitions for MSM USB controller Ivan T. Ivanov
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22  9:20 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Ivan T. Ivanov, Greg Kroah-Hartman, linux-usb, linux-kernel,
	linux-arm-msm, Tim Bird, Mayank Rana

From: "Ivan T. Ivanov" <iivanov@mm-sol.com>

On few legacy platforms, USB PHY is having dedicated reset clk.
It is used to reset USB PHY after putting USB PHY into low power
mode and for calibration of USB PHY. Putting USB PHY into low
power mode is causing ulpi read/write timeout as expected. USB PHY
reset clk is not available on newer platform.

For 28nm PHY, reset USB PHY after resestting USB LINK.
Also reset USB PHY using USB_PHY_PON bit with USB_OTG_HS_PHY_CTRL
register after programming USB PHY Override registers as suggested
with hardware programming guidelines.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
Signed-off-by: Tim Bird <tim.bird@sonymobile.com>
Cc: Mayank Rana <mrana@codeaurora.org>
---
 drivers/usb/phy/phy-msm-usb.c    | 140 ++++++++++++++++++++++++---------------
 include/linux/usb/msm_hsusb_hw.h |   5 ++
 2 files changed, 93 insertions(+), 52 deletions(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index b03d7f1..dababf9 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -48,6 +48,7 @@
 #define DRIVER_NAME	"msm_otg"

 #define ULPI_IO_TIMEOUT_USEC	(10 * 1000)
+#define LINK_RESET_TIMEOUT_USEC	(250 * 1000)

 #define USB_PHY_3P3_VOL_MIN	3050000 /* uV */
 #define USB_PHY_3P3_VOL_MAX	3300000 /* uV */
@@ -267,77 +268,35 @@ static int msm_otg_phy_clk_reset(struct msm_otg *motg)
 	return ret;
 }

-static int msm_otg_phy_reset(struct msm_otg *motg)
+static int msm_link_reset(struct msm_otg *motg)
 {
 	u32 val;
 	int ret;
-	int retries;

 	ret = msm_otg_link_clk_reset(motg, 1);
 	if (ret)
 		return ret;
-	ret = msm_otg_phy_clk_reset(motg);
-	if (ret)
-		return ret;
-	ret = msm_otg_link_clk_reset(motg, 0);
-	if (ret)
-		return ret;

-	val = readl(USB_PORTSC) & ~PORTSC_PTS_MASK;
-	writel(val | PORTSC_PTS_ULPI, USB_PORTSC);
-
-	for (retries = 3; retries > 0; retries--) {
-		ret = ulpi_write(&motg->phy, ULPI_FUNC_CTRL_SUSPENDM,
-				ULPI_CLR(ULPI_FUNC_CTRL));
-		if (!ret)
-			break;
-		ret = msm_otg_phy_clk_reset(motg);
-		if (ret)
-			return ret;
-	}
-	if (!retries)
-		return -ETIMEDOUT;
+	/* wait for 1ms delay as suggested in HPG. */
+	usleep_range(1000, 1200);

-	/* This reset calibrates the phy, if the above write succeeded */
-	ret = msm_otg_phy_clk_reset(motg);
+	ret = msm_otg_link_clk_reset(motg, 0);
 	if (ret)
 		return ret;

-	for (retries = 3; retries > 0; retries--) {
-		ret = ulpi_read(&motg->phy, ULPI_DEBUG);
-		if (ret != -ETIMEDOUT)
-			break;
-		ret = msm_otg_phy_clk_reset(motg);
-		if (ret)
-			return ret;
-	}
-	if (!retries)
-		return -ETIMEDOUT;
-
 	if (motg->phy_number)
 		writel(readl(USB_PHY_CTRL2) | BIT(16), USB_PHY_CTRL2);

-	dev_info(motg->phy.dev, "phy_reset: success\n");
+	val = readl(USB_PORTSC) & ~PORTSC_PTS_MASK;
+	writel(val | PORTSC_PTS_ULPI, USB_PORTSC);
+
 	return 0;
 }

-#define LINK_RESET_TIMEOUT_USEC		(250 * 1000)
 static int msm_otg_reset(struct usb_phy *phy)
 {
 	struct msm_otg *motg = container_of(phy, struct msm_otg, phy);
-	struct msm_otg_platform_data *pdata = motg->pdata;
 	int cnt = 0;
-	int ret;
-	u32 val = 0;
-	u32 ulpi_val = 0;
-
-	ret = msm_otg_phy_reset(motg);
-	if (ret) {
-		dev_err(phy->dev, "phy_reset failed\n");
-		return ret;
-	}
-
-	ulpi_init(motg);

 	writel(USBCMD_RESET, USB_USBCMD);
 	while (cnt < LINK_RESET_TIMEOUT_USEC) {
@@ -351,11 +310,86 @@ static int msm_otg_reset(struct usb_phy *phy)

 	/* select ULPI phy */
 	writel(0x80000000, USB_PORTSC);
+	writel(0x0, USB_AHBBURST);
+	writel(0x08, USB_AHBMODE);
+
+	if (motg->phy_number)
+		writel(readl(USB_PHY_CTRL2) | BIT(16), USB_PHY_CTRL2);
+	return 0;
+}
+
+static void msm_phy_reset(struct msm_otg *motg)
+{
+	void __iomem *addr;
+
+	if (motg->pdata->phy_type != SNPS_28NM_INTEGRATED_PHY) {
+		msm_otg_phy_clk_reset(motg);
+		return;
+	}
+
+	addr = USB_PHY_CTRL;
+	if (motg->phy_number)
+		addr = USB_PHY_CTRL2;
+
+	/* Assert USB PHY_POR */
+	writel(readl(addr) | PHY_POR_ASSERT, addr);
+
+	/*
+	 * wait for minimum 10 microseconds as suggested in HPG.
+	 * Use a slightly larger value since the exact value didn't
+	 * work 100% of the time.
+	 */
+	udelay(12);
+
+	/* Deassert USB PHY_POR */
+	writel(readl(addr) & ~PHY_POR_ASSERT, addr);
+}
+
+static int msm_usb_reset(struct usb_phy *phy)
+{
+	struct msm_otg *motg = container_of(phy, struct msm_otg, phy);
+	int ret;
+
+	if (!IS_ERR(motg->core_clk))
+		clk_prepare_enable(motg->core_clk);
+
+	ret = msm_link_reset(motg);
+	if (ret) {
+		dev_err(phy->dev, "phy_reset failed\n");
+		return ret;
+	}
+
+	ret = msm_otg_reset(&motg->phy);
+	if (ret) {
+		dev_err(phy->dev, "link reset failed\n");
+		return ret;
+	}

 	msleep(100);

-	writel(0x0, USB_AHBBURST);
-	writel(0x00, USB_AHBMODE);
+	/* Reset USB PHY after performing USB Link RESET */
+	msm_phy_reset(motg);
+
+	if (!IS_ERR(motg->core_clk))
+		clk_disable_unprepare(motg->core_clk);
+
+	return 0;
+}
+
+static int msm_phy_init(struct usb_phy *phy)
+{
+	struct msm_otg *motg = container_of(phy, struct msm_otg, phy);
+	struct msm_otg_platform_data *pdata = motg->pdata;
+	u32 val, ulpi_val = 0;
+
+	/* Program USB PHY Override registers. */
+	ulpi_init(motg);
+
+	/*
+	 * It is recommended in HPG to reset USB PHY after programming
+	 * USB PHY Override registers.
+	 */
+	msm_phy_reset(motg);

 	if (pdata->otg_control == OTG_PHY_CONTROL) {
 		val = readl(USB_OTGSC);
@@ -1571,7 +1605,7 @@ static int msm_otg_probe(struct platform_device *pdev)
 		goto disable_ldo;
 	}

-	phy->init = msm_otg_reset;
+	phy->init = msm_phy_init;
 	phy->set_power = msm_otg_set_power;

 	phy->io_ops = &msm_otg_io_ops;
@@ -1580,6 +1614,8 @@ static int msm_otg_probe(struct platform_device *pdev)
 	phy->otg->set_host = msm_otg_set_host;
 	phy->otg->set_peripheral = msm_otg_set_peripheral;

+	msm_usb_reset(phy);
+
 	ret = usb_add_phy(&motg->phy, USB_PHY_TYPE_USB2);
 	if (ret) {
 		dev_err(&pdev->dev, "usb_add_phy failed\n");
diff --git a/include/linux/usb/msm_hsusb_hw.h b/include/linux/usb/msm_hsusb_hw.h
index e6d7035..575c743 100644
--- a/include/linux/usb/msm_hsusb_hw.h
+++ b/include/linux/usb/msm_hsusb_hw.h
@@ -42,9 +42,14 @@
 #define ULPI_DATA(n)          ((n) & 255)
 #define ULPI_DATA_READ(n)     (((n) >> 8) & 255)

+/* synopsys 28nm phy registers */
+#define ULPI_PWR_CLK_MNG_REG	0x88
+#define OTG_COMP_DISABLE	BIT(0)
+
 #define ASYNC_INTR_CTRL         (1 << 29) /* Enable async interrupt */
 #define ULPI_STP_CTRL           (1 << 30) /* Block communication with PHY */
 #define PHY_RETEN               (1 << 1) /* PHY retention enable/disable */
+#define PHY_POR_ASSERT		(1 << 0) /* USB2 28nm PHY POR ASSERT */

 /* OTG definitions */
 #define OTGSC_INTSTS_MASK	(0x7f << 16)
--
1.8.3.2

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v6 15/19] usb: phy: msm: Fix PTS definitions for MSM USB controller
  2014-04-22  9:20 [PATCH v6 00/19] usb: phy: msm: Fixes, cleanups and DT support Ivan T. Ivanov
                   ` (9 preceding siblings ...)
  2014-04-22  9:20 ` [PATCH v6 14/19] usb: phy: msm: Correct USB PHY Reset sequence for newer platform Ivan T. Ivanov
@ 2014-04-22  9:20 ` Ivan T. Ivanov
       [not found]   ` <1398158438-21579-16-git-send-email-iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
  2014-04-22  9:20 ` [PATCH v6 17/19] usb: phy: msm: Handle disconnect events Ivan T. Ivanov
                   ` (2 subsequent siblings)
  13 siblings, 1 reply; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22  9:20 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Tim Bird, Greg Kroah-Hartman, linux-usb, linux-kernel,
	linux-arm-msm, Tim Bird

From: Tim Bird <tbird20d@gmail.com>

Fix the value used for Parallel Transceiver Select (PTS) for the MSM USB
controller.  This is a standard chipidea PORTSC definition, where
a PHY_TYPE of 10b (<<30) is ULPI and 11b (<<30) is SERIAL.
Fix the definitions and use them correctly in the driver code.

Signed-off-by: Tim Bird <tim.bird@sonymobile.com>
---
 drivers/usb/phy/phy-msm-usb.c    | 8 +++++---
 include/linux/usb/msm_hsusb_hw.h | 5 +++--
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index dababf9..e83d13a 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -287,8 +287,9 @@ static int msm_link_reset(struct msm_otg *motg)
 	if (motg->phy_number)
 		writel(readl(USB_PHY_CTRL2) | BIT(16), USB_PHY_CTRL2);

+	/* put transciever in serial mode as part of reset */
 	val = readl(USB_PORTSC) & ~PORTSC_PTS_MASK;
-	writel(val | PORTSC_PTS_ULPI, USB_PORTSC);
+	writel(val | PORTSC_PTS_SERIAL, USB_PORTSC);

 	return 0;
 }
@@ -308,8 +309,9 @@ static int msm_otg_reset(struct usb_phy *phy)
 	if (cnt >= LINK_RESET_TIMEOUT_USEC)
 		return -ETIMEDOUT;

-	/* select ULPI phy */
-	writel(0x80000000, USB_PORTSC);
+	/* select ULPI phy and clear other status/control bits in PORTSC */
+	writel(PORTSC_PTS_ULPI, USB_PORTSC);
+
 	writel(0x0, USB_AHBBURST);
 	writel(0x08, USB_AHBMODE);

diff --git a/include/linux/usb/msm_hsusb_hw.h b/include/linux/usb/msm_hsusb_hw.h
index 575c743..98d3dd8 100644
--- a/include/linux/usb/msm_hsusb_hw.h
+++ b/include/linux/usb/msm_hsusb_hw.h
@@ -31,8 +31,9 @@
 #define USB_USBINTR          (MSM_USB_BASE + 0x0148)

 #define PORTSC_PHCD            (1 << 23) /* phy suspend mode */
-#define PORTSC_PTS_MASK         (3 << 30)
-#define PORTSC_PTS_ULPI         (3 << 30)
+#define PORTSC_PTS_MASK        (3 << 30)
+#define PORTSC_PTS_ULPI        (2 << 30)
+#define PORTSC_PTS_SERIAL      (3 << 30)

 #define USB_ULPI_VIEWPORT    (MSM_USB_BASE + 0x0170)
 #define ULPI_RUN              (1 << 30)
--
1.8.3.2

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v6 16/19] usb: phy: msm: Select secondary PHY via TCSR
  2014-04-22  9:20 [PATCH v6 00/19] usb: phy: msm: Fixes, cleanups and DT support Ivan T. Ivanov
@ 2014-04-22  9:20     ` Ivan T. Ivanov
  2014-04-22  9:20 ` [PATCH v6 02/19] usb: phy: msm: Remove __init macro from driver probe method Ivan T. Ivanov
                       ` (12 subsequent siblings)
  13 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22  9:20 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Tim Bird, Greg Kroah-Hartman, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Tim Bird

From: Tim Bird <tbird20d-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Select the secondary PHY using the TCSR register, if phy-num=1
in the DTS (or phy_number is set in the platform data).  The
SOC has 2 PHYs which can be used with the OTG port, and this
code allows configuring the correct one.

Note: This resolves the problem I was seeing where I couldn't
get the USB driver working at all on a dragonboard, from cold
boot.  This patch depends on patch 5/14 from Ivan's msm USB
patch set.  It does not use DT for the register address, as
there's no evidence that this address changes between SoC
versions.

Signed-off-by: Tim Bird <tim.bird-/MT0OVThwyLZJqsBc5GL+g@public.gmane.org>
---
 drivers/usb/phy/phy-msm-usb.c    | 14 ++++++++++++++
 include/linux/usb/msm_hsusb_hw.h |  3 +++
 2 files changed, 17 insertions(+)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index e83d13a..729c06b 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -1482,6 +1482,7 @@ static int msm_otg_probe(struct platform_device *pdev)
 	struct resource *res;
 	struct msm_otg *motg;
 	struct usb_phy *phy;
+	void __iomem *phy_select;

 	motg = devm_kzalloc(&pdev->dev, sizeof(struct msm_otg), GFP_KERNEL);
 	if (!motg) {
@@ -1544,6 +1545,19 @@ static int msm_otg_probe(struct platform_device *pdev)
 	if (IS_ERR(motg->regs))
 		return PTR_ERR(motg->regs);

+	/*
+	 * NOTE: The PHYs can be multiplexed between the chipidea controller
+	 * and the dwc3 controller, using a single bit. It is important that
+	 * the dwc3 driver does not set this bit in an incompatible way.
+	 */
+	if (motg->phy_number) {
+		phy_select = devm_ioremap_nocache(&pdev->dev, USB2_PHY_SEL, 4);
+		if (IS_ERR(phy_select))
+			return PTR_ERR(phy_select);
+		/* Enable second PHY with the OTG port */
+		writel_relaxed(0x1, phy_select);
+	}
+
 	dev_info(&pdev->dev, "OTG regs = %p\n", motg->regs);

 	motg->irq = platform_get_irq(pdev, 0);
diff --git a/include/linux/usb/msm_hsusb_hw.h b/include/linux/usb/msm_hsusb_hw.h
index 98d3dd8..a29f603 100644
--- a/include/linux/usb/msm_hsusb_hw.h
+++ b/include/linux/usb/msm_hsusb_hw.h
@@ -16,6 +16,9 @@
 #ifndef __LINUX_USB_GADGET_MSM72K_UDC_H__
 #define __LINUX_USB_GADGET_MSM72K_UDC_H__

+/* USB phy selector - in TCSR address range */
+#define USB2_PHY_SEL         0xfd4ab000
+
 #define USB_AHBBURST         (MSM_USB_BASE + 0x0090)
 #define USB_AHBMODE          (MSM_USB_BASE + 0x0098)
 #define USB_CAPLENGTH        (MSM_USB_BASE + 0x0100) /* 8 bit */
--
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v6 16/19] usb: phy: msm: Select secondary PHY via TCSR
@ 2014-04-22  9:20     ` Ivan T. Ivanov
  0 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22  9:20 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Tim Bird, Greg Kroah-Hartman, linux-usb, linux-kernel,
	linux-arm-msm, Tim Bird

From: Tim Bird <tbird20d@gmail.com>

Select the secondary PHY using the TCSR register, if phy-num=1
in the DTS (or phy_number is set in the platform data).  The
SOC has 2 PHYs which can be used with the OTG port, and this
code allows configuring the correct one.

Note: This resolves the problem I was seeing where I couldn't
get the USB driver working at all on a dragonboard, from cold
boot.  This patch depends on patch 5/14 from Ivan's msm USB
patch set.  It does not use DT for the register address, as
there's no evidence that this address changes between SoC
versions.

Signed-off-by: Tim Bird <tim.bird@sonymobile.com>
---
 drivers/usb/phy/phy-msm-usb.c    | 14 ++++++++++++++
 include/linux/usb/msm_hsusb_hw.h |  3 +++
 2 files changed, 17 insertions(+)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index e83d13a..729c06b 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -1482,6 +1482,7 @@ static int msm_otg_probe(struct platform_device *pdev)
 	struct resource *res;
 	struct msm_otg *motg;
 	struct usb_phy *phy;
+	void __iomem *phy_select;

 	motg = devm_kzalloc(&pdev->dev, sizeof(struct msm_otg), GFP_KERNEL);
 	if (!motg) {
@@ -1544,6 +1545,19 @@ static int msm_otg_probe(struct platform_device *pdev)
 	if (IS_ERR(motg->regs))
 		return PTR_ERR(motg->regs);

+	/*
+	 * NOTE: The PHYs can be multiplexed between the chipidea controller
+	 * and the dwc3 controller, using a single bit. It is important that
+	 * the dwc3 driver does not set this bit in an incompatible way.
+	 */
+	if (motg->phy_number) {
+		phy_select = devm_ioremap_nocache(&pdev->dev, USB2_PHY_SEL, 4);
+		if (IS_ERR(phy_select))
+			return PTR_ERR(phy_select);
+		/* Enable second PHY with the OTG port */
+		writel_relaxed(0x1, phy_select);
+	}
+
 	dev_info(&pdev->dev, "OTG regs = %p\n", motg->regs);

 	motg->irq = platform_get_irq(pdev, 0);
diff --git a/include/linux/usb/msm_hsusb_hw.h b/include/linux/usb/msm_hsusb_hw.h
index 98d3dd8..a29f603 100644
--- a/include/linux/usb/msm_hsusb_hw.h
+++ b/include/linux/usb/msm_hsusb_hw.h
@@ -16,6 +16,9 @@
 #ifndef __LINUX_USB_GADGET_MSM72K_UDC_H__
 #define __LINUX_USB_GADGET_MSM72K_UDC_H__

+/* USB phy selector - in TCSR address range */
+#define USB2_PHY_SEL         0xfd4ab000
+
 #define USB_AHBBURST         (MSM_USB_BASE + 0x0090)
 #define USB_AHBMODE          (MSM_USB_BASE + 0x0098)
 #define USB_CAPLENGTH        (MSM_USB_BASE + 0x0100) /* 8 bit */
--
1.8.3.2


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v6 17/19] usb: phy: msm: Handle disconnect events
  2014-04-22  9:20 [PATCH v6 00/19] usb: phy: msm: Fixes, cleanups and DT support Ivan T. Ivanov
                   ` (10 preceding siblings ...)
  2014-04-22  9:20 ` [PATCH v6 15/19] usb: phy: msm: Fix PTS definitions for MSM USB controller Ivan T. Ivanov
@ 2014-04-22  9:20 ` Ivan T. Ivanov
       [not found] ` <1398158438-21579-1-git-send-email-iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
  2014-04-22  9:20 ` [PATCH v6 19/19] usb: phy: msm: Use usb_add_phy_dev() to register device Ivan T. Ivanov
  13 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22  9:20 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Ivan T. Ivanov, Greg Kroah-Hartman, linux-usb, linux-kernel,
	linux-arm-msm, Pavankumar Kondeti

From: "Ivan T. Ivanov" <iivanov@mm-sol.com>

Put the transceiver in non-driving mode. Otherwise host
may not detect soft-disconnection.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
Cc: Pavankumar Kondeti <pkondeti@codeaurora.org>
---
 drivers/usb/phy/phy-msm-usb.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 729c06b..a89d966 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -235,6 +235,23 @@ static void ulpi_init(struct msm_otg *motg)
 	}
 }

+static int msm_phy_notify_disconnect(struct usb_phy *phy,
+				   enum usb_device_speed speed)
+{
+	int val;
+
+	/*
+	 * Put the transceiver in non-driving mode. Otherwise host
+	 * may not detect soft-disconnection.
+	 */
+	val = ulpi_read(phy, ULPI_FUNC_CTRL);
+	val &= ~ULPI_FUNC_CTRL_OPMODE_MASK;
+	val |= ULPI_FUNC_CTRL_OPMODE_NONDRIVING;
+	ulpi_write(phy, val, ULPI_FUNC_CTRL);
+
+	return 0;
+}
+
 static int msm_otg_link_clk_reset(struct msm_otg *motg, bool assert)
 {
 	int ret;
@@ -1623,6 +1640,7 @@ static int msm_otg_probe(struct platform_device *pdev)

 	phy->init = msm_phy_init;
 	phy->set_power = msm_otg_set_power;
+	phy->notify_disconnect = msm_phy_notify_disconnect;

 	phy->io_ops = &msm_otg_io_ops;

--
1.8.3.2

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v6 18/19] usb: phy: msm: Vote for corner of VDD CX instead of voltage of VDD CX
  2014-04-22  9:20 [PATCH v6 00/19] usb: phy: msm: Fixes, cleanups and DT support Ivan T. Ivanov
@ 2014-04-22  9:20     ` Ivan T. Ivanov
  2014-04-22  9:20 ` [PATCH v6 02/19] usb: phy: msm: Remove __init macro from driver probe method Ivan T. Ivanov
                       ` (12 subsequent siblings)
  13 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22  9:20 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Randy Dunlap, Felipe Balbi, Grant Likely
  Cc: Ivan T. Ivanov, Greg Kroah-Hartman, David Brown,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Mayank Rana

From: "Ivan T. Ivanov" <iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>

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-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
Cc: Mayank Rana <mrana-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
---
 .../devicetree/bindings/usb/msm-hsusb.txt          |  5 ++++
 drivers/usb/phy/phy-msm-usb.c                      | 35 +++++++++++++++++-----
 include/linux/usb/msm_hsusb.h                      |  1 +
 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 0669667..2826f2a 100644
--- a/Documentation/devicetree/bindings/usb/msm-hsusb.txt
+++ b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
@@ -65,6 +65,10 @@ Optional properties:
                 Some platforms may have configuration to allow USB
                 controller work with any of the two HSPHYs present.

+- qcom,vdd-levels: This property must be a list of three integer values
+                (no, min, max) where each value represents either a voltage
+                in microvolts or a value corresponding to voltage corner.
+
 Example HSUSB OTG controller device node:

     usb@f9a55000 {
@@ -87,4 +91,5 @@ Example HSUSB OTG controller device node:

         qcom,otg-control = <1>;
         qcom,phy-init-sequence = < -1 0x63 >;
+        qcom,vdd-levels = <1 5 7>;
 	};
diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index a89d966..08c9b2b 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -62,6 +62,13 @@

 #define USB_PHY_VDD_DIG_VOL_MIN	1000000 /* uV */
 #define USB_PHY_VDD_DIG_VOL_MAX	1320000 /* uV */
+#define USB_PHY_SUSP_DIG_VOL	500000  /* uV */
+
+enum vdd_levels {
+	VDD_LEVEL_NONE = 0,
+	VDD_LEVEL_MIN,
+	VDD_LEVEL_MAX,
+};

 static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init)
 {
@@ -69,8 +76,8 @@ static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init)

 	if (init) {
 		ret = regulator_set_voltage(motg->vddcx,
-				USB_PHY_VDD_DIG_VOL_MIN,
-				USB_PHY_VDD_DIG_VOL_MAX);
+				motg->vdd_levels[VDD_LEVEL_MIN],
+				motg->vdd_levels[VDD_LEVEL_MAX]);
 		if (ret) {
 			dev_err(motg->phy.dev, "Cannot set vddcx voltage\n");
 			return ret;
@@ -81,7 +88,7 @@ static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init)
 			dev_err(motg->phy.dev, "unable to enable hsusb vddcx\n");
 	} else {
 		ret = regulator_set_voltage(motg->vddcx, 0,
-			USB_PHY_VDD_DIG_VOL_MAX);
+				motg->vdd_levels[VDD_LEVEL_MAX]);
 		if (ret)
 			dev_err(motg->phy.dev, "Cannot set vddcx voltage\n");
 		ret = regulator_disable(motg->vddcx);
@@ -435,17 +442,16 @@ static int msm_phy_init(struct usb_phy *phy)

 #ifdef CONFIG_PM

-#define USB_PHY_SUSP_DIG_VOL  500000
 static int msm_hsusb_config_vddcx(struct msm_otg *motg, int high)
 {
-	int max_vol = USB_PHY_VDD_DIG_VOL_MAX;
+	int max_vol = motg->vdd_levels[VDD_LEVEL_MAX];
 	int min_vol;
 	int ret;

 	if (high)
-		min_vol = USB_PHY_VDD_DIG_VOL_MIN;
+		min_vol = motg->vdd_levels[VDD_LEVEL_MIN];
 	else
-		min_vol = USB_PHY_SUSP_DIG_VOL;
+		min_vol = motg->vdd_levels[VDD_LEVEL_NONE];

 	ret = regulator_set_voltage(motg->vddcx, min_vol, max_vol);
 	if (ret) {
@@ -1438,7 +1444,7 @@ static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg)
 	struct device_node *node = pdev->dev.of_node;
 	struct property *prop;
 	int len, ret;
-	u32 val;
+	u32 val, tmp[3];

 	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
 	if (!pdata)
@@ -1469,6 +1475,19 @@ static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg)
 	if (!of_property_read_u32(node, "qcom,phy-num", &val) && val < 2)
 		motg->phy_number = val;

+	motg->vdd_levels[VDD_LEVEL_NONE] = USB_PHY_SUSP_DIG_VOL;
+	motg->vdd_levels[VDD_LEVEL_MIN] = USB_PHY_VDD_DIG_VOL_MIN;
+	motg->vdd_levels[VDD_LEVEL_MAX] = USB_PHY_VDD_DIG_VOL_MAX;
+
+	if (of_get_property(node, "qcom,vdd-levels", &len) &&
+	    len == sizeof(tmp)) {
+		of_property_read_u32_array(node, "qcom,vdd-levels",
+					   tmp, len / sizeof(*tmp));
+		motg->vdd_levels[VDD_LEVEL_NONE] = tmp[VDD_LEVEL_NONE];
+		motg->vdd_levels[VDD_LEVEL_MIN] = tmp[VDD_LEVEL_MIN];
+		motg->vdd_levels[VDD_LEVEL_MAX] = tmp[VDD_LEVEL_MAX];
+	}
+
 	prop = of_find_property(node, "qcom,phy-init-sequence", &len);
 	if (!prop || !len)
 		return 0;
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 4628f1a..b0a3924 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -169,6 +169,7 @@ struct msm_otg {

 	struct reset_control *phy_rst;
 	struct reset_control *link_rst;
+	int vdd_levels[3];
 };

 #endif
--
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v6 18/19] usb: phy: msm: Vote for corner of VDD CX instead of voltage of VDD CX
@ 2014-04-22  9:20     ` Ivan T. Ivanov
  0 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22  9:20 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Randy Dunlap, Felipe Balbi, Grant Likely
  Cc: Ivan T. Ivanov, Greg Kroah-Hartman, David Brown, devicetree,
	linux-doc, linux-kernel, linux-usb, linux-arm-msm, Mayank Rana

From: "Ivan T. Ivanov" <iivanov@mm-sol.com>

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>
---
 .../devicetree/bindings/usb/msm-hsusb.txt          |  5 ++++
 drivers/usb/phy/phy-msm-usb.c                      | 35 +++++++++++++++++-----
 include/linux/usb/msm_hsusb.h                      |  1 +
 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 0669667..2826f2a 100644
--- a/Documentation/devicetree/bindings/usb/msm-hsusb.txt
+++ b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
@@ -65,6 +65,10 @@ Optional properties:
                 Some platforms may have configuration to allow USB
                 controller work with any of the two HSPHYs present.

+- qcom,vdd-levels: This property must be a list of three integer values
+                (no, min, max) where each value represents either a voltage
+                in microvolts or a value corresponding to voltage corner.
+
 Example HSUSB OTG controller device node:

     usb@f9a55000 {
@@ -87,4 +91,5 @@ Example HSUSB OTG controller device node:

         qcom,otg-control = <1>;
         qcom,phy-init-sequence = < -1 0x63 >;
+        qcom,vdd-levels = <1 5 7>;
 	};
diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index a89d966..08c9b2b 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -62,6 +62,13 @@

 #define USB_PHY_VDD_DIG_VOL_MIN	1000000 /* uV */
 #define USB_PHY_VDD_DIG_VOL_MAX	1320000 /* uV */
+#define USB_PHY_SUSP_DIG_VOL	500000  /* uV */
+
+enum vdd_levels {
+	VDD_LEVEL_NONE = 0,
+	VDD_LEVEL_MIN,
+	VDD_LEVEL_MAX,
+};

 static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init)
 {
@@ -69,8 +76,8 @@ static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init)

 	if (init) {
 		ret = regulator_set_voltage(motg->vddcx,
-				USB_PHY_VDD_DIG_VOL_MIN,
-				USB_PHY_VDD_DIG_VOL_MAX);
+				motg->vdd_levels[VDD_LEVEL_MIN],
+				motg->vdd_levels[VDD_LEVEL_MAX]);
 		if (ret) {
 			dev_err(motg->phy.dev, "Cannot set vddcx voltage\n");
 			return ret;
@@ -81,7 +88,7 @@ static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init)
 			dev_err(motg->phy.dev, "unable to enable hsusb vddcx\n");
 	} else {
 		ret = regulator_set_voltage(motg->vddcx, 0,
-			USB_PHY_VDD_DIG_VOL_MAX);
+				motg->vdd_levels[VDD_LEVEL_MAX]);
 		if (ret)
 			dev_err(motg->phy.dev, "Cannot set vddcx voltage\n");
 		ret = regulator_disable(motg->vddcx);
@@ -435,17 +442,16 @@ static int msm_phy_init(struct usb_phy *phy)

 #ifdef CONFIG_PM

-#define USB_PHY_SUSP_DIG_VOL  500000
 static int msm_hsusb_config_vddcx(struct msm_otg *motg, int high)
 {
-	int max_vol = USB_PHY_VDD_DIG_VOL_MAX;
+	int max_vol = motg->vdd_levels[VDD_LEVEL_MAX];
 	int min_vol;
 	int ret;

 	if (high)
-		min_vol = USB_PHY_VDD_DIG_VOL_MIN;
+		min_vol = motg->vdd_levels[VDD_LEVEL_MIN];
 	else
-		min_vol = USB_PHY_SUSP_DIG_VOL;
+		min_vol = motg->vdd_levels[VDD_LEVEL_NONE];

 	ret = regulator_set_voltage(motg->vddcx, min_vol, max_vol);
 	if (ret) {
@@ -1438,7 +1444,7 @@ static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg)
 	struct device_node *node = pdev->dev.of_node;
 	struct property *prop;
 	int len, ret;
-	u32 val;
+	u32 val, tmp[3];

 	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
 	if (!pdata)
@@ -1469,6 +1475,19 @@ static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg)
 	if (!of_property_read_u32(node, "qcom,phy-num", &val) && val < 2)
 		motg->phy_number = val;

+	motg->vdd_levels[VDD_LEVEL_NONE] = USB_PHY_SUSP_DIG_VOL;
+	motg->vdd_levels[VDD_LEVEL_MIN] = USB_PHY_VDD_DIG_VOL_MIN;
+	motg->vdd_levels[VDD_LEVEL_MAX] = USB_PHY_VDD_DIG_VOL_MAX;
+
+	if (of_get_property(node, "qcom,vdd-levels", &len) &&
+	    len == sizeof(tmp)) {
+		of_property_read_u32_array(node, "qcom,vdd-levels",
+					   tmp, len / sizeof(*tmp));
+		motg->vdd_levels[VDD_LEVEL_NONE] = tmp[VDD_LEVEL_NONE];
+		motg->vdd_levels[VDD_LEVEL_MIN] = tmp[VDD_LEVEL_MIN];
+		motg->vdd_levels[VDD_LEVEL_MAX] = tmp[VDD_LEVEL_MAX];
+	}
+
 	prop = of_find_property(node, "qcom,phy-init-sequence", &len);
 	if (!prop || !len)
 		return 0;
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 4628f1a..b0a3924 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -169,6 +169,7 @@ struct msm_otg {

 	struct reset_control *phy_rst;
 	struct reset_control *link_rst;
+	int vdd_levels[3];
 };

 #endif
--
1.8.3.2


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v6 19/19] usb: phy: msm: Use usb_add_phy_dev() to register device
  2014-04-22  9:20 [PATCH v6 00/19] usb: phy: msm: Fixes, cleanups and DT support Ivan T. Ivanov
                   ` (12 preceding siblings ...)
       [not found] ` <1398158438-21579-1-git-send-email-iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
@ 2014-04-22  9:20 ` Ivan T. Ivanov
  13 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22  9:20 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Ivan T. Ivanov, Greg Kroah-Hartman, linux-usb, linux-kernel,
	linux-arm-msm

From: "Ivan T. Ivanov" <iivanov@mm-sol.com>

They could be more than one USB2.0 PHY's on the platform.
This will allow all of them to be registred successfuly.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
---
 drivers/usb/phy/phy-msm-usb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 08c9b2b..1029ae0 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -1660,6 +1660,7 @@ static int msm_otg_probe(struct platform_device *pdev)
 	phy->init = msm_phy_init;
 	phy->set_power = msm_otg_set_power;
 	phy->notify_disconnect = msm_phy_notify_disconnect;
+	phy->type = USB_PHY_TYPE_USB2;

 	phy->io_ops = &msm_otg_io_ops;

@@ -1669,7 +1670,7 @@ static int msm_otg_probe(struct platform_device *pdev)

 	msm_usb_reset(phy);

-	ret = usb_add_phy(&motg->phy, USB_PHY_TYPE_USB2);
+	ret = usb_add_phy_dev(&motg->phy);
 	if (ret) {
 		dev_err(&pdev->dev, "usb_add_phy failed\n");
 		goto disable_ldo;
--
1.8.3.2

^ permalink raw reply related	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 15/19] usb: phy: msm: Fix PTS definitions for MSM USB controller
  2014-04-22  9:20 ` [PATCH v6 15/19] usb: phy: msm: Fix PTS definitions for MSM USB controller Ivan T. Ivanov
@ 2014-04-22 13:09       ` Sergei Shtylyov
  0 siblings, 0 replies; 60+ messages in thread
From: Sergei Shtylyov @ 2014-04-22 13:09 UTC (permalink / raw)
  To: Ivan T. Ivanov, Felipe Balbi
  Cc: Tim Bird, Greg Kroah-Hartman, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Tim Bird

Hello.

On 22-04-2014 13:20, Ivan T. Ivanov wrote:

> From: Tim Bird <tbird20d-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

> Fix the value used for Parallel Transceiver Select (PTS) for the MSM USB
> controller.  This is a standard chipidea PORTSC definition, where
> a PHY_TYPE of 10b (<<30) is ULPI and 11b (<<30) is SERIAL.
> Fix the definitions and use them correctly in the driver code.

> Signed-off-by: Tim Bird <tim.bird-/MT0OVThwyLZJqsBc5GL+g@public.gmane.org>
> ---
>   drivers/usb/phy/phy-msm-usb.c    | 8 +++++---
>   include/linux/usb/msm_hsusb_hw.h | 5 +++--
>   2 files changed, 8 insertions(+), 5 deletions(-)

> diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
> index dababf9..e83d13a 100644
> --- a/drivers/usb/phy/phy-msm-usb.c
> +++ b/drivers/usb/phy/phy-msm-usb.c
> @@ -287,8 +287,9 @@ static int msm_link_reset(struct msm_otg *motg)
>   	if (motg->phy_number)
>   		writel(readl(USB_PHY_CTRL2) | BIT(16), USB_PHY_CTRL2);
>
> +	/* put transciever in serial mode as part of reset */

    s/transciever/transceiver/

[...]

> diff --git a/include/linux/usb/msm_hsusb_hw.h b/include/linux/usb/msm_hsusb_hw.h
> index 575c743..98d3dd8 100644
> --- a/include/linux/usb/msm_hsusb_hw.h
> +++ b/include/linux/usb/msm_hsusb_hw.h
> @@ -31,8 +31,9 @@
>   #define USB_USBINTR          (MSM_USB_BASE + 0x0148)
>
>   #define PORTSC_PHCD            (1 << 23) /* phy suspend mode */
> -#define PORTSC_PTS_MASK         (3 << 30)
> -#define PORTSC_PTS_ULPI         (3 << 30)
> +#define PORTSC_PTS_MASK        (3 << 30)
> +#define PORTSC_PTS_ULPI        (2 << 30)
> +#define PORTSC_PTS_SERIAL      (3 << 30)

    Please use tabs, not spaces here.

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 15/19] usb: phy: msm: Fix PTS definitions for MSM USB controller
@ 2014-04-22 13:09       ` Sergei Shtylyov
  0 siblings, 0 replies; 60+ messages in thread
From: Sergei Shtylyov @ 2014-04-22 13:09 UTC (permalink / raw)
  To: Ivan T. Ivanov, Felipe Balbi
  Cc: Tim Bird, Greg Kroah-Hartman, linux-usb, linux-kernel,
	linux-arm-msm, Tim Bird

Hello.

On 22-04-2014 13:20, Ivan T. Ivanov wrote:

> From: Tim Bird <tbird20d@gmail.com>

> Fix the value used for Parallel Transceiver Select (PTS) for the MSM USB
> controller.  This is a standard chipidea PORTSC definition, where
> a PHY_TYPE of 10b (<<30) is ULPI and 11b (<<30) is SERIAL.
> Fix the definitions and use them correctly in the driver code.

> Signed-off-by: Tim Bird <tim.bird@sonymobile.com>
> ---
>   drivers/usb/phy/phy-msm-usb.c    | 8 +++++---
>   include/linux/usb/msm_hsusb_hw.h | 5 +++--
>   2 files changed, 8 insertions(+), 5 deletions(-)

> diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
> index dababf9..e83d13a 100644
> --- a/drivers/usb/phy/phy-msm-usb.c
> +++ b/drivers/usb/phy/phy-msm-usb.c
> @@ -287,8 +287,9 @@ static int msm_link_reset(struct msm_otg *motg)
>   	if (motg->phy_number)
>   		writel(readl(USB_PHY_CTRL2) | BIT(16), USB_PHY_CTRL2);
>
> +	/* put transciever in serial mode as part of reset */

    s/transciever/transceiver/

[...]

> diff --git a/include/linux/usb/msm_hsusb_hw.h b/include/linux/usb/msm_hsusb_hw.h
> index 575c743..98d3dd8 100644
> --- a/include/linux/usb/msm_hsusb_hw.h
> +++ b/include/linux/usb/msm_hsusb_hw.h
> @@ -31,8 +31,9 @@
>   #define USB_USBINTR          (MSM_USB_BASE + 0x0148)
>
>   #define PORTSC_PHCD            (1 << 23) /* phy suspend mode */
> -#define PORTSC_PTS_MASK         (3 << 30)
> -#define PORTSC_PTS_ULPI         (3 << 30)
> +#define PORTSC_PTS_MASK        (3 << 30)
> +#define PORTSC_PTS_ULPI        (2 << 30)
> +#define PORTSC_PTS_SERIAL      (3 << 30)

    Please use tabs, not spaces here.

WBR, Sergei


^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 01/19] usb: phy: msm: Make driver selectable on ARCH_QCOM
  2014-04-22  9:20 ` [PATCH v6 01/19] usb: phy: msm: Make driver selectable on ARCH_QCOM Ivan T. Ivanov
@ 2014-04-22 14:57       ` Felipe Balbi
  0 siblings, 0 replies; 60+ messages in thread
From: Felipe Balbi @ 2014-04-22 14:57 UTC (permalink / raw)
  To: Ivan T. Ivanov
  Cc: Felipe Balbi, Greg Kroah-Hartman,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 1203 bytes --]

On Tue, Apr 22, 2014 at 12:20:20PM +0300, Ivan T. Ivanov wrote:
> From: "Ivan T. Ivanov" <iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
> 
> Controller could be found on APQ and MSM platforms,
> make configuration description more generic.
> 
> Signed-off-by: Ivan T. Ivanov <iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
> ---
>  drivers/usb/phy/Kconfig | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
> index 416e0c8..0c668a3 100644
> --- a/drivers/usb/phy/Kconfig
> +++ b/drivers/usb/phy/Kconfig
> @@ -171,11 +171,11 @@ config USB_ISP1301
>  	  module will be called phy-isp1301.
> 
>  config USB_MSM_OTG
> -	tristate "OTG support for Qualcomm on-chip USB controller"
> -	depends on (USB || USB_GADGET) && ARCH_MSM
> +	tristate "Qualcomm on-chip USB OTG controller support"
> +	depends on (USB || USB_GADGET) && (ARCH_MSM || ARCH_QCOM)

I would actually drop USB || USB_GADGET dependency here just make it
easier to enable the driver on Kconfig, other you have to enable
USB_SUPPORT, then enable USB, go back one menu level, go down to PHY
menu, and choose this driver.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 01/19] usb: phy: msm: Make driver selectable on ARCH_QCOM
@ 2014-04-22 14:57       ` Felipe Balbi
  0 siblings, 0 replies; 60+ messages in thread
From: Felipe Balbi @ 2014-04-22 14:57 UTC (permalink / raw)
  To: Ivan T. Ivanov
  Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-arm-msm

[-- Attachment #1: Type: text/plain, Size: 1145 bytes --]

On Tue, Apr 22, 2014 at 12:20:20PM +0300, Ivan T. Ivanov wrote:
> From: "Ivan T. Ivanov" <iivanov@mm-sol.com>
> 
> Controller could be found on APQ and MSM platforms,
> make configuration description more generic.
> 
> Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
> ---
>  drivers/usb/phy/Kconfig | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
> index 416e0c8..0c668a3 100644
> --- a/drivers/usb/phy/Kconfig
> +++ b/drivers/usb/phy/Kconfig
> @@ -171,11 +171,11 @@ config USB_ISP1301
>  	  module will be called phy-isp1301.
> 
>  config USB_MSM_OTG
> -	tristate "OTG support for Qualcomm on-chip USB controller"
> -	depends on (USB || USB_GADGET) && ARCH_MSM
> +	tristate "Qualcomm on-chip USB OTG controller support"
> +	depends on (USB || USB_GADGET) && (ARCH_MSM || ARCH_QCOM)

I would actually drop USB || USB_GADGET dependency here just make it
easier to enable the driver on Kconfig, other you have to enable
USB_SUPPORT, then enable USB, go back one menu level, go down to PHY
menu, and choose this driver.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 03/19] usb: phy: msm: Move global regulators variables to driver state
  2014-04-22  9:20     ` Ivan T. Ivanov
@ 2014-04-22 14:57       ` Felipe Balbi
  -1 siblings, 0 replies; 60+ messages in thread
From: Felipe Balbi @ 2014-04-22 14:57 UTC (permalink / raw)
  To: Ivan T. Ivanov
  Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-arm-msm

[-- Attachment #1: Type: text/plain, Size: 174 bytes --]

On Tue, Apr 22, 2014 at 12:20:22PM +0300, Ivan T. Ivanov wrote:
> From: "Ivan T. Ivanov" <iivanov@mm-sol.com>

#define ENOLOG		ENOCOMMIT

return -ENOLOG;

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 03/19] usb: phy: msm: Move global regulators variables to driver state
@ 2014-04-22 14:57       ` Felipe Balbi
  0 siblings, 0 replies; 60+ messages in thread
From: Felipe Balbi @ 2014-04-22 14:57 UTC (permalink / raw)
  To: Ivan T. Ivanov
  Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-arm-msm

[-- Attachment #1: Type: text/plain, Size: 174 bytes --]

On Tue, Apr 22, 2014 at 12:20:22PM +0300, Ivan T. Ivanov wrote:
> From: "Ivan T. Ivanov" <iivanov@mm-sol.com>

#define ENOLOG		ENOCOMMIT

return -ENOLOG;

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 04/19] usb: phy: msm: Migrate to Managed Device Resource allocation
  2014-04-22  9:20     ` Ivan T. Ivanov
@ 2014-04-22 15:07         ` Srinivas Kandagatla
  -1 siblings, 0 replies; 60+ messages in thread
From: Srinivas Kandagatla @ 2014-04-22 15:07 UTC (permalink / raw)
  To: Ivan T. Ivanov, Felipe Balbi
  Cc: Greg Kroah-Hartman, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA



On 22/04/14 10:20, Ivan T. Ivanov wrote:
> From: "Ivan T. Ivanov" <iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
>
> Move memory, regulators, clocks and irq allocation to
> devm_* variants. Properly check for valid clk handles.
>
>
> -module_platform_driver_probe(msm_otg_driver, msm_otg_probe);
> +module_platform_driver(msm_otg_driver);

This change doesn’t match the log.

>
>   MODULE_LICENSE("GPL v2");
>   MODULE_DESCRIPTION("MSM USB transceiver driver");
> --
> 1.8.3.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 04/19] usb: phy: msm: Migrate to Managed Device Resource allocation
@ 2014-04-22 15:07         ` Srinivas Kandagatla
  0 siblings, 0 replies; 60+ messages in thread
From: Srinivas Kandagatla @ 2014-04-22 15:07 UTC (permalink / raw)
  To: Ivan T. Ivanov, Felipe Balbi
  Cc: Greg Kroah-Hartman, linux-usb, linux-kernel, linux-arm-msm



On 22/04/14 10:20, Ivan T. Ivanov wrote:
> From: "Ivan T. Ivanov" <iivanov@mm-sol.com>
>
> Move memory, regulators, clocks and irq allocation to
> devm_* variants. Properly check for valid clk handles.
>
>
> -module_platform_driver_probe(msm_otg_driver, msm_otg_probe);
> +module_platform_driver(msm_otg_driver);

This change doesn’t match the log.

>
>   MODULE_LICENSE("GPL v2");
>   MODULE_DESCRIPTION("MSM USB transceiver driver");
> --
> 1.8.3.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 03/19] usb: phy: msm: Move global regulators variables to driver state
  2014-04-22 14:57       ` Felipe Balbi
@ 2014-04-22 15:12           ` Ivan T. Ivanov
  -1 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22 15:12 UTC (permalink / raw)
  To: balbi-l0cyMroinI0
  Cc: Greg Kroah-Hartman, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA

On Tue, 2014-04-22 at 09:57 -0500, Felipe Balbi wrote:
> On Tue, Apr 22, 2014 at 12:20:22PM +0300, Ivan T. Ivanov wrote:
> > From: "Ivan T. Ivanov" <iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
> 
> #define ENOLOG		ENOCOMMIT
> 
> return -ENOLOG;
> 

#if SIMPLE_CHANGE
#define ENOLOG		0
#endif

Will fix it :-)

Ivan

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 03/19] usb: phy: msm: Move global regulators variables to driver state
@ 2014-04-22 15:12           ` Ivan T. Ivanov
  0 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22 15:12 UTC (permalink / raw)
  To: balbi; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel, linux-arm-msm

On Tue, 2014-04-22 at 09:57 -0500, Felipe Balbi wrote:
> On Tue, Apr 22, 2014 at 12:20:22PM +0300, Ivan T. Ivanov wrote:
> > From: "Ivan T. Ivanov" <iivanov@mm-sol.com>
> 
> #define ENOLOG		ENOCOMMIT
> 
> return -ENOLOG;
> 

#if SIMPLE_CHANGE
#define ENOLOG		0
#endif

Will fix it :-)

Ivan


^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 03/19] usb: phy: msm: Move global regulators variables to driver state
  2014-04-22 15:12           ` Ivan T. Ivanov
@ 2014-04-22 15:14             ` Felipe Balbi
  -1 siblings, 0 replies; 60+ messages in thread
From: Felipe Balbi @ 2014-04-22 15:14 UTC (permalink / raw)
  To: Ivan T. Ivanov
  Cc: balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-arm-msm

[-- Attachment #1: Type: text/plain, Size: 501 bytes --]

On Tue, Apr 22, 2014 at 06:12:19PM +0300, Ivan T. Ivanov wrote:
> On Tue, 2014-04-22 at 09:57 -0500, Felipe Balbi wrote:
> > On Tue, Apr 22, 2014 at 12:20:22PM +0300, Ivan T. Ivanov wrote:
> > > From: "Ivan T. Ivanov" <iivanov@mm-sol.com>
> > 
> > #define ENOLOG		ENOCOMMIT
> > 
> > return -ENOLOG;
> > 
> 
> #if SIMPLE_CHANGE
> #define ENOLOG		0
> #endif
> 
> Will fix it :-)

#undef ENOLOG
#define THAT_DOESNT_REALLY_WORK_FOR_ME

hehehe :-) Thanks for updating ;-)

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 03/19] usb: phy: msm: Move global regulators variables to driver state
@ 2014-04-22 15:14             ` Felipe Balbi
  0 siblings, 0 replies; 60+ messages in thread
From: Felipe Balbi @ 2014-04-22 15:14 UTC (permalink / raw)
  To: Ivan T. Ivanov
  Cc: balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-arm-msm

[-- Attachment #1: Type: text/plain, Size: 501 bytes --]

On Tue, Apr 22, 2014 at 06:12:19PM +0300, Ivan T. Ivanov wrote:
> On Tue, 2014-04-22 at 09:57 -0500, Felipe Balbi wrote:
> > On Tue, Apr 22, 2014 at 12:20:22PM +0300, Ivan T. Ivanov wrote:
> > > From: "Ivan T. Ivanov" <iivanov@mm-sol.com>
> > 
> > #define ENOLOG		ENOCOMMIT
> > 
> > return -ENOLOG;
> > 
> 
> #if SIMPLE_CHANGE
> #define ENOLOG		0
> #endif
> 
> Will fix it :-)

#undef ENOLOG
#define THAT_DOESNT_REALLY_WORK_FOR_ME

hehehe :-) Thanks for updating ;-)

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 01/19] usb: phy: msm: Make driver selectable on ARCH_QCOM
  2014-04-22 14:57       ` Felipe Balbi
  (?)
@ 2014-04-22 15:16       ` Ivan T. Ivanov
  2014-04-22 15:24           ` Felipe Balbi
  -1 siblings, 1 reply; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22 15:16 UTC (permalink / raw)
  To: balbi; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel, linux-arm-msm


Hi, 

On Tue, 2014-04-22 at 09:57 -0500, Felipe Balbi wrote:
> On Tue, Apr 22, 2014 at 12:20:20PM +0300, Ivan T. Ivanov wrote:
> > From: "Ivan T. Ivanov" <iivanov@mm-sol.com>
> > 
> > Controller could be found on APQ and MSM platforms,
> > make configuration description more generic.
> > 
> > Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
> > ---
> >  drivers/usb/phy/Kconfig | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
> > index 416e0c8..0c668a3 100644
> > --- a/drivers/usb/phy/Kconfig
> > +++ b/drivers/usb/phy/Kconfig
> > @@ -171,11 +171,11 @@ config USB_ISP1301
> >  	  module will be called phy-isp1301.
> > 
> >  config USB_MSM_OTG
> > -	tristate "OTG support for Qualcomm on-chip USB controller"
> > -	depends on (USB || USB_GADGET) && ARCH_MSM
> > +	tristate "Qualcomm on-chip USB OTG controller support"
> > +	depends on (USB || USB_GADGET) && (ARCH_MSM || ARCH_QCOM)
> 
> I would actually drop USB || USB_GADGET dependency here just make it
> easier to enable the driver on Kconfig, other you have to enable
> USB_SUPPORT, then enable USB, go back one menu level, go down to PHY
> menu, and choose this driver.
> 

Because phy directory already depends on USB_SUPPORT?

Regards,
Ivan

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 04/19] usb: phy: msm: Migrate to Managed Device Resource allocation
  2014-04-22 15:07         ` Srinivas Kandagatla
  (?)
@ 2014-04-22 15:19         ` Ivan T. Ivanov
  -1 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-22 15:19 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-arm-msm

On Tue, 2014-04-22 at 16:07 +0100, Srinivas Kandagatla wrote:
> 
> On 22/04/14 10:20, Ivan T. Ivanov wrote:
> > From: "Ivan T. Ivanov" <iivanov@mm-sol.com>
> >
> > Move memory, regulators, clocks and irq allocation to
> > devm_* variants. Properly check for valid clk handles.
> >
> >
> > -module_platform_driver_probe(msm_otg_driver, msm_otg_probe);
> > +module_platform_driver(msm_otg_driver);
> 
> This change doesn’t match the log.

Right, I have erroneously assumed that devm_ functions are those 
which returns EPROBE_DEFER.

Will make it separate change.

Thanks,
Ivan

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 01/19] usb: phy: msm: Make driver selectable on ARCH_QCOM
  2014-04-22 15:16       ` Ivan T. Ivanov
@ 2014-04-22 15:24           ` Felipe Balbi
  0 siblings, 0 replies; 60+ messages in thread
From: Felipe Balbi @ 2014-04-22 15:24 UTC (permalink / raw)
  To: Ivan T. Ivanov
  Cc: balbi-l0cyMroinI0, Greg Kroah-Hartman,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 1530 bytes --]

On Tue, Apr 22, 2014 at 06:16:35PM +0300, Ivan T. Ivanov wrote:
> 
> Hi, 
> 
> On Tue, 2014-04-22 at 09:57 -0500, Felipe Balbi wrote:
> > On Tue, Apr 22, 2014 at 12:20:20PM +0300, Ivan T. Ivanov wrote:
> > > From: "Ivan T. Ivanov" <iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
> > > 
> > > Controller could be found on APQ and MSM platforms,
> > > make configuration description more generic.
> > > 
> > > Signed-off-by: Ivan T. Ivanov <iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
> > > ---
> > >  drivers/usb/phy/Kconfig | 6 +++---
> > >  1 file changed, 3 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
> > > index 416e0c8..0c668a3 100644
> > > --- a/drivers/usb/phy/Kconfig
> > > +++ b/drivers/usb/phy/Kconfig
> > > @@ -171,11 +171,11 @@ config USB_ISP1301
> > >  	  module will be called phy-isp1301.
> > > 
> > >  config USB_MSM_OTG
> > > -	tristate "OTG support for Qualcomm on-chip USB controller"
> > > -	depends on (USB || USB_GADGET) && ARCH_MSM
> > > +	tristate "Qualcomm on-chip USB OTG controller support"
> > > +	depends on (USB || USB_GADGET) && (ARCH_MSM || ARCH_QCOM)
> > 
> > I would actually drop USB || USB_GADGET dependency here just make it
> > easier to enable the driver on Kconfig, other you have to enable
> > USB_SUPPORT, then enable USB, go back one menu level, go down to PHY
> > menu, and choose this driver.
> > 
> 
> Because phy directory already depends on USB_SUPPORT?

right

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 01/19] usb: phy: msm: Make driver selectable on ARCH_QCOM
@ 2014-04-22 15:24           ` Felipe Balbi
  0 siblings, 0 replies; 60+ messages in thread
From: Felipe Balbi @ 2014-04-22 15:24 UTC (permalink / raw)
  To: Ivan T. Ivanov
  Cc: balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-arm-msm

[-- Attachment #1: Type: text/plain, Size: 1472 bytes --]

On Tue, Apr 22, 2014 at 06:16:35PM +0300, Ivan T. Ivanov wrote:
> 
> Hi, 
> 
> On Tue, 2014-04-22 at 09:57 -0500, Felipe Balbi wrote:
> > On Tue, Apr 22, 2014 at 12:20:20PM +0300, Ivan T. Ivanov wrote:
> > > From: "Ivan T. Ivanov" <iivanov@mm-sol.com>
> > > 
> > > Controller could be found on APQ and MSM platforms,
> > > make configuration description more generic.
> > > 
> > > Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
> > > ---
> > >  drivers/usb/phy/Kconfig | 6 +++---
> > >  1 file changed, 3 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
> > > index 416e0c8..0c668a3 100644
> > > --- a/drivers/usb/phy/Kconfig
> > > +++ b/drivers/usb/phy/Kconfig
> > > @@ -171,11 +171,11 @@ config USB_ISP1301
> > >  	  module will be called phy-isp1301.
> > > 
> > >  config USB_MSM_OTG
> > > -	tristate "OTG support for Qualcomm on-chip USB controller"
> > > -	depends on (USB || USB_GADGET) && ARCH_MSM
> > > +	tristate "Qualcomm on-chip USB OTG controller support"
> > > +	depends on (USB || USB_GADGET) && (ARCH_MSM || ARCH_QCOM)
> > 
> > I would actually drop USB || USB_GADGET dependency here just make it
> > easier to enable the driver on Kconfig, other you have to enable
> > USB_SUPPORT, then enable USB, go back one menu level, go down to PHY
> > menu, and choose this driver.
> > 
> 
> Because phy directory already depends on USB_SUPPORT?

right

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 06/19] usb: phy: msm: Fix checkpatch.pl warnings
  2014-04-22  9:20 ` [PATCH v6 06/19] usb: phy: msm: Fix checkpatch.pl warnings Ivan T. Ivanov
@ 2014-04-22 15:30   ` Srinivas Kandagatla
  2014-04-23  6:51     ` Ivan T. Ivanov
  0 siblings, 1 reply; 60+ messages in thread
From: Srinivas Kandagatla @ 2014-04-22 15:30 UTC (permalink / raw)
  To: Ivan T. Ivanov, Felipe Balbi
  Cc: Greg Kroah-Hartman, linux-usb, linux-kernel, linux-arm-msm



On 22/04/14 10:20, Ivan T. Ivanov wrote:
> @@ -79,8 +78,7 @@ static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init)
>   		ret = regulator_set_voltage(motg->vddcx, 0,
>   			USB_PHY_VDD_DIG_VOL_MAX);
>   		if (ret)
> -			dev_err(motg->phy.dev, "unable to set the voltage "
> -					"for hsusb vddcx\n");
> +			dev_err(motg->phy.dev, "Cannot set vddcx voltage\n");


> @@ -137,15 +133,13 @@ static int msm_hsusb_ldo_set_mode(struct msm_otg *motg, int on)
>   		ret = regulator_set_optimum_mode(motg->v1p8,
>   				USB_PHY_1P8_HPM_LOAD);
>   		if (ret < 0) {
> -			pr_err("%s: Unable to set HPM of the regulator "
> -				"HSUSB_1p8\n", __func__);
> +			pr_err("Could not set HPM for v1p8\n");
>   			return ret;
>   		}


> @@ -390,8 +382,7 @@ static int msm_hsusb_config_vddcx(struct msm_otg *motg, int high)
>
>   	ret = regulator_set_voltage(motg->vddcx, min_vol, max_vol);
>   	if (ret) {
> -		pr_err("%s: unable to set the voltage for regulator "
> -			"HSUSB_VDDCX\n", __func__);
> +		dev_err(motg->phy.dev, "Cannot set vddcx voltage\n");
>   		return ret;
>   	}
>


I see some of pr_err not moved to dev_err?, while others have been moved.

Also noticed that the error messages are changed as part of this fix. 
IMHO, changing an error message would have a side-effects on logging 
tools, anyway Am not sure if its true in this case.


Thanks,
srini

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 11/19] usb: phy: msm: Add device tree support and binding information
  2014-04-22  9:20 ` [PATCH v6 11/19] usb: phy: msm: Add device tree support and binding information Ivan T. Ivanov
@ 2014-04-22 16:05       ` Srinivas Kandagatla
  0 siblings, 0 replies; 60+ messages in thread
From: Srinivas Kandagatla @ 2014-04-22 16:05 UTC (permalink / raw)
  To: Ivan T. Ivanov, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Randy Dunlap, Felipe Balbi,
	Grant Likely
  Cc: Greg Kroah-Hartman, David Brown,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA

Hi Ivan,

On 22/04/14 10:20, Ivan T. Ivanov wrote:
> From: "Ivan T. Ivanov"<iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
>
> Allows MSM OTG controller to be specified via device tree.
>
> Signed-off-by: Ivan T. Ivanov<iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
> ---
>   .../devicetree/bindings/usb/msm-hsusb.txt          |  67 +++++++++++++
>   drivers/usb/phy/phy-msm-usb.c                      | 108 +++++++++++++++++----
>   include/linux/usb/msm_hsusb.h                      |   6 +-
>   3 files changed, 159 insertions(+), 22 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/usb/msm-hsusb.txt b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
> index 5ea26c6..ee4123d 100644
> --- a/Documentation/devicetree/bindings/usb/msm-hsusb.txt
> +++ b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
> @@ -15,3 +15,70 @@ Example EHCI controller device node:
>   		usb-phy = <&usb_otg>;
>   	};
>
> +USB PHY with optional OTG:
> +
> +Required properties:
> +- compatible:   Should contain:
> +  "qcom,usb-otg-ci" for chipsets with ChipIdea 45nm PHY
> +  "qcom,usb-otg-snps" for chipsets with Synopsys 28nm PHY
> +
> +- regs:         Offset and length of the register set in the memory map
> +- interrupts:   interrupt-specifier for the OTG interrupt.
> +
> +- clocks:       A list of phandle + clock-specifier pairs for the
> +                clocks listed in clock-names
> +- clock-names:  Should contain the following:
> +  "phy"         USB PHY reference clock
> +  "core"        Protocol engine clock
> +  "iface"       Interface bus clock
> +  "alt_core"    Protocol engine clock for targets with asynchronous
> +                reset methodology. (optional)
> +
> +- vdccx-supply: phandle to the regulator for the vdd supply for
> +                digital circuit operation.
> +- v1p8-supply:  phandle to the regulator for the 1.8V supply
> +- v3p3-supply:  phandle to the regulator for the 3.3V supply
> +
> +- resets:       A list of phandle + reset-specifier pairs for the
> +                resets listed in reset-names
> +- reset-names:  Should contain the following:
> +  "phy"         USB PHY controller reset
> +  "link"        USB LINK controller reset
> +
> +- qcom,otg-control: OTG control (VBUS and ID notifications) can be one of
> +                1 - PHY control
> +                2 - PMIC control
> +
> +Optional properties:
> +- dr_mode:      One of "host", "peripheral" or "otg". Defaults to "otg"
> +
> +- qcom,phy-init-sequence: PHY configuration sequence values. This is related to Device
> +                Mode Eye Diagram test. Start address at which these values will be
> +                written is ULPI_EXT_VENDOR_SPECIFIC. Value of -1 is reserved as
> +                "do not overwrite default value at this address".
> +                For example: qcom,phy-init-sequence = < -1 0x63 >;
> +                Will update only value at address ULPI_EXT_VENDOR_SPECIFIC + 1.

I don’t think DT maintainers will like the sound of it.
Sorry If I missed some old discussion on this.
But I don't this this is the correct way.

DT should describe the system hardware layout rather than initialization 
sequence.

The initialization code with magic values should go directly into the 
driver and depending on the dt-compatible driver should select the right 
sequence.

/phy-msm-usb.c
> +++ b/drivers/usb/phy/phy-msm-usb.c
> @@ -30,9 +30,12 @@
>   #include <linux/debugfs.h>
>   #include <linux/seq_file.h>
>   #include <linux/pm_runtime.h>
> +#include <linux/of.h>
> +#include <linux/of_device.h>
>
>   #include <linux/usb.h>
>   #include <linux/usb/otg.h>
> +#include <linux/usb/of.h>
>   #include <linux/usb/ulpi.h>
>   #include <linux/usb/gadget.h>
>   #include <linux/usb/hcd.h>
> @@ -217,16 +220,16 @@ static struct usb_phy_io_ops msm_otg_io_ops = {
>   static void ulpi_init(struct msm_otg *motg)
>   {
>   	struct msm_otg_platform_data *pdata = motg->pdata;
> -	int *seq = pdata->phy_init_seq;
> +	int *seq = pdata->phy_init_seq, idx;
> +	u32 addr = ULPI_EXT_VENDOR_SPECIFIC;
>
> -	if (!seq)
> -		return;
> +	for (idx = 0; idx < pdata->phy_init_sz; idx++) {
> +		if (seq[idx] == -1)
> +			continue;
>
> -	while (seq[0] >= 0) {
>   		dev_vdbg(motg->phy.dev, "ulpi: write 0x%02x to 0x%02x\n",
> -				seq[0], seq[1]);
> -		ulpi_write(&motg->phy, seq[0], seq[1]);
> -		seq += 2;
> +				seq[idx], addr + idx);
> +		ulpi_write(&motg->phy, seq[idx], addr + idx);
>   	}
>   }

How is above change related to device trees?
>
> @@ -1343,25 +1346,87 @@ static void msm_otg_debugfs_cleanup(void)
>   	debugfs_remove(msm_otg_dbg_root);
>   }
>
> +static struct of_device_id msm_otg_dt_match[] = {
> +	{
> +		.compatible = "qcom,usb-otg-ci",
> +		.data = (void *) CI_45NM_INTEGRATED_PHY
> +	}, {
> +		.compatible = "qcom,usb-otg-snps",
> +		.data = (void *) SNPS_28NM_INTEGRATED_PHY
> +	}, {}
> +};
> +
> +static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg)
> +{
> +	struct msm_otg_platform_data *pdata;
> +	const struct of_device_id *id;
> +	struct device_node *node = pdev->dev.of_node;
> +	struct property *prop;
> +	int len, ret;
> +	u32 val;
> +
> +	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
> +	if (!pdata)
> +		return -ENOMEM;
> +
> +	motg->pdata = pdata;
> +
> +	id = of_match_device(msm_otg_dt_match, &pdev->dev);
> +	pdata->phy_type = (int) id->data;
> +
> +	pdata->mode = of_usb_get_dr_mode(node);
> +	if (pdata->mode == USB_DR_MODE_UNKNOWN)
> +		pdata->mode = USB_DR_MODE_OTG;
> +
> +	pdata->otg_control = OTG_PHY_CONTROL;
> +	if (!of_property_read_u32(node, "qcom,otg-control", &val))
> +		if (val == OTG_PMIC_CONTROL)
> +			pdata->otg_control = val;
> +
> +	prop = of_find_property(node, "qcom,phy-init-sequence", &len);
> +	if (!prop || !len)
> +		return 0;
> +
> +	pdata->phy_init_seq = devm_kzalloc(&pdev->dev, len, GFP_KERNEL);
> +	if (!pdata->phy_init_seq)
> +		return 0;
return -ENOMEM;
> +
> +	len /= sizeof(u32);
> +
> +	if (len >= ULPI_EXT_VENDOR_SPECIFIC) {
> +		dev_warn(&pdev->dev, "Too big PHY init sequence %d\n", len);
> +		return 0;
> +	}
> +
> +	ret = of_property_read_u32_array(node, "qcom,phy-init-sequence",
> +					 pdata->phy_init_seq, len);
> +	if (!ret)
> +		pdata->phy_init_sz = len;

empty line before return would be nice.
> +	return 0;
> +}
> +
>   static int msm_otg_probe(struct platform_device *pdev)
>   {
>   	int ret = 0;
> +	struct device_node *np = pdev->dev.of_node;
> +	struct msm_otg_platform_data *pdata;
>   	struct resource *res;
>   	struct msm_otg *motg;
>   	struct usb_phy *phy;
>
> -	dev_info(&pdev->dev, "msm_otg probe\n");
> -	if (!dev_get_platdata(&pdev->dev)) {
> -		dev_err(&pdev->dev, "No platform data given. Bailing out\n");
> -		return -ENODEV;
> -	}
> -
>   	motg = devm_kzalloc(&pdev->dev, sizeof(struct msm_otg), GFP_KERNEL);
>   	if (!motg) {
>   		dev_err(&pdev->dev, "unable to allocate msm_otg\n");
>   		return -ENOMEM;
>   	}
>
> +	pdata = dev_get_platdata(&pdev->dev);
> +	if (!pdata) {
shouldn’t this be
if (np) {
> +		ret = msm_otg_read_dt(pdev, motg);
> +		if (ret)
> +			return ret;
> +	}
> +
>   	motg->phy.otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg),
>   				     GFP_KERNEL);
>   	if (!motg->phy.otg) {
> @@ -1369,17 +1434,17 @@ static int msm_otg_probe(struct platform_device *pdev)
>   		return -ENOMEM;
>   	}
>
> -	motg->pdata = dev_get_platdata(&pdev->dev);
>   	phy = &motg->phy;
>   	phy->dev = &pdev->dev;
>
> -	motg->phy_reset_clk = devm_clk_get(&pdev->dev, "usb_phy_clk");
> +	motg->phy_reset_clk = devm_clk_get(&pdev->dev,
> +					   np ? "phy" : "usb_phy_clk");
Not sure why should it be different in dt and non-dt.
>   	if (IS_ERR(motg->phy_reset_clk)) {
>   		dev_err(&pdev->dev, "failed to get usb_phy_clk\n");
>   		return PTR_ERR(motg->phy_reset_clk);
>   	}
>
> -	motg->clk = devm_clk_get(&pdev->dev, "usb_hs_clk");
> +	motg->clk = devm_clk_get(&pdev->dev, np ? "core" : "usb_hs_clk");

Not sure why should it be different in dt and non-dt.
>   	if (IS_ERR(motg->clk)) {
>   		dev_err(&pdev->dev, "failed to get usb_hs_clk\n");
>   		return PTR_ERR(motg->clk);
> @@ -1391,7 +1456,7 @@ static int msm_otg_probe(struct platform_device *pdev)
>   	 * operation and USB core cannot tolerate frequency changes on
>   	 * CORE CLK.
>   	 */
> -	motg->pclk = devm_clk_get(&pdev->dev, "usb_hs_pclk");
> +	motg->pclk = devm_clk_get(&pdev->dev, np ? "iface" : "usb_hs_pclk");
>   	if (IS_ERR(motg->pclk)) {
>   		dev_err(&pdev->dev, "failed to get usb_hs_pclk\n");
>   		return PTR_ERR(motg->pclk);
> @@ -1402,7 +1467,8 @@ static int msm_otg_probe(struct platform_device *pdev)
>   	 * clock is introduced to remove the dependency on AXI
>   	 * bus frequency.
>   	 */
> -	motg->core_clk = devm_clk_get(&pdev->dev, "usb_hs_core_clk");
> +	motg->core_clk = devm_clk_get(&pdev->dev,
> +				      np ? "alt_core" : "usb_hs_core_clk");
>
>   	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>   	motg->regs = devm_ioremap(&pdev->dev, res->start, resource_size(res));
> @@ -1490,8 +1556,7 @@ static int msm_otg_probe(struct platform_device *pdev)
>   	platform_set_drvdata(pdev, motg);
>   	device_init_wakeup(&pdev->dev, 1);
>
> -	if (motg->pdata->mode == USB_DR_MODE_OTG &&
> -			motg->pdata->otg_control == OTG_USER_CONTROL) {
> +	if (motg->pdata->mode == USB_DR_MODE_OTG) {

How is this change related to DT?
>   		ret = msm_otg_debugfs_init(motg);
>   		if (ret)
>   			dev_dbg(&pdev->dev, "Can not create mode change file\n");
> @@ -1637,6 +1702,8 @@ static const struct dev_pm_ops msm_otg_dev_pm_ops = {
>   				msm_otg_runtime_idle)
>   };
>
> +MODULE_DEVICE_TABLE(of, msm_otg_dt_match);
> +
>   static struct platform_driver msm_otg_driver = {
>   	.probe = msm_otg_probe,
>   	.remove = msm_otg_remove,
> @@ -1644,6 +1711,7 @@ static struct platform_driver msm_otg_driver = {
>   		.name = DRIVER_NAME,
>   		.owner = THIS_MODULE,

>   		.pm = &msm_otg_dev_pm_ops,
> +		.of_match_table = msm_otg_dt_match,
>   	},
>   };
>

[snip --
> diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
> index 262ed80..bd68299 100644
> --- a/include/linux/usb/msm_hsusb.h
> +++ b/include/linux/usb/msm_hsusb.h
> @@ -100,8 +100,9 @@ enum usb_chg_type {
>   /**
>    * struct msm_otg_platform_data - platform device data
>    *              for msm_otg driver.
> - * @phy_init_seq: PHY configuration sequence. val, reg pairs
> - *              terminated by -1.
> + * @phy_init_seq: PHY configuration sequence values. Value of -1 is reserved as
> + *              "do not overwrite default vaule at this address".
> + * @phy_init_sz: PHY configuration sequence size.
>    * @vbus_power: VBUS power on/off routine.
>    * @power_budget: VBUS power budget in mA (0 will be treated as 500mA).
>    * @mode: Supported mode (OTG/peripheral/host).
> @@ -109,6 +110,7 @@ enum usb_chg_type {
>    */
>   struct msm_otg_platform_data {
>   	int *phy_init_seq;
> +	int phy_init_sz;
>   	void (*vbus_power)(bool on);
>   	unsigned power_budget;
>   	enum usb_dr_mode mode;
> --
---]

I think, this changeset should be a new patch.

thanks,
srini
> 1.8.3.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
> the body of a message tomajordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info athttp://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 11/19] usb: phy: msm: Add device tree support and binding information
@ 2014-04-22 16:05       ` Srinivas Kandagatla
  0 siblings, 0 replies; 60+ messages in thread
From: Srinivas Kandagatla @ 2014-04-22 16:05 UTC (permalink / raw)
  To: Ivan T. Ivanov, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Randy Dunlap, Felipe Balbi,
	Grant Likely
  Cc: Greg Kroah-Hartman, David Brown, devicetree, linux-doc,
	linux-kernel, linux-usb, linux-arm-msm

Hi Ivan,

On 22/04/14 10:20, Ivan T. Ivanov wrote:
> From: "Ivan T. Ivanov"<iivanov@mm-sol.com>
>
> Allows MSM OTG controller to be specified via device tree.
>
> Signed-off-by: Ivan T. Ivanov<iivanov@mm-sol.com>
> ---
>   .../devicetree/bindings/usb/msm-hsusb.txt          |  67 +++++++++++++
>   drivers/usb/phy/phy-msm-usb.c                      | 108 +++++++++++++++++----
>   include/linux/usb/msm_hsusb.h                      |   6 +-
>   3 files changed, 159 insertions(+), 22 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/usb/msm-hsusb.txt b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
> index 5ea26c6..ee4123d 100644
> --- a/Documentation/devicetree/bindings/usb/msm-hsusb.txt
> +++ b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
> @@ -15,3 +15,70 @@ Example EHCI controller device node:
>   		usb-phy = <&usb_otg>;
>   	};
>
> +USB PHY with optional OTG:
> +
> +Required properties:
> +- compatible:   Should contain:
> +  "qcom,usb-otg-ci" for chipsets with ChipIdea 45nm PHY
> +  "qcom,usb-otg-snps" for chipsets with Synopsys 28nm PHY
> +
> +- regs:         Offset and length of the register set in the memory map
> +- interrupts:   interrupt-specifier for the OTG interrupt.
> +
> +- clocks:       A list of phandle + clock-specifier pairs for the
> +                clocks listed in clock-names
> +- clock-names:  Should contain the following:
> +  "phy"         USB PHY reference clock
> +  "core"        Protocol engine clock
> +  "iface"       Interface bus clock
> +  "alt_core"    Protocol engine clock for targets with asynchronous
> +                reset methodology. (optional)
> +
> +- vdccx-supply: phandle to the regulator for the vdd supply for
> +                digital circuit operation.
> +- v1p8-supply:  phandle to the regulator for the 1.8V supply
> +- v3p3-supply:  phandle to the regulator for the 3.3V supply
> +
> +- resets:       A list of phandle + reset-specifier pairs for the
> +                resets listed in reset-names
> +- reset-names:  Should contain the following:
> +  "phy"         USB PHY controller reset
> +  "link"        USB LINK controller reset
> +
> +- qcom,otg-control: OTG control (VBUS and ID notifications) can be one of
> +                1 - PHY control
> +                2 - PMIC control
> +
> +Optional properties:
> +- dr_mode:      One of "host", "peripheral" or "otg". Defaults to "otg"
> +
> +- qcom,phy-init-sequence: PHY configuration sequence values. This is related to Device
> +                Mode Eye Diagram test. Start address at which these values will be
> +                written is ULPI_EXT_VENDOR_SPECIFIC. Value of -1 is reserved as
> +                "do not overwrite default value at this address".
> +                For example: qcom,phy-init-sequence = < -1 0x63 >;
> +                Will update only value at address ULPI_EXT_VENDOR_SPECIFIC + 1.

I don’t think DT maintainers will like the sound of it.
Sorry If I missed some old discussion on this.
But I don't this this is the correct way.

DT should describe the system hardware layout rather than initialization 
sequence.

The initialization code with magic values should go directly into the 
driver and depending on the dt-compatible driver should select the right 
sequence.

/phy-msm-usb.c
> +++ b/drivers/usb/phy/phy-msm-usb.c
> @@ -30,9 +30,12 @@
>   #include <linux/debugfs.h>
>   #include <linux/seq_file.h>
>   #include <linux/pm_runtime.h>
> +#include <linux/of.h>
> +#include <linux/of_device.h>
>
>   #include <linux/usb.h>
>   #include <linux/usb/otg.h>
> +#include <linux/usb/of.h>
>   #include <linux/usb/ulpi.h>
>   #include <linux/usb/gadget.h>
>   #include <linux/usb/hcd.h>
> @@ -217,16 +220,16 @@ static struct usb_phy_io_ops msm_otg_io_ops = {
>   static void ulpi_init(struct msm_otg *motg)
>   {
>   	struct msm_otg_platform_data *pdata = motg->pdata;
> -	int *seq = pdata->phy_init_seq;
> +	int *seq = pdata->phy_init_seq, idx;
> +	u32 addr = ULPI_EXT_VENDOR_SPECIFIC;
>
> -	if (!seq)
> -		return;
> +	for (idx = 0; idx < pdata->phy_init_sz; idx++) {
> +		if (seq[idx] == -1)
> +			continue;
>
> -	while (seq[0] >= 0) {
>   		dev_vdbg(motg->phy.dev, "ulpi: write 0x%02x to 0x%02x\n",
> -				seq[0], seq[1]);
> -		ulpi_write(&motg->phy, seq[0], seq[1]);
> -		seq += 2;
> +				seq[idx], addr + idx);
> +		ulpi_write(&motg->phy, seq[idx], addr + idx);
>   	}
>   }

How is above change related to device trees?
>
> @@ -1343,25 +1346,87 @@ static void msm_otg_debugfs_cleanup(void)
>   	debugfs_remove(msm_otg_dbg_root);
>   }
>
> +static struct of_device_id msm_otg_dt_match[] = {
> +	{
> +		.compatible = "qcom,usb-otg-ci",
> +		.data = (void *) CI_45NM_INTEGRATED_PHY
> +	}, {
> +		.compatible = "qcom,usb-otg-snps",
> +		.data = (void *) SNPS_28NM_INTEGRATED_PHY
> +	}, {}
> +};
> +
> +static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg)
> +{
> +	struct msm_otg_platform_data *pdata;
> +	const struct of_device_id *id;
> +	struct device_node *node = pdev->dev.of_node;
> +	struct property *prop;
> +	int len, ret;
> +	u32 val;
> +
> +	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
> +	if (!pdata)
> +		return -ENOMEM;
> +
> +	motg->pdata = pdata;
> +
> +	id = of_match_device(msm_otg_dt_match, &pdev->dev);
> +	pdata->phy_type = (int) id->data;
> +
> +	pdata->mode = of_usb_get_dr_mode(node);
> +	if (pdata->mode == USB_DR_MODE_UNKNOWN)
> +		pdata->mode = USB_DR_MODE_OTG;
> +
> +	pdata->otg_control = OTG_PHY_CONTROL;
> +	if (!of_property_read_u32(node, "qcom,otg-control", &val))
> +		if (val == OTG_PMIC_CONTROL)
> +			pdata->otg_control = val;
> +
> +	prop = of_find_property(node, "qcom,phy-init-sequence", &len);
> +	if (!prop || !len)
> +		return 0;
> +
> +	pdata->phy_init_seq = devm_kzalloc(&pdev->dev, len, GFP_KERNEL);
> +	if (!pdata->phy_init_seq)
> +		return 0;
return -ENOMEM;
> +
> +	len /= sizeof(u32);
> +
> +	if (len >= ULPI_EXT_VENDOR_SPECIFIC) {
> +		dev_warn(&pdev->dev, "Too big PHY init sequence %d\n", len);
> +		return 0;
> +	}
> +
> +	ret = of_property_read_u32_array(node, "qcom,phy-init-sequence",
> +					 pdata->phy_init_seq, len);
> +	if (!ret)
> +		pdata->phy_init_sz = len;

empty line before return would be nice.
> +	return 0;
> +}
> +
>   static int msm_otg_probe(struct platform_device *pdev)
>   {
>   	int ret = 0;
> +	struct device_node *np = pdev->dev.of_node;
> +	struct msm_otg_platform_data *pdata;
>   	struct resource *res;
>   	struct msm_otg *motg;
>   	struct usb_phy *phy;
>
> -	dev_info(&pdev->dev, "msm_otg probe\n");
> -	if (!dev_get_platdata(&pdev->dev)) {
> -		dev_err(&pdev->dev, "No platform data given. Bailing out\n");
> -		return -ENODEV;
> -	}
> -
>   	motg = devm_kzalloc(&pdev->dev, sizeof(struct msm_otg), GFP_KERNEL);
>   	if (!motg) {
>   		dev_err(&pdev->dev, "unable to allocate msm_otg\n");
>   		return -ENOMEM;
>   	}
>
> +	pdata = dev_get_platdata(&pdev->dev);
> +	if (!pdata) {
shouldn’t this be
if (np) {
> +		ret = msm_otg_read_dt(pdev, motg);
> +		if (ret)
> +			return ret;
> +	}
> +
>   	motg->phy.otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg),
>   				     GFP_KERNEL);
>   	if (!motg->phy.otg) {
> @@ -1369,17 +1434,17 @@ static int msm_otg_probe(struct platform_device *pdev)
>   		return -ENOMEM;
>   	}
>
> -	motg->pdata = dev_get_platdata(&pdev->dev);
>   	phy = &motg->phy;
>   	phy->dev = &pdev->dev;
>
> -	motg->phy_reset_clk = devm_clk_get(&pdev->dev, "usb_phy_clk");
> +	motg->phy_reset_clk = devm_clk_get(&pdev->dev,
> +					   np ? "phy" : "usb_phy_clk");
Not sure why should it be different in dt and non-dt.
>   	if (IS_ERR(motg->phy_reset_clk)) {
>   		dev_err(&pdev->dev, "failed to get usb_phy_clk\n");
>   		return PTR_ERR(motg->phy_reset_clk);
>   	}
>
> -	motg->clk = devm_clk_get(&pdev->dev, "usb_hs_clk");
> +	motg->clk = devm_clk_get(&pdev->dev, np ? "core" : "usb_hs_clk");

Not sure why should it be different in dt and non-dt.
>   	if (IS_ERR(motg->clk)) {
>   		dev_err(&pdev->dev, "failed to get usb_hs_clk\n");
>   		return PTR_ERR(motg->clk);
> @@ -1391,7 +1456,7 @@ static int msm_otg_probe(struct platform_device *pdev)
>   	 * operation and USB core cannot tolerate frequency changes on
>   	 * CORE CLK.
>   	 */
> -	motg->pclk = devm_clk_get(&pdev->dev, "usb_hs_pclk");
> +	motg->pclk = devm_clk_get(&pdev->dev, np ? "iface" : "usb_hs_pclk");
>   	if (IS_ERR(motg->pclk)) {
>   		dev_err(&pdev->dev, "failed to get usb_hs_pclk\n");
>   		return PTR_ERR(motg->pclk);
> @@ -1402,7 +1467,8 @@ static int msm_otg_probe(struct platform_device *pdev)
>   	 * clock is introduced to remove the dependency on AXI
>   	 * bus frequency.
>   	 */
> -	motg->core_clk = devm_clk_get(&pdev->dev, "usb_hs_core_clk");
> +	motg->core_clk = devm_clk_get(&pdev->dev,
> +				      np ? "alt_core" : "usb_hs_core_clk");
>
>   	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>   	motg->regs = devm_ioremap(&pdev->dev, res->start, resource_size(res));
> @@ -1490,8 +1556,7 @@ static int msm_otg_probe(struct platform_device *pdev)
>   	platform_set_drvdata(pdev, motg);
>   	device_init_wakeup(&pdev->dev, 1);
>
> -	if (motg->pdata->mode == USB_DR_MODE_OTG &&
> -			motg->pdata->otg_control == OTG_USER_CONTROL) {
> +	if (motg->pdata->mode == USB_DR_MODE_OTG) {

How is this change related to DT?
>   		ret = msm_otg_debugfs_init(motg);
>   		if (ret)
>   			dev_dbg(&pdev->dev, "Can not create mode change file\n");
> @@ -1637,6 +1702,8 @@ static const struct dev_pm_ops msm_otg_dev_pm_ops = {
>   				msm_otg_runtime_idle)
>   };
>
> +MODULE_DEVICE_TABLE(of, msm_otg_dt_match);
> +
>   static struct platform_driver msm_otg_driver = {
>   	.probe = msm_otg_probe,
>   	.remove = msm_otg_remove,
> @@ -1644,6 +1711,7 @@ static struct platform_driver msm_otg_driver = {
>   		.name = DRIVER_NAME,
>   		.owner = THIS_MODULE,

>   		.pm = &msm_otg_dev_pm_ops,
> +		.of_match_table = msm_otg_dt_match,
>   	},
>   };
>

[snip --
> diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
> index 262ed80..bd68299 100644
> --- a/include/linux/usb/msm_hsusb.h
> +++ b/include/linux/usb/msm_hsusb.h
> @@ -100,8 +100,9 @@ enum usb_chg_type {
>   /**
>    * struct msm_otg_platform_data - platform device data
>    *              for msm_otg driver.
> - * @phy_init_seq: PHY configuration sequence. val, reg pairs
> - *              terminated by -1.
> + * @phy_init_seq: PHY configuration sequence values. Value of -1 is reserved as
> + *              "do not overwrite default vaule at this address".
> + * @phy_init_sz: PHY configuration sequence size.
>    * @vbus_power: VBUS power on/off routine.
>    * @power_budget: VBUS power budget in mA (0 will be treated as 500mA).
>    * @mode: Supported mode (OTG/peripheral/host).
> @@ -109,6 +110,7 @@ enum usb_chg_type {
>    */
>   struct msm_otg_platform_data {
>   	int *phy_init_seq;
> +	int phy_init_sz;
>   	void (*vbus_power)(bool on);
>   	unsigned power_budget;
>   	enum usb_dr_mode mode;
> --
---]

I think, this changeset should be a new patch.

thanks,
srini
> 1.8.3.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
> the body of a message tomajordomo@vger.kernel.org
> More majordomo info athttp://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 06/19] usb: phy: msm: Fix checkpatch.pl warnings
  2014-04-22 15:30   ` Srinivas Kandagatla
@ 2014-04-23  6:51     ` Ivan T. Ivanov
  0 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-23  6:51 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-arm-msm


On Tue, 2014-04-22 at 16:30 +0100, Srinivas Kandagatla wrote:
> 
> On 22/04/14 10:20, Ivan T. Ivanov wrote:
> > @@ -79,8 +78,7 @@ static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init)
> >   		ret = regulator_set_voltage(motg->vddcx, 0,
> >   			USB_PHY_VDD_DIG_VOL_MAX);
> >   		if (ret)
> > -			dev_err(motg->phy.dev, "unable to set the voltage "
> > -					"for hsusb vddcx\n");
> > +			dev_err(motg->phy.dev, "Cannot set vddcx voltage\n");
> 
> 
> > @@ -137,15 +133,13 @@ static int msm_hsusb_ldo_set_mode(struct msm_otg *motg, int on)
> >   		ret = regulator_set_optimum_mode(motg->v1p8,
> >   				USB_PHY_1P8_HPM_LOAD);
> >   		if (ret < 0) {
> > -			pr_err("%s: Unable to set HPM of the regulator "
> > -				"HSUSB_1p8\n", __func__);
> > +			pr_err("Could not set HPM for v1p8\n");
> >   			return ret;
> >   		}
> 
> 
> > @@ -390,8 +382,7 @@ static int msm_hsusb_config_vddcx(struct msm_otg *motg, int high)
> >
> >   	ret = regulator_set_voltage(motg->vddcx, min_vol, max_vol);
> >   	if (ret) {
> > -		pr_err("%s: unable to set the voltage for regulator "
> > -			"HSUSB_VDDCX\n", __func__);
> > +		dev_err(motg->phy.dev, "Cannot set vddcx voltage\n");
> >   		return ret;
> >   	}
> >
> 
> 
> I see some of pr_err not moved to dev_err?, while others have been moved.

Right, intention was to just shorten messages to fit one line, to make 
checkpatch.pl happy.

Thanks, 
Ivan

> Also noticed that the error messages are changed as part of this fix. 
> IMHO, changing an error message would have a side-effects on logging 
> tools, anyway Am not sure if its true in this case.
> 
> Thanks,
> srini
> --

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 11/19] usb: phy: msm: Add device tree support and binding information
  2014-04-22 16:05       ` Srinivas Kandagatla
  (?)
@ 2014-04-23  7:48       ` Ivan T. Ivanov
  -1 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-23  7:48 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Randy Dunlap, Felipe Balbi, Grant Likely, Greg Kroah-Hartman,
	David Brown, devicetree, linux-doc, linux-kernel, linux-usb,
	linux-arm-msm


Hi Srini,

On Tue, 2014-04-22 at 17:05 +0100, Srinivas Kandagatla wrote:
> Hi Ivan,
> 
> On 22/04/14 10:20, Ivan T. Ivanov wrote:
> > From: "Ivan T. Ivanov"<iivanov@mm-sol.com>
> >
> > Allows MSM OTG controller to be specified via device tree.
> >
> > Signed-off-by: Ivan T. Ivanov<iivanov@mm-sol.com>
> > ---
> >   .../devicetree/bindings/usb/msm-hsusb.txt          |  67 +++++++++++++
> >   drivers/usb/phy/phy-msm-usb.c                      | 108 +++++++++++++++++----
> >   include/linux/usb/msm_hsusb.h                      |   6 +-
> >   3 files changed, 159 insertions(+), 22 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/usb/msm-hsusb.txt b/Documentation/devicetree/bindings/usb/msm-hsusb.txt

<snip>

> > +Optional properties:
> > +- dr_mode:      One of "host", "peripheral" or "otg". Defaults to "otg"
> > +
> > +- qcom,phy-init-sequence: PHY configuration sequence values. This is related to Device
> > +                Mode Eye Diagram test. Start address at which these values will be
> > +                written is ULPI_EXT_VENDOR_SPECIFIC. Value of -1 is reserved as
> > +                "do not overwrite default value at this address".
> > +                For example: qcom,phy-init-sequence = < -1 0x63 >;
> > +                Will update only value at address ULPI_EXT_VENDOR_SPECIFIC + 1.
> 
> I don’t think DT maintainers will like the sound of it.
> Sorry If I missed some old discussion on this.
> But I don't this this is the correct way.
> 
> DT should describe the system hardware layout rather than initialization 
> sequence.
> 
> The initialization code with magic values should go directly into the 
> driver and depending on the dt-compatible driver should select the right 
> sequence.

While I agree in general, this sequence is board depended. It is related
to Eye diagrams tests.

> 
> /phy-msm-usb.c
> > +++ b/drivers/usb/phy/phy-msm-usb.c
> > @@ -30,9 +30,12 @@
> >   #include <linux/debugfs.h>
> >   #include <linux/seq_file.h>
> >   #include <linux/pm_runtime.h>
> > +#include <linux/of.h>
> > +#include <linux/of_device.h>
> >
> >   #include <linux/usb.h>
> >   #include <linux/usb/otg.h>
> > +#include <linux/usb/of.h>
> >   #include <linux/usb/ulpi.h>
> >   #include <linux/usb/gadget.h>
> >   #include <linux/usb/hcd.h>
> > @@ -217,16 +220,16 @@ static struct usb_phy_io_ops msm_otg_io_ops = {
> >   static void ulpi_init(struct msm_otg *motg)
> >   {
> >   	struct msm_otg_platform_data *pdata = motg->pdata;
> > -	int *seq = pdata->phy_init_seq;
> > +	int *seq = pdata->phy_init_seq, idx;
> > +	u32 addr = ULPI_EXT_VENDOR_SPECIFIC;
> >
> > -	if (!seq)
> > -		return;
> > +	for (idx = 0; idx < pdata->phy_init_sz; idx++) {
> > +		if (seq[idx] == -1)
> > +			continue;
> >
> > -	while (seq[0] >= 0) {
> >   		dev_vdbg(motg->phy.dev, "ulpi: write 0x%02x to 0x%02x\n",
> > -				seq[0], seq[1]);
> > -		ulpi_write(&motg->phy, seq[0], seq[1]);
> > -		seq += 2;
> > +				seq[idx], addr + idx);
> > +		ulpi_write(&motg->phy, seq[idx], addr + idx);
> >   	}
> >   }
> 
> How is above change related to device trees?

It is related to above "qcom,phy-init-sequence" parameter.

> >
> > @@ -1343,25 +1346,87 @@ static void msm_otg_debugfs_cleanup(void)
> >   	debugfs_remove(msm_otg_dbg_root);
> >   }
> >
> > +static struct of_device_id msm_otg_dt_match[] = {
> > +	{
> > +		.compatible = "qcom,usb-otg-ci",
> > +		.data = (void *) CI_45NM_INTEGRATED_PHY
> > +	}, {
> > +		.compatible = "qcom,usb-otg-snps",
> > +		.data = (void *) SNPS_28NM_INTEGRATED_PHY
> > +	}, {}
> > +};
> > +
> > +static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg)
> > +{
> > +	struct msm_otg_platform_data *pdata;
> > +	const struct of_device_id *id;
> > +	struct device_node *node = pdev->dev.of_node;
> > +	struct property *prop;
> > +	int len, ret;
> > +	u32 val;
> > +
> > +	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
> > +	if (!pdata)
> > +		return -ENOMEM;
> > +
> > +	motg->pdata = pdata;
> > +
> > +	id = of_match_device(msm_otg_dt_match, &pdev->dev);
> > +	pdata->phy_type = (int) id->data;
> > +
> > +	pdata->mode = of_usb_get_dr_mode(node);
> > +	if (pdata->mode == USB_DR_MODE_UNKNOWN)
> > +		pdata->mode = USB_DR_MODE_OTG;
> > +
> > +	pdata->otg_control = OTG_PHY_CONTROL;
> > +	if (!of_property_read_u32(node, "qcom,otg-control", &val))
> > +		if (val == OTG_PMIC_CONTROL)
> > +			pdata->otg_control = val;
> > +
> > +	prop = of_find_property(node, "qcom,phy-init-sequence", &len);
> > +	if (!prop || !len)
> > +		return 0;
> > +
> > +	pdata->phy_init_seq = devm_kzalloc(&pdev->dev, len, GFP_KERNEL);
> > +	if (!pdata->phy_init_seq)
> > +		return 0;
> return -ENOMEM;

This is optional parameter, but probably I could at least
log the event?!

> > +
> > +	len /= sizeof(u32);
> > +
> > +	if (len >= ULPI_EXT_VENDOR_SPECIFIC) {
> > +		dev_warn(&pdev->dev, "Too big PHY init sequence %d\n", len);
> > +		return 0;
> > +	}
> > +
> > +	ret = of_property_read_u32_array(node, "qcom,phy-init-sequence",
> > +					 pdata->phy_init_seq, len);
> > +	if (!ret)
> > +		pdata->phy_init_sz = len;
> 
> empty line before return would be nice.

Sure.

> > +	return 0;
> > +}
> > +
> >   static int msm_otg_probe(struct platform_device *pdev)
> >   {
> >   	int ret = 0;
> > +	struct device_node *np = pdev->dev.of_node;
> > +	struct msm_otg_platform_data *pdata;
> >   	struct resource *res;
> >   	struct msm_otg *motg;
> >   	struct usb_phy *phy;
> >
> > -	dev_info(&pdev->dev, "msm_otg probe\n");
> > -	if (!dev_get_platdata(&pdev->dev)) {
> > -		dev_err(&pdev->dev, "No platform data given. Bailing out\n");
> > -		return -ENODEV;
> > -	}
> > -
> >   	motg = devm_kzalloc(&pdev->dev, sizeof(struct msm_otg), GFP_KERNEL);
> >   	if (!motg) {
> >   		dev_err(&pdev->dev, "unable to allocate msm_otg\n");
> >   		return -ENOMEM;
> >   	}
> >
> > +	pdata = dev_get_platdata(&pdev->dev);
> > +	if (!pdata) {
> shouldn’t this be
> if (np) {

Yep, probably 

if (!pdata && np) {

> > +		ret = msm_otg_read_dt(pdev, motg);
> > +		if (ret)
> > +			return ret;
> > +	}
> > +
> >   	motg->phy.otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg),
> >   				     GFP_KERNEL);
> >   	if (!motg->phy.otg) {
> > @@ -1369,17 +1434,17 @@ static int msm_otg_probe(struct platform_device *pdev)
> >   		return -ENOMEM;
> >   	}
> >
> > -	motg->pdata = dev_get_platdata(&pdev->dev);
> >   	phy = &motg->phy;
> >   	phy->dev = &pdev->dev;
> >
> > -	motg->phy_reset_clk = devm_clk_get(&pdev->dev, "usb_phy_clk");
> > +	motg->phy_reset_clk = devm_clk_get(&pdev->dev,
> > +					   np ? "phy" : "usb_phy_clk");
> Not sure why should it be different in dt and non-dt.

Why not? "usb" and "clk" are too much for a USB clock name in
context of this driver.

> >   	if (IS_ERR(motg->phy_reset_clk)) {
> >   		dev_err(&pdev->dev, "failed to get usb_phy_clk\n");
> >   		return PTR_ERR(motg->phy_reset_clk);
> >   	}
> >
> > -	motg->clk = devm_clk_get(&pdev->dev, "usb_hs_clk");
> > +	motg->clk = devm_clk_get(&pdev->dev, np ? "core" : "usb_hs_clk");
> 
> Not sure why should it be different in dt and non-dt.

"hs" doesn't make any sense This clock is a core clock
for LINK controller.


> >   	if (IS_ERR(motg->clk)) {
> >   		dev_err(&pdev->dev, "failed to get usb_hs_clk\n");
> >   		return PTR_ERR(motg->clk);
> > @@ -1391,7 +1456,7 @@ static int msm_otg_probe(struct platform_device *pdev)
> >   	 * operation and USB core cannot tolerate frequency changes on
> >   	 * CORE CLK.
> >   	 */
> > -	motg->pclk = devm_clk_get(&pdev->dev, "usb_hs_pclk");
> > +	motg->pclk = devm_clk_get(&pdev->dev, np ? "iface" : "usb_hs_pclk");
> >   	if (IS_ERR(motg->pclk)) {
> >   		dev_err(&pdev->dev, "failed to get usb_hs_pclk\n");
> >   		return PTR_ERR(motg->pclk);
> > @@ -1402,7 +1467,8 @@ static int msm_otg_probe(struct platform_device *pdev)
> >   	 * clock is introduced to remove the dependency on AXI
> >   	 * bus frequency.
> >   	 */
> > -	motg->core_clk = devm_clk_get(&pdev->dev, "usb_hs_core_clk");
> > +	motg->core_clk = devm_clk_get(&pdev->dev,
> > +				      np ? "alt_core" : "usb_hs_core_clk");
> >
> >   	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> >   	motg->regs = devm_ioremap(&pdev->dev, res->start, resource_size(res));
> > @@ -1490,8 +1556,7 @@ static int msm_otg_probe(struct platform_device *pdev)
> >   	platform_set_drvdata(pdev, motg);
> >   	device_init_wakeup(&pdev->dev, 1);
> >
> > -	if (motg->pdata->mode == USB_DR_MODE_OTG &&
> > -			motg->pdata->otg_control == OTG_USER_CONTROL) {
> > +	if (motg->pdata->mode == USB_DR_MODE_OTG) {
> 
> How is this change related to DT?

Yep, it is not really related, will revert.

> >   		ret = msm_otg_debugfs_init(motg);
> >   		if (ret)
> >   			dev_dbg(&pdev->dev, "Can not create mode change file\n");
> > @@ -1637,6 +1702,8 @@ static const struct dev_pm_ops msm_otg_dev_pm_ops = {
> >   				msm_otg_runtime_idle)
> >   };
> >
> > +MODULE_DEVICE_TABLE(of, msm_otg_dt_match);
> > +
> >   static struct platform_driver msm_otg_driver = {
> >   	.probe = msm_otg_probe,
> >   	.remove = msm_otg_remove,
> > @@ -1644,6 +1711,7 @@ static struct platform_driver msm_otg_driver = {
> >   		.name = DRIVER_NAME,
> >   		.owner = THIS_MODULE,
> 
> >   		.pm = &msm_otg_dev_pm_ops,
> > +		.of_match_table = msm_otg_dt_match,
> >   	},
> >   };
> >
> 
> [snip --
> > diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
> > index 262ed80..bd68299 100644
> > --- a/include/linux/usb/msm_hsusb.h
> > +++ b/include/linux/usb/msm_hsusb.h
> > @@ -100,8 +100,9 @@ enum usb_chg_type {
> >   /**
> >    * struct msm_otg_platform_data - platform device data
> >    *              for msm_otg driver.
> > - * @phy_init_seq: PHY configuration sequence. val, reg pairs
> > - *              terminated by -1.
> > + * @phy_init_seq: PHY configuration sequence values. Value of -1 is reserved as
> > + *              "do not overwrite default vaule at this address".
> > + * @phy_init_sz: PHY configuration sequence size.
> >    * @vbus_power: VBUS power on/off routine.
> >    * @power_budget: VBUS power budget in mA (0 will be treated as 500mA).
> >    * @mode: Supported mode (OTG/peripheral/host).
> > @@ -109,6 +110,7 @@ enum usb_chg_type {
> >    */
> >   struct msm_otg_platform_data {
> >   	int *phy_init_seq;
> > +	int phy_init_sz;
> >   	void (*vbus_power)(bool on);
> >   	unsigned power_budget;
> >   	enum usb_dr_mode mode;
> > --
> ---]
> 
> I think, this changeset should be a new patch.

It is part of "qcom,phy-init-sequence" DT property.

Regards,
Ivan

> 
> thanks,
> srini
> > 1.8.3.2

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 01/19] usb: phy: msm: Make driver selectable on ARCH_QCOM
  2014-04-22 15:24           ` Felipe Balbi
@ 2014-04-23  8:48               ` Ivan T. Ivanov
  -1 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-23  8:48 UTC (permalink / raw)
  To: balbi-l0cyMroinI0
  Cc: Greg Kroah-Hartman, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA

On Tue, 2014-04-22 at 10:24 -0500, Felipe Balbi wrote:
> On Tue, Apr 22, 2014 at 06:16:35PM +0300, Ivan T. Ivanov wrote:
> > 
> > Hi, 
> > 
> > On Tue, 2014-04-22 at 09:57 -0500, Felipe Balbi wrote:
> > > On Tue, Apr 22, 2014 at 12:20:20PM +0300, Ivan T. Ivanov wrote:
> > > > From: "Ivan T. Ivanov" <iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
> > > > 
> > > > Controller could be found on APQ and MSM platforms,
> > > > make configuration description more generic.
> > > > 
> > > > Signed-off-by: Ivan T. Ivanov <iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
> > > > ---
> > > >  drivers/usb/phy/Kconfig | 6 +++---
> > > >  1 file changed, 3 insertions(+), 3 deletions(-)
> > > > 
> > > > diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
> > > > index 416e0c8..0c668a3 100644
> > > > --- a/drivers/usb/phy/Kconfig
> > > > +++ b/drivers/usb/phy/Kconfig
> > > > @@ -171,11 +171,11 @@ config USB_ISP1301
> > > >  	  module will be called phy-isp1301.
> > > > 
> > > >  config USB_MSM_OTG
> > > > -	tristate "OTG support for Qualcomm on-chip USB controller"
> > > > -	depends on (USB || USB_GADGET) && ARCH_MSM
> > > > +	tristate "Qualcomm on-chip USB OTG controller support"
> > > > +	depends on (USB || USB_GADGET) && (ARCH_MSM || ARCH_QCOM)
> > > 
> > > I would actually drop USB || USB_GADGET dependency here just make it
> > > easier to enable the driver on Kconfig, other you have to enable
> > > USB_SUPPORT, then enable USB, go back one menu level, go down to PHY
> > > menu, and choose this driver.
> > > 
> > 
> > Because phy directory already depends on USB_SUPPORT?
> 
> right

Build fails if USB and USB_GADGET are not selected. 
of_usb_get_dr_mode is part of USB_COMMON. 

...

if USB_SUPPORT

config USB_COMMON
	tristate
	default y
	depends on USB || USB_GADGET

...

of_usb_get_dr_mode() is no part of this patch, but should I remove
dependency here and add it several patches later?

Regards,
Ivan


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 01/19] usb: phy: msm: Make driver selectable on ARCH_QCOM
@ 2014-04-23  8:48               ` Ivan T. Ivanov
  0 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-23  8:48 UTC (permalink / raw)
  To: balbi; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel, linux-arm-msm

On Tue, 2014-04-22 at 10:24 -0500, Felipe Balbi wrote:
> On Tue, Apr 22, 2014 at 06:16:35PM +0300, Ivan T. Ivanov wrote:
> > 
> > Hi, 
> > 
> > On Tue, 2014-04-22 at 09:57 -0500, Felipe Balbi wrote:
> > > On Tue, Apr 22, 2014 at 12:20:20PM +0300, Ivan T. Ivanov wrote:
> > > > From: "Ivan T. Ivanov" <iivanov@mm-sol.com>
> > > > 
> > > > Controller could be found on APQ and MSM platforms,
> > > > make configuration description more generic.
> > > > 
> > > > Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
> > > > ---
> > > >  drivers/usb/phy/Kconfig | 6 +++---
> > > >  1 file changed, 3 insertions(+), 3 deletions(-)
> > > > 
> > > > diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
> > > > index 416e0c8..0c668a3 100644
> > > > --- a/drivers/usb/phy/Kconfig
> > > > +++ b/drivers/usb/phy/Kconfig
> > > > @@ -171,11 +171,11 @@ config USB_ISP1301
> > > >  	  module will be called phy-isp1301.
> > > > 
> > > >  config USB_MSM_OTG
> > > > -	tristate "OTG support for Qualcomm on-chip USB controller"
> > > > -	depends on (USB || USB_GADGET) && ARCH_MSM
> > > > +	tristate "Qualcomm on-chip USB OTG controller support"
> > > > +	depends on (USB || USB_GADGET) && (ARCH_MSM || ARCH_QCOM)
> > > 
> > > I would actually drop USB || USB_GADGET dependency here just make it
> > > easier to enable the driver on Kconfig, other you have to enable
> > > USB_SUPPORT, then enable USB, go back one menu level, go down to PHY
> > > menu, and choose this driver.
> > > 
> > 
> > Because phy directory already depends on USB_SUPPORT?
> 
> right

Build fails if USB and USB_GADGET are not selected. 
of_usb_get_dr_mode is part of USB_COMMON. 

...

if USB_SUPPORT

config USB_COMMON
	tristate
	default y
	depends on USB || USB_GADGET

...

of_usb_get_dr_mode() is no part of this patch, but should I remove
dependency here and add it several patches later?

Regards,
Ivan



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 15/19] usb: phy: msm: Fix PTS definitions for MSM USB controller
  2014-04-22 13:09       ` Sergei Shtylyov
  (?)
@ 2014-04-23 13:24       ` Ivan T. Ivanov
  2014-04-23 13:35         ` Ivan T. Ivanov
  -1 siblings, 1 reply; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-23 13:24 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Felipe Balbi, Tim Bird, Greg Kroah-Hartman, linux-usb,
	linux-kernel, linux-arm-msm, Tim Bird

Hi,

On Tue, 2014-04-22 at 17:09 +0400, Sergei Shtylyov wrote:
> Hello.
> 
> On 22-04-2014 13:20, Ivan T. Ivanov wrote:
> 
> > From: Tim Bird <tbird20d@gmail.com>
> 
> > Fix the value used for Parallel Transceiver Select (PTS) for the MSM USB
> > controller.  This is a standard chipidea PORTSC definition, where
> > a PHY_TYPE of 10b (<<30) is ULPI and 11b (<<30) is SERIAL.
> > Fix the definitions and use them correctly in the driver code.
> 
> > Signed-off-by: Tim Bird <tim.bird@sonymobile.com>
> > ---
> >   drivers/usb/phy/phy-msm-usb.c    | 8 +++++---
> >   include/linux/usb/msm_hsusb_hw.h | 5 +++--
> >   2 files changed, 8 insertions(+), 5 deletions(-)
> 
> > diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
> > index dababf9..e83d13a 100644
> > --- a/drivers/usb/phy/phy-msm-usb.c
> > +++ b/drivers/usb/phy/phy-msm-usb.c
> > @@ -287,8 +287,9 @@ static int msm_link_reset(struct msm_otg *motg)
> >   	if (motg->phy_number)
> >   		writel(readl(USB_PHY_CTRL2) | BIT(16), USB_PHY_CTRL2);
> >
> > +	/* put transciever in serial mode as part of reset */
> 
>     s/transciever/transceiver/
> 
> [...]
> 
> > diff --git a/include/linux/usb/msm_hsusb_hw.h b/include/linux/usb/msm_hsusb_hw.h
> > index 575c743..98d3dd8 100644
> > --- a/include/linux/usb/msm_hsusb_hw.h
> > +++ b/include/linux/usb/msm_hsusb_hw.h
> > @@ -31,8 +31,9 @@
> >   #define USB_USBINTR          (MSM_USB_BASE + 0x0148)
> >
> >   #define PORTSC_PHCD            (1 << 23) /* phy suspend mode */
> > -#define PORTSC_PTS_MASK         (3 << 30)
> > -#define PORTSC_PTS_ULPI         (3 << 30)
> > +#define PORTSC_PTS_MASK        (3 << 30)
> > +#define PORTSC_PTS_ULPI        (2 << 30)
> > +#define PORTSC_PTS_SERIAL      (3 << 30)
> 
>     Please use tabs, not spaces here.

Thanks, will fix and resend.

Ivan

> 
> WBR, Sergei
> 

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 15/19] usb: phy: msm: Fix PTS definitions for MSM USB controller
  2014-04-23 13:24       ` Ivan T. Ivanov
@ 2014-04-23 13:35         ` Ivan T. Ivanov
  2014-04-23 13:45             ` Sergei Shtylyov
  0 siblings, 1 reply; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-23 13:35 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Felipe Balbi, Tim Bird, Greg Kroah-Hartman, linux-usb,
	linux-kernel, linux-arm-msm, Tim Bird

On Wed, 2014-04-23 at 16:24 +0300, Ivan T. Ivanov wrote:

> > > --- a/include/linux/usb/msm_hsusb_hw.h
> > > +++ b/include/linux/usb/msm_hsusb_hw.h
> > > @@ -31,8 +31,9 @@
> > >   #define USB_USBINTR          (MSM_USB_BASE + 0x0148)
> > >
> > >   #define PORTSC_PHCD            (1 << 23) /* phy suspend mode */
> > > -#define PORTSC_PTS_MASK         (3 << 30)
> > > -#define PORTSC_PTS_ULPI         (3 << 30)
> > > +#define PORTSC_PTS_MASK        (3 << 30)
> > > +#define PORTSC_PTS_ULPI        (2 << 30)
> > > +#define PORTSC_PTS_SERIAL      (3 << 30)
> > 
> >     Please use tabs, not spaces here.
> 
> Thanks, will fix and resend.

I answered too quickly. File contain tabs and spaces for
indentation of definitions. Should I still use tabs here?

Regards,
Ivan

> 
> Ivan
> 
> > 
> > WBR, Sergei
> > 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 15/19] usb: phy: msm: Fix PTS definitions for MSM USB controller
  2014-04-23 13:35         ` Ivan T. Ivanov
@ 2014-04-23 13:45             ` Sergei Shtylyov
  0 siblings, 0 replies; 60+ messages in thread
From: Sergei Shtylyov @ 2014-04-23 13:45 UTC (permalink / raw)
  To: Ivan T. Ivanov
  Cc: Felipe Balbi, Tim Bird, Greg Kroah-Hartman,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Tim Bird

Hello.

On 23-04-2014 17:35, Ivan T. Ivanov wrote:

>>>> --- a/include/linux/usb/msm_hsusb_hw.h
>>>> +++ b/include/linux/usb/msm_hsusb_hw.h
>>>> @@ -31,8 +31,9 @@
>>>>    #define USB_USBINTR          (MSM_USB_BASE + 0x0148)
>>>>
>>>>    #define PORTSC_PHCD            (1 << 23) /* phy suspend mode */
>>>> -#define PORTSC_PTS_MASK         (3 << 30)
>>>> -#define PORTSC_PTS_ULPI         (3 << 30)
>>>> +#define PORTSC_PTS_MASK        (3 << 30)
>>>> +#define PORTSC_PTS_ULPI        (2 << 30)
>>>> +#define PORTSC_PTS_SERIAL      (3 << 30)

>>>      Please use tabs, not spaces here.

>> Thanks, will fix and resend.

> I answered too quickly. File contain tabs and spaces for
> indentation of definitions.

    You mean tabs and spaces on one line? Or sometimes tabs, sometimes spaces?

> Should I still use tabs here?

    If they are already used, why not?

> Regards,
> Ivan

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 15/19] usb: phy: msm: Fix PTS definitions for MSM USB controller
@ 2014-04-23 13:45             ` Sergei Shtylyov
  0 siblings, 0 replies; 60+ messages in thread
From: Sergei Shtylyov @ 2014-04-23 13:45 UTC (permalink / raw)
  To: Ivan T. Ivanov
  Cc: Felipe Balbi, Tim Bird, Greg Kroah-Hartman, linux-usb,
	linux-kernel, linux-arm-msm, Tim Bird

Hello.

On 23-04-2014 17:35, Ivan T. Ivanov wrote:

>>>> --- a/include/linux/usb/msm_hsusb_hw.h
>>>> +++ b/include/linux/usb/msm_hsusb_hw.h
>>>> @@ -31,8 +31,9 @@
>>>>    #define USB_USBINTR          (MSM_USB_BASE + 0x0148)
>>>>
>>>>    #define PORTSC_PHCD            (1 << 23) /* phy suspend mode */
>>>> -#define PORTSC_PTS_MASK         (3 << 30)
>>>> -#define PORTSC_PTS_ULPI         (3 << 30)
>>>> +#define PORTSC_PTS_MASK        (3 << 30)
>>>> +#define PORTSC_PTS_ULPI        (2 << 30)
>>>> +#define PORTSC_PTS_SERIAL      (3 << 30)

>>>      Please use tabs, not spaces here.

>> Thanks, will fix and resend.

> I answered too quickly. File contain tabs and spaces for
> indentation of definitions.

    You mean tabs and spaces on one line? Or sometimes tabs, sometimes spaces?

> Should I still use tabs here?

    If they are already used, why not?

> Regards,
> Ivan

WBR, Sergei


^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 15/19] usb: phy: msm: Fix PTS definitions for MSM USB controller
  2014-04-23 13:45             ` Sergei Shtylyov
  (?)
@ 2014-04-23 13:53             ` Ivan T. Ivanov
  2014-04-23 14:09               ` Sergei Shtylyov
  -1 siblings, 1 reply; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-23 13:53 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Felipe Balbi, Tim Bird, Greg Kroah-Hartman, linux-usb,
	linux-kernel, linux-arm-msm, Tim Bird

On Wed, 2014-04-23 at 17:45 +0400, Sergei Shtylyov wrote:
> Hello.
> 
> On 23-04-2014 17:35, Ivan T. Ivanov wrote:
> 
> >>>> --- a/include/linux/usb/msm_hsusb_hw.h
> >>>> +++ b/include/linux/usb/msm_hsusb_hw.h
> >>>> @@ -31,8 +31,9 @@
> >>>>    #define USB_USBINTR          (MSM_USB_BASE + 0x0148)
> >>>>
> >>>>    #define PORTSC_PHCD            (1 << 23) /* phy suspend mode */
> >>>> -#define PORTSC_PTS_MASK         (3 << 30)
> >>>> -#define PORTSC_PTS_ULPI         (3 << 30)
> >>>> +#define PORTSC_PTS_MASK        (3 << 30)
> >>>> +#define PORTSC_PTS_ULPI        (2 << 30)
> >>>> +#define PORTSC_PTS_SERIAL      (3 << 30)
> 
> >>>      Please use tabs, not spaces here.
> 
> >> Thanks, will fix and resend.
> 
> > I answered too quickly. File contain tabs and spaces for
> > indentation of definitions.
> 
>     You mean tabs and spaces on one line? Or sometimes tabs, sometimes spaces?

In this particular hunk, original code uses spaces.

Ivan

> 
> > Should I still use tabs here?
> 
>     If they are already used, why not?
> 
> > Regards,
> > Ivan
> 
> WBR, Sergei

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 15/19] usb: phy: msm: Fix PTS definitions for MSM USB controller
  2014-04-23 13:53             ` Ivan T. Ivanov
@ 2014-04-23 14:09               ` Sergei Shtylyov
       [not found]                 ` <5357C99F.6070009-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
  0 siblings, 1 reply; 60+ messages in thread
From: Sergei Shtylyov @ 2014-04-23 14:09 UTC (permalink / raw)
  To: Ivan T. Ivanov
  Cc: Felipe Balbi, Tim Bird, Greg Kroah-Hartman, linux-usb,
	linux-kernel, linux-arm-msm, Tim Bird

On 23-04-2014 17:53, Ivan T. Ivanov wrote:

>>>>>> --- a/include/linux/usb/msm_hsusb_hw.h
>>>>>> +++ b/include/linux/usb/msm_hsusb_hw.h
>>>>>> @@ -31,8 +31,9 @@
>>>>>>     #define USB_USBINTR          (MSM_USB_BASE + 0x0148)
>>>>>>
>>>>>>     #define PORTSC_PHCD            (1 << 23) /* phy suspend mode */
>>>>>> -#define PORTSC_PTS_MASK         (3 << 30)
>>>>>> -#define PORTSC_PTS_ULPI         (3 << 30)
>>>>>> +#define PORTSC_PTS_MASK        (3 << 30)
>>>>>> +#define PORTSC_PTS_ULPI        (2 << 30)
>>>>>> +#define PORTSC_PTS_SERIAL      (3 << 30)

>>>>>       Please use tabs, not spaces here.

>>>> Thanks, will fix and resend.

>>> I answered too quickly. File contain tabs and spaces for
>>> indentation of definitions.

>>      You mean tabs and spaces on one line? Or sometimes tabs, sometimes spaces?

> In this particular hunk, original code uses spaces.

    That I saw. 8-)
    I was asking about this file in general.

> Ivan

>>> Should I still use tabs here?

>>      If they are already used, why not?

>>> Regards,
>>> Ivan

WBR, Sergei

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 15/19] usb: phy: msm: Fix PTS definitions for MSM USB controller
  2014-04-23 14:09               ` Sergei Shtylyov
@ 2014-04-23 14:14                     ` Ivan T. Ivanov
  0 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-23 14:14 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Felipe Balbi, Tim Bird, Greg Kroah-Hartman,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Tim Bird

On Wed, 2014-04-23 at 18:09 +0400, Sergei Shtylyov wrote:
> On 23-04-2014 17:53, Ivan T. Ivanov wrote:
> 
> >>>>>> --- a/include/linux/usb/msm_hsusb_hw.h
> >>>>>> +++ b/include/linux/usb/msm_hsusb_hw.h
> >>>>>> @@ -31,8 +31,9 @@
> >>>>>>     #define USB_USBINTR          (MSM_USB_BASE + 0x0148)
> >>>>>>
> >>>>>>     #define PORTSC_PHCD            (1 << 23) /* phy suspend mode */
> >>>>>> -#define PORTSC_PTS_MASK         (3 << 30)
> >>>>>> -#define PORTSC_PTS_ULPI         (3 << 30)
> >>>>>> +#define PORTSC_PTS_MASK        (3 << 30)
> >>>>>> +#define PORTSC_PTS_ULPI        (2 << 30)
> >>>>>> +#define PORTSC_PTS_SERIAL      (3 << 30)
> 
> >>>>>       Please use tabs, not spaces here.
> 
> >>>> Thanks, will fix and resend.
> 
> >>> I answered too quickly. File contain tabs and spaces for
> >>> indentation of definitions.
> 
> >>      You mean tabs and spaces on one line? Or sometimes tabs, sometimes spaces?
> 
> > In this particular hunk, original code uses spaces.
> 
>     That I saw. 8-)
>     I was asking about this file in general.

Legacy :-) Could this be future cleanup? 

Regards,
Ivan

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 15/19] usb: phy: msm: Fix PTS definitions for MSM USB controller
@ 2014-04-23 14:14                     ` Ivan T. Ivanov
  0 siblings, 0 replies; 60+ messages in thread
From: Ivan T. Ivanov @ 2014-04-23 14:14 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Felipe Balbi, Tim Bird, Greg Kroah-Hartman, linux-usb,
	linux-kernel, linux-arm-msm, Tim Bird

On Wed, 2014-04-23 at 18:09 +0400, Sergei Shtylyov wrote:
> On 23-04-2014 17:53, Ivan T. Ivanov wrote:
> 
> >>>>>> --- a/include/linux/usb/msm_hsusb_hw.h
> >>>>>> +++ b/include/linux/usb/msm_hsusb_hw.h
> >>>>>> @@ -31,8 +31,9 @@
> >>>>>>     #define USB_USBINTR          (MSM_USB_BASE + 0x0148)
> >>>>>>
> >>>>>>     #define PORTSC_PHCD            (1 << 23) /* phy suspend mode */
> >>>>>> -#define PORTSC_PTS_MASK         (3 << 30)
> >>>>>> -#define PORTSC_PTS_ULPI         (3 << 30)
> >>>>>> +#define PORTSC_PTS_MASK        (3 << 30)
> >>>>>> +#define PORTSC_PTS_ULPI        (2 << 30)
> >>>>>> +#define PORTSC_PTS_SERIAL      (3 << 30)
> 
> >>>>>       Please use tabs, not spaces here.
> 
> >>>> Thanks, will fix and resend.
> 
> >>> I answered too quickly. File contain tabs and spaces for
> >>> indentation of definitions.
> 
> >>      You mean tabs and spaces on one line? Or sometimes tabs, sometimes spaces?
> 
> > In this particular hunk, original code uses spaces.
> 
>     That I saw. 8-)
>     I was asking about this file in general.

Legacy :-) Could this be future cleanup? 

Regards,
Ivan


^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 15/19] usb: phy: msm: Fix PTS definitions for MSM USB controller
  2014-04-23 14:14                     ` Ivan T. Ivanov
  (?)
@ 2014-04-23 14:31                     ` Sergei Shtylyov
  -1 siblings, 0 replies; 60+ messages in thread
From: Sergei Shtylyov @ 2014-04-23 14:31 UTC (permalink / raw)
  To: Ivan T. Ivanov
  Cc: Felipe Balbi, Tim Bird, Greg Kroah-Hartman, linux-usb,
	linux-kernel, linux-arm-msm, Tim Bird

Hello.

On 23-04-2014 18:14, Ivan T. Ivanov wrote:

>>>>>>>> --- a/include/linux/usb/msm_hsusb_hw.h
>>>>>>>> +++ b/include/linux/usb/msm_hsusb_hw.h
>>>>>>>> @@ -31,8 +31,9 @@
>>>>>>>>      #define USB_USBINTR          (MSM_USB_BASE + 0x0148)
>>>>>>>>
>>>>>>>>      #define PORTSC_PHCD            (1 << 23) /* phy suspend mode */
>>>>>>>> -#define PORTSC_PTS_MASK         (3 << 30)
>>>>>>>> -#define PORTSC_PTS_ULPI         (3 << 30)
>>>>>>>> +#define PORTSC_PTS_MASK        (3 << 30)
>>>>>>>> +#define PORTSC_PTS_ULPI        (2 << 30)
>>>>>>>> +#define PORTSC_PTS_SERIAL      (3 << 30)

>>>>>>>        Please use tabs, not spaces here.

>>>>>> Thanks, will fix and resend.

>>>>> I answered too quickly. File contain tabs and spaces for
>>>>> indentation of definitions.

>>>>       You mean tabs and spaces on one line? Or sometimes tabs, sometimes spaces?

>>> In this particular hunk, original code uses spaces.

>>      That I saw. 8-)
>>      I was asking about this file in general.

> Legacy :-) Could this be future cleanup?

    OK, let's forget about the tabs for now...

> Regards,
> Ivan

WBR, Sergei

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 01/19] usb: phy: msm: Make driver selectable on ARCH_QCOM
  2014-04-23  8:48               ` Ivan T. Ivanov
@ 2014-04-23 15:02                 ` Felipe Balbi
  -1 siblings, 0 replies; 60+ messages in thread
From: Felipe Balbi @ 2014-04-23 15:02 UTC (permalink / raw)
  To: Ivan T. Ivanov
  Cc: balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-arm-msm

[-- Attachment #1: Type: text/plain, Size: 2251 bytes --]

On Wed, Apr 23, 2014 at 11:48:29AM +0300, Ivan T. Ivanov wrote:
> On Tue, 2014-04-22 at 10:24 -0500, Felipe Balbi wrote:
> > On Tue, Apr 22, 2014 at 06:16:35PM +0300, Ivan T. Ivanov wrote:
> > > 
> > > Hi, 
> > > 
> > > On Tue, 2014-04-22 at 09:57 -0500, Felipe Balbi wrote:
> > > > On Tue, Apr 22, 2014 at 12:20:20PM +0300, Ivan T. Ivanov wrote:
> > > > > From: "Ivan T. Ivanov" <iivanov@mm-sol.com>
> > > > > 
> > > > > Controller could be found on APQ and MSM platforms,
> > > > > make configuration description more generic.
> > > > > 
> > > > > Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
> > > > > ---
> > > > >  drivers/usb/phy/Kconfig | 6 +++---
> > > > >  1 file changed, 3 insertions(+), 3 deletions(-)
> > > > > 
> > > > > diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
> > > > > index 416e0c8..0c668a3 100644
> > > > > --- a/drivers/usb/phy/Kconfig
> > > > > +++ b/drivers/usb/phy/Kconfig
> > > > > @@ -171,11 +171,11 @@ config USB_ISP1301
> > > > >  	  module will be called phy-isp1301.
> > > > > 
> > > > >  config USB_MSM_OTG
> > > > > -	tristate "OTG support for Qualcomm on-chip USB controller"
> > > > > -	depends on (USB || USB_GADGET) && ARCH_MSM
> > > > > +	tristate "Qualcomm on-chip USB OTG controller support"
> > > > > +	depends on (USB || USB_GADGET) && (ARCH_MSM || ARCH_QCOM)
> > > > 
> > > > I would actually drop USB || USB_GADGET dependency here just make it
> > > > easier to enable the driver on Kconfig, other you have to enable
> > > > USB_SUPPORT, then enable USB, go back one menu level, go down to PHY
> > > > menu, and choose this driver.
> > > > 
> > > 
> > > Because phy directory already depends on USB_SUPPORT?
> > 
> > right
> 
> Build fails if USB and USB_GADGET are not selected. 
> of_usb_get_dr_mode is part of USB_COMMON. 
> 
> ...
> 
> if USB_SUPPORT
> 
> config USB_COMMON
> 	tristate
> 	default y
> 	depends on USB || USB_GADGET
> 
> ...
> 
> of_usb_get_dr_mode() is no part of this patch, but should I remove
> dependency here and add it several patches later?

I guess we can keep it as is and I'll sort that out globaly later, I can
see a few other PHYs have some "weirdness" in their dependencies

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v6 01/19] usb: phy: msm: Make driver selectable on ARCH_QCOM
@ 2014-04-23 15:02                 ` Felipe Balbi
  0 siblings, 0 replies; 60+ messages in thread
From: Felipe Balbi @ 2014-04-23 15:02 UTC (permalink / raw)
  To: Ivan T. Ivanov
  Cc: balbi, Greg Kroah-Hartman, linux-usb, linux-kernel, linux-arm-msm

[-- Attachment #1: Type: text/plain, Size: 2251 bytes --]

On Wed, Apr 23, 2014 at 11:48:29AM +0300, Ivan T. Ivanov wrote:
> On Tue, 2014-04-22 at 10:24 -0500, Felipe Balbi wrote:
> > On Tue, Apr 22, 2014 at 06:16:35PM +0300, Ivan T. Ivanov wrote:
> > > 
> > > Hi, 
> > > 
> > > On Tue, 2014-04-22 at 09:57 -0500, Felipe Balbi wrote:
> > > > On Tue, Apr 22, 2014 at 12:20:20PM +0300, Ivan T. Ivanov wrote:
> > > > > From: "Ivan T. Ivanov" <iivanov@mm-sol.com>
> > > > > 
> > > > > Controller could be found on APQ and MSM platforms,
> > > > > make configuration description more generic.
> > > > > 
> > > > > Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
> > > > > ---
> > > > >  drivers/usb/phy/Kconfig | 6 +++---
> > > > >  1 file changed, 3 insertions(+), 3 deletions(-)
> > > > > 
> > > > > diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
> > > > > index 416e0c8..0c668a3 100644
> > > > > --- a/drivers/usb/phy/Kconfig
> > > > > +++ b/drivers/usb/phy/Kconfig
> > > > > @@ -171,11 +171,11 @@ config USB_ISP1301
> > > > >  	  module will be called phy-isp1301.
> > > > > 
> > > > >  config USB_MSM_OTG
> > > > > -	tristate "OTG support for Qualcomm on-chip USB controller"
> > > > > -	depends on (USB || USB_GADGET) && ARCH_MSM
> > > > > +	tristate "Qualcomm on-chip USB OTG controller support"
> > > > > +	depends on (USB || USB_GADGET) && (ARCH_MSM || ARCH_QCOM)
> > > > 
> > > > I would actually drop USB || USB_GADGET dependency here just make it
> > > > easier to enable the driver on Kconfig, other you have to enable
> > > > USB_SUPPORT, then enable USB, go back one menu level, go down to PHY
> > > > menu, and choose this driver.
> > > > 
> > > 
> > > Because phy directory already depends on USB_SUPPORT?
> > 
> > right
> 
> Build fails if USB and USB_GADGET are not selected. 
> of_usb_get_dr_mode is part of USB_COMMON. 
> 
> ...
> 
> if USB_SUPPORT
> 
> config USB_COMMON
> 	tristate
> 	default y
> 	depends on USB || USB_GADGET
> 
> ...
> 
> of_usb_get_dr_mode() is no part of this patch, but should I remove
> dependency here and add it several patches later?

I guess we can keep it as is and I'll sort that out globaly later, I can
see a few other PHYs have some "weirdness" in their dependencies

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 60+ messages in thread

end of thread, other threads:[~2014-04-23 15:05 UTC | newest]

Thread overview: 60+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-22  9:20 [PATCH v6 00/19] usb: phy: msm: Fixes, cleanups and DT support Ivan T. Ivanov
2014-04-22  9:20 ` [PATCH v6 01/19] usb: phy: msm: Make driver selectable on ARCH_QCOM Ivan T. Ivanov
     [not found]   ` <1398158438-21579-2-git-send-email-iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
2014-04-22 14:57     ` Felipe Balbi
2014-04-22 14:57       ` Felipe Balbi
2014-04-22 15:16       ` Ivan T. Ivanov
2014-04-22 15:24         ` Felipe Balbi
2014-04-22 15:24           ` Felipe Balbi
     [not found]           ` <20140422152425.GL5524-HgARHv6XitL9zxVx7UNMDg@public.gmane.org>
2014-04-23  8:48             ` Ivan T. Ivanov
2014-04-23  8:48               ` Ivan T. Ivanov
2014-04-23 15:02               ` Felipe Balbi
2014-04-23 15:02                 ` Felipe Balbi
2014-04-22  9:20 ` [PATCH v6 02/19] usb: phy: msm: Remove __init macro from driver probe method Ivan T. Ivanov
2014-04-22  9:20 ` [PATCH v6 06/19] usb: phy: msm: Fix checkpatch.pl warnings Ivan T. Ivanov
2014-04-22 15:30   ` Srinivas Kandagatla
2014-04-23  6:51     ` Ivan T. Ivanov
2014-04-22  9:20 ` [PATCH v6 07/19] usb: phy: msm: Replace custom enum usb_mode_type with enum usb_dr_mode Ivan T. Ivanov
2014-04-22  9:20 ` [PATCH v6 08/19] usb: phy: msm: Remove unused pclk_src_name Ivan T. Ivanov
2014-04-22  9:20 ` [PATCH v6 10/19] usb: phy: msm: Properly check result from platform_get_irq() Ivan T. Ivanov
2014-04-22  9:20 ` [PATCH v6 11/19] usb: phy: msm: Add device tree support and binding information Ivan T. Ivanov
     [not found]   ` <1398158438-21579-12-git-send-email-iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
2014-04-22 16:05     ` Srinivas Kandagatla
2014-04-22 16:05       ` Srinivas Kandagatla
2014-04-23  7:48       ` Ivan T. Ivanov
2014-04-22  9:20 ` [PATCH v6 12/19] usb: phy: msm: Use reset framework for LINK and PHY resets Ivan T. Ivanov
2014-04-22  9:20 ` [PATCH v6 13/19] usb: phy: msm: Add support for secondary PHY control Ivan T. Ivanov
2014-04-22  9:20 ` [PATCH v6 14/19] usb: phy: msm: Correct USB PHY Reset sequence for newer platform Ivan T. Ivanov
2014-04-22  9:20 ` [PATCH v6 15/19] usb: phy: msm: Fix PTS definitions for MSM USB controller Ivan T. Ivanov
     [not found]   ` <1398158438-21579-16-git-send-email-iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
2014-04-22 13:09     ` Sergei Shtylyov
2014-04-22 13:09       ` Sergei Shtylyov
2014-04-23 13:24       ` Ivan T. Ivanov
2014-04-23 13:35         ` Ivan T. Ivanov
2014-04-23 13:45           ` Sergei Shtylyov
2014-04-23 13:45             ` Sergei Shtylyov
2014-04-23 13:53             ` Ivan T. Ivanov
2014-04-23 14:09               ` Sergei Shtylyov
     [not found]                 ` <5357C99F.6070009-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2014-04-23 14:14                   ` Ivan T. Ivanov
2014-04-23 14:14                     ` Ivan T. Ivanov
2014-04-23 14:31                     ` Sergei Shtylyov
2014-04-22  9:20 ` [PATCH v6 17/19] usb: phy: msm: Handle disconnect events Ivan T. Ivanov
     [not found] ` <1398158438-21579-1-git-send-email-iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
2014-04-22  9:20   ` [PATCH v6 03/19] usb: phy: msm: Move global regulators variables to driver state Ivan T. Ivanov
2014-04-22  9:20     ` Ivan T. Ivanov
2014-04-22 14:57     ` Felipe Balbi
2014-04-22 14:57       ` Felipe Balbi
     [not found]       ` <20140422145745.GJ5524-HgARHv6XitL9zxVx7UNMDg@public.gmane.org>
2014-04-22 15:12         ` Ivan T. Ivanov
2014-04-22 15:12           ` Ivan T. Ivanov
2014-04-22 15:14           ` Felipe Balbi
2014-04-22 15:14             ` Felipe Balbi
2014-04-22  9:20   ` [PATCH v6 04/19] usb: phy: msm: Migrate to Managed Device Resource allocation Ivan T. Ivanov
2014-04-22  9:20     ` Ivan T. Ivanov
     [not found]     ` <1398158438-21579-5-git-send-email-iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
2014-04-22 15:07       ` Srinivas Kandagatla
2014-04-22 15:07         ` Srinivas Kandagatla
2014-04-22 15:19         ` Ivan T. Ivanov
2014-04-22  9:20   ` [PATCH v6 05/19] usb: phy: msm: Remove unnecessarily check for valid regulators Ivan T. Ivanov
2014-04-22  9:20     ` Ivan T. Ivanov
2014-04-22  9:20   ` [PATCH v6 09/19] usb: phy: msm: Remove HSUSB prefix from regulator names Ivan T. Ivanov
2014-04-22  9:20     ` Ivan T. Ivanov
2014-04-22  9:20   ` [PATCH v6 16/19] usb: phy: msm: Select secondary PHY via TCSR Ivan T. Ivanov
2014-04-22  9:20     ` Ivan T. Ivanov
2014-04-22  9:20   ` [PATCH v6 18/19] usb: phy: msm: Vote for corner of VDD CX instead of voltage of VDD CX Ivan T. Ivanov
2014-04-22  9:20     ` Ivan T. Ivanov
2014-04-22  9:20 ` [PATCH v6 19/19] usb: phy: msm: Use usb_add_phy_dev() to register device Ivan T. Ivanov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.