Hi Masahiro, On 17 November 2014 11:02, Masahiro Yamada <[email protected]> wrote: > > Hi. > > > > > Another question. > > > > Can U-boot handle the address transformation? > > > > If the upper "bus" node has "ranges" property, > > it must also be checked to get the correct base address, I think. > > > I take this question back too. > Sorry for noise.
OK no problem! Also see fdt_address_cells() and fdt_size_cells() which are in libfdt now. - Simon > > > > > > > On Mon, 17 Nov 2014 19:38:41 +0900 > > Masahiro Yamada <[email protected]> wrote: > > > > > Hi. > > > > > > > > > I want to decode the base address of device nodes of my device trees. > > > > > > For example, drivers/serial/ns16550.c uses fdtdec_get_addr() function > > > to decode the "reg" property, but it is not very nice because > > > it does not check "#address-cells". > > > > > > Precisely, we need to check the parent node to get "#address-cells". > > > (If the parent does not have it, we need to search for it towards the > > > root node.) > > > > > > > > > I am looking for something like of_n_addr_cells() and of_n_size_cells() > > > functions > > > of Linux Kernel. > > > > > > > > > I don't think it is feasible in U-Boot because > > > U-Boot handles device tree blobs as they are (as flattened binaries). > > > > > > If we want to get properties of the parenet node, we must parse the DTB > > > from the > > > beginning. Yes, U-Boot actually parses the same DTB over and over again. > > > > > > Any advice? Import drivers/of/* from Linux?? > > > > > > > > > > > > Simon, do you have any good idea to solve this problem by DM? > > > For example, add "address_cells" and "size_cells" members to struct > > > udevice > > > and then modify drivers/core/simple-bus.c to parse "#address-cells" and > > > "#size-cells" > > > and pass them to children. > > > > > > > > > > _______________________________________________ > > U-Boot mailing list > > [email protected] > > http://lists.denx.de/mailman/listinfo/u-boot > > _______________________________________________ U-Boot mailing list [email protected] http://lists.denx.de/mailman/listinfo/u-boot

