[PATCH 1/2] gpio: nx: Use dev_remap_addr()

peng.fan at nxp.com peng.fan at nxp.com
Mon May 25 06:06:01 CEST 2026


From: Peng Fan <peng.fan at nxp.com>

Use dev_remap_addr() to simplify code.

dev_remap_addr() does same thing as dev_read_addr() + map_physmem(). And
it supports both live device tree and flat DT backends, avoiding direct
dependency on devfdt_* helpers.

Also add error handling logic.

No functional changes.

Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
 drivers/gpio/nx_gpio.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/nx_gpio.c b/drivers/gpio/nx_gpio.c
index 5abbb34daea..1c3d27eb1cc 100644
--- a/drivers/gpio/nx_gpio.c
+++ b/drivers/gpio/nx_gpio.c
@@ -213,9 +213,10 @@ static int nx_gpio_of_to_plat(struct udevice *dev)
 {
 	struct nx_gpio_plat *plat = dev_get_plat(dev);
 
-	plat->regs = map_physmem(devfdt_get_addr(dev),
-				 sizeof(struct nx_gpio_regs),
-				 MAP_NOCACHE);
+	plat->regs = dev_remap_addr(dev);
+	if (!plat->regs)
+		return -EINVAL;
+
 	plat->gpio_count = dev_read_s32_default(dev, "nexell,gpio-bank-width",
 						32);
 	plat->bank_name = dev_read_string(dev, "gpio-bank-name");
-- 
2.51.0



More information about the U-Boot mailing list