From mboxrd@z Thu Jan 1 00:00:00 1970 From: Timur Tabi Date: Tue, 10 May 2016 07:29:26 -0500 Subject: [U-Boot] [PATCH 1/3] dm: gpio: Add driver for MPC85XX GPIO controller In-Reply-To: References: <1461679708-30991-1-git-send-email-mario.six@gdsys.cc> <1461679708-30991-2-git-send-email-mario.six@gdsys.cc> Message-ID: <5731D426.1070806@tabi.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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.