dm: tegra: i2c: Convert to livetree
authorSimon Glass <sjg@chromium.org>
Tue, 25 Jul 2017 14:30:06 +0000 (08:30 -0600)
committerSimon Glass <sjg@chromium.org>
Fri, 28 Jul 2017 18:02:47 +0000 (12:02 -0600)
Update the tegra i2c driver to support a live device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1
Tested-by: Stephen Warren <swarren@nvidia.com>
drivers/i2c/tegra_i2c.c

index 055f48153ae03961a9f8fc4ac0649c2616e78ac7..3255e8ed37090f201b1b70845214576f9bdde8ae 100644 (file)
@@ -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) {