diff options
-rw-r--r-- | drivers/gpio/gpio-vf610.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c index 9031e60c815c..6284bdbe1e0c 100644 --- a/drivers/gpio/gpio-vf610.c +++ b/drivers/gpio/gpio-vf610.c | |||
@@ -62,11 +62,6 @@ struct vf610_gpio_port { | |||
62 | 62 | ||
63 | static struct irq_chip vf610_gpio_irq_chip; | 63 | static struct irq_chip vf610_gpio_irq_chip; |
64 | 64 | ||
65 | static struct vf610_gpio_port *to_vf610_gp(struct gpio_chip *gc) | ||
66 | { | ||
67 | return container_of(gc, struct vf610_gpio_port, gc); | ||
68 | } | ||
69 | |||
70 | static const struct of_device_id vf610_gpio_dt_ids[] = { | 65 | static const struct of_device_id vf610_gpio_dt_ids[] = { |
71 | { .compatible = "fsl,vf610-gpio" }, | 66 | { .compatible = "fsl,vf610-gpio" }, |
72 | { /* sentinel */ } | 67 | { /* sentinel */ } |
@@ -84,14 +79,14 @@ static inline u32 vf610_gpio_readl(void __iomem *reg) | |||
84 | 79 | ||
85 | static int vf610_gpio_get(struct gpio_chip *gc, unsigned int gpio) | 80 | static int vf610_gpio_get(struct gpio_chip *gc, unsigned int gpio) |
86 | { | 81 | { |
87 | struct vf610_gpio_port *port = to_vf610_gp(gc); | 82 | struct vf610_gpio_port *port = gpiochip_get_data(gc); |
88 | 83 | ||
89 | return !!(vf610_gpio_readl(port->gpio_base + GPIO_PDIR) & BIT(gpio)); | 84 | return !!(vf610_gpio_readl(port->gpio_base + GPIO_PDIR) & BIT(gpio)); |
90 | } | 85 | } |
91 | 86 | ||
92 | static void vf610_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) | 87 | static void vf610_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) |
93 | { | 88 | { |
94 | struct vf610_gpio_port *port = to_vf610_gp(gc); | 89 | struct vf610_gpio_port *port = gpiochip_get_data(gc); |
95 | unsigned long mask = BIT(gpio); | 90 | unsigned long mask = BIT(gpio); |
96 | 91 | ||
97 | if (val) | 92 | if (val) |
@@ -116,7 +111,7 @@ static int vf610_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, | |||
116 | static void vf610_gpio_irq_handler(struct irq_desc *desc) | 111 | static void vf610_gpio_irq_handler(struct irq_desc *desc) |
117 | { | 112 | { |
118 | struct vf610_gpio_port *port = | 113 | struct vf610_gpio_port *port = |
119 | to_vf610_gp(irq_desc_get_handler_data(desc)); | 114 | gpiochip_get_data(irq_desc_get_handler_data(desc)); |
120 | struct irq_chip *chip = irq_desc_get_chip(desc); | 115 | struct irq_chip *chip = irq_desc_get_chip(desc); |
121 | int pin; | 116 | int pin; |
122 | unsigned long irq_isfr; | 117 | unsigned long irq_isfr; |
@@ -137,7 +132,7 @@ static void vf610_gpio_irq_handler(struct irq_desc *desc) | |||
137 | static void vf610_gpio_irq_ack(struct irq_data *d) | 132 | static void vf610_gpio_irq_ack(struct irq_data *d) |
138 | { | 133 | { |
139 | struct vf610_gpio_port *port = | 134 | struct vf610_gpio_port *port = |
140 | to_vf610_gp(irq_data_get_irq_chip_data(d)); | 135 | gpiochip_get_data(irq_data_get_irq_chip_data(d)); |
141 | int gpio = d->hwirq; | 136 | int gpio = d->hwirq; |
142 | 137 | ||
143 | vf610_gpio_writel(BIT(gpio), port->base + PORT_ISFR); | 138 | vf610_gpio_writel(BIT(gpio), port->base + PORT_ISFR); |
@@ -146,7 +141,7 @@ static void vf610_gpio_irq_ack(struct irq_data *d) | |||
146 | static int vf610_gpio_irq_set_type(struct irq_data *d, u32 type) | 141 | static int vf610_gpio_irq_set_type(struct irq_data *d, u32 type) |
147 | { | 142 | { |
148 | struct vf610_gpio_port *port = | 143 | struct vf610_gpio_port *port = |
149 | to_vf610_gp(irq_data_get_irq_chip_data(d)); | 144 | gpiochip_get_data(irq_data_get_irq_chip_data(d)); |
150 | u8 irqc; | 145 | u8 irqc; |
151 | 146 | ||
152 | switch (type) { | 147 | switch (type) { |
@@ -182,7 +177,7 @@ static int vf610_gpio_irq_set_type(struct irq_data *d, u32 type) | |||
182 | static void vf610_gpio_irq_mask(struct irq_data *d) | 177 | static void vf610_gpio_irq_mask(struct irq_data *d) |
183 | { | 178 | { |
184 | struct vf610_gpio_port *port = | 179 | struct vf610_gpio_port *port = |
185 | to_vf610_gp(irq_data_get_irq_chip_data(d)); | 180 | gpiochip_get_data(irq_data_get_irq_chip_data(d)); |
186 | void __iomem *pcr_base = port->base + PORT_PCR(d->hwirq); | 181 | void __iomem *pcr_base = port->base + PORT_PCR(d->hwirq); |
187 | 182 | ||
188 | vf610_gpio_writel(0, pcr_base); | 183 | vf610_gpio_writel(0, pcr_base); |
@@ -191,7 +186,7 @@ static void vf610_gpio_irq_mask(struct irq_data *d) | |||
191 | static void vf610_gpio_irq_unmask(struct irq_data *d) | 186 | static void vf610_gpio_irq_unmask(struct irq_data *d) |
192 | { | 187 | { |
193 | struct vf610_gpio_port *port = | 188 | struct vf610_gpio_port *port = |
194 | to_vf610_gp(irq_data_get_irq_chip_data(d)); | 189 | gpiochip_get_data(irq_data_get_irq_chip_data(d)); |
195 | void __iomem *pcr_base = port->base + PORT_PCR(d->hwirq); | 190 | void __iomem *pcr_base = port->base + PORT_PCR(d->hwirq); |
196 | 191 | ||
197 | vf610_gpio_writel(port->irqc[d->hwirq] << PORT_PCR_IRQC_OFFSET, | 192 | vf610_gpio_writel(port->irqc[d->hwirq] << PORT_PCR_IRQC_OFFSET, |
@@ -201,7 +196,7 @@ static void vf610_gpio_irq_unmask(struct irq_data *d) | |||
201 | static int vf610_gpio_irq_set_wake(struct irq_data *d, u32 enable) | 196 | static int vf610_gpio_irq_set_wake(struct irq_data *d, u32 enable) |
202 | { | 197 | { |
203 | struct vf610_gpio_port *port = | 198 | struct vf610_gpio_port *port = |
204 | to_vf610_gp(irq_data_get_irq_chip_data(d)); | 199 | gpiochip_get_data(irq_data_get_irq_chip_data(d)); |
205 | 200 | ||
206 | if (enable) | 201 | if (enable) |
207 | enable_irq_wake(port->irq); | 202 | enable_irq_wake(port->irq); |
@@ -261,7 +256,7 @@ static int vf610_gpio_probe(struct platform_device *pdev) | |||
261 | gc->direction_output = vf610_gpio_direction_output; | 256 | gc->direction_output = vf610_gpio_direction_output; |
262 | gc->set = vf610_gpio_set; | 257 | gc->set = vf610_gpio_set; |
263 | 258 | ||
264 | ret = gpiochip_add(gc); | 259 | ret = gpiochip_add_data(gc, port); |
265 | if (ret < 0) | 260 | if (ret < 0) |
266 | return ret; | 261 | return ret; |
267 | 262 | ||