From: Johan Jonker <jbx6244@gmail.com>
To: dario.binacchi@amarulasolutions.com,
michael@amarulasolutions.com, sjg@chromium.org,
philipp.tomsich@vrull.eu, kever.yang@rock-chips.com
Cc: u-boot@lists.denx.de
Subject: [RFC PATCH v1 1/4] drivers: use dev_read_addr_index_ptr when cast to pointer
Date: Sat, 25 Feb 2023 20:16:37 +0100 [thread overview]
Message-ID: <0a708ae1-4b92-a572-1d74-343070c8a26b@gmail.com> (raw)
In-Reply-To: <49d0321c-72e4-429f-335e-8f23ff866d39@rock-chips.com>
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 dev_read_addr_index_ptr instead of the dev_read_addr_index
function in the various files in the drivers directory that cast
to a pointer.
Signed-off-by: Johan Jonker <jbx6244@gmail.com>
---
Note:
This is needed for a Rockchip patch serie to pass the test and
must be merged before by Rockchip maintainers:
[PATCH v4 00/11] Fixes for Rockchip NFC driver part 1
https://lore.kernel.org/u-boot/f3dba231-4a55-0a94-dfab-5cab1419d132@gmail.com/
Replacement command used:
find . -type f -exec sed -i 's/*)dev_read_addr_index(/
*)dev_read_addr_index_ptr(/g' {} +
---
drivers/mtd/nand/raw/cortina_nand.c | 4 ++--
drivers/net/dm9000x.c | 2 +-
drivers/net/dwmac_meson8b.c | 4 ++--
drivers/pci/pcie_dw_meson.c | 4 ++--
drivers/pci/pcie_dw_rockchip.c | 4 ++--
drivers/watchdog/sbsa_gwdt.c | 12 ++++++------
6 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/drivers/mtd/nand/raw/cortina_nand.c b/drivers/mtd/nand/raw/cortina_nand.c
index 88798f23..b03f3821 100644
--- a/drivers/mtd/nand/raw/cortina_nand.c
+++ b/drivers/mtd/nand/raw/cortina_nand.c
@@ -1175,8 +1175,8 @@ static int fdt_decode_nand(struct udevice *dev, struct nand_drv *info)
int ecc_strength;
info->reg = (struct nand_ctlr *)dev_read_addr(dev);
- info->dma_glb = (struct dma_global *)dev_read_addr_index(dev, 1);
- info->dma_nand = (struct dma_ssp *)dev_read_addr_index(dev, 2);
+ info->dma_glb = (struct dma_global *)dev_read_addr_index_ptr(dev, 1);
+ info->dma_nand = (struct dma_ssp *)dev_read_addr_index_ptr(dev, 2);
info->config.enabled = dev_read_enabled(dev);
ecc_strength = dev_read_u32_default(dev, "nand-ecc-strength", 16);
info->flash_base =
diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c
index b46bdeb2..5855f16b 100644
--- a/drivers/net/dm9000x.c
+++ b/drivers/net/dm9000x.c
@@ -651,7 +651,7 @@ static int dm9000_of_to_plat(struct udevice *dev)
pdata->iobase = dev_read_addr_index(dev, 0);
db->base_io = (void __iomem *)pdata->iobase;
- db->base_data = (void __iomem *)dev_read_addr_index(dev, 1);
+ db->base_data = (void __iomem *)dev_read_addr_index_ptr(dev, 1);
return 0;
}
diff --git a/drivers/net/dwmac_meson8b.c b/drivers/net/dwmac_meson8b.c
index ddbaa87d..871171e1 100644
--- a/drivers/net/dwmac_meson8b.c
+++ b/drivers/net/dwmac_meson8b.c
@@ -41,8 +41,8 @@ static int dwmac_meson8b_of_to_plat(struct udevice *dev)
{
struct dwmac_meson8b_plat *pdata = dev_get_plat(dev);
- pdata->regs = (void *)dev_read_addr_index(dev, 1);
- if ((fdt_addr_t)pdata->regs == FDT_ADDR_T_NONE)
+ pdata->regs = dev_read_addr_index_ptr(dev, 1);
+ if (!pdata->regs)
return -EINVAL;
pdata->dwmac_setup = (void *)dev_get_driver_data(dev);
diff --git a/drivers/pci/pcie_dw_meson.c b/drivers/pci/pcie_dw_meson.c
index 07da9fa5..59567883 100644
--- a/drivers/pci/pcie_dw_meson.c
+++ b/drivers/pci/pcie_dw_meson.c
@@ -337,13 +337,13 @@ static int meson_pcie_parse_dt(struct udevice *dev)
struct meson_pcie *priv = dev_get_priv(dev);
int ret;
- priv->dw.dbi_base = (void *)dev_read_addr_index(dev, 0);
+ priv->dw.dbi_base = dev_read_addr_index_ptr(dev, 0);
if (!priv->dw.dbi_base)
return -ENODEV;
dev_dbg(dev, "ELBI address is 0x%p\n", priv->dw.dbi_base);
- priv->meson_cfg_base = (void *)dev_read_addr_index(dev, 1);
+ priv->meson_cfg_base = dev_read_addr_index_ptr(dev, 1);
if (!priv->meson_cfg_base)
return -ENODEV;
diff --git a/drivers/pci/pcie_dw_rockchip.c b/drivers/pci/pcie_dw_rockchip.c
index 9322e735..2608106b 100644
--- a/drivers/pci/pcie_dw_rockchip.c
+++ b/drivers/pci/pcie_dw_rockchip.c
@@ -353,13 +353,13 @@ static int rockchip_pcie_parse_dt(struct udevice *dev)
struct rk_pcie *priv = dev_get_priv(dev);
int ret;
- priv->dw.dbi_base = (void *)dev_read_addr_index(dev, 0);
+ priv->dw.dbi_base = dev_read_addr_index_ptr(dev, 0);
if (!priv->dw.dbi_base)
return -ENODEV;
dev_dbg(dev, "DBI address is 0x%p\n", priv->dw.dbi_base);
- priv->apb_base = (void *)dev_read_addr_index(dev, 1);
+ priv->apb_base = dev_read_addr_index_ptr(dev, 1);
if (!priv->apb_base)
return -ENODEV;
diff --git a/drivers/watchdog/sbsa_gwdt.c b/drivers/watchdog/sbsa_gwdt.c
index f43cd3fd..ef402898 100644
--- a/drivers/watchdog/sbsa_gwdt.c
+++ b/drivers/watchdog/sbsa_gwdt.c
@@ -98,13 +98,13 @@ static int sbsa_gwdt_of_to_plat(struct udevice *dev)
{
struct sbsa_gwdt_priv *priv = dev_get_priv(dev);
- priv->reg_control = (void __iomem *)dev_read_addr_index(dev, 0);
- if (IS_ERR(priv->reg_control))
- return PTR_ERR(priv->reg_control);
+ priv->reg_control = (void __iomem *)dev_read_addr_index_ptr(dev, 0);
+ if (!priv->reg_control)
+ return -EINVAL;
- priv->reg_refresh = (void __iomem *)dev_read_addr_index(dev, 1);
- if (IS_ERR(priv->reg_refresh))
- return PTR_ERR(priv->reg_refresh);
+ priv->reg_refresh = (void __iomem *)dev_read_addr_index_ptr(dev, 1);
+ if (!priv->reg_refresh)
+ return -EINVAL;
return 0;
}
--
2.20.1
next prev parent reply other threads:[~2023-02-25 19:16 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-18 15:23 [PATCH v4 00/11] Fixes for Rockchip NFC driver part 1 Johan Jonker
2023-02-18 15:26 ` [PATCH v4 01/11] include: fdtdec: decouple fdt_addr_t and phys_addr_t size Johan Jonker
2023-02-23 0:47 ` Kever Yang
2023-02-23 14:06 ` [PATCH v1] spi: spi-aspeed-smc: convert devfdt_get_addr_index output to phys_addr_t Johan Jonker
2023-02-25 9:26 ` Michael Nazzareno Trimarchi
2023-02-25 9:50 ` Johan Jonker
2023-02-25 9:53 ` Michael Nazzareno Trimarchi
2023-02-25 11:40 ` Michael Nazzareno Trimarchi
2023-02-25 9:11 ` [PATCH v4 01/11] include: fdtdec: decouple fdt_addr_t and phys_addr_t size Johan Jonker
2023-02-25 9:15 ` Michael Nazzareno Trimarchi
2023-02-25 9:20 ` Johan Jonker
2023-02-25 11:43 ` [PATCH v2 1/2] core: fdtaddr: add devfdt_get_addr_size_index_ptr function Johan Jonker
2023-02-25 11:44 ` [PATCH v2 2/2] spi: spi-aspeed-smc: use devfdt_get_addr_index_ptr Johan Jonker
2023-02-25 11:47 ` Michael Nazzareno Trimarchi
2023-02-25 11:47 ` [PATCH v2 1/2] core: fdtaddr: add devfdt_get_addr_size_index_ptr function Michael Nazzareno Trimarchi
2023-02-25 16:52 ` Michael Nazzareno Trimarchi
2023-02-25 19:16 ` Johan Jonker [this message]
2023-02-25 19:19 ` [RFC PATCH v1 2/4] drivers: use dev_read_addr_ptr when cast to pointer Johan Jonker
2023-02-25 23:05 ` Johan Jonker
2023-02-25 19:19 ` [RFC PATCH v1 3/4] drivers: use devfdt_get_addr_size_index_ptr " Johan Jonker
2023-02-25 20:39 ` Michael Nazzareno Trimarchi
2023-02-27 15:17 ` Dario Binacchi
2023-02-25 19:19 ` [RFC PATCH v1 4/4] drivers: use devfdt_get_addr_index_ptr " Johan Jonker
2023-02-25 20:40 ` Michael Nazzareno Trimarchi
2023-02-25 20:37 ` [RFC PATCH v1 1/4] drivers: use dev_read_addr_index_ptr " Michael Nazzareno Trimarchi
2023-02-18 15:26 ` [PATCH v4 02/11] include: dm: ofnode: fix headers Johan Jonker
2023-02-18 15:27 ` [PATCH v4 03/11] core: remap: convert regmap_init_mem_plat() input to phys_addr_t Johan Jonker
2023-02-22 7:59 ` Kever Yang
2023-02-18 15:27 ` [PATCH v4 04/11] rockchip: adc: rockchip-saradc: use dev_read_addr_ptr Johan Jonker
2023-02-22 8:00 ` Kever Yang
2023-02-18 15:27 ` [PATCH v4 05/11] rockchip: timer: dw-apb-timer: convert dev_read_addr output to phys_addr_t Johan Jonker
2023-02-18 15:27 ` [PATCH v4 06/11] mtd: nand: raw: rockchip_nfc: use dev_read_addr_ptr Johan Jonker
2023-02-18 15:28 ` [PATCH v4 07/11] mtd: nand: raw: rockchip_nfc: remove the compatible string "rockchip,rk3308-nfc" Johan Jonker
2023-02-18 15:28 ` [PATCH v4 08/11] mtd: nand: raw: rockchip_nfc: add layout structure Johan Jonker
2023-02-18 15:28 ` [PATCH v4 09/11] mtd: nand: raw: rockchip_nfc: add flash_node to chip structure Johan Jonker
2023-02-18 15:28 ` [PATCH v4 10/11] mtd: nand: add support for the Sandisk SDTNQGAMA chip Johan Jonker
2023-02-18 15:29 ` [PATCH v4 11/11] mtd: nand: raw: rockchip_nfc: fix oobfree offset and description Johan Jonker
2023-02-22 8:01 ` Kever Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0a708ae1-4b92-a572-1d74-343070c8a26b@gmail.com \
--to=jbx6244@gmail.com \
--cc=dario.binacchi@amarulasolutions.com \
--cc=kever.yang@rock-chips.com \
--cc=michael@amarulasolutions.com \
--cc=philipp.tomsich@vrull.eu \
--cc=sjg@chromium.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox