diff mbox

[U-Boot,2/3] Tegra30: fdt: Update DT files with I2C info for T30/Cardhu

Message ID 1356135399-28339-3-git-send-email-twarren@nvidia.com
State Accepted
Delegated to: Tom Warren
Headers show

Commit Message

Tom Warren Dec. 22, 2012, 12:16 a.m. UTC
Note that T30 does not have a separate/different DVC (power I2C)
controller like T20 - all 5 I2C controllers are identical, but
DVC_I2C is still used to designate the controller intended for
power control (PWR_I2C in the schematics). On Cardhu, it's used
to access the PMU and EEPROM, as well as the audio codec, temp
sensor, and fuel gauge devices from the OS.

Signed-off-by: Tom Warren <twarren@nvidia.com>
---
 arch/arm/dts/tegra30.dtsi           |   61 +++++++++++++++++++++++++++++++++++
 board/nvidia/dts/tegra30-cardhu.dts |   41 +++++++++++++++++++++++
 2 files changed, 102 insertions(+), 0 deletions(-)

Comments

Stephen Warren Jan. 2, 2013, 8:41 p.m. UTC | #1
On 12/21/2012 05:16 PM, Tom Warren wrote:
> Note that T30 does not have a separate/different DVC (power I2C)
> controller like T20 - all 5 I2C controllers are identical, but
> DVC_I2C is still used to designate the controller intended for
> power control (PWR_I2C in the schematics). On Cardhu, it's used
> to access the PMU and EEPROM, as well as the audio codec, temp
> sensor, and fuel gauge devices from the OS.

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

> +	tegra_car: clock@60006000 {
> +		compatible = "nvidia,tegra30-car", "nvidia,tegra20-car";
> +		reg = <0x60006000 0x1000>;
> +		#clock-cells = <1>;
> +	};
> +
> +	clocks {

It'd be nice to keep the DT nodes sorted in the same order they are in
the kernel. There, the rules are that nodes appears in order:

1) Any nodes from /include/d files, in the order they appeared in the
underlying file.

2) Any nodes with a reg property, in order of the address in the reg
property.

3) Any nodes without a reg property, in alphabetical order by node name.

This will allow the U-Boot and kernel DT files to be more easily
compared/diff'd.

The clocks and osc node would usually be part of the board file, not the
SoC file, I believe...

Actually, the clocks "osc" and (later) "clk_32k" don't appear to be used
anywhere; can we just drop their nodes until if/when they are?

> +	i2c@7000c000 {
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +		compatible = "nvidia,tegra30-i2c", "nvidia,tegra20-i2c";
> +		reg = <0x7000C000 0x100>;
> +		/* PERIPH_ID_I2C1, CLK_M */
> +		clocks = <&tegra_car 12>;
> +	};

I think we should use lower-case for all hex constants in the DT. Also,
can the properties appear in the same order as in the kernel DT files so
they're easier to compare/diff.

Also, the SoC .dtsi file should have status="disabled" for all the
optionally-used HW modules, and the board files set status="okay" for
those that the board actually uses.
Tom Warren Jan. 2, 2013, 8:58 p.m. UTC | #2
Alrightly. Can you send me a link to the latest-and-greatest
T30/Cardhu kernel DT files so I can use 'em as a reference? Every time
I do a Google search for kernel files I'm never sure if I've got the
latest one or not.

Thanks

On Wed, Jan 2, 2013 at 1:41 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> On 12/21/2012 05:16 PM, Tom Warren wrote:
>> Note that T30 does not have a separate/different DVC (power I2C)
>> controller like T20 - all 5 I2C controllers are identical, but
>> DVC_I2C is still used to designate the controller intended for
>> power control (PWR_I2C in the schematics). On Cardhu, it's used
>> to access the PMU and EEPROM, as well as the audio codec, temp
>> sensor, and fuel gauge devices from the OS.
>
>> diff --git a/arch/arm/dts/tegra30.dtsi b/arch/arm/dts/tegra30.dtsi
>
>> +     tegra_car: clock@60006000 {
>> +             compatible = "nvidia,tegra30-car", "nvidia,tegra20-car";
>> +             reg = <0x60006000 0x1000>;
>> +             #clock-cells = <1>;
>> +     };
>> +
>> +     clocks {
>
> It'd be nice to keep the DT nodes sorted in the same order they are in
> the kernel. There, the rules are that nodes appears in order:
>
> 1) Any nodes from /include/d files, in the order they appeared in the
> underlying file.
>
> 2) Any nodes with a reg property, in order of the address in the reg
> property.
>
> 3) Any nodes without a reg property, in alphabetical order by node name.
>
> This will allow the U-Boot and kernel DT files to be more easily
> compared/diff'd.
>
> The clocks and osc node would usually be part of the board file, not the
> SoC file, I believe...
>
> Actually, the clocks "osc" and (later) "clk_32k" don't appear to be used
> anywhere; can we just drop their nodes until if/when they are?
>
>> +     i2c@7000c000 {
>> +             #address-cells = <1>;
>> +             #size-cells = <0>;
>> +             compatible = "nvidia,tegra30-i2c", "nvidia,tegra20-i2c";
>> +             reg = <0x7000C000 0x100>;
>> +             /* PERIPH_ID_I2C1, CLK_M */
>> +             clocks = <&tegra_car 12>;
>> +     };
>
> I think we should use lower-case for all hex constants in the DT. Also,
> can the properties appear in the same order as in the kernel DT files so
> they're easier to compare/diff.
>
> Also, the SoC .dtsi file should have status="disabled" for all the
> optionally-used HW modules, and the board files set status="okay" for
> those that the board actually uses.
Stephen Warren Jan. 2, 2013, 9:10 p.m. UTC | #3
On 01/02/2013 01:58 PM, Tom Warren wrote:
> Alrightly. Can you send me a link to the latest-and-greatest
> T30/Cardhu kernel DT files so I can use 'em as a reference? Every time
> I do a Google search for kernel files I'm never sure if I've got the
> latest one or not.

The easiest way is probably:

git clone
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

cd linux-2.6/arch/arm/boot/dts

ls *cardhu*
diff mbox

Patch

diff --git a/arch/arm/dts/tegra30.dtsi b/arch/arm/dts/tegra30.dtsi
index f568d44..664c397 100644
--- a/arch/arm/dts/tegra30.dtsi
+++ b/arch/arm/dts/tegra30.dtsi
@@ -2,4 +2,65 @@ 
 
 / {
 	compatible = "nvidia,tegra30";
+
+	tegra_car: clock@60006000 {
+		compatible = "nvidia,tegra30-car", "nvidia,tegra20-car";
+		reg = <0x60006000 0x1000>;
+		#clock-cells = <1>;
+	};
+
+	clocks {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		osc: clock {
+			compatible = "fixed-clock";
+			#clock-cells = <0>;
+		};
+	};
+
+	i2c@7000c000 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "nvidia,tegra30-i2c", "nvidia,tegra20-i2c";
+		reg = <0x7000C000 0x100>;
+		/* PERIPH_ID_I2C1, CLK_M */
+		clocks = <&tegra_car 12>;
+	};
+
+	i2c@7000c400 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "nvidia,tegra30-i2c", "nvidia,tegra20-i2c";
+		reg = <0x7000C400 0x100>;
+		/* PERIPH_ID_I2C2, CLK_M */
+		clocks = <&tegra_car 54>;
+	};
+
+	i2c@7000c500 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "nvidia,tegra30-i2c", "nvidia,tegra20-i2c";
+		reg = <0x7000C500 0x100>;
+		/* PERIPH_ID_I2C3, CLK_M */
+		clocks = <&tegra_car 67>;
+	};
+
+	i2c@7000c700 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "nvidia,tegra30-i2c", "nvidia,tegra20-i2c";
+		reg = <0x7000C700 0x100>;
+		/* PERIPH_ID_I2C4, CLK_M */
+		clocks = <&tegra_car 103>;
+	};
+
+	i2c@7000d000 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "nvidia,tegra30-i2c", "nvidia,tegra20-i2c";
+		reg = <0x7000D000 0x100>;
+		/* PERIPH_ID_I2C_DVC, CLK_M */
+		clocks = <&tegra_car 47>;
+	};
 };
diff --git a/board/nvidia/dts/tegra30-cardhu.dts b/board/nvidia/dts/tegra30-cardhu.dts
index 2345766..4eddde6 100644
--- a/board/nvidia/dts/tegra30-cardhu.dts
+++ b/board/nvidia/dts/tegra30-cardhu.dts
@@ -6,8 +6,49 @@ 
 	model = "NVIDIA Cardhu";
 	compatible = "nvidia,cardhu", "nvidia,tegra30";
 
+	aliases {
+		i2c0 = "/i2c@7000d000";
+		i2c1 = "/i2c@7000c000";
+		i2c2 = "/i2c@7000c400";
+		i2c3 = "/i2c@7000c500";
+		i2c4 = "/i2c@7000c700";
+	};
+
 	memory {
 		device_type = "memory";
 		reg = <0x80000000 0x40000000>;
 	};
+
+	clocks {
+		clk_32k: clk_32K {
+			clock-frequency = <32768>;
+		};
+		osc {
+			clock-frequency = <12000000>;
+		};
+	};
+
+	clock@60006000 {
+		clocks = <&clk_32k &osc>;
+	};
+
+	i2c@7000c000 {
+		clock-frequency = <100000>;
+	};
+
+	i2c@7000c400 {
+		clock-frequency = <100000>;
+	};
+
+	i2c@7000c500 {
+		clock-frequency = <100000>;
+	};
+
+	i2c@7000c700 {
+		clock-frequency = <100000>;
+	};
+
+	i2c@7000d000 {
+		clock-frequency = <100000>;
+	};
 };