]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
ata: mtk_ahci: Use dev_remap_addr_index() and ofnode API
authorPeng Fan <peng.fan@nxp.com>
Tue, 26 May 2026 07:46:15 +0000 (15:46 +0800)
committerTom Rini <trini@konsulko.com>
Tue, 9 Jun 2026 22:00:11 +0000 (16:00 -0600)
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 <peng.fan@nxp.com>
drivers/ata/mtk_ahci.c

index 53aabee0a5e6a992691645c86e8d827317806c46..1d4245ee6356634ee3d115f03ea86274c198c694 100644 (file)
@@ -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;
 }