Skip to contentSkip to conversation

ata: mtk_ahci: Use dev_remap_addr_index() and ofnode API

PATCH In review [email protected] 2 participants 3 messages May 26 – Jun 9

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ata: mtk_ahci: Use dev_remap_addr_index() and ofnode API

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.

---
 drivers/ata/mtk_ahci.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/ata/mtk_ahci.c +6 -6
index 53aabee0a5e..1d4245ee635 100644
@@ -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;
 }
 
Signature · 1 line
2.51.0
#1 lore raw

PATCH 2/2 ata: dwc_ahci: Use dev_read_addr_index()

From: Peng Fan <[email protected]>

Use dev_read_addr_index() which supports both live device tree and flat DT backends, avoiding direct dependency on devfdt_* helpers.

No functional changes.

---
 drivers/ata/dwc_ahci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/dwc_ahci.c +1 -1
index b480cde4465..0431d370716 100644
@@ -39,7 +39,7 @@ static int dwc_ahci_of_to_plat(struct udevice *dev)
 	priv->base = map_physmem(dev_read_addr(dev), sizeof(void *),
 				 MAP_NOCACHE);
 
-	addr = devfdt_get_addr_index(dev, 1);
+	addr = dev_read_addr_index(dev, 1);
 	if (addr != FDT_ADDR_T_NONE) {
 		priv->wrapper_base = map_physmem(addr, sizeof(void *),
 						 MAP_NOCACHE);
Signature · 1 line
2.51.0
#2 lore raw
In reply to [email protected]
Quoted 9 lines · On Tue, 26 May 2026 15:46:15 +0800, [email protected] wrote:

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.

[...]

Applied to u-boot/next, thanks!

[1/2] ata: mtk_ahci: Use dev_remap_addr_index() and ofnode API

      commit: ffbfe1cec387e35eadf522e4a7d6ffdba956158b
[2/2] ata: dwc_ahci: Use dev_read_addr_index()
      commit: 8d1d86ff58be46e17bb59b97c2ddc03f167acd05
Signature · 1 line
Tom