u-boot/include/dm
Mario Six e8d5291824 core: ofnode: Fix translation for #size-cells == 0
Commit 286ede6 ("drivers: core: Add translation in live tree case") made
dev_get_addr always use proper bus translations for addresses read from
the device tree. But this leads to problems with certain busses, e.g.
I2C busses, which run into an error during translation, and hence stop
working.

It turns out that of_translate_address() and fdt_translate_address()
stop the address translation with an error when they're asked to
translate addresses for busses where #size-cells == 0 (comment from
drivers/core/of_addr.c):

 * Note: We consider that crossing any level with #size-cells == 0 to mean
 * that translation is impossible (that is we are not dealing with a value
 * that can be mapped to a cpu physical address). This is not really specified
 * that way, but this is traditionally the way IBM at least do things

To fix this case, we check in both the live-tree and non-live tree-case,
whether the bus of the device whose address is about to be translated
has size-cell size zero. If this is the case, we just read the address
as a plain integer and return it, and only apply bus translations if the
size-cell size if greater than zero.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com>
Reported-by: Martin Fuzzey <mfuzzey@parkeon.com>
Fixes: 286ede6 ("drivers: core: Add translation in live tree case")
Reviewed-by: Simon Glass <sjg@chromium.org>
2018-04-01 22:19:10 +08:00
..
platform_data drivers: net: pfe_eth: LS1012A PFE headers 2018-03-22 15:05:28 -05:00
device-internal.h dm: core: Add a comment about the device_remove() flags 2017-08-17 16:44:16 +09:00
device.h dm: core: fix typo in comment (device.h) 2018-02-13 23:24:22 -05:00
fdtaddr.h dm: core: Add livetree address functions 2017-06-01 07:03:07 -06:00
lists.h dm: core: Update device_bind_driver_to_node() to use ofnode 2017-06-01 07:03:08 -06:00
of.h dm: Add more livetree helpers and definitions 2017-06-01 07:03:12 -06:00
of_access.h dm: core: add ofnode_count_phandle_with_args() 2017-07-28 23:34:08 +02:00
of_addr.h dm: core: Add livetree address functions 2017-06-01 07:03:07 -06:00
of_extra.h dm: core: Add a place to put extra device-tree reading functions 2017-06-01 07:03:07 -06:00
ofnode.h core: add ofnode_get_by_phandle() api 2018-02-23 20:48:09 +01:00
pinctrl.h dm: pinctrl: sync with Linux to use pin_config_param 2018-01-21 10:01:02 -07:00
platdata.h dm: core: remove orphaned parameter description in platdata.h 2018-01-01 09:04:19 -05:00
read.h include: dm: Fix 'devioe'/'devuce' typos 2018-01-28 09:36:28 -05:00
root.h dm: core: add clocks node scan 2017-09-11 21:43:58 -06:00
test.h dm: core: Run tests with both livetree and flat tree 2017-06-01 07:03:10 -06:00
uclass-id.h core: ofnode: Fix translation for #size-cells == 0 2018-04-01 22:19:10 +08:00
uclass-internal.h dm: core: Add a way to find a device by ofnode 2017-06-01 07:03:08 -06:00
uclass.h core: add uclass_get_device_by_phandle_id() api 2018-03-31 15:59:59 +08:00
util.h dm: replace dm_dbg() with pr_debug() 2017-10-04 12:00:21 -04:00