u-boot/drivers
Dario Binacchi d64b9cdcd4 fdt: translate address if #size-cells = <0>
The __of_translate_address routine translates an address from the
device tree into a CPU physical address. A note in the description of
the routine explains that the crossing of any level with
since inherited from IBM. This does not happen for Texas Instruments, or
at least for the beaglebone device tree. Without this patch, in fact,
the translation into physical addresses of the registers contained in the
am33xx-clocks.dtsi nodes would not be possible. They all have a parent
with #size-cells = <0>.

The CONFIG_OF_TRANSLATE_ZERO_SIZE_CELLS symbol makes translation
possible even in the case of crossing levels with #size-cells = <0>.

The patch acts conservatively on address translation, except for
removing a check within the of_translate_one function in the
drivers/core/of_addr.c file:

+
        ranges = of_get_property(parent, rprop, &rlen);
-       if (ranges == NULL && !of_empty_ranges_quirk(parent)) {
-               debug("no ranges; cannot translate\n");
-               return 1;
-       }
        if (ranges == NULL || rlen == 0) {
                offset = of_read_number(addr, na);
                memset(addr, 0, pna * 4);
		debug("empty ranges; 1:1 translation\n");

There are two reasons:
1 The function of_empty_ranges_quirk always returns false, invalidating
  the following if statement in case of null ranges. Therefore one of
  the two checks is useless.

2 The implementation of the of_translate_one function found in the
  common/fdt_support.c file has removed this check while keeping the one
  about the 1:1 translation.

The patch adds a test and modifies a check for the correctness of an
address in the case of enabling translation also for zero size cells.
The added test checks translations of addresses generated by nodes of
a device tree similar to those you can find in the files am33xx.dtsi
and am33xx-clocks.dtsi for which the patch was created.

The patch was also tested on a beaglebone black board. The addresses
generated for the registers of the loaded drivers are those specified
by the AM335x reference manual.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Tested-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-12 10:58:05 +05:30
..
adc dm: treewide: Rename ..._platdata variables to just ..._plat 2020-12-13 16:51:09 -07:00
ata dm: core: Access device ofnode through functions 2021-01-05 12:24:41 -07:00
axi dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
bios_emulator common: Drop linux/delay.h from common header 2020-05-18 21:19:23 -04:00
block dm: treewide: Rename dev_get_platdata() to dev_get_plat() 2020-12-13 16:51:09 -07:00
bootcount dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
bus bus: ti: add minimal sysc interconnect target driver 2021-01-12 10:58:04 +05:30
button dm: treewide: Rename 'platdata' variables to just 'plat' 2020-12-13 16:51:08 -07:00
cache dm: treewide: Rename ofdata_to_platdata() to of_to_plat() 2020-12-13 16:51:09 -07:00
clk clk: move clk-ti-sci driver to 'ti' directory 2021-01-12 10:58:05 +05:30
core fdt: translate address if #size-cells = <0> 2021-01-12 10:58:05 +05:30
cpu dm: treewide: Rename ..._platdata variables to just ..._plat 2020-12-13 16:51:09 -07:00
crypto dm: Rename U_BOOT_DEVICE() to U_BOOT_DRVINFO() 2021-01-05 12:26:35 -07:00
ddr Driver model: make some udevice fields private 2021-01-05 22:34:43 -05:00
demo dm: Rename U_BOOT_DEVICE() to U_BOOT_DRVINFO() 2021-01-05 12:26:35 -07:00
dfu dfu_mtd: Add provision to unlock mtd device 2020-12-31 14:41:31 +01:00
dma dm: treewide: Rename ofdata_to_platdata() to of_to_plat() 2020-12-13 16:51:09 -07:00
fastboot fastboot: getvar: fix partition-size return value 2020-09-01 14:47:43 +02:00
firmware dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET() 2021-01-05 12:26:35 -07:00
fpga arm: socfpga: agilex: Enable FPGA Full Reconfiguration support 2020-10-09 17:53:12 +08:00
gpio gpio: tca642x: fix input subcommand for gpio banks > 0 2021-01-12 10:21:41 +05:30
hwspinlock dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
i2c Driver model: make some udevice fields private 2021-01-05 22:34:43 -05:00
input dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
led dm: treewide: Rename ..._platdata variables to just ..._plat 2020-12-13 16:51:09 -07:00
mailbox dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
memory dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
misc Driver model: make some udevice fields private 2021-01-05 22:34:43 -05:00
mmc Driver model: make some udevice fields private 2021-01-05 22:34:43 -05:00
mtd Xilinx changes for v2021.04 2021-01-06 07:57:33 -05:00
mux dm: Use access methods for dev/uclass private data 2021-01-05 12:24:40 -07:00
net Driver model: make some udevice fields private 2021-01-05 22:34:43 -05:00
nvme Prepare v2021.01-rc5 2021-01-05 16:20:26 -05:00
pch dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
pci Driver model: make some udevice fields private 2021-01-05 22:34:43 -05:00
pci_endpoint dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
phy Driver model: make some udevice fields private 2021-01-05 22:34:43 -05:00
pinctrl Driver model: make some udevice fields private 2021-01-05 22:34:43 -05:00
power Driver model: make some udevice fields private 2021-01-05 22:34:43 -05:00
pwm dm: core: Access device ofnode through functions 2021-01-05 12:24:41 -07:00
qe net, qe: add DM support for QE UEC ethernet 2020-09-17 06:09:53 +02:00
ram dm: treewide: Rename ..._platdata variables to just ..._plat 2020-12-13 16:51:09 -07:00
remoteproc dm: Rename U_BOOT_DEVICE() to U_BOOT_DRVINFO() 2021-01-05 12:26:35 -07:00
reset Driver model: make some udevice fields private 2021-01-05 22:34:43 -05:00
rng dm: treewide: Rename ..._platdata variables to just ..._plat 2020-12-13 16:51:09 -07:00
rtc dm: Rename U_BOOT_DEVICE() to U_BOOT_DRVINFO() 2021-01-05 12:26:35 -07:00
scsi dm: treewide: Rename ..._platdata variables to just ..._plat 2020-12-13 16:51:09 -07:00
serial Xilinx changes for v2021.04 2021-01-06 07:57:33 -05:00
smem soc: qualcomm: Fix not calling dev_err with a device 2020-09-30 08:53:43 -04:00
soc dm: treewide: Rename ..._platdata variables to just ..._plat 2020-12-13 16:51:09 -07:00
sound dm: treewide: Rename ..._platdata variables to just ..._plat 2020-12-13 16:51:09 -07:00
spi spi: omap3_spi: Fix speed and mode selection 2021-01-12 10:21:41 +05:30
spmi dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
sysinfo dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
sysreset Driver model: make some udevice fields private 2021-01-05 22:34:43 -05:00
tee dm: core: Access device ofnode through functions 2021-01-05 12:24:41 -07:00
thermal dm: treewide: Rename ofdata_to_platdata() to of_to_plat() 2020-12-13 16:51:09 -07:00
timer Driver model: make some udevice fields private 2021-01-05 22:34:43 -05:00
tpm dm: treewide: Rename ofdata_to_platdata() to of_to_plat() 2020-12-13 16:51:09 -07:00
ufs dm: treewide: Rename ..._platdata variables to just ..._plat 2020-12-13 16:51:09 -07:00
usb Driver model: make some udevice fields private 2021-01-05 22:34:43 -05:00
video Xilinx changes for v2021.04 2021-01-06 07:57:33 -05:00
virtio dm: Avoid accessing seq directly 2020-12-18 20:32:21 -07:00
w1 dm: treewide: Rename ofdata_to_platdata() to of_to_plat() 2020-12-13 16:51:09 -07:00
w1-eeprom dm: treewide: Rename 'platdata' variables to just 'plat' 2020-12-13 16:51:08 -07:00
watchdog Prepare v2021.01-rc5 2021-01-05 16:20:26 -05:00
xen dm: treewide: Rename ..._platdata variables to just ..._plat 2020-12-13 16:51:09 -07:00
Kconfig board: Rename uclass to sysinfo 2020-11-06 10:18:20 +08:00
Makefile board: Rename uclass to sysinfo 2020-11-06 10:18:20 +08:00