[PATCH 5/5] treewide: use dev_read_addr_*_ptr() where appropriate
Simon Glass
sjg at chromium.org
Sat Oct 14 00:00:42 CEST 2023
On Wed, 27 Sept 2023 at 07:34, Matthias Schiffer
<matthias.schiffer at ew.tq-group.com> wrote:
>
> A follow-up to commit 842fb5de424e
> ("drivers: use devfdt_get_addr_size_index_ptr when cast to pointer")
> and commit 320a1938b6f7
> ("drivers: use devfdt_get_addr_index_ptr when cast to pointer").
>
> In addition to using the *_ptr variants of these functions where the
> address is cast to a pointer, this also changes devfdt_get_addr_*() to
> dev_read_addr_*() in a few places. Some variable and field types are
> changed from fdt_addr_t or phys_addr_t to void* where the cast was
> happening later.
>
> This patch fixes a number of compile warnings when building a 32bit
> U-Boot with CONFIG_PHYS_64BIT=y. In some places, it also fixes error
> handling where the return value of dev_read_addr() etc. was checked for
> NULL instead of FDT_ADDR_T_NONE.
>
> Signed-off-by: Matthias Schiffer <matthias.schiffer at ew.tq-group.com>
> ---
>
> This seems to work correctly (tested on x86 sandbox and TI AM62x; I have
> not tested the Tegra, Sun4i and BCM drivers), but I have two questions:
>
> It is not entirely clear to me what the difference between
> dev_read_addr_ptr*() and dev_remap_addr*() etc. is, but some drivers mix
> both. Should dev_remap_addr*() be used for __iomem? Is __iomem used
> consistently in U-Boot at all?
Perhaps there is no difference in U-Boot due to virtual and physical
addresses being the same mostly?
>
> Furthermore, can devfdt_get_*() be replaced with dev_read_*()
> unconditionally? Is there any reason why devfdt_get_*() hasn't been
> dropped entirely in a treewide search-and-replace?
Yes you can replace it...dev_read calls the devfdt interface if !OF_LIVE
>
> The k3-sec-proxy change goes on top of my other patch "mailbox:
> k3-sec-proxy: fix error handling for missing scfg in FDT" I submitted
> yesterday.
>
>
> arch/arm/mach-k3/sysfw-loader.c | 16 ++++++++--------
> drivers/dma/ti/k3-udma.c | 5 ++---
> drivers/gpio/tegra186_gpio.c | 4 ++--
> drivers/mailbox/k3-sec-proxy.c | 18 +++++++++---------
> drivers/phy/allwinner/phy-sun4i-usb.c | 12 ++++++------
> drivers/phy/phy-bcm-sr-pcie.c | 4 ++--
> drivers/ram/k3-am654-ddrss.c | 20 ++++++++++----------
> drivers/ram/k3-ddrss/k3-ddrss.c | 23 ++++++++++-------------
> drivers/soc/ti/k3-navss-ringacc.c | 12 ++++++------
> 9 files changed, 55 insertions(+), 59 deletions(-)
>
Reviewed-by: Simon Glass <sjg at chromium.org>
Applied to u-boot-dm, thanks!
More information about the U-Boot
mailing list