From: Peng Fan <[email protected]>

Use dev_remap_addr_index() instead of devfdt_remap_addr_index() to map the
controller registers, removing the dependency on FDT-specific helpers.

Replace the direct fdt_get_property() lookup combined with dev_of_offset()
by dev_read_prop().

No functional changes.

Signed-off-by: Peng Fan <[email protected]>
---
 drivers/ata/mtk_ahci.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/ata/mtk_ahci.c b/drivers/ata/mtk_ahci.c
index 53aabee0a5e..1d4245ee635 100644
--- a/drivers/ata/mtk_ahci.c
+++ b/drivers/ata/mtk_ahci.c
@@ -45,7 +45,9 @@ static int mtk_ahci_of_to_plat(struct udevice *dev)
 {
        struct mtk_ahci_priv *priv = dev_get_priv(dev);
 
-       priv->base = devfdt_remap_addr_index(dev, 0);
+       priv->base = dev_remap_addr_index(dev, 0);
+       if (!priv->base)
+               return -EINVAL;
 
        return 0;
 }
@@ -54,11 +56,9 @@ static int mtk_ahci_parse_property(struct ahci_uc_priv 
*hpriv,
                                   struct udevice *dev)
 {
        struct mtk_ahci_priv *plat = dev_get_priv(dev);
-       const void *fdt = gd->fdt_blob;
 
        /* enable SATA function if needed */
-       if (fdt_get_property(fdt, dev_of_offset(dev),
-                            "mediatek,phy-mode", NULL)) {
+       if (dev_read_prop(dev, "mediatek,phy-mode", NULL)) {
                plat->mode = syscon_regmap_lookup_by_phandle(dev,
                                                "mediatek,phy-mode");
                if (IS_ERR(plat->mode)) {
@@ -69,8 +69,8 @@ static int mtk_ahci_parse_property(struct ahci_uc_priv *hpriv,
                                   SYS_CFG_SATA_MSK, SYS_CFG_SATA_EN);
        }
 
-       ofnode_read_u32(dev_ofnode(dev), "ports-implemented",
-                       &hpriv->port_map);
+       dev_read_u32(dev, "ports-implemented", &hpriv->port_map);
+
        return 0;
 }
 
-- 
2.51.0

Reply via email to