[U-Boot] [PATCH v5 12/20] dm: tegra: i2c: Convert to livetree

Simon Glass sjg at chromium.org
Tue Jul 25 14:30:06 UTC 2017


Update the tegra i2c driver to support a live device tree.

Signed-off-by: Simon Glass <sjg at chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler at toradex.com>
Tested-on: Beaver, Jetson-TK1
---

Changes in v5: None
Changes in v4:
- Drop fdtdec.h header

Changes in v3: None
Changes in v2: None

 drivers/i2c/tegra_i2c.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/tegra_i2c.c b/drivers/i2c/tegra_i2c.c
index 055f48153a..3255e8ed37 100644
--- a/drivers/i2c/tegra_i2c.c
+++ b/drivers/i2c/tegra_i2c.c
@@ -9,7 +9,6 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
-#include <fdtdec.h>
 #include <i2c.h>
 #include <asm/io.h>
 #include <clk.h>
@@ -365,7 +364,11 @@ static int tegra_i2c_probe(struct udevice *dev)
 
 	i2c_bus->id = dev->seq;
 	i2c_bus->type = dev_get_driver_data(dev);
-	i2c_bus->regs = (struct i2c_ctlr *)devfdt_get_addr(dev);
+	i2c_bus->regs = (struct i2c_ctlr *)dev_read_addr(dev);
+	if ((ulong)i2c_bus->regs == FDT_ADDR_T_NONE) {
+		debug("%s: Cannot get regs address\n", __func__);
+		return -EINVAL;
+	}
 
 	ret = reset_get_by_name(dev, "i2c", &i2c_bus->reset_ctl);
 	if (ret) {
-- 
2.14.0.rc0.284.gd933b75aa4-goog



More information about the U-Boot mailing list