summaryrefslogtreecommitdiff
path: root/drivers/gpio/mpc8xxx_gpio.c
diff options
context:
space:
mode:
authorMario Six <mario.six@gdsys.cc>2018-01-15 11:07:50 +0100
committerTom Rini <trini@konsulko.com>2018-01-28 09:36:28 -0500
commitf5ac4f2ea0b1107a82c309b416af8e55e13d33b1 (patch)
tree9f16ea218b1b5ab2456ce5f976d2cd88ad4b023b /drivers/gpio/mpc8xxx_gpio.c
parentf9c7fde2600de8c5f2f7893c7acfe3d4323f2688 (diff)
gpio: mpc8xxx: Make live-tree compatible
Make the MPC8xxx GPIO driver compatible with a live device tree. Signed-off-by: Mario Six <mario.six@gdsys.cc>
Diffstat (limited to 'drivers/gpio/mpc8xxx_gpio.c')
-rw-r--r--drivers/gpio/mpc8xxx_gpio.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/gpio/mpc8xxx_gpio.c b/drivers/gpio/mpc8xxx_gpio.c
index 0aa72ecd9f..326fd1672d 100644
--- a/drivers/gpio/mpc8xxx_gpio.c
+++ b/drivers/gpio/mpc8xxx_gpio.c
@@ -14,8 +14,6 @@
#include <mapmem.h>
#include <asm/gpio.h>
-DECLARE_GLOBAL_DATA_PTR;
-
struct ccsr_gpio {
u32 gpdir;
u32 gpodr;
@@ -181,15 +179,14 @@ static int mpc8xxx_gpio_ofdata_to_platdata(struct udevice *dev)
{
struct mpc8xxx_gpio_plat *plat = dev_get_platdata(dev);
fdt_addr_t addr;
- fdt_size_t size;
+ u32 reg[2];
+
+ dev_read_u32_array(dev, "reg", reg, 2);
+ addr = dev_translate_address(dev, reg);
- addr = fdtdec_get_addr_size_auto_noparent(gd->fdt_blob,
- dev_of_offset(dev),
- "reg", 0, &size, false);
plat->addr = addr;
- plat->size = size;
- plat->ngpios = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
- "ngpios", 32);
+ plat->size = reg[1];
+ plat->ngpios = dev_read_u32_default(dev, "ngpios", 32);
return 0;
}
@@ -206,7 +203,7 @@ static int mpc8xxx_gpio_platdata_to_priv(struct udevice *dev)
size = 0x100;
priv->addr = plat->addr;
- priv->base = map_sysmem(CONFIG_SYS_IMMR + plat->addr, size);
+ priv->base = map_sysmem(plat->addr, size);
if (!priv->base)
return -ENOMEM;