diff options
author | Haojian Zhuang <haojian.zhuang@marvell.com> | 2011-10-14 05:24:03 -0400 |
---|---|---|
committer | Haojian Zhuang <haojian.zhuang@marvell.com> | 2011-11-14 08:07:59 -0500 |
commit | df664d20814f9b3c3020ced7088a328b477ecf8d (patch) | |
tree | 24e70b148e096ff9e6c02f2eb69be35ef81f3847 /drivers/gpio/gpio-pxa.c | |
parent | 1a8d5fab16ed9401d99d0c463b5e57bdd744c8d3 (diff) |
ARM: pxa: use little endian read write in gpio driver
Remove __raw_readl()/__raw_writel(). Use readl_relaxed()/writel_relaxed()
instead.
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Diffstat (limited to 'drivers/gpio/gpio-pxa.c')
-rw-r--r-- | drivers/gpio/gpio-pxa.c | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c index aebc4e8b7fd1..31d2da4100cd 100644 --- a/drivers/gpio/gpio-pxa.c +++ b/drivers/gpio/gpio-pxa.c | |||
@@ -143,12 +143,12 @@ static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | |||
143 | 143 | ||
144 | spin_lock_irqsave(&gpio_lock, flags); | 144 | spin_lock_irqsave(&gpio_lock, flags); |
145 | 145 | ||
146 | value = __raw_readl(base + GPDR_OFFSET); | 146 | value = readl_relaxed(base + GPDR_OFFSET); |
147 | if (__gpio_is_inverted(chip->base + offset)) | 147 | if (__gpio_is_inverted(chip->base + offset)) |
148 | value |= mask; | 148 | value |= mask; |
149 | else | 149 | else |
150 | value &= ~mask; | 150 | value &= ~mask; |
151 | __raw_writel(value, base + GPDR_OFFSET); | 151 | writel_relaxed(value, base + GPDR_OFFSET); |
152 | 152 | ||
153 | spin_unlock_irqrestore(&gpio_lock, flags); | 153 | spin_unlock_irqrestore(&gpio_lock, flags); |
154 | return 0; | 154 | return 0; |
@@ -161,16 +161,16 @@ static int pxa_gpio_direction_output(struct gpio_chip *chip, | |||
161 | uint32_t tmp, mask = 1 << offset; | 161 | uint32_t tmp, mask = 1 << offset; |
162 | unsigned long flags; | 162 | unsigned long flags; |
163 | 163 | ||
164 | __raw_writel(mask, base + (value ? GPSR_OFFSET : GPCR_OFFSET)); | 164 | writel_relaxed(mask, base + (value ? GPSR_OFFSET : GPCR_OFFSET)); |
165 | 165 | ||
166 | spin_lock_irqsave(&gpio_lock, flags); | 166 | spin_lock_irqsave(&gpio_lock, flags); |
167 | 167 | ||
168 | tmp = __raw_readl(base + GPDR_OFFSET); | 168 | tmp = readl_relaxed(base + GPDR_OFFSET); |
169 | if (__gpio_is_inverted(chip->base + offset)) | 169 | if (__gpio_is_inverted(chip->base + offset)) |
170 | tmp &= ~mask; | 170 | tmp &= ~mask; |
171 | else | 171 | else |
172 | tmp |= mask; | 172 | tmp |= mask; |
173 | __raw_writel(tmp, base + GPDR_OFFSET); | 173 | writel_relaxed(tmp, base + GPDR_OFFSET); |
174 | 174 | ||
175 | spin_unlock_irqrestore(&gpio_lock, flags); | 175 | spin_unlock_irqrestore(&gpio_lock, flags); |
176 | return 0; | 176 | return 0; |
@@ -178,12 +178,12 @@ static int pxa_gpio_direction_output(struct gpio_chip *chip, | |||
178 | 178 | ||
179 | static int pxa_gpio_get(struct gpio_chip *chip, unsigned offset) | 179 | static int pxa_gpio_get(struct gpio_chip *chip, unsigned offset) |
180 | { | 180 | { |
181 | return __raw_readl(gpio_chip_base(chip) + GPLR_OFFSET) & (1 << offset); | 181 | return readl_relaxed(gpio_chip_base(chip) + GPLR_OFFSET) & (1 << offset); |
182 | } | 182 | } |
183 | 183 | ||
184 | static void pxa_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | 184 | static void pxa_gpio_set(struct gpio_chip *chip, unsigned offset, int value) |
185 | { | 185 | { |
186 | __raw_writel(1 << offset, gpio_chip_base(chip) + | 186 | writel_relaxed(1 << offset, gpio_chip_base(chip) + |
187 | (value ? GPSR_OFFSET : GPCR_OFFSET)); | 187 | (value ? GPSR_OFFSET : GPCR_OFFSET)); |
188 | } | 188 | } |
189 | 189 | ||
@@ -228,12 +228,12 @@ static inline void update_edge_detect(struct pxa_gpio_chip *c) | |||
228 | { | 228 | { |
229 | uint32_t grer, gfer; | 229 | uint32_t grer, gfer; |
230 | 230 | ||
231 | grer = __raw_readl(c->regbase + GRER_OFFSET) & ~c->irq_mask; | 231 | grer = readl_relaxed(c->regbase + GRER_OFFSET) & ~c->irq_mask; |
232 | gfer = __raw_readl(c->regbase + GFER_OFFSET) & ~c->irq_mask; | 232 | gfer = readl_relaxed(c->regbase + GFER_OFFSET) & ~c->irq_mask; |
233 | grer |= c->irq_edge_rise & c->irq_mask; | 233 | grer |= c->irq_edge_rise & c->irq_mask; |
234 | gfer |= c->irq_edge_fall & c->irq_mask; | 234 | gfer |= c->irq_edge_fall & c->irq_mask; |
235 | __raw_writel(grer, c->regbase + GRER_OFFSET); | 235 | writel_relaxed(grer, c->regbase + GRER_OFFSET); |
236 | __raw_writel(gfer, c->regbase + GFER_OFFSET); | 236 | writel_relaxed(gfer, c->regbase + GFER_OFFSET); |
237 | } | 237 | } |
238 | 238 | ||
239 | static int pxa_gpio_irq_type(struct irq_data *d, unsigned int type) | 239 | static int pxa_gpio_irq_type(struct irq_data *d, unsigned int type) |
@@ -257,12 +257,12 @@ static int pxa_gpio_irq_type(struct irq_data *d, unsigned int type) | |||
257 | type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING; | 257 | type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING; |
258 | } | 258 | } |
259 | 259 | ||
260 | gpdr = __raw_readl(c->regbase + GPDR_OFFSET); | 260 | gpdr = readl_relaxed(c->regbase + GPDR_OFFSET); |
261 | 261 | ||
262 | if (__gpio_is_inverted(gpio)) | 262 | if (__gpio_is_inverted(gpio)) |
263 | __raw_writel(gpdr | mask, c->regbase + GPDR_OFFSET); | 263 | writel_relaxed(gpdr | mask, c->regbase + GPDR_OFFSET); |
264 | else | 264 | else |
265 | __raw_writel(gpdr & ~mask, c->regbase + GPDR_OFFSET); | 265 | writel_relaxed(gpdr & ~mask, c->regbase + GPDR_OFFSET); |
266 | 266 | ||
267 | if (type & IRQ_TYPE_EDGE_RISING) | 267 | if (type & IRQ_TYPE_EDGE_RISING) |
268 | c->irq_edge_rise |= mask; | 268 | c->irq_edge_rise |= mask; |
@@ -293,9 +293,9 @@ static void pxa_gpio_demux_handler(unsigned int irq, struct irq_desc *desc) | |||
293 | for_each_gpio_chip(gpio, c) { | 293 | for_each_gpio_chip(gpio, c) { |
294 | gpio_base = c->chip.base; | 294 | gpio_base = c->chip.base; |
295 | 295 | ||
296 | gedr = __raw_readl(c->regbase + GEDR_OFFSET); | 296 | gedr = readl_relaxed(c->regbase + GEDR_OFFSET); |
297 | gedr = gedr & c->irq_mask; | 297 | gedr = gedr & c->irq_mask; |
298 | __raw_writel(gedr, c->regbase + GEDR_OFFSET); | 298 | writel_relaxed(gedr, c->regbase + GEDR_OFFSET); |
299 | 299 | ||
300 | n = find_first_bit(&gedr, BITS_PER_LONG); | 300 | n = find_first_bit(&gedr, BITS_PER_LONG); |
301 | while (n < BITS_PER_LONG) { | 301 | while (n < BITS_PER_LONG) { |
@@ -313,7 +313,7 @@ static void pxa_ack_muxed_gpio(struct irq_data *d) | |||
313 | int gpio = pxa_irq_to_gpio(d->irq); | 313 | int gpio = pxa_irq_to_gpio(d->irq); |
314 | struct pxa_gpio_chip *c = gpio_to_pxachip(gpio); | 314 | struct pxa_gpio_chip *c = gpio_to_pxachip(gpio); |
315 | 315 | ||
316 | __raw_writel(GPIO_bit(gpio), c->regbase + GEDR_OFFSET); | 316 | writel_relaxed(GPIO_bit(gpio), c->regbase + GEDR_OFFSET); |
317 | } | 317 | } |
318 | 318 | ||
319 | static void pxa_mask_muxed_gpio(struct irq_data *d) | 319 | static void pxa_mask_muxed_gpio(struct irq_data *d) |
@@ -324,10 +324,10 @@ static void pxa_mask_muxed_gpio(struct irq_data *d) | |||
324 | 324 | ||
325 | c->irq_mask &= ~GPIO_bit(gpio); | 325 | c->irq_mask &= ~GPIO_bit(gpio); |
326 | 326 | ||
327 | grer = __raw_readl(c->regbase + GRER_OFFSET) & ~GPIO_bit(gpio); | 327 | grer = readl_relaxed(c->regbase + GRER_OFFSET) & ~GPIO_bit(gpio); |
328 | gfer = __raw_readl(c->regbase + GFER_OFFSET) & ~GPIO_bit(gpio); | 328 | gfer = readl_relaxed(c->regbase + GFER_OFFSET) & ~GPIO_bit(gpio); |
329 | __raw_writel(grer, c->regbase + GRER_OFFSET); | 329 | writel_relaxed(grer, c->regbase + GRER_OFFSET); |
330 | __raw_writel(gfer, c->regbase + GFER_OFFSET); | 330 | writel_relaxed(gfer, c->regbase + GFER_OFFSET); |
331 | } | 331 | } |
332 | 332 | ||
333 | static void pxa_unmask_muxed_gpio(struct irq_data *d) | 333 | static void pxa_unmask_muxed_gpio(struct irq_data *d) |
@@ -398,9 +398,9 @@ void __init pxa_init_gpio(int mux_irq, int start, int end, set_wake_t fn) | |||
398 | 398 | ||
399 | /* clear all GPIO edge detects */ | 399 | /* clear all GPIO edge detects */ |
400 | for_each_gpio_chip(gpio, c) { | 400 | for_each_gpio_chip(gpio, c) { |
401 | __raw_writel(0, c->regbase + GFER_OFFSET); | 401 | writel_relaxed(0, c->regbase + GFER_OFFSET); |
402 | __raw_writel(0, c->regbase + GRER_OFFSET); | 402 | writel_relaxed(0, c->regbase + GRER_OFFSET); |
403 | __raw_writel(~0,c->regbase + GEDR_OFFSET); | 403 | writel_relaxed(~0,c->regbase + GEDR_OFFSET); |
404 | } | 404 | } |
405 | 405 | ||
406 | #ifdef CONFIG_ARCH_PXA | 406 | #ifdef CONFIG_ARCH_PXA |
@@ -435,13 +435,13 @@ static int pxa_gpio_suspend(void) | |||
435 | int gpio; | 435 | int gpio; |
436 | 436 | ||
437 | for_each_gpio_chip(gpio, c) { | 437 | for_each_gpio_chip(gpio, c) { |
438 | c->saved_gplr = __raw_readl(c->regbase + GPLR_OFFSET); | 438 | c->saved_gplr = readl_relaxed(c->regbase + GPLR_OFFSET); |
439 | c->saved_gpdr = __raw_readl(c->regbase + GPDR_OFFSET); | 439 | c->saved_gpdr = readl_relaxed(c->regbase + GPDR_OFFSET); |
440 | c->saved_grer = __raw_readl(c->regbase + GRER_OFFSET); | 440 | c->saved_grer = readl_relaxed(c->regbase + GRER_OFFSET); |
441 | c->saved_gfer = __raw_readl(c->regbase + GFER_OFFSET); | 441 | c->saved_gfer = readl_relaxed(c->regbase + GFER_OFFSET); |
442 | 442 | ||
443 | /* Clear GPIO transition detect bits */ | 443 | /* Clear GPIO transition detect bits */ |
444 | __raw_writel(0xffffffff, c->regbase + GEDR_OFFSET); | 444 | writel_relaxed(0xffffffff, c->regbase + GEDR_OFFSET); |
445 | } | 445 | } |
446 | return 0; | 446 | return 0; |
447 | } | 447 | } |
@@ -453,12 +453,12 @@ static void pxa_gpio_resume(void) | |||
453 | 453 | ||
454 | for_each_gpio_chip(gpio, c) { | 454 | for_each_gpio_chip(gpio, c) { |
455 | /* restore level with set/clear */ | 455 | /* restore level with set/clear */ |
456 | __raw_writel( c->saved_gplr, c->regbase + GPSR_OFFSET); | 456 | writel_relaxed( c->saved_gplr, c->regbase + GPSR_OFFSET); |
457 | __raw_writel(~c->saved_gplr, c->regbase + GPCR_OFFSET); | 457 | writel_relaxed(~c->saved_gplr, c->regbase + GPCR_OFFSET); |
458 | 458 | ||
459 | __raw_writel(c->saved_grer, c->regbase + GRER_OFFSET); | 459 | writel_relaxed(c->saved_grer, c->regbase + GRER_OFFSET); |
460 | __raw_writel(c->saved_gfer, c->regbase + GFER_OFFSET); | 460 | writel_relaxed(c->saved_gfer, c->regbase + GFER_OFFSET); |
461 | __raw_writel(c->saved_gpdr, c->regbase + GPDR_OFFSET); | 461 | writel_relaxed(c->saved_gpdr, c->regbase + GPDR_OFFSET); |
462 | } | 462 | } |
463 | } | 463 | } |
464 | #else | 464 | #else |