Patchwork [2/2] ARM: tegra: add clocks properties to USB PHY nodes

login
register
mail settings
Submitter Stephen Warren
Date Jan. 23, 2013, 12:28 a.m.
Message ID <1358900903-27654-2-git-send-email-swarren@wwwdotorg.org>
Download mbox | patch
Permalink /patch/214698/
State Accepted, archived
Headers show

Comments

Stephen Warren - Jan. 23, 2013, 12:28 a.m.
From: Stephen Warren <swarren@nvidia.com>

The patch to add USB PHY nodes to device tree was written before Tegra
supported the clocks property in device tree. Now that it does, add the
required clocks properties to these nodes.

This will allow all clk_get_sys() calls in tegra_usb_phy.c to be replaced
by clk_get(phy->dev, clock_name), as part of converting the PHY driver to
a platform driver.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 arch/arm/boot/dts/tegra20.dtsi |    6 ++++++
 1 file changed, 6 insertions(+)
Stephen Warren - Jan. 23, 2013, 12:33 a.m.
On 01/22/2013 05:28 PM, Stephen Warren wrote:
> The patch to add USB PHY nodes to device tree was written before Tegra
> supported the clocks property in device tree. Now that it does, add the
> required clocks properties to these nodes.
> 
> This will allow all clk_get_sys() calls in tegra_usb_phy.c to be replaced
> by clk_get(phy->dev, clock_name), as part of converting the PHY driver to
> a platform driver.

> diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi

> +		clocks = <&tegra_car 22>, <&tegra_car 127>;
> +		clock-names = "utmi", "pll_u";
...
> +		clocks = <&tegra_car 94>, <&tegra_car 127>;
> +		clock-names = "ulpi", "pll_u";

Hmmm. Thinking about that first clock more, if we name it just "phy" in
both the UTMI and ULPI PHY nodes, we could make tegra_phy_init() perform
the clk_get() for all PHY types, and use the same clock name everywhere,
and hence remove the type-specific clk_get()s from tegra_phy_init() and
utmip_pad_open().

Venu, will this work for other chips such as Tegra30/Tegra114 and so on
into the future, or do chips after Tegra20 introduce any new clocks, and
hence break this scheme?
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Venu Byravarasu - Jan. 23, 2013, 6:43 a.m.
> -----Original Message-----
> From: Stephen Warren [mailto:swarren@wwwdotorg.org]
> Sent: Wednesday, January 23, 2013 6:03 AM
> To: Venu Byravarasu
> Cc: Alan Stern; Greg Kroah-Hartman; linux-tegra@vger.kernel.org; linux-arm-
> kernel@lists.infradead.org; linux-usb@vger.kernel.org; Stephen Warren
> Subject: Re: [PATCH 2/2] ARM: tegra: add clocks properties to USB PHY nodes
> 
> On 01/22/2013 05:28 PM, Stephen Warren wrote:
> > The patch to add USB PHY nodes to device tree was written before Tegra
> > supported the clocks property in device tree. Now that it does, add the
> > required clocks properties to these nodes.
> >
> > This will allow all clk_get_sys() calls in tegra_usb_phy.c to be replaced
> > by clk_get(phy->dev, clock_name), as part of converting the PHY driver to
> > a platform driver.
> 
> > diff --git a/arch/arm/boot/dts/tegra20.dtsi
> b/arch/arm/boot/dts/tegra20.dtsi
> 
> > +		clocks = <&tegra_car 22>, <&tegra_car 127>;
> > +		clock-names = "utmi", "pll_u";
> ...
> > +		clocks = <&tegra_car 94>, <&tegra_car 127>;
> > +		clock-names = "ulpi", "pll_u";
> 
> Hmmm. Thinking about that first clock more, if we name it just "phy" in
> both the UTMI and ULPI PHY nodes, we could make tegra_phy_init() perform
> the clk_get() for all PHY types, and use the same clock name everywhere,
> and hence remove the type-specific clk_get()s from tegra_phy_init() and
> utmip_pad_open().
> 
> Venu, will this work for other chips such as Tegra30/Tegra114 and so on
> into the future, or do chips after Tegra20 introduce any new clocks, and
> hence break this scheme?
 
Should be fine, as same clocks are used across all chips.
Acked-by: Venu Byravarasu <vbyravarasu@nvidia.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stephen Warren - Jan. 23, 2013, 4:33 p.m.
On 01/22/2013 11:43 PM, Venu Byravarasu wrote:
> Stephen Warren wrote at Wednesday, January 23, 2013 6:03 AM:
>> On 01/22/2013 05:28 PM, Stephen Warren wrote:
>>> The patch to add USB PHY nodes to device tree was written before Tegra
>>> supported the clocks property in device tree. Now that it does, add the
>>> required clocks properties to these nodes.
>>>
>>> This will allow all clk_get_sys() calls in tegra_usb_phy.c to be replaced
>>> by clk_get(phy->dev, clock_name), as part of converting the PHY driver to
>>> a platform driver.
>>
>>> diff --git a/arch/arm/boot/dts/tegra20.dtsi
>> b/arch/arm/boot/dts/tegra20.dtsi
>>
>>> +		clocks = <&tegra_car 22>, <&tegra_car 127>;
>>> +		clock-names = "utmi", "pll_u";
>> ...
>>> +		clocks = <&tegra_car 94>, <&tegra_car 127>;
>>> +		clock-names = "ulpi", "pll_u";
>>
>> Hmmm. Thinking about that first clock more, if we name it just "phy" in
>> both the UTMI and ULPI PHY nodes, we could make tegra_phy_init() perform
>> the clk_get() for all PHY types, and use the same clock name everywhere,
>> and hence remove the type-specific clk_get()s from tegra_phy_init() and
>> utmip_pad_open().
>>
>> Venu, will this work for other chips such as Tegra30/Tegra114 and so on
>> into the future, or do chips after Tegra20 introduce any new clocks, and
>> hence break this scheme?
>  
> Should be fine, as same clocks are used across all chips.
> Acked-by: Venu Byravarasu <vbyravarasu@nvidia.com>

Thanks. I've applied both patches to Tegra's for-3.9/soc branch, with
patch 2/2 modified to name the first clock "phy" rather than "utmi" or
"ulpi".

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

Patch

diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi
index 2e9d1f0..d5e72ce 100644
--- a/arch/arm/boot/dts/tegra20.dtsi
+++ b/arch/arm/boot/dts/tegra20.dtsi
@@ -442,18 +442,24 @@ 
 		reg = <0xc5000400 0x3c00>;
 		phy_type = "utmi";
 		nvidia,has-legacy-mode;
+		clocks = <&tegra_car 22>, <&tegra_car 127>;
+		clock-names = "utmi", "pll_u";
 	};
 
 	phy2: usb-phy@c5004400 {
 		compatible = "nvidia,tegra20-usb-phy";
 		reg = <0xc5004400 0x3c00>;
 		phy_type = "ulpi";
+		clocks = <&tegra_car 94>, <&tegra_car 127>;
+		clock-names = "ulpi", "pll_u";
 	};
 
 	phy3: usb-phy@c5008400 {
 		compatible = "nvidia,tegra20-usb-phy";
 		reg = <0xc5008400 0x3C00>;
 		phy_type = "utmi";
+		clocks = <&tegra_car 22>, <&tegra_car 127>;
+		clock-names = "utmi", "pll_u";
 	};
 
 	usb@c5000000 {