aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMario Six <mario.six@gdsys.cc>2018-01-15 11:08:09 +0100
committerHeiko Schocher <hs@denx.de>2018-02-06 06:59:59 +0100
commit84a4d34e966eee81268a8c6acc591f359f045559 (patch)
tree265284ce2cb806fc3d17d7cae9854cbf5b14a7c2 /drivers
parentd4f422f88667ac27d1f039211a44515d94b48824 (diff)
downloadu-boot-84a4d34e966eee81268a8c6acc591f359f045559.zip
u-boot-84a4d34e966eee81268a8c6acc591f359f045559.tar.gz
u-boot-84a4d34e966eee81268a8c6acc591f359f045559.tar.bz2
i2c: fsl_i2c: Make live-tree compatible
Make the fsl_i2c driver compatible with a live device tree. Reviewed-by: Heiko Schocher <hs@denx.de> Signed-off-by: Mario Six <mario.six@gdsys.cc>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/fsl_i2c.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/i2c/fsl_i2c.c b/drivers/i2c/fsl_i2c.c
index a7f3ec4..cb0f5ea 100644
--- a/drivers/i2c/fsl_i2c.c
+++ b/drivers/i2c/fsl_i2c.c
@@ -574,22 +574,18 @@ static int fsl_i2c_ofdata_to_platdata(struct udevice *bus)
{
struct fsl_i2c_dev *dev = dev_get_priv(bus);
fdt_addr_t addr;
- fdt_size_t size;
- int node = dev_of_offset(bus);
- addr = fdtdec_get_addr_size_auto_noparent(gd->fdt_blob, node, "reg", 0,
- &size, false);
+ addr = dev_read_u32_default(bus, "reg", -1);
- dev->base = map_sysmem(CONFIG_SYS_IMMR + addr, size);
+ dev->base = map_sysmem(CONFIG_SYS_IMMR + addr, sizeof(struct fsl_i2c_base));
if (!dev->base)
return -ENOMEM;
- dev->index = fdtdec_get_int(gd->fdt_blob, node, "cell-index", -1);
- dev->slaveadd = fdtdec_get_int(gd->fdt_blob, node,
- "u-boot,i2c-slave-addr", 0x7f);
- dev->speed = fdtdec_get_int(gd->fdt_blob, node, "clock-frequency",
- 400000);
+ dev->index = dev_read_u32_default(bus, "cell-index", -1);
+ dev->slaveadd = dev_read_u32_default(bus, "u-boot,i2c-slave-addr",
+ 0x7f);
+ dev->speed = dev_read_u32_default(bus, "clock-frequency", 400000);
dev->i2c_clk = dev->index ? gd->arch.i2c2_clk : gd->arch.i2c1_clk;