]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
gpio: nx: Use dev_remap_addr()
authorPeng Fan <peng.fan@nxp.com>
Mon, 25 May 2026 04:06:01 +0000 (12:06 +0800)
committerTom Rini <trini@konsulko.com>
Tue, 9 Jun 2026 20:53:34 +0000 (14:53 -0600)
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@nxp.com>
drivers/gpio/nx_gpio.c

index 5abbb34daea7e5db0c4aabe54a4e1b56c58087b9..1c3d27eb1cc6256cdd7794cc6f06bafe5e0a3885 100644 (file)
@@ -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");