Skip to contentSkip to conversation

phy: rockchip-usb: correct pll handling and usb-uart

PATCH Superseded Heiko Stuebner 4 participants 18 messages Nov 4, 2015 – Dec 5, 2015

Subsystems (5)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Heiko Stuebner

author maintainer
#0 lore raw

cover phy: rockchip-usb: correct pll handling and usb-uart

Patches 1-7 fix a long-standing issue with the clock-tree of Rockchip SoCs namely our ignorance of the usbphy-internal pll that creates the needed 480MHz but is also a supply-clock back to the core clock-controller in Rockchip SoCs.

Till now that was worked around using a virtual clock in the cru itself, but that is of course ignorant of other parts then disabling the phy behind the cru's back, thus breaking potential users of these clocks.

Patch 8, while not associated with the new pll handling, also builds on the groundwork introduced there and adds support for the function repurposing one of the phys as passthrough for uart-data. This enables attaching a ttl converter to the D+ and D- pins of an usb cable to receive uart data this way, when it is not really possible to attach a regular serial console to a board.

One point of critique in my first iteration [0] of this was, that due to when the reconfiguration happens we may miss parts of the logs when earlycon is enabled. So far early_initcall gets used as the unflattened devicetree is necessary to set this up. Doing this for example in the early_param directly would require parsing the flattened devicetree to get needed nodes and properties.

I still maintain that if you're working on anything before smp-bringup you should use a real dev-board instead or try to solder uart cables on hopefully available test-points :-) .

In any case, if patch 8 causes to much headache, it could be dropped to not hinder the earlier 7 patches.

[0] http://comments.gmane.org/gmane.linux.ports.arm.rockchip/715

Heiko Stuebner (8):
phy: rockchip-usb: fix clock get-put mismatch
phy: rockchip-usb: introduce a common data-struct for the device
phy: rockchip-usb: move per-phy init into a separate function
phy: rockchip-usb: expose the phy-internal PLLs
clk: rockchip: fix usbphy-related clocks
ARM: dts: rockchip: add clock-cells for usb phy nodes
ARM: dts: rockchip: assign usbphy480m_src to the new usbphy pll on
veyron
phy: rockchip-usb: add handler for usb-uart functionality

 .../devicetree/bindings/phy/rockchip-usb-phy.txt   |   6 +-
 Documentation/kernel-parameters.txt                |   6 +
 arch/arm/boot/dts/rk3066a.dtsi                     |   2 +
 arch/arm/boot/dts/rk3188.dtsi                      |   2 +
 arch/arm/boot/dts/rk3288-veyron.dtsi               |   2 +-
 arch/arm/boot/dts/rk3288.dtsi                      |   3 +
 drivers/clk/rockchip/clk-rk3188.c                  |  11 +-
 drivers/clk/rockchip/clk-rk3288.c                  |  16 +-
 drivers/phy/phy-rockchip-usb.c                     | 451 ++++++++++++++++++---
 9 files changed, 417 insertions(+), 82 deletions(-)
Signature · 1 line
2.6.2
author maintainer
#1 lore raw

PATCH 1/8 phy: rockchip-usb: fix clock get-put mismatch

Currently the phy driver only gets the optional clock reference but never puts it again, neither during error handling nor on remove. Fix that by moving the clk_put to a devm-action that gets called at the right time when all other devm actions are done.

---
 drivers/phy/phy-rockchip-usb.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/phy/phy-rockchip-usb.c +15 -0
index 91d6f34..dfc056b 100644
@@ -90,6 +90,14 @@ static const struct phy_ops ops = {
 	.owner		= THIS_MODULE,
 };
 
+static void rockchip_usb_phy_action(void *data)
+{
+	struct rockchip_usb_phy *rk_phy = data;
+
+	if (rk_phy->clk)
+		clk_put(rk_phy->clk);
+}
+
 static int rockchip_usb_phy_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
@@ -124,6 +132,13 @@ static int rockchip_usb_phy_probe(struct platform_device *pdev)
 		if (IS_ERR(rk_phy->clk))
 			rk_phy->clk = NULL;
 
+		err = devm_add_action(dev, rockchip_usb_phy_action, rk_phy);
+		if (err) {
+			if (rk_phy->clk)
+				clk_put(rk_phy->clk);
+			return err;
+		}
+
 		rk_phy->phy = devm_phy_create(dev, child, &ops);
 		if (IS_ERR(rk_phy->phy)) {
 			dev_err(dev, "failed to create PHY\n");
Signature · 1 line
2.6.2
author maintainer
#4 lore raw

PATCH 2/8 phy: rockchip-usb: introduce a common data-struct for the device

In reply to Heiko Stuebner

This introduces a common struct that holds data belonging to the umbrella device that contains all the phys and that we want to use later.

---
 drivers/phy/phy-rockchip-usb.c | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)
drivers/phy/phy-rockchip-usb.c +17 -7
index dfc056b..dda1994 100644
@@ -36,9 +36,14 @@
 #define SIDDQ_ON		BIT(13)
 #define SIDDQ_OFF		(0 << 13)
 
+struct rockchip_usb_phy_base {
+	struct device *dev;
+	struct regmap *reg_base;
+};
+
 struct rockchip_usb_phy {
+	struct rockchip_usb_phy_base *base;
 	unsigned int	reg_offset;
-	struct regmap	*reg_base;
 	struct clk	*clk;
 	struct phy	*phy;
 };
@@ -46,7 +51,7 @@ struct rockchip_usb_phy {
 static int rockchip_usb_phy_power(struct rockchip_usb_phy *phy,
 					   bool siddq)
 {
-	return regmap_write(phy->reg_base, phy->reg_offset,
+	return regmap_write(phy->base->reg_base, phy->reg_offset,
 			    SIDDQ_WRITE_ENA | (siddq ? SIDDQ_ON : SIDDQ_OFF));
 }
 
@@ -101,17 +106,23 @@ static void rockchip_usb_phy_action(void *data)
 static int rockchip_usb_phy_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
+	struct rockchip_usb_phy_base *phy_base;
 	struct rockchip_usb_phy *rk_phy;
 	struct phy_provider *phy_provider;
 	struct device_node *child;
-	struct regmap *grf;
 	unsigned int reg_offset;
 	int err;
 
-	grf = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,grf");
-	if (IS_ERR(grf)) {
+	phy_base = devm_kzalloc(dev, sizeof(*phy_base), GFP_KERNEL);
+	if (!phy_base)
+		return -ENOMEM;
+
+	phy_base->dev = dev;
+	phy_base->reg_base = syscon_regmap_lookup_by_phandle(dev->of_node,
+							     "rockchip,grf");
+	if (IS_ERR(phy_base->reg_base)) {
 		dev_err(&pdev->dev, "Missing rockchip,grf property\n");
-		return PTR_ERR(grf);
+		return PTR_ERR(phy_base->reg_base);
 	}
 
 	for_each_available_child_of_node(dev->of_node, child) {
@@ -126,7 +137,6 @@ static int rockchip_usb_phy_probe(struct platform_device *pdev)
 		}
 
 		rk_phy->reg_offset = reg_offset;
-		rk_phy->reg_base = grf;
 
 		rk_phy->clk = of_clk_get_by_name(child, "phyclk");
 		if (IS_ERR(rk_phy->clk))
Signature · 1 line
2.6.2
author maintainer
#7 lore raw

PATCH 3/8 phy: rockchip-usb: move per-phy init into a separate function

In reply to Heiko Stuebner

This unclutters the loop in probe a lot and makes current (and future) error handling easier to read.

---
 drivers/phy/phy-rockchip-usb.c | 82 ++++++++++++++++++++++++------------------
 1 file changed, 47 insertions(+), 35 deletions(-)
drivers/phy/phy-rockchip-usb.c +47 -35
index dda1994..f10e130 100644
@@ -103,14 +103,57 @@ static void rockchip_usb_phy_action(void *data)
 		clk_put(rk_phy->clk);
 }
 
+static int rockchip_usb_phy_init(struct rockchip_usb_phy_base *base,
+				 struct device_node *child)
+{
+	struct rockchip_usb_phy *rk_phy;
+	unsigned int reg_offset;
+	int err;
+
+	rk_phy = devm_kzalloc(base->dev, sizeof(*rk_phy), GFP_KERNEL);
+	if (!rk_phy)
+		return -ENOMEM;
+
+	rk_phy->base = base;
+
+	if (of_property_read_u32(child, "reg", &reg_offset)) {
+		dev_err(base->dev, "missing reg property in node %s\n",
+			child->name);
+		return -EINVAL;
+	}
+
+	rk_phy->reg_offset = reg_offset;
+
+	rk_phy->clk = of_clk_get_by_name(child, "phyclk");
+	if (IS_ERR(rk_phy->clk))
+		rk_phy->clk = NULL;
+
+	err = devm_add_action(base->dev, rockchip_usb_phy_action, rk_phy);
+	if (err)
+		goto err_devm_action;
+
+	rk_phy->phy = devm_phy_create(base->dev, child, &ops);
+	if (IS_ERR(rk_phy->phy)) {
+		dev_err(base->dev, "failed to create PHY\n");
+		return PTR_ERR(rk_phy->phy);
+	}
+	phy_set_drvdata(rk_phy->phy, rk_phy);
+
+	/* only power up usb phy when it use, so disable it when init*/
+	return rockchip_usb_phy_power(rk_phy, 1);
+
+err_devm_action:
+	if (rk_phy->clk)
+		clk_put(rk_phy->clk);
+	return err;
+}
+
 static int rockchip_usb_phy_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct rockchip_usb_phy_base *phy_base;
-	struct rockchip_usb_phy *rk_phy;
 	struct phy_provider *phy_provider;
 	struct device_node *child;
-	unsigned int reg_offset;
 	int err;
 
 	phy_base = devm_kzalloc(dev, sizeof(*phy_base), GFP_KERNEL);
@@ -126,39 +169,8 @@ static int rockchip_usb_phy_probe(struct platform_device *pdev)
 	}
 
 	for_each_available_child_of_node(dev->of_node, child) {
-		rk_phy = devm_kzalloc(dev, sizeof(*rk_phy), GFP_KERNEL);
-		if (!rk_phy)
-			return -ENOMEM;
-
-		if (of_property_read_u32(child, "reg", &reg_offset)) {
-			dev_err(dev, "missing reg property in node %s\n",
-				child->name);
-			return -EINVAL;
-		}
-
-		rk_phy->reg_offset = reg_offset;
-
-		rk_phy->clk = of_clk_get_by_name(child, "phyclk");
-		if (IS_ERR(rk_phy->clk))
-			rk_phy->clk = NULL;
-
-		err = devm_add_action(dev, rockchip_usb_phy_action, rk_phy);
-		if (err) {
-			if (rk_phy->clk)
-				clk_put(rk_phy->clk);
-			return err;
-		}
-
-		rk_phy->phy = devm_phy_create(dev, child, &ops);
-		if (IS_ERR(rk_phy->phy)) {
-			dev_err(dev, "failed to create PHY\n");
-			return PTR_ERR(rk_phy->phy);
-		}
-		phy_set_drvdata(rk_phy->phy, rk_phy);
-
-		/* only power up usb phy when it use, so disable it when init*/
-		err = rockchip_usb_phy_power(rk_phy, 1);
-		if (err)
+		err = rockchip_usb_phy_init(phy_base, child);
+		if (err < 0)
 			return err;
 	}
 
Signature · 1 line
2.6.2
author maintainer
#9 lore raw

PATCH 4/8 phy: rockchip-usb: expose the phy-internal PLLs

In reply to Heiko Stuebner

The USB phys on Rockchip SoCs contain their own internal PLLs to create the 480MHz needed. Additionally this PLL output is also fed back into the core clock-controller as possible source for clocks like the GPU or others.

Until now this was modelled incorrectly with a "virtual" factor clock in the clock controller. The one big caveat is that if we turn off the usb phy via the siddq signal, all analog components get turned off, including the PLLs. It is therefore possible that a source clock gets disabled without the clock driver ever knowing, possibly making the system hang.

Therefore register the phy-plls as real clocks that the clock driver can then reference again normally, making the clock hirarchy finally reflect the actual hardware.

The phy-ops get converted to simply turning that new clock on and off which in turn controls the siddq signal of the phy.

Through this the driver gains handling for platform-specific data, to handle the phy->clock name association.

---
 .../devicetree/bindings/phy/rockchip-usb-phy.txt   |   6 +-
 drivers/phy/phy-rockchip-usb.c                     | 177 ++++++++++++++++++---
 2 files changed, 160 insertions(+), 23 deletions(-)
Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt +5 -1
index 826454a..68498d5 100644
@@ -1,7 +1,10 @@
 ROCKCHIP USB2 PHY
 
 Required properties:
- - compatible: rockchip,rk3288-usb-phy
+ - compatible: matching the soc type, one of
+     "rockchip,rk3066a-usb-phy"
+     "rockchip,rk3188-usb-phy"
+     "rockchip,rk3288-usb-phy"
  - rockchip,grf : phandle to the syscon managing the "general
    register files"
  - #address-cells: should be 1
@@ -21,6 +24,7 @@ required properties:
 Optional Properties:
 - clocks : phandle + clock specifier for the phy clocks
 - clock-names: string, clock name, must be "phyclk"
+- #clock-cells: for users of the phy-pll, should be 0
 
 Example:
 
drivers/phy/phy-rockchip-usb.c +155 -22

276 lines not on this page · raw message

Signature · 1 line
2.6.2
author maintainer
#11 lore raw

PATCH 5/8 clk: rockchip: fix usbphy-related clocks

In reply to Heiko Stuebner

The otgphy clocks really only drive the phy blocks. These in turn contain plls that then generate the 480m clocks the clock controller uses to supply some other clocks like uart0, gpu or the video-codec.

So fix this structure to actually respect that hirarchy and removed that usb480m fixed-rate clock working as a placeholder till now, as this wouldn't even work if the supplying phy gets turned off while its pll-output gets used elsewhere.

---
 drivers/clk/rockchip/clk-rk3188.c | 11 +++--------
 drivers/clk/rockchip/clk-rk3288.c | 16 +++++-----------
 2 files changed, 8 insertions(+), 19 deletions(-)
drivers/clk/rockchip/clk-rk3188.c +3 -8
index abb4760..7836a97 100644
@@ -319,9 +319,9 @@ static struct rockchip_clk_branch common_clk_branches[] __initdata = {
 	 * the 480m are generated inside the usb block from these clocks,
 	 * but they are also a source for the hsicphy clock.
 	 */
-	GATE(SCLK_OTGPHY0, "sclk_otgphy0", "usb480m", CLK_IGNORE_UNUSED,
+	GATE(SCLK_OTGPHY0, "sclk_otgphy0", "xin24m", CLK_IGNORE_UNUSED,
 			RK2928_CLKGATE_CON(1), 5, GFLAGS),
-	GATE(SCLK_OTGPHY1, "sclk_otgphy1", "usb480m", CLK_IGNORE_UNUSED,
+	GATE(SCLK_OTGPHY1, "sclk_otgphy1", "xin24m", CLK_IGNORE_UNUSED,
 			RK2928_CLKGATE_CON(1), 6, GFLAGS),
 
 	COMPOSITE(0, "mac_src", mux_mac_p, 0,
@@ -635,7 +635,7 @@ static struct clk_div_table div_rk3188_aclk_core_t[] = {
 	{ /* sentinel */ },
 };
 
-PNAME(mux_hsicphy_p)		= { "sclk_otgphy0", "sclk_otgphy1",
+PNAME(mux_hsicphy_p)		= { "sclk_otgphy0_480m", "sclk_otgphy1_480m",
 				    "gpll", "cpll" };
 
 static struct rockchip_clk_branch rk3188_clk_branches[] __initdata = {
@@ -739,11 +739,6 @@ static void __init rk3188_common_clk_init(struct device_node *np)
 		pr_warn("%s: could not register clock xin12m: %ld\n",
 			__func__, PTR_ERR(clk));
 
-	clk = clk_register_fixed_factor(NULL, "usb480m", "xin24m", 0, 20, 1);
-	if (IS_ERR(clk))
-		pr_warn("%s: could not register clock usb480m: %ld\n",
-			__func__, PTR_ERR(clk));
-
 	rockchip_clk_register_branches(common_clk_branches,
 				  ARRAY_SIZE(common_clk_branches));
 
drivers/clk/rockchip/clk-rk3288.c +5 -11
index 9040878..7c8a3e9 100644
@@ -195,8 +195,8 @@ PNAME(mux_hsadcout_p)	= { "hsadc_src", "ext_hsadc" };
 PNAME(mux_edp_24m_p)	= { "ext_edp_24m", "xin24m" };
 PNAME(mux_tspout_p)	= { "cpll", "gpll", "npll", "xin27m" };
 
-PNAME(mux_usbphy480m_p)		= { "sclk_otgphy1", "sclk_otgphy2",
-				    "sclk_otgphy0" };
+PNAME(mux_usbphy480m_p)		= { "sclk_otgphy1_480m", "sclk_otgphy2_480m",
+				    "sclk_otgphy0_480m" };
 PNAME(mux_hsicphy480m_p)	= { "cpll", "gpll", "usbphy480m_src" };
 PNAME(mux_hsicphy12m_p)		= { "hsicphy12m_xin12m", "hsicphy12m_usbphy" };
 
@@ -506,11 +506,11 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = {
 			RK3288_CLKSEL_CON(35), 6, 2, MFLAGS, 0, 5, DFLAGS,
 			RK3288_CLKGATE_CON(4), 10, GFLAGS),
 
-	GATE(SCLK_OTGPHY0, "sclk_otgphy0", "usb480m", CLK_IGNORE_UNUSED,
+	GATE(SCLK_OTGPHY0, "sclk_otgphy0", "xin24m", CLK_IGNORE_UNUSED,
 			RK3288_CLKGATE_CON(13), 4, GFLAGS),
-	GATE(SCLK_OTGPHY1, "sclk_otgphy1", "usb480m", CLK_IGNORE_UNUSED,
+	GATE(SCLK_OTGPHY1, "sclk_otgphy1", "xin24m", CLK_IGNORE_UNUSED,
 			RK3288_CLKGATE_CON(13), 5, GFLAGS),
-	GATE(SCLK_OTGPHY2, "sclk_otgphy2", "usb480m", CLK_IGNORE_UNUSED,
+	GATE(SCLK_OTGPHY2, "sclk_otgphy2", "xin24m", CLK_IGNORE_UNUSED,
 			RK3288_CLKGATE_CON(13), 6, GFLAGS),
 	GATE(SCLK_OTG_ADP, "sclk_otg_adp", "xin32k", CLK_IGNORE_UNUSED,
 			RK3288_CLKGATE_CON(13), 7, GFLAGS),
@@ -874,12 +874,6 @@ static void __init rk3288_clk_init(struct device_node *np)
 		pr_warn("%s: could not register clock xin12m: %ld\n",
 			__func__, PTR_ERR(clk));
 
-
-	clk = clk_register_fixed_factor(NULL, "usb480m", "xin24m", 0, 20, 1);
-	if (IS_ERR(clk))
-		pr_warn("%s: could not register clock usb480m: %ld\n",
-			__func__, PTR_ERR(clk));
-
 	clk = clk_register_fixed_factor(NULL, "hclk_vcodec_pre",
 					"hclk_vcodec_pre_v", 0, 1, 4);
 	if (IS_ERR(clk))
Signature · 1 line
2.6.2
author maintainer
#14 lore raw

PATCH 6/8 ARM: dts: rockchip: add clock-cells for usb phy nodes

In reply to Heiko Stuebner

Add the #clock-cells properties for the usbphy nodes as they provide the pll-clocks now.

---
 arch/arm/boot/dts/rk3066a.dtsi | 2 ++
 arch/arm/boot/dts/rk3188.dtsi  | 2 ++
 arch/arm/boot/dts/rk3288.dtsi  | 3 +++
 3 files changed, 7 insertions(+)
arch/arm/boot/dts/rk3066a.dtsi +2 -0
index 946f187..3e4b41b 100644
@@ -181,6 +181,7 @@
 			reg = <0x17c>;
 			clocks = <&cru SCLK_OTGPHY0>;
 			clock-names = "phyclk";
+			#clock-cells = <0>;
 		};
 
 		usbphy1: usb-phy1 {
@@ -188,6 +189,7 @@
 			reg = <0x188>;
 			clocks = <&cru SCLK_OTGPHY1>;
 			clock-names = "phyclk";
+			#clock-cells = <0>;
 		};
 	};
 
arch/arm/boot/dts/rk3188.dtsi +2 -0
index 6399942..48a287e 100644
@@ -156,6 +156,7 @@
 			reg = <0x10c>;
 			clocks = <&cru SCLK_OTGPHY0>;
 			clock-names = "phyclk";
+			#clock-cells = <0>;
 		};
 
 		usbphy1: usb-phy1 {
@@ -163,6 +164,7 @@
 			reg = <0x11c>;
 			clocks = <&cru SCLK_OTGPHY1>;
 			clock-names = "phyclk";
+			#clock-cells = <0>;
 		};
 	};
 
arch/arm/boot/dts/rk3288.dtsi +3 -0
index c64a116..51a5d29 100644
@@ -943,6 +943,7 @@
 			reg = <0x320>;
 			clocks = <&cru SCLK_OTGPHY0>;
 			clock-names = "phyclk";
+			#clock-cells = <0>;
 		};
 
 		usbphy1: usb-phy1 {
@@ -950,6 +951,7 @@
 			reg = <0x334>;
 			clocks = <&cru SCLK_OTGPHY1>;
 			clock-names = "phyclk";
+			#clock-cells = <0>;
 		};
 
 		usbphy2: usb-phy2 {
@@ -957,6 +959,7 @@
 			reg = <0x348>;
 			clocks = <&cru SCLK_OTGPHY2>;
 			clock-names = "phyclk";
+			#clock-cells = <0>;
 		};
 	};
 
Signature · 1 line
2.6.2
author maintainer
#16 lore raw

PATCH 7/8 ARM: dts: rockchip: assign usbphy480m_src to the new usbphy pll on veyron

In reply to Heiko Stuebner

Veyron devices try to always set the source for usbphy480m to the usbphy0 that is the phy connected to the otg controller, because the firmware- default is usbphy1, the ehci-controller connected to the internal camera that might get turned off way easier to save power.

In the mainline kernel we currently don't use the usbphy480m_src at all, as it mainly powers the uart0 source that is connected to the bluetooth component of the wifi/bt combo.

So move that assignment over to the new real pll clock inside the usbphy.

---
 arch/arm/boot/dts/rk3288-veyron.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/rk3288-veyron.dtsi +1 -1
index d4263ed..c8329b5 100644
@@ -410,7 +410,7 @@
 	status = "okay";
 
 	assigned-clocks = <&cru SCLK_USBPHY480M_SRC>;
-	assigned-clock-parents = <&cru SCLK_OTGPHY0>;
+	assigned-clock-parents = <&usbphy0>;
 	dr_mode = "host";
 };
 
Signature · 1 line
2.6.2
author maintainer
#17 lore raw

PATCH 8/8 phy: rockchip-usb: add handler for usb-uart functionality

In reply to Heiko Stuebner

Most newer Rockchip SoCs provide the possibility to use a usb-phy as passthrough for the debug uart (uart2), making it possible to for example get console output without needing to open the device.

This patch adds an early_initcall to enable this functionality conditionally via the commandline and also disables the corresponding usb controller in the devicetree.

Currently only data for the rk3288 is provided, but at least the rk3188 and arm64 rk3368 also provide this functionality and will be enabled later.

On a spliced usb cable the signals are tx on white wire(D+) and rx on green wire(D-).

The one caveat is that currently the reconfiguration of the phy happens as early_initcall, as the code depends on the unflattened devicetree being available. Everything is fine if only a regular console is active as the console-replay will happen after the reconfiguation. But with earlycon active output up to smp-init currently will get lost.

The phy is an optional property for the connected dwc2 controller, so we still provide the phy device but fail all phy-ops with -EBUSY to make sure the dwc2 does not try to transmit anything on the repurposed phy.

---
 Documentation/kernel-parameters.txt |   6 +
 drivers/phy/phy-rockchip-usb.c      | 231 ++++++++++++++++++++++++++++++------
 2 files changed, 201 insertions(+), 36 deletions(-)
Documentation/kernel-parameters.txt +6 -0
index c6dd5f3..8d9a86e 100644
@@ -3370,6 +3370,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 
 	ro		[KNL] Mount root device read-only on boot
 
+	rockchip.usb_uart
+			Enable the uart passthrough on the designated usb port
+			on Rockchip SoCs. When active, the signals of the
+			debug-uart get routed to the D+ and D- pins of the usb
+			port and the regular usb controller gets disabled.
+
 	root=		[KNL] Root filesystem
 			See name_to_dev_t comment in init/do_mounts.c.
 
drivers/phy/phy-rockchip-usb.c +195 -36

318 lines not on this page · raw message

Signature · 1 line
2.6.2
Reviewed-by on v1 1/8
#2 lore raw

Re: [PATCH 1/8] phy: rockchip-usb: fix clock get-put mismatch

In reply to Heiko Stuebner

Heiko

Quoted 9 lines · Heiko Stuebner

Currently the phy driver only gets the optional clock reference but never puts it again, neither during error handling nor on remove. Fix that by moving the clk_put to a devm-action that gets called at the right time when all other devm actions are done.

---
 drivers/phy/phy-rockchip-usb.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
#5 lore raw

Re: [PATCH 2/8] phy: rockchip-usb: introduce a common data-struct for the device

In reply to Heiko Stuebner

Hi,

Quoted 67 lines · Heiko Stuebner

This introduces a common struct that holds data belonging to the umbrella device that contains all the phys and that we want to use later.

---
 drivers/phy/phy-rockchip-usb.c | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)
drivers/phy/phy-rockchip-usb.c +17 -6
index dfc056b..dda1994 100644
@@ -36,9 +36,14 @@
 #define SIDDQ_ON               BIT(13)
 #define SIDDQ_OFF              (0 << 13)
 
+struct rockchip_usb_phy_base {
+       struct device *dev;
+       struct regmap *reg_base;
+};
+
 struct rockchip_usb_phy {
+       struct rockchip_usb_phy_base *base;
        unsigned int    reg_offset;
-       struct regmap   *reg_base;
        struct clk      *clk;
        struct phy      *phy;
 };
@@ -46,7 +51,7 @@ struct rockchip_usb_phy {
 static int rockchip_usb_phy_power(struct rockchip_usb_phy *phy,
                                           bool siddq)
 {
-       return regmap_write(phy->reg_base, phy->reg_offset,
+       return regmap_write(phy->base->reg_base, phy->reg_offset,
                            SIDDQ_WRITE_ENA | (siddq ? SIDDQ_ON : SIDDQ_OFF));
 }
 
@@ -101,17 +106,23 @@ static void rockchip_usb_phy_action(void *data)
 static int rockchip_usb_phy_probe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
+       struct rockchip_usb_phy_base *phy_base;
        struct rockchip_usb_phy *rk_phy;
        struct phy_provider *phy_provider;
        struct device_node *child;
-       struct regmap *grf;
        unsigned int reg_offset;
        int err;
 
-       grf = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,grf");
-       if (IS_ERR(grf)) {
+       phy_base = devm_kzalloc(dev, sizeof(*phy_base), GFP_KERNEL);
+       if (!phy_base)
+               return -ENOMEM;
+
+       phy_base->dev = dev;
+       phy_base->reg_base = syscon_regmap_lookup_by_phandle(dev->of_node,
+                                                            "rockchip,grf");
+       if (IS_ERR(phy_base->reg_base)) {
                dev_err(&pdev->dev, "Missing rockchip,grf property\n");
-               return PTR_ERR(grf);
+               return PTR_ERR(phy_base->reg_base);
        }
 
        for_each_available_child_of_node(dev->of_node, child) {

drivers/phy/phy-rockchip-usb.c static int rockchip_usb_phy_probe(struct platform_device *pdev) · line 129

Quoted 4 lines
drivers/phy/phy-rockchip-usb.c +0 -1
@@ -126,7 +137,6 @@ static int rockchip_usb_phy_probe(struct platform_device *pdev)
                }
 
                rk_phy->reg_offset = reg_offset;
-               rk_phy->reg_base = grf;

I'm probably missing something, but I would have expected a line line:

  rk_phy->base = phy_base;

Otherwise how does "base" get assigned? Ah, I see. You forgot it in this patch and then cheated and slipped it in in patch #3. ;) For nice bisectability it probably belongs here, too...

-Doug

Reviewed-by on v1 3/8
#8 lore raw

Re: [PATCH 3/8] phy: rockchip-usb: move per-phy init into a separate function

In reply to Heiko Stuebner

Heiko,

Quoted 27 lines · Heiko Stuebner
        for_each_available_child_of_node(dev->of_node, child) {
drivers/phy/phy-rockchip-usb.c +0 -26
-               rk_phy = devm_kzalloc(dev, sizeof(*rk_phy), GFP_KERNEL);
-               if (!rk_phy)
-                       return -ENOMEM;
-
-               if (of_property_read_u32(child, "reg", &reg_offset)) {
-                       dev_err(dev, "missing reg property in node %s\n",
-                               child->name);
-                       return -EINVAL;
-               }
-
-               rk_phy->reg_offset = reg_offset;
-
-               rk_phy->clk = of_clk_get_by_name(child, "phyclk");
-               if (IS_ERR(rk_phy->clk))
-                       rk_phy->clk = NULL;
-
-               err = devm_add_action(dev, rockchip_usb_phy_action, rk_phy);
-               if (err) {
-                       if (rk_phy->clk)
-                               clk_put(rk_phy->clk);
-                       return err;
-               }
-
-               rk_phy->phy = devm_phy_create(dev, child, &ops);
-               if (IS_ERR(rk_phy->phy)) {
-                       dev_err(dev, "failed to create PHY\n");

drivers/phy/phy-rockchip-usb.c static int rockchip_usb_phy_probe(struct platform_device *pdev) · line 174

Quoted 10 lines
drivers/phy/phy-rockchip-usb.c +2 -7
-                       return PTR_ERR(rk_phy->phy);
-               }
-               phy_set_drvdata(rk_phy->phy, rk_phy);
-
-               /* only power up usb phy when it use, so disable it when init*/
-               err = rockchip_usb_phy_power(rk_phy, 1);
-               if (err)
+               err = rockchip_usb_phy_init(phy_base, child);
+               if (err < 0)
                        return err;

You've also included the minor unrelated tweak to check for erorrs with "err < 0" rather than "err" that has the incredibly small chance to affect behavior, making this not a 100% noop change.

I don't personally care that much since it's terribly unlikely to affect anything. ...but you get a 1-line better diffstat if you don't change it and it's unlikely to matter much either way...

-Doug

author maintainer
#6 lore raw

Re: [PATCH 2/8] phy: rockchip-usb: introduce a common data-struct for the device

In reply to Doug Anderson

Am Mittwoch, 4. November 2015, 15:46:04 schrieb Doug Anderson:

Quoted 77 lines

Hi,

Quoted 67 lines · Heiko Stuebner

This introduces a common struct that holds data belonging to the umbrella device that contains all the phys and that we want to use later.

---
 drivers/phy/phy-rockchip-usb.c | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)
drivers/phy/phy-rockchip-usb.c +17 -6
index dfc056b..dda1994 100644
@@ -36,9 +36,14 @@
 #define SIDDQ_ON               BIT(13)
 #define SIDDQ_OFF              (0 << 13)
 
+struct rockchip_usb_phy_base {
+       struct device *dev;
+       struct regmap *reg_base;
+};
+
 struct rockchip_usb_phy {
+       struct rockchip_usb_phy_base *base;
        unsigned int    reg_offset;
-       struct regmap   *reg_base;
        struct clk      *clk;
        struct phy      *phy;
 };
@@ -46,7 +51,7 @@ struct rockchip_usb_phy {
 static int rockchip_usb_phy_power(struct rockchip_usb_phy *phy,
                                           bool siddq)
 {
-       return regmap_write(phy->reg_base, phy->reg_offset,
+       return regmap_write(phy->base->reg_base, phy->reg_offset,
                            SIDDQ_WRITE_ENA | (siddq ? SIDDQ_ON : SIDDQ_OFF));
 }
 
@@ -101,17 +106,23 @@ static void rockchip_usb_phy_action(void *data)
 static int rockchip_usb_phy_probe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
+       struct rockchip_usb_phy_base *phy_base;
        struct rockchip_usb_phy *rk_phy;
        struct phy_provider *phy_provider;
        struct device_node *child;
-       struct regmap *grf;
        unsigned int reg_offset;
        int err;
 
-       grf = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,grf");
-       if (IS_ERR(grf)) {
+       phy_base = devm_kzalloc(dev, sizeof(*phy_base), GFP_KERNEL);
+       if (!phy_base)
+               return -ENOMEM;
+
+       phy_base->dev = dev;
+       phy_base->reg_base = syscon_regmap_lookup_by_phandle(dev->of_node,
+                                                            "rockchip,grf");
+       if (IS_ERR(phy_base->reg_base)) {
                dev_err(&pdev->dev, "Missing rockchip,grf property\n");
-               return PTR_ERR(grf);
+               return PTR_ERR(phy_base->reg_base);
        }
 
        for_each_available_child_of_node(dev->of_node, child) {

drivers/phy/phy-rockchip-usb.c static int rockchip_usb_phy_probe(struct platform_device *pdev) · line 129

Quoted 4 lines
drivers/phy/phy-rockchip-usb.c +0 -1
@@ -126,7 +137,6 @@ static int rockchip_usb_phy_probe(struct platform_device *pdev)
                }
 
                rk_phy->reg_offset = reg_offset;
-               rk_phy->reg_base = grf;

I'm probably missing something, but I would have expected a line line:

Quoted 5 lines
  rk_phy->base = phy_base;

Otherwise how does "base" get assigned? Ah, I see. You forgot it in this patch and then cheated and slipped it in in patch #3. ;) For nice bisectability it probably belongs here, too...

Thanks for that catch and yep, it should definitly be here too. While I did a compile-test for the individual steps, I guess I did not do runtime tests for each.

I guess this is what happens when you try to separate a final work into separate steps :-) . I'll send a revised version hopefully tomorrow.

Heiko

#3 lore raw

Re: [PATCH 1/8] phy: rockchip-usb: fix clock get-put mismatch

In reply to Heiko Stuebner

Hi,

Quoted 30 lines · Heiko Stuebner

Currently the phy driver only gets the optional clock reference but never puts it again, neither during error handling nor on remove. Fix that by moving the clk_put to a devm-action that gets called at the right time when all other devm actions are done.

---
 drivers/phy/phy-rockchip-usb.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/phy/phy-rockchip-usb.c +8 -0
index 91d6f34..dfc056b 100644
@@ -90,6 +90,14 @@ static const struct phy_ops ops = {
 	.owner		= THIS_MODULE,
 };
 
+static void rockchip_usb_phy_action(void *data)
+{
+	struct rockchip_usb_phy *rk_phy = data;
+
+	if (rk_phy->clk)
+		clk_put(rk_phy->clk);
+}
+
 static int rockchip_usb_phy_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;

drivers/phy/phy-rockchip-usb.c static int rockchip_usb_phy_probe(struct platform_device *pdev) · line 138

Quoted 7 lines
drivers/phy/phy-rockchip-usb.c +4 -0
@@ -124,6 +132,13 @@ static int rockchip_usb_phy_probe(struct platform_device *pdev)
 		if (IS_ERR(rk_phy->clk))
 			rk_phy->clk = NULL;
 
+		err = devm_add_action(dev, rockchip_usb_phy_action, rk_phy);
+		if (err) {
+			if (rk_phy->clk)
+				clk_put(rk_phy->clk);

If devm_add_action is added before clk_get this check wouldn't be required at all.

Thanks
Kishon

#10 lore raw

Re: [PATCH 4/8] phy: rockchip-usb: expose the phy-internal PLLs

In reply to Heiko Stuebner

Hi,

Quoted 31 lines · Heiko Stuebner

The USB phys on Rockchip SoCs contain their own internal PLLs to create the 480MHz needed. Additionally this PLL output is also fed back into the core clock-controller as possible source for clocks like the GPU or others.

Until now this was modelled incorrectly with a "virtual" factor clock in the clock controller. The one big caveat is that if we turn off the usb phy via the siddq signal, all analog components get turned off, including the PLLs. It is therefore possible that a source clock gets disabled without the clock driver ever knowing, possibly making the system hang.

Therefore register the phy-plls as real clocks that the clock driver can then reference again normally, making the clock hirarchy finally reflect the actual hardware.

The phy-ops get converted to simply turning that new clock on and off which in turn controls the siddq signal of the phy.

Through this the driver gains handling for platform-specific data, to handle the phy->clock name association.

---
 .../devicetree/bindings/phy/rockchip-usb-phy.txt   |   6 +-
 drivers/phy/phy-rockchip-usb.c                     | 177 ++++++++++++++++++---
 2 files changed, 160 insertions(+), 23 deletions(-)
Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt +0 -0
index 826454a..68498d5 100644

Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt line 7

Quoted 8 lines
Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt +4 -1
@@ -1,7 +1,10 @@
 ROCKCHIP USB2 PHY
 
 Required properties:
- - compatible: rockchip,rk3288-usb-phy
+ - compatible: matching the soc type, one of
+     "rockchip,rk3066a-usb-phy"
+     "rockchip,rk3188-usb-phy"
+     "rockchip,rk3288-usb-phy"

Looks like this adds driver support for new SoC? Maybe create a separate patch for that?

Quoted 53 lines
Documentation/devicetree/bindings/phy/rockchip-usb-phy.txt +1 -0
  - rockchip,grf : phandle to the syscon managing the "general
    register files"
  - #address-cells: should be 1
@@ -21,6 +24,7 @@ required properties:
 Optional Properties:
 - clocks : phandle + clock specifier for the phy clocks
 - clock-names: string, clock name, must be "phyclk"
+- #clock-cells: for users of the phy-pll, should be 0
 
 Example:
 
drivers/phy/phy-rockchip-usb.c +13 -0
index f10e130..509497b 100644
@@ -15,12 +15,14 @@
  */
 
 #include <linux/clk.h>
+#include <linux/clk-provider.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/mutex.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
+#include <linux/of_platform.h>
 #include <linux/phy/phy.h>
 #include <linux/platform_device.h>
 #include <linux/regulator/consumer.h>
@@ -36,18 +38,35 @@
 #define SIDDQ_ON		BIT(13)
 #define SIDDQ_OFF		(0 << 13)
 
+struct rockchip_usb_phys {
+	int reg;
+	const char *pll_name;
+};
+
+struct rockchip_usb_phy_pdata {
+	struct rockchip_usb_phys *phys;
+};
+
 struct rockchip_usb_phy_base {
 	struct device *dev;
 	struct regmap *reg_base;
+	const struct rockchip_usb_phy_pdata *pdata;
 };
 
 struct rockchip_usb_phy {
 	struct rockchip_usb_phy_base *base;
+	struct device_node *np;
 	unsigned int	reg_offset;

drivers/phy/phy-rockchip-usb.c line 69

Quoted 10 lines
drivers/phy/phy-rockchip-usb.c +6 -0
 	struct clk	*clk;
+	struct clk      *clk480m;
+	struct clk_hw	clk480m_hw;
 	struct phy	*phy;
 };
 
+/*
+ * Set siddq to 1 to power down usb phy analog blocks,
+ * set to 0 to enable.
+ */

Not related to $patch.

drivers/phy/phy-rockchip-usb.c static int rockchip_usb_phy_power(struct rockchip_usb_phy *phy, · line 75

Quoted 6 lines
drivers/phy/phy-rockchip-usb.c +0 -0
 static int rockchip_usb_phy_power(struct rockchip_usb_phy *phy,
 					   bool siddq)
 {
@@ -55,17 +74,57 @@ static int rockchip_usb_phy_power(struct rockchip_usb_phy *phy,
 			    SIDDQ_WRITE_ENA | (siddq ? SIDDQ_ON : SIDDQ_OFF));
 }

Thanks
Kishon

Acked-by on v1 5/8
#12 lore raw

RE: [PATCH 5/8] clk: rockchip: fix usbphy-related clocks

In reply to Heiko Stuebner
Quoted 10 lines · Heiko Stuebner

The otgphy clocks really only drive the phy blocks. These in turn contain plls that then generate the 480m clocks the clock controller uses to supply some other clocks like uart0, gpu or the video-codec.

So fix this structure to actually respect that hirarchy and removed that usb480m fixed-rate clock working as a placeholder till now, as this wouldn't even work if the supplying phy gets turned off while its pll-output gets used elsewhere.

Quoted 88 lines
---
 drivers/clk/rockchip/clk-rk3188.c | 11 +++--------
 drivers/clk/rockchip/clk-rk3288.c | 16 +++++-----------
 2 files changed, 8 insertions(+), 19 deletions(-)
drivers/clk/rockchip/clk-rk3188.c +3 -8
index abb4760..7836a97 100644
@@ -319,9 +319,9 @@ static struct rockchip_clk_branch common_clk_branches[] __initdata = {
 	 * the 480m are generated inside the usb block from these clocks,
 	 * but they are also a source for the hsicphy clock.
 	 */
-	GATE(SCLK_OTGPHY0, "sclk_otgphy0", "usb480m", CLK_IGNORE_UNUSED,
+	GATE(SCLK_OTGPHY0, "sclk_otgphy0", "xin24m", CLK_IGNORE_UNUSED,
 			RK2928_CLKGATE_CON(1), 5, GFLAGS),
-	GATE(SCLK_OTGPHY1, "sclk_otgphy1", "usb480m", CLK_IGNORE_UNUSED,
+	GATE(SCLK_OTGPHY1, "sclk_otgphy1", "xin24m", CLK_IGNORE_UNUSED,
 			RK2928_CLKGATE_CON(1), 6, GFLAGS),
 
 	COMPOSITE(0, "mac_src", mux_mac_p, 0,
@@ -635,7 +635,7 @@ static struct clk_div_table div_rk3188_aclk_core_t[] = {
 	{ /* sentinel */ },
 };
 
-PNAME(mux_hsicphy_p)		= { "sclk_otgphy0", "sclk_otgphy1",
+PNAME(mux_hsicphy_p)		= { "sclk_otgphy0_480m", "sclk_otgphy1_480m",
 				    "gpll", "cpll" };
 
 static struct rockchip_clk_branch rk3188_clk_branches[] __initdata = {
@@ -739,11 +739,6 @@ static void __init rk3188_common_clk_init(struct device_node *np)
 		pr_warn("%s: could not register clock xin12m: %ld\n",
 			__func__, PTR_ERR(clk));
 
-	clk = clk_register_fixed_factor(NULL, "usb480m", "xin24m", 0, 20, 1);
-	if (IS_ERR(clk))
-		pr_warn("%s: could not register clock usb480m: %ld\n",
-			__func__, PTR_ERR(clk));
-
 	rockchip_clk_register_branches(common_clk_branches,
 				  ARRAY_SIZE(common_clk_branches));
 
drivers/clk/rockchip/clk-rk3288.c +5 -11
index 9040878..7c8a3e9 100644
@@ -195,8 +195,8 @@ PNAME(mux_hsadcout_p)	= { "hsadc_src", "ext_hsadc" };
 PNAME(mux_edp_24m_p)	= { "ext_edp_24m", "xin24m" };
 PNAME(mux_tspout_p)	= { "cpll", "gpll", "npll", "xin27m" };
 
-PNAME(mux_usbphy480m_p)		= { "sclk_otgphy1", "sclk_otgphy2",
-				    "sclk_otgphy0" };
+PNAME(mux_usbphy480m_p)		= { "sclk_otgphy1_480m", "sclk_otgphy2_480m",
+				    "sclk_otgphy0_480m" };
 PNAME(mux_hsicphy480m_p)	= { "cpll", "gpll", "usbphy480m_src" };
 PNAME(mux_hsicphy12m_p)		= { "hsicphy12m_xin12m", "hsicphy12m_usbphy" };
 
@@ -506,11 +506,11 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = {
 			RK3288_CLKSEL_CON(35), 6, 2, MFLAGS, 0, 5, DFLAGS,
 			RK3288_CLKGATE_CON(4), 10, GFLAGS),
 
-	GATE(SCLK_OTGPHY0, "sclk_otgphy0", "usb480m", CLK_IGNORE_UNUSED,
+	GATE(SCLK_OTGPHY0, "sclk_otgphy0", "xin24m", CLK_IGNORE_UNUSED,
 			RK3288_CLKGATE_CON(13), 4, GFLAGS),
-	GATE(SCLK_OTGPHY1, "sclk_otgphy1", "usb480m", CLK_IGNORE_UNUSED,
+	GATE(SCLK_OTGPHY1, "sclk_otgphy1", "xin24m", CLK_IGNORE_UNUSED,
 			RK3288_CLKGATE_CON(13), 5, GFLAGS),
-	GATE(SCLK_OTGPHY2, "sclk_otgphy2", "usb480m", CLK_IGNORE_UNUSED,
+	GATE(SCLK_OTGPHY2, "sclk_otgphy2", "xin24m", CLK_IGNORE_UNUSED,
 			RK3288_CLKGATE_CON(13), 6, GFLAGS),
 	GATE(SCLK_OTG_ADP, "sclk_otg_adp", "xin32k", CLK_IGNORE_UNUSED,
 			RK3288_CLKGATE_CON(13), 7, GFLAGS),
@@ -874,12 +874,6 @@ static void __init rk3288_clk_init(struct device_node *np)
 		pr_warn("%s: could not register clock xin12m: %ld\n",
 			__func__, PTR_ERR(clk));
 
-
-	clk = clk_register_fixed_factor(NULL, "usb480m", "xin24m", 0, 20, 1);
-	if (IS_ERR(clk))
-		pr_warn("%s: could not register clock usb480m: %ld\n",
-			__func__, PTR_ERR(clk));
-
 	clk = clk_register_fixed_factor(NULL, "hclk_vcodec_pre",
 					"hclk_vcodec_pre_v", 0, 1, 4);
 	if (IS_ERR(clk))
Signature · 1 line
2.6.2
Reviewed-by on v1 6/8
#15 lore raw

RE: [PATCH 6/8] ARM: dts: rockchip: add clock-cells for usb phy nodes

In reply to Heiko Stuebner
Quoted 4 lines · Heiko Stuebner

Add the #clock-cells properties for the usbphy nodes as they provide the pll-clocks now.

Quoted 77 lines
---
 arch/arm/boot/dts/rk3066a.dtsi | 2 ++
 arch/arm/boot/dts/rk3188.dtsi  | 2 ++
 arch/arm/boot/dts/rk3288.dtsi  | 3 +++
 3 files changed, 7 insertions(+)
arch/arm/boot/dts/rk3066a.dtsi +2 -0
index 946f187..3e4b41b 100644
@@ -181,6 +181,7 @@
 			reg = <0x17c>;
 			clocks = <&cru SCLK_OTGPHY0>;
 			clock-names = "phyclk";
+			#clock-cells = <0>;
 		};
 
 		usbphy1: usb-phy1 {
@@ -188,6 +189,7 @@
 			reg = <0x188>;
 			clocks = <&cru SCLK_OTGPHY1>;
 			clock-names = "phyclk";
+			#clock-cells = <0>;
 		};
 	};
 
arch/arm/boot/dts/rk3188.dtsi +2 -0
index 6399942..48a287e 100644
@@ -156,6 +156,7 @@
 			reg = <0x10c>;
 			clocks = <&cru SCLK_OTGPHY0>;
 			clock-names = "phyclk";
+			#clock-cells = <0>;
 		};
 
 		usbphy1: usb-phy1 {
@@ -163,6 +164,7 @@
 			reg = <0x11c>;
 			clocks = <&cru SCLK_OTGPHY1>;
 			clock-names = "phyclk";
+			#clock-cells = <0>;
 		};
 	};
 
arch/arm/boot/dts/rk3288.dtsi +3 -0
index c64a116..51a5d29 100644
@@ -943,6 +943,7 @@
 			reg = <0x320>;
 			clocks = <&cru SCLK_OTGPHY0>;
 			clock-names = "phyclk";
+			#clock-cells = <0>;
 		};
 
 		usbphy1: usb-phy1 {
@@ -950,6 +951,7 @@
 			reg = <0x334>;
 			clocks = <&cru SCLK_OTGPHY1>;
 			clock-names = "phyclk";
+			#clock-cells = <0>;
 		};
 
 		usbphy2: usb-phy2 {
@@ -957,6 +959,7 @@
 			reg = <0x348>;
 			clocks = <&cru SCLK_OTGPHY2>;
 			clock-names = "phyclk";
+			#clock-cells = <0>;
 		};
 	};
 
Signature · 1 line
2.6.2
author maintainer Acked-by Michael Turquette Reviewed-by Michael Turquette
#13 lore raw

Re: [PATCH 5/8] clk: rockchip: fix usbphy-related clocks

In reply to Michael Turquette

Hi Mike

Am Freitag, 4. Dezember 2015, 16:07:23 schrieb Michael Turquette:

Quoted 5 lines
Quoted 4 lines · Heiko Stuebner

The otgphy clocks really only drive the phy blocks. These in turn contain plls that then generate the 480m clocks the clock controller uses to supply some other clocks like uart0, gpu or the video-codec.

Quoted 8 lines
Quoted 6 lines

So fix this structure to actually respect that hirarchy and removed that usb480m fixed-rate clock working as a placeholder till now, as this wouldn't even work if the supplying phy gets turned off while its pll-output gets used elsewhere.

Thanks for Ack + Review, but it seems you found a slightly old version in your inbox :-)

So right new we have,

- [PATCH 5/8] clk: rockchip: fix usbphy-related clocks

- [PATCH 6/8] ARM: dts: rockchip: add clock-cells for usb phy nodes

which should translate nicely to the two equivalent patches in v3:
[PATCH v3 6/8] ARM: dts: rockchip: add clock-cells for usb phy nodes [PATCH v3 7/8] clk: rockchip: fix usbphy-related clocks

but I guess Kishon, was also looking for an Ack on the usbphy-code actually exposing these clocks in
[PATCH v3 5/8] phy: rockchip-usb: expose the phy-internal PLLs

If you could also take a look at that patch, I would be glad :-)

Thanks
Heiko