Re: [U-Boot] [PATCH v2 17/17] dm: i2c: tegra: Convert to driver model

2014-11-16 Thread Heiko Schocher

Hello Simon,

Am 11.11.2014 18:46, schrieb Simon Glass:

This converts all Tegra boards over to use driver model for I2C. The driver
is adjusted to use driver model and the following obsolete CONFIGs are
removed:

- CONFIG_SYS_I2C_INIT_BOARD
- CONFIG_I2C_MULTI_BUS
- CONFIG_SYS_MAX_I2C_BUS
- CONFIG_SYS_I2C_SPEED
- CONFIG_SYS_I2C

This has been tested on:
- trimslice (no I2C)
- beaver
- Jetson-TK1

It has not been tested on Tegra 114 as I don't have that board.

Signed-off-by: Simon Glass s...@chromium.org
---

Changes in v2:
- Adjust tegra_i2c_child_pre_probe() to permit generic I2C devices
- Correct the compatible strings for I2C buses
- Don't init if the speed is 0, since this breaks the controller
- Expand coverage to all Tegra boards

  arch/arm/cpu/tegra20-common/pmu.c   |  21 +-
  arch/arm/dts/tegra124-jetson-tk1.dts|   1 -
  arch/arm/dts/tegra124-norrin.dts|   1 -
  arch/arm/dts/tegra30-tec-ng.dts |   4 +
  arch/arm/include/asm/arch-tegra/tegra_i2c.h |   2 +-
  board/avionic-design/common/tamonten-ng.c   |  12 +-
  board/nvidia/cardhu/cardhu.c|  13 +-
  board/nvidia/common/board.c |   4 -
  board/nvidia/dalmore/dalmore.c  |  21 +-
  board/nvidia/whistler/whistler.c|  29 ++-
  board/toradex/apalis_t30/apalis_t30.c   |  19 +-
  drivers/i2c/tegra_i2c.c | 320 +++-
  drivers/power/tps6586x.c|  27 +--
  include/configs/apalis_t30.h|   3 -
  include/configs/beaver.h|   3 -
  include/configs/cardhu.h|   5 -
  include/configs/colibri_t30.h   |   3 -
  include/configs/dalmore.h   |   5 -
  include/configs/jetson-tk1.h|   5 -
  include/configs/norrin.h|   5 -
  include/configs/seaboard.h  |   3 -
  include/configs/tec-ng.h|   5 -
  include/configs/tegra-common.h  |   1 +
  include/configs/tegra114-common.h   |   3 -
  include/configs/tegra124-common.h   |   3 -
  include/configs/tegra20-common.h|   3 -
  include/configs/tegra30-common.h|   3 -
  include/configs/trimslice.h |   3 -
  include/configs/venice2.h   |   5 -
  include/configs/whistler.h  |   3 -
  include/tps6586x.h  |   4 +-
  31 files changed, 211 insertions(+), 328 deletions(-)


Acked-by: Heiko Schocher h...@denx.de

bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 17/17] dm: i2c: tegra: Convert to driver model

2014-11-11 Thread Simon Glass
This converts all Tegra boards over to use driver model for I2C. The driver
is adjusted to use driver model and the following obsolete CONFIGs are
removed:

   - CONFIG_SYS_I2C_INIT_BOARD
   - CONFIG_I2C_MULTI_BUS
   - CONFIG_SYS_MAX_I2C_BUS
   - CONFIG_SYS_I2C_SPEED
   - CONFIG_SYS_I2C

This has been tested on:
- trimslice (no I2C)
- beaver
- Jetson-TK1

It has not been tested on Tegra 114 as I don't have that board.

Signed-off-by: Simon Glass s...@chromium.org
---

Changes in v2:
- Adjust tegra_i2c_child_pre_probe() to permit generic I2C devices
- Correct the compatible strings for I2C buses
- Don't init if the speed is 0, since this breaks the controller
- Expand coverage to all Tegra boards

 arch/arm/cpu/tegra20-common/pmu.c   |  21 +-
 arch/arm/dts/tegra124-jetson-tk1.dts|   1 -
 arch/arm/dts/tegra124-norrin.dts|   1 -
 arch/arm/dts/tegra30-tec-ng.dts |   4 +
 arch/arm/include/asm/arch-tegra/tegra_i2c.h |   2 +-
 board/avionic-design/common/tamonten-ng.c   |  12 +-
 board/nvidia/cardhu/cardhu.c|  13 +-
 board/nvidia/common/board.c |   4 -
 board/nvidia/dalmore/dalmore.c  |  21 +-
 board/nvidia/whistler/whistler.c|  29 ++-
 board/toradex/apalis_t30/apalis_t30.c   |  19 +-
 drivers/i2c/tegra_i2c.c | 320 +++-
 drivers/power/tps6586x.c|  27 +--
 include/configs/apalis_t30.h|   3 -
 include/configs/beaver.h|   3 -
 include/configs/cardhu.h|   5 -
 include/configs/colibri_t30.h   |   3 -
 include/configs/dalmore.h   |   5 -
 include/configs/jetson-tk1.h|   5 -
 include/configs/norrin.h|   5 -
 include/configs/seaboard.h  |   3 -
 include/configs/tec-ng.h|   5 -
 include/configs/tegra-common.h  |   1 +
 include/configs/tegra114-common.h   |   3 -
 include/configs/tegra124-common.h   |   3 -
 include/configs/tegra20-common.h|   3 -
 include/configs/tegra30-common.h|   3 -
 include/configs/trimslice.h |   3 -
 include/configs/venice2.h   |   5 -
 include/configs/whistler.h  |   3 -
 include/tps6586x.h  |   4 +-
 31 files changed, 211 insertions(+), 328 deletions(-)

diff --git a/arch/arm/cpu/tegra20-common/pmu.c 
b/arch/arm/cpu/tegra20-common/pmu.c
index c595f70..36a76a2 100644
--- a/arch/arm/cpu/tegra20-common/pmu.c
+++ b/arch/arm/cpu/tegra20-common/pmu.c
@@ -6,6 +6,7 @@
  */
 
 #include common.h
+#include i2c.h
 #include tps6586x.h
 #include asm/io.h
 #include asm/arch/tegra.h
@@ -23,9 +24,13 @@
 #define VDD_TRANSITION_STEP0x06/* 150mv */
 #define VDD_TRANSITION_RATE0x06/* 3.52mv/us */
 
+#define PMI_I2C_ADDRESS0x34/* chip requires this address */
+
 int pmu_set_nominal(void)
 {
-   int core, cpu, bus;
+   struct udevice *bus, *dev;
+   int core, cpu;
+   int ret;
 
/* by default, the table has been filled with T25 settings */
switch (tegra_get_chip_sku()) {
@@ -42,12 +47,18 @@ int pmu_set_nominal(void)
return -1;
}
 
-   bus = tegra_i2c_get_dvc_bus_num();
-   if (bus == -1) {
+   ret = tegra_i2c_get_dvc_bus(bus);
+   if (ret) {
debug(%s: Cannot find DVC I2C bus\n, __func__);
-   return -1;
+   return ret;
}
-   tps6586x_init(bus);
+   ret = i2c_get_chip(bus, PMI_I2C_ADDRESS, dev);
+   if (ret) {
+   debug(%s: Cannot find DVC I2C chip\n, __func__);
+   return ret;
+   }
+
+   tps6586x_init(dev);
tps6586x_set_pwm_mode(TPS6586X_PWM_SM1);
return tps6586x_adjust_sm0_sm1(core, cpu, VDD_TRANSITION_STEP,
VDD_TRANSITION_RATE, VDD_RELATION);
diff --git a/arch/arm/dts/tegra124-jetson-tk1.dts 
b/arch/arm/dts/tegra124-jetson-tk1.dts
index ffad116..f6fe9a0 100644
--- a/arch/arm/dts/tegra124-jetson-tk1.dts
+++ b/arch/arm/dts/tegra124-jetson-tk1.dts
@@ -16,7 +16,6 @@
i2c2 = /i2c@7000c400;
i2c3 = /i2c@7000c500;
i2c4 = /i2c@7000c700;
-   i2c5 = /i2c@7000d100;
sdhci0 = /sdhci@700b0600;
sdhci1 = /sdhci@700b0400;
spi0 = /spi@7000d400;
diff --git a/arch/arm/dts/tegra124-norrin.dts b/arch/arm/dts/tegra124-norrin.dts
index b07630c..2dbeab8 100644
--- a/arch/arm/dts/tegra124-norrin.dts
+++ b/arch/arm/dts/tegra124-norrin.dts
@@ -13,7 +13,6 @@
i2c2 = /i2c@7000c400;
i2c3 = /i2c@7000c500;
i2c4 = /i2c@7000c700;
-   i2c5 = /i2c@7000d100;
sdhci0 = /sdhci@700b0600;
sdhci1 = /sdhci@700b0400;
spi0 = /spi@7000d400;
diff --git