From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Warren Date: Mon, 18 Dec 2017 16:03:02 -0700 Subject: [U-Boot] [PATCH v3] drivers: core: Add translation in live tree case In-Reply-To: References: <20171218083402.7712-1-mario.six@gdsys.cc> Message-ID: <4b8e72e6-989e-778c-5c53-75bbce227c25@wwwdotorg.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 12/18/2017 03:33 PM, Stephen Warren wrote: > On 12/18/2017 03:29 PM, Stephen Warren wrote: >> On 12/18/2017 01:34 AM, Mario Six wrote: >>> The function dev_read_addr calls ofnode_get_addr_index in the live tree >>> case, which does not apply bus translations to the address read from the >>> device tree. This results in illegal addresses on boards that rely on >>> bus translations being applied. >>> >>> Fix this situation by applying bus translations in the live tree case as >>> well. >> >> Tested-by: Stephen Warren > > Uggh. Sorry, I take that back. This seems to break NVIDIA Jetson TX1 > (p2371-2180 board), even though it did solve this issue that was present > on other boards in the previous patch version. I'll try and see what's > up (something to do with I2C accesses early during boot)... I guess this is something to do with: > + if (IS_ENABLED(CONFIG_OF_TRANSLATE)) { > + u64 paddr = of_translate_address(ofnode_to_np(node), &addr); > + > + return be32_to_cpu((fdt_addr_t)paddr); My tests passed on a 32-bit platform but failed on a 64-bit platform. I expect you need be64_to_cpu() there on 64-bit platforms? Actually, it should really base the bit-width on #address-cells, but we only support 32- or 64-bit at the moment so switching between the two is probably fine.