summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Fan <[email protected]>2026-05-25 12:06:01 +0800
committerTom Rini <[email protected]>2026-06-09 14:53:34 -0600
commitbc988983d25b19cedd76cba1903e321c52198801 (patch)
tree696c436ad0dd1737ff066af4ea04a9438f1aae14
parentb6d42b3fbf4fc3cac2e84ab0cefe1f31165b5ec1 (diff)
gpio: nx: Use dev_remap_addr()
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 <[email protected]>
-rw-r--r--drivers/gpio/nx_gpio.c7
1 files 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");