[U-Boot] [PATCH] fdt: __of_translate_address(): check parent's 'ranges' before translate

Stephen Warren swarren at wwwdotorg.org
Thu Jan 7 19:25:15 CET 2016


On 01/07/2016 04:40 AM, Przemyslaw Marczak wrote:
> The present implementation of __of_translate_address() taken
> from the Linux, is designed for translate bus/child address
> mappings by using 'ranges' property - and it doesn't allow
> for checking an address for a device's node with zero size-cells.
>
> The 'size-cells > 0' is required for bus/child address mapping,
> but is not required for non-memory mapped address, e.g.: I2C chip.
> Then when we need only raw 'reg' property's value.
>
> Since the I2C device address goes to a single-cell reg property,
> support for that case is welcome, but currently calling dev_get_addr()
> for I2C device will return 'FDT_ADDR_T_NONE', and print the warning:
>
> warning:
> __of_translate_address: Bad cell count for 'some-dev'

This patch takes the wrong approach.

It simply doesn't make sense to /attempt/ to translate an I2C address 
into an MMIO address space. It's a nonsensical operation; no such 
translation is possible under any circumstances because I2C and MMIO 
addresses mean completely different things and simply can't be 
translated to each-other.

Rather than making this nonsensical operation succeed in a way that 
gives the desired no-op result, the nonsensical operation simply 
shouldn't be performed in the first place.


More information about the U-Boot mailing list