[U-Boot] [PATCH 1/3] dm: gpio: Add driver for MPC85XX GPIO controller

Timur Tabi
2016-05-10T12:29:26Z

Mario Six wrote:
>
> The problem is that in 36-bit mode the physical addresses are 64-bit, which
> means that you get 64-bit integers when you read something from the
> device tree
> with fdtdec_get_addr. But the device tree addresses themselves seem to be
> 32-bit, because if I read a property like 'reg = <0xf000 0x100>', I get a
> 64-bit value that contains two 32-bit values, so I have to do 'addr = reg >>
> 32; size = reg & 0xFFFFFFFF;' to extract them (see the patch). Doing
> that poses
> a problem if you use the 32-bit mode, though, since then the physical
> addresses
> are 32-bit.
>
> After reading your comment (and a bit of digging), I found the
> fdtdec_get_addr_size_auto_noparent function, which seems to fix that problem
> (by taking the parent's address-size values into account). I'll respin the
> patches with that function and Simon's concerns addressed.

Addresses from the reg properties should be read with functions like
platform_get_resource(). You're not supposed to be reading the device
tree properties directly.