i2c: fsl: Use dev_read_addr
authorMario Six <mario.six@gdsys.cc>
Wed, 28 Mar 2018 12:37:43 +0000 (14:37 +0200)
committerHeiko Schocher <hs@denx.de>
Wed, 11 Apr 2018 09:34:46 +0000 (11:34 +0200)
Since bus translations are now fully supported, use a plain
"dev_read_addr" to get the device address from the device tree.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
drivers/i2c/fsl_i2c.c

index cb0f5ea2333fbe9bb0f6c402fa0a76597ec7162c..ad8eea43899fa4fd50be9eb08343ffe440033c39 100644 (file)
@@ -573,11 +573,8 @@ static int fsl_i2c_set_bus_speed(struct udevice *bus, uint speed)
 static int fsl_i2c_ofdata_to_platdata(struct udevice *bus)
 {
        struct fsl_i2c_dev *dev = dev_get_priv(bus);
-       fdt_addr_t addr;
 
-       addr = dev_read_u32_default(bus, "reg", -1);
-
-       dev->base = map_sysmem(CONFIG_SYS_IMMR + addr, sizeof(struct fsl_i2c_base));
+       dev->base = map_sysmem(dev_read_addr(bus), sizeof(struct fsl_i2c_base));
 
        if (!dev->base)
                return -ENOMEM;