diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2016-12-07 09:23:45 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-12-07 09:23:45 -0500 |
commit | eb485c7d9e6d71e4f621edb83573cb85c1d22975 (patch) | |
tree | 5a1393c82f2bfecc14fb856a22974a2dd2985c77 /drivers/gpio | |
parent | 46a5c112a401163f5112911166ea78eb4bacdbc2 (diff) | |
parent | 6da7b0dd517592e12966af7ec55eecf6ebd2c589 (diff) |
Merge branch 'pl061' into devel
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-pl061.c | 208 |
1 files changed, 94 insertions, 114 deletions
diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c index 6e3c1430616f..0a6bfd2b06e5 100644 --- a/drivers/gpio/gpio-pl061.c +++ b/drivers/gpio/gpio-pl061.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/gpio.h> | 23 | #include <linux/gpio.h> |
24 | #include <linux/device.h> | 24 | #include <linux/device.h> |
25 | #include <linux/amba/bus.h> | 25 | #include <linux/amba/bus.h> |
26 | #include <linux/amba/pl061.h> | ||
27 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
28 | #include <linux/pinctrl/consumer.h> | 27 | #include <linux/pinctrl/consumer.h> |
29 | #include <linux/pm.h> | 28 | #include <linux/pm.h> |
@@ -50,11 +49,12 @@ struct pl061_context_save_regs { | |||
50 | }; | 49 | }; |
51 | #endif | 50 | #endif |
52 | 51 | ||
53 | struct pl061_gpio { | 52 | struct pl061 { |
54 | spinlock_t lock; | 53 | spinlock_t lock; |
55 | 54 | ||
56 | void __iomem *base; | 55 | void __iomem *base; |
57 | struct gpio_chip gc; | 56 | struct gpio_chip gc; |
57 | int parent_irq; | ||
58 | 58 | ||
59 | #ifdef CONFIG_PM | 59 | #ifdef CONFIG_PM |
60 | struct pl061_context_save_regs csave_regs; | 60 | struct pl061_context_save_regs csave_regs; |
@@ -63,22 +63,22 @@ struct pl061_gpio { | |||
63 | 63 | ||
64 | static int pl061_get_direction(struct gpio_chip *gc, unsigned offset) | 64 | static int pl061_get_direction(struct gpio_chip *gc, unsigned offset) |
65 | { | 65 | { |
66 | struct pl061_gpio *chip = gpiochip_get_data(gc); | 66 | struct pl061 *pl061 = gpiochip_get_data(gc); |
67 | 67 | ||
68 | return !(readb(chip->base + GPIODIR) & BIT(offset)); | 68 | return !(readb(pl061->base + GPIODIR) & BIT(offset)); |
69 | } | 69 | } |
70 | 70 | ||
71 | static int pl061_direction_input(struct gpio_chip *gc, unsigned offset) | 71 | static int pl061_direction_input(struct gpio_chip *gc, unsigned offset) |
72 | { | 72 | { |
73 | struct pl061_gpio *chip = gpiochip_get_data(gc); | 73 | struct pl061 *pl061 = gpiochip_get_data(gc); |
74 | unsigned long flags; | 74 | unsigned long flags; |
75 | unsigned char gpiodir; | 75 | unsigned char gpiodir; |
76 | 76 | ||
77 | spin_lock_irqsave(&chip->lock, flags); | 77 | spin_lock_irqsave(&pl061->lock, flags); |
78 | gpiodir = readb(chip->base + GPIODIR); | 78 | gpiodir = readb(pl061->base + GPIODIR); |
79 | gpiodir &= ~(BIT(offset)); | 79 | gpiodir &= ~(BIT(offset)); |
80 | writeb(gpiodir, chip->base + GPIODIR); | 80 | writeb(gpiodir, pl061->base + GPIODIR); |
81 | spin_unlock_irqrestore(&chip->lock, flags); | 81 | spin_unlock_irqrestore(&pl061->lock, flags); |
82 | 82 | ||
83 | return 0; | 83 | return 0; |
84 | } | 84 | } |
@@ -86,44 +86,44 @@ static int pl061_direction_input(struct gpio_chip *gc, unsigned offset) | |||
86 | static int pl061_direction_output(struct gpio_chip *gc, unsigned offset, | 86 | static int pl061_direction_output(struct gpio_chip *gc, unsigned offset, |
87 | int value) | 87 | int value) |
88 | { | 88 | { |
89 | struct pl061_gpio *chip = gpiochip_get_data(gc); | 89 | struct pl061 *pl061 = gpiochip_get_data(gc); |
90 | unsigned long flags; | 90 | unsigned long flags; |
91 | unsigned char gpiodir; | 91 | unsigned char gpiodir; |
92 | 92 | ||
93 | spin_lock_irqsave(&chip->lock, flags); | 93 | spin_lock_irqsave(&pl061->lock, flags); |
94 | writeb(!!value << offset, chip->base + (BIT(offset + 2))); | 94 | writeb(!!value << offset, pl061->base + (BIT(offset + 2))); |
95 | gpiodir = readb(chip->base + GPIODIR); | 95 | gpiodir = readb(pl061->base + GPIODIR); |
96 | gpiodir |= BIT(offset); | 96 | gpiodir |= BIT(offset); |
97 | writeb(gpiodir, chip->base + GPIODIR); | 97 | writeb(gpiodir, pl061->base + GPIODIR); |
98 | 98 | ||
99 | /* | 99 | /* |
100 | * gpio value is set again, because pl061 doesn't allow to set value of | 100 | * gpio value is set again, because pl061 doesn't allow to set value of |
101 | * a gpio pin before configuring it in OUT mode. | 101 | * a gpio pin before configuring it in OUT mode. |
102 | */ | 102 | */ |
103 | writeb(!!value << offset, chip->base + (BIT(offset + 2))); | 103 | writeb(!!value << offset, pl061->base + (BIT(offset + 2))); |
104 | spin_unlock_irqrestore(&chip->lock, flags); | 104 | spin_unlock_irqrestore(&pl061->lock, flags); |
105 | 105 | ||
106 | return 0; | 106 | return 0; |
107 | } | 107 | } |
108 | 108 | ||
109 | static int pl061_get_value(struct gpio_chip *gc, unsigned offset) | 109 | static int pl061_get_value(struct gpio_chip *gc, unsigned offset) |
110 | { | 110 | { |
111 | struct pl061_gpio *chip = gpiochip_get_data(gc); | 111 | struct pl061 *pl061 = gpiochip_get_data(gc); |
112 | 112 | ||
113 | return !!readb(chip->base + (BIT(offset + 2))); | 113 | return !!readb(pl061->base + (BIT(offset + 2))); |
114 | } | 114 | } |
115 | 115 | ||
116 | static void pl061_set_value(struct gpio_chip *gc, unsigned offset, int value) | 116 | static void pl061_set_value(struct gpio_chip *gc, unsigned offset, int value) |
117 | { | 117 | { |
118 | struct pl061_gpio *chip = gpiochip_get_data(gc); | 118 | struct pl061 *pl061 = gpiochip_get_data(gc); |
119 | 119 | ||
120 | writeb(!!value << offset, chip->base + (BIT(offset + 2))); | 120 | writeb(!!value << offset, pl061->base + (BIT(offset + 2))); |
121 | } | 121 | } |
122 | 122 | ||
123 | static int pl061_irq_type(struct irq_data *d, unsigned trigger) | 123 | static int pl061_irq_type(struct irq_data *d, unsigned trigger) |
124 | { | 124 | { |
125 | struct gpio_chip *gc = irq_data_get_irq_chip_data(d); | 125 | struct gpio_chip *gc = irq_data_get_irq_chip_data(d); |
126 | struct pl061_gpio *chip = gpiochip_get_data(gc); | 126 | struct pl061 *pl061 = gpiochip_get_data(gc); |
127 | int offset = irqd_to_hwirq(d); | 127 | int offset = irqd_to_hwirq(d); |
128 | unsigned long flags; | 128 | unsigned long flags; |
129 | u8 gpiois, gpioibe, gpioiev; | 129 | u8 gpiois, gpioibe, gpioiev; |
@@ -143,11 +143,11 @@ static int pl061_irq_type(struct irq_data *d, unsigned trigger) | |||
143 | } | 143 | } |
144 | 144 | ||
145 | 145 | ||
146 | spin_lock_irqsave(&chip->lock, flags); | 146 | spin_lock_irqsave(&pl061->lock, flags); |
147 | 147 | ||
148 | gpioiev = readb(chip->base + GPIOIEV); | 148 | gpioiev = readb(pl061->base + GPIOIEV); |
149 | gpiois = readb(chip->base + GPIOIS); | 149 | gpiois = readb(pl061->base + GPIOIS); |
150 | gpioibe = readb(chip->base + GPIOIBE); | 150 | gpioibe = readb(pl061->base + GPIOIBE); |
151 | 151 | ||
152 | if (trigger & (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) { | 152 | if (trigger & (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) { |
153 | bool polarity = trigger & IRQ_TYPE_LEVEL_HIGH; | 153 | bool polarity = trigger & IRQ_TYPE_LEVEL_HIGH; |
@@ -199,11 +199,11 @@ static int pl061_irq_type(struct irq_data *d, unsigned trigger) | |||
199 | offset); | 199 | offset); |
200 | } | 200 | } |
201 | 201 | ||
202 | writeb(gpiois, chip->base + GPIOIS); | 202 | writeb(gpiois, pl061->base + GPIOIS); |
203 | writeb(gpioibe, chip->base + GPIOIBE); | 203 | writeb(gpioibe, pl061->base + GPIOIBE); |
204 | writeb(gpioiev, chip->base + GPIOIEV); | 204 | writeb(gpioiev, pl061->base + GPIOIEV); |
205 | 205 | ||
206 | spin_unlock_irqrestore(&chip->lock, flags); | 206 | spin_unlock_irqrestore(&pl061->lock, flags); |
207 | 207 | ||
208 | return 0; | 208 | return 0; |
209 | } | 209 | } |
@@ -213,12 +213,12 @@ static void pl061_irq_handler(struct irq_desc *desc) | |||
213 | unsigned long pending; | 213 | unsigned long pending; |
214 | int offset; | 214 | int offset; |
215 | struct gpio_chip *gc = irq_desc_get_handler_data(desc); | 215 | struct gpio_chip *gc = irq_desc_get_handler_data(desc); |
216 | struct pl061_gpio *chip = gpiochip_get_data(gc); | 216 | struct pl061 *pl061 = gpiochip_get_data(gc); |
217 | struct irq_chip *irqchip = irq_desc_get_chip(desc); | 217 | struct irq_chip *irqchip = irq_desc_get_chip(desc); |
218 | 218 | ||
219 | chained_irq_enter(irqchip, desc); | 219 | chained_irq_enter(irqchip, desc); |
220 | 220 | ||
221 | pending = readb(chip->base + GPIOMIS); | 221 | pending = readb(pl061->base + GPIOMIS); |
222 | if (pending) { | 222 | if (pending) { |
223 | for_each_set_bit(offset, &pending, PL061_GPIO_NR) | 223 | for_each_set_bit(offset, &pending, PL061_GPIO_NR) |
224 | generic_handle_irq(irq_find_mapping(gc->irqdomain, | 224 | generic_handle_irq(irq_find_mapping(gc->irqdomain, |
@@ -231,27 +231,27 @@ static void pl061_irq_handler(struct irq_desc *desc) | |||
231 | static void pl061_irq_mask(struct irq_data *d) | 231 | static void pl061_irq_mask(struct irq_data *d) |
232 | { | 232 | { |
233 | struct gpio_chip *gc = irq_data_get_irq_chip_data(d); | 233 | struct gpio_chip *gc = irq_data_get_irq_chip_data(d); |
234 | struct pl061_gpio *chip = gpiochip_get_data(gc); | 234 | struct pl061 *pl061 = gpiochip_get_data(gc); |
235 | u8 mask = BIT(irqd_to_hwirq(d) % PL061_GPIO_NR); | 235 | u8 mask = BIT(irqd_to_hwirq(d) % PL061_GPIO_NR); |
236 | u8 gpioie; | 236 | u8 gpioie; |
237 | 237 | ||
238 | spin_lock(&chip->lock); | 238 | spin_lock(&pl061->lock); |
239 | gpioie = readb(chip->base + GPIOIE) & ~mask; | 239 | gpioie = readb(pl061->base + GPIOIE) & ~mask; |
240 | writeb(gpioie, chip->base + GPIOIE); | 240 | writeb(gpioie, pl061->base + GPIOIE); |
241 | spin_unlock(&chip->lock); | 241 | spin_unlock(&pl061->lock); |
242 | } | 242 | } |
243 | 243 | ||
244 | static void pl061_irq_unmask(struct irq_data *d) | 244 | static void pl061_irq_unmask(struct irq_data *d) |
245 | { | 245 | { |
246 | struct gpio_chip *gc = irq_data_get_irq_chip_data(d); | 246 | struct gpio_chip *gc = irq_data_get_irq_chip_data(d); |
247 | struct pl061_gpio *chip = gpiochip_get_data(gc); | 247 | struct pl061 *pl061 = gpiochip_get_data(gc); |
248 | u8 mask = BIT(irqd_to_hwirq(d) % PL061_GPIO_NR); | 248 | u8 mask = BIT(irqd_to_hwirq(d) % PL061_GPIO_NR); |
249 | u8 gpioie; | 249 | u8 gpioie; |
250 | 250 | ||
251 | spin_lock(&chip->lock); | 251 | spin_lock(&pl061->lock); |
252 | gpioie = readb(chip->base + GPIOIE) | mask; | 252 | gpioie = readb(pl061->base + GPIOIE) | mask; |
253 | writeb(gpioie, chip->base + GPIOIE); | 253 | writeb(gpioie, pl061->base + GPIOIE); |
254 | spin_unlock(&chip->lock); | 254 | spin_unlock(&pl061->lock); |
255 | } | 255 | } |
256 | 256 | ||
257 | /** | 257 | /** |
@@ -265,19 +265,20 @@ static void pl061_irq_unmask(struct irq_data *d) | |||
265 | static void pl061_irq_ack(struct irq_data *d) | 265 | static void pl061_irq_ack(struct irq_data *d) |
266 | { | 266 | { |
267 | struct gpio_chip *gc = irq_data_get_irq_chip_data(d); | 267 | struct gpio_chip *gc = irq_data_get_irq_chip_data(d); |
268 | struct pl061_gpio *chip = gpiochip_get_data(gc); | 268 | struct pl061 *pl061 = gpiochip_get_data(gc); |
269 | u8 mask = BIT(irqd_to_hwirq(d) % PL061_GPIO_NR); | 269 | u8 mask = BIT(irqd_to_hwirq(d) % PL061_GPIO_NR); |
270 | 270 | ||
271 | spin_lock(&chip->lock); | 271 | spin_lock(&pl061->lock); |
272 | writeb(mask, chip->base + GPIOIC); | 272 | writeb(mask, pl061->base + GPIOIC); |
273 | spin_unlock(&chip->lock); | 273 | spin_unlock(&pl061->lock); |
274 | } | 274 | } |
275 | 275 | ||
276 | static int pl061_irq_set_wake(struct irq_data *d, unsigned int state) | 276 | static int pl061_irq_set_wake(struct irq_data *d, unsigned int state) |
277 | { | 277 | { |
278 | struct gpio_chip *gc = irq_data_get_irq_chip_data(d); | 278 | struct gpio_chip *gc = irq_data_get_irq_chip_data(d); |
279 | struct pl061 *pl061 = gpiochip_get_data(gc); | ||
279 | 280 | ||
280 | return irq_set_irq_wake(gc->irq_parent, state); | 281 | return irq_set_irq_wake(pl061->parent_irq, state); |
281 | } | 282 | } |
282 | 283 | ||
283 | static struct irq_chip pl061_irqchip = { | 284 | static struct irq_chip pl061_irqchip = { |
@@ -292,81 +293,60 @@ static struct irq_chip pl061_irqchip = { | |||
292 | static int pl061_probe(struct amba_device *adev, const struct amba_id *id) | 293 | static int pl061_probe(struct amba_device *adev, const struct amba_id *id) |
293 | { | 294 | { |
294 | struct device *dev = &adev->dev; | 295 | struct device *dev = &adev->dev; |
295 | struct pl061_platform_data *pdata = dev_get_platdata(dev); | 296 | struct pl061 *pl061; |
296 | struct pl061_gpio *chip; | 297 | int ret, irq; |
297 | int ret, irq, i, irq_base; | ||
298 | 298 | ||
299 | chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); | 299 | pl061 = devm_kzalloc(dev, sizeof(*pl061), GFP_KERNEL); |
300 | if (chip == NULL) | 300 | if (pl061 == NULL) |
301 | return -ENOMEM; | 301 | return -ENOMEM; |
302 | 302 | ||
303 | if (pdata) { | 303 | pl061->base = devm_ioremap_resource(dev, &adev->res); |
304 | chip->gc.base = pdata->gpio_base; | 304 | if (IS_ERR(pl061->base)) |
305 | irq_base = pdata->irq_base; | 305 | return PTR_ERR(pl061->base); |
306 | if (irq_base <= 0) { | ||
307 | dev_err(&adev->dev, "invalid IRQ base in pdata\n"); | ||
308 | return -ENODEV; | ||
309 | } | ||
310 | } else { | ||
311 | chip->gc.base = -1; | ||
312 | irq_base = 0; | ||
313 | } | ||
314 | |||
315 | chip->base = devm_ioremap_resource(dev, &adev->res); | ||
316 | if (IS_ERR(chip->base)) | ||
317 | return PTR_ERR(chip->base); | ||
318 | 306 | ||
319 | spin_lock_init(&chip->lock); | 307 | spin_lock_init(&pl061->lock); |
320 | if (of_property_read_bool(dev->of_node, "gpio-ranges")) { | 308 | if (of_property_read_bool(dev->of_node, "gpio-ranges")) { |
321 | chip->gc.request = gpiochip_generic_request; | 309 | pl061->gc.request = gpiochip_generic_request; |
322 | chip->gc.free = gpiochip_generic_free; | 310 | pl061->gc.free = gpiochip_generic_free; |
323 | } | 311 | } |
324 | 312 | ||
325 | chip->gc.get_direction = pl061_get_direction; | 313 | pl061->gc.base = -1; |
326 | chip->gc.direction_input = pl061_direction_input; | 314 | pl061->gc.get_direction = pl061_get_direction; |
327 | chip->gc.direction_output = pl061_direction_output; | 315 | pl061->gc.direction_input = pl061_direction_input; |
328 | chip->gc.get = pl061_get_value; | 316 | pl061->gc.direction_output = pl061_direction_output; |
329 | chip->gc.set = pl061_set_value; | 317 | pl061->gc.get = pl061_get_value; |
330 | chip->gc.ngpio = PL061_GPIO_NR; | 318 | pl061->gc.set = pl061_set_value; |
331 | chip->gc.label = dev_name(dev); | 319 | pl061->gc.ngpio = PL061_GPIO_NR; |
332 | chip->gc.parent = dev; | 320 | pl061->gc.label = dev_name(dev); |
333 | chip->gc.owner = THIS_MODULE; | 321 | pl061->gc.parent = dev; |
334 | 322 | pl061->gc.owner = THIS_MODULE; | |
335 | ret = gpiochip_add_data(&chip->gc, chip); | 323 | |
324 | ret = gpiochip_add_data(&pl061->gc, pl061); | ||
336 | if (ret) | 325 | if (ret) |
337 | return ret; | 326 | return ret; |
338 | 327 | ||
339 | /* | 328 | /* |
340 | * irq_chip support | 329 | * irq_chip support |
341 | */ | 330 | */ |
342 | writeb(0, chip->base + GPIOIE); /* disable irqs */ | 331 | writeb(0, pl061->base + GPIOIE); /* disable irqs */ |
343 | irq = adev->irq[0]; | 332 | irq = adev->irq[0]; |
344 | if (irq < 0) { | 333 | if (irq < 0) { |
345 | dev_err(&adev->dev, "invalid IRQ\n"); | 334 | dev_err(&adev->dev, "invalid IRQ\n"); |
346 | return -ENODEV; | 335 | return -ENODEV; |
347 | } | 336 | } |
337 | pl061->parent_irq = irq; | ||
348 | 338 | ||
349 | ret = gpiochip_irqchip_add(&chip->gc, &pl061_irqchip, | 339 | ret = gpiochip_irqchip_add(&pl061->gc, &pl061_irqchip, |
350 | irq_base, handle_bad_irq, | 340 | 0, handle_bad_irq, |
351 | IRQ_TYPE_NONE); | 341 | IRQ_TYPE_NONE); |
352 | if (ret) { | 342 | if (ret) { |
353 | dev_info(&adev->dev, "could not add irqchip\n"); | 343 | dev_info(&adev->dev, "could not add irqchip\n"); |
354 | return ret; | 344 | return ret; |
355 | } | 345 | } |
356 | gpiochip_set_chained_irqchip(&chip->gc, &pl061_irqchip, | 346 | gpiochip_set_chained_irqchip(&pl061->gc, &pl061_irqchip, |
357 | irq, pl061_irq_handler); | 347 | irq, pl061_irq_handler); |
358 | 348 | ||
359 | for (i = 0; i < PL061_GPIO_NR; i++) { | 349 | amba_set_drvdata(adev, pl061); |
360 | if (pdata) { | ||
361 | if (pdata->directions & (BIT(i))) | ||
362 | pl061_direction_output(&chip->gc, i, | ||
363 | pdata->values & (BIT(i))); | ||
364 | else | ||
365 | pl061_direction_input(&chip->gc, i); | ||
366 | } | ||
367 | } | ||
368 | |||
369 | amba_set_drvdata(adev, chip); | ||
370 | dev_info(&adev->dev, "PL061 GPIO chip @%pa registered\n", | 350 | dev_info(&adev->dev, "PL061 GPIO chip @%pa registered\n", |
371 | &adev->res.start); | 351 | &adev->res.start); |
372 | 352 | ||
@@ -376,20 +356,20 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) | |||
376 | #ifdef CONFIG_PM | 356 | #ifdef CONFIG_PM |
377 | static int pl061_suspend(struct device *dev) | 357 | static int pl061_suspend(struct device *dev) |
378 | { | 358 | { |
379 | struct pl061_gpio *chip = dev_get_drvdata(dev); | 359 | struct pl061 *pl061 = dev_get_drvdata(dev); |
380 | int offset; | 360 | int offset; |
381 | 361 | ||
382 | chip->csave_regs.gpio_data = 0; | 362 | pl061->csave_regs.gpio_data = 0; |
383 | chip->csave_regs.gpio_dir = readb(chip->base + GPIODIR); | 363 | pl061->csave_regs.gpio_dir = readb(pl061->base + GPIODIR); |
384 | chip->csave_regs.gpio_is = readb(chip->base + GPIOIS); | 364 | pl061->csave_regs.gpio_is = readb(pl061->base + GPIOIS); |
385 | chip->csave_regs.gpio_ibe = readb(chip->base + GPIOIBE); | 365 | pl061->csave_regs.gpio_ibe = readb(pl061->base + GPIOIBE); |
386 | chip->csave_regs.gpio_iev = readb(chip->base + GPIOIEV); | 366 | pl061->csave_regs.gpio_iev = readb(pl061->base + GPIOIEV); |
387 | chip->csave_regs.gpio_ie = readb(chip->base + GPIOIE); | 367 | pl061->csave_regs.gpio_ie = readb(pl061->base + GPIOIE); |
388 | 368 | ||
389 | for (offset = 0; offset < PL061_GPIO_NR; offset++) { | 369 | for (offset = 0; offset < PL061_GPIO_NR; offset++) { |
390 | if (chip->csave_regs.gpio_dir & (BIT(offset))) | 370 | if (pl061->csave_regs.gpio_dir & (BIT(offset))) |
391 | chip->csave_regs.gpio_data |= | 371 | pl061->csave_regs.gpio_data |= |
392 | pl061_get_value(&chip->gc, offset) << offset; | 372 | pl061_get_value(&pl061->gc, offset) << offset; |
393 | } | 373 | } |
394 | 374 | ||
395 | return 0; | 375 | return 0; |
@@ -397,22 +377,22 @@ static int pl061_suspend(struct device *dev) | |||
397 | 377 | ||
398 | static int pl061_resume(struct device *dev) | 378 | static int pl061_resume(struct device *dev) |
399 | { | 379 | { |
400 | struct pl061_gpio *chip = dev_get_drvdata(dev); | 380 | struct pl061 *pl061 = dev_get_drvdata(dev); |
401 | int offset; | 381 | int offset; |
402 | 382 | ||
403 | for (offset = 0; offset < PL061_GPIO_NR; offset++) { | 383 | for (offset = 0; offset < PL061_GPIO_NR; offset++) { |
404 | if (chip->csave_regs.gpio_dir & (BIT(offset))) | 384 | if (pl061->csave_regs.gpio_dir & (BIT(offset))) |
405 | pl061_direction_output(&chip->gc, offset, | 385 | pl061_direction_output(&pl061->gc, offset, |
406 | chip->csave_regs.gpio_data & | 386 | pl061->csave_regs.gpio_data & |
407 | (BIT(offset))); | 387 | (BIT(offset))); |
408 | else | 388 | else |
409 | pl061_direction_input(&chip->gc, offset); | 389 | pl061_direction_input(&pl061->gc, offset); |
410 | } | 390 | } |
411 | 391 | ||
412 | writeb(chip->csave_regs.gpio_is, chip->base + GPIOIS); | 392 | writeb(pl061->csave_regs.gpio_is, pl061->base + GPIOIS); |
413 | writeb(chip->csave_regs.gpio_ibe, chip->base + GPIOIBE); | 393 | writeb(pl061->csave_regs.gpio_ibe, pl061->base + GPIOIBE); |
414 | writeb(chip->csave_regs.gpio_iev, chip->base + GPIOIEV); | 394 | writeb(pl061->csave_regs.gpio_iev, pl061->base + GPIOIEV); |
415 | writeb(chip->csave_regs.gpio_ie, chip->base + GPIOIE); | 395 | writeb(pl061->csave_regs.gpio_ie, pl061->base + GPIOIE); |
416 | 396 | ||
417 | return 0; | 397 | return 0; |
418 | } | 398 | } |