Skip to contentSkip to conversation

Add I2C driver for T114 Dalmore

PATCH Superseded Tom Warren 4 participants 27 messages Feb 6, 2013 – Feb 12, 2013

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Tom Warren

author
#0 lore raw

v2 cover Add I2C driver for T114 Dalmore

Update DT tables and enable I2C driver support for the Tegra114 Dalmore board. This uses the standard Tegra I2C driver. 5 controllers are supported, although all may not have devices behind them on every board.

Changes in V2:
- use new calculation for T114 I2C clocks
- incorporate review comments from StephenW for the dtsi file

Tom Warren (3):
Tegra: I2C: Add T114 clock support to tegra_i2c driver
Tegra114: fdt: Update DT files with I2C info for T114/Dalmore
Tegra114: I2C: Enable I2C driver on Dalmore E1611 eval board

 arch/arm/dts/tegra114.dtsi                  |   56 +++++++++++++++++++++++++++
 arch/arm/include/asm/arch-tegra/tegra_i2c.h |    6 +++
 board/nvidia/dts/tegra114-dalmore.dts       |   33 ++++++++++++++++
 drivers/i2c/tegra_i2c.c                     |   22 ++++++++++-
 include/configs/dalmore.h                   |    9 ++++
 include/configs/tegra114-common.h           |    3 +
 6 files changed, 128 insertions(+), 1 deletions(-)
author
#1 lore raw

PATCH v2 1/3 Tegra: I2C: Add T114 clock support to tegra_i2c driver

T114 has a slightly different I2C clock, with a new divisor for standard/fast mode and HS mode. Tested on my Dalmore, and the I2C clock is 100KHz +/- 3% on my Saleae Logic analyzer.

---
v2: new

 arch/arm/include/asm/arch-tegra/tegra_i2c.h |    6 ++++++
 drivers/i2c/tegra_i2c.c                     |   22 +++++++++++++++++++++-
 2 files changed, 27 insertions(+), 1 deletions(-)
arch/arm/include/asm/arch-tegra/tegra_i2c.h +6 -0
index 2650744..853e59b 100644
@@ -105,6 +105,7 @@ struct i2c_ctlr {
 	u32 sl_delay_count;		/* 3C: I2C_I2C_SL_DELAY_COUNT */
 	u32 reserved_2[4];		/* 40: */
 	struct i2c_control control;	/* 50 ~ 68 */
+	u32 clk_div;			/* 6C: I2C_I2C_CLOCK_DIVISOR */
 };
 
 /* bit fields definitions for IO Packet Header 1 format */
@@ -154,6 +155,11 @@ struct i2c_ctlr {
 #define I2C_INT_ARBITRATION_LOST_SHIFT	2
 #define I2C_INT_ARBITRATION_LOST_MASK	(1 << I2C_INT_ARBITRATION_LOST_SHIFT)
 
+/* I2C_CLK_DIVISOR_REGISTER */
+#define CLK_DIV_STD_FAST_MODE		0x19
+#define CLK_DIV_HS_MODE			1
+#define CLK_MULT_STD_FAST_MODE		8
+
 /**
  * Returns the bus number of the DVC controller
  *
drivers/i2c/tegra_i2c.c +21 -1
index efc77fa..0558648 100644
@@ -88,7 +88,27 @@ static void i2c_init_controller(struct i2c_bus *i2c_bus)
 	 * 16 to get the right frequency.
 	 */
 	clock_start_periph_pll(i2c_bus->periph_id, CLOCK_ID_PERIPH,
-			       i2c_bus->speed * 2 * 8);
+		i2c_bus->speed * 2 * 8);
+#if defined(CONFIG_TEGRA114)
+	/*
+	 * T114 I2C went to a single clock source for standard/fast and
+	 * HS clock speeds. The new clock rate setting calculation is:
+	 *  SCL = CLK_SOURCE.I2C /
+	 *   (CLK_MULT_STD_FAST_MODE * (I2C_CLK_DIV_STD_FAST_MODE+1) *
+	 *   I2C FREQUENCY DIVISOR) as per the T114 TRM (sec 30.3.1).
+	 *
+	 * NOTE: We do this here, after the initial clock/pll start,
+	 * because if we read the clk_div reg before the controller
+	 * is running, we hang, and we need it for the new calc.
+	 */
+	int clk_div_std_fast_mode = readl(&i2c_bus->regs->clk_div) >> 16;
+	debug("%s: CLK_DIV_STD_FAST_MODE setting = %d\n", __func__,
+		clk_div_std_fast_mode);
+
+	clock_start_periph_pll(i2c_bus->periph_id, CLOCK_ID_PERIPH,
+		CLK_MULT_STD_FAST_MODE * (clk_div_std_fast_mode+1) *
+		i2c_bus->speed * 2);
+#endif	/* T114 */
 
 	/* Reset I2C controller. */
 	i2c_reset_controller(i2c_bus);
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH v2 1/3 Tegra: I2C: Add T114 clock support to tegra_i2c driver

Quoted 3 lines · Tom Warren

T114 has a slightly different I2C clock, with a new divisor for standard/fast mode and HS mode. Tested on my Dalmore, and the I2C clock is 100KHz +/- 3% on my Saleae Logic analyzer.

This looks plausible to me, but best to have Laxman review it since he's the I2C expert. I'll forward the whole original message to him for this purpose.

At least for me though,

#3 lore raw

PATCH v2 1/3 Tegra: I2C: Add T114 clock support to tegra_i2c driver

In reply to Tom Warren
Quoted 7 lines · Tom Warren

T114 has a slightly different I2C clock, with a new divisor for standard/fast mode and HS mode. Tested on my Dalmore, and the I2C clock is 100KHz +/- 3% on my Saleae Logic analyzer.

---

Changes looks good.

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

#4 lore raw

PATCH v2 1/3 Tegra: I2C: Add T114 clock support to tegra_i2c driver

In reply to Tom Warren

drivers/i2c/tegra_i2c.c static void i2c_init_controller(struct i2c_bus *i2c_bus) · line 91

Quoted 12 lines · Tom Warren

T114 has a slightly different I2C clock, with a new divisor for standard/fast mode and HS mode. Tested on my Dalmore, and the I2C clock is 100KHz +/- 3% on my Saleae Logic analyzer.

---
v2: new

*/
clock_start_periph_pll(i2c_bus->periph_id, CLOCK_ID_PERIPH,

drivers/i2c/tegra_i2c.c +1 -1
-			       i2c_bus->speed * 2 * 8);
+		i2c_bus->speed * 2 * 8);

I think you do not need to multipled by 2 again here. *2 can be remove. I2C clock divder is U16 type.

drivers/i2c/tegra_i2c.c static void i2c_init_controller(struct i2c_bus *i2c_bus) · line 110

Quoted 6 lines
drivers/i2c/tegra_i2c.c +4 -0
+
+	clock_start_periph_pll(i2c_bus->periph_id, CLOCK_ID_PERIPH,
+		CLK_MULT_STD_FAST_MODE * (clk_div_std_fast_mode+1) *
+		i2c_bus->speed * 2);

Same as above, *2 is not required.

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

author
#5 lore raw

PATCH v2 1/3 Tegra: I2C: Add T114 clock support to tegra_i2c driver

Laxman,

Quoted 24 lines · Laxman Dewangan
Quoted 12 lines · Tom Warren

T114 has a slightly different I2C clock, with a new divisor for standard/fast mode and HS mode. Tested on my Dalmore, and the I2C clock is 100KHz +/- 3% on my Saleae Logic analyzer.

---
v2: new

         */
        clock_start_periph_pll(i2c_bus->periph_id, CLOCK_ID_PERIPH,

drivers/i2c/tegra_i2c.c static void i2c_init_controller(struct i2c_bus *i2c_bus) · line 91

Quoted 2 lines
drivers/i2c/tegra_i2c.c +1 -1
-                              i2c_bus->speed * 2 * 8);
+               i2c_bus->speed * 2 * 8);

I think you do not need to multipled by 2 again here. *2 can be remove. I2C clock divder is U16 type.

Quoted 1 line
Quoted 7 lines

drivers/i2c/tegra_i2c.c static void i2c_init_controller(struct i2c_bus *i2c_bus) · line 110

Quoted 4 lines
drivers/i2c/tegra_i2c.c +4 -0
+
+       clock_start_periph_pll(i2c_bus->periph_id, CLOCK_ID_PERIPH,
+               CLK_MULT_STD_FAST_MODE * (clk_div_std_fast_mode+1) *
+               i2c_bus->speed * 2);

Same as above, *2 is not required.

I measured the I2C clock on J51 (GEN1_I2C) on my Dalmore, and the clock is indeed 100KHz (+/- 3 Hz).

Tom

Quoted 12 lines

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

author
#6 lore raw

PATCH v2 2/3 Tegra114: fdt: Update DT files with I2C info for T114/Dalmore

In reply to Tom Warren

Note that T114 does not have a separate/different DVC (power I2C) controller like T20 - all 5 I2C controllers are identical, but I2C5 is used to designate the controller intended for power control (PWR_I2C in the schematics).

---
v2: Match dts files with kernel files, remove unused apdma node

 arch/arm/dts/tegra114.dtsi            |   56 +++++++++++++++++++++++++++++++++
 board/nvidia/dts/tegra114-dalmore.dts |   33 +++++++++++++++++++
 2 files changed, 89 insertions(+), 0 deletions(-)
arch/arm/dts/tegra114.dtsi +56 -0
index d06cd12..7b0c835 100644
@@ -2,4 +2,60 @@
 
 / {
 	compatible = "nvidia,tegra114";
+
+	tegra_car: clock at 60006000 {
+		compatible = "nvidia,tegra114-car, nvidia,tegra30-car";
+		reg = <0x60006000 0x1000>;
+		#clock-cells = <1>;
+	};
+
+	i2c at 7000c000 {
+		compatible = "nvidia,tegra114-i2c", "nvidia,tegra20-i2c";
+		reg = <0x7000c000 0x100>;
+		interrupts = <0 38 0x04>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		clocks = <&tegra_car 12>;
+		status = "disabled";
+	};
+
+	i2c at 7000c400 {
+		compatible = "nvidia,tegra114-i2c", "nvidia,tegra20-i2c";
+		reg = <0x7000c400 0x100>;
+		interrupts = <0 84 0x04>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		clocks = <&tegra_car 54>;
+		status = "disabled";
+	};
+
+	i2c at 7000c500 {
+		compatible = "nvidia,tegra114-i2c", "nvidia,tegra20-i2c";
+		reg = <0x7000c500 0x100>;
+		interrupts = <0 92 0x04>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		clocks = <&tegra_car 67>;
+		status = "disabled";
+	};
+
+	i2c at 7000c700 {
+		compatible = "nvidia,tegra114-i2c", "nvidia,tegra20-i2c";
+		reg = <0x7000c700 0x100>;
+		interrupts = <0 120 0x04>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		clocks = <&tegra_car 103>;
+		status = "disabled";
+	};
+
+	i2c at 7000d000 {
+		compatible = "nvidia,tegra114-i2c", "nvidia,tegra20-i2c";
+		reg = <0x7000d000 0x100>;
+		interrupts = <0 53 0x04>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		clocks = <&tegra_car 47>;
+		status = "disabled";
+	};
 };
board/nvidia/dts/tegra114-dalmore.dts +33 -0
index 7315577..13b07f3 100644
@@ -6,8 +6,41 @@
 	model = "NVIDIA Dalmore";
 	compatible = "nvidia,dalmore", "nvidia,tegra114";
 
+	aliases {
+		i2c0 = "/i2c at 7000d000";
+		i2c1 = "/i2c at 7000c000";
+		i2c2 = "/i2c at 7000c400";
+		i2c3 = "/i2c at 7000c500";
+		i2c4 = "/i2c at 7000c700";
+	};
+
 	memory {
 		device_type = "memory";
 		reg = <0x80000000 0x80000000>;
 	};
+
+	i2c at 7000c000 {
+		status = "okay";
+		clock-frequency = <100000>;
+	};
+
+	i2c at 7000c400 {
+		status = "okay";
+		clock-frequency = <100000>;
+	};
+
+	i2c at 7000c500 {
+		status = "okay";
+		clock-frequency = <100000>;
+	};
+
+	i2c at 7000c700 {
+		status = "okay";
+		clock-frequency = <100000>;
+	};
+
+	i2c at 7000d000 {
+		status = "okay";
+		clock-frequency = <100000>;
+	};
 };
Signature · 1 line
1.7.0.4
#7 lore raw

PATCH v2 2/3 Tegra114: fdt: Update DT files with I2C info for T114/Dalmore

arch/arm/dts/tegra114.dtsi line 7

Quoted 9 lines · Tom Warren

Note that T114 does not have a separate/different DVC (power I2C) controller like T20 - all 5 I2C controllers are identical, but I2C5 is used to designate the controller intended for power control (PWR_I2C in the schematics).

arch/arm/dts/tegra114.dtsi +2 -0
 
+	tegra_car: clock at 60006000 {
+		compatible = "nvidia,tegra114-car, nvidia,tegra30-car";

Only the Tegra114 value should be listed here; the presence of the Tegra30 value in the upstream kernel is a mistake that will be fixed as part of the Tegra114 clock driver patches.

arch/arm/dts/tegra114.dtsi

Quoted 2 lines
arch/arm/dts/tegra114.dtsi +2 -0
+	i2c at 7000c000 {
+		compatible = "nvidia,tegra114-i2c", "nvidia,tegra20-i2c";

Same here; only include the Tegra114 value since the HW isn't 100% compatible with the Tegra20 HW.

board/nvidia/dts/tegra114-dalmore.dts line 45

Quoted 6 lines
board/nvidia/dts/tegra114-dalmore.dts +4 -0
 
+	i2c at 7000d000 {
+		status = "okay";
+		clock-frequency = <100000>;
+	};

According to our downstream Linux kernel, that I2C controller can run up to 400KHz on this board.

author
#8 lore raw

PATCH v2 2/3 Tegra114: fdt: Update DT files with I2C info for T114/Dalmore

Stephen,

Quoted 6 lines · Stephen Warren
Quoted 4 lines · Tom Warren

Note that T114 does not have a separate/different DVC (power I2C) controller like T20 - all 5 I2C controllers are identical, but I2C5 is used to designate the controller intended for power control (PWR_I2C in the schematics).

Quoted 8 lines

arch/arm/dts/tegra114.dtsi line 7

Quoted 4 lines
arch/arm/dts/tegra114.dtsi +2 -0
 
+     tegra_car: clock at 60006000 {
+             compatible = "nvidia,tegra114-car, nvidia,tegra30-car";

Only the Tegra114 value should be listed here; the presence of the Tegra30 value in the upstream kernel is a mistake that will be fixed as part of the Tegra114 clock driver patches.

OK. But this is why I think hewing to the Linux DT files, while laudable, is a time sink. Though since T114 is so new & still settling in, I guess some churn is expected.

Quoted 6 lines

arch/arm/dts/tegra114.dtsi

Quoted 3 lines
arch/arm/dts/tegra114.dtsi +2 -0
+     i2c at 7000c000 {
+             compatible = "nvidia,tegra114-i2c", "nvidia,tegra20-i2c";

Same here; only include the Tegra114 value since the HW isn't 100% compatible with the Tegra20 HW.

What does the 'compatible' designater mean, exactly? Does it require 100% identical HW? Compatible, in a SW/HW sense, to me means that newer SW will work with older/similar (but not exactly the same) HW, etc.

Tegra U-Boot uses the "tegra20-i2c" name to find and load the I2C driver. I could add a new entry in the compat-names table for tegra114-i2c, but I still don't think there's enough difference between T20/T30 and T114 I2C to justify a whole new I2C driver - so far, it's just one register with a new clk divider that has to be taken in consideration when programming the clock source divider.

I could do as the driver does for T20, where there is a separate DVC controller, plus 3 normal I2C controllers. I could 'find_aliases' for the tegrat114-i2c controller first, process its nodes, and return. If no tegrat114-i2c exists, the driver would continue on to look for tegra20-i2c/tegra20-dvc controller info as it does now. It'd still be one tegra_i2c.c driver, with a flag in the i2c_bus struct telling me if I found T114 I2C HW (i2c_bus->single_clk, etc.) and I could then do the new clock divider dance based on that flag. How does that sound?

Quoted 11 lines

board/nvidia/dts/tegra114-dalmore.dts line 45

Quoted 7 lines
board/nvidia/dts/tegra114-dalmore.dts +4 -0
 
+     i2c at 7000d000 {
+             status = "okay";
+             clock-frequency = <100000>;
+     };

According to our downstream Linux kernel, that I2C controller can run up to 400KHz on this board.

But it also runs @ 100KHz just fine, too. Do we need to run at the fastest clock? That's the DVC (PWR_I2C) controller, which U-Boot does little to nothing with right now.

I can set it to 400KHz, but what are the advantages/justifications? Is anything wrong with leaving it at 100KHz?

Tom

#9 lore raw

PATCH v2 2/3 Tegra114: fdt: Update DT files with I2C info for T114/Dalmore

Quoted 14 lines · Tom Warren

Stephen,

Quoted 11 lines · Stephen Warren
Quoted 9 lines · Tom Warren

Note that T114 does not have a separate/different DVC (power I2C) controller like T20 - all 5 I2C controllers are identical, but I2C5 is used to designate the controller intended for power control (PWR_I2C in the schematics).

arch/arm/dts/tegra114.dtsi +2 -0
 
+     tegra_car: clock at 60006000 {
+             compatible = "nvidia,tegra114-car, nvidia,tegra30-car";
Quoted 7 lines
Quoted 3 lines

Only the Tegra114 value should be listed here; the presence of the Tegra30 value in the upstream kernel is a mistake that will be fixed as part of the Tegra114 clock driver patches.

OK. But this is why I think hewing to the Linux DT files, while laudable, is a time sink. Though since T114 is so new & still settling in, I guess some churn is expected.

The issue here is not about making U-Boot fall in line with the kernel. The issue is making the device tree in U-Boot be correct. Right now, the kernel happens to have the most correct device tree, so it's a good reference for U-Boot.

Quoted 10 lines
Quoted 5 lines

arch/arm/dts/tegra114.dtsi

Quoted 2 lines
arch/arm/dts/tegra114.dtsi +2 -0
+     i2c at 7000c000 {
+             compatible = "nvidia,tegra114-i2c", "nvidia,tegra20-i2c";

Same here; only include the Tegra114 value since the HW isn't 100% compatible with the Tegra20 HW.

What does the 'compatible' designater mean, exactly? Does it require 100% identical HW? Compatible, in a SW/HW sense, to me means that newer SW will work with older/similar (but not exactly the same) HW, etc.

The idea here is that the first entry in compatible always defines the most specific implementation identification possible. So, compatible will at least contain:

Tegra20: nvidia,tegra20-i2c
Tegra30: nvidia,tegra30-i2c
Tegra114: nvidia,tegra114-i2c

Now, if a piece of newer hardware can be operated 100% correctly (ignoring issues due to new features not being exposed, or operating at degraded performance) by a driver that only knows about the older hardware, then the compatible property can additionally contain other values indicating what HW it is compatible with. So, we actually end up with:

Tegra20: nvidia,tegra20-i2c
Tegra30: nvidia,tegra30-i2c nvidia,tegra20-i2c
Tegra114: nvidia,tegra114-i2c

Tegra114 I2C HW isn't marked as compatible with either Tegra20 or Tegra30, because the clock divider programming must be different.

Quoted 3 lines

Tegra U-Boot uses the "tegra20-i2c" name to find and load the I2C driver. I could add a new entry in the compat-names table for tegra114-i2c,

Yes, that is the way to go. The driver should include a list of all the different compatible values that it supports.

Quoted 4 lines

but I still don't think there's enough difference between T20/T30 and T114 I2C to justify a whole new I2C driver - so far, it's just one register with a new clk divider that has to be taken in consideration when programming the clock source divider.

But that's required to operate the hardware correctly. It doesn't matter how trivial the difference is; it could just be a single bit that needs to be set/cleared on new HW - there would still be a difference that would otherwise make the HW operate incorrectly.

Quoted 8 lines

I could do as the driver does for T20, where there is a separate DVC controller, plus 3 normal I2C controllers. I could 'find_aliases' for the tegrat114-i2c controller first, process its nodes, and return. If no tegrat114-i2c exists, the driver would continue on to look for tegra20-i2c/tegra20-dvc controller info as it does now. It'd still be one tegra_i2c.c driver, with a flag in the i2c_bus struct telling me if I found T114 I2C HW (i2c_bus->single_clk, etc.) and I could then do the new clock divider dance based on that flag. How does that sound?

The U-Boot function that returns the list of devices supported by the driver should be enhanced so that it can search for nodes compatible with any 1 (or more) of n compatible values at a time, rather than just a single compatible value. Then, all you'd have to do with this change is add a new entry into the table, not add extra code that calls that function separately for each compatible value.

Quoted 10 lines
Quoted 9 lines

board/nvidia/dts/tegra114-dalmore.dts line 45

Quoted 6 lines
board/nvidia/dts/tegra114-dalmore.dts +4 -0
 
+     i2c at 7000d000 {
+             status = "okay";
+             clock-frequency = <100000>;
+     };

According to our downstream Linux kernel, that I2C controller can run up to 400KHz on this board.

Quoted 6 lines

But it also runs @ 100KHz just fine, too. Do we need to run at the fastest clock? That's the DVC (PWR_I2C) controller, which U-Boot does little to nothing with right now.

I can set it to 400KHz, but what are the advantages/justifications? Is anything wrong with leaving it at 100KHz?

The device tree is about describing the hardware. The hardware can run at 400KHz, so the device tree should accurately describe this. It's simply a matter of correctness, rather than randomly filling in something that happens to work.

One practical advantage here is increased boot speed due to I2C accesses taking less time. The advantage might be small here since we probably don't configure too many regulators in U-Boot, but I bet Simon Glass is counting every uS.

And again, if/when we can ever use the same DT for U-Boot and the kernel, this needs to be corrected so the kernel isn't forced to run at a reduced speed for some reason. The kernel sends many many more commands to the PMIC, and many are time-sensitive (e.g. CPU voltage bus adjustments for DVFS).

#10 lore raw

PATCH v2 2/3 Tegra114: fdt: Update DT files with I2C info for T114/Dalmore

Hi Stephen,

Quoted 87 lines · Stephen Warren
Quoted 14 lines · Tom Warren

Stephen,

Quoted 11 lines · Stephen Warren
Quoted 9 lines · Tom Warren

Note that T114 does not have a separate/different DVC (power I2C) controller like T20 - all 5 I2C controllers are identical, but I2C5 is used to designate the controller intended for power control (PWR_I2C in the schematics).

arch/arm/dts/tegra114.dtsi +2 -0
 
+     tegra_car: clock at 60006000 {
+             compatible = "nvidia,tegra114-car, nvidia,tegra30-car";
Quoted 7 lines
Quoted 3 lines

Only the Tegra114 value should be listed here; the presence of the Tegra30 value in the upstream kernel is a mistake that will be fixed as part of the Tegra114 clock driver patches.

OK. But this is why I think hewing to the Linux DT files, while laudable, is a time sink. Though since T114 is so new & still settling in, I guess some churn is expected.

The issue here is not about making U-Boot fall in line with the kernel. The issue is making the device tree in U-Boot be correct. Right now, the kernel happens to have the most correct device tree, so it's a good reference for U-Boot.

Quoted 10 lines
Quoted 5 lines

arch/arm/dts/tegra114.dtsi

Quoted 2 lines
arch/arm/dts/tegra114.dtsi +2 -0
+     i2c at 7000c000 {
+             compatible = "nvidia,tegra114-i2c", "nvidia,tegra20-i2c";

Same here; only include the Tegra114 value since the HW isn't 100% compatible with the Tegra20 HW.

What does the 'compatible' designater mean, exactly? Does it require 100% identical HW? Compatible, in a SW/HW sense, to me means that newer SW will work with older/similar (but not exactly the same) HW, etc.

The idea here is that the first entry in compatible always defines the most specific implementation identification possible. So, compatible will at least contain:

Tegra20: nvidia,tegra20-i2c
Tegra30: nvidia,tegra30-i2c
Tegra114: nvidia,tegra114-i2c

Now, if a piece of newer hardware can be operated 100% correctly (ignoring issues due to new features not being exposed, or operating at degraded performance) by a driver that only knows about the older hardware, then the compatible property can additionally contain other values indicating what HW it is compatible with. So, we actually end up with:

Tegra20: nvidia,tegra20-i2c
Tegra30: nvidia,tegra30-i2c nvidia,tegra20-i2c
Tegra114: nvidia,tegra114-i2c

Tegra114 I2C HW isn't marked as compatible with either Tegra20 or Tegra30, because the clock divider programming must be different.

Quoted 3 lines

Tegra U-Boot uses the "tegra20-i2c" name to find and load the I2C driver. I could add a new entry in the compat-names table for tegra114-i2c,

Yes, that is the way to go. The driver should include a list of all the different compatible values that it supports.

Quoted 4 lines

but I still don't think there's enough difference between T20/T30 and T114 I2C to justify a whole new I2C driver - so far, it's just one register with a new clk divider that has to be taken in consideration when programming the clock source divider.

But that's required to operate the hardware correctly. It doesn't matter how trivial the difference is; it could just be a single bit that needs to be set/cleared on new HW - there would still be a difference that would otherwise make the HW operate incorrectly.

Quoted 8 lines

I could do as the driver does for T20, where there is a separate DVC controller, plus 3 normal I2C controllers. I could 'find_aliases' for the tegrat114-i2c controller first, process its nodes, and return. If no tegrat114-i2c exists, the driver would continue on to look for tegra20-i2c/tegra20-dvc controller info as it does now. It'd still be one tegra_i2c.c driver, with a flag in the i2c_bus struct telling me if I found T114 I2C HW (i2c_bus->single_clk, etc.) and I could then do the new clock divider dance based on that flag. How does that sound?

Quoted 6 lines

The U-Boot function that returns the list of devices supported by the driver should be enhanced so that it can search for nodes compatible with any 1 (or more) of n compatible values at a time, rather than just a single compatible value. Then, all you'd have to do with this change is add a new entry into the table, not add extra code that calls that function separately for each compatible value.

Yes, that needs to be done, and while we are at it I think the function should return a list containing struct {int offset; enum fdt_compat_id; };

I could probably do this by end of week if no one else can do it faster. Please let me know. Tests need to updated also.

Quoted 23 lines
Quoted 11 lines
Quoted 10 lines

board/nvidia/dts/tegra114-dalmore.dts line 45

Quoted 7 lines
board/nvidia/dts/tegra114-dalmore.dts +4 -0
 
+     i2c at 7000d000 {
+             status = "okay";
+             clock-frequency = <100000>;
+     };

According to our downstream Linux kernel, that I2C controller can run up to 400KHz on this board.

Quoted 6 lines

But it also runs @ 100KHz just fine, too. Do we need to run at the fastest clock? That's the DVC (PWR_I2C) controller, which U-Boot does little to nothing with right now.

I can set it to 400KHz, but what are the advantages/justifications? Is anything wrong with leaving it at 100KHz?

The device tree is about describing the hardware. The hardware can run at 400KHz, so the device tree should accurately describe this. It's simply a matter of correctness, rather than randomly filling in something that happens to work.

Quoted 4 lines

One practical advantage here is increased boot speed due to I2C accesses taking less time. The advantage might be small here since we probably don't configure too many regulators in U-Boot, but I bet Simon Glass is counting every uS.

Well we count uS, but only refactor code for mS :-)

Quoted 6 lines

And again, if/when we can ever use the same DT for U-Boot and the kernel, this needs to be corrected so the kernel isn't forced to run at a reduced speed for some reason. The kernel sends many many more commands to the PMIC, and many are time-sensitive (e.g. CPU voltage bus adjustments for DVFS).

Yes we should use the kernel FDT where possible.

Quoted 4 lines

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Regards,
Simon

author
#11 lore raw

PATCH v2 2/3 Tegra114: fdt: Update DT files with I2C info for T114/Dalmore

Simon,

Quoted 97 lines · Simon Glass

Hi Stephen,

Quoted 87 lines · Stephen Warren
Quoted 14 lines · Tom Warren

Stephen,

Quoted 11 lines · Stephen Warren
Quoted 9 lines · Tom Warren

Note that T114 does not have a separate/different DVC (power I2C) controller like T20 - all 5 I2C controllers are identical, but I2C5 is used to designate the controller intended for power control (PWR_I2C in the schematics).

arch/arm/dts/tegra114.dtsi +2 -0
 
+     tegra_car: clock at 60006000 {
+             compatible = "nvidia,tegra114-car, nvidia,tegra30-car";
Quoted 7 lines
Quoted 3 lines

Only the Tegra114 value should be listed here; the presence of the Tegra30 value in the upstream kernel is a mistake that will be fixed as part of the Tegra114 clock driver patches.

OK. But this is why I think hewing to the Linux DT files, while laudable, is a time sink. Though since T114 is so new & still settling in, I guess some churn is expected.

The issue here is not about making U-Boot fall in line with the kernel. The issue is making the device tree in U-Boot be correct. Right now, the kernel happens to have the most correct device tree, so it's a good reference for U-Boot.

Quoted 10 lines
Quoted 5 lines

arch/arm/dts/tegra114.dtsi

Quoted 2 lines
arch/arm/dts/tegra114.dtsi +2 -0
+     i2c at 7000c000 {
+             compatible = "nvidia,tegra114-i2c", "nvidia,tegra20-i2c";

Same here; only include the Tegra114 value since the HW isn't 100% compatible with the Tegra20 HW.

What does the 'compatible' designater mean, exactly? Does it require 100% identical HW? Compatible, in a SW/HW sense, to me means that newer SW will work with older/similar (but not exactly the same) HW, etc.

The idea here is that the first entry in compatible always defines the most specific implementation identification possible. So, compatible will at least contain:

Tegra20: nvidia,tegra20-i2c
Tegra30: nvidia,tegra30-i2c
Tegra114: nvidia,tegra114-i2c

Now, if a piece of newer hardware can be operated 100% correctly (ignoring issues due to new features not being exposed, or operating at degraded performance) by a driver that only knows about the older hardware, then the compatible property can additionally contain other values indicating what HW it is compatible with. So, we actually end up with:

Tegra20: nvidia,tegra20-i2c
Tegra30: nvidia,tegra30-i2c nvidia,tegra20-i2c
Tegra114: nvidia,tegra114-i2c

Tegra114 I2C HW isn't marked as compatible with either Tegra20 or Tegra30, because the clock divider programming must be different.

Quoted 3 lines

Tegra U-Boot uses the "tegra20-i2c" name to find and load the I2C driver. I could add a new entry in the compat-names table for tegra114-i2c,

Yes, that is the way to go. The driver should include a list of all the different compatible values that it supports.

Quoted 4 lines

but I still don't think there's enough difference between T20/T30 and T114 I2C to justify a whole new I2C driver - so far, it's just one register with a new clk divider that has to be taken in consideration when programming the clock source divider.

But that's required to operate the hardware correctly. It doesn't matter how trivial the difference is; it could just be a single bit that needs to be set/cleared on new HW - there would still be a difference that would otherwise make the HW operate incorrectly.

Quoted 8 lines

I could do as the driver does for T20, where there is a separate DVC controller, plus 3 normal I2C controllers. I could 'find_aliases' for the tegrat114-i2c controller first, process its nodes, and return. If no tegrat114-i2c exists, the driver would continue on to look for tegra20-i2c/tegra20-dvc controller info as it does now. It'd still be one tegra_i2c.c driver, with a flag in the i2c_bus struct telling me if I found T114 I2C HW (i2c_bus->single_clk, etc.) and I could then do the new clock divider dance based on that flag. How does that sound?

Quoted 6 lines

The U-Boot function that returns the list of devices supported by the driver should be enhanced so that it can search for nodes compatible with any 1 (or more) of n compatible values at a time, rather than just a single compatible value. Then, all you'd have to do with this change is add a new entry into the table, not add extra code that calls that function separately for each compatible value.

Quoted 6 lines

Yes, that needs to be done, and while we are at it I think the function should return a list containing struct {int offset; enum fdt_compat_id; };

I could probably do this by end of week if no one else can do it faster. Please let me know. Tests need to updated also.

I won't have time for this this week (on vacation Friday thru Tuesday). If you want to tackle this, go ahead. The current T114 I2C patchset is good-to-go AFAICT, with the exception of the clock divisor fix Stephen just pointed out in another thread. So you can use that as your basis for rewrite, if you wish.

Quoted 32 lines
Quoted 24 lines
Quoted 12 lines
Quoted 11 lines

board/nvidia/dts/tegra114-dalmore.dts line 45

Quoted 8 lines
board/nvidia/dts/tegra114-dalmore.dts +4 -0
 
+     i2c at 7000d000 {
+             status = "okay";
+             clock-frequency = <100000>;
+     };

According to our downstream Linux kernel, that I2C controller can run up to 400KHz on this board.

Quoted 6 lines

But it also runs @ 100KHz just fine, too. Do we need to run at the fastest clock? That's the DVC (PWR_I2C) controller, which U-Boot does little to nothing with right now.

I can set it to 400KHz, but what are the advantages/justifications? Is anything wrong with leaving it at 100KHz?

The device tree is about describing the hardware. The hardware can run at 400KHz, so the device tree should accurately describe this. It's simply a matter of correctness, rather than randomly filling in something that happens to work.

Quoted 4 lines

One practical advantage here is increased boot speed due to I2C accesses taking less time. The advantage might be small here since we probably don't configure too many regulators in U-Boot, but I bet Simon Glass is counting every uS.

Well we count uS, but only refactor code for mS :-)

Quoted 1 line
Quoted 7 lines
Quoted 5 lines

And again, if/when we can ever use the same DT for U-Boot and the kernel, this needs to be corrected so the kernel isn't forced to run at a reduced speed for some reason. The kernel sends many many more commands to the PMIC, and many are time-sensitive (e.g. CPU voltage bus adjustments for DVFS).

Yes we should use the kernel FDT where possible.

That's the current POR for Tegra DT use in upstream U-Boot, assuming I can find an up-to-date kernel with the latest DTS files (I'll use Stephen's swarren/linux-tegra.git/for-next until told otherwise).

Tom

Quoted 8 lines
Quoted 5 lines

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Regards,
Simon

#12 lore raw

PATCH v2 2/3 Tegra114: fdt: Update DT files with I2C info for T114/Dalmore

Hi Tom,

Quoted 104 lines · Tom Warren

Simon,

Quoted 101 lines · Simon Glass

Hi Stephen,

Quoted 87 lines · Stephen Warren
Quoted 14 lines · Tom Warren

Stephen,

Quoted 11 lines · Stephen Warren
Quoted 9 lines · Tom Warren

Note that T114 does not have a separate/different DVC (power I2C) controller like T20 - all 5 I2C controllers are identical, but I2C5 is used to designate the controller intended for power control (PWR_I2C in the schematics).

arch/arm/dts/tegra114.dtsi +2 -0
 
+     tegra_car: clock at 60006000 {
+             compatible = "nvidia,tegra114-car, nvidia,tegra30-car";
Quoted 7 lines
Quoted 3 lines

Only the Tegra114 value should be listed here; the presence of the Tegra30 value in the upstream kernel is a mistake that will be fixed as part of the Tegra114 clock driver patches.

OK. But this is why I think hewing to the Linux DT files, while laudable, is a time sink. Though since T114 is so new & still settling in, I guess some churn is expected.

The issue here is not about making U-Boot fall in line with the kernel. The issue is making the device tree in U-Boot be correct. Right now, the kernel happens to have the most correct device tree, so it's a good reference for U-Boot.

Quoted 10 lines
Quoted 5 lines

arch/arm/dts/tegra114.dtsi

Quoted 2 lines
arch/arm/dts/tegra114.dtsi +2 -0
+     i2c at 7000c000 {
+             compatible = "nvidia,tegra114-i2c", "nvidia,tegra20-i2c";

Same here; only include the Tegra114 value since the HW isn't 100% compatible with the Tegra20 HW.

What does the 'compatible' designater mean, exactly? Does it require 100% identical HW? Compatible, in a SW/HW sense, to me means that newer SW will work with older/similar (but not exactly the same) HW, etc.

The idea here is that the first entry in compatible always defines the most specific implementation identification possible. So, compatible will at least contain:

Tegra20: nvidia,tegra20-i2c
Tegra30: nvidia,tegra30-i2c
Tegra114: nvidia,tegra114-i2c

Now, if a piece of newer hardware can be operated 100% correctly (ignoring issues due to new features not being exposed, or operating at degraded performance) by a driver that only knows about the older hardware, then the compatible property can additionally contain other values indicating what HW it is compatible with. So, we actually end up with:

Tegra20: nvidia,tegra20-i2c
Tegra30: nvidia,tegra30-i2c nvidia,tegra20-i2c
Tegra114: nvidia,tegra114-i2c

Tegra114 I2C HW isn't marked as compatible with either Tegra20 or Tegra30, because the clock divider programming must be different.

Quoted 3 lines

Tegra U-Boot uses the "tegra20-i2c" name to find and load the I2C driver. I could add a new entry in the compat-names table for tegra114-i2c,

Yes, that is the way to go. The driver should include a list of all the different compatible values that it supports.

Quoted 4 lines

but I still don't think there's enough difference between T20/T30 and T114 I2C to justify a whole new I2C driver - so far, it's just one register with a new clk divider that has to be taken in consideration when programming the clock source divider.

But that's required to operate the hardware correctly. It doesn't matter how trivial the difference is; it could just be a single bit that needs to be set/cleared on new HW - there would still be a difference that would otherwise make the HW operate incorrectly.

Quoted 8 lines

I could do as the driver does for T20, where there is a separate DVC controller, plus 3 normal I2C controllers. I could 'find_aliases' for the tegrat114-i2c controller first, process its nodes, and return. If no tegrat114-i2c exists, the driver would continue on to look for tegra20-i2c/tegra20-dvc controller info as it does now. It'd still be one tegra_i2c.c driver, with a flag in the i2c_bus struct telling me if I found T114 I2C HW (i2c_bus->single_clk, etc.) and I could then do the new clock divider dance based on that flag. How does that sound?

Quoted 6 lines

The U-Boot function that returns the list of devices supported by the driver should be enhanced so that it can search for nodes compatible with any 1 (or more) of n compatible values at a time, rather than just a single compatible value. Then, all you'd have to do with this change is add a new entry into the table, not add extra code that calls that function separately for each compatible value.

Yes, that needs to be done, and while we are at it I think the function should return a list containing struct {int offset; enum fdt_compat_id; };

Quoted 8 lines
Quoted 2 lines

I could probably do this by end of week if no one else can do it faster. Please let me know. Tests need to updated also.

I won't have time for this this week (on vacation Friday thru Tuesday). If you want to tackle this, go ahead. The current T114 I2C patchset is good-to-go AFAICT, with the exception of the clock divisor fix Stephen just pointed out in another thread. So you can use that as your basis for rewrite, if you wish.

OK, well it is independent of these patches, but seem find as they are anyway. It's something we should do but doesn' t need to hold up proceedings.

Quoted 39 lines
Quoted 39 lines
Quoted 25 lines
Quoted 13 lines
Quoted 5 lines
Quoted 4 lines
board/nvidia/dts/tegra114-dalmore.dts +0 -0
Quoted 7 lines

board/nvidia/dts/tegra114-dalmore.dts line 45

Quoted 4 lines
board/nvidia/dts/tegra114-dalmore.dts +4 -0
+     i2c at 7000d000 {
+             status = "okay";
+             clock-frequency = <100000>;
+     };

According to our downstream Linux kernel, that I2C controller can run up to 400KHz on this board.

Quoted 6 lines

But it also runs @ 100KHz just fine, too. Do we need to run at the fastest clock? That's the DVC (PWR_I2C) controller, which U-Boot does little to nothing with right now.

I can set it to 400KHz, but what are the advantages/justifications? Is anything wrong with leaving it at 100KHz?

The device tree is about describing the hardware. The hardware can run at 400KHz, so the device tree should accurately describe this. It's simply a matter of correctness, rather than randomly filling in something that happens to work.

Quoted 4 lines

One practical advantage here is increased boot speed due to I2C accesses taking less time. The advantage might be small here since we probably don't configure too many regulators in U-Boot, but I bet Simon Glass is counting every uS.

Well we count uS, but only refactor code for mS :-)

Quoted 6 lines

And again, if/when we can ever use the same DT for U-Boot and the kernel, this needs to be corrected so the kernel isn't forced to run at a reduced speed for some reason. The kernel sends many many more commands to the PMIC, and many are time-sensitive (e.g. CPU voltage bus adjustments for DVFS).

Quoted 4 lines
Quoted 1 line

Yes we should use the kernel FDT where possible.

That's the current POR for Tegra DT use in upstream U-Boot, assuming I can find an up-to-date kernel with the latest DTS files (I'll use Stephen's swarren/linux-tegra.git/for-next until told otherwise).

Yes that was always my problem - finding what the kernel actually used, might use, etc.

Regards,
Simon

Quoted 10 lines

Tom

Quoted 8 lines
Quoted 5 lines

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Regards,
Simon

#13 lore raw

PATCH v2 2/3 Tegra114: fdt: Update DT files with I2C info for T114/Dalmore

Quoted 3 lines · Simon Glass

Hi Tom,

On Tue, Feb 12, 2013 at 11:13 AM, Tom Warren <[email protected]> wrote:

...

Quoted 6 lines
Quoted 3 lines

That's the current POR for Tegra DT use in upstream U-Boot, assuming I can find an up-to-date kernel with the latest DTS files (I'll use Stephen's swarren/linux-tegra.git/for-next until told otherwise).

Yes that was always my problem - finding what the kernel actually used, might use, etc.

I must say I find this quite puzzling; the kernel repos aren't exactly hidden.

Tegra's kernel for-next is likely the best place right now as any DT changes typically go through that tree. However, on the off-chance any other maintainer picks up any changes, linux-next.git would have the latest bindings. That's all been true for a year or more.

That said, there is a move to either move the binding definitions and .dts files out of the kernel tree and/or stop taking changes to them through individual SoC trees, but perhaps through the device tree repo. If that does happen, I'll let you know.

#14 lore raw

PATCH v2 2/3 Tegra114: fdt: Update DT files with I2C info for T114/Dalmore

Hi Stephen,

Quoted 9 lines · Stephen Warren
Quoted 3 lines · Simon Glass

Hi Tom,

On Tue, Feb 12, 2013 at 11:13 AM, Tom Warren <[email protected]> wrote:

...

Quoted 4 lines
Quoted 3 lines

That's the current POR for Tegra DT use in upstream U-Boot, assuming I can find an up-to-date kernel with the latest DTS files (I'll use Stephen's swarren/linux-tegra.git/for-next until told otherwise).

Quoted 5 lines
Quoted 2 lines

Yes that was always my problem - finding what the kernel actually used, might use, etc.

I must say I find this quite puzzling; the kernel repos aren't exactly hidden.

Well if a change has made it to a repo then things are easier, particularly if it is next/. It was chasing down patches on mailing lists that I found hard.

Quoted 10 lines

Tegra's kernel for-next is likely the best place right now as any DT changes typically go through that tree. However, on the off-chance any other maintainer picks up any changes, linux-next.git would have the latest bindings. That's all been true for a year or more.

That said, there is a move to either move the binding definitions and .dts files out of the kernel tree and/or stop taking changes to them through individual SoC trees, but perhaps through the device tree repo. If that does happen, I'll let you know.

Sounds good.

Regards,
Simon

author
#15 lore raw

PATCH v2 2/3 Tegra114: fdt: Update DT files with I2C info for T114/Dalmore

In reply to Stephen Warren
Quoted 9 lines · Stephen Warren
Quoted 3 lines · Simon Glass

Hi Tom,

On Tue, Feb 12, 2013 at 11:13 AM, Tom Warren <[email protected]> wrote:

...

Quoted 4 lines
Quoted 3 lines

That's the current POR for Tegra DT use in upstream U-Boot, assuming I can find an up-to-date kernel with the latest DTS files (I'll use Stephen's swarren/linux-tegra.git/for-next until told otherwise).

Quoted 5 lines
Quoted 2 lines

Yes that was always my problem - finding what the kernel actually used, might use, etc.

I must say I find this quite puzzling; the kernel repos aren't exactly hidden.

Not hidden, but numerous. Perhaps I should have said 'can find _the correct_ kernel ...'. I've been pointed to 2 or 3 different repos over the course of these DT patches. I'm not a kernel guru, and I don't have the bandwidth to monitor kernel reflectors, etc. When I need something kernel-related, I resort to Google or asking you.

Quoted 10 lines

Tegra's kernel for-next is likely the best place right now as any DT changes typically go through that tree. However, on the off-chance any other maintainer picks up any changes, linux-next.git would have the latest bindings. That's all been true for a year or more.

That said, there is a move to either move the binding definitions and .dts files out of the kernel tree and/or stop taking changes to them through individual SoC trees, but perhaps through the device tree repo. If that does happen, I'll let you know.

#16 lore raw

PATCH v2 2/3 Tegra114: fdt: Update DT files with I2C info for T114/Dalmore

In reply to Tom Warren
Quoted 14 lines · Tom Warren

Note that T114 does not have a separate/different DVC (power I2C) controller like T20 - all 5 I2C controllers are identical, but I2C5 is used to designate the controller intended for power control (PWR_I2C in the schematics).

---

board/nvidia/dts/tegra114-dalmore.dts +0 -0
index 7315577..13b07f3 100644

board/nvidia/dts/tegra114-dalmore.dts line 15

Quoted 10 lines
board/nvidia/dts/tegra114-dalmore.dts +7 -0
@@ -6,8 +6,41 @@
  	model =NVIDIA Dalmore";
  	compatible =nvidia,dalmore", "nvidia,tegra114";
 
+	aliases {
+		i2c0 =/i2c at 7000d000";
+		i2c1 =/i2c at 7000c000";
+		i2c2 =/i2c at 7000c400";
+		i2c3 =/i2c at 7000c500";
+		i2c4 =/i2c at 7000c700";
+	};

Can we move this to tegar114.dtsi file.

otherwise it looks good.

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

author
#17 lore raw

PATCH v2 2/3 Tegra114: fdt: Update DT files with I2C info for T114/Dalmore

Laxman,

Quoted 21 lines · Laxman Dewangan
Quoted 20 lines · Tom Warren

Note that T114 does not have a separate/different DVC (power I2C) controller like T20 - all 5 I2C controllers are identical, but I2C5 is used to designate the controller intended for power control (PWR_I2C in the schematics).

---

board/nvidia/dts/tegra114-dalmore.dts +0 -0
index 7315577..13b07f3 100644
@@ -6,8 +6,41 @@
        model =NVIDIA Dalmore";
        compatible =nvidia,dalmore", "nvidia,tegra114";
 
Quoted 10 lines

board/nvidia/dts/tegra114-dalmore.dts line 15

Quoted 7 lines
board/nvidia/dts/tegra114-dalmore.dts +6 -0
  +     aliases {
+               i2c0 =/i2c at 7000d000";
+               i2c1 =/i2c at 7000c000";
+               i2c2 =/i2c at 7000c400";
+               i2c3 =/i2c at 7000c500";
+               i2c4 =/i2c at 7000c700";
+       };

Can we move this to tegar114.dtsi file.

I could, but why? Most, if not all, of the U-Boot boards that use DT are putting their aliases in the .dts file in the board directory.

Quoted 3 lines

otherwise it looks good.

Thanks, Laxman. Appreciate your taking a look.

Tom

Quoted 11 lines

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

#18 lore raw

PATCH v2 2/3 Tegra114: fdt: Update DT files with I2C info for T114/Dalmore

Quoted 35 lines · Tom Warren

Laxman,

Quoted 21 lines · Laxman Dewangan
Quoted 20 lines · Tom Warren

Note that T114 does not have a separate/different DVC (power I2C) controller like T20 - all 5 I2C controllers are identical, but I2C5 is used to designate the controller intended for power control (PWR_I2C in the schematics).

---

board/nvidia/dts/tegra114-dalmore.dts +0 -0
index 7315577..13b07f3 100644
@@ -6,8 +6,41 @@
        model =NVIDIA Dalmore";
        compatible =nvidia,dalmore", "nvidia,tegra114";
 
Quoted 10 lines

board/nvidia/dts/tegra114-dalmore.dts line 15

Quoted 7 lines
board/nvidia/dts/tegra114-dalmore.dts +6 -0
  +     aliases {
+               i2c0 =/i2c at 7000d000";
+               i2c1 =/i2c at 7000c000";
+               i2c2 =/i2c at 7000c400";
+               i2c3 =/i2c at 7000c500";
+               i2c4 =/i2c at 7000c700";
+       };

Can we move this to tegar114.dtsi file.

Quoted 2 lines

I could, but why? Most, if not all, of the U-Boot boards that use DT are putting their aliases in the .dts file in the board directory.

Laxman, the issue here is that right now in U-Boot, I believe, if a particular board only uses I2C adapters 0, 2, and 4, then only U-Boot device IDs 0, 1, and 2 are defined, rather than IDs 0, 2, and 4. That's why the aliases are in the per-board file for now, because the actual set of I2C adapters enabled is board-specific.

Tom, as background for Laxman's request, for other devices (e.g. serial ports), customer engineers have pushed back on that naming scheme, and always want a specific HW device to end up with a static name, irrespective of which other devices of the same type are used, if any. For that reason, in the kernel, we have aliases for the serial ports in tegra*.dtsi rather than in per-board files, and the names are static.

So I wonder if in U-Boot we really have to have IDs 0..n rather than e.g. IDs 0, 2, 4 for the I2C ports (when some aren't used). Then, we could just put the aliases in tegra*.dtsi, which makes life simpler when creating board .dts files...

author
#19 lore raw

PATCH v2 2/3 Tegra114: fdt: Update DT files with I2C info for T114/Dalmore

Stephen,

Quoted 52 lines · Stephen Warren
Quoted 35 lines · Tom Warren

Laxman,

Quoted 21 lines · Laxman Dewangan
Quoted 20 lines · Tom Warren

Note that T114 does not have a separate/different DVC (power I2C) controller like T20 - all 5 I2C controllers are identical, but I2C5 is used to designate the controller intended for power control (PWR_I2C in the schematics).

---

board/nvidia/dts/tegra114-dalmore.dts +0 -0
index 7315577..13b07f3 100644
@@ -6,8 +6,41 @@
        model =NVIDIA Dalmore";
        compatible =nvidia,dalmore", "nvidia,tegra114";
 
Quoted 10 lines

board/nvidia/dts/tegra114-dalmore.dts line 15

Quoted 7 lines
board/nvidia/dts/tegra114-dalmore.dts +6 -0
  +     aliases {
+               i2c0 =/i2c at 7000d000";
+               i2c1 =/i2c at 7000c000";
+               i2c2 =/i2c at 7000c400";
+               i2c3 =/i2c at 7000c500";
+               i2c4 =/i2c at 7000c700";
+       };

Can we move this to tegar114.dtsi file.

Quoted 2 lines

I could, but why? Most, if not all, of the U-Boot boards that use DT are putting their aliases in the .dts file in the board directory.

Laxman, the issue here is that right now in U-Boot, I believe, if a particular board only uses I2C adapters 0, 2, and 4, then only U-Boot device IDs 0, 1, and 2 are defined, rather than IDs 0, 2, and 4. That's why the aliases are in the per-board file for now, because the actual set of I2C adapters enabled is board-specific.

Tom, as background for Laxman's request, for other devices (e.g. serial ports), customer engineers have pushed back on that naming scheme, and always want a specific HW device to end up with a static name, irrespective of which other devices of the same type are used, if any. For that reason, in the kernel, we have aliases for the serial ports in tegra*.dtsi rather than in per-board files, and the names are static.

Quoted 4 lines

So I wonder if in U-Boot we really have to have IDs 0..n rather than e.g. IDs 0, 2, 4 for the I2C ports (when some aren't used). Then, we could just put the aliases in tegra*.dtsi, which makes life simpler when creating board .dts files...

Thanks for the background info. I'm focusing on getting T114 I2C in right now, so I can move on to MMC and USB, and what I have seems reasonable/conforms to what's already done in U-Boot.

I don't want to get into reworking everyone's dts/dtsi files right now to move aliases around, or find out which boards really have unused I2C ports (Dalmore uses 'em all, BTW, according to our I2C spreadsheet). If you want to send a set of cleanup/re-org patches for everybody's DTS files, or even just the Tegra boards, feel free. I'll be glad to review it/apply it to u-boot-tegra later.

Thanks,

Tom

#20 lore raw

PATCH v2 2/3 Tegra114: fdt: Update DT files with I2C info for T114/Dalmore

Quoted 55 lines · Tom Warren

Stephen,

Quoted 52 lines · Stephen Warren
Quoted 35 lines · Tom Warren

Laxman,

Quoted 21 lines · Laxman Dewangan
Quoted 20 lines · Tom Warren

Note that T114 does not have a separate/different DVC (power I2C) controller like T20 - all 5 I2C controllers are identical, but I2C5 is used to designate the controller intended for power control (PWR_I2C in the schematics).

---

board/nvidia/dts/tegra114-dalmore.dts +0 -0
index 7315577..13b07f3 100644
@@ -6,8 +6,41 @@
        model =NVIDIA Dalmore";
        compatible =nvidia,dalmore", "nvidia,tegra114";
 
Quoted 10 lines

board/nvidia/dts/tegra114-dalmore.dts line 15

Quoted 7 lines
board/nvidia/dts/tegra114-dalmore.dts +6 -0
  +     aliases {
+               i2c0 =/i2c at 7000d000";
+               i2c1 =/i2c at 7000c000";
+               i2c2 =/i2c at 7000c400";
+               i2c3 =/i2c at 7000c500";
+               i2c4 =/i2c at 7000c700";
+       };

Can we move this to tegar114.dtsi file.

Quoted 2 lines

I could, but why? Most, if not all, of the U-Boot boards that use DT are putting their aliases in the .dts file in the board directory.

Laxman, the issue here is that right now in U-Boot, I believe, if a particular board only uses I2C adapters 0, 2, and 4, then only U-Boot device IDs 0, 1, and 2 are defined, rather than IDs 0, 2, and 4. That's why the aliases are in the per-board file for now, because the actual set of I2C adapters enabled is board-specific.

Tom, as background for Laxman's request, for other devices (e.g. serial ports), customer engineers have pushed back on that naming scheme, and always want a specific HW device to end up with a static name, irrespective of which other devices of the same type are used, if any. For that reason, in the kernel, we have aliases for the serial ports in tegra*.dtsi rather than in per-board files, and the names are static.

Quoted 8 lines
Quoted 4 lines

So I wonder if in U-Boot we really have to have IDs 0..n rather than e.g. IDs 0, 2, 4 for the I2C ports (when some aren't used). Then, we could just put the aliases in tegra*.dtsi, which makes life simpler when creating board .dts files...

Thanks for the background info. I'm focusing on getting T114 I2C in right now, so I can move on to MMC and USB, and what I have seems reasonable/conforms to what's already done in U-Boot.

That doesn't necessarily make it correct.

Quoted 6 lines

I don't want to get into reworking everyone's dts/dtsi files right now to move aliases around, or find out which boards really have unused I2C ports (Dalmore uses 'em all, BTW, according to our I2C spreadsheet). If you want to send a set of cleanup/re-org patches for everybody's DTS files, or even just the Tegra boards, feel free. I'll be glad to review it/apply it to u-boot-tegra later.

Sorry, but that's simply part of writing the .dts file for a board; there is no way around that.

author
#21 lore raw

PATCH v2 2/3 Tegra114: fdt: Update DT files with I2C info for T114/Dalmore

Stephen,

Quoted 74 lines · Stephen Warren
Quoted 55 lines · Tom Warren

Stephen,

Quoted 52 lines · Stephen Warren
Quoted 35 lines · Tom Warren

Laxman,

Quoted 21 lines · Laxman Dewangan
Quoted 20 lines · Tom Warren

Note that T114 does not have a separate/different DVC (power I2C) controller like T20 - all 5 I2C controllers are identical, but I2C5 is used to designate the controller intended for power control (PWR_I2C in the schematics).

---

board/nvidia/dts/tegra114-dalmore.dts +0 -0
index 7315577..13b07f3 100644
@@ -6,8 +6,41 @@
        model =NVIDIA Dalmore";
        compatible =nvidia,dalmore", "nvidia,tegra114";
 
Quoted 10 lines

board/nvidia/dts/tegra114-dalmore.dts line 15

Quoted 7 lines
board/nvidia/dts/tegra114-dalmore.dts +6 -0
  +     aliases {
+               i2c0 =/i2c at 7000d000";
+               i2c1 =/i2c at 7000c000";
+               i2c2 =/i2c at 7000c400";
+               i2c3 =/i2c at 7000c500";
+               i2c4 =/i2c at 7000c700";
+       };

Can we move this to tegar114.dtsi file.

Quoted 2 lines

I could, but why? Most, if not all, of the U-Boot boards that use DT are putting their aliases in the .dts file in the board directory.

Laxman, the issue here is that right now in U-Boot, I believe, if a particular board only uses I2C adapters 0, 2, and 4, then only U-Boot device IDs 0, 1, and 2 are defined, rather than IDs 0, 2, and 4. That's why the aliases are in the per-board file for now, because the actual set of I2C adapters enabled is board-specific.

Tom, as background for Laxman's request, for other devices (e.g. serial ports), customer engineers have pushed back on that naming scheme, and always want a specific HW device to end up with a static name, irrespective of which other devices of the same type are used, if any. For that reason, in the kernel, we have aliases for the serial ports in tegra*.dtsi rather than in per-board files, and the names are static.

Quoted 8 lines
Quoted 4 lines

So I wonder if in U-Boot we really have to have IDs 0..n rather than e.g. IDs 0, 2, 4 for the I2C ports (when some aren't used). Then, we could just put the aliases in tegra*.dtsi, which makes life simpler when creating board .dts files...

Thanks for the background info. I'm focusing on getting T114 I2C in right now, so I can move on to MMC and USB, and what I have seems reasonable/conforms to what's already done in U-Boot.

That doesn't necessarily make it correct.

Quoted 6 lines

I don't want to get into reworking everyone's dts/dtsi files right now to move aliases around, or find out which boards really have unused I2C ports (Dalmore uses 'em all, BTW, according to our I2C spreadsheet). If you want to send a set of cleanup/re-org patches for everybody's DTS files, or even just the Tegra boards, feel free. I'll be glad to review it/apply it to u-boot-tegra later.

Quoted 2 lines

Sorry, but that's simply part of writing the .dts file for a board; there is no way around that.

OK, how about this. For T114, I'll move the aliases to tegra114.dtsi, and use 400KHz for all I2C nodes except I2C1 (saw some internal code saying that it may not run well at that speed on the E1611 board). Since all 5 controllers have devices behind them, I think it's OK to leave all 5 in the aliases.

What do you think of that approach?

Adding Yen Lin to CC

Tom

#22 lore raw

PATCH v2 2/3 Tegra114: fdt: Update DT files with I2C info for T114/Dalmore

Quoted 77 lines · Tom Warren

Stephen,

Quoted 74 lines · Stephen Warren
Quoted 55 lines · Tom Warren

Stephen,

Quoted 52 lines · Stephen Warren
Quoted 35 lines · Tom Warren

Laxman,

Quoted 21 lines · Laxman Dewangan
Quoted 20 lines · Tom Warren

Note that T114 does not have a separate/different DVC (power I2C) controller like T20 - all 5 I2C controllers are identical, but I2C5 is used to designate the controller intended for power control (PWR_I2C in the schematics).

---

board/nvidia/dts/tegra114-dalmore.dts +0 -0
index 7315577..13b07f3 100644
@@ -6,8 +6,41 @@
        model =NVIDIA Dalmore";
        compatible =nvidia,dalmore", "nvidia,tegra114";
 
Quoted 10 lines

board/nvidia/dts/tegra114-dalmore.dts line 15

Quoted 7 lines
board/nvidia/dts/tegra114-dalmore.dts +6 -0
  +     aliases {
+               i2c0 =/i2c at 7000d000";
+               i2c1 =/i2c at 7000c000";
+               i2c2 =/i2c at 7000c400";
+               i2c3 =/i2c at 7000c500";
+               i2c4 =/i2c at 7000c700";
+       };

Can we move this to tegar114.dtsi file.

Quoted 2 lines

I could, but why? Most, if not all, of the U-Boot boards that use DT are putting their aliases in the .dts file in the board directory.

Laxman, the issue here is that right now in U-Boot, I believe, if a particular board only uses I2C adapters 0, 2, and 4, then only U-Boot device IDs 0, 1, and 2 are defined, rather than IDs 0, 2, and 4. That's why the aliases are in the per-board file for now, because the actual set of I2C adapters enabled is board-specific.

Tom, as background for Laxman's request, for other devices (e.g. serial ports), customer engineers have pushed back on that naming scheme, and always want a specific HW device to end up with a static name, irrespective of which other devices of the same type are used, if any. For that reason, in the kernel, we have aliases for the serial ports in tegra*.dtsi rather than in per-board files, and the names are static.

Quoted 8 lines
Quoted 4 lines

So I wonder if in U-Boot we really have to have IDs 0..n rather than e.g. IDs 0, 2, 4 for the I2C ports (when some aren't used). Then, we could just put the aliases in tegra*.dtsi, which makes life simpler when creating board .dts files...

Thanks for the background info. I'm focusing on getting T114 I2C in right now, so I can move on to MMC and USB, and what I have seems reasonable/conforms to what's already done in U-Boot.

That doesn't necessarily make it correct.

Quoted 6 lines

I don't want to get into reworking everyone's dts/dtsi files right now to move aliases around, or find out which boards really have unused I2C ports (Dalmore uses 'em all, BTW, according to our I2C spreadsheet). If you want to send a set of cleanup/re-org patches for everybody's DTS files, or even just the Tegra boards, feel free. I'll be glad to review it/apply it to u-boot-tegra later.

Quoted 4 lines
Quoted 2 lines

Sorry, but that's simply part of writing the .dts file for a board; there is no way around that.

OK, how about this. For T114, I'll move the aliases to tegra114.dtsi,

I believe that makes sense.

But please do check that if you do disable one of the controllers, that the other 4 I2C ports do all get registered and still work OK, so we've tested that code-path. I'm not sure if we have tested the case where the I2C channels don't have contiguous IDs yet, so I have no idea if it works.

Quoted 4 lines

and use 400KHz for all I2C nodes except I2C1 (saw some internal code saying that it may not run well at that speed on the E1611 board). Since all 5 controllers have devices behind them, I think it's OK to leave all 5 in the aliases.

The downstream kernel only has I2C5 (IIRC) set to 400KHz - the other 4 are limited to 100KHz.

author
#23 lore raw

PATCH v2 2/3 Tegra114: fdt: Update DT files with I2C info for T114/Dalmore

Stephen,

Quoted 81 lines · Stephen Warren
Quoted 80 lines · Tom Warren

Stephen,

Quoted 76 lines · Stephen Warren
Quoted 55 lines · Tom Warren

Stephen,

Quoted 52 lines · Stephen Warren
Quoted 35 lines · Tom Warren

Laxman,

Quoted 21 lines · Laxman Dewangan
Quoted 20 lines · Tom Warren

Note that T114 does not have a separate/different DVC (power I2C) controller like T20 - all 5 I2C controllers are identical, but I2C5 is used to designate the controller intended for power control (PWR_I2C in the schematics).

---

board/nvidia/dts/tegra114-dalmore.dts +0 -0
index 7315577..13b07f3 100644
@@ -6,8 +6,41 @@
        model =NVIDIA Dalmore";
        compatible =nvidia,dalmore", "nvidia,tegra114";
 
Quoted 10 lines

board/nvidia/dts/tegra114-dalmore.dts line 15

Quoted 7 lines
board/nvidia/dts/tegra114-dalmore.dts +6 -0
  +     aliases {
+               i2c0 =/i2c at 7000d000";
+               i2c1 =/i2c at 7000c000";
+               i2c2 =/i2c at 7000c400";
+               i2c3 =/i2c at 7000c500";
+               i2c4 =/i2c at 7000c700";
+       };

Can we move this to tegar114.dtsi file.

Quoted 2 lines

I could, but why? Most, if not all, of the U-Boot boards that use DT are putting their aliases in the .dts file in the board directory.

Laxman, the issue here is that right now in U-Boot, I believe, if a particular board only uses I2C adapters 0, 2, and 4, then only U-Boot device IDs 0, 1, and 2 are defined, rather than IDs 0, 2, and 4. That's why the aliases are in the per-board file for now, because the actual set of I2C adapters enabled is board-specific.

Tom, as background for Laxman's request, for other devices (e.g. serial ports), customer engineers have pushed back on that naming scheme, and always want a specific HW device to end up with a static name, irrespective of which other devices of the same type are used, if any. For that reason, in the kernel, we have aliases for the serial ports in tegra*.dtsi rather than in per-board files, and the names are static.

Quoted 8 lines
Quoted 4 lines

So I wonder if in U-Boot we really have to have IDs 0..n rather than e.g. IDs 0, 2, 4 for the I2C ports (when some aren't used). Then, we could just put the aliases in tegra*.dtsi, which makes life simpler when creating board .dts files...

Thanks for the background info. I'm focusing on getting T114 I2C in right now, so I can move on to MMC and USB, and what I have seems reasonable/conforms to what's already done in U-Boot.

That doesn't necessarily make it correct.

Quoted 6 lines

I don't want to get into reworking everyone's dts/dtsi files right now to move aliases around, or find out which boards really have unused I2C ports (Dalmore uses 'em all, BTW, according to our I2C spreadsheet). If you want to send a set of cleanup/re-org patches for everybody's DTS files, or even just the Tegra boards, feel free. I'll be glad to review it/apply it to u-boot-tegra later.

Sorry, but that's simply part of writing the .dts file for a board; there is no way around that.

Quoted 8 lines
Quoted 1 line

OK, how about this. For T114, I'll move the aliases to tegra114.dtsi,

I believe that makes sense.

But please do check that if you do disable one of the controllers, that the other 4 I2C ports do all get registered and still work OK, so we've tested that code-path. I'm not sure if we have tested the case where the I2C channels don't have contiguous IDs yet, so I have no idea if it works.

Yep, if I remove the 'status = okay' from one of the ports (meaning that the .dtsi 'status=disabled' takes over), it can't be selected in the 'i2c' command @ the cmd prompt. Even if I take out dev 2, for instance, I can still select/probe devs 0, 1, 3, and 4.

Quoted 8 lines
Quoted 5 lines

and use 400KHz for all I2C nodes except I2C1 (saw some internal code saying that it may not run well at that speed on the E1611 board). Since all 5 controllers have devices behind them, I think it's OK to leave all 5 in the aliases.

The downstream kernel only has I2C5 (IIRC) set to 400KHz - the other 4 are limited to 100KHz.

OK, I'll update just I2C5/dev 0/PWR_I2C to 400KHz.

Thanks

author
#24 lore raw

PATCH v2 3/3 Tegra114: I2C: Enable I2C driver on Dalmore E1611 eval board

In reply to Tom Warren

Tested all 5 'buses', i2c probe enumerates device addresses on bus 1 and 2.

---
v2: No change

 include/configs/dalmore.h         |    9 +++++++++
 include/configs/tegra114-common.h |    3 +++
 2 files changed, 12 insertions(+), 0 deletions(-)
include/configs/dalmore.h +9 -0
index ce32c80..b1a6e34 100644
@@ -41,6 +41,15 @@
 #define CONFIG_MACH_TYPE		MACH_TYPE_DALMORE
 
 #define CONFIG_BOARD_EARLY_INIT_F
+
+/* I2C */
+#define CONFIG_TEGRA_I2C
+#define CONFIG_SYS_I2C_INIT_BOARD
+#define CONFIG_I2C_MULTI_BUS
+#define CONFIG_SYS_MAX_I2C_BUS		TEGRA_I2C_NUM_CONTROLLERS
+#define CONFIG_SYS_I2C_SPEED		100000
+#define CONFIG_CMD_I2C
+
 #define CONFIG_ENV_IS_NOWHERE
 
 #define MACH_TYPE_DALMORE	4304	/* not yet in mach-types.h */
include/configs/tegra114-common.h +3 -0
index 0033530..c2986d8 100644
@@ -76,4 +76,7 @@
 
 #define CONFIG_SPL_LDSCRIPT		"$(CPUDIR)/tegra114/u-boot-spl.lds"
 
+/* Total I2C ports on Tegra114 */
+#define TEGRA_I2C_NUM_CONTROLLERS	5
+
 #endif /* _TEGRA114_COMMON_H_ */
Signature · 1 line
1.7.0.4
#26 lore raw

PATCH v2 3/3 Tegra114: I2C: Enable I2C driver on Dalmore E1611 eval board

In reply to Tom Warren
Quoted 7 lines · Tom Warren

Tested all 5 'buses', i2c probe enumerates device addresses on bus 1 and 2.

---
v2: No change

Looks good.

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------