1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 08:42:12 +02:00

dm: core: Replace of_offset with accessor

At present devices use a simple integer offset to record the device tree
node associated with the device. In preparation for supporting a live
device tree, which uses a node pointer instead, refactor existing code to
access this field through an inline function.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2017-01-17 16:52:55 -07:00
parent 8aa41363eb
commit e160f7d430
220 changed files with 445 additions and 407 deletions

View File

@@ -585,21 +585,21 @@ 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, bus->of_offset,
"reg", 0, &size, false);
addr = fdtdec_get_addr_size_auto_noparent(gd->fdt_blob, node, "reg", 0,
&size, false);
dev->base = map_sysmem(CONFIG_SYS_IMMR + addr, size);
if (!dev->base)
return -ENOMEM;
dev->index = fdtdec_get_int(gd->fdt_blob, bus->of_offset,
"cell-index", -1);
dev->slaveadd = fdtdec_get_int(gd->fdt_blob, bus->of_offset,
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, bus->of_offset,
"clock-frequency", 400000);
dev->speed = fdtdec_get_int(gd->fdt_blob, node, "clock-frequency",
400000);
dev->i2c_clk = dev->index ? gd->arch.i2c2_clk : gd->arch.i2c1_clk;