[PATCH v5 18/21] drivers: use devfdt_get_addr_ptr when cast to pointer

Johan Jonker jbx6244 at gmail.com
Tue Feb 28 22:21:54 CET 2023


The fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU
can expect 64-bit data from the device tree parser, so use
devfdt_get_addr_ptr instead of the devfdt_get_addr function in
the various files in the drivers directory that cast to a pointer.

Signed-off-by: Johan Jonker <jbx6244 at gmail.com>
---

Changed V5:
  new patch
---
 doc/develop/driver-model/livetree.rst | 2 +-
 drivers/clk/at91/sama7g5.c            | 2 +-
 drivers/clk/at91/sckc.c               | 2 +-
 drivers/spi/mtk_snor.c                | 2 +-
 drivers/spi/mtk_spim.c                | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/doc/develop/driver-model/livetree.rst b/doc/develop/driver-model/livetree.rst
index e9149d73..07264660 100644
--- a/doc/develop/driver-model/livetree.rst
+++ b/doc/develop/driver-model/livetree.rst
@@ -94,7 +94,7 @@ For example, the old code may be like this:
     const void *blob = gd->fdt_blob;
     int node = dev_of_offset(bus);

-    i2c_bus->regs = (struct i2c_ctlr *)devfdt_get_addr(dev);
+    i2c_bus->regs = (struct i2c_ctlr *)devfdt_get_addr_ptr(dev);
     plat->frequency = fdtdec_get_int(blob, node, "spi-max-frequency", 500000);

 The new code is:
diff --git a/drivers/clk/at91/sama7g5.c b/drivers/clk/at91/sama7g5.c
index d1ec3c82..d00016b3 100644
--- a/drivers/clk/at91/sama7g5.c
+++ b/drivers/clk/at91/sama7g5.c
@@ -1114,7 +1114,7 @@ static const struct pmc_clk_setup {

 static int sama7g5_clk_probe(struct udevice *dev)
 {
-	void __iomem *base = (void *)devfdt_get_addr(dev);
+	void __iomem *base = (void __iomem *)devfdt_get_addr_ptr(dev);
 	unsigned int *clkmuxallocs[SAMA7G5_MAX_MUX_ALLOCS];
 	unsigned int *muxallocs[SAMA7G5_MAX_MUX_ALLOCS];
 	const char *p[10];
diff --git a/drivers/clk/at91/sckc.c b/drivers/clk/at91/sckc.c
index 34ce611a..4a0ae983 100644
--- a/drivers/clk/at91/sckc.c
+++ b/drivers/clk/at91/sckc.c
@@ -123,7 +123,7 @@ U_BOOT_DRIVER(at91_sam9x60_td_slck) = {
 static int at91_sam9x60_sckc_probe(struct udevice *dev)
 {
 	struct sam9x60_sckc *sckc = dev_get_priv(dev);
-	void __iomem *base = (void *)devfdt_get_addr(dev);
+	void __iomem *base = (void __iomem *)devfdt_get_addr_ptr(dev);
 	const char *slow_rc_osc, *slow_osc;
 	const char *parents[2];
 	struct clk *clk, c;
diff --git a/drivers/spi/mtk_snor.c b/drivers/spi/mtk_snor.c
index 04f588a7..1dc55052 100644
--- a/drivers/spi/mtk_snor.c
+++ b/drivers/spi/mtk_snor.c
@@ -470,7 +470,7 @@ static int mtk_snor_probe(struct udevice *bus)
 	int ret;
 	u32 reg;

-	priv->base = (void __iomem *)devfdt_get_addr(bus);
+	priv->base = (void __iomem *)devfdt_get_addr_ptr(bus);
 	if (!priv->base)
 		return -EINVAL;

diff --git a/drivers/spi/mtk_spim.c b/drivers/spi/mtk_spim.c
index a7c0fc59..03275346 100644
--- a/drivers/spi/mtk_spim.c
+++ b/drivers/spi/mtk_spim.c
@@ -641,7 +641,7 @@ static int mtk_spim_probe(struct udevice *dev)
 	struct mtk_spim_priv *priv = dev_get_priv(dev);
 	int ret;

-	priv->base = (void __iomem *)devfdt_get_addr(dev);
+	priv->base = (void __iomem *)devfdt_get_addr_ptr(dev);
 	if (!priv->base)
 		return -EINVAL;

--
2.20.1



More information about the U-Boot mailing list