]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
pci: rcar: Use dev_read_addr_index()
authorPeng Fan <peng.fan@nxp.com>
Tue, 26 May 2026 08:09:09 +0000 (16:09 +0800)
committerNeil Armstrong <neil.armstrong@linaro.org>
Wed, 1 Jul 2026 09:42:51 +0000 (11:42 +0200)
Use dev_read_addr_index() which supports both live device tree and flat DT
backends, avoiding direct dependency on devfdt_* helpers.

While at here, correct the return value check.

No functional changes.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patch.msgid.link/20260526-devfdt-pci-v1-1-ed7f31d73938@nxp.com
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
drivers/pci/pci-rcar-gen2.c
drivers/pci/pci-rcar-gen3.c

index 08d5c4fbb8b6f8241e95e819980b8936372abd71..53cb0916741b1aca9c40e51f2e69416c6843df09 100644 (file)
@@ -10,6 +10,7 @@
 #include <clk.h>
 #include <dm.h>
 #include <errno.h>
+#include <fdtdec.h>
 #include <pci.h>
 #include <linux/bitops.h>
 
@@ -235,9 +236,9 @@ static int rcar_gen2_pci_of_to_plat(struct udevice *dev)
 {
        struct rcar_gen2_pci_priv *priv = dev_get_priv(dev);
 
-       priv->cfg_base = devfdt_get_addr_index(dev, 0);
-       priv->mem_base = devfdt_get_addr_index(dev, 1);
-       if (!priv->cfg_base || !priv->mem_base)
+       priv->cfg_base = dev_read_addr_index(dev, 0);
+       priv->mem_base = dev_read_addr_index(dev, 1);
+       if (priv->cfg_base == FDT_ADDR_T_NONE || priv->mem_base == FDT_ADDR_T_NONE)
                return -EINVAL;
 
        return 0;
index d4b4037ce1913429a84a5395df57b644cb8459e6..1925d968c16f833e4654c3b4130bd325670e18f0 100644 (file)
@@ -19,6 +19,7 @@
 #include <clk.h>
 #include <dm.h>
 #include <errno.h>
+#include <fdtdec.h>
 #include <pci.h>
 #include <wait_bit.h>
 #include <linux/bitops.h>
@@ -391,8 +392,8 @@ static int rcar_gen3_pcie_of_to_plat(struct udevice *dev)
 {
        struct rcar_gen3_pcie_priv *priv = dev_get_plat(dev);
 
-       priv->regs = devfdt_get_addr_index(dev, 0);
-       if (!priv->regs)
+       priv->regs = dev_read_addr_index(dev, 0);
+       if (priv->regs == FDT_ADDR_T_NONE)
                return -EINVAL;
 
        return 0;