All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/17] Deprecate phy-omap-control and use SYSCON
@ 2015-06-23 11:58 ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson, tony, balbi, rogerq, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-usb, kishon
  Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, linux,
	gregkh, nsekhar

phy-omap-control driver was added when there was no proper
infrastructure for doing control module initializations.
Now with SYSCON framework being added to the kernel, phy-omap-control
shouldn't be needed.

This series is about adapting phy-omap-usb2, phy-ti-pipe3 and omap2430
to use SYSCON framework instead of phy-omap-control.
However we can't remove the phy-omap-control driver altogether since
that will break older dtbs.

Performed USB enumeration testing in DRA72-EVM, AM43XX-EVM, OMAP5-uEVM
and OMAP4 PANDA.

Performed SATA enumeration testing in DRA72-EVM and OMAP5-uEVM

Performed PCIe enumeration testing in DRA72-EVM.

This patch series is developed on top of Linux 4.1-rc8 +
http://lkml.iu.edu/hypermail/linux/kernel/1505.1/03099.html

Kishon Vijay Abraham I (17):
  phy: ti-pipe3: use ti_pipe3_power_off to power off the PHY during
    probe
  phy: ti-pipe3: use *syscon* framework to power on/off the PHY
  phy: ti-pipe3: use *syscon* framework to set PCS value of the PHY
  phy: omap-usb2: use omap_usb_power_off to power off the PHY during
    probe
  phy: omap-usb2: Add a new compatible string for USB2 PHY2
  phy: omap-usb2: use *syscon* framework to power on/off the PHY
  usb: musb: omap2430: use *syscon* framework to write to mailbox
    register
  ARM: dts: dra7: Add dt node for the sycon pcie
  ARM: dts: dra7: Use "syscon-phy-power" instead of "ctrl-module" in
    SATA PHY node
  ARM: dts: dra7: Use "syscon-phy-power" and "syscon-pcs" in PCIe PHY
    node
  ARM: dts: dra7: Use "ti,dra7x-usb2-phy2" compatible string for USB2
    PHY2
  ARM: dts: dra7: Use "syscon-phy-power" instead of "ctrl-module" in
    USB PHY node
  ARM: dts: am4372: Use "syscon-phy-power" instead of "ctrl-module" in
    USB PHY node
  ARM: dts: OMAP5: Use "syscon-phy-power" instead of "ctrl-module" in
    USB PHY node
  ARM: dts: OMAP5: Use "syscon-phy-power" instead of "ctrl-module" in
    SATA PHY node
  ARM: dts: omap4: Use "syscon-phy-power" instead of "ctrl-module" in
    USB PHY node
  ARM: dts: omap4: Use "syscon-otghs" instead of "ctrl-module" in USB
    node

 Documentation/devicetree/bindings/phy/ti-phy.txt   |   20 +++-
 Documentation/devicetree/bindings/usb/omap-usb.txt |    7 +-
 arch/arm/boot/dts/am4372.dtsi                      |   16 +--
 arch/arm/boot/dts/dra7.dtsi                        |   69 +++--------
 arch/arm/boot/dts/omap4.dtsi                       |   16 +--
 arch/arm/boot/dts/omap5.dtsi                       |   26 +---
 drivers/phy/phy-omap-usb2.c                        |  112 +++++++++++++++---
 drivers/phy/phy-ti-pipe3.c                         |  125 +++++++++++++++++---
 drivers/usb/musb/omap2430.c                        |  118 ++++++++++++++----
 include/linux/phy/omap_usb.h                       |   18 +++
 10 files changed, 365 insertions(+), 162 deletions(-)

-- 
1.7.9.5


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

* [PATCH 00/17] Deprecate phy-omap-control and use SYSCON
@ 2015-06-23 11:58 ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson, tony, balbi, rogerq, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-usb, kishon
  Cc: mark.rutland, linux, pawel.moll, ijc+devicetree, gregkh, nsekhar,
	robh+dt, galak

phy-omap-control driver was added when there was no proper
infrastructure for doing control module initializations.
Now with SYSCON framework being added to the kernel, phy-omap-control
shouldn't be needed.

This series is about adapting phy-omap-usb2, phy-ti-pipe3 and omap2430
to use SYSCON framework instead of phy-omap-control.
However we can't remove the phy-omap-control driver altogether since
that will break older dtbs.

Performed USB enumeration testing in DRA72-EVM, AM43XX-EVM, OMAP5-uEVM
and OMAP4 PANDA.

Performed SATA enumeration testing in DRA72-EVM and OMAP5-uEVM

Performed PCIe enumeration testing in DRA72-EVM.

This patch series is developed on top of Linux 4.1-rc8 +
http://lkml.iu.edu/hypermail/linux/kernel/1505.1/03099.html

Kishon Vijay Abraham I (17):
  phy: ti-pipe3: use ti_pipe3_power_off to power off the PHY during
    probe
  phy: ti-pipe3: use *syscon* framework to power on/off the PHY
  phy: ti-pipe3: use *syscon* framework to set PCS value of the PHY
  phy: omap-usb2: use omap_usb_power_off to power off the PHY during
    probe
  phy: omap-usb2: Add a new compatible string for USB2 PHY2
  phy: omap-usb2: use *syscon* framework to power on/off the PHY
  usb: musb: omap2430: use *syscon* framework to write to mailbox
    register
  ARM: dts: dra7: Add dt node for the sycon pcie
  ARM: dts: dra7: Use "syscon-phy-power" instead of "ctrl-module" in
    SATA PHY node
  ARM: dts: dra7: Use "syscon-phy-power" and "syscon-pcs" in PCIe PHY
    node
  ARM: dts: dra7: Use "ti,dra7x-usb2-phy2" compatible string for USB2
    PHY2
  ARM: dts: dra7: Use "syscon-phy-power" instead of "ctrl-module" in
    USB PHY node
  ARM: dts: am4372: Use "syscon-phy-power" instead of "ctrl-module" in
    USB PHY node
  ARM: dts: OMAP5: Use "syscon-phy-power" instead of "ctrl-module" in
    USB PHY node
  ARM: dts: OMAP5: Use "syscon-phy-power" instead of "ctrl-module" in
    SATA PHY node
  ARM: dts: omap4: Use "syscon-phy-power" instead of "ctrl-module" in
    USB PHY node
  ARM: dts: omap4: Use "syscon-otghs" instead of "ctrl-module" in USB
    node

 Documentation/devicetree/bindings/phy/ti-phy.txt   |   20 +++-
 Documentation/devicetree/bindings/usb/omap-usb.txt |    7 +-
 arch/arm/boot/dts/am4372.dtsi                      |   16 +--
 arch/arm/boot/dts/dra7.dtsi                        |   69 +++--------
 arch/arm/boot/dts/omap4.dtsi                       |   16 +--
 arch/arm/boot/dts/omap5.dtsi                       |   26 +---
 drivers/phy/phy-omap-usb2.c                        |  112 +++++++++++++++---
 drivers/phy/phy-ti-pipe3.c                         |  125 +++++++++++++++++---
 drivers/usb/musb/omap2430.c                        |  118 ++++++++++++++----
 include/linux/phy/omap_usb.h                       |   18 +++
 10 files changed, 365 insertions(+), 162 deletions(-)

-- 
1.7.9.5

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

* [PATCH 00/17] Deprecate phy-omap-control and use SYSCON
@ 2015-06-23 11:58 ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: linux-arm-kernel

phy-omap-control driver was added when there was no proper
infrastructure for doing control module initializations.
Now with SYSCON framework being added to the kernel, phy-omap-control
shouldn't be needed.

This series is about adapting phy-omap-usb2, phy-ti-pipe3 and omap2430
to use SYSCON framework instead of phy-omap-control.
However we can't remove the phy-omap-control driver altogether since
that will break older dtbs.

Performed USB enumeration testing in DRA72-EVM, AM43XX-EVM, OMAP5-uEVM
and OMAP4 PANDA.

Performed SATA enumeration testing in DRA72-EVM and OMAP5-uEVM

Performed PCIe enumeration testing in DRA72-EVM.

This patch series is developed on top of Linux 4.1-rc8 +
http://lkml.iu.edu/hypermail/linux/kernel/1505.1/03099.html

Kishon Vijay Abraham I (17):
  phy: ti-pipe3: use ti_pipe3_power_off to power off the PHY during
    probe
  phy: ti-pipe3: use *syscon* framework to power on/off the PHY
  phy: ti-pipe3: use *syscon* framework to set PCS value of the PHY
  phy: omap-usb2: use omap_usb_power_off to power off the PHY during
    probe
  phy: omap-usb2: Add a new compatible string for USB2 PHY2
  phy: omap-usb2: use *syscon* framework to power on/off the PHY
  usb: musb: omap2430: use *syscon* framework to write to mailbox
    register
  ARM: dts: dra7: Add dt node for the sycon pcie
  ARM: dts: dra7: Use "syscon-phy-power" instead of "ctrl-module" in
    SATA PHY node
  ARM: dts: dra7: Use "syscon-phy-power" and "syscon-pcs" in PCIe PHY
    node
  ARM: dts: dra7: Use "ti,dra7x-usb2-phy2" compatible string for USB2
    PHY2
  ARM: dts: dra7: Use "syscon-phy-power" instead of "ctrl-module" in
    USB PHY node
  ARM: dts: am4372: Use "syscon-phy-power" instead of "ctrl-module" in
    USB PHY node
  ARM: dts: OMAP5: Use "syscon-phy-power" instead of "ctrl-module" in
    USB PHY node
  ARM: dts: OMAP5: Use "syscon-phy-power" instead of "ctrl-module" in
    SATA PHY node
  ARM: dts: omap4: Use "syscon-phy-power" instead of "ctrl-module" in
    USB PHY node
  ARM: dts: omap4: Use "syscon-otghs" instead of "ctrl-module" in USB
    node

 Documentation/devicetree/bindings/phy/ti-phy.txt   |   20 +++-
 Documentation/devicetree/bindings/usb/omap-usb.txt |    7 +-
 arch/arm/boot/dts/am4372.dtsi                      |   16 +--
 arch/arm/boot/dts/dra7.dtsi                        |   69 +++--------
 arch/arm/boot/dts/omap4.dtsi                       |   16 +--
 arch/arm/boot/dts/omap5.dtsi                       |   26 +---
 drivers/phy/phy-omap-usb2.c                        |  112 +++++++++++++++---
 drivers/phy/phy-ti-pipe3.c                         |  125 +++++++++++++++++---
 drivers/usb/musb/omap2430.c                        |  118 ++++++++++++++----
 include/linux/phy/omap_usb.h                       |   18 +++
 10 files changed, 365 insertions(+), 162 deletions(-)

-- 
1.7.9.5

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

* [PATCH 01/17] phy: ti-pipe3: use ti_pipe3_power_off to power off the PHY during probe
  2015-06-23 11:58 ` Kishon Vijay Abraham I
  (?)
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  -1 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson, tony, balbi, rogerq, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-usb, kishon
  Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, linux,
	gregkh, nsekhar

No functional change. Previously omap_control_phy_power() was used to power
off the PHY during probe. But once PIPE3 driver is adapted to use syscon,
omap_control_phy_power() cannot be used. Hence used ti_pipe3_power_off
to power off the PHY.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/phy/phy-ti-pipe3.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
index 08020dc..d784426 100644
--- a/drivers/phy/phy-ti-pipe3.c
+++ b/drivers/phy/phy-ti-pipe3.c
@@ -431,8 +431,6 @@ static int ti_pipe3_probe(struct platform_device *pdev)
 
 	phy->control_dev = &control_pdev->dev;
 
-	omap_control_phy_power(phy->control_dev, 0);
-
 	platform_set_drvdata(pdev, phy);
 	pm_runtime_enable(phy->dev);
 
@@ -451,6 +449,8 @@ static int ti_pipe3_probe(struct platform_device *pdev)
 		return PTR_ERR(generic_phy);
 
 	phy_set_drvdata(generic_phy, phy);
+	ti_pipe3_power_off(generic_phy);
+
 	phy_provider = devm_of_phy_provider_register(phy->dev,
 			of_phy_simple_xlate);
 	if (IS_ERR(phy_provider))
-- 
1.7.9.5


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

* [PATCH 01/17] phy: ti-pipe3: use ti_pipe3_power_off to power off the PHY during probe
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson, tony, balbi, rogerq, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-usb, kishon
  Cc: mark.rutland, linux, pawel.moll, ijc+devicetree, gregkh, nsekhar,
	robh+dt, galak

No functional change. Previously omap_control_phy_power() was used to power
off the PHY during probe. But once PIPE3 driver is adapted to use syscon,
omap_control_phy_power() cannot be used. Hence used ti_pipe3_power_off
to power off the PHY.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/phy/phy-ti-pipe3.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
index 08020dc..d784426 100644
--- a/drivers/phy/phy-ti-pipe3.c
+++ b/drivers/phy/phy-ti-pipe3.c
@@ -431,8 +431,6 @@ static int ti_pipe3_probe(struct platform_device *pdev)
 
 	phy->control_dev = &control_pdev->dev;
 
-	omap_control_phy_power(phy->control_dev, 0);
-
 	platform_set_drvdata(pdev, phy);
 	pm_runtime_enable(phy->dev);
 
@@ -451,6 +449,8 @@ static int ti_pipe3_probe(struct platform_device *pdev)
 		return PTR_ERR(generic_phy);
 
 	phy_set_drvdata(generic_phy, phy);
+	ti_pipe3_power_off(generic_phy);
+
 	phy_provider = devm_of_phy_provider_register(phy->dev,
 			of_phy_simple_xlate);
 	if (IS_ERR(phy_provider))
-- 
1.7.9.5

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

* [PATCH 01/17] phy: ti-pipe3: use ti_pipe3_power_off to power off the PHY during probe
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: linux-arm-kernel

No functional change. Previously omap_control_phy_power() was used to power
off the PHY during probe. But once PIPE3 driver is adapted to use syscon,
omap_control_phy_power() cannot be used. Hence used ti_pipe3_power_off
to power off the PHY.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/phy/phy-ti-pipe3.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
index 08020dc..d784426 100644
--- a/drivers/phy/phy-ti-pipe3.c
+++ b/drivers/phy/phy-ti-pipe3.c
@@ -431,8 +431,6 @@ static int ti_pipe3_probe(struct platform_device *pdev)
 
 	phy->control_dev = &control_pdev->dev;
 
-	omap_control_phy_power(phy->control_dev, 0);
-
 	platform_set_drvdata(pdev, phy);
 	pm_runtime_enable(phy->dev);
 
@@ -451,6 +449,8 @@ static int ti_pipe3_probe(struct platform_device *pdev)
 		return PTR_ERR(generic_phy);
 
 	phy_set_drvdata(generic_phy, phy);
+	ti_pipe3_power_off(generic_phy);
+
 	phy_provider = devm_of_phy_provider_register(phy->dev,
 			of_phy_simple_xlate);
 	if (IS_ERR(phy_provider))
-- 
1.7.9.5

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

* [PATCH 02/17] phy: ti-pipe3: use *syscon* framework to power on/off the PHY
  2015-06-23 11:58 ` Kishon Vijay Abraham I
  (?)
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  -1 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson, tony, balbi, rogerq, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-usb, kishon
  Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, linux,
	gregkh, nsekhar

Deprecate using phy-omap-control driver to power on/off the PHY and
use *syscon* framework to do the same.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 Documentation/devicetree/bindings/phy/ti-phy.txt |   10 ++-
 drivers/phy/phy-ti-pipe3.c                       |   91 ++++++++++++++++++----
 2 files changed, 86 insertions(+), 15 deletions(-)

diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
index f0f5537..d3ad3bf 100644
--- a/Documentation/devicetree/bindings/phy/ti-phy.txt
+++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
@@ -77,8 +77,6 @@ Required properties:
    * "div-clk" - apll clock
 
 Optional properties:
- - ctrl-module : phandle of the control module used by PHY driver to power on
-   the PHY.
  - id: If there are multiple instance of the same type, in order to
    differentiate between each instance "id" can be used (e.g., multi-lane PCIe
    PHY). If "id" is not provided, it is set to default value of '1'.
@@ -86,6 +84,14 @@ Optional properties:
    CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0
    register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.
 
+Deprecated properties:
+ - ctrl-module : phandle of the control module used by PHY driver to power on
+   the PHY.
+
+Recommended properies:
+ - syscon-phy-power : phandle/offset pair. Phandle to the system control
+   module and the register offset to power on/off the PHY.
+
 This is usually a subnode of ocp2scp to which it is connected.
 
 usb3phy@4a084400 {
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
index d784426..78bac00 100644
--- a/drivers/phy/phy-ti-pipe3.c
+++ b/drivers/phy/phy-ti-pipe3.c
@@ -56,6 +56,15 @@
 
 #define SATA_PLL_SOFT_RESET	BIT(18)
 
+#define PIPE3_PHY_PWRCTL_CLK_CMD_MASK	0x003FC000
+#define PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT	14
+
+#define PIPE3_PHY_PWRCTL_CLK_FREQ_MASK	0xFFC00000
+#define PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT	22
+
+#define PIPE3_PHY_TX_RX_POWERON		0x3
+#define PIPE3_PHY_TX_RX_POWEROFF	0x0
+
 /*
  * This is an Empirical value that works, need to confirm the actual
  * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status
@@ -86,8 +95,10 @@ struct ti_pipe3 {
 	struct clk		*refclk;
 	struct clk		*div_clk;
 	struct pipe3_dpll_map	*dpll_map;
+	struct regmap		*phy_power_syscon; /* ctrl. reg. acces */
 	struct regmap		*dpll_reset_syscon; /* ctrl. reg. acces */
 	unsigned int		dpll_reset_reg; /* reg. index within syscon */
+	unsigned int		power_reg; /* power reg. index within syscon */
 	bool			sata_refclk_enabled;
 };
 
@@ -144,18 +155,49 @@ static void ti_pipe3_disable_clocks(struct ti_pipe3 *phy);
 
 static int ti_pipe3_power_off(struct phy *x)
 {
+	u32 val;
+	int ret;
 	struct ti_pipe3 *phy = phy_get_drvdata(x);
 
-	omap_control_phy_power(phy->control_dev, 0);
+	if (phy->phy_power_syscon) {
+		val = PIPE3_PHY_TX_RX_POWEROFF <<
+			PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT;
+
+		ret = regmap_update_bits(phy->phy_power_syscon, phy->power_reg,
+					 PIPE3_PHY_PWRCTL_CLK_CMD_MASK, val);
+		if (ret < 0)
+			return ret;
+	} else {
+		omap_control_phy_power(phy->control_dev, 0);
+	}
 
 	return 0;
 }
 
 static int ti_pipe3_power_on(struct phy *x)
 {
+	u32 val;
+	u32 mask;
+	int ret;
+	unsigned long rate;
 	struct ti_pipe3 *phy = phy_get_drvdata(x);
 
-	omap_control_phy_power(phy->control_dev, 1);
+	if (phy->phy_power_syscon) {
+		rate = clk_get_rate(phy->sys_clk);
+		rate = rate / 1000000;
+		mask = OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK |
+			  OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_MASK;
+		val = PIPE3_PHY_TX_RX_POWERON <<
+			PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT;
+		val |= rate << OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT;
+
+		ret = regmap_update_bits(phy->phy_power_syscon, phy->power_reg,
+					 mask, val);
+		if (ret < 0)
+			return ret;
+	} else {
+		omap_control_phy_power(phy->control_dev, 1);
+	}
 
 	return 0;
 }
@@ -417,19 +459,42 @@ static int ti_pipe3_probe(struct platform_device *pdev)
 		phy->div_clk = ERR_PTR(-ENODEV);
 	}
 
-	control_node = of_parse_phandle(node, "ctrl-module", 0);
-	if (!control_node) {
-		dev_err(&pdev->dev, "Failed to get control device phandle\n");
-		return -EINVAL;
-	}
+	phy->phy_power_syscon = syscon_regmap_lookup_by_phandle(node,
+							"syscon-phy-power");
+	if (IS_ERR(phy->phy_power_syscon)) {
+		dev_info(&pdev->dev,
+			 "can't get syscon-phy-power, using control device\n");
+		phy->phy_power_syscon = NULL;
+
+		control_node = of_parse_phandle(node, "ctrl-module", 0);
+		if (!control_node) {
+			dev_err(&pdev->dev,
+				"Failed to get control device phandle\n");
+			return -EINVAL;
+		}
 
-	control_pdev = of_find_device_by_node(control_node);
-	if (!control_pdev) {
-		dev_err(&pdev->dev, "Failed to get control device\n");
-		return -EINVAL;
-	}
+		control_pdev = of_find_device_by_node(control_node);
+		if (!control_pdev) {
+			dev_err(&pdev->dev, "Failed to get control device\n");
+			return -EINVAL;
+		}
 
-	phy->control_dev = &control_pdev->dev;
+		phy->control_dev = &control_pdev->dev;
+	} else {
+		phy->sys_clk = devm_clk_get(phy->dev, "sysclk");
+		if (IS_ERR(phy->sys_clk)) {
+			dev_err(&pdev->dev, "unable to get sysclk\n");
+			return -EINVAL;
+		}
+
+		if (of_property_read_u32_index(node,
+					       "syscon-phy-power", 1,
+					       &phy->power_reg)) {
+			dev_err(&pdev->dev,
+				"couldn't get power reg. offset\n");
+			return -EINVAL;
+		}
+	}
 
 	platform_set_drvdata(pdev, phy);
 	pm_runtime_enable(phy->dev);
-- 
1.7.9.5


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

* [PATCH 02/17] phy: ti-pipe3: use *syscon* framework to power on/off the PHY
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson, tony, balbi, rogerq, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-usb, kishon
  Cc: mark.rutland, linux, pawel.moll, ijc+devicetree, gregkh, nsekhar,
	robh+dt, galak

Deprecate using phy-omap-control driver to power on/off the PHY and
use *syscon* framework to do the same.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 Documentation/devicetree/bindings/phy/ti-phy.txt |   10 ++-
 drivers/phy/phy-ti-pipe3.c                       |   91 ++++++++++++++++++----
 2 files changed, 86 insertions(+), 15 deletions(-)

diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
index f0f5537..d3ad3bf 100644
--- a/Documentation/devicetree/bindings/phy/ti-phy.txt
+++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
@@ -77,8 +77,6 @@ Required properties:
    * "div-clk" - apll clock
 
 Optional properties:
- - ctrl-module : phandle of the control module used by PHY driver to power on
-   the PHY.
  - id: If there are multiple instance of the same type, in order to
    differentiate between each instance "id" can be used (e.g., multi-lane PCIe
    PHY). If "id" is not provided, it is set to default value of '1'.
@@ -86,6 +84,14 @@ Optional properties:
    CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0
    register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.
 
+Deprecated properties:
+ - ctrl-module : phandle of the control module used by PHY driver to power on
+   the PHY.
+
+Recommended properies:
+ - syscon-phy-power : phandle/offset pair. Phandle to the system control
+   module and the register offset to power on/off the PHY.
+
 This is usually a subnode of ocp2scp to which it is connected.
 
 usb3phy@4a084400 {
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
index d784426..78bac00 100644
--- a/drivers/phy/phy-ti-pipe3.c
+++ b/drivers/phy/phy-ti-pipe3.c
@@ -56,6 +56,15 @@
 
 #define SATA_PLL_SOFT_RESET	BIT(18)
 
+#define PIPE3_PHY_PWRCTL_CLK_CMD_MASK	0x003FC000
+#define PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT	14
+
+#define PIPE3_PHY_PWRCTL_CLK_FREQ_MASK	0xFFC00000
+#define PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT	22
+
+#define PIPE3_PHY_TX_RX_POWERON		0x3
+#define PIPE3_PHY_TX_RX_POWEROFF	0x0
+
 /*
  * This is an Empirical value that works, need to confirm the actual
  * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status
@@ -86,8 +95,10 @@ struct ti_pipe3 {
 	struct clk		*refclk;
 	struct clk		*div_clk;
 	struct pipe3_dpll_map	*dpll_map;
+	struct regmap		*phy_power_syscon; /* ctrl. reg. acces */
 	struct regmap		*dpll_reset_syscon; /* ctrl. reg. acces */
 	unsigned int		dpll_reset_reg; /* reg. index within syscon */
+	unsigned int		power_reg; /* power reg. index within syscon */
 	bool			sata_refclk_enabled;
 };
 
@@ -144,18 +155,49 @@ static void ti_pipe3_disable_clocks(struct ti_pipe3 *phy);
 
 static int ti_pipe3_power_off(struct phy *x)
 {
+	u32 val;
+	int ret;
 	struct ti_pipe3 *phy = phy_get_drvdata(x);
 
-	omap_control_phy_power(phy->control_dev, 0);
+	if (phy->phy_power_syscon) {
+		val = PIPE3_PHY_TX_RX_POWEROFF <<
+			PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT;
+
+		ret = regmap_update_bits(phy->phy_power_syscon, phy->power_reg,
+					 PIPE3_PHY_PWRCTL_CLK_CMD_MASK, val);
+		if (ret < 0)
+			return ret;
+	} else {
+		omap_control_phy_power(phy->control_dev, 0);
+	}
 
 	return 0;
 }
 
 static int ti_pipe3_power_on(struct phy *x)
 {
+	u32 val;
+	u32 mask;
+	int ret;
+	unsigned long rate;
 	struct ti_pipe3 *phy = phy_get_drvdata(x);
 
-	omap_control_phy_power(phy->control_dev, 1);
+	if (phy->phy_power_syscon) {
+		rate = clk_get_rate(phy->sys_clk);
+		rate = rate / 1000000;
+		mask = OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK |
+			  OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_MASK;
+		val = PIPE3_PHY_TX_RX_POWERON <<
+			PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT;
+		val |= rate << OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT;
+
+		ret = regmap_update_bits(phy->phy_power_syscon, phy->power_reg,
+					 mask, val);
+		if (ret < 0)
+			return ret;
+	} else {
+		omap_control_phy_power(phy->control_dev, 1);
+	}
 
 	return 0;
 }
@@ -417,19 +459,42 @@ static int ti_pipe3_probe(struct platform_device *pdev)
 		phy->div_clk = ERR_PTR(-ENODEV);
 	}
 
-	control_node = of_parse_phandle(node, "ctrl-module", 0);
-	if (!control_node) {
-		dev_err(&pdev->dev, "Failed to get control device phandle\n");
-		return -EINVAL;
-	}
+	phy->phy_power_syscon = syscon_regmap_lookup_by_phandle(node,
+							"syscon-phy-power");
+	if (IS_ERR(phy->phy_power_syscon)) {
+		dev_info(&pdev->dev,
+			 "can't get syscon-phy-power, using control device\n");
+		phy->phy_power_syscon = NULL;
+
+		control_node = of_parse_phandle(node, "ctrl-module", 0);
+		if (!control_node) {
+			dev_err(&pdev->dev,
+				"Failed to get control device phandle\n");
+			return -EINVAL;
+		}
 
-	control_pdev = of_find_device_by_node(control_node);
-	if (!control_pdev) {
-		dev_err(&pdev->dev, "Failed to get control device\n");
-		return -EINVAL;
-	}
+		control_pdev = of_find_device_by_node(control_node);
+		if (!control_pdev) {
+			dev_err(&pdev->dev, "Failed to get control device\n");
+			return -EINVAL;
+		}
 
-	phy->control_dev = &control_pdev->dev;
+		phy->control_dev = &control_pdev->dev;
+	} else {
+		phy->sys_clk = devm_clk_get(phy->dev, "sysclk");
+		if (IS_ERR(phy->sys_clk)) {
+			dev_err(&pdev->dev, "unable to get sysclk\n");
+			return -EINVAL;
+		}
+
+		if (of_property_read_u32_index(node,
+					       "syscon-phy-power", 1,
+					       &phy->power_reg)) {
+			dev_err(&pdev->dev,
+				"couldn't get power reg. offset\n");
+			return -EINVAL;
+		}
+	}
 
 	platform_set_drvdata(pdev, phy);
 	pm_runtime_enable(phy->dev);
-- 
1.7.9.5

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

* [PATCH 02/17] phy: ti-pipe3: use *syscon* framework to power on/off the PHY
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: linux-arm-kernel

Deprecate using phy-omap-control driver to power on/off the PHY and
use *syscon* framework to do the same.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 Documentation/devicetree/bindings/phy/ti-phy.txt |   10 ++-
 drivers/phy/phy-ti-pipe3.c                       |   91 ++++++++++++++++++----
 2 files changed, 86 insertions(+), 15 deletions(-)

diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
index f0f5537..d3ad3bf 100644
--- a/Documentation/devicetree/bindings/phy/ti-phy.txt
+++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
@@ -77,8 +77,6 @@ Required properties:
    * "div-clk" - apll clock
 
 Optional properties:
- - ctrl-module : phandle of the control module used by PHY driver to power on
-   the PHY.
  - id: If there are multiple instance of the same type, in order to
    differentiate between each instance "id" can be used (e.g., multi-lane PCIe
    PHY). If "id" is not provided, it is set to default value of '1'.
@@ -86,6 +84,14 @@ Optional properties:
    CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0
    register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.
 
+Deprecated properties:
+ - ctrl-module : phandle of the control module used by PHY driver to power on
+   the PHY.
+
+Recommended properies:
+ - syscon-phy-power : phandle/offset pair. Phandle to the system control
+   module and the register offset to power on/off the PHY.
+
 This is usually a subnode of ocp2scp to which it is connected.
 
 usb3phy at 4a084400 {
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
index d784426..78bac00 100644
--- a/drivers/phy/phy-ti-pipe3.c
+++ b/drivers/phy/phy-ti-pipe3.c
@@ -56,6 +56,15 @@
 
 #define SATA_PLL_SOFT_RESET	BIT(18)
 
+#define PIPE3_PHY_PWRCTL_CLK_CMD_MASK	0x003FC000
+#define PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT	14
+
+#define PIPE3_PHY_PWRCTL_CLK_FREQ_MASK	0xFFC00000
+#define PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT	22
+
+#define PIPE3_PHY_TX_RX_POWERON		0x3
+#define PIPE3_PHY_TX_RX_POWEROFF	0x0
+
 /*
  * This is an Empirical value that works, need to confirm the actual
  * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status
@@ -86,8 +95,10 @@ struct ti_pipe3 {
 	struct clk		*refclk;
 	struct clk		*div_clk;
 	struct pipe3_dpll_map	*dpll_map;
+	struct regmap		*phy_power_syscon; /* ctrl. reg. acces */
 	struct regmap		*dpll_reset_syscon; /* ctrl. reg. acces */
 	unsigned int		dpll_reset_reg; /* reg. index within syscon */
+	unsigned int		power_reg; /* power reg. index within syscon */
 	bool			sata_refclk_enabled;
 };
 
@@ -144,18 +155,49 @@ static void ti_pipe3_disable_clocks(struct ti_pipe3 *phy);
 
 static int ti_pipe3_power_off(struct phy *x)
 {
+	u32 val;
+	int ret;
 	struct ti_pipe3 *phy = phy_get_drvdata(x);
 
-	omap_control_phy_power(phy->control_dev, 0);
+	if (phy->phy_power_syscon) {
+		val = PIPE3_PHY_TX_RX_POWEROFF <<
+			PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT;
+
+		ret = regmap_update_bits(phy->phy_power_syscon, phy->power_reg,
+					 PIPE3_PHY_PWRCTL_CLK_CMD_MASK, val);
+		if (ret < 0)
+			return ret;
+	} else {
+		omap_control_phy_power(phy->control_dev, 0);
+	}
 
 	return 0;
 }
 
 static int ti_pipe3_power_on(struct phy *x)
 {
+	u32 val;
+	u32 mask;
+	int ret;
+	unsigned long rate;
 	struct ti_pipe3 *phy = phy_get_drvdata(x);
 
-	omap_control_phy_power(phy->control_dev, 1);
+	if (phy->phy_power_syscon) {
+		rate = clk_get_rate(phy->sys_clk);
+		rate = rate / 1000000;
+		mask = OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK |
+			  OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_MASK;
+		val = PIPE3_PHY_TX_RX_POWERON <<
+			PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT;
+		val |= rate << OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT;
+
+		ret = regmap_update_bits(phy->phy_power_syscon, phy->power_reg,
+					 mask, val);
+		if (ret < 0)
+			return ret;
+	} else {
+		omap_control_phy_power(phy->control_dev, 1);
+	}
 
 	return 0;
 }
@@ -417,19 +459,42 @@ static int ti_pipe3_probe(struct platform_device *pdev)
 		phy->div_clk = ERR_PTR(-ENODEV);
 	}
 
-	control_node = of_parse_phandle(node, "ctrl-module", 0);
-	if (!control_node) {
-		dev_err(&pdev->dev, "Failed to get control device phandle\n");
-		return -EINVAL;
-	}
+	phy->phy_power_syscon = syscon_regmap_lookup_by_phandle(node,
+							"syscon-phy-power");
+	if (IS_ERR(phy->phy_power_syscon)) {
+		dev_info(&pdev->dev,
+			 "can't get syscon-phy-power, using control device\n");
+		phy->phy_power_syscon = NULL;
+
+		control_node = of_parse_phandle(node, "ctrl-module", 0);
+		if (!control_node) {
+			dev_err(&pdev->dev,
+				"Failed to get control device phandle\n");
+			return -EINVAL;
+		}
 
-	control_pdev = of_find_device_by_node(control_node);
-	if (!control_pdev) {
-		dev_err(&pdev->dev, "Failed to get control device\n");
-		return -EINVAL;
-	}
+		control_pdev = of_find_device_by_node(control_node);
+		if (!control_pdev) {
+			dev_err(&pdev->dev, "Failed to get control device\n");
+			return -EINVAL;
+		}
 
-	phy->control_dev = &control_pdev->dev;
+		phy->control_dev = &control_pdev->dev;
+	} else {
+		phy->sys_clk = devm_clk_get(phy->dev, "sysclk");
+		if (IS_ERR(phy->sys_clk)) {
+			dev_err(&pdev->dev, "unable to get sysclk\n");
+			return -EINVAL;
+		}
+
+		if (of_property_read_u32_index(node,
+					       "syscon-phy-power", 1,
+					       &phy->power_reg)) {
+			dev_err(&pdev->dev,
+				"couldn't get power reg. offset\n");
+			return -EINVAL;
+		}
+	}
 
 	platform_set_drvdata(pdev, phy);
 	pm_runtime_enable(phy->dev);
-- 
1.7.9.5

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

* [PATCH 03/17] phy: ti-pipe3: use *syscon* framework to set PCS value of the PHY
  2015-06-23 11:58 ` Kishon Vijay Abraham I
  (?)
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  -1 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson, tony, balbi, rogerq, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-usb, kishon
  Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, linux,
	gregkh, nsekhar

Deprecate using phy-omap-control driver to set PCS value of the PHY
and start using *syscon* framework to do the same.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 Documentation/devicetree/bindings/phy/ti-phy.txt |    2 ++
 drivers/phy/phy-ti-pipe3.c                       |   32 +++++++++++++++++++++-
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
index d3ad3bf..52c7a92 100644
--- a/Documentation/devicetree/bindings/phy/ti-phy.txt
+++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
@@ -83,6 +83,8 @@ Optional properties:
  - syscon-pllreset: Handle to system control region that contains the
    CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0
    register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.
+ - syscon-pcs : phandle/offset pair. Phandle to the system control module and the
+   register offset to write the PCS delay value.
 
 Deprecated properties:
  - ctrl-module : phandle of the control module used by PHY driver to power on
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
index 78bac00..e2f9ad7 100644
--- a/drivers/phy/phy-ti-pipe3.c
+++ b/drivers/phy/phy-ti-pipe3.c
@@ -65,6 +65,9 @@
 #define PIPE3_PHY_TX_RX_POWERON		0x3
 #define PIPE3_PHY_TX_RX_POWEROFF	0x0
 
+#define PCIE_PCS_MASK			0xFF0000
+#define PCIE_PCS_DELAY_COUNT_SHIFT	0x10
+
 /*
  * This is an Empirical value that works, need to confirm the actual
  * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status
@@ -96,9 +99,11 @@ struct ti_pipe3 {
 	struct clk		*div_clk;
 	struct pipe3_dpll_map	*dpll_map;
 	struct regmap		*phy_power_syscon; /* ctrl. reg. acces */
+	struct regmap		*pcs_syscon; /* ctrl. reg. acces */
 	struct regmap		*dpll_reset_syscon; /* ctrl. reg. acces */
 	unsigned int		dpll_reset_reg; /* reg. index within syscon */
 	unsigned int		power_reg; /* power reg. index within syscon */
+	unsigned int		pcie_pcs_reg; /* pcs reg. index in syscon */
 	bool			sata_refclk_enabled;
 };
 
@@ -271,7 +276,16 @@ static int ti_pipe3_init(struct phy *x)
 	 * 18-1804.
 	 */
 	if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-pcie")) {
-		omap_control_pcie_pcs(phy->control_dev, 0x96);
+		if (phy->pcs_syscon) {
+			val = 0x96 << OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT;
+			ret = regmap_update_bits(phy->pcs_syscon,
+						 phy->pcie_pcs_reg,
+						 PCIE_PCS_MASK, val);
+			if (ret < 0)
+				return ret;
+		} else {
+			omap_control_pcie_pcs(phy->control_dev, 0x96);
+		}
 		return 0;
 	}
 
@@ -455,6 +469,22 @@ static int ti_pipe3_probe(struct platform_device *pdev)
 			dev_err(&pdev->dev, "unable to get div-clk\n");
 			return PTR_ERR(phy->div_clk);
 		}
+
+		phy->pcs_syscon = syscon_regmap_lookup_by_phandle(node,
+								  "syscon-pcs");
+		if (IS_ERR(phy->pcs_syscon)) {
+			dev_dbg(&pdev->dev,
+				 "can't get syscon-pcs, using omap control\n");
+			phy->pcs_syscon = NULL;
+		} else {
+			if (of_property_read_u32_index(node,
+						       "syscon-pcs", 1,
+						       &phy->pcie_pcs_reg)) {
+				dev_err(&pdev->dev,
+					"couldn't get pcie pcs reg. offset\n");
+				return -EINVAL;
+			}
+		}
 	} else {
 		phy->div_clk = ERR_PTR(-ENODEV);
 	}
-- 
1.7.9.5


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

* [PATCH 03/17] phy: ti-pipe3: use *syscon* framework to set PCS value of the PHY
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson, tony, balbi, rogerq, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-usb, kishon
  Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, linux,
	gregkh, nsekhar

Deprecate using phy-omap-control driver to set PCS value of the PHY
and start using *syscon* framework to do the same.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 Documentation/devicetree/bindings/phy/ti-phy.txt |    2 ++
 drivers/phy/phy-ti-pipe3.c                       |   32 +++++++++++++++++++++-
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
index d3ad3bf..52c7a92 100644
--- a/Documentation/devicetree/bindings/phy/ti-phy.txt
+++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
@@ -83,6 +83,8 @@ Optional properties:
  - syscon-pllreset: Handle to system control region that contains the
    CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0
    register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.
+ - syscon-pcs : phandle/offset pair. Phandle to the system control module and the
+   register offset to write the PCS delay value.
 
 Deprecated properties:
  - ctrl-module : phandle of the control module used by PHY driver to power on
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
index 78bac00..e2f9ad7 100644
--- a/drivers/phy/phy-ti-pipe3.c
+++ b/drivers/phy/phy-ti-pipe3.c
@@ -65,6 +65,9 @@
 #define PIPE3_PHY_TX_RX_POWERON		0x3
 #define PIPE3_PHY_TX_RX_POWEROFF	0x0
 
+#define PCIE_PCS_MASK			0xFF0000
+#define PCIE_PCS_DELAY_COUNT_SHIFT	0x10
+
 /*
  * This is an Empirical value that works, need to confirm the actual
  * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status
@@ -96,9 +99,11 @@ struct ti_pipe3 {
 	struct clk		*div_clk;
 	struct pipe3_dpll_map	*dpll_map;
 	struct regmap		*phy_power_syscon; /* ctrl. reg. acces */
+	struct regmap		*pcs_syscon; /* ctrl. reg. acces */
 	struct regmap		*dpll_reset_syscon; /* ctrl. reg. acces */
 	unsigned int		dpll_reset_reg; /* reg. index within syscon */
 	unsigned int		power_reg; /* power reg. index within syscon */
+	unsigned int		pcie_pcs_reg; /* pcs reg. index in syscon */
 	bool			sata_refclk_enabled;
 };
 
@@ -271,7 +276,16 @@ static int ti_pipe3_init(struct phy *x)
 	 * 18-1804.
 	 */
 	if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-pcie")) {
-		omap_control_pcie_pcs(phy->control_dev, 0x96);
+		if (phy->pcs_syscon) {
+			val = 0x96 << OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT;
+			ret = regmap_update_bits(phy->pcs_syscon,
+						 phy->pcie_pcs_reg,
+						 PCIE_PCS_MASK, val);
+			if (ret < 0)
+				return ret;
+		} else {
+			omap_control_pcie_pcs(phy->control_dev, 0x96);
+		}
 		return 0;
 	}
 
@@ -455,6 +469,22 @@ static int ti_pipe3_probe(struct platform_device *pdev)
 			dev_err(&pdev->dev, "unable to get div-clk\n");
 			return PTR_ERR(phy->div_clk);
 		}
+
+		phy->pcs_syscon = syscon_regmap_lookup_by_phandle(node,
+								  "syscon-pcs");
+		if (IS_ERR(phy->pcs_syscon)) {
+			dev_dbg(&pdev->dev,
+				 "can't get syscon-pcs, using omap control\n");
+			phy->pcs_syscon = NULL;
+		} else {
+			if (of_property_read_u32_index(node,
+						       "syscon-pcs", 1,
+						       &phy->pcie_pcs_reg)) {
+				dev_err(&pdev->dev,
+					"couldn't get pcie pcs reg. offset\n");
+				return -EINVAL;
+			}
+		}
 	} else {
 		phy->div_clk = ERR_PTR(-ENODEV);
 	}
-- 
1.7.9.5

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

* [PATCH 03/17] phy: ti-pipe3: use *syscon* framework to set PCS value of the PHY
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: linux-arm-kernel

Deprecate using phy-omap-control driver to set PCS value of the PHY
and start using *syscon* framework to do the same.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 Documentation/devicetree/bindings/phy/ti-phy.txt |    2 ++
 drivers/phy/phy-ti-pipe3.c                       |   32 +++++++++++++++++++++-
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
index d3ad3bf..52c7a92 100644
--- a/Documentation/devicetree/bindings/phy/ti-phy.txt
+++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
@@ -83,6 +83,8 @@ Optional properties:
  - syscon-pllreset: Handle to system control region that contains the
    CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0
    register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.
+ - syscon-pcs : phandle/offset pair. Phandle to the system control module and the
+   register offset to write the PCS delay value.
 
 Deprecated properties:
  - ctrl-module : phandle of the control module used by PHY driver to power on
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
index 78bac00..e2f9ad7 100644
--- a/drivers/phy/phy-ti-pipe3.c
+++ b/drivers/phy/phy-ti-pipe3.c
@@ -65,6 +65,9 @@
 #define PIPE3_PHY_TX_RX_POWERON		0x3
 #define PIPE3_PHY_TX_RX_POWEROFF	0x0
 
+#define PCIE_PCS_MASK			0xFF0000
+#define PCIE_PCS_DELAY_COUNT_SHIFT	0x10
+
 /*
  * This is an Empirical value that works, need to confirm the actual
  * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status
@@ -96,9 +99,11 @@ struct ti_pipe3 {
 	struct clk		*div_clk;
 	struct pipe3_dpll_map	*dpll_map;
 	struct regmap		*phy_power_syscon; /* ctrl. reg. acces */
+	struct regmap		*pcs_syscon; /* ctrl. reg. acces */
 	struct regmap		*dpll_reset_syscon; /* ctrl. reg. acces */
 	unsigned int		dpll_reset_reg; /* reg. index within syscon */
 	unsigned int		power_reg; /* power reg. index within syscon */
+	unsigned int		pcie_pcs_reg; /* pcs reg. index in syscon */
 	bool			sata_refclk_enabled;
 };
 
@@ -271,7 +276,16 @@ static int ti_pipe3_init(struct phy *x)
 	 * 18-1804.
 	 */
 	if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-pcie")) {
-		omap_control_pcie_pcs(phy->control_dev, 0x96);
+		if (phy->pcs_syscon) {
+			val = 0x96 << OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT;
+			ret = regmap_update_bits(phy->pcs_syscon,
+						 phy->pcie_pcs_reg,
+						 PCIE_PCS_MASK, val);
+			if (ret < 0)
+				return ret;
+		} else {
+			omap_control_pcie_pcs(phy->control_dev, 0x96);
+		}
 		return 0;
 	}
 
@@ -455,6 +469,22 @@ static int ti_pipe3_probe(struct platform_device *pdev)
 			dev_err(&pdev->dev, "unable to get div-clk\n");
 			return PTR_ERR(phy->div_clk);
 		}
+
+		phy->pcs_syscon = syscon_regmap_lookup_by_phandle(node,
+								  "syscon-pcs");
+		if (IS_ERR(phy->pcs_syscon)) {
+			dev_dbg(&pdev->dev,
+				 "can't get syscon-pcs, using omap control\n");
+			phy->pcs_syscon = NULL;
+		} else {
+			if (of_property_read_u32_index(node,
+						       "syscon-pcs", 1,
+						       &phy->pcie_pcs_reg)) {
+				dev_err(&pdev->dev,
+					"couldn't get pcie pcs reg. offset\n");
+				return -EINVAL;
+			}
+		}
 	} else {
 		phy->div_clk = ERR_PTR(-ENODEV);
 	}
-- 
1.7.9.5

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

* [PATCH 04/17] phy: omap-usb2: use omap_usb_power_off to power off the PHY during probe
  2015-06-23 11:58 ` Kishon Vijay Abraham I
  (?)
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  -1 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson, tony, balbi, rogerq, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-usb, kishon
  Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, linux,
	gregkh, nsekhar

No functional change. Previously omap_control_phy_power() was used to power
off the PHY during probe. But once phy-omap-usb2 driver is adapted to
use syscon, omap_control_phy_power() cannot be used. Hence used
omap_usb_power_off to power off the PHY.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/phy/phy-omap-usb2.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
index c1a4686..b5c266a 100644
--- a/drivers/phy/phy-omap-usb2.c
+++ b/drivers/phy/phy-omap-usb2.c
@@ -241,7 +241,6 @@ static int omap_usb2_probe(struct platform_device *pdev)
 	}
 
 	phy->control_dev = &control_pdev->dev;
-	omap_control_phy_power(phy->control_dev, 0);
 
 	otg->set_host		= omap_usb_set_host;
 	otg->set_peripheral	= omap_usb_set_peripheral;
@@ -261,6 +260,7 @@ static int omap_usb2_probe(struct platform_device *pdev)
 	}
 
 	phy_set_drvdata(generic_phy, phy);
+	omap_usb_power_off(generic_phy);
 
 	phy_provider = devm_of_phy_provider_register(phy->dev,
 			of_phy_simple_xlate);
-- 
1.7.9.5


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

* [PATCH 04/17] phy: omap-usb2: use omap_usb_power_off to power off the PHY during probe
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson, tony, balbi, rogerq, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-usb, kishon
  Cc: mark.rutland, linux, pawel.moll, ijc+devicetree, gregkh, nsekhar,
	robh+dt, galak

No functional change. Previously omap_control_phy_power() was used to power
off the PHY during probe. But once phy-omap-usb2 driver is adapted to
use syscon, omap_control_phy_power() cannot be used. Hence used
omap_usb_power_off to power off the PHY.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/phy/phy-omap-usb2.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
index c1a4686..b5c266a 100644
--- a/drivers/phy/phy-omap-usb2.c
+++ b/drivers/phy/phy-omap-usb2.c
@@ -241,7 +241,6 @@ static int omap_usb2_probe(struct platform_device *pdev)
 	}
 
 	phy->control_dev = &control_pdev->dev;
-	omap_control_phy_power(phy->control_dev, 0);
 
 	otg->set_host		= omap_usb_set_host;
 	otg->set_peripheral	= omap_usb_set_peripheral;
@@ -261,6 +260,7 @@ static int omap_usb2_probe(struct platform_device *pdev)
 	}
 
 	phy_set_drvdata(generic_phy, phy);
+	omap_usb_power_off(generic_phy);
 
 	phy_provider = devm_of_phy_provider_register(phy->dev,
 			of_phy_simple_xlate);
-- 
1.7.9.5

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

* [PATCH 04/17] phy: omap-usb2: use omap_usb_power_off to power off the PHY during probe
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: linux-arm-kernel

No functional change. Previously omap_control_phy_power() was used to power
off the PHY during probe. But once phy-omap-usb2 driver is adapted to
use syscon, omap_control_phy_power() cannot be used. Hence used
omap_usb_power_off to power off the PHY.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/phy/phy-omap-usb2.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
index c1a4686..b5c266a 100644
--- a/drivers/phy/phy-omap-usb2.c
+++ b/drivers/phy/phy-omap-usb2.c
@@ -241,7 +241,6 @@ static int omap_usb2_probe(struct platform_device *pdev)
 	}
 
 	phy->control_dev = &control_pdev->dev;
-	omap_control_phy_power(phy->control_dev, 0);
 
 	otg->set_host		= omap_usb_set_host;
 	otg->set_peripheral	= omap_usb_set_peripheral;
@@ -261,6 +260,7 @@ static int omap_usb2_probe(struct platform_device *pdev)
 	}
 
 	phy_set_drvdata(generic_phy, phy);
+	omap_usb_power_off(generic_phy);
 
 	phy_provider = devm_of_phy_provider_register(phy->dev,
 			of_phy_simple_xlate);
-- 
1.7.9.5

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

* [PATCH 05/17] phy: omap-usb2: Add a new compatible string for USB2 PHY2
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson, tony, balbi, rogerq, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-usb, kishon
  Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, linux,
	gregkh, nsekhar

The USB2 PHY2 has a different register map compared to USB2 PHY1
to power on/off the PHY. In order to handle it, add a new
"compatible" string.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 Documentation/devicetree/bindings/phy/ti-phy.txt |    2 ++
 drivers/phy/phy-omap-usb2.c                      |    9 +++++++++
 2 files changed, 11 insertions(+)

diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
index 52c7a92..b9101b9 100644
--- a/Documentation/devicetree/bindings/phy/ti-phy.txt
+++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
@@ -31,6 +31,8 @@ OMAP USB2 PHY
 
 Required properties:
  - compatible: Should be "ti,omap-usb2"
+	       Should be "ti,dra7x-usb2-phy2" for the 2nd instance of USB2 PHY
+			in DRA7x
  - reg : Address and length of the register set for the device.
  - #phy-cells: determine the number of cells that should be given in the
    phandle while referencing this phy.
diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
index b5c266a..2f7220f 100644
--- a/drivers/phy/phy-omap-usb2.c
+++ b/drivers/phy/phy-omap-usb2.c
@@ -159,6 +159,11 @@ static const struct usb_phy_data dra7x_usb2_data = {
 	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
 };
 
+static const struct usb_phy_data dra7x_usb2_phy2_data = {
+	.label = "dra7x_usb2_phy2",
+	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
+};
+
 static const struct usb_phy_data am437x_usb2_data = {
 	.label = "am437x_usb2",
 	.flags =  0,
@@ -178,6 +183,10 @@ static const struct of_device_id omap_usb2_id_table[] = {
 		.data = &dra7x_usb2_data,
 	},
 	{
+		.compatible = "ti,dra7x-usb2-phy2",
+		.data = &dra7x_usb2_phy2_data,
+	},
+	{
 		.compatible = "ti,am437x-usb2",
 		.data = &am437x_usb2_data,
 	},
-- 
1.7.9.5


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

* [PATCH 05/17] phy: omap-usb2: Add a new compatible string for USB2 PHY2
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson-rdvid1DuHRBWk0Htik3J/w, tony-4v6yS6AI5VpBDgjK7y7TUQ,
	balbi-l0cyMroinI0, rogerq-l0cyMroinI0,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, kishon-l0cyMroinI0
  Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8,
	mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0

The USB2 PHY2 has a different register map compared to USB2 PHY1
to power on/off the PHY. In order to handle it, add a new
"compatible" string.

Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
---
 Documentation/devicetree/bindings/phy/ti-phy.txt |    2 ++
 drivers/phy/phy-omap-usb2.c                      |    9 +++++++++
 2 files changed, 11 insertions(+)

diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
index 52c7a92..b9101b9 100644
--- a/Documentation/devicetree/bindings/phy/ti-phy.txt
+++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
@@ -31,6 +31,8 @@ OMAP USB2 PHY
 
 Required properties:
  - compatible: Should be "ti,omap-usb2"
+	       Should be "ti,dra7x-usb2-phy2" for the 2nd instance of USB2 PHY
+			in DRA7x
  - reg : Address and length of the register set for the device.
  - #phy-cells: determine the number of cells that should be given in the
    phandle while referencing this phy.
diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
index b5c266a..2f7220f 100644
--- a/drivers/phy/phy-omap-usb2.c
+++ b/drivers/phy/phy-omap-usb2.c
@@ -159,6 +159,11 @@ static const struct usb_phy_data dra7x_usb2_data = {
 	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
 };
 
+static const struct usb_phy_data dra7x_usb2_phy2_data = {
+	.label = "dra7x_usb2_phy2",
+	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
+};
+
 static const struct usb_phy_data am437x_usb2_data = {
 	.label = "am437x_usb2",
 	.flags =  0,
@@ -178,6 +183,10 @@ static const struct of_device_id omap_usb2_id_table[] = {
 		.data = &dra7x_usb2_data,
 	},
 	{
+		.compatible = "ti,dra7x-usb2-phy2",
+		.data = &dra7x_usb2_phy2_data,
+	},
+	{
 		.compatible = "ti,am437x-usb2",
 		.data = &am437x_usb2_data,
 	},
-- 
1.7.9.5

--
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] 150+ messages in thread

* [PATCH 05/17] phy: omap-usb2: Add a new compatible string for USB2 PHY2
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: linux-arm-kernel

The USB2 PHY2 has a different register map compared to USB2 PHY1
to power on/off the PHY. In order to handle it, add a new
"compatible" string.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 Documentation/devicetree/bindings/phy/ti-phy.txt |    2 ++
 drivers/phy/phy-omap-usb2.c                      |    9 +++++++++
 2 files changed, 11 insertions(+)

diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
index 52c7a92..b9101b9 100644
--- a/Documentation/devicetree/bindings/phy/ti-phy.txt
+++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
@@ -31,6 +31,8 @@ OMAP USB2 PHY
 
 Required properties:
  - compatible: Should be "ti,omap-usb2"
+	       Should be "ti,dra7x-usb2-phy2" for the 2nd instance of USB2 PHY
+			in DRA7x
  - reg : Address and length of the register set for the device.
  - #phy-cells: determine the number of cells that should be given in the
    phandle while referencing this phy.
diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
index b5c266a..2f7220f 100644
--- a/drivers/phy/phy-omap-usb2.c
+++ b/drivers/phy/phy-omap-usb2.c
@@ -159,6 +159,11 @@ static const struct usb_phy_data dra7x_usb2_data = {
 	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
 };
 
+static const struct usb_phy_data dra7x_usb2_phy2_data = {
+	.label = "dra7x_usb2_phy2",
+	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
+};
+
 static const struct usb_phy_data am437x_usb2_data = {
 	.label = "am437x_usb2",
 	.flags =  0,
@@ -178,6 +183,10 @@ static const struct of_device_id omap_usb2_id_table[] = {
 		.data = &dra7x_usb2_data,
 	},
 	{
+		.compatible = "ti,dra7x-usb2-phy2",
+		.data = &dra7x_usb2_phy2_data,
+	},
+	{
 		.compatible = "ti,am437x-usb2",
 		.data = &am437x_usb2_data,
 	},
-- 
1.7.9.5

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

* [PATCH 06/17] phy: omap-usb2: use *syscon* framework to power on/off the PHY
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson, tony, balbi, rogerq, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-usb, kishon
  Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, linux,
	gregkh, nsekhar

Deprecate using phy-omap-control driver to power on/off the PHY,
and use *syscon* framework to do the same. This handles
powering on/off the PHY for the USB2 PHYs used in various TI SoCs.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 Documentation/devicetree/bindings/phy/ti-phy.txt |    6 +-
 drivers/phy/phy-omap-usb2.c                      |  101 ++++++++++++++++++----
 include/linux/phy/omap_usb.h                     |   18 ++++
 3 files changed, 107 insertions(+), 18 deletions(-)

diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
index b9101b9..5bfe461 100644
--- a/Documentation/devicetree/bindings/phy/ti-phy.txt
+++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
@@ -42,10 +42,14 @@ Required properties:
    * "wkupclk" - wakeup clock.
    * "refclk" - reference clock (optional).
 
-Optional properties:
+Deprecated properties:
  - ctrl-module : phandle of the control module used by PHY driver to power on
    the PHY.
 
+Recommended properies:
+- syscon-phy-power : phandle/offset pair. Phandle to the system control
+  module and the register offset to power on/off the PHY.
+
 This is usually a subnode of ocp2scp to which it is connected.
 
 usb2phy@4a0ad080 {
diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
index 2f7220f..180b066 100644
--- a/drivers/phy/phy-omap-usb2.c
+++ b/drivers/phy/phy-omap-usb2.c
@@ -29,6 +29,8 @@
 #include <linux/delay.h>
 #include <linux/phy/omap_control_phy.h>
 #include <linux/phy/phy.h>
+#include <linux/mfd/syscon.h>
+#include <linux/regmap.h>
 #include <linux/of_platform.h>
 
 #define USB2PHY_DISCON_BYP_LATCH (1 << 31)
@@ -97,22 +99,65 @@ static int omap_usb_set_peripheral(struct usb_otg *otg,
 	return 0;
 }
 
-static int omap_usb_power_off(struct phy *x)
+static int omap_usb_phy_power(struct omap_usb *phy, int on)
 {
-	struct omap_usb *phy = phy_get_drvdata(x);
+	u32 val = 0;
+	u32 mask;
+	int ret;
 
-	omap_control_phy_power(phy->control_dev, 0);
+	if (phy->syscon_phy_power) {
+		switch (phy->type) {
+		case TYPE_USB2:
+			mask = OMAP_DEV_PHY_PD;
+			if (!on)
+				val = OMAP_DEV_PHY_PD;
+			break;
+		case TYPE_DRA7USB2:
+			mask = OMAP_USB2_PHY_PD;
+			if (!on)
+				val = OMAP_USB2_PHY_PD;
+			break;
+		case TYPE_AM437USB2:
+			mask = AM437X_USB2_PHY_PD |
+				AM437X_USB2_OTG_PD |
+				AM437X_USB2_OTGVDET_EN |
+				AM437X_USB2_OTGSESSEND_EN;
+			if (on) {
+				val = AM437X_USB2_OTGVDET_EN |
+					AM437X_USB2_OTGSESSEND_EN;
+			} else {
+				val = AM437X_USB2_PHY_PD | AM437X_USB2_OTG_PD;
+			}
+			break;
+		default:
+			dev_err(phy->dev, "%s: type %d not recognized\n",
+				__func__, phy->type);
+			return -EINVAL;
+		}
+
+		ret = regmap_update_bits(phy->syscon_phy_power, phy->power_reg,
+					 mask, val);
+		if (ret < 0)
+			return ret;
+	} else {
+		omap_control_phy_power(phy->control_dev, on);
+	}
 
 	return 0;
 }
 
-static int omap_usb_power_on(struct phy *x)
+static int omap_usb_power_off(struct phy *x)
 {
 	struct omap_usb *phy = phy_get_drvdata(x);
 
-	omap_control_phy_power(phy->control_dev, 1);
+	return omap_usb_phy_power(phy, false);
+}
 
-	return 0;
+static int omap_usb_power_on(struct phy *x)
+{
+	struct omap_usb *phy = phy_get_drvdata(x);
+
+	return omap_usb_phy_power(phy, true);
 }
 
 static int omap_usb_init(struct phy *x)
@@ -147,26 +192,31 @@ static struct phy_ops ops = {
 static const struct usb_phy_data omap_usb2_data = {
 	.label = "omap_usb2",
 	.flags = OMAP_USB2_HAS_START_SRP | OMAP_USB2_HAS_SET_VBUS,
+	.type = TYPE_USB2,
 };
 
 static const struct usb_phy_data omap5_usb2_data = {
 	.label = "omap5_usb2",
 	.flags = 0,
+	.type = TYPE_USB2,
 };
 
 static const struct usb_phy_data dra7x_usb2_data = {
 	.label = "dra7x_usb2",
 	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
+	.type = TYPE_USB2,
 };
 
 static const struct usb_phy_data dra7x_usb2_phy2_data = {
 	.label = "dra7x_usb2_phy2",
 	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
+	.type = TYPE_DRA7USB2,
 };
 
 static const struct usb_phy_data am437x_usb2_data = {
 	.label = "am437x_usb2",
 	.flags =  0,
+	.type = TYPE_AM437USB2,
 };
 
 static const struct of_device_id omap_usb2_id_table[] = {
@@ -223,6 +273,7 @@ static int omap_usb2_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	phy->dev		= &pdev->dev;
+	phy->type		= phy_data->type;
 
 	phy->phy.dev		= phy->dev;
 	phy->phy.label		= phy_data->label;
@@ -237,20 +288,36 @@ static int omap_usb2_probe(struct platform_device *pdev)
 		phy->flags |= OMAP_USB2_CALIBRATE_FALSE_DISCONNECT;
 	}
 
-	control_node = of_parse_phandle(node, "ctrl-module", 0);
-	if (!control_node) {
-		dev_err(&pdev->dev, "Failed to get control device phandle\n");
-		return -EINVAL;
-	}
+	phy->syscon_phy_power = syscon_regmap_lookup_by_phandle(node,
+							"syscon-phy-power");
+	if (IS_ERR(phy->syscon_phy_power)) {
+		dev_info(&pdev->dev,
+			 "can't get syscon-phy-power, using control device\n");
+		phy->syscon_phy_power = NULL;
+
+		control_node = of_parse_phandle(node, "ctrl-module", 0);
+		if (!control_node) {
+			dev_err(&pdev->dev,
+				"Failed to get control device phandle\n");
+			return -EINVAL;
+		}
 
-	control_pdev = of_find_device_by_node(control_node);
-	if (!control_pdev) {
-		dev_err(&pdev->dev, "Failed to get control device\n");
-		return -EINVAL;
+		control_pdev = of_find_device_by_node(control_node);
+		if (!control_pdev) {
+			dev_err(&pdev->dev, "Failed to get control device\n");
+			return -EINVAL;
+		}
+		phy->control_dev = &control_pdev->dev;
+	} else {
+		if (of_property_read_u32_index(node,
+					       "syscon-phy-power", 1,
+					       &phy->power_reg)) {
+			dev_err(&pdev->dev,
+				"couldn't get power reg. offset\n");
+			return -EINVAL;
+		}
 	}
 
-	phy->control_dev = &control_pdev->dev;
-
 	otg->set_host		= omap_usb_set_host;
 	otg->set_peripheral	= omap_usb_set_peripheral;
 	if (phy_data->flags & OMAP_USB2_HAS_SET_VBUS)
diff --git a/include/linux/phy/omap_usb.h b/include/linux/phy/omap_usb.h
index dc2c541..de933ab 100644
--- a/include/linux/phy/omap_usb.h
+++ b/include/linux/phy/omap_usb.h
@@ -30,6 +30,12 @@ struct usb_dpll_params {
 	u32	mf;
 };
 
+enum omap_usb_phy_type {
+	TYPE_USB2,    /* USB2_PHY, power down in CONTROL_DEV_CONF */
+	TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */
+	TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */
+};
+
 struct omap_usb {
 	struct usb_phy		phy;
 	struct phy_companion	*comparator;
@@ -40,11 +46,15 @@ struct omap_usb {
 	struct clk		*wkupclk;
 	struct clk		*optclk;
 	u8			flags;
+	enum omap_usb_phy_type	type;
+	struct regmap		*syscon_phy_power; /* ctrl. reg. acces */
+	unsigned int		power_reg; /* power reg. index within syscon */
 };
 
 struct usb_phy_data {
 	const char *label;
 	u8 flags;
+	enum omap_usb_phy_type type;
 };
 
 /* Driver Flags */
@@ -52,6 +62,14 @@ struct usb_phy_data {
 #define OMAP_USB2_HAS_SET_VBUS (1 << 1)
 #define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT (1 << 2)
 
+#define OMAP_DEV_PHY_PD		BIT(0)
+#define OMAP_USB2_PHY_PD	BIT(28)
+
+#define AM437X_USB2_PHY_PD		BIT(0)
+#define AM437X_USB2_OTG_PD		BIT(1)
+#define AM437X_USB2_OTGVDET_EN		BIT(19)
+#define AM437X_USB2_OTGSESSEND_EN	BIT(20)
+
 #define	phy_to_omapusb(x)	container_of((x), struct omap_usb, phy)
 
 #if defined(CONFIG_OMAP_USB2) || defined(CONFIG_OMAP_USB2_MODULE)
-- 
1.7.9.5


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

* [PATCH 06/17] phy: omap-usb2: use *syscon* framework to power on/off the PHY
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson-rdvid1DuHRBWk0Htik3J/w, tony-4v6yS6AI5VpBDgjK7y7TUQ,
	balbi-l0cyMroinI0, rogerq-l0cyMroinI0,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, kishon-l0cyMroinI0
  Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8,
	mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0

Deprecate using phy-omap-control driver to power on/off the PHY,
and use *syscon* framework to do the same. This handles
powering on/off the PHY for the USB2 PHYs used in various TI SoCs.

Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
---
 Documentation/devicetree/bindings/phy/ti-phy.txt |    6 +-
 drivers/phy/phy-omap-usb2.c                      |  101 ++++++++++++++++++----
 include/linux/phy/omap_usb.h                     |   18 ++++
 3 files changed, 107 insertions(+), 18 deletions(-)

diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
index b9101b9..5bfe461 100644
--- a/Documentation/devicetree/bindings/phy/ti-phy.txt
+++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
@@ -42,10 +42,14 @@ Required properties:
    * "wkupclk" - wakeup clock.
    * "refclk" - reference clock (optional).
 
-Optional properties:
+Deprecated properties:
  - ctrl-module : phandle of the control module used by PHY driver to power on
    the PHY.
 
+Recommended properies:
+- syscon-phy-power : phandle/offset pair. Phandle to the system control
+  module and the register offset to power on/off the PHY.
+
 This is usually a subnode of ocp2scp to which it is connected.
 
 usb2phy@4a0ad080 {
diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
index 2f7220f..180b066 100644
--- a/drivers/phy/phy-omap-usb2.c
+++ b/drivers/phy/phy-omap-usb2.c
@@ -29,6 +29,8 @@
 #include <linux/delay.h>
 #include <linux/phy/omap_control_phy.h>
 #include <linux/phy/phy.h>
+#include <linux/mfd/syscon.h>
+#include <linux/regmap.h>
 #include <linux/of_platform.h>
 
 #define USB2PHY_DISCON_BYP_LATCH (1 << 31)
@@ -97,22 +99,65 @@ static int omap_usb_set_peripheral(struct usb_otg *otg,
 	return 0;
 }
 
-static int omap_usb_power_off(struct phy *x)
+static int omap_usb_phy_power(struct omap_usb *phy, int on)
 {
-	struct omap_usb *phy = phy_get_drvdata(x);
+	u32 val = 0;
+	u32 mask;
+	int ret;
 
-	omap_control_phy_power(phy->control_dev, 0);
+	if (phy->syscon_phy_power) {
+		switch (phy->type) {
+		case TYPE_USB2:
+			mask = OMAP_DEV_PHY_PD;
+			if (!on)
+				val = OMAP_DEV_PHY_PD;
+			break;
+		case TYPE_DRA7USB2:
+			mask = OMAP_USB2_PHY_PD;
+			if (!on)
+				val = OMAP_USB2_PHY_PD;
+			break;
+		case TYPE_AM437USB2:
+			mask = AM437X_USB2_PHY_PD |
+				AM437X_USB2_OTG_PD |
+				AM437X_USB2_OTGVDET_EN |
+				AM437X_USB2_OTGSESSEND_EN;
+			if (on) {
+				val = AM437X_USB2_OTGVDET_EN |
+					AM437X_USB2_OTGSESSEND_EN;
+			} else {
+				val = AM437X_USB2_PHY_PD | AM437X_USB2_OTG_PD;
+			}
+			break;
+		default:
+			dev_err(phy->dev, "%s: type %d not recognized\n",
+				__func__, phy->type);
+			return -EINVAL;
+		}
+
+		ret = regmap_update_bits(phy->syscon_phy_power, phy->power_reg,
+					 mask, val);
+		if (ret < 0)
+			return ret;
+	} else {
+		omap_control_phy_power(phy->control_dev, on);
+	}
 
 	return 0;
 }
 
-static int omap_usb_power_on(struct phy *x)
+static int omap_usb_power_off(struct phy *x)
 {
 	struct omap_usb *phy = phy_get_drvdata(x);
 
-	omap_control_phy_power(phy->control_dev, 1);
+	return omap_usb_phy_power(phy, false);
+}
 
-	return 0;
+static int omap_usb_power_on(struct phy *x)
+{
+	struct omap_usb *phy = phy_get_drvdata(x);
+
+	return omap_usb_phy_power(phy, true);
 }
 
 static int omap_usb_init(struct phy *x)
@@ -147,26 +192,31 @@ static struct phy_ops ops = {
 static const struct usb_phy_data omap_usb2_data = {
 	.label = "omap_usb2",
 	.flags = OMAP_USB2_HAS_START_SRP | OMAP_USB2_HAS_SET_VBUS,
+	.type = TYPE_USB2,
 };
 
 static const struct usb_phy_data omap5_usb2_data = {
 	.label = "omap5_usb2",
 	.flags = 0,
+	.type = TYPE_USB2,
 };
 
 static const struct usb_phy_data dra7x_usb2_data = {
 	.label = "dra7x_usb2",
 	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
+	.type = TYPE_USB2,
 };
 
 static const struct usb_phy_data dra7x_usb2_phy2_data = {
 	.label = "dra7x_usb2_phy2",
 	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
+	.type = TYPE_DRA7USB2,
 };
 
 static const struct usb_phy_data am437x_usb2_data = {
 	.label = "am437x_usb2",
 	.flags =  0,
+	.type = TYPE_AM437USB2,
 };
 
 static const struct of_device_id omap_usb2_id_table[] = {
@@ -223,6 +273,7 @@ static int omap_usb2_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	phy->dev		= &pdev->dev;
+	phy->type		= phy_data->type;
 
 	phy->phy.dev		= phy->dev;
 	phy->phy.label		= phy_data->label;
@@ -237,20 +288,36 @@ static int omap_usb2_probe(struct platform_device *pdev)
 		phy->flags |= OMAP_USB2_CALIBRATE_FALSE_DISCONNECT;
 	}
 
-	control_node = of_parse_phandle(node, "ctrl-module", 0);
-	if (!control_node) {
-		dev_err(&pdev->dev, "Failed to get control device phandle\n");
-		return -EINVAL;
-	}
+	phy->syscon_phy_power = syscon_regmap_lookup_by_phandle(node,
+							"syscon-phy-power");
+	if (IS_ERR(phy->syscon_phy_power)) {
+		dev_info(&pdev->dev,
+			 "can't get syscon-phy-power, using control device\n");
+		phy->syscon_phy_power = NULL;
+
+		control_node = of_parse_phandle(node, "ctrl-module", 0);
+		if (!control_node) {
+			dev_err(&pdev->dev,
+				"Failed to get control device phandle\n");
+			return -EINVAL;
+		}
 
-	control_pdev = of_find_device_by_node(control_node);
-	if (!control_pdev) {
-		dev_err(&pdev->dev, "Failed to get control device\n");
-		return -EINVAL;
+		control_pdev = of_find_device_by_node(control_node);
+		if (!control_pdev) {
+			dev_err(&pdev->dev, "Failed to get control device\n");
+			return -EINVAL;
+		}
+		phy->control_dev = &control_pdev->dev;
+	} else {
+		if (of_property_read_u32_index(node,
+					       "syscon-phy-power", 1,
+					       &phy->power_reg)) {
+			dev_err(&pdev->dev,
+				"couldn't get power reg. offset\n");
+			return -EINVAL;
+		}
 	}
 
-	phy->control_dev = &control_pdev->dev;
-
 	otg->set_host		= omap_usb_set_host;
 	otg->set_peripheral	= omap_usb_set_peripheral;
 	if (phy_data->flags & OMAP_USB2_HAS_SET_VBUS)
diff --git a/include/linux/phy/omap_usb.h b/include/linux/phy/omap_usb.h
index dc2c541..de933ab 100644
--- a/include/linux/phy/omap_usb.h
+++ b/include/linux/phy/omap_usb.h
@@ -30,6 +30,12 @@ struct usb_dpll_params {
 	u32	mf;
 };
 
+enum omap_usb_phy_type {
+	TYPE_USB2,    /* USB2_PHY, power down in CONTROL_DEV_CONF */
+	TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */
+	TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */
+};
+
 struct omap_usb {
 	struct usb_phy		phy;
 	struct phy_companion	*comparator;
@@ -40,11 +46,15 @@ struct omap_usb {
 	struct clk		*wkupclk;
 	struct clk		*optclk;
 	u8			flags;
+	enum omap_usb_phy_type	type;
+	struct regmap		*syscon_phy_power; /* ctrl. reg. acces */
+	unsigned int		power_reg; /* power reg. index within syscon */
 };
 
 struct usb_phy_data {
 	const char *label;
 	u8 flags;
+	enum omap_usb_phy_type type;
 };
 
 /* Driver Flags */
@@ -52,6 +62,14 @@ struct usb_phy_data {
 #define OMAP_USB2_HAS_SET_VBUS (1 << 1)
 #define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT (1 << 2)
 
+#define OMAP_DEV_PHY_PD		BIT(0)
+#define OMAP_USB2_PHY_PD	BIT(28)
+
+#define AM437X_USB2_PHY_PD		BIT(0)
+#define AM437X_USB2_OTG_PD		BIT(1)
+#define AM437X_USB2_OTGVDET_EN		BIT(19)
+#define AM437X_USB2_OTGSESSEND_EN	BIT(20)
+
 #define	phy_to_omapusb(x)	container_of((x), struct omap_usb, phy)
 
 #if defined(CONFIG_OMAP_USB2) || defined(CONFIG_OMAP_USB2_MODULE)
-- 
1.7.9.5

--
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] 150+ messages in thread

* [PATCH 06/17] phy: omap-usb2: use *syscon* framework to power on/off the PHY
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: linux-arm-kernel

Deprecate using phy-omap-control driver to power on/off the PHY,
and use *syscon* framework to do the same. This handles
powering on/off the PHY for the USB2 PHYs used in various TI SoCs.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 Documentation/devicetree/bindings/phy/ti-phy.txt |    6 +-
 drivers/phy/phy-omap-usb2.c                      |  101 ++++++++++++++++++----
 include/linux/phy/omap_usb.h                     |   18 ++++
 3 files changed, 107 insertions(+), 18 deletions(-)

diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
index b9101b9..5bfe461 100644
--- a/Documentation/devicetree/bindings/phy/ti-phy.txt
+++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
@@ -42,10 +42,14 @@ Required properties:
    * "wkupclk" - wakeup clock.
    * "refclk" - reference clock (optional).
 
-Optional properties:
+Deprecated properties:
  - ctrl-module : phandle of the control module used by PHY driver to power on
    the PHY.
 
+Recommended properies:
+- syscon-phy-power : phandle/offset pair. Phandle to the system control
+  module and the register offset to power on/off the PHY.
+
 This is usually a subnode of ocp2scp to which it is connected.
 
 usb2phy at 4a0ad080 {
diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
index 2f7220f..180b066 100644
--- a/drivers/phy/phy-omap-usb2.c
+++ b/drivers/phy/phy-omap-usb2.c
@@ -29,6 +29,8 @@
 #include <linux/delay.h>
 #include <linux/phy/omap_control_phy.h>
 #include <linux/phy/phy.h>
+#include <linux/mfd/syscon.h>
+#include <linux/regmap.h>
 #include <linux/of_platform.h>
 
 #define USB2PHY_DISCON_BYP_LATCH (1 << 31)
@@ -97,22 +99,65 @@ static int omap_usb_set_peripheral(struct usb_otg *otg,
 	return 0;
 }
 
-static int omap_usb_power_off(struct phy *x)
+static int omap_usb_phy_power(struct omap_usb *phy, int on)
 {
-	struct omap_usb *phy = phy_get_drvdata(x);
+	u32 val = 0;
+	u32 mask;
+	int ret;
 
-	omap_control_phy_power(phy->control_dev, 0);
+	if (phy->syscon_phy_power) {
+		switch (phy->type) {
+		case TYPE_USB2:
+			mask = OMAP_DEV_PHY_PD;
+			if (!on)
+				val = OMAP_DEV_PHY_PD;
+			break;
+		case TYPE_DRA7USB2:
+			mask = OMAP_USB2_PHY_PD;
+			if (!on)
+				val = OMAP_USB2_PHY_PD;
+			break;
+		case TYPE_AM437USB2:
+			mask = AM437X_USB2_PHY_PD |
+				AM437X_USB2_OTG_PD |
+				AM437X_USB2_OTGVDET_EN |
+				AM437X_USB2_OTGSESSEND_EN;
+			if (on) {
+				val = AM437X_USB2_OTGVDET_EN |
+					AM437X_USB2_OTGSESSEND_EN;
+			} else {
+				val = AM437X_USB2_PHY_PD | AM437X_USB2_OTG_PD;
+			}
+			break;
+		default:
+			dev_err(phy->dev, "%s: type %d not recognized\n",
+				__func__, phy->type);
+			return -EINVAL;
+		}
+
+		ret = regmap_update_bits(phy->syscon_phy_power, phy->power_reg,
+					 mask, val);
+		if (ret < 0)
+			return ret;
+	} else {
+		omap_control_phy_power(phy->control_dev, on);
+	}
 
 	return 0;
 }
 
-static int omap_usb_power_on(struct phy *x)
+static int omap_usb_power_off(struct phy *x)
 {
 	struct omap_usb *phy = phy_get_drvdata(x);
 
-	omap_control_phy_power(phy->control_dev, 1);
+	return omap_usb_phy_power(phy, false);
+}
 
-	return 0;
+static int omap_usb_power_on(struct phy *x)
+{
+	struct omap_usb *phy = phy_get_drvdata(x);
+
+	return omap_usb_phy_power(phy, true);
 }
 
 static int omap_usb_init(struct phy *x)
@@ -147,26 +192,31 @@ static struct phy_ops ops = {
 static const struct usb_phy_data omap_usb2_data = {
 	.label = "omap_usb2",
 	.flags = OMAP_USB2_HAS_START_SRP | OMAP_USB2_HAS_SET_VBUS,
+	.type = TYPE_USB2,
 };
 
 static const struct usb_phy_data omap5_usb2_data = {
 	.label = "omap5_usb2",
 	.flags = 0,
+	.type = TYPE_USB2,
 };
 
 static const struct usb_phy_data dra7x_usb2_data = {
 	.label = "dra7x_usb2",
 	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
+	.type = TYPE_USB2,
 };
 
 static const struct usb_phy_data dra7x_usb2_phy2_data = {
 	.label = "dra7x_usb2_phy2",
 	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
+	.type = TYPE_DRA7USB2,
 };
 
 static const struct usb_phy_data am437x_usb2_data = {
 	.label = "am437x_usb2",
 	.flags =  0,
+	.type = TYPE_AM437USB2,
 };
 
 static const struct of_device_id omap_usb2_id_table[] = {
@@ -223,6 +273,7 @@ static int omap_usb2_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	phy->dev		= &pdev->dev;
+	phy->type		= phy_data->type;
 
 	phy->phy.dev		= phy->dev;
 	phy->phy.label		= phy_data->label;
@@ -237,20 +288,36 @@ static int omap_usb2_probe(struct platform_device *pdev)
 		phy->flags |= OMAP_USB2_CALIBRATE_FALSE_DISCONNECT;
 	}
 
-	control_node = of_parse_phandle(node, "ctrl-module", 0);
-	if (!control_node) {
-		dev_err(&pdev->dev, "Failed to get control device phandle\n");
-		return -EINVAL;
-	}
+	phy->syscon_phy_power = syscon_regmap_lookup_by_phandle(node,
+							"syscon-phy-power");
+	if (IS_ERR(phy->syscon_phy_power)) {
+		dev_info(&pdev->dev,
+			 "can't get syscon-phy-power, using control device\n");
+		phy->syscon_phy_power = NULL;
+
+		control_node = of_parse_phandle(node, "ctrl-module", 0);
+		if (!control_node) {
+			dev_err(&pdev->dev,
+				"Failed to get control device phandle\n");
+			return -EINVAL;
+		}
 
-	control_pdev = of_find_device_by_node(control_node);
-	if (!control_pdev) {
-		dev_err(&pdev->dev, "Failed to get control device\n");
-		return -EINVAL;
+		control_pdev = of_find_device_by_node(control_node);
+		if (!control_pdev) {
+			dev_err(&pdev->dev, "Failed to get control device\n");
+			return -EINVAL;
+		}
+		phy->control_dev = &control_pdev->dev;
+	} else {
+		if (of_property_read_u32_index(node,
+					       "syscon-phy-power", 1,
+					       &phy->power_reg)) {
+			dev_err(&pdev->dev,
+				"couldn't get power reg. offset\n");
+			return -EINVAL;
+		}
 	}
 
-	phy->control_dev = &control_pdev->dev;
-
 	otg->set_host		= omap_usb_set_host;
 	otg->set_peripheral	= omap_usb_set_peripheral;
 	if (phy_data->flags & OMAP_USB2_HAS_SET_VBUS)
diff --git a/include/linux/phy/omap_usb.h b/include/linux/phy/omap_usb.h
index dc2c541..de933ab 100644
--- a/include/linux/phy/omap_usb.h
+++ b/include/linux/phy/omap_usb.h
@@ -30,6 +30,12 @@ struct usb_dpll_params {
 	u32	mf;
 };
 
+enum omap_usb_phy_type {
+	TYPE_USB2,    /* USB2_PHY, power down in CONTROL_DEV_CONF */
+	TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */
+	TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */
+};
+
 struct omap_usb {
 	struct usb_phy		phy;
 	struct phy_companion	*comparator;
@@ -40,11 +46,15 @@ struct omap_usb {
 	struct clk		*wkupclk;
 	struct clk		*optclk;
 	u8			flags;
+	enum omap_usb_phy_type	type;
+	struct regmap		*syscon_phy_power; /* ctrl. reg. acces */
+	unsigned int		power_reg; /* power reg. index within syscon */
 };
 
 struct usb_phy_data {
 	const char *label;
 	u8 flags;
+	enum omap_usb_phy_type type;
 };
 
 /* Driver Flags */
@@ -52,6 +62,14 @@ struct usb_phy_data {
 #define OMAP_USB2_HAS_SET_VBUS (1 << 1)
 #define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT (1 << 2)
 
+#define OMAP_DEV_PHY_PD		BIT(0)
+#define OMAP_USB2_PHY_PD	BIT(28)
+
+#define AM437X_USB2_PHY_PD		BIT(0)
+#define AM437X_USB2_OTG_PD		BIT(1)
+#define AM437X_USB2_OTGVDET_EN		BIT(19)
+#define AM437X_USB2_OTGSESSEND_EN	BIT(20)
+
 #define	phy_to_omapusb(x)	container_of((x), struct omap_usb, phy)
 
 #if defined(CONFIG_OMAP_USB2) || defined(CONFIG_OMAP_USB2_MODULE)
-- 
1.7.9.5

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

* [PATCH 07/17] usb: musb: omap2430: use *syscon* framework to write to mailbox register
  2015-06-23 11:58 ` Kishon Vijay Abraham I
  (?)
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  -1 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson, tony, balbi, rogerq, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-usb, kishon
  Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, linux,
	gregkh, nsekhar

Deprecate using phy-omap-control driver to write to the mailbox register
and start using *syscon* framework to do the same.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 Documentation/devicetree/bindings/usb/omap-usb.txt |    7 +-
 drivers/usb/musb/omap2430.c                        |  118 ++++++++++++++++----
 2 files changed, 102 insertions(+), 23 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt
index 38d9bb8..c001306 100644
--- a/Documentation/devicetree/bindings/usb/omap-usb.txt
+++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
@@ -20,10 +20,15 @@ OMAP MUSB GLUE
  - phy-names : the names of the PHY corresponding to the PHYs present in the
    *phy* phandle.
 
-Optional properties:
+Optional Properties:
+Deprecated properties:
  - ctrl-module : phandle of the control module this glue uses to write to
    mailbox
 
+Recommended properies:
+ - syscon-otghs : phandle/offset pair. Phandle to the system control module and the
+   register offset of the mailbox.
+
 SOC specific device node entry
 usb_otg_hs: usb_otg_hs@4a0ab000 {
 	compatible = "ti,omap4-musb";
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index cc752d8..bcd6d1e 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -39,16 +39,27 @@
 #include <linux/usb/musb-omap.h>
 #include <linux/phy/omap_control_phy.h>
 #include <linux/of_platform.h>
+#include <linux/regmap.h>
+#include <linux/mfd/syscon.h>
 
 #include "musb_core.h"
 #include "omap2430.h"
 
+#define OMAP2430_MUSB_MODE_MASK	0x1f
+#define OMAP2430_MUSB_AVALID	(0x1 << 0)
+#define OMAP2430_MUSB_BVALID	(0x1 << 1)
+#define OMAP2430_MUSB_VBUSVALID	(0x1 << 2)
+#define OMAP2430_MUSB_SESSEND	(0x1 << 3)
+#define OMAP2430_MUSB_IDDIG	(0x1 << 4)
+
 struct omap2430_glue {
 	struct device		*dev;
 	struct platform_device	*musb;
 	enum omap_musb_vbus_id_status status;
 	struct work_struct	omap_musb_mailbox_work;
 	struct device		*control_otghs;
+	struct regmap		*syscon_otghs; /* ctrl. reg. acces */
+	unsigned int            otghs_reg; /* otghs reg. index within syscon */
 };
 #define glue_to_musb(g)		platform_get_drvdata(g->musb)
 
@@ -253,6 +264,47 @@ void omap_musb_mailbox(enum omap_musb_vbus_id_status status)
 }
 EXPORT_SYMBOL_GPL(omap_musb_mailbox);
 
+static void omap2430_musb_set_usbmode(struct omap2430_glue *glue,
+				      enum omap_control_usb_mode mode)
+{
+	u32 val;
+	int ret;
+
+	if (glue->syscon_otghs) {
+		switch (mode) {
+		case USB_MODE_HOST:
+			val = OMAP2430_MUSB_AVALID | OMAP2430_MUSB_VBUSVALID;
+			break;
+
+		case USB_MODE_DEVICE:
+			val = OMAP2430_MUSB_IDDIG | OMAP2430_MUSB_AVALID |
+				OMAP2430_MUSB_VBUSVALID;
+			break;
+
+		case USB_MODE_DISCONNECT:
+			val = OMAP2430_MUSB_IDDIG | OMAP2430_MUSB_SESSEND;
+			break;
+
+		default:
+			dev_dbg(glue->dev, "Invalid mode\n");
+			goto err_regmap_update;
+		}
+
+		ret = regmap_update_bits(glue->syscon_otghs,
+					 glue->otghs_reg,
+					 OMAP2430_MUSB_MODE_MASK, val);
+		if (ret < 0)
+			goto err_regmap_update;
+	} else {
+		omap_control_usb_set_mode(glue->control_otghs, mode);
+	}
+
+	return;
+
+err_regmap_update:
+	dev_err(glue->dev, "Failed to set mode to %d\n", mode);
+}
+
 static void omap_musb_set_mailbox(struct omap2430_glue *glue)
 {
 	struct musb *musb = glue_to_musb(glue);
@@ -270,8 +322,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
 		musb->xceiv->last_event = USB_EVENT_ID;
 		if (musb->gadget_driver) {
 			pm_runtime_get_sync(dev);
-			omap_control_usb_set_mode(glue->control_otghs,
-				USB_MODE_HOST);
+			omap2430_musb_set_usbmode(glue, USB_MODE_HOST);
 			omap2430_musb_set_vbus(musb, 1);
 		}
 		break;
@@ -284,7 +335,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
 		musb->xceiv->last_event = USB_EVENT_VBUS;
 		if (musb->gadget_driver)
 			pm_runtime_get_sync(dev);
-		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE);
+		omap2430_musb_set_usbmode(glue, USB_MODE_DEVICE);
 		break;
 
 	case OMAP_MUSB_ID_FLOAT:
@@ -301,8 +352,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
 		if (data->interface_type == MUSB_INTERFACE_UTMI)
 			otg_set_vbus(musb->xceiv->otg, 0);
 
-		omap_control_usb_set_mode(glue->control_otghs,
-			USB_MODE_DISCONNECT);
+		omap2430_musb_set_usbmode(glue, USB_MODE_DISCONNECT);
 		break;
 	default:
 		dev_dbg(dev, "ID float\n");
@@ -444,7 +494,7 @@ static void omap2430_musb_enable(struct musb *musb)
 	switch (glue->status) {
 
 	case OMAP_MUSB_ID_GROUND:
-		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_HOST);
+		omap2430_musb_set_usbmode(glue, USB_MODE_HOST);
 		if (data->interface_type != MUSB_INTERFACE_UTMI)
 			break;
 		devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
@@ -463,7 +513,7 @@ static void omap2430_musb_enable(struct musb *musb)
 		break;
 
 	case OMAP_MUSB_VBUS_VALID:
-		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE);
+		omap2430_musb_set_usbmode(glue, USB_MODE_DEVICE);
 		break;
 
 	default:
@@ -477,8 +527,7 @@ static void omap2430_musb_disable(struct musb *musb)
 	struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
 
 	if (glue->status != OMAP_MUSB_UNKNOWN)
-		omap_control_usb_set_mode(glue->control_otghs,
-			USB_MODE_DISCONNECT);
+		omap2430_musb_set_usbmode(glue, USB_MODE_DISCONNECT);
 }
 
 static int omap2430_musb_exit(struct musb *musb)
@@ -507,6 +556,40 @@ static const struct musb_platform_ops omap2430_ops = {
 
 static u64 omap2430_dmamask = DMA_BIT_MASK(32);
 
+static int omap2430_get_control(struct omap2430_glue *glue,
+				struct device_node *np)
+{
+	struct device_node *control_node;
+	struct platform_device *control_pdev;
+
+	glue->syscon_otghs = syscon_regmap_lookup_by_phandle(np,
+							     "syscon-otghs");
+	if (IS_ERR(glue->syscon_otghs)) {
+		dev_info(glue->dev, "can't get syscon, using control device\n");
+		glue->syscon_otghs = NULL;
+
+		control_node = of_parse_phandle(np, "ctrl-module", 0);
+		if (control_node) {
+			control_pdev = of_find_device_by_node(control_node);
+			if (!control_pdev) {
+				dev_err(glue->dev,
+					"Failed to get control device\n");
+				return -EINVAL;
+			}
+			glue->control_otghs = &control_pdev->dev;
+		}
+	} else {
+		if (of_property_read_u32_index(np, "syscon-otghs", 1,
+					       &glue->otghs_reg)) {
+			dev_err(glue->dev,
+				"couldn't get otghs reg. offset\n");
+			return -EINVAL;
+		}
+	}
+
+	return 0;
+}
+
 static int omap2430_probe(struct platform_device *pdev)
 {
 	struct resource			musb_resources[3];
@@ -538,9 +621,6 @@ static int omap2430_probe(struct platform_device *pdev)
 	glue->control_otghs = ERR_PTR(-ENODEV);
 
 	if (np) {
-		struct device_node *control_node;
-		struct platform_device *control_pdev;
-
 		pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
 		if (!pdata)
 			goto err2;
@@ -567,16 +647,10 @@ static int omap2430_probe(struct platform_device *pdev)
 		pdata->board_data	= data;
 		pdata->config		= config;
 
-		control_node = of_parse_phandle(np, "ctrl-module", 0);
-		if (control_node) {
-			control_pdev = of_find_device_by_node(control_node);
-			if (!control_pdev) {
-				dev_err(&pdev->dev, "Failed to get control device\n");
-				ret = -EINVAL;
-				goto err2;
-			}
-			glue->control_otghs = &control_pdev->dev;
-		}
+		ret = omap2430_get_control(glue, np);
+		if (ret)
+			goto err2;
+
 	}
 	pdata->platform_ops		= &omap2430_ops;
 
-- 
1.7.9.5


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

* [PATCH 07/17] usb: musb: omap2430: use *syscon* framework to write to mailbox register
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson, tony, balbi, rogerq, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-usb, kishon
  Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, linux,
	gregkh, nsekhar

Deprecate using phy-omap-control driver to write to the mailbox register
and start using *syscon* framework to do the same.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 Documentation/devicetree/bindings/usb/omap-usb.txt |    7 +-
 drivers/usb/musb/omap2430.c                        |  118 ++++++++++++++++----
 2 files changed, 102 insertions(+), 23 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt
index 38d9bb8..c001306 100644
--- a/Documentation/devicetree/bindings/usb/omap-usb.txt
+++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
@@ -20,10 +20,15 @@ OMAP MUSB GLUE
  - phy-names : the names of the PHY corresponding to the PHYs present in the
    *phy* phandle.
 
-Optional properties:
+Optional Properties:
+Deprecated properties:
  - ctrl-module : phandle of the control module this glue uses to write to
    mailbox
 
+Recommended properies:
+ - syscon-otghs : phandle/offset pair. Phandle to the system control module and the
+   register offset of the mailbox.
+
 SOC specific device node entry
 usb_otg_hs: usb_otg_hs@4a0ab000 {
 	compatible = "ti,omap4-musb";
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index cc752d8..bcd6d1e 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -39,16 +39,27 @@
 #include <linux/usb/musb-omap.h>
 #include <linux/phy/omap_control_phy.h>
 #include <linux/of_platform.h>
+#include <linux/regmap.h>
+#include <linux/mfd/syscon.h>
 
 #include "musb_core.h"
 #include "omap2430.h"
 
+#define OMAP2430_MUSB_MODE_MASK	0x1f
+#define OMAP2430_MUSB_AVALID	(0x1 << 0)
+#define OMAP2430_MUSB_BVALID	(0x1 << 1)
+#define OMAP2430_MUSB_VBUSVALID	(0x1 << 2)
+#define OMAP2430_MUSB_SESSEND	(0x1 << 3)
+#define OMAP2430_MUSB_IDDIG	(0x1 << 4)
+
 struct omap2430_glue {
 	struct device		*dev;
 	struct platform_device	*musb;
 	enum omap_musb_vbus_id_status status;
 	struct work_struct	omap_musb_mailbox_work;
 	struct device		*control_otghs;
+	struct regmap		*syscon_otghs; /* ctrl. reg. acces */
+	unsigned int            otghs_reg; /* otghs reg. index within syscon */
 };
 #define glue_to_musb(g)		platform_get_drvdata(g->musb)
 
@@ -253,6 +264,47 @@ void omap_musb_mailbox(enum omap_musb_vbus_id_status status)
 }
 EXPORT_SYMBOL_GPL(omap_musb_mailbox);
 
+static void omap2430_musb_set_usbmode(struct omap2430_glue *glue,
+				      enum omap_control_usb_mode mode)
+{
+	u32 val;
+	int ret;
+
+	if (glue->syscon_otghs) {
+		switch (mode) {
+		case USB_MODE_HOST:
+			val = OMAP2430_MUSB_AVALID | OMAP2430_MUSB_VBUSVALID;
+			break;
+
+		case USB_MODE_DEVICE:
+			val = OMAP2430_MUSB_IDDIG | OMAP2430_MUSB_AVALID |
+				OMAP2430_MUSB_VBUSVALID;
+			break;
+
+		case USB_MODE_DISCONNECT:
+			val = OMAP2430_MUSB_IDDIG | OMAP2430_MUSB_SESSEND;
+			break;
+
+		default:
+			dev_dbg(glue->dev, "Invalid mode\n");
+			goto err_regmap_update;
+		}
+
+		ret = regmap_update_bits(glue->syscon_otghs,
+					 glue->otghs_reg,
+					 OMAP2430_MUSB_MODE_MASK, val);
+		if (ret < 0)
+			goto err_regmap_update;
+	} else {
+		omap_control_usb_set_mode(glue->control_otghs, mode);
+	}
+
+	return;
+
+err_regmap_update:
+	dev_err(glue->dev, "Failed to set mode to %d\n", mode);
+}
+
 static void omap_musb_set_mailbox(struct omap2430_glue *glue)
 {
 	struct musb *musb = glue_to_musb(glue);
@@ -270,8 +322,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
 		musb->xceiv->last_event = USB_EVENT_ID;
 		if (musb->gadget_driver) {
 			pm_runtime_get_sync(dev);
-			omap_control_usb_set_mode(glue->control_otghs,
-				USB_MODE_HOST);
+			omap2430_musb_set_usbmode(glue, USB_MODE_HOST);
 			omap2430_musb_set_vbus(musb, 1);
 		}
 		break;
@@ -284,7 +335,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
 		musb->xceiv->last_event = USB_EVENT_VBUS;
 		if (musb->gadget_driver)
 			pm_runtime_get_sync(dev);
-		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE);
+		omap2430_musb_set_usbmode(glue, USB_MODE_DEVICE);
 		break;
 
 	case OMAP_MUSB_ID_FLOAT:
@@ -301,8 +352,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
 		if (data->interface_type == MUSB_INTERFACE_UTMI)
 			otg_set_vbus(musb->xceiv->otg, 0);
 
-		omap_control_usb_set_mode(glue->control_otghs,
-			USB_MODE_DISCONNECT);
+		omap2430_musb_set_usbmode(glue, USB_MODE_DISCONNECT);
 		break;
 	default:
 		dev_dbg(dev, "ID float\n");
@@ -444,7 +494,7 @@ static void omap2430_musb_enable(struct musb *musb)
 	switch (glue->status) {
 
 	case OMAP_MUSB_ID_GROUND:
-		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_HOST);
+		omap2430_musb_set_usbmode(glue, USB_MODE_HOST);
 		if (data->interface_type != MUSB_INTERFACE_UTMI)
 			break;
 		devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
@@ -463,7 +513,7 @@ static void omap2430_musb_enable(struct musb *musb)
 		break;
 
 	case OMAP_MUSB_VBUS_VALID:
-		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE);
+		omap2430_musb_set_usbmode(glue, USB_MODE_DEVICE);
 		break;
 
 	default:
@@ -477,8 +527,7 @@ static void omap2430_musb_disable(struct musb *musb)
 	struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
 
 	if (glue->status != OMAP_MUSB_UNKNOWN)
-		omap_control_usb_set_mode(glue->control_otghs,
-			USB_MODE_DISCONNECT);
+		omap2430_musb_set_usbmode(glue, USB_MODE_DISCONNECT);
 }
 
 static int omap2430_musb_exit(struct musb *musb)
@@ -507,6 +556,40 @@ static const struct musb_platform_ops omap2430_ops = {
 
 static u64 omap2430_dmamask = DMA_BIT_MASK(32);
 
+static int omap2430_get_control(struct omap2430_glue *glue,
+				struct device_node *np)
+{
+	struct device_node *control_node;
+	struct platform_device *control_pdev;
+
+	glue->syscon_otghs = syscon_regmap_lookup_by_phandle(np,
+							     "syscon-otghs");
+	if (IS_ERR(glue->syscon_otghs)) {
+		dev_info(glue->dev, "can't get syscon, using control device\n");
+		glue->syscon_otghs = NULL;
+
+		control_node = of_parse_phandle(np, "ctrl-module", 0);
+		if (control_node) {
+			control_pdev = of_find_device_by_node(control_node);
+			if (!control_pdev) {
+				dev_err(glue->dev,
+					"Failed to get control device\n");
+				return -EINVAL;
+			}
+			glue->control_otghs = &control_pdev->dev;
+		}
+	} else {
+		if (of_property_read_u32_index(np, "syscon-otghs", 1,
+					       &glue->otghs_reg)) {
+			dev_err(glue->dev,
+				"couldn't get otghs reg. offset\n");
+			return -EINVAL;
+		}
+	}
+
+	return 0;
+}
+
 static int omap2430_probe(struct platform_device *pdev)
 {
 	struct resource			musb_resources[3];
@@ -538,9 +621,6 @@ static int omap2430_probe(struct platform_device *pdev)
 	glue->control_otghs = ERR_PTR(-ENODEV);
 
 	if (np) {
-		struct device_node *control_node;
-		struct platform_device *control_pdev;
-
 		pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
 		if (!pdata)
 			goto err2;
@@ -567,16 +647,10 @@ static int omap2430_probe(struct platform_device *pdev)
 		pdata->board_data	= data;
 		pdata->config		= config;
 
-		control_node = of_parse_phandle(np, "ctrl-module", 0);
-		if (control_node) {
-			control_pdev = of_find_device_by_node(control_node);
-			if (!control_pdev) {
-				dev_err(&pdev->dev, "Failed to get control device\n");
-				ret = -EINVAL;
-				goto err2;
-			}
-			glue->control_otghs = &control_pdev->dev;
-		}
+		ret = omap2430_get_control(glue, np);
+		if (ret)
+			goto err2;
+
 	}
 	pdata->platform_ops		= &omap2430_ops;
 
-- 
1.7.9.5

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

* [PATCH 07/17] usb: musb: omap2430: use *syscon* framework to write to mailbox register
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: linux-arm-kernel

Deprecate using phy-omap-control driver to write to the mailbox register
and start using *syscon* framework to do the same.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 Documentation/devicetree/bindings/usb/omap-usb.txt |    7 +-
 drivers/usb/musb/omap2430.c                        |  118 ++++++++++++++++----
 2 files changed, 102 insertions(+), 23 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt
index 38d9bb8..c001306 100644
--- a/Documentation/devicetree/bindings/usb/omap-usb.txt
+++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
@@ -20,10 +20,15 @@ OMAP MUSB GLUE
  - phy-names : the names of the PHY corresponding to the PHYs present in the
    *phy* phandle.
 
-Optional properties:
+Optional Properties:
+Deprecated properties:
  - ctrl-module : phandle of the control module this glue uses to write to
    mailbox
 
+Recommended properies:
+ - syscon-otghs : phandle/offset pair. Phandle to the system control module and the
+   register offset of the mailbox.
+
 SOC specific device node entry
 usb_otg_hs: usb_otg_hs at 4a0ab000 {
 	compatible = "ti,omap4-musb";
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index cc752d8..bcd6d1e 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -39,16 +39,27 @@
 #include <linux/usb/musb-omap.h>
 #include <linux/phy/omap_control_phy.h>
 #include <linux/of_platform.h>
+#include <linux/regmap.h>
+#include <linux/mfd/syscon.h>
 
 #include "musb_core.h"
 #include "omap2430.h"
 
+#define OMAP2430_MUSB_MODE_MASK	0x1f
+#define OMAP2430_MUSB_AVALID	(0x1 << 0)
+#define OMAP2430_MUSB_BVALID	(0x1 << 1)
+#define OMAP2430_MUSB_VBUSVALID	(0x1 << 2)
+#define OMAP2430_MUSB_SESSEND	(0x1 << 3)
+#define OMAP2430_MUSB_IDDIG	(0x1 << 4)
+
 struct omap2430_glue {
 	struct device		*dev;
 	struct platform_device	*musb;
 	enum omap_musb_vbus_id_status status;
 	struct work_struct	omap_musb_mailbox_work;
 	struct device		*control_otghs;
+	struct regmap		*syscon_otghs; /* ctrl. reg. acces */
+	unsigned int            otghs_reg; /* otghs reg. index within syscon */
 };
 #define glue_to_musb(g)		platform_get_drvdata(g->musb)
 
@@ -253,6 +264,47 @@ void omap_musb_mailbox(enum omap_musb_vbus_id_status status)
 }
 EXPORT_SYMBOL_GPL(omap_musb_mailbox);
 
+static void omap2430_musb_set_usbmode(struct omap2430_glue *glue,
+				      enum omap_control_usb_mode mode)
+{
+	u32 val;
+	int ret;
+
+	if (glue->syscon_otghs) {
+		switch (mode) {
+		case USB_MODE_HOST:
+			val = OMAP2430_MUSB_AVALID | OMAP2430_MUSB_VBUSVALID;
+			break;
+
+		case USB_MODE_DEVICE:
+			val = OMAP2430_MUSB_IDDIG | OMAP2430_MUSB_AVALID |
+				OMAP2430_MUSB_VBUSVALID;
+			break;
+
+		case USB_MODE_DISCONNECT:
+			val = OMAP2430_MUSB_IDDIG | OMAP2430_MUSB_SESSEND;
+			break;
+
+		default:
+			dev_dbg(glue->dev, "Invalid mode\n");
+			goto err_regmap_update;
+		}
+
+		ret = regmap_update_bits(glue->syscon_otghs,
+					 glue->otghs_reg,
+					 OMAP2430_MUSB_MODE_MASK, val);
+		if (ret < 0)
+			goto err_regmap_update;
+	} else {
+		omap_control_usb_set_mode(glue->control_otghs, mode);
+	}
+
+	return;
+
+err_regmap_update:
+	dev_err(glue->dev, "Failed to set mode to %d\n", mode);
+}
+
 static void omap_musb_set_mailbox(struct omap2430_glue *glue)
 {
 	struct musb *musb = glue_to_musb(glue);
@@ -270,8 +322,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
 		musb->xceiv->last_event = USB_EVENT_ID;
 		if (musb->gadget_driver) {
 			pm_runtime_get_sync(dev);
-			omap_control_usb_set_mode(glue->control_otghs,
-				USB_MODE_HOST);
+			omap2430_musb_set_usbmode(glue, USB_MODE_HOST);
 			omap2430_musb_set_vbus(musb, 1);
 		}
 		break;
@@ -284,7 +335,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
 		musb->xceiv->last_event = USB_EVENT_VBUS;
 		if (musb->gadget_driver)
 			pm_runtime_get_sync(dev);
-		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE);
+		omap2430_musb_set_usbmode(glue, USB_MODE_DEVICE);
 		break;
 
 	case OMAP_MUSB_ID_FLOAT:
@@ -301,8 +352,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
 		if (data->interface_type == MUSB_INTERFACE_UTMI)
 			otg_set_vbus(musb->xceiv->otg, 0);
 
-		omap_control_usb_set_mode(glue->control_otghs,
-			USB_MODE_DISCONNECT);
+		omap2430_musb_set_usbmode(glue, USB_MODE_DISCONNECT);
 		break;
 	default:
 		dev_dbg(dev, "ID float\n");
@@ -444,7 +494,7 @@ static void omap2430_musb_enable(struct musb *musb)
 	switch (glue->status) {
 
 	case OMAP_MUSB_ID_GROUND:
-		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_HOST);
+		omap2430_musb_set_usbmode(glue, USB_MODE_HOST);
 		if (data->interface_type != MUSB_INTERFACE_UTMI)
 			break;
 		devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
@@ -463,7 +513,7 @@ static void omap2430_musb_enable(struct musb *musb)
 		break;
 
 	case OMAP_MUSB_VBUS_VALID:
-		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE);
+		omap2430_musb_set_usbmode(glue, USB_MODE_DEVICE);
 		break;
 
 	default:
@@ -477,8 +527,7 @@ static void omap2430_musb_disable(struct musb *musb)
 	struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
 
 	if (glue->status != OMAP_MUSB_UNKNOWN)
-		omap_control_usb_set_mode(glue->control_otghs,
-			USB_MODE_DISCONNECT);
+		omap2430_musb_set_usbmode(glue, USB_MODE_DISCONNECT);
 }
 
 static int omap2430_musb_exit(struct musb *musb)
@@ -507,6 +556,40 @@ static const struct musb_platform_ops omap2430_ops = {
 
 static u64 omap2430_dmamask = DMA_BIT_MASK(32);
 
+static int omap2430_get_control(struct omap2430_glue *glue,
+				struct device_node *np)
+{
+	struct device_node *control_node;
+	struct platform_device *control_pdev;
+
+	glue->syscon_otghs = syscon_regmap_lookup_by_phandle(np,
+							     "syscon-otghs");
+	if (IS_ERR(glue->syscon_otghs)) {
+		dev_info(glue->dev, "can't get syscon, using control device\n");
+		glue->syscon_otghs = NULL;
+
+		control_node = of_parse_phandle(np, "ctrl-module", 0);
+		if (control_node) {
+			control_pdev = of_find_device_by_node(control_node);
+			if (!control_pdev) {
+				dev_err(glue->dev,
+					"Failed to get control device\n");
+				return -EINVAL;
+			}
+			glue->control_otghs = &control_pdev->dev;
+		}
+	} else {
+		if (of_property_read_u32_index(np, "syscon-otghs", 1,
+					       &glue->otghs_reg)) {
+			dev_err(glue->dev,
+				"couldn't get otghs reg. offset\n");
+			return -EINVAL;
+		}
+	}
+
+	return 0;
+}
+
 static int omap2430_probe(struct platform_device *pdev)
 {
 	struct resource			musb_resources[3];
@@ -538,9 +621,6 @@ static int omap2430_probe(struct platform_device *pdev)
 	glue->control_otghs = ERR_PTR(-ENODEV);
 
 	if (np) {
-		struct device_node *control_node;
-		struct platform_device *control_pdev;
-
 		pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
 		if (!pdata)
 			goto err2;
@@ -567,16 +647,10 @@ static int omap2430_probe(struct platform_device *pdev)
 		pdata->board_data	= data;
 		pdata->config		= config;
 
-		control_node = of_parse_phandle(np, "ctrl-module", 0);
-		if (control_node) {
-			control_pdev = of_find_device_by_node(control_node);
-			if (!control_pdev) {
-				dev_err(&pdev->dev, "Failed to get control device\n");
-				ret = -EINVAL;
-				goto err2;
-			}
-			glue->control_otghs = &control_pdev->dev;
-		}
+		ret = omap2430_get_control(glue, np);
+		if (ret)
+			goto err2;
+
 	}
 	pdata->platform_ops		= &omap2430_ops;
 
-- 
1.7.9.5

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

* [PATCH 08/17] ARM: dts: dra7: Add dt node for the sycon pcie
  2015-06-23 11:58 ` Kishon Vijay Abraham I
  (?)
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  -1 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson, tony, balbi, rogerq, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-usb, kishon
  Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, linux,
	gregkh, nsekhar

Add new device tree node for the control module register space where
PCIe registers are present.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 arch/arm/boot/dts/dra7.dtsi |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index 260f300..3f434f7 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -291,6 +291,11 @@
 			reg = <0x4a002e00 0x7c>;
 		};
 
+		dra7_ctrl_pcie: tisyscon@4a003c00 {
+			compatible = "syscon";
+			reg = <0x4a003c00 0x48>;
+		};
+
 		sdma: dma-controller@4a056000 {
 			compatible = "ti,omap4430-sdma";
 			reg = <0x4a056000 0x1000>;
-- 
1.7.9.5


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

* [PATCH 08/17] ARM: dts: dra7: Add dt node for the sycon pcie
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson, tony, balbi, rogerq, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-usb, kishon
  Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, linux,
	gregkh, nsekhar

Add new device tree node for the control module register space where
PCIe registers are present.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 arch/arm/boot/dts/dra7.dtsi |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index 260f300..3f434f7 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -291,6 +291,11 @@
 			reg = <0x4a002e00 0x7c>;
 		};
 
+		dra7_ctrl_pcie: tisyscon@4a003c00 {
+			compatible = "syscon";
+			reg = <0x4a003c00 0x48>;
+		};
+
 		sdma: dma-controller@4a056000 {
 			compatible = "ti,omap4430-sdma";
 			reg = <0x4a056000 0x1000>;
-- 
1.7.9.5

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

* [PATCH 08/17] ARM: dts: dra7: Add dt node for the sycon pcie
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: linux-arm-kernel

Add new device tree node for the control module register space where
PCIe registers are present.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 arch/arm/boot/dts/dra7.dtsi |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index 260f300..3f434f7 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -291,6 +291,11 @@
 			reg = <0x4a002e00 0x7c>;
 		};
 
+		dra7_ctrl_pcie: tisyscon at 4a003c00 {
+			compatible = "syscon";
+			reg = <0x4a003c00 0x48>;
+		};
+
 		sdma: dma-controller at 4a056000 {
 			compatible = "ti,omap4430-sdma";
 			reg = <0x4a056000 0x1000>;
-- 
1.7.9.5

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

* [PATCH 09/17] ARM: dts: dra7: Use "syscon-phy-power" instead of "ctrl-module" in SATA PHY node
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson, tony, balbi, rogerq, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-usb, kishon
  Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, linux,
	gregkh, nsekhar

Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
property from SATA PHY node. Since "omap_control_sata" note is no longer
used, remove it.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 arch/arm/boot/dts/dra7.dtsi |   10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index 3f434f7..92e0741 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -1115,14 +1115,6 @@
 			status = "disabled";
 		};
 
-		omap_control_sata: control-phy@4a002374 {
-			compatible = "ti,control-phy-pipe3";
-			reg = <0x4a002374 0x4>;
-			reg-names = "power";
-			clocks = <&sys_clkin1>;
-			clock-names = "sysclk";
-		};
-
 		/* OCP2SCP3 */
 		ocp2scp@4a090000 {
 			compatible = "ti,omap-ocp2scp";
@@ -1137,7 +1129,7 @@
 				      <0x4A096400 0x64>, /* phy_tx */
 				      <0x4A096800 0x40>; /* pll_ctrl */
 				reg-names = "phy_rx", "phy_tx", "pll_ctrl";
-				ctrl-module = <&omap_control_sata>;
+				syscon-phy-power = <&dra7_ctrl_core 0x374>;
 				clocks = <&sys_clkin1>, <&sata_ref_clk>;
 				clock-names = "sysclk", "refclk";
 				syscon-pllreset = <&dra7_ctrl_core 0x3fc>;
-- 
1.7.9.5


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

* [PATCH 09/17] ARM: dts: dra7: Use "syscon-phy-power" instead of "ctrl-module" in SATA PHY node
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson-rdvid1DuHRBWk0Htik3J/w, tony-4v6yS6AI5VpBDgjK7y7TUQ,
	balbi-l0cyMroinI0, rogerq-l0cyMroinI0,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, kishon-l0cyMroinI0
  Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8,
	mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0

Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
property from SATA PHY node. Since "omap_control_sata" note is no longer
used, remove it.

Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
---
 arch/arm/boot/dts/dra7.dtsi |   10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index 3f434f7..92e0741 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -1115,14 +1115,6 @@
 			status = "disabled";
 		};
 
-		omap_control_sata: control-phy@4a002374 {
-			compatible = "ti,control-phy-pipe3";
-			reg = <0x4a002374 0x4>;
-			reg-names = "power";
-			clocks = <&sys_clkin1>;
-			clock-names = "sysclk";
-		};
-
 		/* OCP2SCP3 */
 		ocp2scp@4a090000 {
 			compatible = "ti,omap-ocp2scp";
@@ -1137,7 +1129,7 @@
 				      <0x4A096400 0x64>, /* phy_tx */
 				      <0x4A096800 0x40>; /* pll_ctrl */
 				reg-names = "phy_rx", "phy_tx", "pll_ctrl";
-				ctrl-module = <&omap_control_sata>;
+				syscon-phy-power = <&dra7_ctrl_core 0x374>;
 				clocks = <&sys_clkin1>, <&sata_ref_clk>;
 				clock-names = "sysclk", "refclk";
 				syscon-pllreset = <&dra7_ctrl_core 0x3fc>;
-- 
1.7.9.5

--
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] 150+ messages in thread

* [PATCH 09/17] ARM: dts: dra7: Use "syscon-phy-power" instead of "ctrl-module" in SATA PHY node
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: linux-arm-kernel

Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
property from SATA PHY node. Since "omap_control_sata" note is no longer
used, remove it.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 arch/arm/boot/dts/dra7.dtsi |   10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index 3f434f7..92e0741 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -1115,14 +1115,6 @@
 			status = "disabled";
 		};
 
-		omap_control_sata: control-phy at 4a002374 {
-			compatible = "ti,control-phy-pipe3";
-			reg = <0x4a002374 0x4>;
-			reg-names = "power";
-			clocks = <&sys_clkin1>;
-			clock-names = "sysclk";
-		};
-
 		/* OCP2SCP3 */
 		ocp2scp at 4a090000 {
 			compatible = "ti,omap-ocp2scp";
@@ -1137,7 +1129,7 @@
 				      <0x4A096400 0x64>, /* phy_tx */
 				      <0x4A096800 0x40>; /* pll_ctrl */
 				reg-names = "phy_rx", "phy_tx", "pll_ctrl";
-				ctrl-module = <&omap_control_sata>;
+				syscon-phy-power = <&dra7_ctrl_core 0x374>;
 				clocks = <&sys_clkin1>, <&sata_ref_clk>;
 				clock-names = "sysclk", "refclk";
 				syscon-pllreset = <&dra7_ctrl_core 0x3fc>;
-- 
1.7.9.5

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

* [PATCH 10/17] ARM: dts: dra7: Use "syscon-phy-power" and "syscon-pcs" in PCIe PHY node
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson, tony, balbi, rogerq, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-usb, kishon
  Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, linux,
	gregkh, nsekhar

Add "syscon-phy-power" property and "syscon-pcs" property which can
be used to perform the control module initializations and remove
the deprecated "ctrl-module" property from PCIe PHY dt nodes.

Phandle to "sysclk" clock node is also added to the PCIe PHY node
since some of the syscon initializations is based on system clock
frequency.

Since "omap_control_pcie1phy" and "omap_control_pcie2phy" devicetree
nodes are no longer used, remove it.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 arch/arm/boot/dts/dra7.dtsi |   28 +++++++---------------------
 1 file changed, 7 insertions(+), 21 deletions(-)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index 92e0741..f69db70 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -1141,16 +1141,18 @@
 				reg = <0x4a094000 0x80>, /* phy_rx */
 				      <0x4a094400 0x64>; /* phy_tx */
 				reg-names = "phy_rx", "phy_tx";
-				ctrl-module = <&omap_control_pcie1phy>;
+				syscon-phy-power = <&dra7_ctrl_pcie 0x40>;
+				syscon-pcs = <&dra7_ctrl_pcie 0x34>;
 				clocks = <&dpll_pcie_ref_ck>,
 					 <&dpll_pcie_ref_m2ldo_ck>,
 					 <&optfclk_pciephy1_32khz>,
 					 <&optfclk_pciephy1_clk>,
 					 <&optfclk_pciephy1_div_clk>,
-					 <&optfclk_pciephy_div>;
+					 <&optfclk_pciephy_div>,
+					 <&sys_clkin1>;
 				clock-names = "dpll_ref", "dpll_ref_m2",
 					      "wkupclk", "refclk",
-					      "div-clk", "phy-div";
+					      "div-clk", "phy-div", "sysclk";
 				#phy-cells = <0>;
 			};
 
@@ -1159,7 +1161,8 @@
 				reg = <0x4a095000 0x80>, /* phy_rx */
 				      <0x4a095400 0x64>; /* phy_tx */
 				reg-names = "phy_rx", "phy_tx";
-				ctrl-module = <&omap_control_pcie2phy>;
+				syscon-phy-power = <&dra7_ctrl_pcie 0x44>;
+				syscon-pcs = <&dra7_ctrl_pcie 0x34>;
 				clocks = <&dpll_pcie_ref_ck>,
 					 <&dpll_pcie_ref_m2ldo_ck>,
 					 <&optfclk_pciephy2_32khz>,
@@ -1184,23 +1187,6 @@
 			ti,hwmods = "sata";
 		};
 
-		omap_control_pcie1phy: control-phy@0x4a003c40 {
-			compatible = "ti,control-phy-pcie";
-			reg = <0x4a003c40 0x4>, <0x4a003c14 0x4>, <0x4a003c34 0x4>;
-			reg-names = "power", "control_sma", "pcie_pcs";
-			clocks = <&sys_clkin1>;
-			clock-names = "sysclk";
-		};
-
-		omap_control_pcie2phy: control-pcie@0x4a003c44 {
-			compatible = "ti,control-phy-pcie";
-			reg = <0x4a003c44 0x4>, <0x4a003c14 0x4>, <0x4a003c34 0x4>;
-			reg-names = "power", "control_sma", "pcie_pcs";
-			clocks = <&sys_clkin1>;
-			clock-names = "sysclk";
-			status = "disabled";
-		};
-
 		rtc: rtc@48838000 {
 			compatible = "ti,am3352-rtc";
 			reg = <0x48838000 0x100>;
-- 
1.7.9.5


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

* [PATCH 10/17] ARM: dts: dra7: Use "syscon-phy-power" and "syscon-pcs" in PCIe PHY node
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson-rdvid1DuHRBWk0Htik3J/w, tony-4v6yS6AI5VpBDgjK7y7TUQ,
	balbi-l0cyMroinI0, rogerq-l0cyMroinI0,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, kishon-l0cyMroinI0
  Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8,
	mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0

Add "syscon-phy-power" property and "syscon-pcs" property which can
be used to perform the control module initializations and remove
the deprecated "ctrl-module" property from PCIe PHY dt nodes.

Phandle to "sysclk" clock node is also added to the PCIe PHY node
since some of the syscon initializations is based on system clock
frequency.

Since "omap_control_pcie1phy" and "omap_control_pcie2phy" devicetree
nodes are no longer used, remove it.

Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
---
 arch/arm/boot/dts/dra7.dtsi |   28 +++++++---------------------
 1 file changed, 7 insertions(+), 21 deletions(-)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index 92e0741..f69db70 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -1141,16 +1141,18 @@
 				reg = <0x4a094000 0x80>, /* phy_rx */
 				      <0x4a094400 0x64>; /* phy_tx */
 				reg-names = "phy_rx", "phy_tx";
-				ctrl-module = <&omap_control_pcie1phy>;
+				syscon-phy-power = <&dra7_ctrl_pcie 0x40>;
+				syscon-pcs = <&dra7_ctrl_pcie 0x34>;
 				clocks = <&dpll_pcie_ref_ck>,
 					 <&dpll_pcie_ref_m2ldo_ck>,
 					 <&optfclk_pciephy1_32khz>,
 					 <&optfclk_pciephy1_clk>,
 					 <&optfclk_pciephy1_div_clk>,
-					 <&optfclk_pciephy_div>;
+					 <&optfclk_pciephy_div>,
+					 <&sys_clkin1>;
 				clock-names = "dpll_ref", "dpll_ref_m2",
 					      "wkupclk", "refclk",
-					      "div-clk", "phy-div";
+					      "div-clk", "phy-div", "sysclk";
 				#phy-cells = <0>;
 			};
 
@@ -1159,7 +1161,8 @@
 				reg = <0x4a095000 0x80>, /* phy_rx */
 				      <0x4a095400 0x64>; /* phy_tx */
 				reg-names = "phy_rx", "phy_tx";
-				ctrl-module = <&omap_control_pcie2phy>;
+				syscon-phy-power = <&dra7_ctrl_pcie 0x44>;
+				syscon-pcs = <&dra7_ctrl_pcie 0x34>;
 				clocks = <&dpll_pcie_ref_ck>,
 					 <&dpll_pcie_ref_m2ldo_ck>,
 					 <&optfclk_pciephy2_32khz>,
@@ -1184,23 +1187,6 @@
 			ti,hwmods = "sata";
 		};
 
-		omap_control_pcie1phy: control-phy@0x4a003c40 {
-			compatible = "ti,control-phy-pcie";
-			reg = <0x4a003c40 0x4>, <0x4a003c14 0x4>, <0x4a003c34 0x4>;
-			reg-names = "power", "control_sma", "pcie_pcs";
-			clocks = <&sys_clkin1>;
-			clock-names = "sysclk";
-		};
-
-		omap_control_pcie2phy: control-pcie@0x4a003c44 {
-			compatible = "ti,control-phy-pcie";
-			reg = <0x4a003c44 0x4>, <0x4a003c14 0x4>, <0x4a003c34 0x4>;
-			reg-names = "power", "control_sma", "pcie_pcs";
-			clocks = <&sys_clkin1>;
-			clock-names = "sysclk";
-			status = "disabled";
-		};
-
 		rtc: rtc@48838000 {
 			compatible = "ti,am3352-rtc";
 			reg = <0x48838000 0x100>;
-- 
1.7.9.5

--
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] 150+ messages in thread

* [PATCH 10/17] ARM: dts: dra7: Use "syscon-phy-power" and "syscon-pcs" in PCIe PHY node
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: linux-arm-kernel

Add "syscon-phy-power" property and "syscon-pcs" property which can
be used to perform the control module initializations and remove
the deprecated "ctrl-module" property from PCIe PHY dt nodes.

Phandle to "sysclk" clock node is also added to the PCIe PHY node
since some of the syscon initializations is based on system clock
frequency.

Since "omap_control_pcie1phy" and "omap_control_pcie2phy" devicetree
nodes are no longer used, remove it.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 arch/arm/boot/dts/dra7.dtsi |   28 +++++++---------------------
 1 file changed, 7 insertions(+), 21 deletions(-)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index 92e0741..f69db70 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -1141,16 +1141,18 @@
 				reg = <0x4a094000 0x80>, /* phy_rx */
 				      <0x4a094400 0x64>; /* phy_tx */
 				reg-names = "phy_rx", "phy_tx";
-				ctrl-module = <&omap_control_pcie1phy>;
+				syscon-phy-power = <&dra7_ctrl_pcie 0x40>;
+				syscon-pcs = <&dra7_ctrl_pcie 0x34>;
 				clocks = <&dpll_pcie_ref_ck>,
 					 <&dpll_pcie_ref_m2ldo_ck>,
 					 <&optfclk_pciephy1_32khz>,
 					 <&optfclk_pciephy1_clk>,
 					 <&optfclk_pciephy1_div_clk>,
-					 <&optfclk_pciephy_div>;
+					 <&optfclk_pciephy_div>,
+					 <&sys_clkin1>;
 				clock-names = "dpll_ref", "dpll_ref_m2",
 					      "wkupclk", "refclk",
-					      "div-clk", "phy-div";
+					      "div-clk", "phy-div", "sysclk";
 				#phy-cells = <0>;
 			};
 
@@ -1159,7 +1161,8 @@
 				reg = <0x4a095000 0x80>, /* phy_rx */
 				      <0x4a095400 0x64>; /* phy_tx */
 				reg-names = "phy_rx", "phy_tx";
-				ctrl-module = <&omap_control_pcie2phy>;
+				syscon-phy-power = <&dra7_ctrl_pcie 0x44>;
+				syscon-pcs = <&dra7_ctrl_pcie 0x34>;
 				clocks = <&dpll_pcie_ref_ck>,
 					 <&dpll_pcie_ref_m2ldo_ck>,
 					 <&optfclk_pciephy2_32khz>,
@@ -1184,23 +1187,6 @@
 			ti,hwmods = "sata";
 		};
 
-		omap_control_pcie1phy: control-phy at 0x4a003c40 {
-			compatible = "ti,control-phy-pcie";
-			reg = <0x4a003c40 0x4>, <0x4a003c14 0x4>, <0x4a003c34 0x4>;
-			reg-names = "power", "control_sma", "pcie_pcs";
-			clocks = <&sys_clkin1>;
-			clock-names = "sysclk";
-		};
-
-		omap_control_pcie2phy: control-pcie at 0x4a003c44 {
-			compatible = "ti,control-phy-pcie";
-			reg = <0x4a003c44 0x4>, <0x4a003c14 0x4>, <0x4a003c34 0x4>;
-			reg-names = "power", "control_sma", "pcie_pcs";
-			clocks = <&sys_clkin1>;
-			clock-names = "sysclk";
-			status = "disabled";
-		};
-
 		rtc: rtc at 48838000 {
 			compatible = "ti,am3352-rtc";
 			reg = <0x48838000 0x100>;
-- 
1.7.9.5

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

* [PATCH 11/17] ARM: dts: dra7: Use "ti,dra7x-usb2-phy2" compatible string for USB2 PHY2
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson, tony, balbi, rogerq, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-usb, kishon
  Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, linux,
	gregkh, nsekhar

The USB2 PHY2 has a different register map compared to USB2 PHY1
to power on/off the PHY. In order to handle it, use the new compatible
string "ti,dra7x-usb2-phy2" for the second instance of USB2 PHY.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 arch/arm/boot/dts/dra7.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index f69db70..a8ee829 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -1235,7 +1235,7 @@
 			};
 
 			usb2_phy2: phy@4a085000 {
-				compatible = "ti,omap-usb2";
+				compatible = "ti,dra7x-usb2-phy2", "ti,omap-usb2";
 				reg = <0x4a085000 0x400>;
 				ctrl-module = <&omap_control_usb2phy2>;
 				clocks = <&usb_phy2_always_on_clk32k>,
-- 
1.7.9.5


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

* [PATCH 11/17] ARM: dts: dra7: Use "ti,dra7x-usb2-phy2" compatible string for USB2 PHY2
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson-rdvid1DuHRBWk0Htik3J/w, tony-4v6yS6AI5VpBDgjK7y7TUQ,
	balbi-l0cyMroinI0, rogerq-l0cyMroinI0,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, kishon-l0cyMroinI0
  Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8,
	mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0

The USB2 PHY2 has a different register map compared to USB2 PHY1
to power on/off the PHY. In order to handle it, use the new compatible
string "ti,dra7x-usb2-phy2" for the second instance of USB2 PHY.

Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
---
 arch/arm/boot/dts/dra7.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index f69db70..a8ee829 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -1235,7 +1235,7 @@
 			};
 
 			usb2_phy2: phy@4a085000 {
-				compatible = "ti,omap-usb2";
+				compatible = "ti,dra7x-usb2-phy2", "ti,omap-usb2";
 				reg = <0x4a085000 0x400>;
 				ctrl-module = <&omap_control_usb2phy2>;
 				clocks = <&usb_phy2_always_on_clk32k>,
-- 
1.7.9.5

--
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] 150+ messages in thread

* [PATCH 11/17] ARM: dts: dra7: Use "ti, dra7x-usb2-phy2" compatible string for USB2 PHY2
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: linux-arm-kernel

The USB2 PHY2 has a different register map compared to USB2 PHY1
to power on/off the PHY. In order to handle it, use the new compatible
string "ti,dra7x-usb2-phy2" for the second instance of USB2 PHY.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 arch/arm/boot/dts/dra7.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index f69db70..a8ee829 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -1235,7 +1235,7 @@
 			};
 
 			usb2_phy2: phy at 4a085000 {
-				compatible = "ti,omap-usb2";
+				compatible = "ti,dra7x-usb2-phy2", "ti,omap-usb2";
 				reg = <0x4a085000 0x400>;
 				ctrl-module = <&omap_control_usb2phy2>;
 				clocks = <&usb_phy2_always_on_clk32k>,
-- 
1.7.9.5

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

* [PATCH 12/17] ARM: dts: dra7: Use "syscon-phy-power" instead of "ctrl-module" in USB PHY node
  2015-06-23 11:58 ` Kishon Vijay Abraham I
  (?)
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  -1 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson, tony, balbi, rogerq, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-usb, kishon
  Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, linux,
	gregkh, nsekhar

Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
property from USB PHY devicetree nodes.

Since "omap_control_usb2phy1", "omap_control_usb3phy1" and
"omap_control_usb2phy2" devicetree nodes are no longer used, remove it.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 arch/arm/boot/dts/dra7.dtsi |   24 +++---------------------
 1 file changed, 3 insertions(+), 21 deletions(-)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index a8ee829..e82ac00 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -1196,24 +1196,6 @@
 			clocks = <&sys_32k_ck>;
 		};
 
-		omap_control_usb2phy1: control-phy@4a002300 {
-			compatible = "ti,control-phy-usb2";
-			reg = <0x4a002300 0x4>;
-			reg-names = "power";
-		};
-
-		omap_control_usb3phy1: control-phy@4a002370 {
-			compatible = "ti,control-phy-pipe3";
-			reg = <0x4a002370 0x4>;
-			reg-names = "power";
-		};
-
-		omap_control_usb2phy2: control-phy@0x4a002e74 {
-			compatible = "ti,control-phy-usb2-dra7";
-			reg = <0x4a002e74 0x4>;
-			reg-names = "power";
-		};
-
 		/* OCP2SCP1 */
 		ocp2scp@4a080000 {
 			compatible = "ti,omap-ocp2scp";
@@ -1226,7 +1208,7 @@
 			usb2_phy1: phy@4a084000 {
 				compatible = "ti,omap-usb2";
 				reg = <0x4a084000 0x400>;
-				ctrl-module = <&omap_control_usb2phy1>;
+				syscon-phy-power = <&dra7_ctrl_core 0x300>;
 				clocks = <&usb_phy1_always_on_clk32k>,
 					 <&usb_otg_ss1_refclk960m>;
 				clock-names =	"wkupclk",
@@ -1237,7 +1219,7 @@
 			usb2_phy2: phy@4a085000 {
 				compatible = "ti,dra7x-usb2-phy2", "ti,omap-usb2";
 				reg = <0x4a085000 0x400>;
-				ctrl-module = <&omap_control_usb2phy2>;
+				syscon-phy-power = <&dra7_ctrl_general 0x74>;
 				clocks = <&usb_phy2_always_on_clk32k>,
 					 <&usb_otg_ss2_refclk960m>;
 				clock-names =	"wkupclk",
@@ -1251,7 +1233,7 @@
 				      <0x4a084800 0x64>,
 				      <0x4a084c00 0x40>;
 				reg-names = "phy_rx", "phy_tx", "pll_ctrl";
-				ctrl-module = <&omap_control_usb3phy1>;
+				syscon-phy-power = <&dra7_ctrl_core 0x370>;
 				clocks = <&usb_phy3_always_on_clk32k>,
 					 <&sys_clkin1>,
 					 <&usb_otg_ss1_refclk960m>;
-- 
1.7.9.5


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

* [PATCH 12/17] ARM: dts: dra7: Use "syscon-phy-power" instead of "ctrl-module" in USB PHY node
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson, tony, balbi, rogerq, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-usb, kishon
  Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, linux,
	gregkh, nsekhar

Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
property from USB PHY devicetree nodes.

Since "omap_control_usb2phy1", "omap_control_usb3phy1" and
"omap_control_usb2phy2" devicetree nodes are no longer used, remove it.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 arch/arm/boot/dts/dra7.dtsi |   24 +++---------------------
 1 file changed, 3 insertions(+), 21 deletions(-)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index a8ee829..e82ac00 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -1196,24 +1196,6 @@
 			clocks = <&sys_32k_ck>;
 		};
 
-		omap_control_usb2phy1: control-phy@4a002300 {
-			compatible = "ti,control-phy-usb2";
-			reg = <0x4a002300 0x4>;
-			reg-names = "power";
-		};
-
-		omap_control_usb3phy1: control-phy@4a002370 {
-			compatible = "ti,control-phy-pipe3";
-			reg = <0x4a002370 0x4>;
-			reg-names = "power";
-		};
-
-		omap_control_usb2phy2: control-phy@0x4a002e74 {
-			compatible = "ti,control-phy-usb2-dra7";
-			reg = <0x4a002e74 0x4>;
-			reg-names = "power";
-		};
-
 		/* OCP2SCP1 */
 		ocp2scp@4a080000 {
 			compatible = "ti,omap-ocp2scp";
@@ -1226,7 +1208,7 @@
 			usb2_phy1: phy@4a084000 {
 				compatible = "ti,omap-usb2";
 				reg = <0x4a084000 0x400>;
-				ctrl-module = <&omap_control_usb2phy1>;
+				syscon-phy-power = <&dra7_ctrl_core 0x300>;
 				clocks = <&usb_phy1_always_on_clk32k>,
 					 <&usb_otg_ss1_refclk960m>;
 				clock-names =	"wkupclk",
@@ -1237,7 +1219,7 @@
 			usb2_phy2: phy@4a085000 {
 				compatible = "ti,dra7x-usb2-phy2", "ti,omap-usb2";
 				reg = <0x4a085000 0x400>;
-				ctrl-module = <&omap_control_usb2phy2>;
+				syscon-phy-power = <&dra7_ctrl_general 0x74>;
 				clocks = <&usb_phy2_always_on_clk32k>,
 					 <&usb_otg_ss2_refclk960m>;
 				clock-names =	"wkupclk",
@@ -1251,7 +1233,7 @@
 				      <0x4a084800 0x64>,
 				      <0x4a084c00 0x40>;
 				reg-names = "phy_rx", "phy_tx", "pll_ctrl";
-				ctrl-module = <&omap_control_usb3phy1>;
+				syscon-phy-power = <&dra7_ctrl_core 0x370>;
 				clocks = <&usb_phy3_always_on_clk32k>,
 					 <&sys_clkin1>,
 					 <&usb_otg_ss1_refclk960m>;
-- 
1.7.9.5

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

* [PATCH 12/17] ARM: dts: dra7: Use "syscon-phy-power" instead of "ctrl-module" in USB PHY node
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: linux-arm-kernel

Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
property from USB PHY devicetree nodes.

Since "omap_control_usb2phy1", "omap_control_usb3phy1" and
"omap_control_usb2phy2" devicetree nodes are no longer used, remove it.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 arch/arm/boot/dts/dra7.dtsi |   24 +++---------------------
 1 file changed, 3 insertions(+), 21 deletions(-)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index a8ee829..e82ac00 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -1196,24 +1196,6 @@
 			clocks = <&sys_32k_ck>;
 		};
 
-		omap_control_usb2phy1: control-phy at 4a002300 {
-			compatible = "ti,control-phy-usb2";
-			reg = <0x4a002300 0x4>;
-			reg-names = "power";
-		};
-
-		omap_control_usb3phy1: control-phy at 4a002370 {
-			compatible = "ti,control-phy-pipe3";
-			reg = <0x4a002370 0x4>;
-			reg-names = "power";
-		};
-
-		omap_control_usb2phy2: control-phy at 0x4a002e74 {
-			compatible = "ti,control-phy-usb2-dra7";
-			reg = <0x4a002e74 0x4>;
-			reg-names = "power";
-		};
-
 		/* OCP2SCP1 */
 		ocp2scp at 4a080000 {
 			compatible = "ti,omap-ocp2scp";
@@ -1226,7 +1208,7 @@
 			usb2_phy1: phy at 4a084000 {
 				compatible = "ti,omap-usb2";
 				reg = <0x4a084000 0x400>;
-				ctrl-module = <&omap_control_usb2phy1>;
+				syscon-phy-power = <&dra7_ctrl_core 0x300>;
 				clocks = <&usb_phy1_always_on_clk32k>,
 					 <&usb_otg_ss1_refclk960m>;
 				clock-names =	"wkupclk",
@@ -1237,7 +1219,7 @@
 			usb2_phy2: phy at 4a085000 {
 				compatible = "ti,dra7x-usb2-phy2", "ti,omap-usb2";
 				reg = <0x4a085000 0x400>;
-				ctrl-module = <&omap_control_usb2phy2>;
+				syscon-phy-power = <&dra7_ctrl_general 0x74>;
 				clocks = <&usb_phy2_always_on_clk32k>,
 					 <&usb_otg_ss2_refclk960m>;
 				clock-names =	"wkupclk",
@@ -1251,7 +1233,7 @@
 				      <0x4a084800 0x64>,
 				      <0x4a084c00 0x40>;
 				reg-names = "phy_rx", "phy_tx", "pll_ctrl";
-				ctrl-module = <&omap_control_usb3phy1>;
+				syscon-phy-power = <&dra7_ctrl_core 0x370>;
 				clocks = <&usb_phy3_always_on_clk32k>,
 					 <&sys_clkin1>,
 					 <&usb_otg_ss1_refclk960m>;
-- 
1.7.9.5

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

* [PATCH 13/17] ARM: dts: am4372: Use "syscon-phy-power" instead of "ctrl-module" in USB PHY node
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson, tony, balbi, rogerq, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-usb, kishon
  Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, linux,
	gregkh, nsekhar

Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
property from USB PHY device tree node.

Since "am43xx_control_usb2phy1" and "am43xx_control_usb2phy2"
devicetree nodes are no longer used, remove it.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 arch/arm/boot/dts/am4372.dtsi |   16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi
index c80a3e2..0754e0da 100644
--- a/arch/arm/boot/dts/am4372.dtsi
+++ b/arch/arm/boot/dts/am4372.dtsi
@@ -796,18 +796,6 @@
 			status = "disabled";
 		};
 
-		am43xx_control_usb2phy1: control-phy@44e10620 {
-			compatible = "ti,control-phy-usb2-am437";
-			reg = <0x44e10620 0x4>;
-			reg-names = "power";
-		};
-
-		am43xx_control_usb2phy2: control-phy@0x44e10628 {
-			compatible = "ti,control-phy-usb2-am437";
-			reg = <0x44e10628 0x4>;
-			reg-names = "power";
-		};
-
 		ocp2scp0: ocp2scp@483a8000 {
 			compatible = "ti,am437x-ocp2scp", "ti,omap-ocp2scp";
 			#address-cells = <1>;
@@ -818,7 +806,7 @@
 			usb2_phy1: phy@483a8000 {
 				compatible = "ti,am437x-usb2";
 				reg = <0x483a8000 0x8000>;
-				ctrl-module = <&am43xx_control_usb2phy1>;
+				syscon-phy-power = <&scm_conf 0x620>;
 				clocks = <&usb_phy0_always_on_clk32k>,
 					 <&usb_otg_ss0_refclk960m>;
 				clock-names = "wkupclk", "refclk";
@@ -837,7 +825,7 @@
 			usb2_phy2: phy@483e8000 {
 				compatible = "ti,am437x-usb2";
 				reg = <0x483e8000 0x8000>;
-				ctrl-module = <&am43xx_control_usb2phy2>;
+				syscon-phy-power = <&scm_conf 0x628>;
 				clocks = <&usb_phy1_always_on_clk32k>,
 					 <&usb_otg_ss1_refclk960m>;
 				clock-names = "wkupclk", "refclk";
-- 
1.7.9.5


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

* [PATCH 13/17] ARM: dts: am4372: Use "syscon-phy-power" instead of "ctrl-module" in USB PHY node
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson-rdvid1DuHRBWk0Htik3J/w, tony-4v6yS6AI5VpBDgjK7y7TUQ,
	balbi-l0cyMroinI0, rogerq-l0cyMroinI0,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, kishon-l0cyMroinI0
  Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8,
	mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0

Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
property from USB PHY device tree node.

Since "am43xx_control_usb2phy1" and "am43xx_control_usb2phy2"
devicetree nodes are no longer used, remove it.

Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
---
 arch/arm/boot/dts/am4372.dtsi |   16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi
index c80a3e2..0754e0da 100644
--- a/arch/arm/boot/dts/am4372.dtsi
+++ b/arch/arm/boot/dts/am4372.dtsi
@@ -796,18 +796,6 @@
 			status = "disabled";
 		};
 
-		am43xx_control_usb2phy1: control-phy@44e10620 {
-			compatible = "ti,control-phy-usb2-am437";
-			reg = <0x44e10620 0x4>;
-			reg-names = "power";
-		};
-
-		am43xx_control_usb2phy2: control-phy@0x44e10628 {
-			compatible = "ti,control-phy-usb2-am437";
-			reg = <0x44e10628 0x4>;
-			reg-names = "power";
-		};
-
 		ocp2scp0: ocp2scp@483a8000 {
 			compatible = "ti,am437x-ocp2scp", "ti,omap-ocp2scp";
 			#address-cells = <1>;
@@ -818,7 +806,7 @@
 			usb2_phy1: phy@483a8000 {
 				compatible = "ti,am437x-usb2";
 				reg = <0x483a8000 0x8000>;
-				ctrl-module = <&am43xx_control_usb2phy1>;
+				syscon-phy-power = <&scm_conf 0x620>;
 				clocks = <&usb_phy0_always_on_clk32k>,
 					 <&usb_otg_ss0_refclk960m>;
 				clock-names = "wkupclk", "refclk";
@@ -837,7 +825,7 @@
 			usb2_phy2: phy@483e8000 {
 				compatible = "ti,am437x-usb2";
 				reg = <0x483e8000 0x8000>;
-				ctrl-module = <&am43xx_control_usb2phy2>;
+				syscon-phy-power = <&scm_conf 0x628>;
 				clocks = <&usb_phy1_always_on_clk32k>,
 					 <&usb_otg_ss1_refclk960m>;
 				clock-names = "wkupclk", "refclk";
-- 
1.7.9.5

--
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] 150+ messages in thread

* [PATCH 13/17] ARM: dts: am4372: Use "syscon-phy-power" instead of "ctrl-module" in USB PHY node
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: linux-arm-kernel

Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
property from USB PHY device tree node.

Since "am43xx_control_usb2phy1" and "am43xx_control_usb2phy2"
devicetree nodes are no longer used, remove it.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 arch/arm/boot/dts/am4372.dtsi |   16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi
index c80a3e2..0754e0da 100644
--- a/arch/arm/boot/dts/am4372.dtsi
+++ b/arch/arm/boot/dts/am4372.dtsi
@@ -796,18 +796,6 @@
 			status = "disabled";
 		};
 
-		am43xx_control_usb2phy1: control-phy at 44e10620 {
-			compatible = "ti,control-phy-usb2-am437";
-			reg = <0x44e10620 0x4>;
-			reg-names = "power";
-		};
-
-		am43xx_control_usb2phy2: control-phy at 0x44e10628 {
-			compatible = "ti,control-phy-usb2-am437";
-			reg = <0x44e10628 0x4>;
-			reg-names = "power";
-		};
-
 		ocp2scp0: ocp2scp at 483a8000 {
 			compatible = "ti,am437x-ocp2scp", "ti,omap-ocp2scp";
 			#address-cells = <1>;
@@ -818,7 +806,7 @@
 			usb2_phy1: phy at 483a8000 {
 				compatible = "ti,am437x-usb2";
 				reg = <0x483a8000 0x8000>;
-				ctrl-module = <&am43xx_control_usb2phy1>;
+				syscon-phy-power = <&scm_conf 0x620>;
 				clocks = <&usb_phy0_always_on_clk32k>,
 					 <&usb_otg_ss0_refclk960m>;
 				clock-names = "wkupclk", "refclk";
@@ -837,7 +825,7 @@
 			usb2_phy2: phy at 483e8000 {
 				compatible = "ti,am437x-usb2";
 				reg = <0x483e8000 0x8000>;
-				ctrl-module = <&am43xx_control_usb2phy2>;
+				syscon-phy-power = <&scm_conf 0x628>;
 				clocks = <&usb_phy1_always_on_clk32k>,
 					 <&usb_otg_ss1_refclk960m>;
 				clock-names = "wkupclk", "refclk";
-- 
1.7.9.5

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

* [PATCH 14/17] ARM: dts: OMAP5: Use "syscon-phy-power" instead of "ctrl-module" in USB PHY node
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson, tony, balbi, rogerq, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-usb, kishon
  Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, linux,
	gregkh, nsekhar

Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
property from USB PHY devicetree node.

Since "omap_control_usb2phy" and "omap_control_usb3phy" devicetree nodes
are no longer used, remove it.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 arch/arm/boot/dts/omap5.dtsi |   16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index 7d24ae0..9b50314 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -846,18 +846,6 @@
 			hw-caps-temp-alert;
 		};
 
-		omap_control_usb2phy: control-phy@4a002300 {
-			compatible = "ti,control-phy-usb2";
-			reg = <0x4a002300 0x4>;
-			reg-names = "power";
-		};
-
-		omap_control_usb3phy: control-phy@4a002370 {
-			compatible = "ti,control-phy-pipe3";
-			reg = <0x4a002370 0x4>;
-			reg-names = "power";
-		};
-
 		usb3: omap_dwc3@4a020000 {
 			compatible = "ti,dwc3";
 			ti,hwmods = "usb_otg_ss";
@@ -888,7 +876,7 @@
 			usb2_phy: usb2phy@4a084000 {
 				compatible = "ti,omap-usb2";
 				reg = <0x4a084000 0x7c>;
-				ctrl-module = <&omap_control_usb2phy>;
+				syscon-phy-power = <&scm_conf 0x300>;
 				clocks = <&usb_phy_cm_clk32k>, <&usb_otg_ss_refclk960m>;
 				clock-names = "wkupclk", "refclk";
 				#phy-cells = <0>;
@@ -900,7 +888,7 @@
 				      <0x4a084800 0x64>,
 				      <0x4a084c00 0x40>;
 				reg-names = "phy_rx", "phy_tx", "pll_ctrl";
-				ctrl-module = <&omap_control_usb3phy>;
+				syscon-phy-power = <&scm_conf 0x370>;
 				clocks = <&usb_phy_cm_clk32k>,
 					 <&sys_clkin>,
 					 <&usb_otg_ss_refclk960m>;
-- 
1.7.9.5


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

* [PATCH 14/17] ARM: dts: OMAP5: Use "syscon-phy-power" instead of "ctrl-module" in USB PHY node
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: bcousson-rdvid1DuHRBWk0Htik3J/w, tony-4v6yS6AI5VpBDgjK7y7TUQ,
	balbi-l0cyMroinI0, rogerq-l0cyMroinI0,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, kishon-l0cyMroinI0
  Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8,
	mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0

Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
property from USB PHY devicetree node.

Since "omap_control_usb2phy" and "omap_control_usb3phy" devicetree nodes
are no longer used, remove it.

Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
---
 arch/arm/boot/dts/omap5.dtsi |   16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index 7d24ae0..9b50314 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -846,18 +846,6 @@
 			hw-caps-temp-alert;
 		};
 
-		omap_control_usb2phy: control-phy@4a002300 {
-			compatible = "ti,control-phy-usb2";
-			reg = <0x4a002300 0x4>;
-			reg-names = "power";
-		};
-
-		omap_control_usb3phy: control-phy@4a002370 {
-			compatible = "ti,control-phy-pipe3";
-			reg = <0x4a002370 0x4>;
-			reg-names = "power";
-		};

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

* [PATCH 14/17] ARM: dts: OMAP5: Use "syscon-phy-power" instead of "ctrl-module" in USB PHY node
@ 2015-06-23 11:58   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:58 UTC (permalink / raw)
  To: linux-arm-kernel

Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
property from USB PHY devicetree node.

Since "omap_control_usb2phy" and "omap_control_usb3phy" devicetree nodes
are no longer used, remove it.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 arch/arm/boot/dts/omap5.dtsi |   16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index 7d24ae0..9b50314 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -846,18 +846,6 @@
 			hw-caps-temp-alert;
 		};
 
-		omap_control_usb2phy: control-phy at 4a002300 {
-			compatible = "ti,control-phy-usb2";
-			reg = <0x4a002300 0x4>;
-			reg-names = "power";
-		};
-
-		omap_control_usb3phy: control-phy at 4a002370 {
-			compatible = "ti,control-phy-pipe3";
-			reg = <0x4a002370 0x4>;
-			reg-names = "power";
-		};
-
 		usb3: omap_dwc3 at 4a020000 {
 			compatible = "ti,dwc3";
 			ti,hwmods = "usb_otg_ss";
@@ -888,7 +876,7 @@
 			usb2_phy: usb2phy at 4a084000 {
 				compatible = "ti,omap-usb2";
 				reg = <0x4a084000 0x7c>;
-				ctrl-module = <&omap_control_usb2phy>;
+				syscon-phy-power = <&scm_conf 0x300>;
 				clocks = <&usb_phy_cm_clk32k>, <&usb_otg_ss_refclk960m>;
 				clock-names = "wkupclk", "refclk";
 				#phy-cells = <0>;
@@ -900,7 +888,7 @@
 				      <0x4a084800 0x64>,
 				      <0x4a084c00 0x40>;
 				reg-names = "phy_rx", "phy_tx", "pll_ctrl";
-				ctrl-module = <&omap_control_usb3phy>;
+				syscon-phy-power = <&scm_conf 0x370>;
 				clocks = <&usb_phy_cm_clk32k>,
 					 <&sys_clkin>,
 					 <&usb_otg_ss_refclk960m>;
-- 
1.7.9.5

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

* [PATCH 15/17] ARM: dts: OMAP5: Use "syscon-phy-power" instead of "ctrl-module" in SATA PHY node
  2015-06-23 11:58 ` Kishon Vijay Abraham I
  (?)
@ 2015-06-23 11:59   ` Kishon Vijay Abraham I
  -1 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:59 UTC (permalink / raw)
  To: bcousson, tony, balbi, rogerq, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-usb, kishon
  Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, linux,
	gregkh, nsekhar

Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
property from SATA PHY node.

Since "omap_control_sata" devicetree node is no longer used, remove it.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 arch/arm/boot/dts/omap5.dtsi |   10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index 9b50314..ca0a77f 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -944,14 +944,6 @@
 			#thermal-sensor-cells = <1>;
 		};
 
-		omap_control_sata: control-phy@4a002374 {
-			compatible = "ti,control-phy-pipe3";
-			reg = <0x4a002374 0x4>;
-			reg-names = "power";
-			clocks = <&sys_clkin>;
-			clock-names = "sysclk";
-		};
-
 		/* OCP2SCP3 */
 		ocp2scp@4a090000 {
 			compatible = "ti,omap-ocp2scp";
@@ -966,7 +958,7 @@
 				      <0x4A096400 0x64>, /* phy_tx */
 				      <0x4A096800 0x40>; /* pll_ctrl */
 				reg-names = "phy_rx", "phy_tx", "pll_ctrl";
-				ctrl-module = <&omap_control_sata>;
+				syscon-phy-power = <&scm_conf 0x374>;
 				clocks = <&sys_clkin>, <&sata_ref_clk>;
 				clock-names = "sysclk", "refclk";
 				#phy-cells = <0>;
-- 
1.7.9.5


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

* [PATCH 15/17] ARM: dts: OMAP5: Use "syscon-phy-power" instead of "ctrl-module" in SATA PHY node
@ 2015-06-23 11:59   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:59 UTC (permalink / raw)
  To: bcousson, tony, balbi, rogerq, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-usb, kishon
  Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, linux,
	gregkh, nsekhar

Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
property from SATA PHY node.

Since "omap_control_sata" devicetree node is no longer used, remove it.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 arch/arm/boot/dts/omap5.dtsi |   10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index 9b50314..ca0a77f 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -944,14 +944,6 @@
 			#thermal-sensor-cells = <1>;
 		};
 
-		omap_control_sata: control-phy@4a002374 {
-			compatible = "ti,control-phy-pipe3";
-			reg = <0x4a002374 0x4>;
-			reg-names = "power";
-			clocks = <&sys_clkin>;
-			clock-names = "sysclk";
-		};
-
 		/* OCP2SCP3 */
 		ocp2scp@4a090000 {
 			compatible = "ti,omap-ocp2scp";
@@ -966,7 +958,7 @@
 				      <0x4A096400 0x64>, /* phy_tx */
 				      <0x4A096800 0x40>; /* pll_ctrl */
 				reg-names = "phy_rx", "phy_tx", "pll_ctrl";
-				ctrl-module = <&omap_control_sata>;
+				syscon-phy-power = <&scm_conf 0x374>;
 				clocks = <&sys_clkin>, <&sata_ref_clk>;
 				clock-names = "sysclk", "refclk";
 				#phy-cells = <0>;
-- 
1.7.9.5

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

* [PATCH 15/17] ARM: dts: OMAP5: Use "syscon-phy-power" instead of "ctrl-module" in SATA PHY node
@ 2015-06-23 11:59   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:59 UTC (permalink / raw)
  To: linux-arm-kernel

Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
property from SATA PHY node.

Since "omap_control_sata" devicetree node is no longer used, remove it.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 arch/arm/boot/dts/omap5.dtsi |   10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index 9b50314..ca0a77f 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -944,14 +944,6 @@
 			#thermal-sensor-cells = <1>;
 		};
 
-		omap_control_sata: control-phy at 4a002374 {
-			compatible = "ti,control-phy-pipe3";
-			reg = <0x4a002374 0x4>;
-			reg-names = "power";
-			clocks = <&sys_clkin>;
-			clock-names = "sysclk";
-		};
-
 		/* OCP2SCP3 */
 		ocp2scp at 4a090000 {
 			compatible = "ti,omap-ocp2scp";
@@ -966,7 +958,7 @@
 				      <0x4A096400 0x64>, /* phy_tx */
 				      <0x4A096800 0x40>; /* pll_ctrl */
 				reg-names = "phy_rx", "phy_tx", "pll_ctrl";
-				ctrl-module = <&omap_control_sata>;
+				syscon-phy-power = <&scm_conf 0x374>;
 				clocks = <&sys_clkin>, <&sata_ref_clk>;
 				clock-names = "sysclk", "refclk";
 				#phy-cells = <0>;
-- 
1.7.9.5

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

* [PATCH 16/17] ARM: dts: omap4: Use "syscon-phy-power" instead of "ctrl-module" in USB PHY node
@ 2015-06-23 11:59   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:59 UTC (permalink / raw)
  To: bcousson, tony, balbi, rogerq, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-usb, kishon
  Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, linux,
	gregkh, nsekhar

Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
property from USB PHY dt node.

Since "omap_control_usb2phy" devicetree node is no longer used,
remove it.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 arch/arm/boot/dts/omap4.dtsi |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index f884d6a..d0e0960 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -701,7 +701,7 @@
 			usb2_phy: usb2phy@4a0ad080 {
 				compatible = "ti,omap-usb2";
 				reg = <0x4a0ad080 0x58>;
-				ctrl-module = <&omap_control_usb2phy>;
+				syscon-phy-power = <&scm_conf 0x300>;
 				clocks = <&usb_phy_cm_clk32k>;
 				clock-names = "wkupclk";
 				#phy-cells = <0>;
@@ -852,12 +852,6 @@
 			};
 		};
 
-		omap_control_usb2phy: control-phy@4a002300 {
-			compatible = "ti,control-phy-usb2";
-			reg = <0x4a002300 0x4>;
-			reg-names = "power";
-		};
-
 		omap_control_usbotg: control-phy@4a00233c {
 			compatible = "ti,control-phy-otghs";
 			reg = <0x4a00233c 0x4>;
-- 
1.7.9.5


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

* [PATCH 16/17] ARM: dts: omap4: Use "syscon-phy-power" instead of "ctrl-module" in USB PHY node
@ 2015-06-23 11:59   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:59 UTC (permalink / raw)
  To: bcousson-rdvid1DuHRBWk0Htik3J/w, tony-4v6yS6AI5VpBDgjK7y7TUQ,
	balbi-l0cyMroinI0, rogerq-l0cyMroinI0,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, kishon-l0cyMroinI0
  Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8,
	mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0

Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
property from USB PHY dt node.

Since "omap_control_usb2phy" devicetree node is no longer used,
remove it.

Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
---
 arch/arm/boot/dts/omap4.dtsi |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index f884d6a..d0e0960 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -701,7 +701,7 @@
 			usb2_phy: usb2phy@4a0ad080 {
 				compatible = "ti,omap-usb2";
 				reg = <0x4a0ad080 0x58>;
-				ctrl-module = <&omap_control_usb2phy>;
+				syscon-phy-power = <&scm_conf 0x300>;
 				clocks = <&usb_phy_cm_clk32k>;
 				clock-names = "wkupclk";
 				#phy-cells = <0>;
@@ -852,12 +852,6 @@
 			};
 		};
 
-		omap_control_usb2phy: control-phy@4a002300 {
-			compatible = "ti,control-phy-usb2";
-			reg = <0x4a002300 0x4>;
-			reg-names = "power";
-		};

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

* [PATCH 16/17] ARM: dts: omap4: Use "syscon-phy-power" instead of "ctrl-module" in USB PHY node
@ 2015-06-23 11:59   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:59 UTC (permalink / raw)
  To: linux-arm-kernel

Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
property from USB PHY dt node.

Since "omap_control_usb2phy" devicetree node is no longer used,
remove it.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 arch/arm/boot/dts/omap4.dtsi |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index f884d6a..d0e0960 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -701,7 +701,7 @@
 			usb2_phy: usb2phy at 4a0ad080 {
 				compatible = "ti,omap-usb2";
 				reg = <0x4a0ad080 0x58>;
-				ctrl-module = <&omap_control_usb2phy>;
+				syscon-phy-power = <&scm_conf 0x300>;
 				clocks = <&usb_phy_cm_clk32k>;
 				clock-names = "wkupclk";
 				#phy-cells = <0>;
@@ -852,12 +852,6 @@
 			};
 		};
 
-		omap_control_usb2phy: control-phy at 4a002300 {
-			compatible = "ti,control-phy-usb2";
-			reg = <0x4a002300 0x4>;
-			reg-names = "power";
-		};
-
 		omap_control_usbotg: control-phy at 4a00233c {
 			compatible = "ti,control-phy-otghs";
 			reg = <0x4a00233c 0x4>;
-- 
1.7.9.5

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

* [PATCH 17/17] ARM: dts: omap4: Use "syscon-otghs" instead of "ctrl-module" in USB node
@ 2015-06-23 11:59   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:59 UTC (permalink / raw)
  To: bcousson, tony, balbi, rogerq, devicetree, linux-kernel,
	linux-omap, linux-arm-kernel, linux-usb, kishon
  Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak, linux,
	gregkh, nsekhar

Add "syscon-otghs" property and remove the deprecated "ctrl-module"
property from MUSB devicetree node.

Since "omap_control_usbotg" devicetree node is no longer used, remove
it.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 arch/arm/boot/dts/omap4.dtsi |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index d0e0960..3bc77b1 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -852,12 +852,6 @@
 			};
 		};
 
-		omap_control_usbotg: control-phy@4a00233c {
-			compatible = "ti,control-phy-otghs";
-			reg = <0x4a00233c 0x4>;
-			reg-names = "otghs_control";
-		};
-
 		usb_otg_hs: usb_otg_hs@4a0ab000 {
 			compatible = "ti,omap4-musb";
 			reg = <0x4a0ab000 0x7ff>;
@@ -870,7 +864,7 @@
 			multipoint = <1>;
 			num-eps = <16>;
 			ram-bits = <12>;
-			ctrl-module = <&omap_control_usbotg>;
+			syscon-otghs = <&scm_conf 0x33c>;
 		};
 
 		aes: aes@4b501000 {
-- 
1.7.9.5


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

* [PATCH 17/17] ARM: dts: omap4: Use "syscon-otghs" instead of "ctrl-module" in USB node
@ 2015-06-23 11:59   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:59 UTC (permalink / raw)
  To: bcousson-rdvid1DuHRBWk0Htik3J/w, tony-4v6yS6AI5VpBDgjK7y7TUQ,
	balbi-l0cyMroinI0, rogerq-l0cyMroinI0,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, kishon-l0cyMroinI0
  Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8,
	mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0

Add "syscon-otghs" property and remove the deprecated "ctrl-module"
property from MUSB devicetree node.

Since "omap_control_usbotg" devicetree node is no longer used, remove
it.

Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
---
 arch/arm/boot/dts/omap4.dtsi |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index d0e0960..3bc77b1 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -852,12 +852,6 @@
 			};
 		};
 
-		omap_control_usbotg: control-phy@4a00233c {
-			compatible = "ti,control-phy-otghs";
-			reg = <0x4a00233c 0x4>;
-			reg-names = "otghs_control";
-		};
-
 		usb_otg_hs: usb_otg_hs@4a0ab000 {
 			compatible = "ti,omap4-musb";
 			reg = <0x4a0ab000 0x7ff>;
@@ -870,7 +864,7 @@
 			multipoint = <1>;
 			num-eps = <16>;
 			ram-bits = <12>;
-			ctrl-module = <&omap_control_usbotg>;
+			syscon-otghs = <&scm_conf 0x33c>;
 		};
 
 		aes: aes@4b501000 {
-- 
1.7.9.5

--
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] 150+ messages in thread

* [PATCH 17/17] ARM: dts: omap4: Use "syscon-otghs" instead of "ctrl-module" in USB node
@ 2015-06-23 11:59   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-23 11:59 UTC (permalink / raw)
  To: linux-arm-kernel

Add "syscon-otghs" property and remove the deprecated "ctrl-module"
property from MUSB devicetree node.

Since "omap_control_usbotg" devicetree node is no longer used, remove
it.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 arch/arm/boot/dts/omap4.dtsi |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index d0e0960..3bc77b1 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -852,12 +852,6 @@
 			};
 		};
 
-		omap_control_usbotg: control-phy at 4a00233c {
-			compatible = "ti,control-phy-otghs";
-			reg = <0x4a00233c 0x4>;
-			reg-names = "otghs_control";
-		};
-
 		usb_otg_hs: usb_otg_hs at 4a0ab000 {
 			compatible = "ti,omap4-musb";
 			reg = <0x4a0ab000 0x7ff>;
@@ -870,7 +864,7 @@
 			multipoint = <1>;
 			num-eps = <16>;
 			ram-bits = <12>;
-			ctrl-module = <&omap_control_usbotg>;
+			syscon-otghs = <&scm_conf 0x33c>;
 		};
 
 		aes: aes at 4b501000 {
-- 
1.7.9.5

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

* Re: [PATCH 01/17] phy: ti-pipe3: use ti_pipe3_power_off to power off the PHY during probe
  2015-06-23 11:58   ` Kishon Vijay Abraham I
  (?)
@ 2015-06-23 14:47     ` Roger Quadros
  -1 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-23 14:47 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson, tony, balbi, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

On Tue, 23 Jun 2015 17:28:46 +0530
Kishon Vijay Abraham I <kishon@ti.com> wrote:

> No functional change. Previously omap_control_phy_power() was used to power
> off the PHY during probe. But once PIPE3 driver is adapted to use syscon,
> omap_control_phy_power() cannot be used. Hence used ti_pipe3_power_off
> to power off the PHY.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>

Acked-by: Roger Quadros <rogerq@ti.com>

cheers,
-roger

> ---
>  drivers/phy/phy-ti-pipe3.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
> index 08020dc..d784426 100644
> --- a/drivers/phy/phy-ti-pipe3.c
> +++ b/drivers/phy/phy-ti-pipe3.c
> @@ -431,8 +431,6 @@ static int ti_pipe3_probe(struct platform_device *pdev)
>  
>  	phy->control_dev = &control_pdev->dev;
>  
> -	omap_control_phy_power(phy->control_dev, 0);
> -
>  	platform_set_drvdata(pdev, phy);
>  	pm_runtime_enable(phy->dev);
>  
> @@ -451,6 +449,8 @@ static int ti_pipe3_probe(struct platform_device *pdev)
>  		return PTR_ERR(generic_phy);
>  
>  	phy_set_drvdata(generic_phy, phy);
> +	ti_pipe3_power_off(generic_phy);
> +
>  	phy_provider = devm_of_phy_provider_register(phy->dev,
>  			of_phy_simple_xlate);
>  	if (IS_ERR(phy_provider))
> -- 
> 1.7.9.5
> 

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

* Re: [PATCH 01/17] phy: ti-pipe3: use ti_pipe3_power_off to power off the PHY during probe
@ 2015-06-23 14:47     ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-23 14:47 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson, tony, balbi, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

On Tue, 23 Jun 2015 17:28:46 +0530
Kishon Vijay Abraham I <kishon@ti.com> wrote:

> No functional change. Previously omap_control_phy_power() was used to power
> off the PHY during probe. But once PIPE3 driver is adapted to use syscon,
> omap_control_phy_power() cannot be used. Hence used ti_pipe3_power_off
> to power off the PHY.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>

Acked-by: Roger Quadros <rogerq@ti.com>

cheers,
-roger

> ---
>  drivers/phy/phy-ti-pipe3.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
> index 08020dc..d784426 100644
> --- a/drivers/phy/phy-ti-pipe3.c
> +++ b/drivers/phy/phy-ti-pipe3.c
> @@ -431,8 +431,6 @@ static int ti_pipe3_probe(struct platform_device *pdev)
>  
>  	phy->control_dev = &control_pdev->dev;
>  
> -	omap_control_phy_power(phy->control_dev, 0);
> -
>  	platform_set_drvdata(pdev, phy);
>  	pm_runtime_enable(phy->dev);
>  
> @@ -451,6 +449,8 @@ static int ti_pipe3_probe(struct platform_device *pdev)
>  		return PTR_ERR(generic_phy);
>  
>  	phy_set_drvdata(generic_phy, phy);
> +	ti_pipe3_power_off(generic_phy);
> +
>  	phy_provider = devm_of_phy_provider_register(phy->dev,
>  			of_phy_simple_xlate);
>  	if (IS_ERR(phy_provider))
> -- 
> 1.7.9.5
> 

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

* [PATCH 01/17] phy: ti-pipe3: use ti_pipe3_power_off to power off the PHY during probe
@ 2015-06-23 14:47     ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-23 14:47 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 23 Jun 2015 17:28:46 +0530
Kishon Vijay Abraham I <kishon@ti.com> wrote:

> No functional change. Previously omap_control_phy_power() was used to power
> off the PHY during probe. But once PIPE3 driver is adapted to use syscon,
> omap_control_phy_power() cannot be used. Hence used ti_pipe3_power_off
> to power off the PHY.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>

Acked-by: Roger Quadros <rogerq@ti.com>

cheers,
-roger

> ---
>  drivers/phy/phy-ti-pipe3.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
> index 08020dc..d784426 100644
> --- a/drivers/phy/phy-ti-pipe3.c
> +++ b/drivers/phy/phy-ti-pipe3.c
> @@ -431,8 +431,6 @@ static int ti_pipe3_probe(struct platform_device *pdev)
>  
>  	phy->control_dev = &control_pdev->dev;
>  
> -	omap_control_phy_power(phy->control_dev, 0);
> -
>  	platform_set_drvdata(pdev, phy);
>  	pm_runtime_enable(phy->dev);
>  
> @@ -451,6 +449,8 @@ static int ti_pipe3_probe(struct platform_device *pdev)
>  		return PTR_ERR(generic_phy);
>  
>  	phy_set_drvdata(generic_phy, phy);
> +	ti_pipe3_power_off(generic_phy);
> +
>  	phy_provider = devm_of_phy_provider_register(phy->dev,
>  			of_phy_simple_xlate);
>  	if (IS_ERR(phy_provider))
> -- 
> 1.7.9.5
> 

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

* Re: [PATCH 02/17] phy: ti-pipe3: use *syscon* framework to power on/off the PHY
@ 2015-06-23 14:53     ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-23 14:53 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson, tony, balbi, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

Hi Kishon,

On Tue, 23 Jun 2015 17:28:47 +0530
Kishon Vijay Abraham I <kishon@ti.com> wrote:

> Deprecate using phy-omap-control driver to power on/off the PHY and
> use *syscon* framework to do the same.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  Documentation/devicetree/bindings/phy/ti-phy.txt |   10 ++-
>  drivers/phy/phy-ti-pipe3.c                       |   91 ++++++++++++++++++----
>  2 files changed, 86 insertions(+), 15 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
> index f0f5537..d3ad3bf 100644
> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
> @@ -77,8 +77,6 @@ Required properties:
>     * "div-clk" - apll clock
>  
>  Optional properties:
> - - ctrl-module : phandle of the control module used by PHY driver to power on
> -   the PHY.
>   - id: If there are multiple instance of the same type, in order to
>     differentiate between each instance "id" can be used (e.g., multi-lane PCIe
>     PHY). If "id" is not provided, it is set to default value of '1'.
> @@ -86,6 +84,14 @@ Optional properties:
>     CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0
>     register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.
>  
> +Deprecated properties:
> + - ctrl-module : phandle of the control module used by PHY driver to power on
> +   the PHY.
> +
> +Recommended properies:
> + - syscon-phy-power : phandle/offset pair. Phandle to the system control
> +   module and the register offset to power on/off the PHY.
> +
>  This is usually a subnode of ocp2scp to which it is connected.
>  
>  usb3phy@4a084400 {
> diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
> index d784426..78bac00 100644
> --- a/drivers/phy/phy-ti-pipe3.c
> +++ b/drivers/phy/phy-ti-pipe3.c
> @@ -56,6 +56,15 @@
>  
>  #define SATA_PLL_SOFT_RESET	BIT(18)
>  
> +#define PIPE3_PHY_PWRCTL_CLK_CMD_MASK	0x003FC000
> +#define PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT	14
> +
> +#define PIPE3_PHY_PWRCTL_CLK_FREQ_MASK	0xFFC00000
> +#define PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT	22
> +
> +#define PIPE3_PHY_TX_RX_POWERON		0x3
> +#define PIPE3_PHY_TX_RX_POWEROFF	0x0
> +
>  /*
>   * This is an Empirical value that works, need to confirm the actual
>   * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status
> @@ -86,8 +95,10 @@ struct ti_pipe3 {
>  	struct clk		*refclk;
>  	struct clk		*div_clk;
>  	struct pipe3_dpll_map	*dpll_map;
> +	struct regmap		*phy_power_syscon; /* ctrl. reg. acces */
>  	struct regmap		*dpll_reset_syscon; /* ctrl. reg. acces */
>  	unsigned int		dpll_reset_reg; /* reg. index within syscon */
> +	unsigned int		power_reg; /* power reg. index within syscon */
>  	bool			sata_refclk_enabled;
>  };
>  
> @@ -144,18 +155,49 @@ static void ti_pipe3_disable_clocks(struct ti_pipe3 *phy);
>  
>  static int ti_pipe3_power_off(struct phy *x)
>  {
> +	u32 val;
> +	int ret;
>  	struct ti_pipe3 *phy = phy_get_drvdata(x);
>  
> -	omap_control_phy_power(phy->control_dev, 0);
> +	if (phy->phy_power_syscon) {
> +		val = PIPE3_PHY_TX_RX_POWEROFF <<
> +			PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT;
> +
> +		ret = regmap_update_bits(phy->phy_power_syscon, phy->power_reg,
> +					 PIPE3_PHY_PWRCTL_CLK_CMD_MASK, val);
> +		if (ret < 0)
> +			return ret;
> +	} else {
> +		omap_control_phy_power(phy->control_dev, 0);
> +	}
>  
>  	return 0;
>  }
>  
>  static int ti_pipe3_power_on(struct phy *x)
>  {
> +	u32 val;
> +	u32 mask;
> +	int ret;
> +	unsigned long rate;
>  	struct ti_pipe3 *phy = phy_get_drvdata(x);
>  
> -	omap_control_phy_power(phy->control_dev, 1);
> +	if (phy->phy_power_syscon) {
> +		rate = clk_get_rate(phy->sys_clk);

what if clk_get_rate() returns 0?

> +		rate = rate / 1000000;
> +		mask = OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK |
> +			  OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_MASK;
> +		val = PIPE3_PHY_TX_RX_POWERON <<
> +			PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT;
> +		val |= rate << OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT;
> +
> +		ret = regmap_update_bits(phy->phy_power_syscon, phy->power_reg,
> +					 mask, val);
> +		if (ret < 0)
> +			return ret;
> +	} else {
> +		omap_control_phy_power(phy->control_dev, 1);
> +	}
>  
>  	return 0;
>  }
> @@ -417,19 +459,42 @@ static int ti_pipe3_probe(struct platform_device *pdev)
>  		phy->div_clk = ERR_PTR(-ENODEV);
>  	}
>  
> -	control_node = of_parse_phandle(node, "ctrl-module", 0);
> -	if (!control_node) {
> -		dev_err(&pdev->dev, "Failed to get control device phandle\n");
> -		return -EINVAL;
> -	}
> +	phy->phy_power_syscon = syscon_regmap_lookup_by_phandle(node,
> +							"syscon-phy-power");
> +	if (IS_ERR(phy->phy_power_syscon)) {
> +		dev_info(&pdev->dev,
> +			 "can't get syscon-phy-power, using control device\n");

dev_dbg()? as we don't want to annoy old DT users?

> +		phy->phy_power_syscon = NULL;
> +
> +		control_node = of_parse_phandle(node, "ctrl-module", 0);
> +		if (!control_node) {
> +			dev_err(&pdev->dev,
> +				"Failed to get control device phandle\n");
> +			return -EINVAL;
> +		}
>  
> -	control_pdev = of_find_device_by_node(control_node);
> -	if (!control_pdev) {
> -		dev_err(&pdev->dev, "Failed to get control device\n");
> -		return -EINVAL;
> -	}
> +		control_pdev = of_find_device_by_node(control_node);
> +		if (!control_pdev) {
> +			dev_err(&pdev->dev, "Failed to get control device\n");
> +			return -EINVAL;
> +		}
>  
> -	phy->control_dev = &control_pdev->dev;
> +		phy->control_dev = &control_pdev->dev;
> +	} else {
> +		phy->sys_clk = devm_clk_get(phy->dev, "sysclk");
> +		if (IS_ERR(phy->sys_clk)) {
> +			dev_err(&pdev->dev, "unable to get sysclk\n");
> +			return -EINVAL;
> +		}

we're already doing this at another place in pipe3_probe. Let's do it at one place.

> +
> +		if (of_property_read_u32_index(node,
> +					       "syscon-phy-power", 1,
> +					       &phy->power_reg)) {
> +			dev_err(&pdev->dev,
> +				"couldn't get power reg. offset\n");
> +			return -EINVAL;
> +		}
> +	}
>  
>  	platform_set_drvdata(pdev, phy);
>  	pm_runtime_enable(phy->dev);
> -- 
> 1.7.9.5
> 
cheers,
-roger

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

* Re: [PATCH 02/17] phy: ti-pipe3: use *syscon* framework to power on/off the PHY
@ 2015-06-23 14:53     ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-23 14:53 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson-rdvid1DuHRBWk0Htik3J/w, tony-4v6yS6AI5VpBDgjK7y7TUQ,
	balbi-l0cyMroinI0, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0

Hi Kishon,

On Tue, 23 Jun 2015 17:28:47 +0530
Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org> wrote:

> Deprecate using phy-omap-control driver to power on/off the PHY and
> use *syscon* framework to do the same.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
> ---
>  Documentation/devicetree/bindings/phy/ti-phy.txt |   10 ++-
>  drivers/phy/phy-ti-pipe3.c                       |   91 ++++++++++++++++++----
>  2 files changed, 86 insertions(+), 15 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
> index f0f5537..d3ad3bf 100644
> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
> @@ -77,8 +77,6 @@ Required properties:
>     * "div-clk" - apll clock
>  
>  Optional properties:
> - - ctrl-module : phandle of the control module used by PHY driver to power on
> -   the PHY.
>   - id: If there are multiple instance of the same type, in order to
>     differentiate between each instance "id" can be used (e.g., multi-lane PCIe
>     PHY). If "id" is not provided, it is set to default value of '1'.
> @@ -86,6 +84,14 @@ Optional properties:
>     CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0
>     register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.
>  
> +Deprecated properties:
> + - ctrl-module : phandle of the control module used by PHY driver to power on
> +   the PHY.
> +
> +Recommended properies:
> + - syscon-phy-power : phandle/offset pair. Phandle to the system control
> +   module and the register offset to power on/off the PHY.
> +
>  This is usually a subnode of ocp2scp to which it is connected.
>  
>  usb3phy@4a084400 {
> diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
> index d784426..78bac00 100644
> --- a/drivers/phy/phy-ti-pipe3.c
> +++ b/drivers/phy/phy-ti-pipe3.c
> @@ -56,6 +56,15 @@
>  
>  #define SATA_PLL_SOFT_RESET	BIT(18)
>  
> +#define PIPE3_PHY_PWRCTL_CLK_CMD_MASK	0x003FC000
> +#define PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT	14
> +
> +#define PIPE3_PHY_PWRCTL_CLK_FREQ_MASK	0xFFC00000
> +#define PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT	22
> +
> +#define PIPE3_PHY_TX_RX_POWERON		0x3
> +#define PIPE3_PHY_TX_RX_POWEROFF	0x0
> +
>  /*
>   * This is an Empirical value that works, need to confirm the actual
>   * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status
> @@ -86,8 +95,10 @@ struct ti_pipe3 {
>  	struct clk		*refclk;
>  	struct clk		*div_clk;
>  	struct pipe3_dpll_map	*dpll_map;
> +	struct regmap		*phy_power_syscon; /* ctrl. reg. acces */
>  	struct regmap		*dpll_reset_syscon; /* ctrl. reg. acces */
>  	unsigned int		dpll_reset_reg; /* reg. index within syscon */
> +	unsigned int		power_reg; /* power reg. index within syscon */
>  	bool			sata_refclk_enabled;
>  };
>  
> @@ -144,18 +155,49 @@ static void ti_pipe3_disable_clocks(struct ti_pipe3 *phy);
>  
>  static int ti_pipe3_power_off(struct phy *x)
>  {
> +	u32 val;
> +	int ret;
>  	struct ti_pipe3 *phy = phy_get_drvdata(x);
>  
> -	omap_control_phy_power(phy->control_dev, 0);
> +	if (phy->phy_power_syscon) {
> +		val = PIPE3_PHY_TX_RX_POWEROFF <<
> +			PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT;
> +
> +		ret = regmap_update_bits(phy->phy_power_syscon, phy->power_reg,
> +					 PIPE3_PHY_PWRCTL_CLK_CMD_MASK, val);
> +		if (ret < 0)
> +			return ret;
> +	} else {
> +		omap_control_phy_power(phy->control_dev, 0);
> +	}
>  
>  	return 0;
>  }
>  
>  static int ti_pipe3_power_on(struct phy *x)
>  {
> +	u32 val;
> +	u32 mask;
> +	int ret;
> +	unsigned long rate;
>  	struct ti_pipe3 *phy = phy_get_drvdata(x);
>  
> -	omap_control_phy_power(phy->control_dev, 1);
> +	if (phy->phy_power_syscon) {
> +		rate = clk_get_rate(phy->sys_clk);

what if clk_get_rate() returns 0?

> +		rate = rate / 1000000;
> +		mask = OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK |
> +			  OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_MASK;
> +		val = PIPE3_PHY_TX_RX_POWERON <<
> +			PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT;
> +		val |= rate << OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT;
> +
> +		ret = regmap_update_bits(phy->phy_power_syscon, phy->power_reg,
> +					 mask, val);
> +		if (ret < 0)
> +			return ret;
> +	} else {
> +		omap_control_phy_power(phy->control_dev, 1);
> +	}
>  
>  	return 0;
>  }
> @@ -417,19 +459,42 @@ static int ti_pipe3_probe(struct platform_device *pdev)
>  		phy->div_clk = ERR_PTR(-ENODEV);
>  	}
>  
> -	control_node = of_parse_phandle(node, "ctrl-module", 0);
> -	if (!control_node) {
> -		dev_err(&pdev->dev, "Failed to get control device phandle\n");
> -		return -EINVAL;
> -	}
> +	phy->phy_power_syscon = syscon_regmap_lookup_by_phandle(node,
> +							"syscon-phy-power");
> +	if (IS_ERR(phy->phy_power_syscon)) {
> +		dev_info(&pdev->dev,
> +			 "can't get syscon-phy-power, using control device\n");

dev_dbg()? as we don't want to annoy old DT users?

> +		phy->phy_power_syscon = NULL;
> +
> +		control_node = of_parse_phandle(node, "ctrl-module", 0);
> +		if (!control_node) {
> +			dev_err(&pdev->dev,
> +				"Failed to get control device phandle\n");
> +			return -EINVAL;
> +		}
>  
> -	control_pdev = of_find_device_by_node(control_node);
> -	if (!control_pdev) {
> -		dev_err(&pdev->dev, "Failed to get control device\n");
> -		return -EINVAL;
> -	}
> +		control_pdev = of_find_device_by_node(control_node);
> +		if (!control_pdev) {
> +			dev_err(&pdev->dev, "Failed to get control device\n");
> +			return -EINVAL;
> +		}
>  
> -	phy->control_dev = &control_pdev->dev;
> +		phy->control_dev = &control_pdev->dev;
> +	} else {
> +		phy->sys_clk = devm_clk_get(phy->dev, "sysclk");
> +		if (IS_ERR(phy->sys_clk)) {
> +			dev_err(&pdev->dev, "unable to get sysclk\n");
> +			return -EINVAL;
> +		}

we're already doing this at another place in pipe3_probe. Let's do it at one place.

> +
> +		if (of_property_read_u32_index(node,
> +					       "syscon-phy-power", 1,
> +					       &phy->power_reg)) {
> +			dev_err(&pdev->dev,
> +				"couldn't get power reg. offset\n");
> +			return -EINVAL;
> +		}
> +	}
>  
>  	platform_set_drvdata(pdev, phy);
>  	pm_runtime_enable(phy->dev);
> -- 
> 1.7.9.5
> 
cheers,
-roger
--
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] 150+ messages in thread

* [PATCH 02/17] phy: ti-pipe3: use *syscon* framework to power on/off the PHY
@ 2015-06-23 14:53     ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-23 14:53 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Kishon,

On Tue, 23 Jun 2015 17:28:47 +0530
Kishon Vijay Abraham I <kishon@ti.com> wrote:

> Deprecate using phy-omap-control driver to power on/off the PHY and
> use *syscon* framework to do the same.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  Documentation/devicetree/bindings/phy/ti-phy.txt |   10 ++-
>  drivers/phy/phy-ti-pipe3.c                       |   91 ++++++++++++++++++----
>  2 files changed, 86 insertions(+), 15 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
> index f0f5537..d3ad3bf 100644
> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
> @@ -77,8 +77,6 @@ Required properties:
>     * "div-clk" - apll clock
>  
>  Optional properties:
> - - ctrl-module : phandle of the control module used by PHY driver to power on
> -   the PHY.
>   - id: If there are multiple instance of the same type, in order to
>     differentiate between each instance "id" can be used (e.g., multi-lane PCIe
>     PHY). If "id" is not provided, it is set to default value of '1'.
> @@ -86,6 +84,14 @@ Optional properties:
>     CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0
>     register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.
>  
> +Deprecated properties:
> + - ctrl-module : phandle of the control module used by PHY driver to power on
> +   the PHY.
> +
> +Recommended properies:
> + - syscon-phy-power : phandle/offset pair. Phandle to the system control
> +   module and the register offset to power on/off the PHY.
> +
>  This is usually a subnode of ocp2scp to which it is connected.
>  
>  usb3phy at 4a084400 {
> diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
> index d784426..78bac00 100644
> --- a/drivers/phy/phy-ti-pipe3.c
> +++ b/drivers/phy/phy-ti-pipe3.c
> @@ -56,6 +56,15 @@
>  
>  #define SATA_PLL_SOFT_RESET	BIT(18)
>  
> +#define PIPE3_PHY_PWRCTL_CLK_CMD_MASK	0x003FC000
> +#define PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT	14
> +
> +#define PIPE3_PHY_PWRCTL_CLK_FREQ_MASK	0xFFC00000
> +#define PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT	22
> +
> +#define PIPE3_PHY_TX_RX_POWERON		0x3
> +#define PIPE3_PHY_TX_RX_POWEROFF	0x0
> +
>  /*
>   * This is an Empirical value that works, need to confirm the actual
>   * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status
> @@ -86,8 +95,10 @@ struct ti_pipe3 {
>  	struct clk		*refclk;
>  	struct clk		*div_clk;
>  	struct pipe3_dpll_map	*dpll_map;
> +	struct regmap		*phy_power_syscon; /* ctrl. reg. acces */
>  	struct regmap		*dpll_reset_syscon; /* ctrl. reg. acces */
>  	unsigned int		dpll_reset_reg; /* reg. index within syscon */
> +	unsigned int		power_reg; /* power reg. index within syscon */
>  	bool			sata_refclk_enabled;
>  };
>  
> @@ -144,18 +155,49 @@ static void ti_pipe3_disable_clocks(struct ti_pipe3 *phy);
>  
>  static int ti_pipe3_power_off(struct phy *x)
>  {
> +	u32 val;
> +	int ret;
>  	struct ti_pipe3 *phy = phy_get_drvdata(x);
>  
> -	omap_control_phy_power(phy->control_dev, 0);
> +	if (phy->phy_power_syscon) {
> +		val = PIPE3_PHY_TX_RX_POWEROFF <<
> +			PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT;
> +
> +		ret = regmap_update_bits(phy->phy_power_syscon, phy->power_reg,
> +					 PIPE3_PHY_PWRCTL_CLK_CMD_MASK, val);
> +		if (ret < 0)
> +			return ret;
> +	} else {
> +		omap_control_phy_power(phy->control_dev, 0);
> +	}
>  
>  	return 0;
>  }
>  
>  static int ti_pipe3_power_on(struct phy *x)
>  {
> +	u32 val;
> +	u32 mask;
> +	int ret;
> +	unsigned long rate;
>  	struct ti_pipe3 *phy = phy_get_drvdata(x);
>  
> -	omap_control_phy_power(phy->control_dev, 1);
> +	if (phy->phy_power_syscon) {
> +		rate = clk_get_rate(phy->sys_clk);

what if clk_get_rate() returns 0?

> +		rate = rate / 1000000;
> +		mask = OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK |
> +			  OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_MASK;
> +		val = PIPE3_PHY_TX_RX_POWERON <<
> +			PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT;
> +		val |= rate << OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT;
> +
> +		ret = regmap_update_bits(phy->phy_power_syscon, phy->power_reg,
> +					 mask, val);
> +		if (ret < 0)
> +			return ret;
> +	} else {
> +		omap_control_phy_power(phy->control_dev, 1);
> +	}
>  
>  	return 0;
>  }
> @@ -417,19 +459,42 @@ static int ti_pipe3_probe(struct platform_device *pdev)
>  		phy->div_clk = ERR_PTR(-ENODEV);
>  	}
>  
> -	control_node = of_parse_phandle(node, "ctrl-module", 0);
> -	if (!control_node) {
> -		dev_err(&pdev->dev, "Failed to get control device phandle\n");
> -		return -EINVAL;
> -	}
> +	phy->phy_power_syscon = syscon_regmap_lookup_by_phandle(node,
> +							"syscon-phy-power");
> +	if (IS_ERR(phy->phy_power_syscon)) {
> +		dev_info(&pdev->dev,
> +			 "can't get syscon-phy-power, using control device\n");

dev_dbg()? as we don't want to annoy old DT users?

> +		phy->phy_power_syscon = NULL;
> +
> +		control_node = of_parse_phandle(node, "ctrl-module", 0);
> +		if (!control_node) {
> +			dev_err(&pdev->dev,
> +				"Failed to get control device phandle\n");
> +			return -EINVAL;
> +		}
>  
> -	control_pdev = of_find_device_by_node(control_node);
> -	if (!control_pdev) {
> -		dev_err(&pdev->dev, "Failed to get control device\n");
> -		return -EINVAL;
> -	}
> +		control_pdev = of_find_device_by_node(control_node);
> +		if (!control_pdev) {
> +			dev_err(&pdev->dev, "Failed to get control device\n");
> +			return -EINVAL;
> +		}
>  
> -	phy->control_dev = &control_pdev->dev;
> +		phy->control_dev = &control_pdev->dev;
> +	} else {
> +		phy->sys_clk = devm_clk_get(phy->dev, "sysclk");
> +		if (IS_ERR(phy->sys_clk)) {
> +			dev_err(&pdev->dev, "unable to get sysclk\n");
> +			return -EINVAL;
> +		}

we're already doing this at another place in pipe3_probe. Let's do it at one place.

> +
> +		if (of_property_read_u32_index(node,
> +					       "syscon-phy-power", 1,
> +					       &phy->power_reg)) {
> +			dev_err(&pdev->dev,
> +				"couldn't get power reg. offset\n");
> +			return -EINVAL;
> +		}
> +	}
>  
>  	platform_set_drvdata(pdev, phy);
>  	pm_runtime_enable(phy->dev);
> -- 
> 1.7.9.5
> 
cheers,
-roger

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

* Re: [PATCH 03/17] phy: ti-pipe3: use *syscon* framework to set PCS value of the PHY
@ 2015-06-24 10:34     ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 10:34 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson, tony, balbi, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

On Tue, 23 Jun 2015 17:28:48 +0530
Kishon Vijay Abraham I <kishon@ti.com> wrote:

> Deprecate using phy-omap-control driver to set PCS value of the PHY
> and start using *syscon* framework to do the same.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  Documentation/devicetree/bindings/phy/ti-phy.txt |    2 ++
>  drivers/phy/phy-ti-pipe3.c                       |   32 +++++++++++++++++++++-
>  2 files changed, 33 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
> index d3ad3bf..52c7a92 100644
> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
> @@ -83,6 +83,8 @@ Optional properties:
>   - syscon-pllreset: Handle to system control region that contains the
>     CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0
>     register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.
> + - syscon-pcs : phandle/offset pair. Phandle to the system control module and the
> +   register offset to write the PCS delay value.

What is PCS?
Is this valid only for PCIe? If yes we could mention it here.

>  
>  Deprecated properties:
>   - ctrl-module : phandle of the control module used by PHY driver to power on
> diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
> index 78bac00..e2f9ad7 100644
> --- a/drivers/phy/phy-ti-pipe3.c
> +++ b/drivers/phy/phy-ti-pipe3.c
> @@ -65,6 +65,9 @@
>  #define PIPE3_PHY_TX_RX_POWERON		0x3
>  #define PIPE3_PHY_TX_RX_POWEROFF	0x0
>  
> +#define PCIE_PCS_MASK			0xFF0000
> +#define PCIE_PCS_DELAY_COUNT_SHIFT	0x10
> +
>  /*
>   * This is an Empirical value that works, need to confirm the actual
>   * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status
> @@ -96,9 +99,11 @@ struct ti_pipe3 {
>  	struct clk		*div_clk;
>  	struct pipe3_dpll_map	*dpll_map;
>  	struct regmap		*phy_power_syscon; /* ctrl. reg. acces */
> +	struct regmap		*pcs_syscon; /* ctrl. reg. acces */
>  	struct regmap		*dpll_reset_syscon; /* ctrl. reg. acces */
>  	unsigned int		dpll_reset_reg; /* reg. index within syscon */
>  	unsigned int		power_reg; /* power reg. index within syscon */
> +	unsigned int		pcie_pcs_reg; /* pcs reg. index in syscon */
>  	bool			sata_refclk_enabled;
>  };
>  
> @@ -271,7 +276,16 @@ static int ti_pipe3_init(struct phy *x)
>  	 * 18-1804.
>  	 */
>  	if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-pcie")) {
> -		omap_control_pcie_pcs(phy->control_dev, 0x96);
> +		if (phy->pcs_syscon) {
> +			val = 0x96 << OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT;
> +			ret = regmap_update_bits(phy->pcs_syscon,
> +						 phy->pcie_pcs_reg,
> +						 PCIE_PCS_MASK, val);
> +			if (ret < 0)
> +				return ret;
> +		} else {
> +			omap_control_pcie_pcs(phy->control_dev, 0x96);
> +		}
>  		return 0;
>  	}
>  
> @@ -455,6 +469,22 @@ static int ti_pipe3_probe(struct platform_device *pdev)
>  			dev_err(&pdev->dev, "unable to get div-clk\n");
>  			return PTR_ERR(phy->div_clk);
>  		}
> +
> +		phy->pcs_syscon = syscon_regmap_lookup_by_phandle(node,
> +								  "syscon-pcs");
> +		if (IS_ERR(phy->pcs_syscon)) {
> +			dev_dbg(&pdev->dev,
> +				 "can't get syscon-pcs, using omap control\n");
> +			phy->pcs_syscon = NULL;
> +		} else {
> +			if (of_property_read_u32_index(node,
> +						       "syscon-pcs", 1,
> +						       &phy->pcie_pcs_reg)) {
> +				dev_err(&pdev->dev,
> +					"couldn't get pcie pcs reg. offset\n");
> +				return -EINVAL;
> +			}
> +		}
>  	} else {
>  		phy->div_clk = ERR_PTR(-ENODEV);
>  	}
> -- 
> 1.7.9.5
> 

Other than that,

Acked-by: Roger Quadros <rogerq@ti.com>

cheers,
-roger

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

* Re: [PATCH 03/17] phy: ti-pipe3: use *syscon* framework to set PCS value of the PHY
@ 2015-06-24 10:34     ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 10:34 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson-rdvid1DuHRBWk0Htik3J/w, tony-4v6yS6AI5VpBDgjK7y7TUQ,
	balbi-l0cyMroinI0, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0

On Tue, 23 Jun 2015 17:28:48 +0530
Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org> wrote:

> Deprecate using phy-omap-control driver to set PCS value of the PHY
> and start using *syscon* framework to do the same.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
> ---
>  Documentation/devicetree/bindings/phy/ti-phy.txt |    2 ++
>  drivers/phy/phy-ti-pipe3.c                       |   32 +++++++++++++++++++++-
>  2 files changed, 33 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
> index d3ad3bf..52c7a92 100644
> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
> @@ -83,6 +83,8 @@ Optional properties:
>   - syscon-pllreset: Handle to system control region that contains the
>     CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0
>     register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.
> + - syscon-pcs : phandle/offset pair. Phandle to the system control module and the
> +   register offset to write the PCS delay value.

What is PCS?
Is this valid only for PCIe? If yes we could mention it here.

>  
>  Deprecated properties:
>   - ctrl-module : phandle of the control module used by PHY driver to power on
> diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
> index 78bac00..e2f9ad7 100644
> --- a/drivers/phy/phy-ti-pipe3.c
> +++ b/drivers/phy/phy-ti-pipe3.c
> @@ -65,6 +65,9 @@
>  #define PIPE3_PHY_TX_RX_POWERON		0x3
>  #define PIPE3_PHY_TX_RX_POWEROFF	0x0
>  
> +#define PCIE_PCS_MASK			0xFF0000
> +#define PCIE_PCS_DELAY_COUNT_SHIFT	0x10
> +
>  /*
>   * This is an Empirical value that works, need to confirm the actual
>   * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status
> @@ -96,9 +99,11 @@ struct ti_pipe3 {
>  	struct clk		*div_clk;
>  	struct pipe3_dpll_map	*dpll_map;
>  	struct regmap		*phy_power_syscon; /* ctrl. reg. acces */
> +	struct regmap		*pcs_syscon; /* ctrl. reg. acces */
>  	struct regmap		*dpll_reset_syscon; /* ctrl. reg. acces */
>  	unsigned int		dpll_reset_reg; /* reg. index within syscon */
>  	unsigned int		power_reg; /* power reg. index within syscon */
> +	unsigned int		pcie_pcs_reg; /* pcs reg. index in syscon */
>  	bool			sata_refclk_enabled;
>  };
>  
> @@ -271,7 +276,16 @@ static int ti_pipe3_init(struct phy *x)
>  	 * 18-1804.
>  	 */
>  	if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-pcie")) {
> -		omap_control_pcie_pcs(phy->control_dev, 0x96);
> +		if (phy->pcs_syscon) {
> +			val = 0x96 << OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT;
> +			ret = regmap_update_bits(phy->pcs_syscon,
> +						 phy->pcie_pcs_reg,
> +						 PCIE_PCS_MASK, val);
> +			if (ret < 0)
> +				return ret;
> +		} else {
> +			omap_control_pcie_pcs(phy->control_dev, 0x96);
> +		}
>  		return 0;
>  	}
>  
> @@ -455,6 +469,22 @@ static int ti_pipe3_probe(struct platform_device *pdev)
>  			dev_err(&pdev->dev, "unable to get div-clk\n");
>  			return PTR_ERR(phy->div_clk);
>  		}
> +
> +		phy->pcs_syscon = syscon_regmap_lookup_by_phandle(node,
> +								  "syscon-pcs");
> +		if (IS_ERR(phy->pcs_syscon)) {
> +			dev_dbg(&pdev->dev,
> +				 "can't get syscon-pcs, using omap control\n");
> +			phy->pcs_syscon = NULL;
> +		} else {
> +			if (of_property_read_u32_index(node,
> +						       "syscon-pcs", 1,
> +						       &phy->pcie_pcs_reg)) {
> +				dev_err(&pdev->dev,
> +					"couldn't get pcie pcs reg. offset\n");
> +				return -EINVAL;
> +			}
> +		}
>  	} else {
>  		phy->div_clk = ERR_PTR(-ENODEV);
>  	}
> -- 
> 1.7.9.5
> 

Other than that,

Acked-by: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>

cheers,
-roger
--
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	[flat|nested] 150+ messages in thread

* [PATCH 03/17] phy: ti-pipe3: use *syscon* framework to set PCS value of the PHY
@ 2015-06-24 10:34     ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 10:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 23 Jun 2015 17:28:48 +0530
Kishon Vijay Abraham I <kishon@ti.com> wrote:

> Deprecate using phy-omap-control driver to set PCS value of the PHY
> and start using *syscon* framework to do the same.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  Documentation/devicetree/bindings/phy/ti-phy.txt |    2 ++
>  drivers/phy/phy-ti-pipe3.c                       |   32 +++++++++++++++++++++-
>  2 files changed, 33 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
> index d3ad3bf..52c7a92 100644
> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
> @@ -83,6 +83,8 @@ Optional properties:
>   - syscon-pllreset: Handle to system control region that contains the
>     CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0
>     register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.
> + - syscon-pcs : phandle/offset pair. Phandle to the system control module and the
> +   register offset to write the PCS delay value.

What is PCS?
Is this valid only for PCIe? If yes we could mention it here.

>  
>  Deprecated properties:
>   - ctrl-module : phandle of the control module used by PHY driver to power on
> diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
> index 78bac00..e2f9ad7 100644
> --- a/drivers/phy/phy-ti-pipe3.c
> +++ b/drivers/phy/phy-ti-pipe3.c
> @@ -65,6 +65,9 @@
>  #define PIPE3_PHY_TX_RX_POWERON		0x3
>  #define PIPE3_PHY_TX_RX_POWEROFF	0x0
>  
> +#define PCIE_PCS_MASK			0xFF0000
> +#define PCIE_PCS_DELAY_COUNT_SHIFT	0x10
> +
>  /*
>   * This is an Empirical value that works, need to confirm the actual
>   * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status
> @@ -96,9 +99,11 @@ struct ti_pipe3 {
>  	struct clk		*div_clk;
>  	struct pipe3_dpll_map	*dpll_map;
>  	struct regmap		*phy_power_syscon; /* ctrl. reg. acces */
> +	struct regmap		*pcs_syscon; /* ctrl. reg. acces */
>  	struct regmap		*dpll_reset_syscon; /* ctrl. reg. acces */
>  	unsigned int		dpll_reset_reg; /* reg. index within syscon */
>  	unsigned int		power_reg; /* power reg. index within syscon */
> +	unsigned int		pcie_pcs_reg; /* pcs reg. index in syscon */
>  	bool			sata_refclk_enabled;
>  };
>  
> @@ -271,7 +276,16 @@ static int ti_pipe3_init(struct phy *x)
>  	 * 18-1804.
>  	 */
>  	if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-pcie")) {
> -		omap_control_pcie_pcs(phy->control_dev, 0x96);
> +		if (phy->pcs_syscon) {
> +			val = 0x96 << OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT;
> +			ret = regmap_update_bits(phy->pcs_syscon,
> +						 phy->pcie_pcs_reg,
> +						 PCIE_PCS_MASK, val);
> +			if (ret < 0)
> +				return ret;
> +		} else {
> +			omap_control_pcie_pcs(phy->control_dev, 0x96);
> +		}
>  		return 0;
>  	}
>  
> @@ -455,6 +469,22 @@ static int ti_pipe3_probe(struct platform_device *pdev)
>  			dev_err(&pdev->dev, "unable to get div-clk\n");
>  			return PTR_ERR(phy->div_clk);
>  		}
> +
> +		phy->pcs_syscon = syscon_regmap_lookup_by_phandle(node,
> +								  "syscon-pcs");
> +		if (IS_ERR(phy->pcs_syscon)) {
> +			dev_dbg(&pdev->dev,
> +				 "can't get syscon-pcs, using omap control\n");
> +			phy->pcs_syscon = NULL;
> +		} else {
> +			if (of_property_read_u32_index(node,
> +						       "syscon-pcs", 1,
> +						       &phy->pcie_pcs_reg)) {
> +				dev_err(&pdev->dev,
> +					"couldn't get pcie pcs reg. offset\n");
> +				return -EINVAL;
> +			}
> +		}
>  	} else {
>  		phy->div_clk = ERR_PTR(-ENODEV);
>  	}
> -- 
> 1.7.9.5
> 

Other than that,

Acked-by: Roger Quadros <rogerq@ti.com>

cheers,
-roger

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

* Re: [PATCH 17/17] ARM: dts: omap4: Use "syscon-otghs" instead of "ctrl-module" in USB node
@ 2015-06-24 10:41     ` Tony Lindgren
  0 siblings, 0 replies; 150+ messages in thread
From: Tony Lindgren @ 2015-06-24 10:41 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson, balbi, rogerq, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

* Kishon Vijay Abraham I <kishon@ti.com> [150623 05:02]:
> --- a/arch/arm/boot/dts/omap4.dtsi
> +++ b/arch/arm/boot/dts/omap4.dtsi
> @@ -852,12 +852,6 @@
>  			};
>  		};
>  
> -		omap_control_usbotg: control-phy@4a00233c {
> -			compatible = "ti,control-phy-otghs";
> -			reg = <0x4a00233c 0x4>;
> -			reg-names = "otghs_control";
> -		};
> -
>  		usb_otg_hs: usb_otg_hs@4a0ab000 {
>  			compatible = "ti,omap4-musb";
>  			reg = <0x4a0ab000 0x7ff>;
> @@ -870,7 +864,7 @@
>  			multipoint = <1>;
>  			num-eps = <16>;
>  			ram-bits = <12>;
> -			ctrl-module = <&omap_control_usbotg>;
> +			syscon-otghs = <&scm_conf 0x33c>;
>  		};
>  
>  		aes: aes@4b501000 {

We should still keep a separate entry for the phy in the dtsi
files. And the phy should be a child of the scm_conf area in the
dtsi file.

This is because the scm and usb_otg_hs are separate devices and
can be clocked separately. So the phy driver needs to be a
separate driver to avoid spaghetti code and issues with clocking.

Regards,

Tony

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

* Re: [PATCH 17/17] ARM: dts: omap4: Use "syscon-otghs" instead of "ctrl-module" in USB node
@ 2015-06-24 10:41     ` Tony Lindgren
  0 siblings, 0 replies; 150+ messages in thread
From: Tony Lindgren @ 2015-06-24 10:41 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson-rdvid1DuHRBWk0Htik3J/w, balbi-l0cyMroinI0,
	rogerq-l0cyMroinI0, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0

* Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org> [150623 05:02]:
> --- a/arch/arm/boot/dts/omap4.dtsi
> +++ b/arch/arm/boot/dts/omap4.dtsi
> @@ -852,12 +852,6 @@
>  			};
>  		};
>  
> -		omap_control_usbotg: control-phy@4a00233c {
> -			compatible = "ti,control-phy-otghs";
> -			reg = <0x4a00233c 0x4>;
> -			reg-names = "otghs_control";
> -		};
> -
>  		usb_otg_hs: usb_otg_hs@4a0ab000 {
>  			compatible = "ti,omap4-musb";
>  			reg = <0x4a0ab000 0x7ff>;
> @@ -870,7 +864,7 @@
>  			multipoint = <1>;
>  			num-eps = <16>;
>  			ram-bits = <12>;
> -			ctrl-module = <&omap_control_usbotg>;
> +			syscon-otghs = <&scm_conf 0x33c>;
>  		};
>  
>  		aes: aes@4b501000 {

We should still keep a separate entry for the phy in the dtsi
files. And the phy should be a child of the scm_conf area in the
dtsi file.

This is because the scm and usb_otg_hs are separate devices and
can be clocked separately. So the phy driver needs to be a
separate driver to avoid spaghetti code and issues with clocking.

Regards,

Tony
--
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] 150+ messages in thread

* [PATCH 17/17] ARM: dts: omap4: Use "syscon-otghs" instead of "ctrl-module" in USB node
@ 2015-06-24 10:41     ` Tony Lindgren
  0 siblings, 0 replies; 150+ messages in thread
From: Tony Lindgren @ 2015-06-24 10:41 UTC (permalink / raw)
  To: linux-arm-kernel

* Kishon Vijay Abraham I <kishon@ti.com> [150623 05:02]:
> --- a/arch/arm/boot/dts/omap4.dtsi
> +++ b/arch/arm/boot/dts/omap4.dtsi
> @@ -852,12 +852,6 @@
>  			};
>  		};
>  
> -		omap_control_usbotg: control-phy at 4a00233c {
> -			compatible = "ti,control-phy-otghs";
> -			reg = <0x4a00233c 0x4>;
> -			reg-names = "otghs_control";
> -		};
> -
>  		usb_otg_hs: usb_otg_hs at 4a0ab000 {
>  			compatible = "ti,omap4-musb";
>  			reg = <0x4a0ab000 0x7ff>;
> @@ -870,7 +864,7 @@
>  			multipoint = <1>;
>  			num-eps = <16>;
>  			ram-bits = <12>;
> -			ctrl-module = <&omap_control_usbotg>;
> +			syscon-otghs = <&scm_conf 0x33c>;
>  		};
>  
>  		aes: aes at 4b501000 {

We should still keep a separate entry for the phy in the dtsi
files. And the phy should be a child of the scm_conf area in the
dtsi file.

This is because the scm and usb_otg_hs are separate devices and
can be clocked separately. So the phy driver needs to be a
separate driver to avoid spaghetti code and issues with clocking.

Regards,

Tony

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

* Re: [PATCH 04/17] phy: omap-usb2: use omap_usb_power_off to power off the PHY during probe
@ 2015-06-24 10:58     ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 10:58 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson, tony, balbi, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

On Tue, 23 Jun 2015 17:28:49 +0530
Kishon Vijay Abraham I <kishon@ti.com> wrote:

> No functional change. Previously omap_control_phy_power() was used to power
> off the PHY during probe. But once phy-omap-usb2 driver is adapted to
> use syscon, omap_control_phy_power() cannot be used. Hence used
> omap_usb_power_off to power off the PHY.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>

Acked-by: Roger Quadros <rogerq@ti.com>

cheers,
-roger

> ---
>  drivers/phy/phy-omap-usb2.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
> index c1a4686..b5c266a 100644
> --- a/drivers/phy/phy-omap-usb2.c
> +++ b/drivers/phy/phy-omap-usb2.c
> @@ -241,7 +241,6 @@ static int omap_usb2_probe(struct platform_device *pdev)
>  	}
>  
>  	phy->control_dev = &control_pdev->dev;
> -	omap_control_phy_power(phy->control_dev, 0);
>  
>  	otg->set_host		= omap_usb_set_host;
>  	otg->set_peripheral	= omap_usb_set_peripheral;
> @@ -261,6 +260,7 @@ static int omap_usb2_probe(struct platform_device *pdev)
>  	}
>  
>  	phy_set_drvdata(generic_phy, phy);
> +	omap_usb_power_off(generic_phy);
>  
>  	phy_provider = devm_of_phy_provider_register(phy->dev,
>  			of_phy_simple_xlate);
> -- 
> 1.7.9.5
> 

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

* Re: [PATCH 04/17] phy: omap-usb2: use omap_usb_power_off to power off the PHY during probe
@ 2015-06-24 10:58     ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 10:58 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson-rdvid1DuHRBWk0Htik3J/w, tony-4v6yS6AI5VpBDgjK7y7TUQ,
	balbi-l0cyMroinI0, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0

On Tue, 23 Jun 2015 17:28:49 +0530
Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org> wrote:

> No functional change. Previously omap_control_phy_power() was used to power
> off the PHY during probe. But once phy-omap-usb2 driver is adapted to
> use syscon, omap_control_phy_power() cannot be used. Hence used
> omap_usb_power_off to power off the PHY.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>

Acked-by: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>

cheers,
-roger

> ---
>  drivers/phy/phy-omap-usb2.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
> index c1a4686..b5c266a 100644
> --- a/drivers/phy/phy-omap-usb2.c
> +++ b/drivers/phy/phy-omap-usb2.c
> @@ -241,7 +241,6 @@ static int omap_usb2_probe(struct platform_device *pdev)
>  	}
>  
>  	phy->control_dev = &control_pdev->dev;
> -	omap_control_phy_power(phy->control_dev, 0);
>  
>  	otg->set_host		= omap_usb_set_host;
>  	otg->set_peripheral	= omap_usb_set_peripheral;
> @@ -261,6 +260,7 @@ static int omap_usb2_probe(struct platform_device *pdev)
>  	}
>  
>  	phy_set_drvdata(generic_phy, phy);
> +	omap_usb_power_off(generic_phy);
>  
>  	phy_provider = devm_of_phy_provider_register(phy->dev,
>  			of_phy_simple_xlate);
> -- 
> 1.7.9.5
> 
--
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	[flat|nested] 150+ messages in thread

* [PATCH 04/17] phy: omap-usb2: use omap_usb_power_off to power off the PHY during probe
@ 2015-06-24 10:58     ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 10:58 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 23 Jun 2015 17:28:49 +0530
Kishon Vijay Abraham I <kishon@ti.com> wrote:

> No functional change. Previously omap_control_phy_power() was used to power
> off the PHY during probe. But once phy-omap-usb2 driver is adapted to
> use syscon, omap_control_phy_power() cannot be used. Hence used
> omap_usb_power_off to power off the PHY.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>

Acked-by: Roger Quadros <rogerq@ti.com>

cheers,
-roger

> ---
>  drivers/phy/phy-omap-usb2.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
> index c1a4686..b5c266a 100644
> --- a/drivers/phy/phy-omap-usb2.c
> +++ b/drivers/phy/phy-omap-usb2.c
> @@ -241,7 +241,6 @@ static int omap_usb2_probe(struct platform_device *pdev)
>  	}
>  
>  	phy->control_dev = &control_pdev->dev;
> -	omap_control_phy_power(phy->control_dev, 0);
>  
>  	otg->set_host		= omap_usb_set_host;
>  	otg->set_peripheral	= omap_usb_set_peripheral;
> @@ -261,6 +260,7 @@ static int omap_usb2_probe(struct platform_device *pdev)
>  	}
>  
>  	phy_set_drvdata(generic_phy, phy);
> +	omap_usb_power_off(generic_phy);
>  
>  	phy_provider = devm_of_phy_provider_register(phy->dev,
>  			of_phy_simple_xlate);
> -- 
> 1.7.9.5
> 

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

* Re: [PATCH 05/17] phy: omap-usb2: Add a new compatible string for USB2 PHY2
  2015-06-23 11:58   ` Kishon Vijay Abraham I
  (?)
@ 2015-06-24 11:03     ` Roger Quadros
  -1 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 11:03 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson, tony, balbi, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

On Tue, 23 Jun 2015 17:28:50 +0530
Kishon Vijay Abraham I <kishon@ti.com> wrote:

> The USB2 PHY2 has a different register map compared to USB2 PHY1
> to power on/off the PHY. In order to handle it, add a new
> "compatible" string.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  Documentation/devicetree/bindings/phy/ti-phy.txt |    2 ++
>  drivers/phy/phy-omap-usb2.c                      |    9 +++++++++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
> index 52c7a92..b9101b9 100644
> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
> @@ -31,6 +31,8 @@ OMAP USB2 PHY
>  
>  Required properties:
>   - compatible: Should be "ti,omap-usb2"
> +	       Should be "ti,dra7x-usb2-phy2" for the 2nd instance of USB2 PHY
> +			in DRA7x
>   - reg : Address and length of the register set for the device.
>   - #phy-cells: determine the number of cells that should be given in the
>     phandle while referencing this phy.
> diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
> index b5c266a..2f7220f 100644
> --- a/drivers/phy/phy-omap-usb2.c
> +++ b/drivers/phy/phy-omap-usb2.c
> @@ -159,6 +159,11 @@ static const struct usb_phy_data dra7x_usb2_data = {
>  	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
>  };
>  
> +static const struct usb_phy_data dra7x_usb2_phy2_data = {
> +	.label = "dra7x_usb2_phy2",
> +	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,

Isn't it better to define the register map in usb_phy_data
so that you don't need to check for compatible flag everytime?

> +};
> +
>  static const struct usb_phy_data am437x_usb2_data = {
>  	.label = "am437x_usb2",
>  	.flags =  0,
> @@ -178,6 +183,10 @@ static const struct of_device_id omap_usb2_id_table[] = {
>  		.data = &dra7x_usb2_data,
>  	},
>  	{
> +		.compatible = "ti,dra7x-usb2-phy2",
> +		.data = &dra7x_usb2_phy2_data,
> +	},
> +	{
>  		.compatible = "ti,am437x-usb2",
>  		.data = &am437x_usb2_data,
>  	},
> -- 
> 1.7.9.5
> 

cheers,
-roger

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

* Re: [PATCH 05/17] phy: omap-usb2: Add a new compatible string for USB2 PHY2
@ 2015-06-24 11:03     ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 11:03 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson, tony, balbi, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

On Tue, 23 Jun 2015 17:28:50 +0530
Kishon Vijay Abraham I <kishon@ti.com> wrote:

> The USB2 PHY2 has a different register map compared to USB2 PHY1
> to power on/off the PHY. In order to handle it, add a new
> "compatible" string.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  Documentation/devicetree/bindings/phy/ti-phy.txt |    2 ++
>  drivers/phy/phy-omap-usb2.c                      |    9 +++++++++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
> index 52c7a92..b9101b9 100644
> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
> @@ -31,6 +31,8 @@ OMAP USB2 PHY
>  
>  Required properties:
>   - compatible: Should be "ti,omap-usb2"
> +	       Should be "ti,dra7x-usb2-phy2" for the 2nd instance of USB2 PHY
> +			in DRA7x
>   - reg : Address and length of the register set for the device.
>   - #phy-cells: determine the number of cells that should be given in the
>     phandle while referencing this phy.
> diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
> index b5c266a..2f7220f 100644
> --- a/drivers/phy/phy-omap-usb2.c
> +++ b/drivers/phy/phy-omap-usb2.c
> @@ -159,6 +159,11 @@ static const struct usb_phy_data dra7x_usb2_data = {
>  	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
>  };
>  
> +static const struct usb_phy_data dra7x_usb2_phy2_data = {
> +	.label = "dra7x_usb2_phy2",
> +	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,

Isn't it better to define the register map in usb_phy_data
so that you don't need to check for compatible flag everytime?

> +};
> +
>  static const struct usb_phy_data am437x_usb2_data = {
>  	.label = "am437x_usb2",
>  	.flags =  0,
> @@ -178,6 +183,10 @@ static const struct of_device_id omap_usb2_id_table[] = {
>  		.data = &dra7x_usb2_data,
>  	},
>  	{
> +		.compatible = "ti,dra7x-usb2-phy2",
> +		.data = &dra7x_usb2_phy2_data,
> +	},
> +	{
>  		.compatible = "ti,am437x-usb2",
>  		.data = &am437x_usb2_data,
>  	},
> -- 
> 1.7.9.5
> 

cheers,
-roger

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

* [PATCH 05/17] phy: omap-usb2: Add a new compatible string for USB2 PHY2
@ 2015-06-24 11:03     ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 11:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 23 Jun 2015 17:28:50 +0530
Kishon Vijay Abraham I <kishon@ti.com> wrote:

> The USB2 PHY2 has a different register map compared to USB2 PHY1
> to power on/off the PHY. In order to handle it, add a new
> "compatible" string.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  Documentation/devicetree/bindings/phy/ti-phy.txt |    2 ++
>  drivers/phy/phy-omap-usb2.c                      |    9 +++++++++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
> index 52c7a92..b9101b9 100644
> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
> @@ -31,6 +31,8 @@ OMAP USB2 PHY
>  
>  Required properties:
>   - compatible: Should be "ti,omap-usb2"
> +	       Should be "ti,dra7x-usb2-phy2" for the 2nd instance of USB2 PHY
> +			in DRA7x
>   - reg : Address and length of the register set for the device.
>   - #phy-cells: determine the number of cells that should be given in the
>     phandle while referencing this phy.
> diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
> index b5c266a..2f7220f 100644
> --- a/drivers/phy/phy-omap-usb2.c
> +++ b/drivers/phy/phy-omap-usb2.c
> @@ -159,6 +159,11 @@ static const struct usb_phy_data dra7x_usb2_data = {
>  	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
>  };
>  
> +static const struct usb_phy_data dra7x_usb2_phy2_data = {
> +	.label = "dra7x_usb2_phy2",
> +	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,

Isn't it better to define the register map in usb_phy_data
so that you don't need to check for compatible flag everytime?

> +};
> +
>  static const struct usb_phy_data am437x_usb2_data = {
>  	.label = "am437x_usb2",
>  	.flags =  0,
> @@ -178,6 +183,10 @@ static const struct of_device_id omap_usb2_id_table[] = {
>  		.data = &dra7x_usb2_data,
>  	},
>  	{
> +		.compatible = "ti,dra7x-usb2-phy2",
> +		.data = &dra7x_usb2_phy2_data,
> +	},
> +	{
>  		.compatible = "ti,am437x-usb2",
>  		.data = &am437x_usb2_data,
>  	},
> -- 
> 1.7.9.5
> 

cheers,
-roger

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

* Re: [PATCH 17/17] ARM: dts: omap4: Use "syscon-otghs" instead of "ctrl-module" in USB node
  2015-06-24 10:41     ` Tony Lindgren
  (?)
@ 2015-06-24 11:21       ` Kishon Vijay Abraham I
  -1 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 11:21 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: bcousson, balbi, rogerq, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

Hi Tony,

On Wednesday 24 June 2015 04:11 PM, Tony Lindgren wrote:
> * Kishon Vijay Abraham I <kishon@ti.com> [150623 05:02]:
>> --- a/arch/arm/boot/dts/omap4.dtsi
>> +++ b/arch/arm/boot/dts/omap4.dtsi
>> @@ -852,12 +852,6 @@
>>   			};
>>   		};
>>
>> -		omap_control_usbotg: control-phy@4a00233c {
>> -			compatible = "ti,control-phy-otghs";
>> -			reg = <0x4a00233c 0x4>;
>> -			reg-names = "otghs_control";
>> -		};
>> -
>>   		usb_otg_hs: usb_otg_hs@4a0ab000 {
>>   			compatible = "ti,omap4-musb";
>>   			reg = <0x4a0ab000 0x7ff>;
>> @@ -870,7 +864,7 @@
>>   			multipoint = <1>;
>>   			num-eps = <16>;
>>   			ram-bits = <12>;
>> -			ctrl-module = <&omap_control_usbotg>;
>> +			syscon-otghs = <&scm_conf 0x33c>;
>>   		};
>>
>>   		aes: aes@4b501000 {
>
> We should still keep a separate entry for the phy in the dtsi
> files. And the phy should be a child of the scm_conf area in the
> dtsi file.
>
> This is because the scm and usb_otg_hs are separate devices and
> can be clocked separately. So the phy driver needs to be a
> separate driver to avoid spaghetti code and issues with clocking.

AFAIK SCM is clocked by L4CFG_L4_GICLK which is either free running or is 
managed automatically by the HW i.e gated when there is no access to the 
CTRL_MODULE_CORE registers.

Having a separate control-PHY driver only to do a regmap update to SCM is 
unnecessary IMHO.

Thanks
Kishon

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

* Re: [PATCH 17/17] ARM: dts: omap4: Use "syscon-otghs" instead of "ctrl-module" in USB node
@ 2015-06-24 11:21       ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 11:21 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: bcousson, balbi, rogerq, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

Hi Tony,

On Wednesday 24 June 2015 04:11 PM, Tony Lindgren wrote:
> * Kishon Vijay Abraham I <kishon@ti.com> [150623 05:02]:
>> --- a/arch/arm/boot/dts/omap4.dtsi
>> +++ b/arch/arm/boot/dts/omap4.dtsi
>> @@ -852,12 +852,6 @@
>>   			};
>>   		};
>>
>> -		omap_control_usbotg: control-phy@4a00233c {
>> -			compatible = "ti,control-phy-otghs";
>> -			reg = <0x4a00233c 0x4>;
>> -			reg-names = "otghs_control";
>> -		};
>> -
>>   		usb_otg_hs: usb_otg_hs@4a0ab000 {
>>   			compatible = "ti,omap4-musb";
>>   			reg = <0x4a0ab000 0x7ff>;
>> @@ -870,7 +864,7 @@
>>   			multipoint = <1>;
>>   			num-eps = <16>;
>>   			ram-bits = <12>;
>> -			ctrl-module = <&omap_control_usbotg>;
>> +			syscon-otghs = <&scm_conf 0x33c>;
>>   		};
>>
>>   		aes: aes@4b501000 {
>
> We should still keep a separate entry for the phy in the dtsi
> files. And the phy should be a child of the scm_conf area in the
> dtsi file.
>
> This is because the scm and usb_otg_hs are separate devices and
> can be clocked separately. So the phy driver needs to be a
> separate driver to avoid spaghetti code and issues with clocking.

AFAIK SCM is clocked by L4CFG_L4_GICLK which is either free running or is 
managed automatically by the HW i.e gated when there is no access to the 
CTRL_MODULE_CORE registers.

Having a separate control-PHY driver only to do a regmap update to SCM is 
unnecessary IMHO.

Thanks
Kishon

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

* [PATCH 17/17] ARM: dts: omap4: Use "syscon-otghs" instead of "ctrl-module" in USB node
@ 2015-06-24 11:21       ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 11:21 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Tony,

On Wednesday 24 June 2015 04:11 PM, Tony Lindgren wrote:
> * Kishon Vijay Abraham I <kishon@ti.com> [150623 05:02]:
>> --- a/arch/arm/boot/dts/omap4.dtsi
>> +++ b/arch/arm/boot/dts/omap4.dtsi
>> @@ -852,12 +852,6 @@
>>   			};
>>   		};
>>
>> -		omap_control_usbotg: control-phy at 4a00233c {
>> -			compatible = "ti,control-phy-otghs";
>> -			reg = <0x4a00233c 0x4>;
>> -			reg-names = "otghs_control";
>> -		};
>> -
>>   		usb_otg_hs: usb_otg_hs at 4a0ab000 {
>>   			compatible = "ti,omap4-musb";
>>   			reg = <0x4a0ab000 0x7ff>;
>> @@ -870,7 +864,7 @@
>>   			multipoint = <1>;
>>   			num-eps = <16>;
>>   			ram-bits = <12>;
>> -			ctrl-module = <&omap_control_usbotg>;
>> +			syscon-otghs = <&scm_conf 0x33c>;
>>   		};
>>
>>   		aes: aes at 4b501000 {
>
> We should still keep a separate entry for the phy in the dtsi
> files. And the phy should be a child of the scm_conf area in the
> dtsi file.
>
> This is because the scm and usb_otg_hs are separate devices and
> can be clocked separately. So the phy driver needs to be a
> separate driver to avoid spaghetti code and issues with clocking.

AFAIK SCM is clocked by L4CFG_L4_GICLK which is either free running or is 
managed automatically by the HW i.e gated when there is no access to the 
CTRL_MODULE_CORE registers.

Having a separate control-PHY driver only to do a regmap update to SCM is 
unnecessary IMHO.

Thanks
Kishon

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

* Re: [PATCH 02/17] phy: ti-pipe3: use *syscon* framework to power on/off the PHY
@ 2015-06-24 11:26       ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 11:26 UTC (permalink / raw)
  To: Roger Quadros
  Cc: bcousson, tony, balbi, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

Hi,

On Tuesday 23 June 2015 08:23 PM, Roger Quadros wrote:
> Hi Kishon,
>
> On Tue, 23 Jun 2015 17:28:47 +0530
> Kishon Vijay Abraham I <kishon@ti.com> wrote:
>
>> Deprecate using phy-omap-control driver to power on/off the PHY and
>> use *syscon* framework to do the same.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> ---
>>   Documentation/devicetree/bindings/phy/ti-phy.txt |   10 ++-
>>   drivers/phy/phy-ti-pipe3.c                       |   91 ++++++++++++++++++----
>>   2 files changed, 86 insertions(+), 15 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
>> index f0f5537..d3ad3bf 100644
>> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
>> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
>> @@ -77,8 +77,6 @@ Required properties:
>>      * "div-clk" - apll clock
>>
>>   Optional properties:
>> - - ctrl-module : phandle of the control module used by PHY driver to power on
>> -   the PHY.
>>    - id: If there are multiple instance of the same type, in order to
>>      differentiate between each instance "id" can be used (e.g., multi-lane PCIe
>>      PHY). If "id" is not provided, it is set to default value of '1'.
>> @@ -86,6 +84,14 @@ Optional properties:
>>      CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0
>>      register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.
>>
>> +Deprecated properties:
>> + - ctrl-module : phandle of the control module used by PHY driver to power on
>> +   the PHY.
>> +
>> +Recommended properies:
>> + - syscon-phy-power : phandle/offset pair. Phandle to the system control
>> +   module and the register offset to power on/off the PHY.
>> +
>>   This is usually a subnode of ocp2scp to which it is connected.
>>
>>   usb3phy@4a084400 {
>> diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
>> index d784426..78bac00 100644
>> --- a/drivers/phy/phy-ti-pipe3.c
>> +++ b/drivers/phy/phy-ti-pipe3.c
>> @@ -56,6 +56,15 @@
>>
>>   #define SATA_PLL_SOFT_RESET	BIT(18)
>>
>> +#define PIPE3_PHY_PWRCTL_CLK_CMD_MASK	0x003FC000
>> +#define PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT	14
>> +
>> +#define PIPE3_PHY_PWRCTL_CLK_FREQ_MASK	0xFFC00000
>> +#define PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT	22
>> +
>> +#define PIPE3_PHY_TX_RX_POWERON		0x3
>> +#define PIPE3_PHY_TX_RX_POWEROFF	0x0
>> +
>>   /*
>>    * This is an Empirical value that works, need to confirm the actual
>>    * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status
>> @@ -86,8 +95,10 @@ struct ti_pipe3 {
>>   	struct clk		*refclk;
>>   	struct clk		*div_clk;
>>   	struct pipe3_dpll_map	*dpll_map;
>> +	struct regmap		*phy_power_syscon; /* ctrl. reg. acces */
>>   	struct regmap		*dpll_reset_syscon; /* ctrl. reg. acces */
>>   	unsigned int		dpll_reset_reg; /* reg. index within syscon */
>> +	unsigned int		power_reg; /* power reg. index within syscon */
>>   	bool			sata_refclk_enabled;
>>   };
>>
>> @@ -144,18 +155,49 @@ static void ti_pipe3_disable_clocks(struct ti_pipe3 *phy);
>>
>>   static int ti_pipe3_power_off(struct phy *x)
>>   {
>> +	u32 val;
>> +	int ret;
>>   	struct ti_pipe3 *phy = phy_get_drvdata(x);
>>
>> -	omap_control_phy_power(phy->control_dev, 0);
>> +	if (phy->phy_power_syscon) {
>> +		val = PIPE3_PHY_TX_RX_POWEROFF <<
>> +			PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT;
>> +
>> +		ret = regmap_update_bits(phy->phy_power_syscon, phy->power_reg,
>> +					 PIPE3_PHY_PWRCTL_CLK_CMD_MASK, val);
>> +		if (ret < 0)
>> +			return ret;
>> +	} else {
>> +		omap_control_phy_power(phy->control_dev, 0);
>> +	}
>>
>>   	return 0;
>>   }
>>
>>   static int ti_pipe3_power_on(struct phy *x)
>>   {
>> +	u32 val;
>> +	u32 mask;
>> +	int ret;
>> +	unsigned long rate;
>>   	struct ti_pipe3 *phy = phy_get_drvdata(x);
>>
>> -	omap_control_phy_power(phy->control_dev, 1);
>> +	if (phy->phy_power_syscon) {
>> +		rate = clk_get_rate(phy->sys_clk);
>
> what if clk_get_rate() returns 0?

hmm.. If '0' is an error value of clk_get_rate() then it would be good to 
return with an error message.
>
>> +		rate = rate / 1000000;
>> +		mask = OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK |
>> +			  OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_MASK;
>> +		val = PIPE3_PHY_TX_RX_POWERON <<
>> +			PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT;
>> +		val |= rate << OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT;
>> +
>> +		ret = regmap_update_bits(phy->phy_power_syscon, phy->power_reg,
>> +					 mask, val);
>> +		if (ret < 0)
>> +			return ret;
>> +	} else {
>> +		omap_control_phy_power(phy->control_dev, 1);
>> +	}
>>
>>   	return 0;
>>   }
>> @@ -417,19 +459,42 @@ static int ti_pipe3_probe(struct platform_device *pdev)
>>   		phy->div_clk = ERR_PTR(-ENODEV);
>>   	}
>>
>> -	control_node = of_parse_phandle(node, "ctrl-module", 0);
>> -	if (!control_node) {
>> -		dev_err(&pdev->dev, "Failed to get control device phandle\n");
>> -		return -EINVAL;
>> -	}
>> +	phy->phy_power_syscon = syscon_regmap_lookup_by_phandle(node,
>> +							"syscon-phy-power");
>> +	if (IS_ERR(phy->phy_power_syscon)) {
>> +		dev_info(&pdev->dev,
>> +			 "can't get syscon-phy-power, using control device\n");
>
> dev_dbg()? as we don't want to annoy old DT users?

okay.
>
>> +		phy->phy_power_syscon = NULL;
>> +
>> +		control_node = of_parse_phandle(node, "ctrl-module", 0);
>> +		if (!control_node) {
>> +			dev_err(&pdev->dev,
>> +				"Failed to get control device phandle\n");
>> +			return -EINVAL;
>> +		}
>>
>> -	control_pdev = of_find_device_by_node(control_node);
>> -	if (!control_pdev) {
>> -		dev_err(&pdev->dev, "Failed to get control device\n");
>> -		return -EINVAL;
>> -	}
>> +		control_pdev = of_find_device_by_node(control_node);
>> +		if (!control_pdev) {
>> +			dev_err(&pdev->dev, "Failed to get control device\n");
>> +			return -EINVAL;
>> +		}
>>
>> -	phy->control_dev = &control_pdev->dev;
>> +		phy->control_dev = &control_pdev->dev;
>> +	} else {
>> +		phy->sys_clk = devm_clk_get(phy->dev, "sysclk");
>> +		if (IS_ERR(phy->sys_clk)) {
>> +			dev_err(&pdev->dev, "unable to get sysclk\n");
>> +			return -EINVAL;
>> +		}
>
> we're already doing this at another place in pipe3_probe. Let's do it at one place.

right, this can be improved.

Thanks
Kishon

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

* Re: [PATCH 02/17] phy: ti-pipe3: use *syscon* framework to power on/off the PHY
@ 2015-06-24 11:26       ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 11:26 UTC (permalink / raw)
  To: Roger Quadros
  Cc: bcousson-rdvid1DuHRBWk0Htik3J/w, tony-4v6yS6AI5VpBDgjK7y7TUQ,
	balbi-l0cyMroinI0, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0

Hi,

On Tuesday 23 June 2015 08:23 PM, Roger Quadros wrote:
> Hi Kishon,
>
> On Tue, 23 Jun 2015 17:28:47 +0530
> Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org> wrote:
>
>> Deprecate using phy-omap-control driver to power on/off the PHY and
>> use *syscon* framework to do the same.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
>> ---
>>   Documentation/devicetree/bindings/phy/ti-phy.txt |   10 ++-
>>   drivers/phy/phy-ti-pipe3.c                       |   91 ++++++++++++++++++----
>>   2 files changed, 86 insertions(+), 15 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
>> index f0f5537..d3ad3bf 100644
>> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
>> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
>> @@ -77,8 +77,6 @@ Required properties:
>>      * "div-clk" - apll clock
>>
>>   Optional properties:
>> - - ctrl-module : phandle of the control module used by PHY driver to power on
>> -   the PHY.
>>    - id: If there are multiple instance of the same type, in order to
>>      differentiate between each instance "id" can be used (e.g., multi-lane PCIe
>>      PHY). If "id" is not provided, it is set to default value of '1'.
>> @@ -86,6 +84,14 @@ Optional properties:
>>      CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0
>>      register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.
>>
>> +Deprecated properties:
>> + - ctrl-module : phandle of the control module used by PHY driver to power on
>> +   the PHY.
>> +
>> +Recommended properies:
>> + - syscon-phy-power : phandle/offset pair. Phandle to the system control
>> +   module and the register offset to power on/off the PHY.
>> +
>>   This is usually a subnode of ocp2scp to which it is connected.
>>
>>   usb3phy@4a084400 {
>> diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
>> index d784426..78bac00 100644
>> --- a/drivers/phy/phy-ti-pipe3.c
>> +++ b/drivers/phy/phy-ti-pipe3.c
>> @@ -56,6 +56,15 @@
>>
>>   #define SATA_PLL_SOFT_RESET	BIT(18)
>>
>> +#define PIPE3_PHY_PWRCTL_CLK_CMD_MASK	0x003FC000
>> +#define PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT	14
>> +
>> +#define PIPE3_PHY_PWRCTL_CLK_FREQ_MASK	0xFFC00000
>> +#define PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT	22
>> +
>> +#define PIPE3_PHY_TX_RX_POWERON		0x3
>> +#define PIPE3_PHY_TX_RX_POWEROFF	0x0
>> +
>>   /*
>>    * This is an Empirical value that works, need to confirm the actual
>>    * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status
>> @@ -86,8 +95,10 @@ struct ti_pipe3 {
>>   	struct clk		*refclk;
>>   	struct clk		*div_clk;
>>   	struct pipe3_dpll_map	*dpll_map;
>> +	struct regmap		*phy_power_syscon; /* ctrl. reg. acces */
>>   	struct regmap		*dpll_reset_syscon; /* ctrl. reg. acces */
>>   	unsigned int		dpll_reset_reg; /* reg. index within syscon */
>> +	unsigned int		power_reg; /* power reg. index within syscon */
>>   	bool			sata_refclk_enabled;
>>   };
>>
>> @@ -144,18 +155,49 @@ static void ti_pipe3_disable_clocks(struct ti_pipe3 *phy);
>>
>>   static int ti_pipe3_power_off(struct phy *x)
>>   {
>> +	u32 val;
>> +	int ret;
>>   	struct ti_pipe3 *phy = phy_get_drvdata(x);
>>
>> -	omap_control_phy_power(phy->control_dev, 0);
>> +	if (phy->phy_power_syscon) {
>> +		val = PIPE3_PHY_TX_RX_POWEROFF <<
>> +			PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT;
>> +
>> +		ret = regmap_update_bits(phy->phy_power_syscon, phy->power_reg,
>> +					 PIPE3_PHY_PWRCTL_CLK_CMD_MASK, val);
>> +		if (ret < 0)
>> +			return ret;
>> +	} else {
>> +		omap_control_phy_power(phy->control_dev, 0);
>> +	}
>>
>>   	return 0;
>>   }
>>
>>   static int ti_pipe3_power_on(struct phy *x)
>>   {
>> +	u32 val;
>> +	u32 mask;
>> +	int ret;
>> +	unsigned long rate;
>>   	struct ti_pipe3 *phy = phy_get_drvdata(x);
>>
>> -	omap_control_phy_power(phy->control_dev, 1);
>> +	if (phy->phy_power_syscon) {
>> +		rate = clk_get_rate(phy->sys_clk);
>
> what if clk_get_rate() returns 0?

hmm.. If '0' is an error value of clk_get_rate() then it would be good to 
return with an error message.
>
>> +		rate = rate / 1000000;
>> +		mask = OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK |
>> +			  OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_MASK;
>> +		val = PIPE3_PHY_TX_RX_POWERON <<
>> +			PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT;
>> +		val |= rate << OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT;
>> +
>> +		ret = regmap_update_bits(phy->phy_power_syscon, phy->power_reg,
>> +					 mask, val);
>> +		if (ret < 0)
>> +			return ret;
>> +	} else {
>> +		omap_control_phy_power(phy->control_dev, 1);
>> +	}
>>
>>   	return 0;
>>   }
>> @@ -417,19 +459,42 @@ static int ti_pipe3_probe(struct platform_device *pdev)
>>   		phy->div_clk = ERR_PTR(-ENODEV);
>>   	}
>>
>> -	control_node = of_parse_phandle(node, "ctrl-module", 0);
>> -	if (!control_node) {
>> -		dev_err(&pdev->dev, "Failed to get control device phandle\n");
>> -		return -EINVAL;
>> -	}
>> +	phy->phy_power_syscon = syscon_regmap_lookup_by_phandle(node,
>> +							"syscon-phy-power");
>> +	if (IS_ERR(phy->phy_power_syscon)) {
>> +		dev_info(&pdev->dev,
>> +			 "can't get syscon-phy-power, using control device\n");
>
> dev_dbg()? as we don't want to annoy old DT users?

okay.
>
>> +		phy->phy_power_syscon = NULL;
>> +
>> +		control_node = of_parse_phandle(node, "ctrl-module", 0);
>> +		if (!control_node) {
>> +			dev_err(&pdev->dev,
>> +				"Failed to get control device phandle\n");
>> +			return -EINVAL;
>> +		}
>>
>> -	control_pdev = of_find_device_by_node(control_node);
>> -	if (!control_pdev) {
>> -		dev_err(&pdev->dev, "Failed to get control device\n");
>> -		return -EINVAL;
>> -	}
>> +		control_pdev = of_find_device_by_node(control_node);
>> +		if (!control_pdev) {
>> +			dev_err(&pdev->dev, "Failed to get control device\n");
>> +			return -EINVAL;
>> +		}
>>
>> -	phy->control_dev = &control_pdev->dev;
>> +		phy->control_dev = &control_pdev->dev;
>> +	} else {
>> +		phy->sys_clk = devm_clk_get(phy->dev, "sysclk");
>> +		if (IS_ERR(phy->sys_clk)) {
>> +			dev_err(&pdev->dev, "unable to get sysclk\n");
>> +			return -EINVAL;
>> +		}
>
> we're already doing this at another place in pipe3_probe. Let's do it at one place.

right, this can be improved.

Thanks
Kishon
--
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] 150+ messages in thread

* [PATCH 02/17] phy: ti-pipe3: use *syscon* framework to power on/off the PHY
@ 2015-06-24 11:26       ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 11:26 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Tuesday 23 June 2015 08:23 PM, Roger Quadros wrote:
> Hi Kishon,
>
> On Tue, 23 Jun 2015 17:28:47 +0530
> Kishon Vijay Abraham I <kishon@ti.com> wrote:
>
>> Deprecate using phy-omap-control driver to power on/off the PHY and
>> use *syscon* framework to do the same.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> ---
>>   Documentation/devicetree/bindings/phy/ti-phy.txt |   10 ++-
>>   drivers/phy/phy-ti-pipe3.c                       |   91 ++++++++++++++++++----
>>   2 files changed, 86 insertions(+), 15 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
>> index f0f5537..d3ad3bf 100644
>> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
>> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
>> @@ -77,8 +77,6 @@ Required properties:
>>      * "div-clk" - apll clock
>>
>>   Optional properties:
>> - - ctrl-module : phandle of the control module used by PHY driver to power on
>> -   the PHY.
>>    - id: If there are multiple instance of the same type, in order to
>>      differentiate between each instance "id" can be used (e.g., multi-lane PCIe
>>      PHY). If "id" is not provided, it is set to default value of '1'.
>> @@ -86,6 +84,14 @@ Optional properties:
>>      CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0
>>      register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.
>>
>> +Deprecated properties:
>> + - ctrl-module : phandle of the control module used by PHY driver to power on
>> +   the PHY.
>> +
>> +Recommended properies:
>> + - syscon-phy-power : phandle/offset pair. Phandle to the system control
>> +   module and the register offset to power on/off the PHY.
>> +
>>   This is usually a subnode of ocp2scp to which it is connected.
>>
>>   usb3phy at 4a084400 {
>> diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
>> index d784426..78bac00 100644
>> --- a/drivers/phy/phy-ti-pipe3.c
>> +++ b/drivers/phy/phy-ti-pipe3.c
>> @@ -56,6 +56,15 @@
>>
>>   #define SATA_PLL_SOFT_RESET	BIT(18)
>>
>> +#define PIPE3_PHY_PWRCTL_CLK_CMD_MASK	0x003FC000
>> +#define PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT	14
>> +
>> +#define PIPE3_PHY_PWRCTL_CLK_FREQ_MASK	0xFFC00000
>> +#define PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT	22
>> +
>> +#define PIPE3_PHY_TX_RX_POWERON		0x3
>> +#define PIPE3_PHY_TX_RX_POWEROFF	0x0
>> +
>>   /*
>>    * This is an Empirical value that works, need to confirm the actual
>>    * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status
>> @@ -86,8 +95,10 @@ struct ti_pipe3 {
>>   	struct clk		*refclk;
>>   	struct clk		*div_clk;
>>   	struct pipe3_dpll_map	*dpll_map;
>> +	struct regmap		*phy_power_syscon; /* ctrl. reg. acces */
>>   	struct regmap		*dpll_reset_syscon; /* ctrl. reg. acces */
>>   	unsigned int		dpll_reset_reg; /* reg. index within syscon */
>> +	unsigned int		power_reg; /* power reg. index within syscon */
>>   	bool			sata_refclk_enabled;
>>   };
>>
>> @@ -144,18 +155,49 @@ static void ti_pipe3_disable_clocks(struct ti_pipe3 *phy);
>>
>>   static int ti_pipe3_power_off(struct phy *x)
>>   {
>> +	u32 val;
>> +	int ret;
>>   	struct ti_pipe3 *phy = phy_get_drvdata(x);
>>
>> -	omap_control_phy_power(phy->control_dev, 0);
>> +	if (phy->phy_power_syscon) {
>> +		val = PIPE3_PHY_TX_RX_POWEROFF <<
>> +			PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT;
>> +
>> +		ret = regmap_update_bits(phy->phy_power_syscon, phy->power_reg,
>> +					 PIPE3_PHY_PWRCTL_CLK_CMD_MASK, val);
>> +		if (ret < 0)
>> +			return ret;
>> +	} else {
>> +		omap_control_phy_power(phy->control_dev, 0);
>> +	}
>>
>>   	return 0;
>>   }
>>
>>   static int ti_pipe3_power_on(struct phy *x)
>>   {
>> +	u32 val;
>> +	u32 mask;
>> +	int ret;
>> +	unsigned long rate;
>>   	struct ti_pipe3 *phy = phy_get_drvdata(x);
>>
>> -	omap_control_phy_power(phy->control_dev, 1);
>> +	if (phy->phy_power_syscon) {
>> +		rate = clk_get_rate(phy->sys_clk);
>
> what if clk_get_rate() returns 0?

hmm.. If '0' is an error value of clk_get_rate() then it would be good to 
return with an error message.
>
>> +		rate = rate / 1000000;
>> +		mask = OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK |
>> +			  OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_MASK;
>> +		val = PIPE3_PHY_TX_RX_POWERON <<
>> +			PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT;
>> +		val |= rate << OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT;
>> +
>> +		ret = regmap_update_bits(phy->phy_power_syscon, phy->power_reg,
>> +					 mask, val);
>> +		if (ret < 0)
>> +			return ret;
>> +	} else {
>> +		omap_control_phy_power(phy->control_dev, 1);
>> +	}
>>
>>   	return 0;
>>   }
>> @@ -417,19 +459,42 @@ static int ti_pipe3_probe(struct platform_device *pdev)
>>   		phy->div_clk = ERR_PTR(-ENODEV);
>>   	}
>>
>> -	control_node = of_parse_phandle(node, "ctrl-module", 0);
>> -	if (!control_node) {
>> -		dev_err(&pdev->dev, "Failed to get control device phandle\n");
>> -		return -EINVAL;
>> -	}
>> +	phy->phy_power_syscon = syscon_regmap_lookup_by_phandle(node,
>> +							"syscon-phy-power");
>> +	if (IS_ERR(phy->phy_power_syscon)) {
>> +		dev_info(&pdev->dev,
>> +			 "can't get syscon-phy-power, using control device\n");
>
> dev_dbg()? as we don't want to annoy old DT users?

okay.
>
>> +		phy->phy_power_syscon = NULL;
>> +
>> +		control_node = of_parse_phandle(node, "ctrl-module", 0);
>> +		if (!control_node) {
>> +			dev_err(&pdev->dev,
>> +				"Failed to get control device phandle\n");
>> +			return -EINVAL;
>> +		}
>>
>> -	control_pdev = of_find_device_by_node(control_node);
>> -	if (!control_pdev) {
>> -		dev_err(&pdev->dev, "Failed to get control device\n");
>> -		return -EINVAL;
>> -	}
>> +		control_pdev = of_find_device_by_node(control_node);
>> +		if (!control_pdev) {
>> +			dev_err(&pdev->dev, "Failed to get control device\n");
>> +			return -EINVAL;
>> +		}
>>
>> -	phy->control_dev = &control_pdev->dev;
>> +		phy->control_dev = &control_pdev->dev;
>> +	} else {
>> +		phy->sys_clk = devm_clk_get(phy->dev, "sysclk");
>> +		if (IS_ERR(phy->sys_clk)) {
>> +			dev_err(&pdev->dev, "unable to get sysclk\n");
>> +			return -EINVAL;
>> +		}
>
> we're already doing this at another place in pipe3_probe. Let's do it at one place.

right, this can be improved.

Thanks
Kishon

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

* Re: [PATCH 06/17] phy: omap-usb2: use *syscon* framework to power on/off the PHY
@ 2015-06-24 11:33     ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 11:33 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson, tony, balbi, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

On Tue, 23 Jun 2015 17:28:51 +0530
Kishon Vijay Abraham I <kishon@ti.com> wrote:

> Deprecate using phy-omap-control driver to power on/off the PHY,
> and use *syscon* framework to do the same. This handles
> powering on/off the PHY for the USB2 PHYs used in various TI SoCs.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  Documentation/devicetree/bindings/phy/ti-phy.txt |    6 +-
>  drivers/phy/phy-omap-usb2.c                      |  101 ++++++++++++++++++----
>  include/linux/phy/omap_usb.h                     |   18 ++++
>  3 files changed, 107 insertions(+), 18 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
> index b9101b9..5bfe461 100644
> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
> @@ -42,10 +42,14 @@ Required properties:
>     * "wkupclk" - wakeup clock.
>     * "refclk" - reference clock (optional).
>  
> -Optional properties:
> +Deprecated properties:
>   - ctrl-module : phandle of the control module used by PHY driver to power on
>     the PHY.
>  
> +Recommended properies:
> +- syscon-phy-power : phandle/offset pair. Phandle to the system control
> +  module and the register offset to power on/off the PHY.
> +
>  This is usually a subnode of ocp2scp to which it is connected.
>  
>  usb2phy@4a0ad080 {
> diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
> index 2f7220f..180b066 100644
> --- a/drivers/phy/phy-omap-usb2.c
> +++ b/drivers/phy/phy-omap-usb2.c
> @@ -29,6 +29,8 @@
>  #include <linux/delay.h>
>  #include <linux/phy/omap_control_phy.h>
>  #include <linux/phy/phy.h>
> +#include <linux/mfd/syscon.h>
> +#include <linux/regmap.h>
>  #include <linux/of_platform.h>
>  
>  #define USB2PHY_DISCON_BYP_LATCH (1 << 31)
> @@ -97,22 +99,65 @@ static int omap_usb_set_peripheral(struct usb_otg *otg,
>  	return 0;
>  }
>  
> -static int omap_usb_power_off(struct phy *x)
> +static int omap_usb_phy_power(struct omap_usb *phy, int on)
>  {
> -	struct omap_usb *phy = phy_get_drvdata(x);
> +	u32 val = 0;
> +	u32 mask;
> +	int ret;
>  
> -	omap_control_phy_power(phy->control_dev, 0);
> +	if (phy->syscon_phy_power) {
> +		switch (phy->type) {
> +		case TYPE_USB2:
> +			mask = OMAP_DEV_PHY_PD;
> +			if (!on)
> +				val = OMAP_DEV_PHY_PD;
> +			break;
> +		case TYPE_DRA7USB2:
> +			mask = OMAP_USB2_PHY_PD;
> +			if (!on)
> +				val = OMAP_USB2_PHY_PD;
> +			break;
> +		case TYPE_AM437USB2:
> +			mask = AM437X_USB2_PHY_PD |
> +				AM437X_USB2_OTG_PD |
> +				AM437X_USB2_OTGVDET_EN |
> +				AM437X_USB2_OTGSESSEND_EN;
> +			if (on) {
> +				val = AM437X_USB2_OTGVDET_EN |
> +					AM437X_USB2_OTGSESSEND_EN;
> +			} else {
> +				val = AM437X_USB2_PHY_PD | AM437X_USB2_OTG_PD;
> +			}
> +			break;
> +		default:
> +			dev_err(phy->dev, "%s: type %d not recognized\n",
> +				__func__, phy->type);
> +			return -EINVAL;
> +		}
> +
> +		ret = regmap_update_bits(phy->syscon_phy_power, phy->power_reg,
> +					 mask, val);
> +		if (ret < 0)
> +			return ret;
> +	} else {
> +		omap_control_phy_power(phy->control_dev, on);
> +	}
>  
>  	return 0;
>  }
>  
> -static int omap_usb_power_on(struct phy *x)
> +static int omap_usb_power_off(struct phy *x)
>  {
>  	struct omap_usb *phy = phy_get_drvdata(x);
>  
> -	omap_control_phy_power(phy->control_dev, 1);
> +	return omap_usb_phy_power(phy, false);
> +}
>  
> -	return 0;
> +static int omap_usb_power_on(struct phy *x)
> +{
> +	struct omap_usb *phy = phy_get_drvdata(x);
> +
> +	return omap_usb_phy_power(phy, true);
>  }
>  
>  static int omap_usb_init(struct phy *x)
> @@ -147,26 +192,31 @@ static struct phy_ops ops = {
>  static const struct usb_phy_data omap_usb2_data = {
>  	.label = "omap_usb2",
>  	.flags = OMAP_USB2_HAS_START_SRP | OMAP_USB2_HAS_SET_VBUS,
> +	.type = TYPE_USB2,
>  };
>  
>  static const struct usb_phy_data omap5_usb2_data = {
>  	.label = "omap5_usb2",
>  	.flags = 0,
> +	.type = TYPE_USB2,
>  };
>  
>  static const struct usb_phy_data dra7x_usb2_data = {
>  	.label = "dra7x_usb2",
>  	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
> +	.type = TYPE_USB2,
>  };
>  
>  static const struct usb_phy_data dra7x_usb2_phy2_data = {
>  	.label = "dra7x_usb2_phy2",
>  	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
> +	.type = TYPE_DRA7USB2,
>  };
>  
>  static const struct usb_phy_data am437x_usb2_data = {
>  	.label = "am437x_usb2",
>  	.flags =  0,
> +	.type = TYPE_AM437USB2,
>  };
>  
>  static const struct of_device_id omap_usb2_id_table[] = {
> @@ -223,6 +273,7 @@ static int omap_usb2_probe(struct platform_device *pdev)
>  		return -ENOMEM;
>  
>  	phy->dev		= &pdev->dev;
> +	phy->type		= phy_data->type;
>  
>  	phy->phy.dev		= phy->dev;
>  	phy->phy.label		= phy_data->label;
> @@ -237,20 +288,36 @@ static int omap_usb2_probe(struct platform_device *pdev)
>  		phy->flags |= OMAP_USB2_CALIBRATE_FALSE_DISCONNECT;
>  	}
>  
> -	control_node = of_parse_phandle(node, "ctrl-module", 0);
> -	if (!control_node) {
> -		dev_err(&pdev->dev, "Failed to get control device phandle\n");
> -		return -EINVAL;
> -	}
> +	phy->syscon_phy_power = syscon_regmap_lookup_by_phandle(node,
> +							"syscon-phy-power");
> +	if (IS_ERR(phy->syscon_phy_power)) {
> +		dev_info(&pdev->dev,
> +			 "can't get syscon-phy-power, using control device\n");
> +		phy->syscon_phy_power = NULL;
> +
> +		control_node = of_parse_phandle(node, "ctrl-module", 0);
> +		if (!control_node) {
> +			dev_err(&pdev->dev,
> +				"Failed to get control device phandle\n");
> +			return -EINVAL;
> +		}
>  
> -	control_pdev = of_find_device_by_node(control_node);
> -	if (!control_pdev) {
> -		dev_err(&pdev->dev, "Failed to get control device\n");
> -		return -EINVAL;
> +		control_pdev = of_find_device_by_node(control_node);
> +		if (!control_pdev) {
> +			dev_err(&pdev->dev, "Failed to get control device\n");
> +			return -EINVAL;
> +		}
> +		phy->control_dev = &control_pdev->dev;
> +	} else {
> +		if (of_property_read_u32_index(node,
> +					       "syscon-phy-power", 1,
> +					       &phy->power_reg)) {
> +			dev_err(&pdev->dev,
> +				"couldn't get power reg. offset\n");
> +			return -EINVAL;
> +		}
>  	}
>  
> -	phy->control_dev = &control_pdev->dev;
> -
>  	otg->set_host		= omap_usb_set_host;
>  	otg->set_peripheral	= omap_usb_set_peripheral;
>  	if (phy_data->flags & OMAP_USB2_HAS_SET_VBUS)
> diff --git a/include/linux/phy/omap_usb.h b/include/linux/phy/omap_usb.h
> index dc2c541..de933ab 100644
> --- a/include/linux/phy/omap_usb.h
> +++ b/include/linux/phy/omap_usb.h
> @@ -30,6 +30,12 @@ struct usb_dpll_params {
>  	u32	mf;
>  };
>  
> +enum omap_usb_phy_type {
> +	TYPE_USB2,    /* USB2_PHY, power down in CONTROL_DEV_CONF */
> +	TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */
> +	TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */
> +};
> +
>  struct omap_usb {
>  	struct usb_phy		phy;
>  	struct phy_companion	*comparator;
> @@ -40,11 +46,15 @@ struct omap_usb {
>  	struct clk		*wkupclk;
>  	struct clk		*optclk;
>  	u8			flags;
> +	enum omap_usb_phy_type	type;
> +	struct regmap		*syscon_phy_power; /* ctrl. reg. acces */
> +	unsigned int		power_reg; /* power reg. index within syscon */
>  };
>  
>  struct usb_phy_data {
>  	const char *label;
>  	u8 flags;
> +	enum omap_usb_phy_type type;
>  };
>  
>  /* Driver Flags */
> @@ -52,6 +62,14 @@ struct usb_phy_data {
>  #define OMAP_USB2_HAS_SET_VBUS (1 << 1)
>  #define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT (1 << 2)
>  
> +#define OMAP_DEV_PHY_PD		BIT(0)
> +#define OMAP_USB2_PHY_PD	BIT(28)
> +
> +#define AM437X_USB2_PHY_PD		BIT(0)

This PD bit can be set in usb_phy_data and used by
a single block of code for all 3 phys.

> +#define AM437X_USB2_OTG_PD		BIT(1)
> +#define AM437X_USB2_OTGVDET_EN		BIT(19)
> +#define AM437X_USB2_OTGSESSEND_EN	BIT(20)
> +
>  #define	phy_to_omapusb(x)	container_of((x), struct omap_usb, phy)
>  
>  #if defined(CONFIG_OMAP_USB2) || defined(CONFIG_OMAP_USB2_MODULE)
> -- 
> 1.7.9.5
> 

cheers,
-roger

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

* Re: [PATCH 06/17] phy: omap-usb2: use *syscon* framework to power on/off the PHY
@ 2015-06-24 11:33     ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 11:33 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson-rdvid1DuHRBWk0Htik3J/w, tony-4v6yS6AI5VpBDgjK7y7TUQ,
	balbi-l0cyMroinI0, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0

On Tue, 23 Jun 2015 17:28:51 +0530
Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org> wrote:

> Deprecate using phy-omap-control driver to power on/off the PHY,
> and use *syscon* framework to do the same. This handles
> powering on/off the PHY for the USB2 PHYs used in various TI SoCs.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
> ---
>  Documentation/devicetree/bindings/phy/ti-phy.txt |    6 +-
>  drivers/phy/phy-omap-usb2.c                      |  101 ++++++++++++++++++----
>  include/linux/phy/omap_usb.h                     |   18 ++++
>  3 files changed, 107 insertions(+), 18 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
> index b9101b9..5bfe461 100644
> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
> @@ -42,10 +42,14 @@ Required properties:
>     * "wkupclk" - wakeup clock.
>     * "refclk" - reference clock (optional).
>  
> -Optional properties:
> +Deprecated properties:
>   - ctrl-module : phandle of the control module used by PHY driver to power on
>     the PHY.
>  
> +Recommended properies:
> +- syscon-phy-power : phandle/offset pair. Phandle to the system control
> +  module and the register offset to power on/off the PHY.
> +
>  This is usually a subnode of ocp2scp to which it is connected.
>  
>  usb2phy@4a0ad080 {
> diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
> index 2f7220f..180b066 100644
> --- a/drivers/phy/phy-omap-usb2.c
> +++ b/drivers/phy/phy-omap-usb2.c
> @@ -29,6 +29,8 @@
>  #include <linux/delay.h>
>  #include <linux/phy/omap_control_phy.h>
>  #include <linux/phy/phy.h>
> +#include <linux/mfd/syscon.h>
> +#include <linux/regmap.h>
>  #include <linux/of_platform.h>
>  
>  #define USB2PHY_DISCON_BYP_LATCH (1 << 31)
> @@ -97,22 +99,65 @@ static int omap_usb_set_peripheral(struct usb_otg *otg,
>  	return 0;
>  }
>  
> -static int omap_usb_power_off(struct phy *x)
> +static int omap_usb_phy_power(struct omap_usb *phy, int on)
>  {
> -	struct omap_usb *phy = phy_get_drvdata(x);
> +	u32 val = 0;
> +	u32 mask;
> +	int ret;
>  
> -	omap_control_phy_power(phy->control_dev, 0);
> +	if (phy->syscon_phy_power) {
> +		switch (phy->type) {
> +		case TYPE_USB2:
> +			mask = OMAP_DEV_PHY_PD;
> +			if (!on)
> +				val = OMAP_DEV_PHY_PD;
> +			break;
> +		case TYPE_DRA7USB2:
> +			mask = OMAP_USB2_PHY_PD;
> +			if (!on)
> +				val = OMAP_USB2_PHY_PD;
> +			break;
> +		case TYPE_AM437USB2:
> +			mask = AM437X_USB2_PHY_PD |
> +				AM437X_USB2_OTG_PD |
> +				AM437X_USB2_OTGVDET_EN |
> +				AM437X_USB2_OTGSESSEND_EN;
> +			if (on) {
> +				val = AM437X_USB2_OTGVDET_EN |
> +					AM437X_USB2_OTGSESSEND_EN;
> +			} else {
> +				val = AM437X_USB2_PHY_PD | AM437X_USB2_OTG_PD;
> +			}
> +			break;
> +		default:
> +			dev_err(phy->dev, "%s: type %d not recognized\n",
> +				__func__, phy->type);
> +			return -EINVAL;
> +		}
> +
> +		ret = regmap_update_bits(phy->syscon_phy_power, phy->power_reg,
> +					 mask, val);
> +		if (ret < 0)
> +			return ret;
> +	} else {
> +		omap_control_phy_power(phy->control_dev, on);
> +	}
>  
>  	return 0;
>  }
>  
> -static int omap_usb_power_on(struct phy *x)
> +static int omap_usb_power_off(struct phy *x)
>  {
>  	struct omap_usb *phy = phy_get_drvdata(x);
>  
> -	omap_control_phy_power(phy->control_dev, 1);
> +	return omap_usb_phy_power(phy, false);
> +}
>  
> -	return 0;
> +static int omap_usb_power_on(struct phy *x)
> +{
> +	struct omap_usb *phy = phy_get_drvdata(x);
> +
> +	return omap_usb_phy_power(phy, true);
>  }
>  
>  static int omap_usb_init(struct phy *x)
> @@ -147,26 +192,31 @@ static struct phy_ops ops = {
>  static const struct usb_phy_data omap_usb2_data = {
>  	.label = "omap_usb2",
>  	.flags = OMAP_USB2_HAS_START_SRP | OMAP_USB2_HAS_SET_VBUS,
> +	.type = TYPE_USB2,
>  };
>  
>  static const struct usb_phy_data omap5_usb2_data = {
>  	.label = "omap5_usb2",
>  	.flags = 0,
> +	.type = TYPE_USB2,
>  };
>  
>  static const struct usb_phy_data dra7x_usb2_data = {
>  	.label = "dra7x_usb2",
>  	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
> +	.type = TYPE_USB2,
>  };
>  
>  static const struct usb_phy_data dra7x_usb2_phy2_data = {
>  	.label = "dra7x_usb2_phy2",
>  	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
> +	.type = TYPE_DRA7USB2,
>  };
>  
>  static const struct usb_phy_data am437x_usb2_data = {
>  	.label = "am437x_usb2",
>  	.flags =  0,
> +	.type = TYPE_AM437USB2,
>  };
>  
>  static const struct of_device_id omap_usb2_id_table[] = {
> @@ -223,6 +273,7 @@ static int omap_usb2_probe(struct platform_device *pdev)
>  		return -ENOMEM;
>  
>  	phy->dev		= &pdev->dev;
> +	phy->type		= phy_data->type;
>  
>  	phy->phy.dev		= phy->dev;
>  	phy->phy.label		= phy_data->label;
> @@ -237,20 +288,36 @@ static int omap_usb2_probe(struct platform_device *pdev)
>  		phy->flags |= OMAP_USB2_CALIBRATE_FALSE_DISCONNECT;
>  	}
>  
> -	control_node = of_parse_phandle(node, "ctrl-module", 0);
> -	if (!control_node) {
> -		dev_err(&pdev->dev, "Failed to get control device phandle\n");
> -		return -EINVAL;
> -	}
> +	phy->syscon_phy_power = syscon_regmap_lookup_by_phandle(node,
> +							"syscon-phy-power");
> +	if (IS_ERR(phy->syscon_phy_power)) {
> +		dev_info(&pdev->dev,
> +			 "can't get syscon-phy-power, using control device\n");
> +		phy->syscon_phy_power = NULL;
> +
> +		control_node = of_parse_phandle(node, "ctrl-module", 0);
> +		if (!control_node) {
> +			dev_err(&pdev->dev,
> +				"Failed to get control device phandle\n");
> +			return -EINVAL;
> +		}
>  
> -	control_pdev = of_find_device_by_node(control_node);
> -	if (!control_pdev) {
> -		dev_err(&pdev->dev, "Failed to get control device\n");
> -		return -EINVAL;
> +		control_pdev = of_find_device_by_node(control_node);
> +		if (!control_pdev) {
> +			dev_err(&pdev->dev, "Failed to get control device\n");
> +			return -EINVAL;
> +		}
> +		phy->control_dev = &control_pdev->dev;
> +	} else {
> +		if (of_property_read_u32_index(node,
> +					       "syscon-phy-power", 1,
> +					       &phy->power_reg)) {
> +			dev_err(&pdev->dev,
> +				"couldn't get power reg. offset\n");
> +			return -EINVAL;
> +		}
>  	}
>  
> -	phy->control_dev = &control_pdev->dev;
> -
>  	otg->set_host		= omap_usb_set_host;
>  	otg->set_peripheral	= omap_usb_set_peripheral;
>  	if (phy_data->flags & OMAP_USB2_HAS_SET_VBUS)
> diff --git a/include/linux/phy/omap_usb.h b/include/linux/phy/omap_usb.h
> index dc2c541..de933ab 100644
> --- a/include/linux/phy/omap_usb.h
> +++ b/include/linux/phy/omap_usb.h
> @@ -30,6 +30,12 @@ struct usb_dpll_params {
>  	u32	mf;
>  };
>  
> +enum omap_usb_phy_type {
> +	TYPE_USB2,    /* USB2_PHY, power down in CONTROL_DEV_CONF */
> +	TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */
> +	TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */
> +};
> +
>  struct omap_usb {
>  	struct usb_phy		phy;
>  	struct phy_companion	*comparator;
> @@ -40,11 +46,15 @@ struct omap_usb {
>  	struct clk		*wkupclk;
>  	struct clk		*optclk;
>  	u8			flags;
> +	enum omap_usb_phy_type	type;
> +	struct regmap		*syscon_phy_power; /* ctrl. reg. acces */
> +	unsigned int		power_reg; /* power reg. index within syscon */
>  };
>  
>  struct usb_phy_data {
>  	const char *label;
>  	u8 flags;
> +	enum omap_usb_phy_type type;
>  };
>  
>  /* Driver Flags */
> @@ -52,6 +62,14 @@ struct usb_phy_data {
>  #define OMAP_USB2_HAS_SET_VBUS (1 << 1)
>  #define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT (1 << 2)
>  
> +#define OMAP_DEV_PHY_PD		BIT(0)
> +#define OMAP_USB2_PHY_PD	BIT(28)
> +
> +#define AM437X_USB2_PHY_PD		BIT(0)

This PD bit can be set in usb_phy_data and used by
a single block of code for all 3 phys.

> +#define AM437X_USB2_OTG_PD		BIT(1)
> +#define AM437X_USB2_OTGVDET_EN		BIT(19)
> +#define AM437X_USB2_OTGSESSEND_EN	BIT(20)
> +
>  #define	phy_to_omapusb(x)	container_of((x), struct omap_usb, phy)
>  
>  #if defined(CONFIG_OMAP_USB2) || defined(CONFIG_OMAP_USB2_MODULE)
> -- 
> 1.7.9.5
> 

cheers,
-roger
--
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	[flat|nested] 150+ messages in thread

* [PATCH 06/17] phy: omap-usb2: use *syscon* framework to power on/off the PHY
@ 2015-06-24 11:33     ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 11:33 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 23 Jun 2015 17:28:51 +0530
Kishon Vijay Abraham I <kishon@ti.com> wrote:

> Deprecate using phy-omap-control driver to power on/off the PHY,
> and use *syscon* framework to do the same. This handles
> powering on/off the PHY for the USB2 PHYs used in various TI SoCs.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  Documentation/devicetree/bindings/phy/ti-phy.txt |    6 +-
>  drivers/phy/phy-omap-usb2.c                      |  101 ++++++++++++++++++----
>  include/linux/phy/omap_usb.h                     |   18 ++++
>  3 files changed, 107 insertions(+), 18 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
> index b9101b9..5bfe461 100644
> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
> @@ -42,10 +42,14 @@ Required properties:
>     * "wkupclk" - wakeup clock.
>     * "refclk" - reference clock (optional).
>  
> -Optional properties:
> +Deprecated properties:
>   - ctrl-module : phandle of the control module used by PHY driver to power on
>     the PHY.
>  
> +Recommended properies:
> +- syscon-phy-power : phandle/offset pair. Phandle to the system control
> +  module and the register offset to power on/off the PHY.
> +
>  This is usually a subnode of ocp2scp to which it is connected.
>  
>  usb2phy at 4a0ad080 {
> diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
> index 2f7220f..180b066 100644
> --- a/drivers/phy/phy-omap-usb2.c
> +++ b/drivers/phy/phy-omap-usb2.c
> @@ -29,6 +29,8 @@
>  #include <linux/delay.h>
>  #include <linux/phy/omap_control_phy.h>
>  #include <linux/phy/phy.h>
> +#include <linux/mfd/syscon.h>
> +#include <linux/regmap.h>
>  #include <linux/of_platform.h>
>  
>  #define USB2PHY_DISCON_BYP_LATCH (1 << 31)
> @@ -97,22 +99,65 @@ static int omap_usb_set_peripheral(struct usb_otg *otg,
>  	return 0;
>  }
>  
> -static int omap_usb_power_off(struct phy *x)
> +static int omap_usb_phy_power(struct omap_usb *phy, int on)
>  {
> -	struct omap_usb *phy = phy_get_drvdata(x);
> +	u32 val = 0;
> +	u32 mask;
> +	int ret;
>  
> -	omap_control_phy_power(phy->control_dev, 0);
> +	if (phy->syscon_phy_power) {
> +		switch (phy->type) {
> +		case TYPE_USB2:
> +			mask = OMAP_DEV_PHY_PD;
> +			if (!on)
> +				val = OMAP_DEV_PHY_PD;
> +			break;
> +		case TYPE_DRA7USB2:
> +			mask = OMAP_USB2_PHY_PD;
> +			if (!on)
> +				val = OMAP_USB2_PHY_PD;
> +			break;
> +		case TYPE_AM437USB2:
> +			mask = AM437X_USB2_PHY_PD |
> +				AM437X_USB2_OTG_PD |
> +				AM437X_USB2_OTGVDET_EN |
> +				AM437X_USB2_OTGSESSEND_EN;
> +			if (on) {
> +				val = AM437X_USB2_OTGVDET_EN |
> +					AM437X_USB2_OTGSESSEND_EN;
> +			} else {
> +				val = AM437X_USB2_PHY_PD | AM437X_USB2_OTG_PD;
> +			}
> +			break;
> +		default:
> +			dev_err(phy->dev, "%s: type %d not recognized\n",
> +				__func__, phy->type);
> +			return -EINVAL;
> +		}
> +
> +		ret = regmap_update_bits(phy->syscon_phy_power, phy->power_reg,
> +					 mask, val);
> +		if (ret < 0)
> +			return ret;
> +	} else {
> +		omap_control_phy_power(phy->control_dev, on);
> +	}
>  
>  	return 0;
>  }
>  
> -static int omap_usb_power_on(struct phy *x)
> +static int omap_usb_power_off(struct phy *x)
>  {
>  	struct omap_usb *phy = phy_get_drvdata(x);
>  
> -	omap_control_phy_power(phy->control_dev, 1);
> +	return omap_usb_phy_power(phy, false);
> +}
>  
> -	return 0;
> +static int omap_usb_power_on(struct phy *x)
> +{
> +	struct omap_usb *phy = phy_get_drvdata(x);
> +
> +	return omap_usb_phy_power(phy, true);
>  }
>  
>  static int omap_usb_init(struct phy *x)
> @@ -147,26 +192,31 @@ static struct phy_ops ops = {
>  static const struct usb_phy_data omap_usb2_data = {
>  	.label = "omap_usb2",
>  	.flags = OMAP_USB2_HAS_START_SRP | OMAP_USB2_HAS_SET_VBUS,
> +	.type = TYPE_USB2,
>  };
>  
>  static const struct usb_phy_data omap5_usb2_data = {
>  	.label = "omap5_usb2",
>  	.flags = 0,
> +	.type = TYPE_USB2,
>  };
>  
>  static const struct usb_phy_data dra7x_usb2_data = {
>  	.label = "dra7x_usb2",
>  	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
> +	.type = TYPE_USB2,
>  };
>  
>  static const struct usb_phy_data dra7x_usb2_phy2_data = {
>  	.label = "dra7x_usb2_phy2",
>  	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
> +	.type = TYPE_DRA7USB2,
>  };
>  
>  static const struct usb_phy_data am437x_usb2_data = {
>  	.label = "am437x_usb2",
>  	.flags =  0,
> +	.type = TYPE_AM437USB2,
>  };
>  
>  static const struct of_device_id omap_usb2_id_table[] = {
> @@ -223,6 +273,7 @@ static int omap_usb2_probe(struct platform_device *pdev)
>  		return -ENOMEM;
>  
>  	phy->dev		= &pdev->dev;
> +	phy->type		= phy_data->type;
>  
>  	phy->phy.dev		= phy->dev;
>  	phy->phy.label		= phy_data->label;
> @@ -237,20 +288,36 @@ static int omap_usb2_probe(struct platform_device *pdev)
>  		phy->flags |= OMAP_USB2_CALIBRATE_FALSE_DISCONNECT;
>  	}
>  
> -	control_node = of_parse_phandle(node, "ctrl-module", 0);
> -	if (!control_node) {
> -		dev_err(&pdev->dev, "Failed to get control device phandle\n");
> -		return -EINVAL;
> -	}
> +	phy->syscon_phy_power = syscon_regmap_lookup_by_phandle(node,
> +							"syscon-phy-power");
> +	if (IS_ERR(phy->syscon_phy_power)) {
> +		dev_info(&pdev->dev,
> +			 "can't get syscon-phy-power, using control device\n");
> +		phy->syscon_phy_power = NULL;
> +
> +		control_node = of_parse_phandle(node, "ctrl-module", 0);
> +		if (!control_node) {
> +			dev_err(&pdev->dev,
> +				"Failed to get control device phandle\n");
> +			return -EINVAL;
> +		}
>  
> -	control_pdev = of_find_device_by_node(control_node);
> -	if (!control_pdev) {
> -		dev_err(&pdev->dev, "Failed to get control device\n");
> -		return -EINVAL;
> +		control_pdev = of_find_device_by_node(control_node);
> +		if (!control_pdev) {
> +			dev_err(&pdev->dev, "Failed to get control device\n");
> +			return -EINVAL;
> +		}
> +		phy->control_dev = &control_pdev->dev;
> +	} else {
> +		if (of_property_read_u32_index(node,
> +					       "syscon-phy-power", 1,
> +					       &phy->power_reg)) {
> +			dev_err(&pdev->dev,
> +				"couldn't get power reg. offset\n");
> +			return -EINVAL;
> +		}
>  	}
>  
> -	phy->control_dev = &control_pdev->dev;
> -
>  	otg->set_host		= omap_usb_set_host;
>  	otg->set_peripheral	= omap_usb_set_peripheral;
>  	if (phy_data->flags & OMAP_USB2_HAS_SET_VBUS)
> diff --git a/include/linux/phy/omap_usb.h b/include/linux/phy/omap_usb.h
> index dc2c541..de933ab 100644
> --- a/include/linux/phy/omap_usb.h
> +++ b/include/linux/phy/omap_usb.h
> @@ -30,6 +30,12 @@ struct usb_dpll_params {
>  	u32	mf;
>  };
>  
> +enum omap_usb_phy_type {
> +	TYPE_USB2,    /* USB2_PHY, power down in CONTROL_DEV_CONF */
> +	TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */
> +	TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */
> +};
> +
>  struct omap_usb {
>  	struct usb_phy		phy;
>  	struct phy_companion	*comparator;
> @@ -40,11 +46,15 @@ struct omap_usb {
>  	struct clk		*wkupclk;
>  	struct clk		*optclk;
>  	u8			flags;
> +	enum omap_usb_phy_type	type;
> +	struct regmap		*syscon_phy_power; /* ctrl. reg. acces */
> +	unsigned int		power_reg; /* power reg. index within syscon */
>  };
>  
>  struct usb_phy_data {
>  	const char *label;
>  	u8 flags;
> +	enum omap_usb_phy_type type;
>  };
>  
>  /* Driver Flags */
> @@ -52,6 +62,14 @@ struct usb_phy_data {
>  #define OMAP_USB2_HAS_SET_VBUS (1 << 1)
>  #define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT (1 << 2)
>  
> +#define OMAP_DEV_PHY_PD		BIT(0)
> +#define OMAP_USB2_PHY_PD	BIT(28)
> +
> +#define AM437X_USB2_PHY_PD		BIT(0)

This PD bit can be set in usb_phy_data and used by
a single block of code for all 3 phys.

> +#define AM437X_USB2_OTG_PD		BIT(1)
> +#define AM437X_USB2_OTGVDET_EN		BIT(19)
> +#define AM437X_USB2_OTGSESSEND_EN	BIT(20)
> +
>  #define	phy_to_omapusb(x)	container_of((x), struct omap_usb, phy)
>  
>  #if defined(CONFIG_OMAP_USB2) || defined(CONFIG_OMAP_USB2_MODULE)
> -- 
> 1.7.9.5
> 

cheers,
-roger

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

* Re: [PATCH 07/17] usb: musb: omap2430: use *syscon* framework to write to mailbox register
  2015-06-23 11:58   ` Kishon Vijay Abraham I
  (?)
@ 2015-06-24 11:39     ` Roger Quadros
  -1 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 11:39 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson, tony, balbi, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

On Tue, 23 Jun 2015 17:28:52 +0530
Kishon Vijay Abraham I <kishon@ti.com> wrote:

> Deprecate using phy-omap-control driver to write to the mailbox register
> and start using *syscon* framework to do the same.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  Documentation/devicetree/bindings/usb/omap-usb.txt |    7 +-
>  drivers/usb/musb/omap2430.c                        |  118 ++++++++++++++++----
>  2 files changed, 102 insertions(+), 23 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt
> index 38d9bb8..c001306 100644
> --- a/Documentation/devicetree/bindings/usb/omap-usb.txt
> +++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
> @@ -20,10 +20,15 @@ OMAP MUSB GLUE
>   - phy-names : the names of the PHY corresponding to the PHYs present in the
>     *phy* phandle.
>  
> -Optional properties:
> +Optional Properties:
> +Deprecated properties:
>   - ctrl-module : phandle of the control module this glue uses to write to
>     mailbox
>  
> +Recommended properies:
> + - syscon-otghs : phandle/offset pair. Phandle to the system control module and the
> +   register offset of the mailbox.
> +
>  SOC specific device node entry
>  usb_otg_hs: usb_otg_hs@4a0ab000 {
>  	compatible = "ti,omap4-musb";
> diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
> index cc752d8..bcd6d1e 100644
> --- a/drivers/usb/musb/omap2430.c
> +++ b/drivers/usb/musb/omap2430.c
> @@ -39,16 +39,27 @@
>  #include <linux/usb/musb-omap.h>
>  #include <linux/phy/omap_control_phy.h>
>  #include <linux/of_platform.h>
> +#include <linux/regmap.h>
> +#include <linux/mfd/syscon.h>
>  
>  #include "musb_core.h"
>  #include "omap2430.h"
>  
> +#define OMAP2430_MUSB_MODE_MASK	0x1f
> +#define OMAP2430_MUSB_AVALID	(0x1 << 0)
> +#define OMAP2430_MUSB_BVALID	(0x1 << 1)
> +#define OMAP2430_MUSB_VBUSVALID	(0x1 << 2)
> +#define OMAP2430_MUSB_SESSEND	(0x1 << 3)
> +#define OMAP2430_MUSB_IDDIG	(0x1 << 4)
> +
>  struct omap2430_glue {
>  	struct device		*dev;
>  	struct platform_device	*musb;
>  	enum omap_musb_vbus_id_status status;
>  	struct work_struct	omap_musb_mailbox_work;
>  	struct device		*control_otghs;
> +	struct regmap		*syscon_otghs; /* ctrl. reg. acces */
> +	unsigned int            otghs_reg; /* otghs reg. index within syscon */
>  };
>  #define glue_to_musb(g)		platform_get_drvdata(g->musb)
>  
> @@ -253,6 +264,47 @@ void omap_musb_mailbox(enum omap_musb_vbus_id_status status)
>  }
>  EXPORT_SYMBOL_GPL(omap_musb_mailbox);
>  
> +static void omap2430_musb_set_usbmode(struct omap2430_glue *glue,
> +				      enum omap_control_usb_mode mode)
> +{
> +	u32 val;
> +	int ret;
> +
> +	if (glue->syscon_otghs) {
> +		switch (mode) {
> +		case USB_MODE_HOST:
> +			val = OMAP2430_MUSB_AVALID | OMAP2430_MUSB_VBUSVALID;
> +			break;
> +
> +		case USB_MODE_DEVICE:
> +			val = OMAP2430_MUSB_IDDIG | OMAP2430_MUSB_AVALID |
> +				OMAP2430_MUSB_VBUSVALID;
> +			break;
> +
> +		case USB_MODE_DISCONNECT:
> +			val = OMAP2430_MUSB_IDDIG | OMAP2430_MUSB_SESSEND;
> +			break;
> +
> +		default:
> +			dev_dbg(glue->dev, "Invalid mode\n");
> +			goto err_regmap_update;
> +		}
> +
> +		ret = regmap_update_bits(glue->syscon_otghs,
> +					 glue->otghs_reg,
> +					 OMAP2430_MUSB_MODE_MASK, val);
> +		if (ret < 0)
> +			goto err_regmap_update;
> +	} else {
> +		omap_control_usb_set_mode(glue->control_otghs, mode);
> +	}
> +
> +	return;
> +
> +err_regmap_update:
> +	dev_err(glue->dev, "Failed to set mode to %d\n", mode);
> +}
> +
>  static void omap_musb_set_mailbox(struct omap2430_glue *glue)
>  {
>  	struct musb *musb = glue_to_musb(glue);
> @@ -270,8 +322,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
>  		musb->xceiv->last_event = USB_EVENT_ID;
>  		if (musb->gadget_driver) {
>  			pm_runtime_get_sync(dev);
> -			omap_control_usb_set_mode(glue->control_otghs,
> -				USB_MODE_HOST);
> +			omap2430_musb_set_usbmode(glue, USB_MODE_HOST);
>  			omap2430_musb_set_vbus(musb, 1);
>  		}
>  		break;
> @@ -284,7 +335,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
>  		musb->xceiv->last_event = USB_EVENT_VBUS;
>  		if (musb->gadget_driver)
>  			pm_runtime_get_sync(dev);
> -		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE);
> +		omap2430_musb_set_usbmode(glue, USB_MODE_DEVICE);
>  		break;
>  
>  	case OMAP_MUSB_ID_FLOAT:
> @@ -301,8 +352,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
>  		if (data->interface_type == MUSB_INTERFACE_UTMI)
>  			otg_set_vbus(musb->xceiv->otg, 0);
>  
> -		omap_control_usb_set_mode(glue->control_otghs,
> -			USB_MODE_DISCONNECT);
> +		omap2430_musb_set_usbmode(glue, USB_MODE_DISCONNECT);
>  		break;
>  	default:
>  		dev_dbg(dev, "ID float\n");
> @@ -444,7 +494,7 @@ static void omap2430_musb_enable(struct musb *musb)
>  	switch (glue->status) {
>  
>  	case OMAP_MUSB_ID_GROUND:
> -		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_HOST);
> +		omap2430_musb_set_usbmode(glue, USB_MODE_HOST);
>  		if (data->interface_type != MUSB_INTERFACE_UTMI)
>  			break;
>  		devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
> @@ -463,7 +513,7 @@ static void omap2430_musb_enable(struct musb *musb)
>  		break;
>  
>  	case OMAP_MUSB_VBUS_VALID:
> -		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE);
> +		omap2430_musb_set_usbmode(glue, USB_MODE_DEVICE);
>  		break;
>  
>  	default:
> @@ -477,8 +527,7 @@ static void omap2430_musb_disable(struct musb *musb)
>  	struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
>  
>  	if (glue->status != OMAP_MUSB_UNKNOWN)
> -		omap_control_usb_set_mode(glue->control_otghs,
> -			USB_MODE_DISCONNECT);
> +		omap2430_musb_set_usbmode(glue, USB_MODE_DISCONNECT);
>  }
>  
>  static int omap2430_musb_exit(struct musb *musb)
> @@ -507,6 +556,40 @@ static const struct musb_platform_ops omap2430_ops = {
>  
>  static u64 omap2430_dmamask = DMA_BIT_MASK(32);
>  
> +static int omap2430_get_control(struct omap2430_glue *glue,
> +				struct device_node *np)
> +{
> +	struct device_node *control_node;
> +	struct platform_device *control_pdev;
> +
> +	glue->syscon_otghs = syscon_regmap_lookup_by_phandle(np,
> +							     "syscon-otghs");
> +	if (IS_ERR(glue->syscon_otghs)) {
> +		dev_info(glue->dev, "can't get syscon, using control device\n");

dev_dbg().

> +		glue->syscon_otghs = NULL;
> +
> +		control_node = of_parse_phandle(np, "ctrl-module", 0);
> +		if (control_node) {
> +			control_pdev = of_find_device_by_node(control_node);
> +			if (!control_pdev) {
> +				dev_err(glue->dev,
> +					"Failed to get control device\n");
> +				return -EINVAL;
> +			}
> +			glue->control_otghs = &control_pdev->dev;
> +		}
> +	} else {
> +		if (of_property_read_u32_index(np, "syscon-otghs", 1,
> +					       &glue->otghs_reg)) {
> +			dev_err(glue->dev,
> +				"couldn't get otghs reg. offset\n");
> +			return -EINVAL;
> +		}
> +	}
> +
> +	return 0;
> +}
> +
>  static int omap2430_probe(struct platform_device *pdev)
>  {
>  	struct resource			musb_resources[3];
> @@ -538,9 +621,6 @@ static int omap2430_probe(struct platform_device *pdev)
>  	glue->control_otghs = ERR_PTR(-ENODEV);
>  
>  	if (np) {
> -		struct device_node *control_node;
> -		struct platform_device *control_pdev;
> -
>  		pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
>  		if (!pdata)
>  			goto err2;
> @@ -567,16 +647,10 @@ static int omap2430_probe(struct platform_device *pdev)
>  		pdata->board_data	= data;
>  		pdata->config		= config;
>  
> -		control_node = of_parse_phandle(np, "ctrl-module", 0);
> -		if (control_node) {
> -			control_pdev = of_find_device_by_node(control_node);
> -			if (!control_pdev) {
> -				dev_err(&pdev->dev, "Failed to get control device\n");
> -				ret = -EINVAL;
> -				goto err2;
> -			}
> -			glue->control_otghs = &control_pdev->dev;
> -		}
> +		ret = omap2430_get_control(glue, np);
> +		if (ret)
> +			goto err2;
> +
>  	}
>  	pdata->platform_ops		= &omap2430_ops;
>  

cheers,
-roger

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

* Re: [PATCH 07/17] usb: musb: omap2430: use *syscon* framework to write to mailbox register
@ 2015-06-24 11:39     ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 11:39 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson, tony, balbi, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

On Tue, 23 Jun 2015 17:28:52 +0530
Kishon Vijay Abraham I <kishon@ti.com> wrote:

> Deprecate using phy-omap-control driver to write to the mailbox register
> and start using *syscon* framework to do the same.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  Documentation/devicetree/bindings/usb/omap-usb.txt |    7 +-
>  drivers/usb/musb/omap2430.c                        |  118 ++++++++++++++++----
>  2 files changed, 102 insertions(+), 23 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt
> index 38d9bb8..c001306 100644
> --- a/Documentation/devicetree/bindings/usb/omap-usb.txt
> +++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
> @@ -20,10 +20,15 @@ OMAP MUSB GLUE
>   - phy-names : the names of the PHY corresponding to the PHYs present in the
>     *phy* phandle.
>  
> -Optional properties:
> +Optional Properties:
> +Deprecated properties:
>   - ctrl-module : phandle of the control module this glue uses to write to
>     mailbox
>  
> +Recommended properies:
> + - syscon-otghs : phandle/offset pair. Phandle to the system control module and the
> +   register offset of the mailbox.
> +
>  SOC specific device node entry
>  usb_otg_hs: usb_otg_hs@4a0ab000 {
>  	compatible = "ti,omap4-musb";
> diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
> index cc752d8..bcd6d1e 100644
> --- a/drivers/usb/musb/omap2430.c
> +++ b/drivers/usb/musb/omap2430.c
> @@ -39,16 +39,27 @@
>  #include <linux/usb/musb-omap.h>
>  #include <linux/phy/omap_control_phy.h>
>  #include <linux/of_platform.h>
> +#include <linux/regmap.h>
> +#include <linux/mfd/syscon.h>
>  
>  #include "musb_core.h"
>  #include "omap2430.h"
>  
> +#define OMAP2430_MUSB_MODE_MASK	0x1f
> +#define OMAP2430_MUSB_AVALID	(0x1 << 0)
> +#define OMAP2430_MUSB_BVALID	(0x1 << 1)
> +#define OMAP2430_MUSB_VBUSVALID	(0x1 << 2)
> +#define OMAP2430_MUSB_SESSEND	(0x1 << 3)
> +#define OMAP2430_MUSB_IDDIG	(0x1 << 4)
> +
>  struct omap2430_glue {
>  	struct device		*dev;
>  	struct platform_device	*musb;
>  	enum omap_musb_vbus_id_status status;
>  	struct work_struct	omap_musb_mailbox_work;
>  	struct device		*control_otghs;
> +	struct regmap		*syscon_otghs; /* ctrl. reg. acces */
> +	unsigned int            otghs_reg; /* otghs reg. index within syscon */
>  };
>  #define glue_to_musb(g)		platform_get_drvdata(g->musb)
>  
> @@ -253,6 +264,47 @@ void omap_musb_mailbox(enum omap_musb_vbus_id_status status)
>  }
>  EXPORT_SYMBOL_GPL(omap_musb_mailbox);
>  
> +static void omap2430_musb_set_usbmode(struct omap2430_glue *glue,
> +				      enum omap_control_usb_mode mode)
> +{
> +	u32 val;
> +	int ret;
> +
> +	if (glue->syscon_otghs) {
> +		switch (mode) {
> +		case USB_MODE_HOST:
> +			val = OMAP2430_MUSB_AVALID | OMAP2430_MUSB_VBUSVALID;
> +			break;
> +
> +		case USB_MODE_DEVICE:
> +			val = OMAP2430_MUSB_IDDIG | OMAP2430_MUSB_AVALID |
> +				OMAP2430_MUSB_VBUSVALID;
> +			break;
> +
> +		case USB_MODE_DISCONNECT:
> +			val = OMAP2430_MUSB_IDDIG | OMAP2430_MUSB_SESSEND;
> +			break;
> +
> +		default:
> +			dev_dbg(glue->dev, "Invalid mode\n");
> +			goto err_regmap_update;
> +		}
> +
> +		ret = regmap_update_bits(glue->syscon_otghs,
> +					 glue->otghs_reg,
> +					 OMAP2430_MUSB_MODE_MASK, val);
> +		if (ret < 0)
> +			goto err_regmap_update;
> +	} else {
> +		omap_control_usb_set_mode(glue->control_otghs, mode);
> +	}
> +
> +	return;
> +
> +err_regmap_update:
> +	dev_err(glue->dev, "Failed to set mode to %d\n", mode);
> +}
> +
>  static void omap_musb_set_mailbox(struct omap2430_glue *glue)
>  {
>  	struct musb *musb = glue_to_musb(glue);
> @@ -270,8 +322,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
>  		musb->xceiv->last_event = USB_EVENT_ID;
>  		if (musb->gadget_driver) {
>  			pm_runtime_get_sync(dev);
> -			omap_control_usb_set_mode(glue->control_otghs,
> -				USB_MODE_HOST);
> +			omap2430_musb_set_usbmode(glue, USB_MODE_HOST);
>  			omap2430_musb_set_vbus(musb, 1);
>  		}
>  		break;
> @@ -284,7 +335,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
>  		musb->xceiv->last_event = USB_EVENT_VBUS;
>  		if (musb->gadget_driver)
>  			pm_runtime_get_sync(dev);
> -		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE);
> +		omap2430_musb_set_usbmode(glue, USB_MODE_DEVICE);
>  		break;
>  
>  	case OMAP_MUSB_ID_FLOAT:
> @@ -301,8 +352,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
>  		if (data->interface_type == MUSB_INTERFACE_UTMI)
>  			otg_set_vbus(musb->xceiv->otg, 0);
>  
> -		omap_control_usb_set_mode(glue->control_otghs,
> -			USB_MODE_DISCONNECT);
> +		omap2430_musb_set_usbmode(glue, USB_MODE_DISCONNECT);
>  		break;
>  	default:
>  		dev_dbg(dev, "ID float\n");
> @@ -444,7 +494,7 @@ static void omap2430_musb_enable(struct musb *musb)
>  	switch (glue->status) {
>  
>  	case OMAP_MUSB_ID_GROUND:
> -		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_HOST);
> +		omap2430_musb_set_usbmode(glue, USB_MODE_HOST);
>  		if (data->interface_type != MUSB_INTERFACE_UTMI)
>  			break;
>  		devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
> @@ -463,7 +513,7 @@ static void omap2430_musb_enable(struct musb *musb)
>  		break;
>  
>  	case OMAP_MUSB_VBUS_VALID:
> -		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE);
> +		omap2430_musb_set_usbmode(glue, USB_MODE_DEVICE);
>  		break;
>  
>  	default:
> @@ -477,8 +527,7 @@ static void omap2430_musb_disable(struct musb *musb)
>  	struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
>  
>  	if (glue->status != OMAP_MUSB_UNKNOWN)
> -		omap_control_usb_set_mode(glue->control_otghs,
> -			USB_MODE_DISCONNECT);
> +		omap2430_musb_set_usbmode(glue, USB_MODE_DISCONNECT);
>  }
>  
>  static int omap2430_musb_exit(struct musb *musb)
> @@ -507,6 +556,40 @@ static const struct musb_platform_ops omap2430_ops = {
>  
>  static u64 omap2430_dmamask = DMA_BIT_MASK(32);
>  
> +static int omap2430_get_control(struct omap2430_glue *glue,
> +				struct device_node *np)
> +{
> +	struct device_node *control_node;
> +	struct platform_device *control_pdev;
> +
> +	glue->syscon_otghs = syscon_regmap_lookup_by_phandle(np,
> +							     "syscon-otghs");
> +	if (IS_ERR(glue->syscon_otghs)) {
> +		dev_info(glue->dev, "can't get syscon, using control device\n");

dev_dbg().

> +		glue->syscon_otghs = NULL;
> +
> +		control_node = of_parse_phandle(np, "ctrl-module", 0);
> +		if (control_node) {
> +			control_pdev = of_find_device_by_node(control_node);
> +			if (!control_pdev) {
> +				dev_err(glue->dev,
> +					"Failed to get control device\n");
> +				return -EINVAL;
> +			}
> +			glue->control_otghs = &control_pdev->dev;
> +		}
> +	} else {
> +		if (of_property_read_u32_index(np, "syscon-otghs", 1,
> +					       &glue->otghs_reg)) {
> +			dev_err(glue->dev,
> +				"couldn't get otghs reg. offset\n");
> +			return -EINVAL;
> +		}
> +	}
> +
> +	return 0;
> +}
> +
>  static int omap2430_probe(struct platform_device *pdev)
>  {
>  	struct resource			musb_resources[3];
> @@ -538,9 +621,6 @@ static int omap2430_probe(struct platform_device *pdev)
>  	glue->control_otghs = ERR_PTR(-ENODEV);
>  
>  	if (np) {
> -		struct device_node *control_node;
> -		struct platform_device *control_pdev;
> -
>  		pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
>  		if (!pdata)
>  			goto err2;
> @@ -567,16 +647,10 @@ static int omap2430_probe(struct platform_device *pdev)
>  		pdata->board_data	= data;
>  		pdata->config		= config;
>  
> -		control_node = of_parse_phandle(np, "ctrl-module", 0);
> -		if (control_node) {
> -			control_pdev = of_find_device_by_node(control_node);
> -			if (!control_pdev) {
> -				dev_err(&pdev->dev, "Failed to get control device\n");
> -				ret = -EINVAL;
> -				goto err2;
> -			}
> -			glue->control_otghs = &control_pdev->dev;
> -		}
> +		ret = omap2430_get_control(glue, np);
> +		if (ret)
> +			goto err2;
> +
>  	}
>  	pdata->platform_ops		= &omap2430_ops;
>  

cheers,
-roger

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

* [PATCH 07/17] usb: musb: omap2430: use *syscon* framework to write to mailbox register
@ 2015-06-24 11:39     ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 11:39 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 23 Jun 2015 17:28:52 +0530
Kishon Vijay Abraham I <kishon@ti.com> wrote:

> Deprecate using phy-omap-control driver to write to the mailbox register
> and start using *syscon* framework to do the same.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  Documentation/devicetree/bindings/usb/omap-usb.txt |    7 +-
>  drivers/usb/musb/omap2430.c                        |  118 ++++++++++++++++----
>  2 files changed, 102 insertions(+), 23 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt
> index 38d9bb8..c001306 100644
> --- a/Documentation/devicetree/bindings/usb/omap-usb.txt
> +++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
> @@ -20,10 +20,15 @@ OMAP MUSB GLUE
>   - phy-names : the names of the PHY corresponding to the PHYs present in the
>     *phy* phandle.
>  
> -Optional properties:
> +Optional Properties:
> +Deprecated properties:
>   - ctrl-module : phandle of the control module this glue uses to write to
>     mailbox
>  
> +Recommended properies:
> + - syscon-otghs : phandle/offset pair. Phandle to the system control module and the
> +   register offset of the mailbox.
> +
>  SOC specific device node entry
>  usb_otg_hs: usb_otg_hs at 4a0ab000 {
>  	compatible = "ti,omap4-musb";
> diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
> index cc752d8..bcd6d1e 100644
> --- a/drivers/usb/musb/omap2430.c
> +++ b/drivers/usb/musb/omap2430.c
> @@ -39,16 +39,27 @@
>  #include <linux/usb/musb-omap.h>
>  #include <linux/phy/omap_control_phy.h>
>  #include <linux/of_platform.h>
> +#include <linux/regmap.h>
> +#include <linux/mfd/syscon.h>
>  
>  #include "musb_core.h"
>  #include "omap2430.h"
>  
> +#define OMAP2430_MUSB_MODE_MASK	0x1f
> +#define OMAP2430_MUSB_AVALID	(0x1 << 0)
> +#define OMAP2430_MUSB_BVALID	(0x1 << 1)
> +#define OMAP2430_MUSB_VBUSVALID	(0x1 << 2)
> +#define OMAP2430_MUSB_SESSEND	(0x1 << 3)
> +#define OMAP2430_MUSB_IDDIG	(0x1 << 4)
> +
>  struct omap2430_glue {
>  	struct device		*dev;
>  	struct platform_device	*musb;
>  	enum omap_musb_vbus_id_status status;
>  	struct work_struct	omap_musb_mailbox_work;
>  	struct device		*control_otghs;
> +	struct regmap		*syscon_otghs; /* ctrl. reg. acces */
> +	unsigned int            otghs_reg; /* otghs reg. index within syscon */
>  };
>  #define glue_to_musb(g)		platform_get_drvdata(g->musb)
>  
> @@ -253,6 +264,47 @@ void omap_musb_mailbox(enum omap_musb_vbus_id_status status)
>  }
>  EXPORT_SYMBOL_GPL(omap_musb_mailbox);
>  
> +static void omap2430_musb_set_usbmode(struct omap2430_glue *glue,
> +				      enum omap_control_usb_mode mode)
> +{
> +	u32 val;
> +	int ret;
> +
> +	if (glue->syscon_otghs) {
> +		switch (mode) {
> +		case USB_MODE_HOST:
> +			val = OMAP2430_MUSB_AVALID | OMAP2430_MUSB_VBUSVALID;
> +			break;
> +
> +		case USB_MODE_DEVICE:
> +			val = OMAP2430_MUSB_IDDIG | OMAP2430_MUSB_AVALID |
> +				OMAP2430_MUSB_VBUSVALID;
> +			break;
> +
> +		case USB_MODE_DISCONNECT:
> +			val = OMAP2430_MUSB_IDDIG | OMAP2430_MUSB_SESSEND;
> +			break;
> +
> +		default:
> +			dev_dbg(glue->dev, "Invalid mode\n");
> +			goto err_regmap_update;
> +		}
> +
> +		ret = regmap_update_bits(glue->syscon_otghs,
> +					 glue->otghs_reg,
> +					 OMAP2430_MUSB_MODE_MASK, val);
> +		if (ret < 0)
> +			goto err_regmap_update;
> +	} else {
> +		omap_control_usb_set_mode(glue->control_otghs, mode);
> +	}
> +
> +	return;
> +
> +err_regmap_update:
> +	dev_err(glue->dev, "Failed to set mode to %d\n", mode);
> +}
> +
>  static void omap_musb_set_mailbox(struct omap2430_glue *glue)
>  {
>  	struct musb *musb = glue_to_musb(glue);
> @@ -270,8 +322,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
>  		musb->xceiv->last_event = USB_EVENT_ID;
>  		if (musb->gadget_driver) {
>  			pm_runtime_get_sync(dev);
> -			omap_control_usb_set_mode(glue->control_otghs,
> -				USB_MODE_HOST);
> +			omap2430_musb_set_usbmode(glue, USB_MODE_HOST);
>  			omap2430_musb_set_vbus(musb, 1);
>  		}
>  		break;
> @@ -284,7 +335,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
>  		musb->xceiv->last_event = USB_EVENT_VBUS;
>  		if (musb->gadget_driver)
>  			pm_runtime_get_sync(dev);
> -		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE);
> +		omap2430_musb_set_usbmode(glue, USB_MODE_DEVICE);
>  		break;
>  
>  	case OMAP_MUSB_ID_FLOAT:
> @@ -301,8 +352,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
>  		if (data->interface_type == MUSB_INTERFACE_UTMI)
>  			otg_set_vbus(musb->xceiv->otg, 0);
>  
> -		omap_control_usb_set_mode(glue->control_otghs,
> -			USB_MODE_DISCONNECT);
> +		omap2430_musb_set_usbmode(glue, USB_MODE_DISCONNECT);
>  		break;
>  	default:
>  		dev_dbg(dev, "ID float\n");
> @@ -444,7 +494,7 @@ static void omap2430_musb_enable(struct musb *musb)
>  	switch (glue->status) {
>  
>  	case OMAP_MUSB_ID_GROUND:
> -		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_HOST);
> +		omap2430_musb_set_usbmode(glue, USB_MODE_HOST);
>  		if (data->interface_type != MUSB_INTERFACE_UTMI)
>  			break;
>  		devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
> @@ -463,7 +513,7 @@ static void omap2430_musb_enable(struct musb *musb)
>  		break;
>  
>  	case OMAP_MUSB_VBUS_VALID:
> -		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE);
> +		omap2430_musb_set_usbmode(glue, USB_MODE_DEVICE);
>  		break;
>  
>  	default:
> @@ -477,8 +527,7 @@ static void omap2430_musb_disable(struct musb *musb)
>  	struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
>  
>  	if (glue->status != OMAP_MUSB_UNKNOWN)
> -		omap_control_usb_set_mode(glue->control_otghs,
> -			USB_MODE_DISCONNECT);
> +		omap2430_musb_set_usbmode(glue, USB_MODE_DISCONNECT);
>  }
>  
>  static int omap2430_musb_exit(struct musb *musb)
> @@ -507,6 +556,40 @@ static const struct musb_platform_ops omap2430_ops = {
>  
>  static u64 omap2430_dmamask = DMA_BIT_MASK(32);
>  
> +static int omap2430_get_control(struct omap2430_glue *glue,
> +				struct device_node *np)
> +{
> +	struct device_node *control_node;
> +	struct platform_device *control_pdev;
> +
> +	glue->syscon_otghs = syscon_regmap_lookup_by_phandle(np,
> +							     "syscon-otghs");
> +	if (IS_ERR(glue->syscon_otghs)) {
> +		dev_info(glue->dev, "can't get syscon, using control device\n");

dev_dbg().

> +		glue->syscon_otghs = NULL;
> +
> +		control_node = of_parse_phandle(np, "ctrl-module", 0);
> +		if (control_node) {
> +			control_pdev = of_find_device_by_node(control_node);
> +			if (!control_pdev) {
> +				dev_err(glue->dev,
> +					"Failed to get control device\n");
> +				return -EINVAL;
> +			}
> +			glue->control_otghs = &control_pdev->dev;
> +		}
> +	} else {
> +		if (of_property_read_u32_index(np, "syscon-otghs", 1,
> +					       &glue->otghs_reg)) {
> +			dev_err(glue->dev,
> +				"couldn't get otghs reg. offset\n");
> +			return -EINVAL;
> +		}
> +	}
> +
> +	return 0;
> +}
> +
>  static int omap2430_probe(struct platform_device *pdev)
>  {
>  	struct resource			musb_resources[3];
> @@ -538,9 +621,6 @@ static int omap2430_probe(struct platform_device *pdev)
>  	glue->control_otghs = ERR_PTR(-ENODEV);
>  
>  	if (np) {
> -		struct device_node *control_node;
> -		struct platform_device *control_pdev;
> -
>  		pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
>  		if (!pdata)
>  			goto err2;
> @@ -567,16 +647,10 @@ static int omap2430_probe(struct platform_device *pdev)
>  		pdata->board_data	= data;
>  		pdata->config		= config;
>  
> -		control_node = of_parse_phandle(np, "ctrl-module", 0);
> -		if (control_node) {
> -			control_pdev = of_find_device_by_node(control_node);
> -			if (!control_pdev) {
> -				dev_err(&pdev->dev, "Failed to get control device\n");
> -				ret = -EINVAL;
> -				goto err2;
> -			}
> -			glue->control_otghs = &control_pdev->dev;
> -		}
> +		ret = omap2430_get_control(glue, np);
> +		if (ret)
> +			goto err2;
> +
>  	}
>  	pdata->platform_ops		= &omap2430_ops;
>  

cheers,
-roger

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

* Re: [PATCH 17/17] ARM: dts: omap4: Use "syscon-otghs" instead of "ctrl-module" in USB node
@ 2015-06-24 11:46         ` Tony Lindgren
  0 siblings, 0 replies; 150+ messages in thread
From: Tony Lindgren @ 2015-06-24 11:46 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson, balbi, rogerq, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

* Kishon Vijay Abraham I <kishon@ti.com> [150624 04:23]:
> On Wednesday 24 June 2015 04:11 PM, Tony Lindgren wrote:
> >* Kishon Vijay Abraham I <kishon@ti.com> [150623 05:02]:
> >>--- a/arch/arm/boot/dts/omap4.dtsi
> >>+++ b/arch/arm/boot/dts/omap4.dtsi
> >>@@ -852,12 +852,6 @@
> >>  			};
> >>  		};
> >>
> >>-		omap_control_usbotg: control-phy@4a00233c {
> >>-			compatible = "ti,control-phy-otghs";
> >>-			reg = <0x4a00233c 0x4>;
> >>-			reg-names = "otghs_control";
> >>-		};
> >>-
> >>  		usb_otg_hs: usb_otg_hs@4a0ab000 {
> >>  			compatible = "ti,omap4-musb";
> >>  			reg = <0x4a0ab000 0x7ff>;
> >>@@ -870,7 +864,7 @@
> >>  			multipoint = <1>;
> >>  			num-eps = <16>;
> >>  			ram-bits = <12>;
> >>-			ctrl-module = <&omap_control_usbotg>;
> >>+			syscon-otghs = <&scm_conf 0x33c>;
> >>  		};
> >>
> >>  		aes: aes@4b501000 {
> >
> >We should still keep a separate entry for the phy in the dtsi
> >files. And the phy should be a child of the scm_conf area in the
> >dtsi file.
> >
> >This is because the scm and usb_otg_hs are separate devices and
> >can be clocked separately. So the phy driver needs to be a
> >separate driver to avoid spaghetti code and issues with clocking.
> 
> AFAIK SCM is clocked by L4CFG_L4_GICLK which is either free running or is
> managed automatically by the HW i.e gated when there is no access to the
> CTRL_MODULE_CORE registers.

The point is they are separate devices on the interconnect. And we
don't want to add dependencies between separate devices. And there
is nothing stopping us from starting to idle the SCM module.
 
> Having a separate control-PHY driver only to do a regmap update to SCM is
> unnecessary IMHO.

Not true. The phy driver can be generic and used by multiple platforms.

And the phy driver should be capable of idling the phy separately
independent of the USB module. And the phy driver should be able to
tell the system things like ID pin status, VBUS status and so on.

So to summarize, we are _not_ going to start tinkering with the sycon
registers directly from random device drivers in a separate IO space.

Anything using the syscon registers must implement a driver for some
Linux generic framework such as phy, clock, or regulator framework.

Regards,

Tony

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

* Re: [PATCH 17/17] ARM: dts: omap4: Use "syscon-otghs" instead of "ctrl-module" in USB node
@ 2015-06-24 11:46         ` Tony Lindgren
  0 siblings, 0 replies; 150+ messages in thread
From: Tony Lindgren @ 2015-06-24 11:46 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson-rdvid1DuHRBWk0Htik3J/w, balbi-l0cyMroinI0,
	rogerq-l0cyMroinI0, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0

* Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org> [150624 04:23]:
> On Wednesday 24 June 2015 04:11 PM, Tony Lindgren wrote:
> >* Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org> [150623 05:02]:
> >>--- a/arch/arm/boot/dts/omap4.dtsi
> >>+++ b/arch/arm/boot/dts/omap4.dtsi
> >>@@ -852,12 +852,6 @@
> >>  			};
> >>  		};
> >>
> >>-		omap_control_usbotg: control-phy@4a00233c {
> >>-			compatible = "ti,control-phy-otghs";
> >>-			reg = <0x4a00233c 0x4>;
> >>-			reg-names = "otghs_control";
> >>-		};
> >>-
> >>  		usb_otg_hs: usb_otg_hs@4a0ab000 {
> >>  			compatible = "ti,omap4-musb";
> >>  			reg = <0x4a0ab000 0x7ff>;
> >>@@ -870,7 +864,7 @@
> >>  			multipoint = <1>;
> >>  			num-eps = <16>;
> >>  			ram-bits = <12>;
> >>-			ctrl-module = <&omap_control_usbotg>;
> >>+			syscon-otghs = <&scm_conf 0x33c>;
> >>  		};
> >>
> >>  		aes: aes@4b501000 {
> >
> >We should still keep a separate entry for the phy in the dtsi
> >files. And the phy should be a child of the scm_conf area in the
> >dtsi file.
> >
> >This is because the scm and usb_otg_hs are separate devices and
> >can be clocked separately. So the phy driver needs to be a
> >separate driver to avoid spaghetti code and issues with clocking.
> 
> AFAIK SCM is clocked by L4CFG_L4_GICLK which is either free running or is
> managed automatically by the HW i.e gated when there is no access to the
> CTRL_MODULE_CORE registers.

The point is they are separate devices on the interconnect. And we
don't want to add dependencies between separate devices. And there
is nothing stopping us from starting to idle the SCM module.
 
> Having a separate control-PHY driver only to do a regmap update to SCM is
> unnecessary IMHO.

Not true. The phy driver can be generic and used by multiple platforms.

And the phy driver should be capable of idling the phy separately
independent of the USB module. And the phy driver should be able to
tell the system things like ID pin status, VBUS status and so on.

So to summarize, we are _not_ going to start tinkering with the sycon
registers directly from random device drivers in a separate IO space.

Anything using the syscon registers must implement a driver for some
Linux generic framework such as phy, clock, or regulator framework.

Regards,

Tony
--
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] 150+ messages in thread

* [PATCH 17/17] ARM: dts: omap4: Use "syscon-otghs" instead of "ctrl-module" in USB node
@ 2015-06-24 11:46         ` Tony Lindgren
  0 siblings, 0 replies; 150+ messages in thread
From: Tony Lindgren @ 2015-06-24 11:46 UTC (permalink / raw)
  To: linux-arm-kernel

* Kishon Vijay Abraham I <kishon@ti.com> [150624 04:23]:
> On Wednesday 24 June 2015 04:11 PM, Tony Lindgren wrote:
> >* Kishon Vijay Abraham I <kishon@ti.com> [150623 05:02]:
> >>--- a/arch/arm/boot/dts/omap4.dtsi
> >>+++ b/arch/arm/boot/dts/omap4.dtsi
> >>@@ -852,12 +852,6 @@
> >>  			};
> >>  		};
> >>
> >>-		omap_control_usbotg: control-phy at 4a00233c {
> >>-			compatible = "ti,control-phy-otghs";
> >>-			reg = <0x4a00233c 0x4>;
> >>-			reg-names = "otghs_control";
> >>-		};
> >>-
> >>  		usb_otg_hs: usb_otg_hs at 4a0ab000 {
> >>  			compatible = "ti,omap4-musb";
> >>  			reg = <0x4a0ab000 0x7ff>;
> >>@@ -870,7 +864,7 @@
> >>  			multipoint = <1>;
> >>  			num-eps = <16>;
> >>  			ram-bits = <12>;
> >>-			ctrl-module = <&omap_control_usbotg>;
> >>+			syscon-otghs = <&scm_conf 0x33c>;
> >>  		};
> >>
> >>  		aes: aes at 4b501000 {
> >
> >We should still keep a separate entry for the phy in the dtsi
> >files. And the phy should be a child of the scm_conf area in the
> >dtsi file.
> >
> >This is because the scm and usb_otg_hs are separate devices and
> >can be clocked separately. So the phy driver needs to be a
> >separate driver to avoid spaghetti code and issues with clocking.
> 
> AFAIK SCM is clocked by L4CFG_L4_GICLK which is either free running or is
> managed automatically by the HW i.e gated when there is no access to the
> CTRL_MODULE_CORE registers.

The point is they are separate devices on the interconnect. And we
don't want to add dependencies between separate devices. And there
is nothing stopping us from starting to idle the SCM module.
 
> Having a separate control-PHY driver only to do a regmap update to SCM is
> unnecessary IMHO.

Not true. The phy driver can be generic and used by multiple platforms.

And the phy driver should be capable of idling the phy separately
independent of the USB module. And the phy driver should be able to
tell the system things like ID pin status, VBUS status and so on.

So to summarize, we are _not_ going to start tinkering with the sycon
registers directly from random device drivers in a separate IO space.

Anything using the syscon registers must implement a driver for some
Linux generic framework such as phy, clock, or regulator framework.

Regards,

Tony

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

* Re: [PATCH 07/17] usb: musb: omap2430: use *syscon* framework to write to mailbox register
@ 2015-06-24 11:49     ` Tony Lindgren
  0 siblings, 0 replies; 150+ messages in thread
From: Tony Lindgren @ 2015-06-24 11:49 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson, balbi, rogerq, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

* Kishon Vijay Abraham I <kishon@ti.com> [150623 05:02]:
> Deprecate using phy-omap-control driver to write to the mailbox register
> and start using *syscon* framework to do the same.

All this stuff needs to go to some generic syscon USB phy
driver. Let's not start adding phy specific stuff to a USB
driver.

Regards,

Tony

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

* Re: [PATCH 07/17] usb: musb: omap2430: use *syscon* framework to write to mailbox register
@ 2015-06-24 11:49     ` Tony Lindgren
  0 siblings, 0 replies; 150+ messages in thread
From: Tony Lindgren @ 2015-06-24 11:49 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson-rdvid1DuHRBWk0Htik3J/w, balbi-l0cyMroinI0,
	rogerq-l0cyMroinI0, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0

* Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org> [150623 05:02]:
> Deprecate using phy-omap-control driver to write to the mailbox register
> and start using *syscon* framework to do the same.

All this stuff needs to go to some generic syscon USB phy
driver. Let's not start adding phy specific stuff to a USB
driver.

Regards,

Tony
--
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	[flat|nested] 150+ messages in thread

* [PATCH 07/17] usb: musb: omap2430: use *syscon* framework to write to mailbox register
@ 2015-06-24 11:49     ` Tony Lindgren
  0 siblings, 0 replies; 150+ messages in thread
From: Tony Lindgren @ 2015-06-24 11:49 UTC (permalink / raw)
  To: linux-arm-kernel

* Kishon Vijay Abraham I <kishon@ti.com> [150623 05:02]:
> Deprecate using phy-omap-control driver to write to the mailbox register
> and start using *syscon* framework to do the same.

All this stuff needs to go to some generic syscon USB phy
driver. Let's not start adding phy specific stuff to a USB
driver.

Regards,

Tony

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

* Re: [PATCH 08/17] ARM: dts: dra7: Add dt node for the sycon pcie
@ 2015-06-24 11:50     ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 11:50 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson, tony, balbi, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

On Tue, 23 Jun 2015 17:28:53 +0530
Kishon Vijay Abraham I <kishon@ti.com> wrote:

> Add new device tree node for the control module register space where
> PCIe registers are present.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  arch/arm/boot/dts/dra7.dtsi |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
> index 260f300..3f434f7 100644
> --- a/arch/arm/boot/dts/dra7.dtsi
> +++ b/arch/arm/boot/dts/dra7.dtsi
> @@ -291,6 +291,11 @@
>  			reg = <0x4a002e00 0x7c>;
>  		};
>  
> +		dra7_ctrl_pcie: tisyscon@4a003c00 {
> +			compatible = "syscon";
> +			reg = <0x4a003c00 0x48>;
> +		};
> +

Why do you need to start from 0x4a003c00?
CTRL_CORE_PCIESS1_PCS1 is at 0x4a003c24

>  		sdma: dma-controller@4a056000 {
>  			compatible = "ti,omap4430-sdma";
>  			reg = <0x4a056000 0x1000>;
> -- 
> 1.7.9.5
> 

cheers,
-roger

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

* Re: [PATCH 08/17] ARM: dts: dra7: Add dt node for the sycon pcie
@ 2015-06-24 11:50     ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 11:50 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson-rdvid1DuHRBWk0Htik3J/w, tony-4v6yS6AI5VpBDgjK7y7TUQ,
	balbi-l0cyMroinI0, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0

On Tue, 23 Jun 2015 17:28:53 +0530
Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org> wrote:

> Add new device tree node for the control module register space where
> PCIe registers are present.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
> ---
>  arch/arm/boot/dts/dra7.dtsi |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
> index 260f300..3f434f7 100644
> --- a/arch/arm/boot/dts/dra7.dtsi
> +++ b/arch/arm/boot/dts/dra7.dtsi
> @@ -291,6 +291,11 @@
>  			reg = <0x4a002e00 0x7c>;
>  		};
>  
> +		dra7_ctrl_pcie: tisyscon@4a003c00 {
> +			compatible = "syscon";
> +			reg = <0x4a003c00 0x48>;
> +		};
> +

Why do you need to start from 0x4a003c00?
CTRL_CORE_PCIESS1_PCS1 is at 0x4a003c24

>  		sdma: dma-controller@4a056000 {
>  			compatible = "ti,omap4430-sdma";
>  			reg = <0x4a056000 0x1000>;
> -- 
> 1.7.9.5
> 

cheers,
-roger
--
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] 150+ messages in thread

* [PATCH 08/17] ARM: dts: dra7: Add dt node for the sycon pcie
@ 2015-06-24 11:50     ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 11:50 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 23 Jun 2015 17:28:53 +0530
Kishon Vijay Abraham I <kishon@ti.com> wrote:

> Add new device tree node for the control module register space where
> PCIe registers are present.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  arch/arm/boot/dts/dra7.dtsi |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
> index 260f300..3f434f7 100644
> --- a/arch/arm/boot/dts/dra7.dtsi
> +++ b/arch/arm/boot/dts/dra7.dtsi
> @@ -291,6 +291,11 @@
>  			reg = <0x4a002e00 0x7c>;
>  		};
>  
> +		dra7_ctrl_pcie: tisyscon at 4a003c00 {
> +			compatible = "syscon";
> +			reg = <0x4a003c00 0x48>;
> +		};
> +

Why do you need to start from 0x4a003c00?
CTRL_CORE_PCIESS1_PCS1 is at 0x4a003c24

>  		sdma: dma-controller at 4a056000 {
>  			compatible = "ti,omap4430-sdma";
>  			reg = <0x4a056000 0x1000>;
> -- 
> 1.7.9.5
> 

cheers,
-roger

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

* Re: [PATCH 08/17] ARM: dts: dra7: Add dt node for the sycon pcie
  2015-06-24 11:50     ` Roger Quadros
  (?)
@ 2015-06-24 11:56       ` Roger Quadros
  -1 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 11:56 UTC (permalink / raw)
  To: Roger Quadros
  Cc: Kishon Vijay Abraham I, bcousson, tony, balbi, devicetree,
	linux-kernel, linux-omap, linux-arm-kernel, linux-usb, robh+dt,
	pawel.moll, mark.rutland, ijc+devicetree, galak, linux, gregkh,
	nsekhar

On Wed, 24 Jun 2015 14:50:17 +0300
Roger Quadros <rogerq@ti.com> wrote:

> On Tue, 23 Jun 2015 17:28:53 +0530
> Kishon Vijay Abraham I <kishon@ti.com> wrote:
> 
> > Add new device tree node for the control module register space where
> > PCIe registers are present.
> > 
> > Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> > ---
> >  arch/arm/boot/dts/dra7.dtsi |    5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
> > index 260f300..3f434f7 100644
> > --- a/arch/arm/boot/dts/dra7.dtsi
> > +++ b/arch/arm/boot/dts/dra7.dtsi
> > @@ -291,6 +291,11 @@
> >  			reg = <0x4a002e00 0x7c>;
> >  		};
> >  
> > +		dra7_ctrl_pcie: tisyscon@4a003c00 {
> > +			compatible = "syscon";
> > +			reg = <0x4a003c00 0x48>;
> > +		};
> > +
> 
> Why do you need to start from 0x4a003c00?
> CTRL_CORE_PCIESS1_PCS1 is at 0x4a003c24

Also, why can't this dra7_ctrl_pcie node be where scm_conf is.

> 
> >  		sdma: dma-controller@4a056000 {
> >  			compatible = "ti,omap4430-sdma";
> >  			reg = <0x4a056000 0x1000>;
> > -- 
> > 1.7.9.5
> > 
> 
> cheers,
> -roger
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" 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] 150+ messages in thread

* Re: [PATCH 08/17] ARM: dts: dra7: Add dt node for the sycon pcie
@ 2015-06-24 11:56       ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 11:56 UTC (permalink / raw)
  To: Roger Quadros
  Cc: Kishon Vijay Abraham I, bcousson, tony, balbi, devicetree,
	linux-kernel, linux-omap, linux-arm-kernel, linux-usb, robh+dt,
	pawel.moll, mark.rutland, ijc+devicetree, galak, linux, gregkh,
	nsekhar

On Wed, 24 Jun 2015 14:50:17 +0300
Roger Quadros <rogerq@ti.com> wrote:

> On Tue, 23 Jun 2015 17:28:53 +0530
> Kishon Vijay Abraham I <kishon@ti.com> wrote:
> 
> > Add new device tree node for the control module register space where
> > PCIe registers are present.
> > 
> > Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> > ---
> >  arch/arm/boot/dts/dra7.dtsi |    5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
> > index 260f300..3f434f7 100644
> > --- a/arch/arm/boot/dts/dra7.dtsi
> > +++ b/arch/arm/boot/dts/dra7.dtsi
> > @@ -291,6 +291,11 @@
> >  			reg = <0x4a002e00 0x7c>;
> >  		};
> >  
> > +		dra7_ctrl_pcie: tisyscon@4a003c00 {
> > +			compatible = "syscon";
> > +			reg = <0x4a003c00 0x48>;
> > +		};
> > +
> 
> Why do you need to start from 0x4a003c00?
> CTRL_CORE_PCIESS1_PCS1 is at 0x4a003c24

Also, why can't this dra7_ctrl_pcie node be where scm_conf is.

> 
> >  		sdma: dma-controller@4a056000 {
> >  			compatible = "ti,omap4430-sdma";
> >  			reg = <0x4a056000 0x1000>;
> > -- 
> > 1.7.9.5
> > 
> 
> cheers,
> -roger
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" 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] 150+ messages in thread

* [PATCH 08/17] ARM: dts: dra7: Add dt node for the sycon pcie
@ 2015-06-24 11:56       ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 11:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 24 Jun 2015 14:50:17 +0300
Roger Quadros <rogerq@ti.com> wrote:

> On Tue, 23 Jun 2015 17:28:53 +0530
> Kishon Vijay Abraham I <kishon@ti.com> wrote:
> 
> > Add new device tree node for the control module register space where
> > PCIe registers are present.
> > 
> > Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> > ---
> >  arch/arm/boot/dts/dra7.dtsi |    5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
> > index 260f300..3f434f7 100644
> > --- a/arch/arm/boot/dts/dra7.dtsi
> > +++ b/arch/arm/boot/dts/dra7.dtsi
> > @@ -291,6 +291,11 @@
> >  			reg = <0x4a002e00 0x7c>;
> >  		};
> >  
> > +		dra7_ctrl_pcie: tisyscon at 4a003c00 {
> > +			compatible = "syscon";
> > +			reg = <0x4a003c00 0x48>;
> > +		};
> > +
> 
> Why do you need to start from 0x4a003c00?
> CTRL_CORE_PCIESS1_PCS1 is at 0x4a003c24

Also, why can't this dra7_ctrl_pcie node be where scm_conf is.

> 
> >  		sdma: dma-controller at 4a056000 {
> >  			compatible = "ti,omap4430-sdma";
> >  			reg = <0x4a056000 0x1000>;
> > -- 
> > 1.7.9.5
> > 
> 
> cheers,
> -roger
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 17/17] ARM: dts: omap4: Use "syscon-otghs" instead of "ctrl-module" in USB node
  2015-06-24 10:41     ` Tony Lindgren
  (?)
@ 2015-06-24 12:02       ` Roger Quadros
  -1 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 12:02 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Kishon Vijay Abraham I, bcousson, balbi, devicetree,
	linux-kernel, linux-omap, linux-arm-kernel, linux-usb, robh+dt,
	pawel.moll, mark.rutland, ijc+devicetree, galak, linux, gregkh,
	nsekhar

On Wed, 24 Jun 2015 03:41:16 -0700
Tony Lindgren <tony@atomide.com> wrote:

> * Kishon Vijay Abraham I <kishon@ti.com> [150623 05:02]:
> > --- a/arch/arm/boot/dts/omap4.dtsi
> > +++ b/arch/arm/boot/dts/omap4.dtsi
> > @@ -852,12 +852,6 @@
> >  			};
> >  		};
> >  
> > -		omap_control_usbotg: control-phy@4a00233c {
> > -			compatible = "ti,control-phy-otghs";
> > -			reg = <0x4a00233c 0x4>;
> > -			reg-names = "otghs_control";
> > -		};
> > -
> >  		usb_otg_hs: usb_otg_hs@4a0ab000 {
> >  			compatible = "ti,omap4-musb";
> >  			reg = <0x4a0ab000 0x7ff>;
> > @@ -870,7 +864,7 @@
> >  			multipoint = <1>;
> >  			num-eps = <16>;
> >  			ram-bits = <12>;
> > -			ctrl-module = <&omap_control_usbotg>;
> > +			syscon-otghs = <&scm_conf 0x33c>;
> >  		};
> >  
> >  		aes: aes@4b501000 {
> 
> We should still keep a separate entry for the phy in the dtsi
> files. And the phy should be a child of the scm_conf area in the
> dtsi file.

The PHY already has a separate entry with its own set of registers.
Just that some bits have been shoved into the control module space
not only for PHY but for other modules as well like DSS, DCAN, etc.

> 
> This is because the scm and usb_otg_hs are separate devices and
> can be clocked separately. So the phy driver needs to be a
> separate driver to avoid spaghetti code and issues with clocking.

for the PHY register space this is already done.

But for the register bits that lie in control module space isn't that
taken care by syscon driver?

cheers,
-roger

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

* Re: [PATCH 17/17] ARM: dts: omap4: Use "syscon-otghs" instead of "ctrl-module" in USB node
@ 2015-06-24 12:02       ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 12:02 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Kishon Vijay Abraham I, bcousson, balbi, devicetree,
	linux-kernel, linux-omap, linux-arm-kernel, linux-usb, robh+dt,
	pawel.moll, mark.rutland, ijc+devicetree, galak, linux, gregkh,
	nsekhar

On Wed, 24 Jun 2015 03:41:16 -0700
Tony Lindgren <tony@atomide.com> wrote:

> * Kishon Vijay Abraham I <kishon@ti.com> [150623 05:02]:
> > --- a/arch/arm/boot/dts/omap4.dtsi
> > +++ b/arch/arm/boot/dts/omap4.dtsi
> > @@ -852,12 +852,6 @@
> >  			};
> >  		};
> >  
> > -		omap_control_usbotg: control-phy@4a00233c {
> > -			compatible = "ti,control-phy-otghs";
> > -			reg = <0x4a00233c 0x4>;
> > -			reg-names = "otghs_control";
> > -		};
> > -
> >  		usb_otg_hs: usb_otg_hs@4a0ab000 {
> >  			compatible = "ti,omap4-musb";
> >  			reg = <0x4a0ab000 0x7ff>;
> > @@ -870,7 +864,7 @@
> >  			multipoint = <1>;
> >  			num-eps = <16>;
> >  			ram-bits = <12>;
> > -			ctrl-module = <&omap_control_usbotg>;
> > +			syscon-otghs = <&scm_conf 0x33c>;
> >  		};
> >  
> >  		aes: aes@4b501000 {
> 
> We should still keep a separate entry for the phy in the dtsi
> files. And the phy should be a child of the scm_conf area in the
> dtsi file.

The PHY already has a separate entry with its own set of registers.
Just that some bits have been shoved into the control module space
not only for PHY but for other modules as well like DSS, DCAN, etc.

> 
> This is because the scm and usb_otg_hs are separate devices and
> can be clocked separately. So the phy driver needs to be a
> separate driver to avoid spaghetti code and issues with clocking.

for the PHY register space this is already done.

But for the register bits that lie in control module space isn't that
taken care by syscon driver?

cheers,
-roger

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

* [PATCH 17/17] ARM: dts: omap4: Use "syscon-otghs" instead of "ctrl-module" in USB node
@ 2015-06-24 12:02       ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 12:02 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 24 Jun 2015 03:41:16 -0700
Tony Lindgren <tony@atomide.com> wrote:

> * Kishon Vijay Abraham I <kishon@ti.com> [150623 05:02]:
> > --- a/arch/arm/boot/dts/omap4.dtsi
> > +++ b/arch/arm/boot/dts/omap4.dtsi
> > @@ -852,12 +852,6 @@
> >  			};
> >  		};
> >  
> > -		omap_control_usbotg: control-phy at 4a00233c {
> > -			compatible = "ti,control-phy-otghs";
> > -			reg = <0x4a00233c 0x4>;
> > -			reg-names = "otghs_control";
> > -		};
> > -
> >  		usb_otg_hs: usb_otg_hs at 4a0ab000 {
> >  			compatible = "ti,omap4-musb";
> >  			reg = <0x4a0ab000 0x7ff>;
> > @@ -870,7 +864,7 @@
> >  			multipoint = <1>;
> >  			num-eps = <16>;
> >  			ram-bits = <12>;
> > -			ctrl-module = <&omap_control_usbotg>;
> > +			syscon-otghs = <&scm_conf 0x33c>;
> >  		};
> >  
> >  		aes: aes at 4b501000 {
> 
> We should still keep a separate entry for the phy in the dtsi
> files. And the phy should be a child of the scm_conf area in the
> dtsi file.

The PHY already has a separate entry with its own set of registers.
Just that some bits have been shoved into the control module space
not only for PHY but for other modules as well like DSS, DCAN, etc.

> 
> This is because the scm and usb_otg_hs are separate devices and
> can be clocked separately. So the phy driver needs to be a
> separate driver to avoid spaghetti code and issues with clocking.

for the PHY register space this is already done.

But for the register bits that lie in control module space isn't that
taken care by syscon driver?

cheers,
-roger

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

* Re: [PATCH 09/17] ARM: dts: dra7: Use "syscon-phy-power" instead of "ctrl-module" in SATA PHY node
  2015-06-23 11:58   ` Kishon Vijay Abraham I
  (?)
@ 2015-06-24 12:06     ` Roger Quadros
  -1 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 12:06 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson, tony, balbi, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

On Tue, 23 Jun 2015 17:28:54 +0530
Kishon Vijay Abraham I <kishon@ti.com> wrote:

> Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
> property from SATA PHY node. Since "omap_control_sata" note is no longer
> used, remove it.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>

Acked-by: Roger Quadros <rogerq@ti.com>

cheers,
-roger

> ---
>  arch/arm/boot/dts/dra7.dtsi |   10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
> index 3f434f7..92e0741 100644
> --- a/arch/arm/boot/dts/dra7.dtsi
> +++ b/arch/arm/boot/dts/dra7.dtsi
> @@ -1115,14 +1115,6 @@
>  			status = "disabled";
>  		};
>  
> -		omap_control_sata: control-phy@4a002374 {
> -			compatible = "ti,control-phy-pipe3";
> -			reg = <0x4a002374 0x4>;
> -			reg-names = "power";
> -			clocks = <&sys_clkin1>;
> -			clock-names = "sysclk";
> -		};
> -
>  		/* OCP2SCP3 */
>  		ocp2scp@4a090000 {
>  			compatible = "ti,omap-ocp2scp";
> @@ -1137,7 +1129,7 @@
>  				      <0x4A096400 0x64>, /* phy_tx */
>  				      <0x4A096800 0x40>; /* pll_ctrl */
>  				reg-names = "phy_rx", "phy_tx", "pll_ctrl";
> -				ctrl-module = <&omap_control_sata>;
> +				syscon-phy-power = <&dra7_ctrl_core 0x374>;
>  				clocks = <&sys_clkin1>, <&sata_ref_clk>;
>  				clock-names = "sysclk", "refclk";
>  				syscon-pllreset = <&dra7_ctrl_core 0x3fc>;
> -- 
> 1.7.9.5
> 

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

* Re: [PATCH 09/17] ARM: dts: dra7: Use "syscon-phy-power" instead of "ctrl-module" in SATA PHY node
@ 2015-06-24 12:06     ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 12:06 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson, tony, balbi, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

On Tue, 23 Jun 2015 17:28:54 +0530
Kishon Vijay Abraham I <kishon@ti.com> wrote:

> Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
> property from SATA PHY node. Since "omap_control_sata" note is no longer
> used, remove it.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>

Acked-by: Roger Quadros <rogerq@ti.com>

cheers,
-roger

> ---
>  arch/arm/boot/dts/dra7.dtsi |   10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
> index 3f434f7..92e0741 100644
> --- a/arch/arm/boot/dts/dra7.dtsi
> +++ b/arch/arm/boot/dts/dra7.dtsi
> @@ -1115,14 +1115,6 @@
>  			status = "disabled";
>  		};
>  
> -		omap_control_sata: control-phy@4a002374 {
> -			compatible = "ti,control-phy-pipe3";
> -			reg = <0x4a002374 0x4>;
> -			reg-names = "power";
> -			clocks = <&sys_clkin1>;
> -			clock-names = "sysclk";
> -		};
> -
>  		/* OCP2SCP3 */
>  		ocp2scp@4a090000 {
>  			compatible = "ti,omap-ocp2scp";
> @@ -1137,7 +1129,7 @@
>  				      <0x4A096400 0x64>, /* phy_tx */
>  				      <0x4A096800 0x40>; /* pll_ctrl */
>  				reg-names = "phy_rx", "phy_tx", "pll_ctrl";
> -				ctrl-module = <&omap_control_sata>;
> +				syscon-phy-power = <&dra7_ctrl_core 0x374>;
>  				clocks = <&sys_clkin1>, <&sata_ref_clk>;
>  				clock-names = "sysclk", "refclk";
>  				syscon-pllreset = <&dra7_ctrl_core 0x3fc>;
> -- 
> 1.7.9.5
> 

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

* [PATCH 09/17] ARM: dts: dra7: Use "syscon-phy-power" instead of "ctrl-module" in SATA PHY node
@ 2015-06-24 12:06     ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 12:06 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 23 Jun 2015 17:28:54 +0530
Kishon Vijay Abraham I <kishon@ti.com> wrote:

> Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
> property from SATA PHY node. Since "omap_control_sata" note is no longer
> used, remove it.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>

Acked-by: Roger Quadros <rogerq@ti.com>

cheers,
-roger

> ---
>  arch/arm/boot/dts/dra7.dtsi |   10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
> index 3f434f7..92e0741 100644
> --- a/arch/arm/boot/dts/dra7.dtsi
> +++ b/arch/arm/boot/dts/dra7.dtsi
> @@ -1115,14 +1115,6 @@
>  			status = "disabled";
>  		};
>  
> -		omap_control_sata: control-phy at 4a002374 {
> -			compatible = "ti,control-phy-pipe3";
> -			reg = <0x4a002374 0x4>;
> -			reg-names = "power";
> -			clocks = <&sys_clkin1>;
> -			clock-names = "sysclk";
> -		};
> -
>  		/* OCP2SCP3 */
>  		ocp2scp at 4a090000 {
>  			compatible = "ti,omap-ocp2scp";
> @@ -1137,7 +1129,7 @@
>  				      <0x4A096400 0x64>, /* phy_tx */
>  				      <0x4A096800 0x40>; /* pll_ctrl */
>  				reg-names = "phy_rx", "phy_tx", "pll_ctrl";
> -				ctrl-module = <&omap_control_sata>;
> +				syscon-phy-power = <&dra7_ctrl_core 0x374>;
>  				clocks = <&sys_clkin1>, <&sata_ref_clk>;
>  				clock-names = "sysclk", "refclk";
>  				syscon-pllreset = <&dra7_ctrl_core 0x3fc>;
> -- 
> 1.7.9.5
> 

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

* Re: [PATCH 11/17] ARM: dts: dra7: Use "ti,dra7x-usb2-phy2" compatible string for USB2 PHY2
@ 2015-06-24 12:07     ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 12:07 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson, tony, balbi, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

On Tue, 23 Jun 2015 17:28:56 +0530
Kishon Vijay Abraham I <kishon@ti.com> wrote:

> The USB2 PHY2 has a different register map compared to USB2 PHY1
> to power on/off the PHY. In order to handle it, use the new compatible
> string "ti,dra7x-usb2-phy2" for the second instance of USB2 PHY.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  arch/arm/boot/dts/dra7.dtsi |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
> index f69db70..a8ee829 100644
> --- a/arch/arm/boot/dts/dra7.dtsi
> +++ b/arch/arm/boot/dts/dra7.dtsi
> @@ -1235,7 +1235,7 @@
>  			};
>  
>  			usb2_phy2: phy@4a085000 {
> -				compatible = "ti,omap-usb2";
> +				compatible = "ti,dra7x-usb2-phy2", "ti,omap-usb2";

Why do you want to retain "ti,omap-usb2".
It is not backward compatible with it right?

>  				reg = <0x4a085000 0x400>;
>  				ctrl-module = <&omap_control_usb2phy2>;
>  				clocks = <&usb_phy2_always_on_clk32k>,
> -- 
> 1.7.9.5
> 

cheers,
-roger

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

* Re: [PATCH 11/17] ARM: dts: dra7: Use "ti,dra7x-usb2-phy2" compatible string for USB2 PHY2
@ 2015-06-24 12:07     ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 12:07 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson-rdvid1DuHRBWk0Htik3J/w, tony-4v6yS6AI5VpBDgjK7y7TUQ,
	balbi-l0cyMroinI0, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0

On Tue, 23 Jun 2015 17:28:56 +0530
Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org> wrote:

> The USB2 PHY2 has a different register map compared to USB2 PHY1
> to power on/off the PHY. In order to handle it, use the new compatible
> string "ti,dra7x-usb2-phy2" for the second instance of USB2 PHY.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
> ---
>  arch/arm/boot/dts/dra7.dtsi |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
> index f69db70..a8ee829 100644
> --- a/arch/arm/boot/dts/dra7.dtsi
> +++ b/arch/arm/boot/dts/dra7.dtsi
> @@ -1235,7 +1235,7 @@
>  			};
>  
>  			usb2_phy2: phy@4a085000 {
> -				compatible = "ti,omap-usb2";
> +				compatible = "ti,dra7x-usb2-phy2", "ti,omap-usb2";

Why do you want to retain "ti,omap-usb2".
It is not backward compatible with it right?

>  				reg = <0x4a085000 0x400>;
>  				ctrl-module = <&omap_control_usb2phy2>;
>  				clocks = <&usb_phy2_always_on_clk32k>,
> -- 
> 1.7.9.5
> 

cheers,
-roger
--
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	[flat|nested] 150+ messages in thread

* [PATCH 11/17] ARM: dts: dra7: Use "ti,dra7x-usb2-phy2" compatible string for USB2 PHY2
@ 2015-06-24 12:07     ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 12:07 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 23 Jun 2015 17:28:56 +0530
Kishon Vijay Abraham I <kishon@ti.com> wrote:

> The USB2 PHY2 has a different register map compared to USB2 PHY1
> to power on/off the PHY. In order to handle it, use the new compatible
> string "ti,dra7x-usb2-phy2" for the second instance of USB2 PHY.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  arch/arm/boot/dts/dra7.dtsi |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
> index f69db70..a8ee829 100644
> --- a/arch/arm/boot/dts/dra7.dtsi
> +++ b/arch/arm/boot/dts/dra7.dtsi
> @@ -1235,7 +1235,7 @@
>  			};
>  
>  			usb2_phy2: phy at 4a085000 {
> -				compatible = "ti,omap-usb2";
> +				compatible = "ti,dra7x-usb2-phy2", "ti,omap-usb2";

Why do you want to retain "ti,omap-usb2".
It is not backward compatible with it right?

>  				reg = <0x4a085000 0x400>;
>  				ctrl-module = <&omap_control_usb2phy2>;
>  				clocks = <&usb_phy2_always_on_clk32k>,
> -- 
> 1.7.9.5
> 

cheers,
-roger

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

* Re: [PATCH 08/17] ARM: dts: dra7: Add dt node for the sycon pcie
@ 2015-06-24 12:09         ` Tony Lindgren
  0 siblings, 0 replies; 150+ messages in thread
From: Tony Lindgren @ 2015-06-24 12:09 UTC (permalink / raw)
  To: Roger Quadros
  Cc: Kishon Vijay Abraham I, bcousson, balbi, devicetree,
	linux-kernel, linux-omap, linux-arm-kernel, linux-usb, robh+dt,
	pawel.moll, mark.rutland, ijc+devicetree, galak, linux, gregkh,
	nsekhar

* Roger Quadros <rogerq@ti.com> [150624 04:58]:
> On Wed, 24 Jun 2015 14:50:17 +0300
> Roger Quadros <rogerq@ti.com> wrote:
> 
> > On Tue, 23 Jun 2015 17:28:53 +0530
> > Kishon Vijay Abraham I <kishon@ti.com> wrote:
> > 
> > > Add new device tree node for the control module register space where
> > > PCIe registers are present.
> > > 
> > > Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> > > ---
> > >  arch/arm/boot/dts/dra7.dtsi |    5 +++++
> > >  1 file changed, 5 insertions(+)
> > > 
> > > diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
> > > index 260f300..3f434f7 100644
> > > --- a/arch/arm/boot/dts/dra7.dtsi
> > > +++ b/arch/arm/boot/dts/dra7.dtsi
> > > @@ -291,6 +291,11 @@
> > >  			reg = <0x4a002e00 0x7c>;
> > >  		};
> > >  
> > > +		dra7_ctrl_pcie: tisyscon@4a003c00 {
> > > +			compatible = "syscon";
> > > +			reg = <0x4a003c00 0x48>;
> > > +		};
> > > +
> > 
> > Why do you need to start from 0x4a003c00?
> > CTRL_CORE_PCIESS1_PCS1 is at 0x4a003c24
> 
> Also, why can't this dra7_ctrl_pcie node be where scm_conf is.

Yes all the scm children should be under scm@2000 entry in the
dra7.dtsi file.

And BTW, there's nothing stopping a driver doing of_ioremap
on a larger range and be a child under scm@2000 in the dra7.dtsi
if that range is dedicated to a single driver.

My take is we should only use regmap for the scm_conf area
in general.

Regards,

Tony

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

* Re: [PATCH 08/17] ARM: dts: dra7: Add dt node for the sycon pcie
@ 2015-06-24 12:09         ` Tony Lindgren
  0 siblings, 0 replies; 150+ messages in thread
From: Tony Lindgren @ 2015-06-24 12:09 UTC (permalink / raw)
  To: Roger Quadros
  Cc: Kishon Vijay Abraham I, bcousson-rdvid1DuHRBWk0Htik3J/w,
	balbi-l0cyMroinI0, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0

* Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org> [150624 04:58]:
> On Wed, 24 Jun 2015 14:50:17 +0300
> Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org> wrote:
> 
> > On Tue, 23 Jun 2015 17:28:53 +0530
> > Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org> wrote:
> > 
> > > Add new device tree node for the control module register space where
> > > PCIe registers are present.
> > > 
> > > Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
> > > ---
> > >  arch/arm/boot/dts/dra7.dtsi |    5 +++++
> > >  1 file changed, 5 insertions(+)
> > > 
> > > diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
> > > index 260f300..3f434f7 100644
> > > --- a/arch/arm/boot/dts/dra7.dtsi
> > > +++ b/arch/arm/boot/dts/dra7.dtsi
> > > @@ -291,6 +291,11 @@
> > >  			reg = <0x4a002e00 0x7c>;
> > >  		};
> > >  
> > > +		dra7_ctrl_pcie: tisyscon@4a003c00 {
> > > +			compatible = "syscon";
> > > +			reg = <0x4a003c00 0x48>;
> > > +		};
> > > +
> > 
> > Why do you need to start from 0x4a003c00?
> > CTRL_CORE_PCIESS1_PCS1 is at 0x4a003c24
> 
> Also, why can't this dra7_ctrl_pcie node be where scm_conf is.

Yes all the scm children should be under scm@2000 entry in the
dra7.dtsi file.

And BTW, there's nothing stopping a driver doing of_ioremap
on a larger range and be a child under scm@2000 in the dra7.dtsi
if that range is dedicated to a single driver.

My take is we should only use regmap for the scm_conf area
in general.

Regards,

Tony
--
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] 150+ messages in thread

* [PATCH 08/17] ARM: dts: dra7: Add dt node for the sycon pcie
@ 2015-06-24 12:09         ` Tony Lindgren
  0 siblings, 0 replies; 150+ messages in thread
From: Tony Lindgren @ 2015-06-24 12:09 UTC (permalink / raw)
  To: linux-arm-kernel

* Roger Quadros <rogerq@ti.com> [150624 04:58]:
> On Wed, 24 Jun 2015 14:50:17 +0300
> Roger Quadros <rogerq@ti.com> wrote:
> 
> > On Tue, 23 Jun 2015 17:28:53 +0530
> > Kishon Vijay Abraham I <kishon@ti.com> wrote:
> > 
> > > Add new device tree node for the control module register space where
> > > PCIe registers are present.
> > > 
> > > Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> > > ---
> > >  arch/arm/boot/dts/dra7.dtsi |    5 +++++
> > >  1 file changed, 5 insertions(+)
> > > 
> > > diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
> > > index 260f300..3f434f7 100644
> > > --- a/arch/arm/boot/dts/dra7.dtsi
> > > +++ b/arch/arm/boot/dts/dra7.dtsi
> > > @@ -291,6 +291,11 @@
> > >  			reg = <0x4a002e00 0x7c>;
> > >  		};
> > >  
> > > +		dra7_ctrl_pcie: tisyscon at 4a003c00 {
> > > +			compatible = "syscon";
> > > +			reg = <0x4a003c00 0x48>;
> > > +		};
> > > +
> > 
> > Why do you need to start from 0x4a003c00?
> > CTRL_CORE_PCIESS1_PCS1 is at 0x4a003c24
> 
> Also, why can't this dra7_ctrl_pcie node be where scm_conf is.

Yes all the scm children should be under scm at 2000 entry in the
dra7.dtsi file.

And BTW, there's nothing stopping a driver doing of_ioremap
on a larger range and be a child under scm at 2000 in the dra7.dtsi
if that range is dedicated to a single driver.

My take is we should only use regmap for the scm_conf area
in general.

Regards,

Tony

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

* Re: [PATCH 09/17] ARM: dts: dra7: Use "syscon-phy-power" instead of "ctrl-module" in SATA PHY node
@ 2015-06-24 12:12       ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 12:12 UTC (permalink / raw)
  To: Roger Quadros
  Cc: Kishon Vijay Abraham I, bcousson, tony, balbi, devicetree,
	linux-kernel, linux-omap, linux-arm-kernel, linux-usb, robh+dt,
	pawel.moll, mark.rutland, ijc+devicetree, galak, linux, gregkh,
	nsekhar

On Wed, 24 Jun 2015 15:06:02 +0300
Roger Quadros <rogerq@ti.com> wrote:

> On Tue, 23 Jun 2015 17:28:54 +0530
> Kishon Vijay Abraham I <kishon@ti.com> wrote:
> 
> > Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
> > property from SATA PHY node. Since "omap_control_sata" note is no longer
> > used, remove it.
> > 
> > Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> 
> Acked-by: Roger Quadros <rogerq@ti.com>

One comment though.

> 
> > ---
> >  arch/arm/boot/dts/dra7.dtsi |   10 +---------
> >  1 file changed, 1 insertion(+), 9 deletions(-)
> > 
> > diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
> > index 3f434f7..92e0741 100644
> > --- a/arch/arm/boot/dts/dra7.dtsi
> > +++ b/arch/arm/boot/dts/dra7.dtsi
> > @@ -1115,14 +1115,6 @@
> >  			status = "disabled";
> >  		};
> >  
> > -		omap_control_sata: control-phy@4a002374 {
> > -			compatible = "ti,control-phy-pipe3";
> > -			reg = <0x4a002374 0x4>;
> > -			reg-names = "power";
> > -			clocks = <&sys_clkin1>;
> > -			clock-names = "sysclk";
> > -		};
> > -
> >  		/* OCP2SCP3 */
> >  		ocp2scp@4a090000 {
> >  			compatible = "ti,omap-ocp2scp";
> > @@ -1137,7 +1129,7 @@
> >  				      <0x4A096400 0x64>, /* phy_tx */
> >  				      <0x4A096800 0x40>; /* pll_ctrl */
> >  				reg-names = "phy_rx", "phy_tx", "pll_ctrl";
> > -				ctrl-module = <&omap_control_sata>;
> > +				syscon-phy-power = <&dra7_ctrl_core 0x374>;

why can't we use scm_conf instead of dra7_ctrl_core?
dra7_ctrl_core seems to be redundant and wrongly placed.

> >  				clocks = <&sys_clkin1>, <&sata_ref_clk>;
> >  				clock-names = "sysclk", "refclk";
> >  				syscon-pllreset = <&dra7_ctrl_core 0x3fc>;
> > -- 
> > 1.7.9.5
> > 

cheers,
-roger

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

* Re: [PATCH 09/17] ARM: dts: dra7: Use "syscon-phy-power" instead of "ctrl-module" in SATA PHY node
@ 2015-06-24 12:12       ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 12:12 UTC (permalink / raw)
  To: Roger Quadros
  Cc: Kishon Vijay Abraham I, bcousson-rdvid1DuHRBWk0Htik3J/w,
	tony-4v6yS6AI5VpBDgjK7y7TUQ, balbi-l0cyMroinI0,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0

On Wed, 24 Jun 2015 15:06:02 +0300
Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org> wrote:

> On Tue, 23 Jun 2015 17:28:54 +0530
> Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org> wrote:
> 
> > Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
> > property from SATA PHY node. Since "omap_control_sata" note is no longer
> > used, remove it.
> > 
> > Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
> 
> Acked-by: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>

One comment though.

> 
> > ---
> >  arch/arm/boot/dts/dra7.dtsi |   10 +---------
> >  1 file changed, 1 insertion(+), 9 deletions(-)
> > 
> > diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
> > index 3f434f7..92e0741 100644
> > --- a/arch/arm/boot/dts/dra7.dtsi
> > +++ b/arch/arm/boot/dts/dra7.dtsi
> > @@ -1115,14 +1115,6 @@
> >  			status = "disabled";
> >  		};
> >  
> > -		omap_control_sata: control-phy@4a002374 {
> > -			compatible = "ti,control-phy-pipe3";
> > -			reg = <0x4a002374 0x4>;
> > -			reg-names = "power";
> > -			clocks = <&sys_clkin1>;
> > -			clock-names = "sysclk";
> > -		};
> > -
> >  		/* OCP2SCP3 */
> >  		ocp2scp@4a090000 {
> >  			compatible = "ti,omap-ocp2scp";
> > @@ -1137,7 +1129,7 @@
> >  				      <0x4A096400 0x64>, /* phy_tx */
> >  				      <0x4A096800 0x40>; /* pll_ctrl */
> >  				reg-names = "phy_rx", "phy_tx", "pll_ctrl";
> > -				ctrl-module = <&omap_control_sata>;
> > +				syscon-phy-power = <&dra7_ctrl_core 0x374>;

why can't we use scm_conf instead of dra7_ctrl_core?
dra7_ctrl_core seems to be redundant and wrongly placed.

> >  				clocks = <&sys_clkin1>, <&sata_ref_clk>;
> >  				clock-names = "sysclk", "refclk";
> >  				syscon-pllreset = <&dra7_ctrl_core 0x3fc>;
> > -- 
> > 1.7.9.5
> > 

cheers,
-roger
--
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] 150+ messages in thread

* [PATCH 09/17] ARM: dts: dra7: Use "syscon-phy-power" instead of "ctrl-module" in SATA PHY node
@ 2015-06-24 12:12       ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 12:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 24 Jun 2015 15:06:02 +0300
Roger Quadros <rogerq@ti.com> wrote:

> On Tue, 23 Jun 2015 17:28:54 +0530
> Kishon Vijay Abraham I <kishon@ti.com> wrote:
> 
> > Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
> > property from SATA PHY node. Since "omap_control_sata" note is no longer
> > used, remove it.
> > 
> > Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> 
> Acked-by: Roger Quadros <rogerq@ti.com>

One comment though.

> 
> > ---
> >  arch/arm/boot/dts/dra7.dtsi |   10 +---------
> >  1 file changed, 1 insertion(+), 9 deletions(-)
> > 
> > diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
> > index 3f434f7..92e0741 100644
> > --- a/arch/arm/boot/dts/dra7.dtsi
> > +++ b/arch/arm/boot/dts/dra7.dtsi
> > @@ -1115,14 +1115,6 @@
> >  			status = "disabled";
> >  		};
> >  
> > -		omap_control_sata: control-phy at 4a002374 {
> > -			compatible = "ti,control-phy-pipe3";
> > -			reg = <0x4a002374 0x4>;
> > -			reg-names = "power";
> > -			clocks = <&sys_clkin1>;
> > -			clock-names = "sysclk";
> > -		};
> > -
> >  		/* OCP2SCP3 */
> >  		ocp2scp at 4a090000 {
> >  			compatible = "ti,omap-ocp2scp";
> > @@ -1137,7 +1129,7 @@
> >  				      <0x4A096400 0x64>, /* phy_tx */
> >  				      <0x4A096800 0x40>; /* pll_ctrl */
> >  				reg-names = "phy_rx", "phy_tx", "pll_ctrl";
> > -				ctrl-module = <&omap_control_sata>;
> > +				syscon-phy-power = <&dra7_ctrl_core 0x374>;

why can't we use scm_conf instead of dra7_ctrl_core?
dra7_ctrl_core seems to be redundant and wrongly placed.

> >  				clocks = <&sys_clkin1>, <&sata_ref_clk>;
> >  				clock-names = "sysclk", "refclk";
> >  				syscon-pllreset = <&dra7_ctrl_core 0x3fc>;
> > -- 
> > 1.7.9.5
> > 

cheers,
-roger

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

* Re: [PATCH 08/17] ARM: dts: dra7: Add dt node for the sycon pcie
@ 2015-06-24 12:19           ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 12:19 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Kishon Vijay Abraham I, bcousson, balbi, devicetree,
	linux-kernel, linux-omap, linux-arm-kernel, linux-usb, robh+dt,
	pawel.moll, mark.rutland, ijc+devicetree, galak, linux, gregkh,
	nsekhar

On Wed, 24 Jun 2015 05:09:39 -0700
Tony Lindgren <tony@atomide.com> wrote:

> * Roger Quadros <rogerq@ti.com> [150624 04:58]:
> > On Wed, 24 Jun 2015 14:50:17 +0300
> > Roger Quadros <rogerq@ti.com> wrote:
> > 
> > > On Tue, 23 Jun 2015 17:28:53 +0530
> > > Kishon Vijay Abraham I <kishon@ti.com> wrote:
> > > 
> > > > Add new device tree node for the control module register space where
> > > > PCIe registers are present.
> > > > 
> > > > Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> > > > ---
> > > >  arch/arm/boot/dts/dra7.dtsi |    5 +++++
> > > >  1 file changed, 5 insertions(+)
> > > > 
> > > > diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
> > > > index 260f300..3f434f7 100644
> > > > --- a/arch/arm/boot/dts/dra7.dtsi
> > > > +++ b/arch/arm/boot/dts/dra7.dtsi
> > > > @@ -291,6 +291,11 @@
> > > >  			reg = <0x4a002e00 0x7c>;
> > > >  		};
> > > >  
> > > > +		dra7_ctrl_pcie: tisyscon@4a003c00 {
> > > > +			compatible = "syscon";
> > > > +			reg = <0x4a003c00 0x48>;
> > > > +		};
> > > > +
> > > 
> > > Why do you need to start from 0x4a003c00?
> > > CTRL_CORE_PCIESS1_PCS1 is at 0x4a003c24
> > 
> > Also, why can't this dra7_ctrl_pcie node be where scm_conf is.
> 
> Yes all the scm children should be under scm@2000 entry in the
> dra7.dtsi file.
> 
> And BTW, there's nothing stopping a driver doing of_ioremap
> on a larger range and be a child under scm@2000 in the dra7.dtsi
> if that range is dedicated to a single driver.

Agreed.

> 
> My take is we should only use regmap for the scm_conf area
> in general.

+1

should we get rid of dra7_ctrl_core and dra7_ctrl_general?
or move them to scm node?

cheers,
-roger

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

* Re: [PATCH 08/17] ARM: dts: dra7: Add dt node for the sycon pcie
@ 2015-06-24 12:19           ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 12:19 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Kishon Vijay Abraham I, bcousson-rdvid1DuHRBWk0Htik3J/w,
	balbi-l0cyMroinI0, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0

On Wed, 24 Jun 2015 05:09:39 -0700
Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> wrote:

> * Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org> [150624 04:58]:
> > On Wed, 24 Jun 2015 14:50:17 +0300
> > Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org> wrote:
> > 
> > > On Tue, 23 Jun 2015 17:28:53 +0530
> > > Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org> wrote:
> > > 
> > > > Add new device tree node for the control module register space where
> > > > PCIe registers are present.
> > > > 
> > > > Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
> > > > ---
> > > >  arch/arm/boot/dts/dra7.dtsi |    5 +++++
> > > >  1 file changed, 5 insertions(+)
> > > > 
> > > > diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
> > > > index 260f300..3f434f7 100644
> > > > --- a/arch/arm/boot/dts/dra7.dtsi
> > > > +++ b/arch/arm/boot/dts/dra7.dtsi
> > > > @@ -291,6 +291,11 @@
> > > >  			reg = <0x4a002e00 0x7c>;
> > > >  		};
> > > >  
> > > > +		dra7_ctrl_pcie: tisyscon@4a003c00 {
> > > > +			compatible = "syscon";
> > > > +			reg = <0x4a003c00 0x48>;
> > > > +		};
> > > > +
> > > 
> > > Why do you need to start from 0x4a003c00?
> > > CTRL_CORE_PCIESS1_PCS1 is at 0x4a003c24
> > 
> > Also, why can't this dra7_ctrl_pcie node be where scm_conf is.
> 
> Yes all the scm children should be under scm@2000 entry in the
> dra7.dtsi file.
> 
> And BTW, there's nothing stopping a driver doing of_ioremap
> on a larger range and be a child under scm@2000 in the dra7.dtsi
> if that range is dedicated to a single driver.

Agreed.

> 
> My take is we should only use regmap for the scm_conf area
> in general.

+1

should we get rid of dra7_ctrl_core and dra7_ctrl_general?
or move them to scm node?

cheers,
-roger
--
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] 150+ messages in thread

* [PATCH 08/17] ARM: dts: dra7: Add dt node for the sycon pcie
@ 2015-06-24 12:19           ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 12:19 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 24 Jun 2015 05:09:39 -0700
Tony Lindgren <tony@atomide.com> wrote:

> * Roger Quadros <rogerq@ti.com> [150624 04:58]:
> > On Wed, 24 Jun 2015 14:50:17 +0300
> > Roger Quadros <rogerq@ti.com> wrote:
> > 
> > > On Tue, 23 Jun 2015 17:28:53 +0530
> > > Kishon Vijay Abraham I <kishon@ti.com> wrote:
> > > 
> > > > Add new device tree node for the control module register space where
> > > > PCIe registers are present.
> > > > 
> > > > Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> > > > ---
> > > >  arch/arm/boot/dts/dra7.dtsi |    5 +++++
> > > >  1 file changed, 5 insertions(+)
> > > > 
> > > > diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
> > > > index 260f300..3f434f7 100644
> > > > --- a/arch/arm/boot/dts/dra7.dtsi
> > > > +++ b/arch/arm/boot/dts/dra7.dtsi
> > > > @@ -291,6 +291,11 @@
> > > >  			reg = <0x4a002e00 0x7c>;
> > > >  		};
> > > >  
> > > > +		dra7_ctrl_pcie: tisyscon at 4a003c00 {
> > > > +			compatible = "syscon";
> > > > +			reg = <0x4a003c00 0x48>;
> > > > +		};
> > > > +
> > > 
> > > Why do you need to start from 0x4a003c00?
> > > CTRL_CORE_PCIESS1_PCS1 is at 0x4a003c24
> > 
> > Also, why can't this dra7_ctrl_pcie node be where scm_conf is.
> 
> Yes all the scm children should be under scm at 2000 entry in the
> dra7.dtsi file.
> 
> And BTW, there's nothing stopping a driver doing of_ioremap
> on a larger range and be a child under scm at 2000 in the dra7.dtsi
> if that range is dedicated to a single driver.

Agreed.

> 
> My take is we should only use regmap for the scm_conf area
> in general.

+1

should we get rid of dra7_ctrl_core and dra7_ctrl_general?
or move them to scm node?

cheers,
-roger

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

* Re: [PATCH 08/17] ARM: dts: dra7: Add dt node for the sycon pcie
@ 2015-06-24 12:49             ` Tony Lindgren
  0 siblings, 0 replies; 150+ messages in thread
From: Tony Lindgren @ 2015-06-24 12:49 UTC (permalink / raw)
  To: Roger Quadros
  Cc: Kishon Vijay Abraham I, bcousson, balbi, devicetree,
	linux-kernel, linux-omap, linux-arm-kernel, linux-usb, robh+dt,
	pawel.moll, mark.rutland, ijc+devicetree, galak, linux, gregkh,
	nsekhar

* Roger Quadros <rogerq@ti.com> [150624 05:21]:
> On Wed, 24 Jun 2015 05:09:39 -0700
> Tony Lindgren <tony@atomide.com> wrote:
> > 
> > My take is we should only use regmap for the scm_conf area
> > in general.
> 
> +1
> 
> should we get rid of dra7_ctrl_core and dra7_ctrl_general?
> or move them to scm node?

Well at least move them. And if there are clear dedicated
register ranges there claimed only by a single device driver,
then those drivers should be just regular loadable driver
modules doing of_ioremap on the range. And in that case they
can be removed.

We have examples of both in dra7.dtsi, pbias_regulator using
the scm_conf via syscon, and then dra7_pmx_core ioremapping
a dedicated register range. So unless there are other messy
register ranges like the scm_conf area then there should not
be need for other syscon areas.

Regards,

Tony

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

* Re: [PATCH 08/17] ARM: dts: dra7: Add dt node for the sycon pcie
@ 2015-06-24 12:49             ` Tony Lindgren
  0 siblings, 0 replies; 150+ messages in thread
From: Tony Lindgren @ 2015-06-24 12:49 UTC (permalink / raw)
  To: Roger Quadros
  Cc: Kishon Vijay Abraham I, bcousson-rdvid1DuHRBWk0Htik3J/w,
	balbi-l0cyMroinI0, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0

* Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org> [150624 05:21]:
> On Wed, 24 Jun 2015 05:09:39 -0700
> Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> wrote:
> > 
> > My take is we should only use regmap for the scm_conf area
> > in general.
> 
> +1
> 
> should we get rid of dra7_ctrl_core and dra7_ctrl_general?
> or move them to scm node?

Well at least move them. And if there are clear dedicated
register ranges there claimed only by a single device driver,
then those drivers should be just regular loadable driver
modules doing of_ioremap on the range. And in that case they
can be removed.

We have examples of both in dra7.dtsi, pbias_regulator using
the scm_conf via syscon, and then dra7_pmx_core ioremapping
a dedicated register range. So unless there are other messy
register ranges like the scm_conf area then there should not
be need for other syscon areas.

Regards,

Tony
--
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] 150+ messages in thread

* [PATCH 08/17] ARM: dts: dra7: Add dt node for the sycon pcie
@ 2015-06-24 12:49             ` Tony Lindgren
  0 siblings, 0 replies; 150+ messages in thread
From: Tony Lindgren @ 2015-06-24 12:49 UTC (permalink / raw)
  To: linux-arm-kernel

* Roger Quadros <rogerq@ti.com> [150624 05:21]:
> On Wed, 24 Jun 2015 05:09:39 -0700
> Tony Lindgren <tony@atomide.com> wrote:
> > 
> > My take is we should only use regmap for the scm_conf area
> > in general.
> 
> +1
> 
> should we get rid of dra7_ctrl_core and dra7_ctrl_general?
> or move them to scm node?

Well at least move them. And if there are clear dedicated
register ranges there claimed only by a single device driver,
then those drivers should be just regular loadable driver
modules doing of_ioremap on the range. And in that case they
can be removed.

We have examples of both in dra7.dtsi, pbias_regulator using
the scm_conf via syscon, and then dra7_pmx_core ioremapping
a dedicated register range. So unless there are other messy
register ranges like the scm_conf area then there should not
be need for other syscon areas.

Regards,

Tony

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

* Re: [PATCH 06/17] phy: omap-usb2: use *syscon* framework to power on/off the PHY
  2015-06-24 11:33     ` Roger Quadros
  (?)
@ 2015-06-24 12:59       ` Kishon Vijay Abraham I
  -1 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 12:59 UTC (permalink / raw)
  To: Roger Quadros
  Cc: bcousson, tony, balbi, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

Hi,

On Wednesday 24 June 2015 05:03 PM, Roger Quadros wrote:
> On Tue, 23 Jun 2015 17:28:51 +0530
> Kishon Vijay Abraham I <kishon@ti.com> wrote:
> 
>> Deprecate using phy-omap-control driver to power on/off the PHY,
>> and use *syscon* framework to do the same. This handles
>> powering on/off the PHY for the USB2 PHYs used in various TI SoCs.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> ---
>>  Documentation/devicetree/bindings/phy/ti-phy.txt |    6 +-
>>  drivers/phy/phy-omap-usb2.c                      |  101 ++++++++++++++++++----
>>  include/linux/phy/omap_usb.h                     |   18 ++++
>>  3 files changed, 107 insertions(+), 18 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
>> index b9101b9..5bfe461 100644
>> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
>> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
>> @@ -42,10 +42,14 @@ Required properties:
>>     * "wkupclk" - wakeup clock.
>>     * "refclk" - reference clock (optional).
>>  
>> -Optional properties:
>> +Deprecated properties:
>>   - ctrl-module : phandle of the control module used by PHY driver to power on
>>     the PHY.
>>  
>> +Recommended properies:
>> +- syscon-phy-power : phandle/offset pair. Phandle to the system control
>> +  module and the register offset to power on/off the PHY.
>> +
>>  This is usually a subnode of ocp2scp to which it is connected.
>>  
>>  usb2phy@4a0ad080 {
>> diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
>> index 2f7220f..180b066 100644
>> --- a/drivers/phy/phy-omap-usb2.c
>> +++ b/drivers/phy/phy-omap-usb2.c
>> @@ -29,6 +29,8 @@
>>  #include <linux/delay.h>
>>  #include <linux/phy/omap_control_phy.h>
>>  #include <linux/phy/phy.h>
>> +#include <linux/mfd/syscon.h>
>> +#include <linux/regmap.h>
>>  #include <linux/of_platform.h>
>>  
>>  #define USB2PHY_DISCON_BYP_LATCH (1 << 31)
>> @@ -97,22 +99,65 @@ static int omap_usb_set_peripheral(struct usb_otg *otg,
>>  	return 0;
>>  }
>>  
>> -static int omap_usb_power_off(struct phy *x)
>> +static int omap_usb_phy_power(struct omap_usb *phy, int on)
>>  {
>> -	struct omap_usb *phy = phy_get_drvdata(x);
>> +	u32 val = 0;
>> +	u32 mask;
>> +	int ret;
>>  
>> -	omap_control_phy_power(phy->control_dev, 0);
>> +	if (phy->syscon_phy_power) {
>> +		switch (phy->type) {
>> +		case TYPE_USB2:
>> +			mask = OMAP_DEV_PHY_PD;
>> +			if (!on)
>> +				val = OMAP_DEV_PHY_PD;
>> +			break;
>> +		case TYPE_DRA7USB2:
>> +			mask = OMAP_USB2_PHY_PD;
>> +			if (!on)
>> +				val = OMAP_USB2_PHY_PD;
>> +			break;
>> +		case TYPE_AM437USB2:
>> +			mask = AM437X_USB2_PHY_PD |
>> +				AM437X_USB2_OTG_PD |
>> +				AM437X_USB2_OTGVDET_EN |
>> +				AM437X_USB2_OTGSESSEND_EN;
>> +			if (on) {
>> +				val = AM437X_USB2_OTGVDET_EN |
>> +					AM437X_USB2_OTGSESSEND_EN;
>> +			} else {
>> +				val = AM437X_USB2_PHY_PD | AM437X_USB2_OTG_PD;
>> +			}
>> +			break;
>> +		default:
>> +			dev_err(phy->dev, "%s: type %d not recognized\n",
>> +				__func__, phy->type);
>> +			return -EINVAL;
>> +		}
>> +
>> +		ret = regmap_update_bits(phy->syscon_phy_power, phy->power_reg,
>> +					 mask, val);
>> +		if (ret < 0)
>> +			return ret;
>> +	} else {
>> +		omap_control_phy_power(phy->control_dev, on);
>> +	}
>>  
>>  	return 0;
>>  }
>>  
>> -static int omap_usb_power_on(struct phy *x)
>> +static int omap_usb_power_off(struct phy *x)
>>  {
>>  	struct omap_usb *phy = phy_get_drvdata(x);
>>  
>> -	omap_control_phy_power(phy->control_dev, 1);
>> +	return omap_usb_phy_power(phy, false);
>> +}
>>  
>> -	return 0;
>> +static int omap_usb_power_on(struct phy *x)
>> +{
>> +	struct omap_usb *phy = phy_get_drvdata(x);
>> +
>> +	return omap_usb_phy_power(phy, true);
>>  }
>>  
>>  static int omap_usb_init(struct phy *x)
>> @@ -147,26 +192,31 @@ static struct phy_ops ops = {
>>  static const struct usb_phy_data omap_usb2_data = {
>>  	.label = "omap_usb2",
>>  	.flags = OMAP_USB2_HAS_START_SRP | OMAP_USB2_HAS_SET_VBUS,
>> +	.type = TYPE_USB2,
>>  };
>>  
>>  static const struct usb_phy_data omap5_usb2_data = {
>>  	.label = "omap5_usb2",
>>  	.flags = 0,
>> +	.type = TYPE_USB2,
>>  };
>>  
>>  static const struct usb_phy_data dra7x_usb2_data = {
>>  	.label = "dra7x_usb2",
>>  	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
>> +	.type = TYPE_USB2,
>>  };
>>  
>>  static const struct usb_phy_data dra7x_usb2_phy2_data = {
>>  	.label = "dra7x_usb2_phy2",
>>  	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
>> +	.type = TYPE_DRA7USB2,
>>  };
>>  
>>  static const struct usb_phy_data am437x_usb2_data = {
>>  	.label = "am437x_usb2",
>>  	.flags =  0,
>> +	.type = TYPE_AM437USB2,
>>  };
>>  
>>  static const struct of_device_id omap_usb2_id_table[] = {
>> @@ -223,6 +273,7 @@ static int omap_usb2_probe(struct platform_device *pdev)
>>  		return -ENOMEM;
>>  
>>  	phy->dev		= &pdev->dev;
>> +	phy->type		= phy_data->type;
>>  
>>  	phy->phy.dev		= phy->dev;
>>  	phy->phy.label		= phy_data->label;
>> @@ -237,20 +288,36 @@ static int omap_usb2_probe(struct platform_device *pdev)
>>  		phy->flags |= OMAP_USB2_CALIBRATE_FALSE_DISCONNECT;
>>  	}
>>  
>> -	control_node = of_parse_phandle(node, "ctrl-module", 0);
>> -	if (!control_node) {
>> -		dev_err(&pdev->dev, "Failed to get control device phandle\n");
>> -		return -EINVAL;
>> -	}
>> +	phy->syscon_phy_power = syscon_regmap_lookup_by_phandle(node,
>> +							"syscon-phy-power");
>> +	if (IS_ERR(phy->syscon_phy_power)) {
>> +		dev_info(&pdev->dev,
>> +			 "can't get syscon-phy-power, using control device\n");
>> +		phy->syscon_phy_power = NULL;
>> +
>> +		control_node = of_parse_phandle(node, "ctrl-module", 0);
>> +		if (!control_node) {
>> +			dev_err(&pdev->dev,
>> +				"Failed to get control device phandle\n");
>> +			return -EINVAL;
>> +		}
>>  
>> -	control_pdev = of_find_device_by_node(control_node);
>> -	if (!control_pdev) {
>> -		dev_err(&pdev->dev, "Failed to get control device\n");
>> -		return -EINVAL;
>> +		control_pdev = of_find_device_by_node(control_node);
>> +		if (!control_pdev) {
>> +			dev_err(&pdev->dev, "Failed to get control device\n");
>> +			return -EINVAL;
>> +		}
>> +		phy->control_dev = &control_pdev->dev;
>> +	} else {
>> +		if (of_property_read_u32_index(node,
>> +					       "syscon-phy-power", 1,
>> +					       &phy->power_reg)) {
>> +			dev_err(&pdev->dev,
>> +				"couldn't get power reg. offset\n");
>> +			return -EINVAL;
>> +		}
>>  	}
>>  
>> -	phy->control_dev = &control_pdev->dev;
>> -
>>  	otg->set_host		= omap_usb_set_host;
>>  	otg->set_peripheral	= omap_usb_set_peripheral;
>>  	if (phy_data->flags & OMAP_USB2_HAS_SET_VBUS)
>> diff --git a/include/linux/phy/omap_usb.h b/include/linux/phy/omap_usb.h
>> index dc2c541..de933ab 100644
>> --- a/include/linux/phy/omap_usb.h
>> +++ b/include/linux/phy/omap_usb.h
>> @@ -30,6 +30,12 @@ struct usb_dpll_params {
>>  	u32	mf;
>>  };
>>  
>> +enum omap_usb_phy_type {
>> +	TYPE_USB2,    /* USB2_PHY, power down in CONTROL_DEV_CONF */
>> +	TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */
>> +	TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */
>> +};
>> +
>>  struct omap_usb {
>>  	struct usb_phy		phy;
>>  	struct phy_companion	*comparator;
>> @@ -40,11 +46,15 @@ struct omap_usb {
>>  	struct clk		*wkupclk;
>>  	struct clk		*optclk;
>>  	u8			flags;
>> +	enum omap_usb_phy_type	type;
>> +	struct regmap		*syscon_phy_power; /* ctrl. reg. acces */
>> +	unsigned int		power_reg; /* power reg. index within syscon */
>>  };
>>  
>>  struct usb_phy_data {
>>  	const char *label;
>>  	u8 flags;
>> +	enum omap_usb_phy_type type;
>>  };
>>  
>>  /* Driver Flags */
>> @@ -52,6 +62,14 @@ struct usb_phy_data {
>>  #define OMAP_USB2_HAS_SET_VBUS (1 << 1)
>>  #define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT (1 << 2)
>>  
>> +#define OMAP_DEV_PHY_PD		BIT(0)
>> +#define OMAP_USB2_PHY_PD	BIT(28)
>> +
>> +#define AM437X_USB2_PHY_PD		BIT(0)
> 
> This PD bit can be set in usb_phy_data and used by
> a single block of code for all 3 phys.

yeah, that could be done.

Thanks
Kishon

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

* Re: [PATCH 06/17] phy: omap-usb2: use *syscon* framework to power on/off the PHY
@ 2015-06-24 12:59       ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 12:59 UTC (permalink / raw)
  To: Roger Quadros
  Cc: bcousson, tony, balbi, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

Hi,

On Wednesday 24 June 2015 05:03 PM, Roger Quadros wrote:
> On Tue, 23 Jun 2015 17:28:51 +0530
> Kishon Vijay Abraham I <kishon@ti.com> wrote:
> 
>> Deprecate using phy-omap-control driver to power on/off the PHY,
>> and use *syscon* framework to do the same. This handles
>> powering on/off the PHY for the USB2 PHYs used in various TI SoCs.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> ---
>>  Documentation/devicetree/bindings/phy/ti-phy.txt |    6 +-
>>  drivers/phy/phy-omap-usb2.c                      |  101 ++++++++++++++++++----
>>  include/linux/phy/omap_usb.h                     |   18 ++++
>>  3 files changed, 107 insertions(+), 18 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
>> index b9101b9..5bfe461 100644
>> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
>> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
>> @@ -42,10 +42,14 @@ Required properties:
>>     * "wkupclk" - wakeup clock.
>>     * "refclk" - reference clock (optional).
>>  
>> -Optional properties:
>> +Deprecated properties:
>>   - ctrl-module : phandle of the control module used by PHY driver to power on
>>     the PHY.
>>  
>> +Recommended properies:
>> +- syscon-phy-power : phandle/offset pair. Phandle to the system control
>> +  module and the register offset to power on/off the PHY.
>> +
>>  This is usually a subnode of ocp2scp to which it is connected.
>>  
>>  usb2phy@4a0ad080 {
>> diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
>> index 2f7220f..180b066 100644
>> --- a/drivers/phy/phy-omap-usb2.c
>> +++ b/drivers/phy/phy-omap-usb2.c
>> @@ -29,6 +29,8 @@
>>  #include <linux/delay.h>
>>  #include <linux/phy/omap_control_phy.h>
>>  #include <linux/phy/phy.h>
>> +#include <linux/mfd/syscon.h>
>> +#include <linux/regmap.h>
>>  #include <linux/of_platform.h>
>>  
>>  #define USB2PHY_DISCON_BYP_LATCH (1 << 31)
>> @@ -97,22 +99,65 @@ static int omap_usb_set_peripheral(struct usb_otg *otg,
>>  	return 0;
>>  }
>>  
>> -static int omap_usb_power_off(struct phy *x)
>> +static int omap_usb_phy_power(struct omap_usb *phy, int on)
>>  {
>> -	struct omap_usb *phy = phy_get_drvdata(x);
>> +	u32 val = 0;
>> +	u32 mask;
>> +	int ret;
>>  
>> -	omap_control_phy_power(phy->control_dev, 0);
>> +	if (phy->syscon_phy_power) {
>> +		switch (phy->type) {
>> +		case TYPE_USB2:
>> +			mask = OMAP_DEV_PHY_PD;
>> +			if (!on)
>> +				val = OMAP_DEV_PHY_PD;
>> +			break;
>> +		case TYPE_DRA7USB2:
>> +			mask = OMAP_USB2_PHY_PD;
>> +			if (!on)
>> +				val = OMAP_USB2_PHY_PD;
>> +			break;
>> +		case TYPE_AM437USB2:
>> +			mask = AM437X_USB2_PHY_PD |
>> +				AM437X_USB2_OTG_PD |
>> +				AM437X_USB2_OTGVDET_EN |
>> +				AM437X_USB2_OTGSESSEND_EN;
>> +			if (on) {
>> +				val = AM437X_USB2_OTGVDET_EN |
>> +					AM437X_USB2_OTGSESSEND_EN;
>> +			} else {
>> +				val = AM437X_USB2_PHY_PD | AM437X_USB2_OTG_PD;
>> +			}
>> +			break;
>> +		default:
>> +			dev_err(phy->dev, "%s: type %d not recognized\n",
>> +				__func__, phy->type);
>> +			return -EINVAL;
>> +		}
>> +
>> +		ret = regmap_update_bits(phy->syscon_phy_power, phy->power_reg,
>> +					 mask, val);
>> +		if (ret < 0)
>> +			return ret;
>> +	} else {
>> +		omap_control_phy_power(phy->control_dev, on);
>> +	}
>>  
>>  	return 0;
>>  }
>>  
>> -static int omap_usb_power_on(struct phy *x)
>> +static int omap_usb_power_off(struct phy *x)
>>  {
>>  	struct omap_usb *phy = phy_get_drvdata(x);
>>  
>> -	omap_control_phy_power(phy->control_dev, 1);
>> +	return omap_usb_phy_power(phy, false);
>> +}
>>  
>> -	return 0;
>> +static int omap_usb_power_on(struct phy *x)
>> +{
>> +	struct omap_usb *phy = phy_get_drvdata(x);
>> +
>> +	return omap_usb_phy_power(phy, true);
>>  }
>>  
>>  static int omap_usb_init(struct phy *x)
>> @@ -147,26 +192,31 @@ static struct phy_ops ops = {
>>  static const struct usb_phy_data omap_usb2_data = {
>>  	.label = "omap_usb2",
>>  	.flags = OMAP_USB2_HAS_START_SRP | OMAP_USB2_HAS_SET_VBUS,
>> +	.type = TYPE_USB2,
>>  };
>>  
>>  static const struct usb_phy_data omap5_usb2_data = {
>>  	.label = "omap5_usb2",
>>  	.flags = 0,
>> +	.type = TYPE_USB2,
>>  };
>>  
>>  static const struct usb_phy_data dra7x_usb2_data = {
>>  	.label = "dra7x_usb2",
>>  	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
>> +	.type = TYPE_USB2,
>>  };
>>  
>>  static const struct usb_phy_data dra7x_usb2_phy2_data = {
>>  	.label = "dra7x_usb2_phy2",
>>  	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
>> +	.type = TYPE_DRA7USB2,
>>  };
>>  
>>  static const struct usb_phy_data am437x_usb2_data = {
>>  	.label = "am437x_usb2",
>>  	.flags =  0,
>> +	.type = TYPE_AM437USB2,
>>  };
>>  
>>  static const struct of_device_id omap_usb2_id_table[] = {
>> @@ -223,6 +273,7 @@ static int omap_usb2_probe(struct platform_device *pdev)
>>  		return -ENOMEM;
>>  
>>  	phy->dev		= &pdev->dev;
>> +	phy->type		= phy_data->type;
>>  
>>  	phy->phy.dev		= phy->dev;
>>  	phy->phy.label		= phy_data->label;
>> @@ -237,20 +288,36 @@ static int omap_usb2_probe(struct platform_device *pdev)
>>  		phy->flags |= OMAP_USB2_CALIBRATE_FALSE_DISCONNECT;
>>  	}
>>  
>> -	control_node = of_parse_phandle(node, "ctrl-module", 0);
>> -	if (!control_node) {
>> -		dev_err(&pdev->dev, "Failed to get control device phandle\n");
>> -		return -EINVAL;
>> -	}
>> +	phy->syscon_phy_power = syscon_regmap_lookup_by_phandle(node,
>> +							"syscon-phy-power");
>> +	if (IS_ERR(phy->syscon_phy_power)) {
>> +		dev_info(&pdev->dev,
>> +			 "can't get syscon-phy-power, using control device\n");
>> +		phy->syscon_phy_power = NULL;
>> +
>> +		control_node = of_parse_phandle(node, "ctrl-module", 0);
>> +		if (!control_node) {
>> +			dev_err(&pdev->dev,
>> +				"Failed to get control device phandle\n");
>> +			return -EINVAL;
>> +		}
>>  
>> -	control_pdev = of_find_device_by_node(control_node);
>> -	if (!control_pdev) {
>> -		dev_err(&pdev->dev, "Failed to get control device\n");
>> -		return -EINVAL;
>> +		control_pdev = of_find_device_by_node(control_node);
>> +		if (!control_pdev) {
>> +			dev_err(&pdev->dev, "Failed to get control device\n");
>> +			return -EINVAL;
>> +		}
>> +		phy->control_dev = &control_pdev->dev;
>> +	} else {
>> +		if (of_property_read_u32_index(node,
>> +					       "syscon-phy-power", 1,
>> +					       &phy->power_reg)) {
>> +			dev_err(&pdev->dev,
>> +				"couldn't get power reg. offset\n");
>> +			return -EINVAL;
>> +		}
>>  	}
>>  
>> -	phy->control_dev = &control_pdev->dev;
>> -
>>  	otg->set_host		= omap_usb_set_host;
>>  	otg->set_peripheral	= omap_usb_set_peripheral;
>>  	if (phy_data->flags & OMAP_USB2_HAS_SET_VBUS)
>> diff --git a/include/linux/phy/omap_usb.h b/include/linux/phy/omap_usb.h
>> index dc2c541..de933ab 100644
>> --- a/include/linux/phy/omap_usb.h
>> +++ b/include/linux/phy/omap_usb.h
>> @@ -30,6 +30,12 @@ struct usb_dpll_params {
>>  	u32	mf;
>>  };
>>  
>> +enum omap_usb_phy_type {
>> +	TYPE_USB2,    /* USB2_PHY, power down in CONTROL_DEV_CONF */
>> +	TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */
>> +	TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */
>> +};
>> +
>>  struct omap_usb {
>>  	struct usb_phy		phy;
>>  	struct phy_companion	*comparator;
>> @@ -40,11 +46,15 @@ struct omap_usb {
>>  	struct clk		*wkupclk;
>>  	struct clk		*optclk;
>>  	u8			flags;
>> +	enum omap_usb_phy_type	type;
>> +	struct regmap		*syscon_phy_power; /* ctrl. reg. acces */
>> +	unsigned int		power_reg; /* power reg. index within syscon */
>>  };
>>  
>>  struct usb_phy_data {
>>  	const char *label;
>>  	u8 flags;
>> +	enum omap_usb_phy_type type;
>>  };
>>  
>>  /* Driver Flags */
>> @@ -52,6 +62,14 @@ struct usb_phy_data {
>>  #define OMAP_USB2_HAS_SET_VBUS (1 << 1)
>>  #define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT (1 << 2)
>>  
>> +#define OMAP_DEV_PHY_PD		BIT(0)
>> +#define OMAP_USB2_PHY_PD	BIT(28)
>> +
>> +#define AM437X_USB2_PHY_PD		BIT(0)
> 
> This PD bit can be set in usb_phy_data and used by
> a single block of code for all 3 phys.

yeah, that could be done.

Thanks
Kishon

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

* [PATCH 06/17] phy: omap-usb2: use *syscon* framework to power on/off the PHY
@ 2015-06-24 12:59       ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 12:59 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Wednesday 24 June 2015 05:03 PM, Roger Quadros wrote:
> On Tue, 23 Jun 2015 17:28:51 +0530
> Kishon Vijay Abraham I <kishon@ti.com> wrote:
> 
>> Deprecate using phy-omap-control driver to power on/off the PHY,
>> and use *syscon* framework to do the same. This handles
>> powering on/off the PHY for the USB2 PHYs used in various TI SoCs.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> ---
>>  Documentation/devicetree/bindings/phy/ti-phy.txt |    6 +-
>>  drivers/phy/phy-omap-usb2.c                      |  101 ++++++++++++++++++----
>>  include/linux/phy/omap_usb.h                     |   18 ++++
>>  3 files changed, 107 insertions(+), 18 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
>> index b9101b9..5bfe461 100644
>> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
>> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
>> @@ -42,10 +42,14 @@ Required properties:
>>     * "wkupclk" - wakeup clock.
>>     * "refclk" - reference clock (optional).
>>  
>> -Optional properties:
>> +Deprecated properties:
>>   - ctrl-module : phandle of the control module used by PHY driver to power on
>>     the PHY.
>>  
>> +Recommended properies:
>> +- syscon-phy-power : phandle/offset pair. Phandle to the system control
>> +  module and the register offset to power on/off the PHY.
>> +
>>  This is usually a subnode of ocp2scp to which it is connected.
>>  
>>  usb2phy at 4a0ad080 {
>> diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
>> index 2f7220f..180b066 100644
>> --- a/drivers/phy/phy-omap-usb2.c
>> +++ b/drivers/phy/phy-omap-usb2.c
>> @@ -29,6 +29,8 @@
>>  #include <linux/delay.h>
>>  #include <linux/phy/omap_control_phy.h>
>>  #include <linux/phy/phy.h>
>> +#include <linux/mfd/syscon.h>
>> +#include <linux/regmap.h>
>>  #include <linux/of_platform.h>
>>  
>>  #define USB2PHY_DISCON_BYP_LATCH (1 << 31)
>> @@ -97,22 +99,65 @@ static int omap_usb_set_peripheral(struct usb_otg *otg,
>>  	return 0;
>>  }
>>  
>> -static int omap_usb_power_off(struct phy *x)
>> +static int omap_usb_phy_power(struct omap_usb *phy, int on)
>>  {
>> -	struct omap_usb *phy = phy_get_drvdata(x);
>> +	u32 val = 0;
>> +	u32 mask;
>> +	int ret;
>>  
>> -	omap_control_phy_power(phy->control_dev, 0);
>> +	if (phy->syscon_phy_power) {
>> +		switch (phy->type) {
>> +		case TYPE_USB2:
>> +			mask = OMAP_DEV_PHY_PD;
>> +			if (!on)
>> +				val = OMAP_DEV_PHY_PD;
>> +			break;
>> +		case TYPE_DRA7USB2:
>> +			mask = OMAP_USB2_PHY_PD;
>> +			if (!on)
>> +				val = OMAP_USB2_PHY_PD;
>> +			break;
>> +		case TYPE_AM437USB2:
>> +			mask = AM437X_USB2_PHY_PD |
>> +				AM437X_USB2_OTG_PD |
>> +				AM437X_USB2_OTGVDET_EN |
>> +				AM437X_USB2_OTGSESSEND_EN;
>> +			if (on) {
>> +				val = AM437X_USB2_OTGVDET_EN |
>> +					AM437X_USB2_OTGSESSEND_EN;
>> +			} else {
>> +				val = AM437X_USB2_PHY_PD | AM437X_USB2_OTG_PD;
>> +			}
>> +			break;
>> +		default:
>> +			dev_err(phy->dev, "%s: type %d not recognized\n",
>> +				__func__, phy->type);
>> +			return -EINVAL;
>> +		}
>> +
>> +		ret = regmap_update_bits(phy->syscon_phy_power, phy->power_reg,
>> +					 mask, val);
>> +		if (ret < 0)
>> +			return ret;
>> +	} else {
>> +		omap_control_phy_power(phy->control_dev, on);
>> +	}
>>  
>>  	return 0;
>>  }
>>  
>> -static int omap_usb_power_on(struct phy *x)
>> +static int omap_usb_power_off(struct phy *x)
>>  {
>>  	struct omap_usb *phy = phy_get_drvdata(x);
>>  
>> -	omap_control_phy_power(phy->control_dev, 1);
>> +	return omap_usb_phy_power(phy, false);
>> +}
>>  
>> -	return 0;
>> +static int omap_usb_power_on(struct phy *x)
>> +{
>> +	struct omap_usb *phy = phy_get_drvdata(x);
>> +
>> +	return omap_usb_phy_power(phy, true);
>>  }
>>  
>>  static int omap_usb_init(struct phy *x)
>> @@ -147,26 +192,31 @@ static struct phy_ops ops = {
>>  static const struct usb_phy_data omap_usb2_data = {
>>  	.label = "omap_usb2",
>>  	.flags = OMAP_USB2_HAS_START_SRP | OMAP_USB2_HAS_SET_VBUS,
>> +	.type = TYPE_USB2,
>>  };
>>  
>>  static const struct usb_phy_data omap5_usb2_data = {
>>  	.label = "omap5_usb2",
>>  	.flags = 0,
>> +	.type = TYPE_USB2,
>>  };
>>  
>>  static const struct usb_phy_data dra7x_usb2_data = {
>>  	.label = "dra7x_usb2",
>>  	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
>> +	.type = TYPE_USB2,
>>  };
>>  
>>  static const struct usb_phy_data dra7x_usb2_phy2_data = {
>>  	.label = "dra7x_usb2_phy2",
>>  	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
>> +	.type = TYPE_DRA7USB2,
>>  };
>>  
>>  static const struct usb_phy_data am437x_usb2_data = {
>>  	.label = "am437x_usb2",
>>  	.flags =  0,
>> +	.type = TYPE_AM437USB2,
>>  };
>>  
>>  static const struct of_device_id omap_usb2_id_table[] = {
>> @@ -223,6 +273,7 @@ static int omap_usb2_probe(struct platform_device *pdev)
>>  		return -ENOMEM;
>>  
>>  	phy->dev		= &pdev->dev;
>> +	phy->type		= phy_data->type;
>>  
>>  	phy->phy.dev		= phy->dev;
>>  	phy->phy.label		= phy_data->label;
>> @@ -237,20 +288,36 @@ static int omap_usb2_probe(struct platform_device *pdev)
>>  		phy->flags |= OMAP_USB2_CALIBRATE_FALSE_DISCONNECT;
>>  	}
>>  
>> -	control_node = of_parse_phandle(node, "ctrl-module", 0);
>> -	if (!control_node) {
>> -		dev_err(&pdev->dev, "Failed to get control device phandle\n");
>> -		return -EINVAL;
>> -	}
>> +	phy->syscon_phy_power = syscon_regmap_lookup_by_phandle(node,
>> +							"syscon-phy-power");
>> +	if (IS_ERR(phy->syscon_phy_power)) {
>> +		dev_info(&pdev->dev,
>> +			 "can't get syscon-phy-power, using control device\n");
>> +		phy->syscon_phy_power = NULL;
>> +
>> +		control_node = of_parse_phandle(node, "ctrl-module", 0);
>> +		if (!control_node) {
>> +			dev_err(&pdev->dev,
>> +				"Failed to get control device phandle\n");
>> +			return -EINVAL;
>> +		}
>>  
>> -	control_pdev = of_find_device_by_node(control_node);
>> -	if (!control_pdev) {
>> -		dev_err(&pdev->dev, "Failed to get control device\n");
>> -		return -EINVAL;
>> +		control_pdev = of_find_device_by_node(control_node);
>> +		if (!control_pdev) {
>> +			dev_err(&pdev->dev, "Failed to get control device\n");
>> +			return -EINVAL;
>> +		}
>> +		phy->control_dev = &control_pdev->dev;
>> +	} else {
>> +		if (of_property_read_u32_index(node,
>> +					       "syscon-phy-power", 1,
>> +					       &phy->power_reg)) {
>> +			dev_err(&pdev->dev,
>> +				"couldn't get power reg. offset\n");
>> +			return -EINVAL;
>> +		}
>>  	}
>>  
>> -	phy->control_dev = &control_pdev->dev;
>> -
>>  	otg->set_host		= omap_usb_set_host;
>>  	otg->set_peripheral	= omap_usb_set_peripheral;
>>  	if (phy_data->flags & OMAP_USB2_HAS_SET_VBUS)
>> diff --git a/include/linux/phy/omap_usb.h b/include/linux/phy/omap_usb.h
>> index dc2c541..de933ab 100644
>> --- a/include/linux/phy/omap_usb.h
>> +++ b/include/linux/phy/omap_usb.h
>> @@ -30,6 +30,12 @@ struct usb_dpll_params {
>>  	u32	mf;
>>  };
>>  
>> +enum omap_usb_phy_type {
>> +	TYPE_USB2,    /* USB2_PHY, power down in CONTROL_DEV_CONF */
>> +	TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */
>> +	TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */
>> +};
>> +
>>  struct omap_usb {
>>  	struct usb_phy		phy;
>>  	struct phy_companion	*comparator;
>> @@ -40,11 +46,15 @@ struct omap_usb {
>>  	struct clk		*wkupclk;
>>  	struct clk		*optclk;
>>  	u8			flags;
>> +	enum omap_usb_phy_type	type;
>> +	struct regmap		*syscon_phy_power; /* ctrl. reg. acces */
>> +	unsigned int		power_reg; /* power reg. index within syscon */
>>  };
>>  
>>  struct usb_phy_data {
>>  	const char *label;
>>  	u8 flags;
>> +	enum omap_usb_phy_type type;
>>  };
>>  
>>  /* Driver Flags */
>> @@ -52,6 +62,14 @@ struct usb_phy_data {
>>  #define OMAP_USB2_HAS_SET_VBUS (1 << 1)
>>  #define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT (1 << 2)
>>  
>> +#define OMAP_DEV_PHY_PD		BIT(0)
>> +#define OMAP_USB2_PHY_PD	BIT(28)
>> +
>> +#define AM437X_USB2_PHY_PD		BIT(0)
> 
> This PD bit can be set in usb_phy_data and used by
> a single block of code for all 3 phys.

yeah, that could be done.

Thanks
Kishon

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

* Re: [PATCH 07/17] usb: musb: omap2430: use *syscon* framework to write to mailbox register
@ 2015-06-24 13:06       ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 13:06 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: bcousson, balbi, rogerq, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

Hi Tony,

On Wednesday 24 June 2015 05:19 PM, Tony Lindgren wrote:
> * Kishon Vijay Abraham I <kishon@ti.com> [150623 05:02]:
>> Deprecate using phy-omap-control driver to write to the mailbox register
>> and start using *syscon* framework to do the same.
> 
> All this stuff needs to go to some generic syscon USB phy
> driver. Let's not start adding phy specific stuff to a USB
> driver.

Mailbox register is actually part of OMAP USB glue that should be written in
order to inform the usbmode to the MUSB core.

Thanks
Kishon

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

* Re: [PATCH 07/17] usb: musb: omap2430: use *syscon* framework to write to mailbox register
@ 2015-06-24 13:06       ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 13:06 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: bcousson-rdvid1DuHRBWk0Htik3J/w, balbi-l0cyMroinI0,
	rogerq-l0cyMroinI0, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0

Hi Tony,

On Wednesday 24 June 2015 05:19 PM, Tony Lindgren wrote:
> * Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org> [150623 05:02]:
>> Deprecate using phy-omap-control driver to write to the mailbox register
>> and start using *syscon* framework to do the same.
> 
> All this stuff needs to go to some generic syscon USB phy
> driver. Let's not start adding phy specific stuff to a USB
> driver.

Mailbox register is actually part of OMAP USB glue that should be written in
order to inform the usbmode to the MUSB core.

Thanks
Kishon
--
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] 150+ messages in thread

* [PATCH 07/17] usb: musb: omap2430: use *syscon* framework to write to mailbox register
@ 2015-06-24 13:06       ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 13:06 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Tony,

On Wednesday 24 June 2015 05:19 PM, Tony Lindgren wrote:
> * Kishon Vijay Abraham I <kishon@ti.com> [150623 05:02]:
>> Deprecate using phy-omap-control driver to write to the mailbox register
>> and start using *syscon* framework to do the same.
> 
> All this stuff needs to go to some generic syscon USB phy
> driver. Let's not start adding phy specific stuff to a USB
> driver.

Mailbox register is actually part of OMAP USB glue that should be written in
order to inform the usbmode to the MUSB core.

Thanks
Kishon

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

* Re: [PATCH 11/17] ARM: dts: dra7: Use "ti,dra7x-usb2-phy2" compatible string for USB2 PHY2
@ 2015-06-24 13:10       ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 13:10 UTC (permalink / raw)
  To: Roger Quadros
  Cc: bcousson, tony, balbi, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

Hi,

On Wednesday 24 June 2015 05:37 PM, Roger Quadros wrote:
> On Tue, 23 Jun 2015 17:28:56 +0530
> Kishon Vijay Abraham I <kishon@ti.com> wrote:
> 
>> The USB2 PHY2 has a different register map compared to USB2 PHY1
>> to power on/off the PHY. In order to handle it, use the new compatible
>> string "ti,dra7x-usb2-phy2" for the second instance of USB2 PHY.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> ---
>>  arch/arm/boot/dts/dra7.dtsi |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
>> index f69db70..a8ee829 100644
>> --- a/arch/arm/boot/dts/dra7.dtsi
>> +++ b/arch/arm/boot/dts/dra7.dtsi
>> @@ -1235,7 +1235,7 @@
>>  			};
>>  
>>  			usb2_phy2: phy@4a085000 {
>> -				compatible = "ti,omap-usb2";
>> +				compatible = "ti,dra7x-usb2-phy2", "ti,omap-usb2";
> 
> Why do you want to retain "ti,omap-usb2".
> It is not backward compatible with it right?

The newer dtbs will anyway have "ti,dra7x-usb2-phy2", so "ti,omap-usb2" was
kept just for legacy reasons.

Thanks
Kishon

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

* Re: [PATCH 11/17] ARM: dts: dra7: Use "ti,dra7x-usb2-phy2" compatible string for USB2 PHY2
@ 2015-06-24 13:10       ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 13:10 UTC (permalink / raw)
  To: Roger Quadros
  Cc: bcousson-rdvid1DuHRBWk0Htik3J/w, tony-4v6yS6AI5VpBDgjK7y7TUQ,
	balbi-l0cyMroinI0, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0

Hi,

On Wednesday 24 June 2015 05:37 PM, Roger Quadros wrote:
> On Tue, 23 Jun 2015 17:28:56 +0530
> Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org> wrote:
> 
>> The USB2 PHY2 has a different register map compared to USB2 PHY1
>> to power on/off the PHY. In order to handle it, use the new compatible
>> string "ti,dra7x-usb2-phy2" for the second instance of USB2 PHY.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
>> ---
>>  arch/arm/boot/dts/dra7.dtsi |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
>> index f69db70..a8ee829 100644
>> --- a/arch/arm/boot/dts/dra7.dtsi
>> +++ b/arch/arm/boot/dts/dra7.dtsi
>> @@ -1235,7 +1235,7 @@
>>  			};
>>  
>>  			usb2_phy2: phy@4a085000 {
>> -				compatible = "ti,omap-usb2";
>> +				compatible = "ti,dra7x-usb2-phy2", "ti,omap-usb2";
> 
> Why do you want to retain "ti,omap-usb2".
> It is not backward compatible with it right?

The newer dtbs will anyway have "ti,dra7x-usb2-phy2", so "ti,omap-usb2" was
kept just for legacy reasons.

Thanks
Kishon
--
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] 150+ messages in thread

* [PATCH 11/17] ARM: dts: dra7: Use "ti, dra7x-usb2-phy2" compatible string for USB2 PHY2
@ 2015-06-24 13:10       ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 13:10 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Wednesday 24 June 2015 05:37 PM, Roger Quadros wrote:
> On Tue, 23 Jun 2015 17:28:56 +0530
> Kishon Vijay Abraham I <kishon@ti.com> wrote:
> 
>> The USB2 PHY2 has a different register map compared to USB2 PHY1
>> to power on/off the PHY. In order to handle it, use the new compatible
>> string "ti,dra7x-usb2-phy2" for the second instance of USB2 PHY.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> ---
>>  arch/arm/boot/dts/dra7.dtsi |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
>> index f69db70..a8ee829 100644
>> --- a/arch/arm/boot/dts/dra7.dtsi
>> +++ b/arch/arm/boot/dts/dra7.dtsi
>> @@ -1235,7 +1235,7 @@
>>  			};
>>  
>>  			usb2_phy2: phy at 4a085000 {
>> -				compatible = "ti,omap-usb2";
>> +				compatible = "ti,dra7x-usb2-phy2", "ti,omap-usb2";
> 
> Why do you want to retain "ti,omap-usb2".
> It is not backward compatible with it right?

The newer dtbs will anyway have "ti,dra7x-usb2-phy2", so "ti,omap-usb2" was
kept just for legacy reasons.

Thanks
Kishon

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

* Re: [PATCH 03/17] phy: ti-pipe3: use *syscon* framework to set PCS value of the PHY
  2015-06-24 10:34     ` Roger Quadros
  (?)
@ 2015-06-24 13:16       ` Kishon Vijay Abraham I
  -1 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 13:16 UTC (permalink / raw)
  To: Roger Quadros
  Cc: bcousson, tony, balbi, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

Hi,

On Wednesday 24 June 2015 04:04 PM, Roger Quadros wrote:
> On Tue, 23 Jun 2015 17:28:48 +0530
> Kishon Vijay Abraham I <kishon@ti.com> wrote:
> 
>> Deprecate using phy-omap-control driver to set PCS value of the PHY
>> and start using *syscon* framework to do the same.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> ---
>>   Documentation/devicetree/bindings/phy/ti-phy.txt |    2 ++
>>   drivers/phy/phy-ti-pipe3.c                       |   32 +++++++++++++++++++++-
>>   2 files changed, 33 insertions(+), 1 deletion(-)
>>
>> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
>> index d3ad3bf..52c7a92 100644
>> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
>> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
>> @@ -83,6 +83,8 @@ Optional properties:
>>    - syscon-pllreset: Handle to system control region that contains the
>>      CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0
>>      register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.
>> + - syscon-pcs : phandle/offset pair. Phandle to the system control module and the
>> +   register offset to write the PCS delay value.
> 
> What is PCS?

IIRC physical coding subsystem.
> Is this valid only for PCIe? If yes we could mention it here.

This is introduced specifically for PCIe. But there are other PCS registers
with a different register map altogether for USB. I'm not sure if we will ever
have to do those settings.

Thanks
Kishon

> 
>>   
>>   Deprecated properties:
>>    - ctrl-module : phandle of the control module used by PHY driver to power on
>> diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
>> index 78bac00..e2f9ad7 100644
>> --- a/drivers/phy/phy-ti-pipe3.c
>> +++ b/drivers/phy/phy-ti-pipe3.c
>> @@ -65,6 +65,9 @@
>>   #define PIPE3_PHY_TX_RX_POWERON		0x3
>>   #define PIPE3_PHY_TX_RX_POWEROFF	0x0
>>   
>> +#define PCIE_PCS_MASK			0xFF0000
>> +#define PCIE_PCS_DELAY_COUNT_SHIFT	0x10
>> +
>>   /*
>>    * This is an Empirical value that works, need to confirm the actual
>>    * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status
>> @@ -96,9 +99,11 @@ struct ti_pipe3 {
>>   	struct clk		*div_clk;
>>   	struct pipe3_dpll_map	*dpll_map;
>>   	struct regmap		*phy_power_syscon; /* ctrl. reg. acces */
>> +	struct regmap		*pcs_syscon; /* ctrl. reg. acces */
>>   	struct regmap		*dpll_reset_syscon; /* ctrl. reg. acces */
>>   	unsigned int		dpll_reset_reg; /* reg. index within syscon */
>>   	unsigned int		power_reg; /* power reg. index within syscon */
>> +	unsigned int		pcie_pcs_reg; /* pcs reg. index in syscon */
>>   	bool			sata_refclk_enabled;
>>   };
>>   
>> @@ -271,7 +276,16 @@ static int ti_pipe3_init(struct phy *x)
>>   	 * 18-1804.
>>   	 */
>>   	if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-pcie")) {
>> -		omap_control_pcie_pcs(phy->control_dev, 0x96);
>> +		if (phy->pcs_syscon) {
>> +			val = 0x96 << OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT;
>> +			ret = regmap_update_bits(phy->pcs_syscon,
>> +						 phy->pcie_pcs_reg,
>> +						 PCIE_PCS_MASK, val);
>> +			if (ret < 0)
>> +				return ret;
>> +		} else {
>> +			omap_control_pcie_pcs(phy->control_dev, 0x96);
>> +		}
>>   		return 0;
>>   	}
>>   
>> @@ -455,6 +469,22 @@ static int ti_pipe3_probe(struct platform_device *pdev)
>>   			dev_err(&pdev->dev, "unable to get div-clk\n");
>>   			return PTR_ERR(phy->div_clk);
>>   		}
>> +
>> +		phy->pcs_syscon = syscon_regmap_lookup_by_phandle(node,
>> +								  "syscon-pcs");
>> +		if (IS_ERR(phy->pcs_syscon)) {
>> +			dev_dbg(&pdev->dev,
>> +				 "can't get syscon-pcs, using omap control\n");
>> +			phy->pcs_syscon = NULL;
>> +		} else {
>> +			if (of_property_read_u32_index(node,
>> +						       "syscon-pcs", 1,
>> +						       &phy->pcie_pcs_reg)) {
>> +				dev_err(&pdev->dev,
>> +					"couldn't get pcie pcs reg. offset\n");
>> +				return -EINVAL;
>> +			}
>> +		}
>>   	} else {
>>   		phy->div_clk = ERR_PTR(-ENODEV);
>>   	}
>> -- 
>> 1.7.9.5
>>
> 
> Other than that,
> 
> Acked-by: Roger Quadros <rogerq@ti.com>
> 
> cheers,
> -roger
> 

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

* Re: [PATCH 03/17] phy: ti-pipe3: use *syscon* framework to set PCS value of the PHY
@ 2015-06-24 13:16       ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 13:16 UTC (permalink / raw)
  To: Roger Quadros
  Cc: bcousson, tony, balbi, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

Hi,

On Wednesday 24 June 2015 04:04 PM, Roger Quadros wrote:
> On Tue, 23 Jun 2015 17:28:48 +0530
> Kishon Vijay Abraham I <kishon@ti.com> wrote:
> 
>> Deprecate using phy-omap-control driver to set PCS value of the PHY
>> and start using *syscon* framework to do the same.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> ---
>>   Documentation/devicetree/bindings/phy/ti-phy.txt |    2 ++
>>   drivers/phy/phy-ti-pipe3.c                       |   32 +++++++++++++++++++++-
>>   2 files changed, 33 insertions(+), 1 deletion(-)
>>
>> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
>> index d3ad3bf..52c7a92 100644
>> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
>> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
>> @@ -83,6 +83,8 @@ Optional properties:
>>    - syscon-pllreset: Handle to system control region that contains the
>>      CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0
>>      register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.
>> + - syscon-pcs : phandle/offset pair. Phandle to the system control module and the
>> +   register offset to write the PCS delay value.
> 
> What is PCS?

IIRC physical coding subsystem.
> Is this valid only for PCIe? If yes we could mention it here.

This is introduced specifically for PCIe. But there are other PCS registers
with a different register map altogether for USB. I'm not sure if we will ever
have to do those settings.

Thanks
Kishon

> 
>>   
>>   Deprecated properties:
>>    - ctrl-module : phandle of the control module used by PHY driver to power on
>> diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
>> index 78bac00..e2f9ad7 100644
>> --- a/drivers/phy/phy-ti-pipe3.c
>> +++ b/drivers/phy/phy-ti-pipe3.c
>> @@ -65,6 +65,9 @@
>>   #define PIPE3_PHY_TX_RX_POWERON		0x3
>>   #define PIPE3_PHY_TX_RX_POWEROFF	0x0
>>   
>> +#define PCIE_PCS_MASK			0xFF0000
>> +#define PCIE_PCS_DELAY_COUNT_SHIFT	0x10
>> +
>>   /*
>>    * This is an Empirical value that works, need to confirm the actual
>>    * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status
>> @@ -96,9 +99,11 @@ struct ti_pipe3 {
>>   	struct clk		*div_clk;
>>   	struct pipe3_dpll_map	*dpll_map;
>>   	struct regmap		*phy_power_syscon; /* ctrl. reg. acces */
>> +	struct regmap		*pcs_syscon; /* ctrl. reg. acces */
>>   	struct regmap		*dpll_reset_syscon; /* ctrl. reg. acces */
>>   	unsigned int		dpll_reset_reg; /* reg. index within syscon */
>>   	unsigned int		power_reg; /* power reg. index within syscon */
>> +	unsigned int		pcie_pcs_reg; /* pcs reg. index in syscon */
>>   	bool			sata_refclk_enabled;
>>   };
>>   
>> @@ -271,7 +276,16 @@ static int ti_pipe3_init(struct phy *x)
>>   	 * 18-1804.
>>   	 */
>>   	if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-pcie")) {
>> -		omap_control_pcie_pcs(phy->control_dev, 0x96);
>> +		if (phy->pcs_syscon) {
>> +			val = 0x96 << OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT;
>> +			ret = regmap_update_bits(phy->pcs_syscon,
>> +						 phy->pcie_pcs_reg,
>> +						 PCIE_PCS_MASK, val);
>> +			if (ret < 0)
>> +				return ret;
>> +		} else {
>> +			omap_control_pcie_pcs(phy->control_dev, 0x96);
>> +		}
>>   		return 0;
>>   	}
>>   
>> @@ -455,6 +469,22 @@ static int ti_pipe3_probe(struct platform_device *pdev)
>>   			dev_err(&pdev->dev, "unable to get div-clk\n");
>>   			return PTR_ERR(phy->div_clk);
>>   		}
>> +
>> +		phy->pcs_syscon = syscon_regmap_lookup_by_phandle(node,
>> +								  "syscon-pcs");
>> +		if (IS_ERR(phy->pcs_syscon)) {
>> +			dev_dbg(&pdev->dev,
>> +				 "can't get syscon-pcs, using omap control\n");
>> +			phy->pcs_syscon = NULL;
>> +		} else {
>> +			if (of_property_read_u32_index(node,
>> +						       "syscon-pcs", 1,
>> +						       &phy->pcie_pcs_reg)) {
>> +				dev_err(&pdev->dev,
>> +					"couldn't get pcie pcs reg. offset\n");
>> +				return -EINVAL;
>> +			}
>> +		}
>>   	} else {
>>   		phy->div_clk = ERR_PTR(-ENODEV);
>>   	}
>> -- 
>> 1.7.9.5
>>
> 
> Other than that,
> 
> Acked-by: Roger Quadros <rogerq@ti.com>
> 
> cheers,
> -roger
> 

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

* [PATCH 03/17] phy: ti-pipe3: use *syscon* framework to set PCS value of the PHY
@ 2015-06-24 13:16       ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 13:16 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Wednesday 24 June 2015 04:04 PM, Roger Quadros wrote:
> On Tue, 23 Jun 2015 17:28:48 +0530
> Kishon Vijay Abraham I <kishon@ti.com> wrote:
> 
>> Deprecate using phy-omap-control driver to set PCS value of the PHY
>> and start using *syscon* framework to do the same.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> ---
>>   Documentation/devicetree/bindings/phy/ti-phy.txt |    2 ++
>>   drivers/phy/phy-ti-pipe3.c                       |   32 +++++++++++++++++++++-
>>   2 files changed, 33 insertions(+), 1 deletion(-)
>>
>> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
>> index d3ad3bf..52c7a92 100644
>> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
>> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
>> @@ -83,6 +83,8 @@ Optional properties:
>>    - syscon-pllreset: Handle to system control region that contains the
>>      CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0
>>      register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.
>> + - syscon-pcs : phandle/offset pair. Phandle to the system control module and the
>> +   register offset to write the PCS delay value.
> 
> What is PCS?

IIRC physical coding subsystem.
> Is this valid only for PCIe? If yes we could mention it here.

This is introduced specifically for PCIe. But there are other PCS registers
with a different register map altogether for USB. I'm not sure if we will ever
have to do those settings.

Thanks
Kishon

> 
>>   
>>   Deprecated properties:
>>    - ctrl-module : phandle of the control module used by PHY driver to power on
>> diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
>> index 78bac00..e2f9ad7 100644
>> --- a/drivers/phy/phy-ti-pipe3.c
>> +++ b/drivers/phy/phy-ti-pipe3.c
>> @@ -65,6 +65,9 @@
>>   #define PIPE3_PHY_TX_RX_POWERON		0x3
>>   #define PIPE3_PHY_TX_RX_POWEROFF	0x0
>>   
>> +#define PCIE_PCS_MASK			0xFF0000
>> +#define PCIE_PCS_DELAY_COUNT_SHIFT	0x10
>> +
>>   /*
>>    * This is an Empirical value that works, need to confirm the actual
>>    * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status
>> @@ -96,9 +99,11 @@ struct ti_pipe3 {
>>   	struct clk		*div_clk;
>>   	struct pipe3_dpll_map	*dpll_map;
>>   	struct regmap		*phy_power_syscon; /* ctrl. reg. acces */
>> +	struct regmap		*pcs_syscon; /* ctrl. reg. acces */
>>   	struct regmap		*dpll_reset_syscon; /* ctrl. reg. acces */
>>   	unsigned int		dpll_reset_reg; /* reg. index within syscon */
>>   	unsigned int		power_reg; /* power reg. index within syscon */
>> +	unsigned int		pcie_pcs_reg; /* pcs reg. index in syscon */
>>   	bool			sata_refclk_enabled;
>>   };
>>   
>> @@ -271,7 +276,16 @@ static int ti_pipe3_init(struct phy *x)
>>   	 * 18-1804.
>>   	 */
>>   	if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-pcie")) {
>> -		omap_control_pcie_pcs(phy->control_dev, 0x96);
>> +		if (phy->pcs_syscon) {
>> +			val = 0x96 << OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT;
>> +			ret = regmap_update_bits(phy->pcs_syscon,
>> +						 phy->pcie_pcs_reg,
>> +						 PCIE_PCS_MASK, val);
>> +			if (ret < 0)
>> +				return ret;
>> +		} else {
>> +			omap_control_pcie_pcs(phy->control_dev, 0x96);
>> +		}
>>   		return 0;
>>   	}
>>   
>> @@ -455,6 +469,22 @@ static int ti_pipe3_probe(struct platform_device *pdev)
>>   			dev_err(&pdev->dev, "unable to get div-clk\n");
>>   			return PTR_ERR(phy->div_clk);
>>   		}
>> +
>> +		phy->pcs_syscon = syscon_regmap_lookup_by_phandle(node,
>> +								  "syscon-pcs");
>> +		if (IS_ERR(phy->pcs_syscon)) {
>> +			dev_dbg(&pdev->dev,
>> +				 "can't get syscon-pcs, using omap control\n");
>> +			phy->pcs_syscon = NULL;
>> +		} else {
>> +			if (of_property_read_u32_index(node,
>> +						       "syscon-pcs", 1,
>> +						       &phy->pcie_pcs_reg)) {
>> +				dev_err(&pdev->dev,
>> +					"couldn't get pcie pcs reg. offset\n");
>> +				return -EINVAL;
>> +			}
>> +		}
>>   	} else {
>>   		phy->div_clk = ERR_PTR(-ENODEV);
>>   	}
>> -- 
>> 1.7.9.5
>>
> 
> Other than that,
> 
> Acked-by: Roger Quadros <rogerq@ti.com>
> 
> cheers,
> -roger
> 

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

* Re: [PATCH 05/17] phy: omap-usb2: Add a new compatible string for USB2 PHY2
@ 2015-06-24 13:21       ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 13:21 UTC (permalink / raw)
  To: Roger Quadros
  Cc: bcousson, tony, balbi, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

Hi,

On Wednesday 24 June 2015 04:33 PM, Roger Quadros wrote:
> On Tue, 23 Jun 2015 17:28:50 +0530
> Kishon Vijay Abraham I <kishon@ti.com> wrote:
> 
>> The USB2 PHY2 has a different register map compared to USB2 PHY1
>> to power on/off the PHY. In order to handle it, add a new
>> "compatible" string.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> ---
>>  Documentation/devicetree/bindings/phy/ti-phy.txt |    2 ++
>>  drivers/phy/phy-omap-usb2.c                      |    9 +++++++++
>>  2 files changed, 11 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
>> index 52c7a92..b9101b9 100644
>> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
>> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
>> @@ -31,6 +31,8 @@ OMAP USB2 PHY
>>  
>>  Required properties:
>>   - compatible: Should be "ti,omap-usb2"
>> +	       Should be "ti,dra7x-usb2-phy2" for the 2nd instance of USB2 PHY
>> +			in DRA7x
>>   - reg : Address and length of the register set for the device.
>>   - #phy-cells: determine the number of cells that should be given in the
>>     phandle while referencing this phy.
>> diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
>> index b5c266a..2f7220f 100644
>> --- a/drivers/phy/phy-omap-usb2.c
>> +++ b/drivers/phy/phy-omap-usb2.c
>> @@ -159,6 +159,11 @@ static const struct usb_phy_data dra7x_usb2_data = {
>>  	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
>>  };
>>  
>> +static const struct usb_phy_data dra7x_usb2_phy2_data = {
>> +	.label = "dra7x_usb2_phy2",
>> +	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
> 
> Isn't it better to define the register map in usb_phy_data
> so that you don't need to check for compatible flag everytime?
> 

We could may be define it for DRA7x USB2 PHYs but for am437x-usb2, it might not
be good.

Thanks
Kishon

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

* Re: [PATCH 05/17] phy: omap-usb2: Add a new compatible string for USB2 PHY2
@ 2015-06-24 13:21       ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 13:21 UTC (permalink / raw)
  To: Roger Quadros
  Cc: bcousson-rdvid1DuHRBWk0Htik3J/w, tony-4v6yS6AI5VpBDgjK7y7TUQ,
	balbi-l0cyMroinI0, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0

Hi,

On Wednesday 24 June 2015 04:33 PM, Roger Quadros wrote:
> On Tue, 23 Jun 2015 17:28:50 +0530
> Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org> wrote:
> 
>> The USB2 PHY2 has a different register map compared to USB2 PHY1
>> to power on/off the PHY. In order to handle it, add a new
>> "compatible" string.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
>> ---
>>  Documentation/devicetree/bindings/phy/ti-phy.txt |    2 ++
>>  drivers/phy/phy-omap-usb2.c                      |    9 +++++++++
>>  2 files changed, 11 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
>> index 52c7a92..b9101b9 100644
>> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
>> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
>> @@ -31,6 +31,8 @@ OMAP USB2 PHY
>>  
>>  Required properties:
>>   - compatible: Should be "ti,omap-usb2"
>> +	       Should be "ti,dra7x-usb2-phy2" for the 2nd instance of USB2 PHY
>> +			in DRA7x
>>   - reg : Address and length of the register set for the device.
>>   - #phy-cells: determine the number of cells that should be given in the
>>     phandle while referencing this phy.
>> diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
>> index b5c266a..2f7220f 100644
>> --- a/drivers/phy/phy-omap-usb2.c
>> +++ b/drivers/phy/phy-omap-usb2.c
>> @@ -159,6 +159,11 @@ static const struct usb_phy_data dra7x_usb2_data = {
>>  	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
>>  };
>>  
>> +static const struct usb_phy_data dra7x_usb2_phy2_data = {
>> +	.label = "dra7x_usb2_phy2",
>> +	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
> 
> Isn't it better to define the register map in usb_phy_data
> so that you don't need to check for compatible flag everytime?
> 

We could may be define it for DRA7x USB2 PHYs but for am437x-usb2, it might not
be good.

Thanks
Kishon
--
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	[flat|nested] 150+ messages in thread

* [PATCH 05/17] phy: omap-usb2: Add a new compatible string for USB2 PHY2
@ 2015-06-24 13:21       ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 13:21 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Wednesday 24 June 2015 04:33 PM, Roger Quadros wrote:
> On Tue, 23 Jun 2015 17:28:50 +0530
> Kishon Vijay Abraham I <kishon@ti.com> wrote:
> 
>> The USB2 PHY2 has a different register map compared to USB2 PHY1
>> to power on/off the PHY. In order to handle it, add a new
>> "compatible" string.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> ---
>>  Documentation/devicetree/bindings/phy/ti-phy.txt |    2 ++
>>  drivers/phy/phy-omap-usb2.c                      |    9 +++++++++
>>  2 files changed, 11 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
>> index 52c7a92..b9101b9 100644
>> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
>> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
>> @@ -31,6 +31,8 @@ OMAP USB2 PHY
>>  
>>  Required properties:
>>   - compatible: Should be "ti,omap-usb2"
>> +	       Should be "ti,dra7x-usb2-phy2" for the 2nd instance of USB2 PHY
>> +			in DRA7x
>>   - reg : Address and length of the register set for the device.
>>   - #phy-cells: determine the number of cells that should be given in the
>>     phandle while referencing this phy.
>> diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
>> index b5c266a..2f7220f 100644
>> --- a/drivers/phy/phy-omap-usb2.c
>> +++ b/drivers/phy/phy-omap-usb2.c
>> @@ -159,6 +159,11 @@ static const struct usb_phy_data dra7x_usb2_data = {
>>  	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
>>  };
>>  
>> +static const struct usb_phy_data dra7x_usb2_phy2_data = {
>> +	.label = "dra7x_usb2_phy2",
>> +	.flags = OMAP_USB2_CALIBRATE_FALSE_DISCONNECT,
> 
> Isn't it better to define the register map in usb_phy_data
> so that you don't need to check for compatible flag everytime?
> 

We could may be define it for DRA7x USB2 PHYs but for am437x-usb2, it might not
be good.

Thanks
Kishon

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

* Re: [PATCH 07/17] usb: musb: omap2430: use *syscon* framework to write to mailbox register
  2015-06-24 11:39     ` Roger Quadros
  (?)
@ 2015-06-24 13:21       ` Kishon Vijay Abraham I
  -1 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 13:21 UTC (permalink / raw)
  To: Roger Quadros
  Cc: bcousson, tony, balbi, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

Hi,

On Wednesday 24 June 2015 05:09 PM, Roger Quadros wrote:
> On Tue, 23 Jun 2015 17:28:52 +0530
> Kishon Vijay Abraham I <kishon@ti.com> wrote:
> 
>> Deprecate using phy-omap-control driver to write to the mailbox register
>> and start using *syscon* framework to do the same.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> ---
>>  Documentation/devicetree/bindings/usb/omap-usb.txt |    7 +-
>>  drivers/usb/musb/omap2430.c                        |  118 ++++++++++++++++----
>>  2 files changed, 102 insertions(+), 23 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt
>> index 38d9bb8..c001306 100644
>> --- a/Documentation/devicetree/bindings/usb/omap-usb.txt
>> +++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
>> @@ -20,10 +20,15 @@ OMAP MUSB GLUE
>>   - phy-names : the names of the PHY corresponding to the PHYs present in the
>>     *phy* phandle.
>>  
>> -Optional properties:
>> +Optional Properties:
>> +Deprecated properties:
>>   - ctrl-module : phandle of the control module this glue uses to write to
>>     mailbox
>>  
>> +Recommended properies:
>> + - syscon-otghs : phandle/offset pair. Phandle to the system control module and the
>> +   register offset of the mailbox.
>> +
>>  SOC specific device node entry
>>  usb_otg_hs: usb_otg_hs@4a0ab000 {
>>  	compatible = "ti,omap4-musb";
>> diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
>> index cc752d8..bcd6d1e 100644
>> --- a/drivers/usb/musb/omap2430.c
>> +++ b/drivers/usb/musb/omap2430.c
>> @@ -39,16 +39,27 @@
>>  #include <linux/usb/musb-omap.h>
>>  #include <linux/phy/omap_control_phy.h>
>>  #include <linux/of_platform.h>
>> +#include <linux/regmap.h>
>> +#include <linux/mfd/syscon.h>
>>  
>>  #include "musb_core.h"
>>  #include "omap2430.h"
>>  
>> +#define OMAP2430_MUSB_MODE_MASK	0x1f
>> +#define OMAP2430_MUSB_AVALID	(0x1 << 0)
>> +#define OMAP2430_MUSB_BVALID	(0x1 << 1)
>> +#define OMAP2430_MUSB_VBUSVALID	(0x1 << 2)
>> +#define OMAP2430_MUSB_SESSEND	(0x1 << 3)
>> +#define OMAP2430_MUSB_IDDIG	(0x1 << 4)
>> +
>>  struct omap2430_glue {
>>  	struct device		*dev;
>>  	struct platform_device	*musb;
>>  	enum omap_musb_vbus_id_status status;
>>  	struct work_struct	omap_musb_mailbox_work;
>>  	struct device		*control_otghs;
>> +	struct regmap		*syscon_otghs; /* ctrl. reg. acces */
>> +	unsigned int            otghs_reg; /* otghs reg. index within syscon */
>>  };
>>  #define glue_to_musb(g)		platform_get_drvdata(g->musb)
>>  
>> @@ -253,6 +264,47 @@ void omap_musb_mailbox(enum omap_musb_vbus_id_status status)
>>  }
>>  EXPORT_SYMBOL_GPL(omap_musb_mailbox);
>>  
>> +static void omap2430_musb_set_usbmode(struct omap2430_glue *glue,
>> +				      enum omap_control_usb_mode mode)
>> +{
>> +	u32 val;
>> +	int ret;
>> +
>> +	if (glue->syscon_otghs) {
>> +		switch (mode) {
>> +		case USB_MODE_HOST:
>> +			val = OMAP2430_MUSB_AVALID | OMAP2430_MUSB_VBUSVALID;
>> +			break;
>> +
>> +		case USB_MODE_DEVICE:
>> +			val = OMAP2430_MUSB_IDDIG | OMAP2430_MUSB_AVALID |
>> +				OMAP2430_MUSB_VBUSVALID;
>> +			break;
>> +
>> +		case USB_MODE_DISCONNECT:
>> +			val = OMAP2430_MUSB_IDDIG | OMAP2430_MUSB_SESSEND;
>> +			break;
>> +
>> +		default:
>> +			dev_dbg(glue->dev, "Invalid mode\n");
>> +			goto err_regmap_update;
>> +		}
>> +
>> +		ret = regmap_update_bits(glue->syscon_otghs,
>> +					 glue->otghs_reg,
>> +					 OMAP2430_MUSB_MODE_MASK, val);
>> +		if (ret < 0)
>> +			goto err_regmap_update;
>> +	} else {
>> +		omap_control_usb_set_mode(glue->control_otghs, mode);
>> +	}
>> +
>> +	return;
>> +
>> +err_regmap_update:
>> +	dev_err(glue->dev, "Failed to set mode to %d\n", mode);
>> +}
>> +
>>  static void omap_musb_set_mailbox(struct omap2430_glue *glue)
>>  {
>>  	struct musb *musb = glue_to_musb(glue);
>> @@ -270,8 +322,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
>>  		musb->xceiv->last_event = USB_EVENT_ID;
>>  		if (musb->gadget_driver) {
>>  			pm_runtime_get_sync(dev);
>> -			omap_control_usb_set_mode(glue->control_otghs,
>> -				USB_MODE_HOST);
>> +			omap2430_musb_set_usbmode(glue, USB_MODE_HOST);
>>  			omap2430_musb_set_vbus(musb, 1);
>>  		}
>>  		break;
>> @@ -284,7 +335,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
>>  		musb->xceiv->last_event = USB_EVENT_VBUS;
>>  		if (musb->gadget_driver)
>>  			pm_runtime_get_sync(dev);
>> -		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE);
>> +		omap2430_musb_set_usbmode(glue, USB_MODE_DEVICE);
>>  		break;
>>  
>>  	case OMAP_MUSB_ID_FLOAT:
>> @@ -301,8 +352,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
>>  		if (data->interface_type == MUSB_INTERFACE_UTMI)
>>  			otg_set_vbus(musb->xceiv->otg, 0);
>>  
>> -		omap_control_usb_set_mode(glue->control_otghs,
>> -			USB_MODE_DISCONNECT);
>> +		omap2430_musb_set_usbmode(glue, USB_MODE_DISCONNECT);
>>  		break;
>>  	default:
>>  		dev_dbg(dev, "ID float\n");
>> @@ -444,7 +494,7 @@ static void omap2430_musb_enable(struct musb *musb)
>>  	switch (glue->status) {
>>  
>>  	case OMAP_MUSB_ID_GROUND:
>> -		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_HOST);
>> +		omap2430_musb_set_usbmode(glue, USB_MODE_HOST);
>>  		if (data->interface_type != MUSB_INTERFACE_UTMI)
>>  			break;
>>  		devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
>> @@ -463,7 +513,7 @@ static void omap2430_musb_enable(struct musb *musb)
>>  		break;
>>  
>>  	case OMAP_MUSB_VBUS_VALID:
>> -		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE);
>> +		omap2430_musb_set_usbmode(glue, USB_MODE_DEVICE);
>>  		break;
>>  
>>  	default:
>> @@ -477,8 +527,7 @@ static void omap2430_musb_disable(struct musb *musb)
>>  	struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
>>  
>>  	if (glue->status != OMAP_MUSB_UNKNOWN)
>> -		omap_control_usb_set_mode(glue->control_otghs,
>> -			USB_MODE_DISCONNECT);
>> +		omap2430_musb_set_usbmode(glue, USB_MODE_DISCONNECT);
>>  }
>>  
>>  static int omap2430_musb_exit(struct musb *musb)
>> @@ -507,6 +556,40 @@ static const struct musb_platform_ops omap2430_ops = {
>>  
>>  static u64 omap2430_dmamask = DMA_BIT_MASK(32);
>>  
>> +static int omap2430_get_control(struct omap2430_glue *glue,
>> +				struct device_node *np)
>> +{
>> +	struct device_node *control_node;
>> +	struct platform_device *control_pdev;
>> +
>> +	glue->syscon_otghs = syscon_regmap_lookup_by_phandle(np,
>> +							     "syscon-otghs");
>> +	if (IS_ERR(glue->syscon_otghs)) {
>> +		dev_info(glue->dev, "can't get syscon, using control device\n");
> 
> dev_dbg().

Alright.

Thanks
Kishon

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

* Re: [PATCH 07/17] usb: musb: omap2430: use *syscon* framework to write to mailbox register
@ 2015-06-24 13:21       ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 13:21 UTC (permalink / raw)
  To: Roger Quadros
  Cc: bcousson, tony, balbi, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

Hi,

On Wednesday 24 June 2015 05:09 PM, Roger Quadros wrote:
> On Tue, 23 Jun 2015 17:28:52 +0530
> Kishon Vijay Abraham I <kishon@ti.com> wrote:
> 
>> Deprecate using phy-omap-control driver to write to the mailbox register
>> and start using *syscon* framework to do the same.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> ---
>>  Documentation/devicetree/bindings/usb/omap-usb.txt |    7 +-
>>  drivers/usb/musb/omap2430.c                        |  118 ++++++++++++++++----
>>  2 files changed, 102 insertions(+), 23 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt
>> index 38d9bb8..c001306 100644
>> --- a/Documentation/devicetree/bindings/usb/omap-usb.txt
>> +++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
>> @@ -20,10 +20,15 @@ OMAP MUSB GLUE
>>   - phy-names : the names of the PHY corresponding to the PHYs present in the
>>     *phy* phandle.
>>  
>> -Optional properties:
>> +Optional Properties:
>> +Deprecated properties:
>>   - ctrl-module : phandle of the control module this glue uses to write to
>>     mailbox
>>  
>> +Recommended properies:
>> + - syscon-otghs : phandle/offset pair. Phandle to the system control module and the
>> +   register offset of the mailbox.
>> +
>>  SOC specific device node entry
>>  usb_otg_hs: usb_otg_hs@4a0ab000 {
>>  	compatible = "ti,omap4-musb";
>> diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
>> index cc752d8..bcd6d1e 100644
>> --- a/drivers/usb/musb/omap2430.c
>> +++ b/drivers/usb/musb/omap2430.c
>> @@ -39,16 +39,27 @@
>>  #include <linux/usb/musb-omap.h>
>>  #include <linux/phy/omap_control_phy.h>
>>  #include <linux/of_platform.h>
>> +#include <linux/regmap.h>
>> +#include <linux/mfd/syscon.h>
>>  
>>  #include "musb_core.h"
>>  #include "omap2430.h"
>>  
>> +#define OMAP2430_MUSB_MODE_MASK	0x1f
>> +#define OMAP2430_MUSB_AVALID	(0x1 << 0)
>> +#define OMAP2430_MUSB_BVALID	(0x1 << 1)
>> +#define OMAP2430_MUSB_VBUSVALID	(0x1 << 2)
>> +#define OMAP2430_MUSB_SESSEND	(0x1 << 3)
>> +#define OMAP2430_MUSB_IDDIG	(0x1 << 4)
>> +
>>  struct omap2430_glue {
>>  	struct device		*dev;
>>  	struct platform_device	*musb;
>>  	enum omap_musb_vbus_id_status status;
>>  	struct work_struct	omap_musb_mailbox_work;
>>  	struct device		*control_otghs;
>> +	struct regmap		*syscon_otghs; /* ctrl. reg. acces */
>> +	unsigned int            otghs_reg; /* otghs reg. index within syscon */
>>  };
>>  #define glue_to_musb(g)		platform_get_drvdata(g->musb)
>>  
>> @@ -253,6 +264,47 @@ void omap_musb_mailbox(enum omap_musb_vbus_id_status status)
>>  }
>>  EXPORT_SYMBOL_GPL(omap_musb_mailbox);
>>  
>> +static void omap2430_musb_set_usbmode(struct omap2430_glue *glue,
>> +				      enum omap_control_usb_mode mode)
>> +{
>> +	u32 val;
>> +	int ret;
>> +
>> +	if (glue->syscon_otghs) {
>> +		switch (mode) {
>> +		case USB_MODE_HOST:
>> +			val = OMAP2430_MUSB_AVALID | OMAP2430_MUSB_VBUSVALID;
>> +			break;
>> +
>> +		case USB_MODE_DEVICE:
>> +			val = OMAP2430_MUSB_IDDIG | OMAP2430_MUSB_AVALID |
>> +				OMAP2430_MUSB_VBUSVALID;
>> +			break;
>> +
>> +		case USB_MODE_DISCONNECT:
>> +			val = OMAP2430_MUSB_IDDIG | OMAP2430_MUSB_SESSEND;
>> +			break;
>> +
>> +		default:
>> +			dev_dbg(glue->dev, "Invalid mode\n");
>> +			goto err_regmap_update;
>> +		}
>> +
>> +		ret = regmap_update_bits(glue->syscon_otghs,
>> +					 glue->otghs_reg,
>> +					 OMAP2430_MUSB_MODE_MASK, val);
>> +		if (ret < 0)
>> +			goto err_regmap_update;
>> +	} else {
>> +		omap_control_usb_set_mode(glue->control_otghs, mode);
>> +	}
>> +
>> +	return;
>> +
>> +err_regmap_update:
>> +	dev_err(glue->dev, "Failed to set mode to %d\n", mode);
>> +}
>> +
>>  static void omap_musb_set_mailbox(struct omap2430_glue *glue)
>>  {
>>  	struct musb *musb = glue_to_musb(glue);
>> @@ -270,8 +322,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
>>  		musb->xceiv->last_event = USB_EVENT_ID;
>>  		if (musb->gadget_driver) {
>>  			pm_runtime_get_sync(dev);
>> -			omap_control_usb_set_mode(glue->control_otghs,
>> -				USB_MODE_HOST);
>> +			omap2430_musb_set_usbmode(glue, USB_MODE_HOST);
>>  			omap2430_musb_set_vbus(musb, 1);
>>  		}
>>  		break;
>> @@ -284,7 +335,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
>>  		musb->xceiv->last_event = USB_EVENT_VBUS;
>>  		if (musb->gadget_driver)
>>  			pm_runtime_get_sync(dev);
>> -		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE);
>> +		omap2430_musb_set_usbmode(glue, USB_MODE_DEVICE);
>>  		break;
>>  
>>  	case OMAP_MUSB_ID_FLOAT:
>> @@ -301,8 +352,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
>>  		if (data->interface_type == MUSB_INTERFACE_UTMI)
>>  			otg_set_vbus(musb->xceiv->otg, 0);
>>  
>> -		omap_control_usb_set_mode(glue->control_otghs,
>> -			USB_MODE_DISCONNECT);
>> +		omap2430_musb_set_usbmode(glue, USB_MODE_DISCONNECT);
>>  		break;
>>  	default:
>>  		dev_dbg(dev, "ID float\n");
>> @@ -444,7 +494,7 @@ static void omap2430_musb_enable(struct musb *musb)
>>  	switch (glue->status) {
>>  
>>  	case OMAP_MUSB_ID_GROUND:
>> -		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_HOST);
>> +		omap2430_musb_set_usbmode(glue, USB_MODE_HOST);
>>  		if (data->interface_type != MUSB_INTERFACE_UTMI)
>>  			break;
>>  		devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
>> @@ -463,7 +513,7 @@ static void omap2430_musb_enable(struct musb *musb)
>>  		break;
>>  
>>  	case OMAP_MUSB_VBUS_VALID:
>> -		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE);
>> +		omap2430_musb_set_usbmode(glue, USB_MODE_DEVICE);
>>  		break;
>>  
>>  	default:
>> @@ -477,8 +527,7 @@ static void omap2430_musb_disable(struct musb *musb)
>>  	struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
>>  
>>  	if (glue->status != OMAP_MUSB_UNKNOWN)
>> -		omap_control_usb_set_mode(glue->control_otghs,
>> -			USB_MODE_DISCONNECT);
>> +		omap2430_musb_set_usbmode(glue, USB_MODE_DISCONNECT);
>>  }
>>  
>>  static int omap2430_musb_exit(struct musb *musb)
>> @@ -507,6 +556,40 @@ static const struct musb_platform_ops omap2430_ops = {
>>  
>>  static u64 omap2430_dmamask = DMA_BIT_MASK(32);
>>  
>> +static int omap2430_get_control(struct omap2430_glue *glue,
>> +				struct device_node *np)
>> +{
>> +	struct device_node *control_node;
>> +	struct platform_device *control_pdev;
>> +
>> +	glue->syscon_otghs = syscon_regmap_lookup_by_phandle(np,
>> +							     "syscon-otghs");
>> +	if (IS_ERR(glue->syscon_otghs)) {
>> +		dev_info(glue->dev, "can't get syscon, using control device\n");
> 
> dev_dbg().

Alright.

Thanks
Kishon

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

* [PATCH 07/17] usb: musb: omap2430: use *syscon* framework to write to mailbox register
@ 2015-06-24 13:21       ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 13:21 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Wednesday 24 June 2015 05:09 PM, Roger Quadros wrote:
> On Tue, 23 Jun 2015 17:28:52 +0530
> Kishon Vijay Abraham I <kishon@ti.com> wrote:
> 
>> Deprecate using phy-omap-control driver to write to the mailbox register
>> and start using *syscon* framework to do the same.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> ---
>>  Documentation/devicetree/bindings/usb/omap-usb.txt |    7 +-
>>  drivers/usb/musb/omap2430.c                        |  118 ++++++++++++++++----
>>  2 files changed, 102 insertions(+), 23 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt
>> index 38d9bb8..c001306 100644
>> --- a/Documentation/devicetree/bindings/usb/omap-usb.txt
>> +++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
>> @@ -20,10 +20,15 @@ OMAP MUSB GLUE
>>   - phy-names : the names of the PHY corresponding to the PHYs present in the
>>     *phy* phandle.
>>  
>> -Optional properties:
>> +Optional Properties:
>> +Deprecated properties:
>>   - ctrl-module : phandle of the control module this glue uses to write to
>>     mailbox
>>  
>> +Recommended properies:
>> + - syscon-otghs : phandle/offset pair. Phandle to the system control module and the
>> +   register offset of the mailbox.
>> +
>>  SOC specific device node entry
>>  usb_otg_hs: usb_otg_hs at 4a0ab000 {
>>  	compatible = "ti,omap4-musb";
>> diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
>> index cc752d8..bcd6d1e 100644
>> --- a/drivers/usb/musb/omap2430.c
>> +++ b/drivers/usb/musb/omap2430.c
>> @@ -39,16 +39,27 @@
>>  #include <linux/usb/musb-omap.h>
>>  #include <linux/phy/omap_control_phy.h>
>>  #include <linux/of_platform.h>
>> +#include <linux/regmap.h>
>> +#include <linux/mfd/syscon.h>
>>  
>>  #include "musb_core.h"
>>  #include "omap2430.h"
>>  
>> +#define OMAP2430_MUSB_MODE_MASK	0x1f
>> +#define OMAP2430_MUSB_AVALID	(0x1 << 0)
>> +#define OMAP2430_MUSB_BVALID	(0x1 << 1)
>> +#define OMAP2430_MUSB_VBUSVALID	(0x1 << 2)
>> +#define OMAP2430_MUSB_SESSEND	(0x1 << 3)
>> +#define OMAP2430_MUSB_IDDIG	(0x1 << 4)
>> +
>>  struct omap2430_glue {
>>  	struct device		*dev;
>>  	struct platform_device	*musb;
>>  	enum omap_musb_vbus_id_status status;
>>  	struct work_struct	omap_musb_mailbox_work;
>>  	struct device		*control_otghs;
>> +	struct regmap		*syscon_otghs; /* ctrl. reg. acces */
>> +	unsigned int            otghs_reg; /* otghs reg. index within syscon */
>>  };
>>  #define glue_to_musb(g)		platform_get_drvdata(g->musb)
>>  
>> @@ -253,6 +264,47 @@ void omap_musb_mailbox(enum omap_musb_vbus_id_status status)
>>  }
>>  EXPORT_SYMBOL_GPL(omap_musb_mailbox);
>>  
>> +static void omap2430_musb_set_usbmode(struct omap2430_glue *glue,
>> +				      enum omap_control_usb_mode mode)
>> +{
>> +	u32 val;
>> +	int ret;
>> +
>> +	if (glue->syscon_otghs) {
>> +		switch (mode) {
>> +		case USB_MODE_HOST:
>> +			val = OMAP2430_MUSB_AVALID | OMAP2430_MUSB_VBUSVALID;
>> +			break;
>> +
>> +		case USB_MODE_DEVICE:
>> +			val = OMAP2430_MUSB_IDDIG | OMAP2430_MUSB_AVALID |
>> +				OMAP2430_MUSB_VBUSVALID;
>> +			break;
>> +
>> +		case USB_MODE_DISCONNECT:
>> +			val = OMAP2430_MUSB_IDDIG | OMAP2430_MUSB_SESSEND;
>> +			break;
>> +
>> +		default:
>> +			dev_dbg(glue->dev, "Invalid mode\n");
>> +			goto err_regmap_update;
>> +		}
>> +
>> +		ret = regmap_update_bits(glue->syscon_otghs,
>> +					 glue->otghs_reg,
>> +					 OMAP2430_MUSB_MODE_MASK, val);
>> +		if (ret < 0)
>> +			goto err_regmap_update;
>> +	} else {
>> +		omap_control_usb_set_mode(glue->control_otghs, mode);
>> +	}
>> +
>> +	return;
>> +
>> +err_regmap_update:
>> +	dev_err(glue->dev, "Failed to set mode to %d\n", mode);
>> +}
>> +
>>  static void omap_musb_set_mailbox(struct omap2430_glue *glue)
>>  {
>>  	struct musb *musb = glue_to_musb(glue);
>> @@ -270,8 +322,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
>>  		musb->xceiv->last_event = USB_EVENT_ID;
>>  		if (musb->gadget_driver) {
>>  			pm_runtime_get_sync(dev);
>> -			omap_control_usb_set_mode(glue->control_otghs,
>> -				USB_MODE_HOST);
>> +			omap2430_musb_set_usbmode(glue, USB_MODE_HOST);
>>  			omap2430_musb_set_vbus(musb, 1);
>>  		}
>>  		break;
>> @@ -284,7 +335,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
>>  		musb->xceiv->last_event = USB_EVENT_VBUS;
>>  		if (musb->gadget_driver)
>>  			pm_runtime_get_sync(dev);
>> -		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE);
>> +		omap2430_musb_set_usbmode(glue, USB_MODE_DEVICE);
>>  		break;
>>  
>>  	case OMAP_MUSB_ID_FLOAT:
>> @@ -301,8 +352,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
>>  		if (data->interface_type == MUSB_INTERFACE_UTMI)
>>  			otg_set_vbus(musb->xceiv->otg, 0);
>>  
>> -		omap_control_usb_set_mode(glue->control_otghs,
>> -			USB_MODE_DISCONNECT);
>> +		omap2430_musb_set_usbmode(glue, USB_MODE_DISCONNECT);
>>  		break;
>>  	default:
>>  		dev_dbg(dev, "ID float\n");
>> @@ -444,7 +494,7 @@ static void omap2430_musb_enable(struct musb *musb)
>>  	switch (glue->status) {
>>  
>>  	case OMAP_MUSB_ID_GROUND:
>> -		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_HOST);
>> +		omap2430_musb_set_usbmode(glue, USB_MODE_HOST);
>>  		if (data->interface_type != MUSB_INTERFACE_UTMI)
>>  			break;
>>  		devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
>> @@ -463,7 +513,7 @@ static void omap2430_musb_enable(struct musb *musb)
>>  		break;
>>  
>>  	case OMAP_MUSB_VBUS_VALID:
>> -		omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE);
>> +		omap2430_musb_set_usbmode(glue, USB_MODE_DEVICE);
>>  		break;
>>  
>>  	default:
>> @@ -477,8 +527,7 @@ static void omap2430_musb_disable(struct musb *musb)
>>  	struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
>>  
>>  	if (glue->status != OMAP_MUSB_UNKNOWN)
>> -		omap_control_usb_set_mode(glue->control_otghs,
>> -			USB_MODE_DISCONNECT);
>> +		omap2430_musb_set_usbmode(glue, USB_MODE_DISCONNECT);
>>  }
>>  
>>  static int omap2430_musb_exit(struct musb *musb)
>> @@ -507,6 +556,40 @@ static const struct musb_platform_ops omap2430_ops = {
>>  
>>  static u64 omap2430_dmamask = DMA_BIT_MASK(32);
>>  
>> +static int omap2430_get_control(struct omap2430_glue *glue,
>> +				struct device_node *np)
>> +{
>> +	struct device_node *control_node;
>> +	struct platform_device *control_pdev;
>> +
>> +	glue->syscon_otghs = syscon_regmap_lookup_by_phandle(np,
>> +							     "syscon-otghs");
>> +	if (IS_ERR(glue->syscon_otghs)) {
>> +		dev_info(glue->dev, "can't get syscon, using control device\n");
> 
> dev_dbg().

Alright.

Thanks
Kishon

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

* Re: [PATCH 08/17] ARM: dts: dra7: Add dt node for the sycon pcie
  2015-06-24 11:50     ` Roger Quadros
  (?)
@ 2015-06-24 13:29       ` Kishon Vijay Abraham I
  -1 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 13:29 UTC (permalink / raw)
  To: Roger Quadros
  Cc: bcousson, tony, balbi, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

Hi,

On Wednesday 24 June 2015 05:20 PM, Roger Quadros wrote:
> On Tue, 23 Jun 2015 17:28:53 +0530
> Kishon Vijay Abraham I <kishon@ti.com> wrote:
> 
>> Add new device tree node for the control module register space where
>> PCIe registers are present.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> ---
>>  arch/arm/boot/dts/dra7.dtsi |    5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
>> index 260f300..3f434f7 100644
>> --- a/arch/arm/boot/dts/dra7.dtsi
>> +++ b/arch/arm/boot/dts/dra7.dtsi
>> @@ -291,6 +291,11 @@
>>  			reg = <0x4a002e00 0x7c>;
>>  		};
>>  
>> +		dra7_ctrl_pcie: tisyscon@4a003c00 {
>> +			compatible = "syscon";
>> +			reg = <0x4a003c00 0x48>;
>> +		};
>> +
> 
> Why do you need to start from 0x4a003c00?
> CTRL_CORE_PCIESS1_PCS1 is at 0x4a003c24

Actually wanted to have minimum number of syscon dt nodes. So thought even
others can use dra7_ctrl_pcie phandle. But I looked only at dra7_ctrl_core and
dra7_ctrl_general and not scm_conf :-(

Thanks
Kishon

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

* Re: [PATCH 08/17] ARM: dts: dra7: Add dt node for the sycon pcie
@ 2015-06-24 13:29       ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 13:29 UTC (permalink / raw)
  To: Roger Quadros
  Cc: bcousson, tony, balbi, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

Hi,

On Wednesday 24 June 2015 05:20 PM, Roger Quadros wrote:
> On Tue, 23 Jun 2015 17:28:53 +0530
> Kishon Vijay Abraham I <kishon@ti.com> wrote:
> 
>> Add new device tree node for the control module register space where
>> PCIe registers are present.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> ---
>>  arch/arm/boot/dts/dra7.dtsi |    5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
>> index 260f300..3f434f7 100644
>> --- a/arch/arm/boot/dts/dra7.dtsi
>> +++ b/arch/arm/boot/dts/dra7.dtsi
>> @@ -291,6 +291,11 @@
>>  			reg = <0x4a002e00 0x7c>;
>>  		};
>>  
>> +		dra7_ctrl_pcie: tisyscon@4a003c00 {
>> +			compatible = "syscon";
>> +			reg = <0x4a003c00 0x48>;
>> +		};
>> +
> 
> Why do you need to start from 0x4a003c00?
> CTRL_CORE_PCIESS1_PCS1 is at 0x4a003c24

Actually wanted to have minimum number of syscon dt nodes. So thought even
others can use dra7_ctrl_pcie phandle. But I looked only at dra7_ctrl_core and
dra7_ctrl_general and not scm_conf :-(

Thanks
Kishon

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

* [PATCH 08/17] ARM: dts: dra7: Add dt node for the sycon pcie
@ 2015-06-24 13:29       ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 13:29 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Wednesday 24 June 2015 05:20 PM, Roger Quadros wrote:
> On Tue, 23 Jun 2015 17:28:53 +0530
> Kishon Vijay Abraham I <kishon@ti.com> wrote:
> 
>> Add new device tree node for the control module register space where
>> PCIe registers are present.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> ---
>>  arch/arm/boot/dts/dra7.dtsi |    5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
>> index 260f300..3f434f7 100644
>> --- a/arch/arm/boot/dts/dra7.dtsi
>> +++ b/arch/arm/boot/dts/dra7.dtsi
>> @@ -291,6 +291,11 @@
>>  			reg = <0x4a002e00 0x7c>;
>>  		};
>>  
>> +		dra7_ctrl_pcie: tisyscon at 4a003c00 {
>> +			compatible = "syscon";
>> +			reg = <0x4a003c00 0x48>;
>> +		};
>> +
> 
> Why do you need to start from 0x4a003c00?
> CTRL_CORE_PCIESS1_PCS1 is at 0x4a003c24

Actually wanted to have minimum number of syscon dt nodes. So thought even
others can use dra7_ctrl_pcie phandle. But I looked only at dra7_ctrl_core and
dra7_ctrl_general and not scm_conf :-(

Thanks
Kishon

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

* Re: [PATCH 08/17] ARM: dts: dra7: Add dt node for the sycon pcie
@ 2015-06-24 13:30         ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 13:30 UTC (permalink / raw)
  To: Roger Quadros
  Cc: bcousson, tony, balbi, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

Hi,

On Wednesday 24 June 2015 05:26 PM, Roger Quadros wrote:
> On Wed, 24 Jun 2015 14:50:17 +0300
> Roger Quadros <rogerq@ti.com> wrote:
> 
>> On Tue, 23 Jun 2015 17:28:53 +0530
>> Kishon Vijay Abraham I <kishon@ti.com> wrote:
>>
>>> Add new device tree node for the control module register space where
>>> PCIe registers are present.
>>>
>>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>>> ---
>>>  arch/arm/boot/dts/dra7.dtsi |    5 +++++
>>>  1 file changed, 5 insertions(+)
>>>
>>> diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
>>> index 260f300..3f434f7 100644
>>> --- a/arch/arm/boot/dts/dra7.dtsi
>>> +++ b/arch/arm/boot/dts/dra7.dtsi
>>> @@ -291,6 +291,11 @@
>>>  			reg = <0x4a002e00 0x7c>;
>>>  		};
>>>  
>>> +		dra7_ctrl_pcie: tisyscon@4a003c00 {
>>> +			compatible = "syscon";
>>> +			reg = <0x4a003c00 0x48>;
>>> +		};
>>> +
>>
>> Why do you need to start from 0x4a003c00?
>> CTRL_CORE_PCIESS1_PCS1 is at 0x4a003c24
> 
> Also, why can't this dra7_ctrl_pcie node be where scm_conf is.

Yes. I think that's the right thing to do. I saw dra7_ctrl_core and
dra7_ctrl_general and added it.

Thanks
Kishon

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

* Re: [PATCH 08/17] ARM: dts: dra7: Add dt node for the sycon pcie
@ 2015-06-24 13:30         ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 13:30 UTC (permalink / raw)
  To: Roger Quadros
  Cc: bcousson-rdvid1DuHRBWk0Htik3J/w, tony-4v6yS6AI5VpBDgjK7y7TUQ,
	balbi-l0cyMroinI0, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0

Hi,

On Wednesday 24 June 2015 05:26 PM, Roger Quadros wrote:
> On Wed, 24 Jun 2015 14:50:17 +0300
> Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org> wrote:
> 
>> On Tue, 23 Jun 2015 17:28:53 +0530
>> Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org> wrote:
>>
>>> Add new device tree node for the control module register space where
>>> PCIe registers are present.
>>>
>>> Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
>>> ---
>>>  arch/arm/boot/dts/dra7.dtsi |    5 +++++
>>>  1 file changed, 5 insertions(+)
>>>
>>> diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
>>> index 260f300..3f434f7 100644
>>> --- a/arch/arm/boot/dts/dra7.dtsi
>>> +++ b/arch/arm/boot/dts/dra7.dtsi
>>> @@ -291,6 +291,11 @@
>>>  			reg = <0x4a002e00 0x7c>;
>>>  		};
>>>  
>>> +		dra7_ctrl_pcie: tisyscon@4a003c00 {
>>> +			compatible = "syscon";
>>> +			reg = <0x4a003c00 0x48>;
>>> +		};
>>> +
>>
>> Why do you need to start from 0x4a003c00?
>> CTRL_CORE_PCIESS1_PCS1 is at 0x4a003c24
> 
> Also, why can't this dra7_ctrl_pcie node be where scm_conf is.

Yes. I think that's the right thing to do. I saw dra7_ctrl_core and
dra7_ctrl_general and added it.

Thanks
Kishon
--
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	[flat|nested] 150+ messages in thread

* [PATCH 08/17] ARM: dts: dra7: Add dt node for the sycon pcie
@ 2015-06-24 13:30         ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 13:30 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Wednesday 24 June 2015 05:26 PM, Roger Quadros wrote:
> On Wed, 24 Jun 2015 14:50:17 +0300
> Roger Quadros <rogerq@ti.com> wrote:
> 
>> On Tue, 23 Jun 2015 17:28:53 +0530
>> Kishon Vijay Abraham I <kishon@ti.com> wrote:
>>
>>> Add new device tree node for the control module register space where
>>> PCIe registers are present.
>>>
>>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>>> ---
>>>  arch/arm/boot/dts/dra7.dtsi |    5 +++++
>>>  1 file changed, 5 insertions(+)
>>>
>>> diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
>>> index 260f300..3f434f7 100644
>>> --- a/arch/arm/boot/dts/dra7.dtsi
>>> +++ b/arch/arm/boot/dts/dra7.dtsi
>>> @@ -291,6 +291,11 @@
>>>  			reg = <0x4a002e00 0x7c>;
>>>  		};
>>>  
>>> +		dra7_ctrl_pcie: tisyscon at 4a003c00 {
>>> +			compatible = "syscon";
>>> +			reg = <0x4a003c00 0x48>;
>>> +		};
>>> +
>>
>> Why do you need to start from 0x4a003c00?
>> CTRL_CORE_PCIESS1_PCS1 is at 0x4a003c24
> 
> Also, why can't this dra7_ctrl_pcie node be where scm_conf is.

Yes. I think that's the right thing to do. I saw dra7_ctrl_core and
dra7_ctrl_general and added it.

Thanks
Kishon

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

* Re: [PATCH 09/17] ARM: dts: dra7: Use "syscon-phy-power" instead of "ctrl-module" in SATA PHY node
@ 2015-06-24 13:31         ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 13:31 UTC (permalink / raw)
  To: Roger Quadros
  Cc: bcousson, tony, balbi, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar



On Wednesday 24 June 2015 05:42 PM, Roger Quadros wrote:
> On Wed, 24 Jun 2015 15:06:02 +0300
> Roger Quadros <rogerq@ti.com> wrote:
> 
>> On Tue, 23 Jun 2015 17:28:54 +0530
>> Kishon Vijay Abraham I <kishon@ti.com> wrote:
>>
>>> Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
>>> property from SATA PHY node. Since "omap_control_sata" note is no longer
>>> used, remove it.
>>>
>>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>>
>> Acked-by: Roger Quadros <rogerq@ti.com>
> 
> One comment though.
> 
>>
>>> ---
>>>  arch/arm/boot/dts/dra7.dtsi |   10 +---------
>>>  1 file changed, 1 insertion(+), 9 deletions(-)
>>>
>>> diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
>>> index 3f434f7..92e0741 100644
>>> --- a/arch/arm/boot/dts/dra7.dtsi
>>> +++ b/arch/arm/boot/dts/dra7.dtsi
>>> @@ -1115,14 +1115,6 @@
>>>  			status = "disabled";
>>>  		};
>>>  
>>> -		omap_control_sata: control-phy@4a002374 {
>>> -			compatible = "ti,control-phy-pipe3";
>>> -			reg = <0x4a002374 0x4>;
>>> -			reg-names = "power";
>>> -			clocks = <&sys_clkin1>;
>>> -			clock-names = "sysclk";
>>> -		};
>>> -
>>>  		/* OCP2SCP3 */
>>>  		ocp2scp@4a090000 {
>>>  			compatible = "ti,omap-ocp2scp";
>>> @@ -1137,7 +1129,7 @@
>>>  				      <0x4A096400 0x64>, /* phy_tx */
>>>  				      <0x4A096800 0x40>; /* pll_ctrl */
>>>  				reg-names = "phy_rx", "phy_tx", "pll_ctrl";
>>> -				ctrl-module = <&omap_control_sata>;
>>> +				syscon-phy-power = <&dra7_ctrl_core 0x374>;
> 
> why can't we use scm_conf instead of dra7_ctrl_core?
> dra7_ctrl_core seems to be redundant and wrongly placed.

Agreed!

Thanks
Kishon

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

* Re: [PATCH 09/17] ARM: dts: dra7: Use "syscon-phy-power" instead of "ctrl-module" in SATA PHY node
@ 2015-06-24 13:31         ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 13:31 UTC (permalink / raw)
  To: Roger Quadros
  Cc: bcousson-rdvid1DuHRBWk0Htik3J/w, tony-4v6yS6AI5VpBDgjK7y7TUQ,
	balbi-l0cyMroinI0, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0



On Wednesday 24 June 2015 05:42 PM, Roger Quadros wrote:
> On Wed, 24 Jun 2015 15:06:02 +0300
> Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org> wrote:
> 
>> On Tue, 23 Jun 2015 17:28:54 +0530
>> Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org> wrote:
>>
>>> Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
>>> property from SATA PHY node. Since "omap_control_sata" note is no longer
>>> used, remove it.
>>>
>>> Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
>>
>> Acked-by: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
> 
> One comment though.
> 
>>
>>> ---
>>>  arch/arm/boot/dts/dra7.dtsi |   10 +---------
>>>  1 file changed, 1 insertion(+), 9 deletions(-)
>>>
>>> diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
>>> index 3f434f7..92e0741 100644
>>> --- a/arch/arm/boot/dts/dra7.dtsi
>>> +++ b/arch/arm/boot/dts/dra7.dtsi
>>> @@ -1115,14 +1115,6 @@
>>>  			status = "disabled";
>>>  		};
>>>  
>>> -		omap_control_sata: control-phy@4a002374 {
>>> -			compatible = "ti,control-phy-pipe3";
>>> -			reg = <0x4a002374 0x4>;
>>> -			reg-names = "power";
>>> -			clocks = <&sys_clkin1>;
>>> -			clock-names = "sysclk";
>>> -		};
>>> -
>>>  		/* OCP2SCP3 */
>>>  		ocp2scp@4a090000 {
>>>  			compatible = "ti,omap-ocp2scp";
>>> @@ -1137,7 +1129,7 @@
>>>  				      <0x4A096400 0x64>, /* phy_tx */
>>>  				      <0x4A096800 0x40>; /* pll_ctrl */
>>>  				reg-names = "phy_rx", "phy_tx", "pll_ctrl";
>>> -				ctrl-module = <&omap_control_sata>;
>>> +				syscon-phy-power = <&dra7_ctrl_core 0x374>;
> 
> why can't we use scm_conf instead of dra7_ctrl_core?
> dra7_ctrl_core seems to be redundant and wrongly placed.

Agreed!

Thanks
Kishon
--
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] 150+ messages in thread

* [PATCH 09/17] ARM: dts: dra7: Use "syscon-phy-power" instead of "ctrl-module" in SATA PHY node
@ 2015-06-24 13:31         ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 150+ messages in thread
From: Kishon Vijay Abraham I @ 2015-06-24 13:31 UTC (permalink / raw)
  To: linux-arm-kernel



On Wednesday 24 June 2015 05:42 PM, Roger Quadros wrote:
> On Wed, 24 Jun 2015 15:06:02 +0300
> Roger Quadros <rogerq@ti.com> wrote:
> 
>> On Tue, 23 Jun 2015 17:28:54 +0530
>> Kishon Vijay Abraham I <kishon@ti.com> wrote:
>>
>>> Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
>>> property from SATA PHY node. Since "omap_control_sata" note is no longer
>>> used, remove it.
>>>
>>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>>
>> Acked-by: Roger Quadros <rogerq@ti.com>
> 
> One comment though.
> 
>>
>>> ---
>>>  arch/arm/boot/dts/dra7.dtsi |   10 +---------
>>>  1 file changed, 1 insertion(+), 9 deletions(-)
>>>
>>> diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
>>> index 3f434f7..92e0741 100644
>>> --- a/arch/arm/boot/dts/dra7.dtsi
>>> +++ b/arch/arm/boot/dts/dra7.dtsi
>>> @@ -1115,14 +1115,6 @@
>>>  			status = "disabled";
>>>  		};
>>>  
>>> -		omap_control_sata: control-phy at 4a002374 {
>>> -			compatible = "ti,control-phy-pipe3";
>>> -			reg = <0x4a002374 0x4>;
>>> -			reg-names = "power";
>>> -			clocks = <&sys_clkin1>;
>>> -			clock-names = "sysclk";
>>> -		};
>>> -
>>>  		/* OCP2SCP3 */
>>>  		ocp2scp at 4a090000 {
>>>  			compatible = "ti,omap-ocp2scp";
>>> @@ -1137,7 +1129,7 @@
>>>  				      <0x4A096400 0x64>, /* phy_tx */
>>>  				      <0x4A096800 0x40>; /* pll_ctrl */
>>>  				reg-names = "phy_rx", "phy_tx", "pll_ctrl";
>>> -				ctrl-module = <&omap_control_sata>;
>>> +				syscon-phy-power = <&dra7_ctrl_core 0x374>;
> 
> why can't we use scm_conf instead of dra7_ctrl_core?
> dra7_ctrl_core seems to be redundant and wrongly placed.

Agreed!

Thanks
Kishon

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

* Re: [PATCH 03/17] phy: ti-pipe3: use *syscon* framework to set PCS value of the PHY
@ 2015-06-24 13:48         ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 13:48 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson, tony, balbi, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

On Wed, 24 Jun 2015 18:46:08 +0530
Kishon Vijay Abraham I <kishon@ti.com> wrote:

> Hi,
> 
> On Wednesday 24 June 2015 04:04 PM, Roger Quadros wrote:
> > On Tue, 23 Jun 2015 17:28:48 +0530
> > Kishon Vijay Abraham I <kishon@ti.com> wrote:
> > 
> >> Deprecate using phy-omap-control driver to set PCS value of the PHY
> >> and start using *syscon* framework to do the same.
> >>
> >> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> >> ---
> >>   Documentation/devicetree/bindings/phy/ti-phy.txt |    2 ++
> >>   drivers/phy/phy-ti-pipe3.c                       |   32 +++++++++++++++++++++-
> >>   2 files changed, 33 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
> >> index d3ad3bf..52c7a92 100644
> >> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
> >> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
> >> @@ -83,6 +83,8 @@ Optional properties:
> >>    - syscon-pllreset: Handle to system control region that contains the
> >>      CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0
> >>      register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.
> >> + - syscon-pcs : phandle/offset pair. Phandle to the system control module and the
> >> +   register offset to write the PCS delay value.
> > 
> > What is PCS?
> 
> IIRC physical coding subsystem.
> > Is this valid only for PCIe? If yes we could mention it here.
> 
> This is introduced specifically for PCIe. But there are other PCS registers
> with a different register map altogether for USB. I'm not sure if we will ever
> have to do those settings.

OK then let's not say it is PCIe specific.

cheers,
-roger

> 
> > 
> >>   
> >>   Deprecated properties:
> >>    - ctrl-module : phandle of the control module used by PHY driver to power on
> >> diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
> >> index 78bac00..e2f9ad7 100644
> >> --- a/drivers/phy/phy-ti-pipe3.c
> >> +++ b/drivers/phy/phy-ti-pipe3.c
> >> @@ -65,6 +65,9 @@
> >>   #define PIPE3_PHY_TX_RX_POWERON		0x3
> >>   #define PIPE3_PHY_TX_RX_POWEROFF	0x0
> >>   
> >> +#define PCIE_PCS_MASK			0xFF0000
> >> +#define PCIE_PCS_DELAY_COUNT_SHIFT	0x10
> >> +
> >>   /*
> >>    * This is an Empirical value that works, need to confirm the actual
> >>    * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status
> >> @@ -96,9 +99,11 @@ struct ti_pipe3 {
> >>   	struct clk		*div_clk;
> >>   	struct pipe3_dpll_map	*dpll_map;
> >>   	struct regmap		*phy_power_syscon; /* ctrl. reg. acces */
> >> +	struct regmap		*pcs_syscon; /* ctrl. reg. acces */
> >>   	struct regmap		*dpll_reset_syscon; /* ctrl. reg. acces */
> >>   	unsigned int		dpll_reset_reg; /* reg. index within syscon */
> >>   	unsigned int		power_reg; /* power reg. index within syscon */
> >> +	unsigned int		pcie_pcs_reg; /* pcs reg. index in syscon */
> >>   	bool			sata_refclk_enabled;
> >>   };
> >>   
> >> @@ -271,7 +276,16 @@ static int ti_pipe3_init(struct phy *x)
> >>   	 * 18-1804.
> >>   	 */
> >>   	if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-pcie")) {
> >> -		omap_control_pcie_pcs(phy->control_dev, 0x96);
> >> +		if (phy->pcs_syscon) {
> >> +			val = 0x96 << OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT;
> >> +			ret = regmap_update_bits(phy->pcs_syscon,
> >> +						 phy->pcie_pcs_reg,
> >> +						 PCIE_PCS_MASK, val);
> >> +			if (ret < 0)
> >> +				return ret;
> >> +		} else {
> >> +			omap_control_pcie_pcs(phy->control_dev, 0x96);
> >> +		}
> >>   		return 0;
> >>   	}
> >>   
> >> @@ -455,6 +469,22 @@ static int ti_pipe3_probe(struct platform_device *pdev)
> >>   			dev_err(&pdev->dev, "unable to get div-clk\n");
> >>   			return PTR_ERR(phy->div_clk);
> >>   		}
> >> +
> >> +		phy->pcs_syscon = syscon_regmap_lookup_by_phandle(node,
> >> +								  "syscon-pcs");
> >> +		if (IS_ERR(phy->pcs_syscon)) {
> >> +			dev_dbg(&pdev->dev,
> >> +				 "can't get syscon-pcs, using omap control\n");
> >> +			phy->pcs_syscon = NULL;
> >> +		} else {
> >> +			if (of_property_read_u32_index(node,
> >> +						       "syscon-pcs", 1,
> >> +						       &phy->pcie_pcs_reg)) {
> >> +				dev_err(&pdev->dev,
> >> +					"couldn't get pcie pcs reg. offset\n");
> >> +				return -EINVAL;
> >> +			}
> >> +		}
> >>   	} else {
> >>   		phy->div_clk = ERR_PTR(-ENODEV);
> >>   	}
> >> -- 
> >> 1.7.9.5
> >>
> > 
> > Other than that,
> > 
> > Acked-by: Roger Quadros <rogerq@ti.com>
> > 
> > cheers,
> > -roger
> > 

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

* Re: [PATCH 03/17] phy: ti-pipe3: use *syscon* framework to set PCS value of the PHY
@ 2015-06-24 13:48         ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 13:48 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson-rdvid1DuHRBWk0Htik3J/w, tony-4v6yS6AI5VpBDgjK7y7TUQ,
	balbi-l0cyMroinI0, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0

On Wed, 24 Jun 2015 18:46:08 +0530
Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org> wrote:

> Hi,
> 
> On Wednesday 24 June 2015 04:04 PM, Roger Quadros wrote:
> > On Tue, 23 Jun 2015 17:28:48 +0530
> > Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org> wrote:
> > 
> >> Deprecate using phy-omap-control driver to set PCS value of the PHY
> >> and start using *syscon* framework to do the same.
> >>
> >> Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
> >> ---
> >>   Documentation/devicetree/bindings/phy/ti-phy.txt |    2 ++
> >>   drivers/phy/phy-ti-pipe3.c                       |   32 +++++++++++++++++++++-
> >>   2 files changed, 33 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
> >> index d3ad3bf..52c7a92 100644
> >> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
> >> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
> >> @@ -83,6 +83,8 @@ Optional properties:
> >>    - syscon-pllreset: Handle to system control region that contains the
> >>      CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0
> >>      register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.
> >> + - syscon-pcs : phandle/offset pair. Phandle to the system control module and the
> >> +   register offset to write the PCS delay value.
> > 
> > What is PCS?
> 
> IIRC physical coding subsystem.
> > Is this valid only for PCIe? If yes we could mention it here.
> 
> This is introduced specifically for PCIe. But there are other PCS registers
> with a different register map altogether for USB. I'm not sure if we will ever
> have to do those settings.

OK then let's not say it is PCIe specific.

cheers,
-roger

> 
> > 
> >>   
> >>   Deprecated properties:
> >>    - ctrl-module : phandle of the control module used by PHY driver to power on
> >> diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
> >> index 78bac00..e2f9ad7 100644
> >> --- a/drivers/phy/phy-ti-pipe3.c
> >> +++ b/drivers/phy/phy-ti-pipe3.c
> >> @@ -65,6 +65,9 @@
> >>   #define PIPE3_PHY_TX_RX_POWERON		0x3
> >>   #define PIPE3_PHY_TX_RX_POWEROFF	0x0
> >>   
> >> +#define PCIE_PCS_MASK			0xFF0000
> >> +#define PCIE_PCS_DELAY_COUNT_SHIFT	0x10
> >> +
> >>   /*
> >>    * This is an Empirical value that works, need to confirm the actual
> >>    * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status
> >> @@ -96,9 +99,11 @@ struct ti_pipe3 {
> >>   	struct clk		*div_clk;
> >>   	struct pipe3_dpll_map	*dpll_map;
> >>   	struct regmap		*phy_power_syscon; /* ctrl. reg. acces */
> >> +	struct regmap		*pcs_syscon; /* ctrl. reg. acces */
> >>   	struct regmap		*dpll_reset_syscon; /* ctrl. reg. acces */
> >>   	unsigned int		dpll_reset_reg; /* reg. index within syscon */
> >>   	unsigned int		power_reg; /* power reg. index within syscon */
> >> +	unsigned int		pcie_pcs_reg; /* pcs reg. index in syscon */
> >>   	bool			sata_refclk_enabled;
> >>   };
> >>   
> >> @@ -271,7 +276,16 @@ static int ti_pipe3_init(struct phy *x)
> >>   	 * 18-1804.
> >>   	 */
> >>   	if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-pcie")) {
> >> -		omap_control_pcie_pcs(phy->control_dev, 0x96);
> >> +		if (phy->pcs_syscon) {
> >> +			val = 0x96 << OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT;
> >> +			ret = regmap_update_bits(phy->pcs_syscon,
> >> +						 phy->pcie_pcs_reg,
> >> +						 PCIE_PCS_MASK, val);
> >> +			if (ret < 0)
> >> +				return ret;
> >> +		} else {
> >> +			omap_control_pcie_pcs(phy->control_dev, 0x96);
> >> +		}
> >>   		return 0;
> >>   	}
> >>   
> >> @@ -455,6 +469,22 @@ static int ti_pipe3_probe(struct platform_device *pdev)
> >>   			dev_err(&pdev->dev, "unable to get div-clk\n");
> >>   			return PTR_ERR(phy->div_clk);
> >>   		}
> >> +
> >> +		phy->pcs_syscon = syscon_regmap_lookup_by_phandle(node,
> >> +								  "syscon-pcs");
> >> +		if (IS_ERR(phy->pcs_syscon)) {
> >> +			dev_dbg(&pdev->dev,
> >> +				 "can't get syscon-pcs, using omap control\n");
> >> +			phy->pcs_syscon = NULL;
> >> +		} else {
> >> +			if (of_property_read_u32_index(node,
> >> +						       "syscon-pcs", 1,
> >> +						       &phy->pcie_pcs_reg)) {
> >> +				dev_err(&pdev->dev,
> >> +					"couldn't get pcie pcs reg. offset\n");
> >> +				return -EINVAL;
> >> +			}
> >> +		}
> >>   	} else {
> >>   		phy->div_clk = ERR_PTR(-ENODEV);
> >>   	}
> >> -- 
> >> 1.7.9.5
> >>
> > 
> > Other than that,
> > 
> > Acked-by: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
> > 
> > cheers,
> > -roger
> > 
--
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] 150+ messages in thread

* [PATCH 03/17] phy: ti-pipe3: use *syscon* framework to set PCS value of the PHY
@ 2015-06-24 13:48         ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 13:48 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 24 Jun 2015 18:46:08 +0530
Kishon Vijay Abraham I <kishon@ti.com> wrote:

> Hi,
> 
> On Wednesday 24 June 2015 04:04 PM, Roger Quadros wrote:
> > On Tue, 23 Jun 2015 17:28:48 +0530
> > Kishon Vijay Abraham I <kishon@ti.com> wrote:
> > 
> >> Deprecate using phy-omap-control driver to set PCS value of the PHY
> >> and start using *syscon* framework to do the same.
> >>
> >> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> >> ---
> >>   Documentation/devicetree/bindings/phy/ti-phy.txt |    2 ++
> >>   drivers/phy/phy-ti-pipe3.c                       |   32 +++++++++++++++++++++-
> >>   2 files changed, 33 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
> >> index d3ad3bf..52c7a92 100644
> >> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
> >> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
> >> @@ -83,6 +83,8 @@ Optional properties:
> >>    - syscon-pllreset: Handle to system control region that contains the
> >>      CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0
> >>      register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.
> >> + - syscon-pcs : phandle/offset pair. Phandle to the system control module and the
> >> +   register offset to write the PCS delay value.
> > 
> > What is PCS?
> 
> IIRC physical coding subsystem.
> > Is this valid only for PCIe? If yes we could mention it here.
> 
> This is introduced specifically for PCIe. But there are other PCS registers
> with a different register map altogether for USB. I'm not sure if we will ever
> have to do those settings.

OK then let's not say it is PCIe specific.

cheers,
-roger

> 
> > 
> >>   
> >>   Deprecated properties:
> >>    - ctrl-module : phandle of the control module used by PHY driver to power on
> >> diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
> >> index 78bac00..e2f9ad7 100644
> >> --- a/drivers/phy/phy-ti-pipe3.c
> >> +++ b/drivers/phy/phy-ti-pipe3.c
> >> @@ -65,6 +65,9 @@
> >>   #define PIPE3_PHY_TX_RX_POWERON		0x3
> >>   #define PIPE3_PHY_TX_RX_POWEROFF	0x0
> >>   
> >> +#define PCIE_PCS_MASK			0xFF0000
> >> +#define PCIE_PCS_DELAY_COUNT_SHIFT	0x10
> >> +
> >>   /*
> >>    * This is an Empirical value that works, need to confirm the actual
> >>    * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status
> >> @@ -96,9 +99,11 @@ struct ti_pipe3 {
> >>   	struct clk		*div_clk;
> >>   	struct pipe3_dpll_map	*dpll_map;
> >>   	struct regmap		*phy_power_syscon; /* ctrl. reg. acces */
> >> +	struct regmap		*pcs_syscon; /* ctrl. reg. acces */
> >>   	struct regmap		*dpll_reset_syscon; /* ctrl. reg. acces */
> >>   	unsigned int		dpll_reset_reg; /* reg. index within syscon */
> >>   	unsigned int		power_reg; /* power reg. index within syscon */
> >> +	unsigned int		pcie_pcs_reg; /* pcs reg. index in syscon */
> >>   	bool			sata_refclk_enabled;
> >>   };
> >>   
> >> @@ -271,7 +276,16 @@ static int ti_pipe3_init(struct phy *x)
> >>   	 * 18-1804.
> >>   	 */
> >>   	if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-pcie")) {
> >> -		omap_control_pcie_pcs(phy->control_dev, 0x96);
> >> +		if (phy->pcs_syscon) {
> >> +			val = 0x96 << OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT;
> >> +			ret = regmap_update_bits(phy->pcs_syscon,
> >> +						 phy->pcie_pcs_reg,
> >> +						 PCIE_PCS_MASK, val);
> >> +			if (ret < 0)
> >> +				return ret;
> >> +		} else {
> >> +			omap_control_pcie_pcs(phy->control_dev, 0x96);
> >> +		}
> >>   		return 0;
> >>   	}
> >>   
> >> @@ -455,6 +469,22 @@ static int ti_pipe3_probe(struct platform_device *pdev)
> >>   			dev_err(&pdev->dev, "unable to get div-clk\n");
> >>   			return PTR_ERR(phy->div_clk);
> >>   		}
> >> +
> >> +		phy->pcs_syscon = syscon_regmap_lookup_by_phandle(node,
> >> +								  "syscon-pcs");
> >> +		if (IS_ERR(phy->pcs_syscon)) {
> >> +			dev_dbg(&pdev->dev,
> >> +				 "can't get syscon-pcs, using omap control\n");
> >> +			phy->pcs_syscon = NULL;
> >> +		} else {
> >> +			if (of_property_read_u32_index(node,
> >> +						       "syscon-pcs", 1,
> >> +						       &phy->pcie_pcs_reg)) {
> >> +				dev_err(&pdev->dev,
> >> +					"couldn't get pcie pcs reg. offset\n");
> >> +				return -EINVAL;
> >> +			}
> >> +		}
> >>   	} else {
> >>   		phy->div_clk = ERR_PTR(-ENODEV);
> >>   	}
> >> -- 
> >> 1.7.9.5
> >>
> > 
> > Other than that,
> > 
> > Acked-by: Roger Quadros <rogerq@ti.com>
> > 
> > cheers,
> > -roger
> > 

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

* Re: [PATCH 11/17] ARM: dts: dra7: Use "ti,dra7x-usb2-phy2" compatible string for USB2 PHY2
@ 2015-06-24 13:50         ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 13:50 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson, tony, balbi, devicetree, linux-kernel, linux-omap,
	linux-arm-kernel, linux-usb, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak, linux, gregkh, nsekhar

On Wed, 24 Jun 2015 18:40:31 +0530
Kishon Vijay Abraham I <kishon@ti.com> wrote:

> Hi,
> 
> On Wednesday 24 June 2015 05:37 PM, Roger Quadros wrote:
> > On Tue, 23 Jun 2015 17:28:56 +0530
> > Kishon Vijay Abraham I <kishon@ti.com> wrote:
> > 
> >> The USB2 PHY2 has a different register map compared to USB2 PHY1
> >> to power on/off the PHY. In order to handle it, use the new compatible
> >> string "ti,dra7x-usb2-phy2" for the second instance of USB2 PHY.
> >>
> >> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> >> ---
> >>  arch/arm/boot/dts/dra7.dtsi |    2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
> >> index f69db70..a8ee829 100644
> >> --- a/arch/arm/boot/dts/dra7.dtsi
> >> +++ b/arch/arm/boot/dts/dra7.dtsi
> >> @@ -1235,7 +1235,7 @@
> >>  			};
> >>  
> >>  			usb2_phy2: phy@4a085000 {
> >> -				compatible = "ti,omap-usb2";
> >> +				compatible = "ti,dra7x-usb2-phy2", "ti,omap-usb2";
> > 
> > Why do you want to retain "ti,omap-usb2".
> > It is not backward compatible with it right?
> 
> The newer dtbs will anyway have "ti,dra7x-usb2-phy2", so "ti,omap-usb2" was
> kept just for legacy reasons.

OK then.

cheers,
-roger

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

* Re: [PATCH 11/17] ARM: dts: dra7: Use "ti,dra7x-usb2-phy2" compatible string for USB2 PHY2
@ 2015-06-24 13:50         ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 13:50 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: bcousson-rdvid1DuHRBWk0Htik3J/w, tony-4v6yS6AI5VpBDgjK7y7TUQ,
	balbi-l0cyMroinI0, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, nsekhar-l0cyMroinI0

On Wed, 24 Jun 2015 18:40:31 +0530
Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org> wrote:

> Hi,
> 
> On Wednesday 24 June 2015 05:37 PM, Roger Quadros wrote:
> > On Tue, 23 Jun 2015 17:28:56 +0530
> > Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org> wrote:
> > 
> >> The USB2 PHY2 has a different register map compared to USB2 PHY1
> >> to power on/off the PHY. In order to handle it, use the new compatible
> >> string "ti,dra7x-usb2-phy2" for the second instance of USB2 PHY.
> >>
> >> Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
> >> ---
> >>  arch/arm/boot/dts/dra7.dtsi |    2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
> >> index f69db70..a8ee829 100644
> >> --- a/arch/arm/boot/dts/dra7.dtsi
> >> +++ b/arch/arm/boot/dts/dra7.dtsi
> >> @@ -1235,7 +1235,7 @@
> >>  			};
> >>  
> >>  			usb2_phy2: phy@4a085000 {
> >> -				compatible = "ti,omap-usb2";
> >> +				compatible = "ti,dra7x-usb2-phy2", "ti,omap-usb2";
> > 
> > Why do you want to retain "ti,omap-usb2".
> > It is not backward compatible with it right?
> 
> The newer dtbs will anyway have "ti,dra7x-usb2-phy2", so "ti,omap-usb2" was
> kept just for legacy reasons.

OK then.

cheers,
-roger
--
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] 150+ messages in thread

* [PATCH 11/17] ARM: dts: dra7: Use "ti,dra7x-usb2-phy2" compatible string for USB2 PHY2
@ 2015-06-24 13:50         ` Roger Quadros
  0 siblings, 0 replies; 150+ messages in thread
From: Roger Quadros @ 2015-06-24 13:50 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 24 Jun 2015 18:40:31 +0530
Kishon Vijay Abraham I <kishon@ti.com> wrote:

> Hi,
> 
> On Wednesday 24 June 2015 05:37 PM, Roger Quadros wrote:
> > On Tue, 23 Jun 2015 17:28:56 +0530
> > Kishon Vijay Abraham I <kishon@ti.com> wrote:
> > 
> >> The USB2 PHY2 has a different register map compared to USB2 PHY1
> >> to power on/off the PHY. In order to handle it, use the new compatible
> >> string "ti,dra7x-usb2-phy2" for the second instance of USB2 PHY.
> >>
> >> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> >> ---
> >>  arch/arm/boot/dts/dra7.dtsi |    2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
> >> index f69db70..a8ee829 100644
> >> --- a/arch/arm/boot/dts/dra7.dtsi
> >> +++ b/arch/arm/boot/dts/dra7.dtsi
> >> @@ -1235,7 +1235,7 @@
> >>  			};
> >>  
> >>  			usb2_phy2: phy at 4a085000 {
> >> -				compatible = "ti,omap-usb2";
> >> +				compatible = "ti,dra7x-usb2-phy2", "ti,omap-usb2";
> > 
> > Why do you want to retain "ti,omap-usb2".
> > It is not backward compatible with it right?
> 
> The newer dtbs will anyway have "ti,dra7x-usb2-phy2", so "ti,omap-usb2" was
> kept just for legacy reasons.

OK then.

cheers,
-roger

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

end of thread, other threads:[~2015-06-24 13:51 UTC | newest]

Thread overview: 150+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-23 11:58 [PATCH 00/17] Deprecate phy-omap-control and use SYSCON Kishon Vijay Abraham I
2015-06-23 11:58 ` Kishon Vijay Abraham I
2015-06-23 11:58 ` Kishon Vijay Abraham I
2015-06-23 11:58 ` [PATCH 01/17] phy: ti-pipe3: use ti_pipe3_power_off to power off the PHY during probe Kishon Vijay Abraham I
2015-06-23 11:58   ` Kishon Vijay Abraham I
2015-06-23 11:58   ` Kishon Vijay Abraham I
2015-06-23 14:47   ` Roger Quadros
2015-06-23 14:47     ` Roger Quadros
2015-06-23 14:47     ` Roger Quadros
2015-06-23 11:58 ` [PATCH 02/17] phy: ti-pipe3: use *syscon* framework to power on/off the PHY Kishon Vijay Abraham I
2015-06-23 11:58   ` Kishon Vijay Abraham I
2015-06-23 11:58   ` Kishon Vijay Abraham I
2015-06-23 14:53   ` Roger Quadros
2015-06-23 14:53     ` Roger Quadros
2015-06-23 14:53     ` Roger Quadros
2015-06-24 11:26     ` Kishon Vijay Abraham I
2015-06-24 11:26       ` Kishon Vijay Abraham I
2015-06-24 11:26       ` Kishon Vijay Abraham I
2015-06-23 11:58 ` [PATCH 03/17] phy: ti-pipe3: use *syscon* framework to set PCS value of " Kishon Vijay Abraham I
2015-06-23 11:58   ` Kishon Vijay Abraham I
2015-06-23 11:58   ` Kishon Vijay Abraham I
2015-06-24 10:34   ` Roger Quadros
2015-06-24 10:34     ` Roger Quadros
2015-06-24 10:34     ` Roger Quadros
2015-06-24 13:16     ` Kishon Vijay Abraham I
2015-06-24 13:16       ` Kishon Vijay Abraham I
2015-06-24 13:16       ` Kishon Vijay Abraham I
2015-06-24 13:48       ` Roger Quadros
2015-06-24 13:48         ` Roger Quadros
2015-06-24 13:48         ` Roger Quadros
2015-06-23 11:58 ` [PATCH 04/17] phy: omap-usb2: use omap_usb_power_off to power off the PHY during probe Kishon Vijay Abraham I
2015-06-23 11:58   ` Kishon Vijay Abraham I
2015-06-23 11:58   ` Kishon Vijay Abraham I
2015-06-24 10:58   ` Roger Quadros
2015-06-24 10:58     ` Roger Quadros
2015-06-24 10:58     ` Roger Quadros
2015-06-23 11:58 ` [PATCH 05/17] phy: omap-usb2: Add a new compatible string for USB2 PHY2 Kishon Vijay Abraham I
2015-06-23 11:58   ` Kishon Vijay Abraham I
2015-06-23 11:58   ` Kishon Vijay Abraham I
2015-06-24 11:03   ` Roger Quadros
2015-06-24 11:03     ` Roger Quadros
2015-06-24 11:03     ` Roger Quadros
2015-06-24 13:21     ` Kishon Vijay Abraham I
2015-06-24 13:21       ` Kishon Vijay Abraham I
2015-06-24 13:21       ` Kishon Vijay Abraham I
2015-06-23 11:58 ` [PATCH 06/17] phy: omap-usb2: use *syscon* framework to power on/off the PHY Kishon Vijay Abraham I
2015-06-23 11:58   ` Kishon Vijay Abraham I
2015-06-23 11:58   ` Kishon Vijay Abraham I
2015-06-24 11:33   ` Roger Quadros
2015-06-24 11:33     ` Roger Quadros
2015-06-24 11:33     ` Roger Quadros
2015-06-24 12:59     ` Kishon Vijay Abraham I
2015-06-24 12:59       ` Kishon Vijay Abraham I
2015-06-24 12:59       ` Kishon Vijay Abraham I
2015-06-23 11:58 ` [PATCH 07/17] usb: musb: omap2430: use *syscon* framework to write to mailbox register Kishon Vijay Abraham I
2015-06-23 11:58   ` Kishon Vijay Abraham I
2015-06-23 11:58   ` Kishon Vijay Abraham I
2015-06-24 11:39   ` Roger Quadros
2015-06-24 11:39     ` Roger Quadros
2015-06-24 11:39     ` Roger Quadros
2015-06-24 13:21     ` Kishon Vijay Abraham I
2015-06-24 13:21       ` Kishon Vijay Abraham I
2015-06-24 13:21       ` Kishon Vijay Abraham I
2015-06-24 11:49   ` Tony Lindgren
2015-06-24 11:49     ` Tony Lindgren
2015-06-24 11:49     ` Tony Lindgren
2015-06-24 13:06     ` Kishon Vijay Abraham I
2015-06-24 13:06       ` Kishon Vijay Abraham I
2015-06-24 13:06       ` Kishon Vijay Abraham I
2015-06-23 11:58 ` [PATCH 08/17] ARM: dts: dra7: Add dt node for the sycon pcie Kishon Vijay Abraham I
2015-06-23 11:58   ` Kishon Vijay Abraham I
2015-06-23 11:58   ` Kishon Vijay Abraham I
2015-06-24 11:50   ` Roger Quadros
2015-06-24 11:50     ` Roger Quadros
2015-06-24 11:50     ` Roger Quadros
2015-06-24 11:56     ` Roger Quadros
2015-06-24 11:56       ` Roger Quadros
2015-06-24 11:56       ` Roger Quadros
2015-06-24 12:09       ` Tony Lindgren
2015-06-24 12:09         ` Tony Lindgren
2015-06-24 12:09         ` Tony Lindgren
2015-06-24 12:19         ` Roger Quadros
2015-06-24 12:19           ` Roger Quadros
2015-06-24 12:19           ` Roger Quadros
2015-06-24 12:49           ` Tony Lindgren
2015-06-24 12:49             ` Tony Lindgren
2015-06-24 12:49             ` Tony Lindgren
2015-06-24 13:30       ` Kishon Vijay Abraham I
2015-06-24 13:30         ` Kishon Vijay Abraham I
2015-06-24 13:30         ` Kishon Vijay Abraham I
2015-06-24 13:29     ` Kishon Vijay Abraham I
2015-06-24 13:29       ` Kishon Vijay Abraham I
2015-06-24 13:29       ` Kishon Vijay Abraham I
2015-06-23 11:58 ` [PATCH 09/17] ARM: dts: dra7: Use "syscon-phy-power" instead of "ctrl-module" in SATA PHY node Kishon Vijay Abraham I
2015-06-23 11:58   ` Kishon Vijay Abraham I
2015-06-23 11:58   ` Kishon Vijay Abraham I
2015-06-24 12:06   ` Roger Quadros
2015-06-24 12:06     ` Roger Quadros
2015-06-24 12:06     ` Roger Quadros
2015-06-24 12:12     ` Roger Quadros
2015-06-24 12:12       ` Roger Quadros
2015-06-24 12:12       ` Roger Quadros
2015-06-24 13:31       ` Kishon Vijay Abraham I
2015-06-24 13:31         ` Kishon Vijay Abraham I
2015-06-24 13:31         ` Kishon Vijay Abraham I
2015-06-23 11:58 ` [PATCH 10/17] ARM: dts: dra7: Use "syscon-phy-power" and "syscon-pcs" in PCIe " Kishon Vijay Abraham I
2015-06-23 11:58   ` Kishon Vijay Abraham I
2015-06-23 11:58   ` Kishon Vijay Abraham I
2015-06-23 11:58 ` [PATCH 11/17] ARM: dts: dra7: Use "ti,dra7x-usb2-phy2" compatible string for USB2 PHY2 Kishon Vijay Abraham I
2015-06-23 11:58   ` [PATCH 11/17] ARM: dts: dra7: Use "ti, dra7x-usb2-phy2" " Kishon Vijay Abraham I
2015-06-23 11:58   ` [PATCH 11/17] ARM: dts: dra7: Use "ti,dra7x-usb2-phy2" " Kishon Vijay Abraham I
2015-06-24 12:07   ` Roger Quadros
2015-06-24 12:07     ` Roger Quadros
2015-06-24 12:07     ` Roger Quadros
2015-06-24 13:10     ` Kishon Vijay Abraham I
2015-06-24 13:10       ` [PATCH 11/17] ARM: dts: dra7: Use "ti, dra7x-usb2-phy2" " Kishon Vijay Abraham I
2015-06-24 13:10       ` [PATCH 11/17] ARM: dts: dra7: Use "ti,dra7x-usb2-phy2" " Kishon Vijay Abraham I
2015-06-24 13:50       ` Roger Quadros
2015-06-24 13:50         ` Roger Quadros
2015-06-24 13:50         ` Roger Quadros
2015-06-23 11:58 ` [PATCH 12/17] ARM: dts: dra7: Use "syscon-phy-power" instead of "ctrl-module" in USB PHY node Kishon Vijay Abraham I
2015-06-23 11:58   ` Kishon Vijay Abraham I
2015-06-23 11:58   ` Kishon Vijay Abraham I
2015-06-23 11:58 ` [PATCH 13/17] ARM: dts: am4372: " Kishon Vijay Abraham I
2015-06-23 11:58   ` Kishon Vijay Abraham I
2015-06-23 11:58   ` Kishon Vijay Abraham I
2015-06-23 11:58 ` [PATCH 14/17] ARM: dts: OMAP5: " Kishon Vijay Abraham I
2015-06-23 11:58   ` Kishon Vijay Abraham I
2015-06-23 11:58   ` Kishon Vijay Abraham I
2015-06-23 11:59 ` [PATCH 15/17] ARM: dts: OMAP5: Use "syscon-phy-power" instead of "ctrl-module" in SATA " Kishon Vijay Abraham I
2015-06-23 11:59   ` Kishon Vijay Abraham I
2015-06-23 11:59   ` Kishon Vijay Abraham I
2015-06-23 11:59 ` [PATCH 16/17] ARM: dts: omap4: Use "syscon-phy-power" instead of "ctrl-module" in USB " Kishon Vijay Abraham I
2015-06-23 11:59   ` Kishon Vijay Abraham I
2015-06-23 11:59   ` Kishon Vijay Abraham I
2015-06-23 11:59 ` [PATCH 17/17] ARM: dts: omap4: Use "syscon-otghs" instead of "ctrl-module" in USB node Kishon Vijay Abraham I
2015-06-23 11:59   ` Kishon Vijay Abraham I
2015-06-23 11:59   ` Kishon Vijay Abraham I
2015-06-24 10:41   ` Tony Lindgren
2015-06-24 10:41     ` Tony Lindgren
2015-06-24 10:41     ` Tony Lindgren
2015-06-24 11:21     ` Kishon Vijay Abraham I
2015-06-24 11:21       ` Kishon Vijay Abraham I
2015-06-24 11:21       ` Kishon Vijay Abraham I
2015-06-24 11:46       ` Tony Lindgren
2015-06-24 11:46         ` Tony Lindgren
2015-06-24 11:46         ` Tony Lindgren
2015-06-24 12:02     ` Roger Quadros
2015-06-24 12:02       ` Roger Quadros
2015-06-24 12:02       ` Roger Quadros

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.