summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJean-Jacques Hiblot <jjhiblot@ti.com>2017-02-13 15:17:48 (GMT)
committerSimon Glass <sjg@chromium.org>2017-03-22 13:27:19 (GMT)
commit1804044f30872075ee1996631caa18b617f3c718 (patch)
tree03217671a0abc87b66f81dc6ffebd1eda0b59f2a /drivers
parentb0d9512ab0f1b2c3f56346bf14b0978d45477ad2 (diff)
downloadu-boot-fsl-qoriq-1804044f30872075ee1996631caa18b617f3c718.tar.xz
regmap: use fdt address translation
In the DTS, the addresses are defined relative to the parent bus. We need to translate them to get the address as seen by the CPU core. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/core/regmap.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/core/regmap.c b/drivers/core/regmap.c
index 833cd78..3bec3df 100644
--- a/drivers/core/regmap.c
+++ b/drivers/core/regmap.c
@@ -70,6 +70,7 @@ int regmap_init_mem(struct udevice *dev, struct regmap **mapp)
int addr_len, size_len, both_len;
int parent;
int len;
+ int index;
parent = dev_of_offset(dev->parent);
addr_len = fdt_address_cells(blob, parent);
@@ -86,13 +87,14 @@ int regmap_init_mem(struct udevice *dev, struct regmap **mapp)
if (!map)
return -ENOMEM;
- map->base = fdtdec_get_number(cell, addr_len);
-
- for (range = map->range; count > 0;
- count--, cell += both_len, range++) {
- range->start = fdtdec_get_number(cell, addr_len);
- range->size = fdtdec_get_number(cell + addr_len, size_len);
+ for (range = map->range, index = 0; count > 0;
+ count--, cell += both_len, range++, index++) {
+ fdt_size_t sz;
+ range->start = fdtdec_get_addr_size_fixed(blob, dev->of_offset,
+ "reg", index, addr_len, size_len, &sz, true);
+ range->size = sz;
}
+ map->base = map->range[0].start;
*mapp = map;