diff options
Diffstat (limited to 'drivers/gpio/mt7621_gpio.c')
-rw-r--r-- | drivers/gpio/mt7621_gpio.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/gpio/mt7621_gpio.c b/drivers/gpio/mt7621_gpio.c index 612413e17b..65b4cbf61b 100644 --- a/drivers/gpio/mt7621_gpio.c +++ b/drivers/gpio/mt7621_gpio.c @@ -38,20 +38,20 @@ enum mediatek_gpio_reg { static void __iomem *mediatek_gpio_membase; -struct mediatek_gpio_platdata { +struct mediatek_gpio_plat { char bank_name[3]; /* Name of bank, e.g. "PA", "PB" etc */ int gpio_count; int bank; }; -static u32 reg_offs(struct mediatek_gpio_platdata *plat, int reg) +static u32 reg_offs(struct mediatek_gpio_plat *plat, int reg) { return (reg * 0x10) + (plat->bank * 0x4); } static int mediatek_gpio_get_value(struct udevice *dev, unsigned int offset) { - struct mediatek_gpio_platdata *plat = dev_get_platdata(dev); + struct mediatek_gpio_plat *plat = dev_get_plat(dev); return !!(ioread32(mediatek_gpio_membase + reg_offs(plat, GPIO_REG_DATA)) & BIT(offset)); @@ -60,7 +60,7 @@ static int mediatek_gpio_get_value(struct udevice *dev, unsigned int offset) static int mediatek_gpio_set_value(struct udevice *dev, unsigned int offset, int value) { - struct mediatek_gpio_platdata *plat = dev_get_platdata(dev); + struct mediatek_gpio_plat *plat = dev_get_plat(dev); iowrite32(BIT(offset), mediatek_gpio_membase + reg_offs(plat, value ? GPIO_REG_DSET : GPIO_REG_DCLR)); @@ -70,7 +70,7 @@ static int mediatek_gpio_set_value(struct udevice *dev, unsigned int offset, static int mediatek_gpio_direction_input(struct udevice *dev, unsigned int offset) { - struct mediatek_gpio_platdata *plat = dev_get_platdata(dev); + struct mediatek_gpio_plat *plat = dev_get_plat(dev); clrbits_le32(mediatek_gpio_membase + reg_offs(plat, GPIO_REG_CTRL), BIT(offset)); @@ -81,7 +81,7 @@ static int mediatek_gpio_direction_input(struct udevice *dev, unsigned int offse static int mediatek_gpio_direction_output(struct udevice *dev, unsigned int offset, int value) { - struct mediatek_gpio_platdata *plat = dev_get_platdata(dev); + struct mediatek_gpio_plat *plat = dev_get_plat(dev); setbits_le32(mediatek_gpio_membase + reg_offs(plat, GPIO_REG_CTRL), BIT(offset)); @@ -92,7 +92,7 @@ static int mediatek_gpio_direction_output(struct udevice *dev, unsigned int offs static int mediatek_gpio_get_function(struct udevice *dev, unsigned int offset) { - struct mediatek_gpio_platdata *plat = dev_get_platdata(dev); + struct mediatek_gpio_plat *plat = dev_get_plat(dev); u32 t; t = ioread32(mediatek_gpio_membase + reg_offs(plat, GPIO_REG_CTRL)); @@ -112,7 +112,7 @@ static const struct dm_gpio_ops gpio_mediatek_ops = { static int gpio_mediatek_probe(struct udevice *dev) { - struct mediatek_gpio_platdata *plat = dev_get_platdata(dev); + struct mediatek_gpio_plat *plat = dev_get_plat(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); /* Tell the uclass how many GPIOs we have */ @@ -130,7 +130,7 @@ static int gpio_mediatek_probe(struct udevice *dev) */ static int gpio_mediatek_bind(struct udevice *parent) { - struct mediatek_gpio_platdata *plat = parent->platdata; + struct mediatek_gpio_plat *plat = parent->plat; ofnode node; int bank = 0; int ret; @@ -145,7 +145,7 @@ static int gpio_mediatek_bind(struct udevice *parent) for (node = dev_read_first_subnode(parent); ofnode_valid(node); node = dev_read_next_subnode(node)) { - struct mediatek_gpio_platdata *plat; + struct mediatek_gpio_plat *plat; struct udevice *dev; plat = calloc(1, sizeof(*plat)); @@ -157,12 +157,11 @@ static int gpio_mediatek_bind(struct udevice *parent) plat->gpio_count = MTK_BANK_WIDTH; plat->bank = bank; - ret = device_bind(parent, parent->driver, - plat->bank_name, plat, -1, &dev); + ret = device_bind(parent, parent->driver, plat->bank_name, plat, + node, &dev); if (ret) return ret; - dev->node = node; bank++; } |