diff options
author | Lad, Prabhakar <prabhakar.csengg@gmail.com> | 2013-12-11 12:52:07 -0500 |
---|---|---|
committer | Sekhar Nori <nsekhar@ti.com> | 2013-12-25 13:32:10 -0500 |
commit | 388291c3a1eb6fec7ec673939fdc2a8e4bce550f (patch) | |
tree | 40723b6edcd75bf9c2802685729d4e840d145aab /drivers/gpio/gpio-davinci.c | |
parent | 319e2e3f63c348a9b66db4667efa73178e18b17d (diff) |
gpio: davinci: use {readl|writel}_relaxed() instead of __raw_*
This patch replaces the __raw_readl/writel with
{readl|writel}_relaxed(), Altough the code runs on ARMv5
based SOCs, changing this will help using code for other
use cases (like with big-endian machines).
Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Diffstat (limited to 'drivers/gpio/gpio-davinci.c')
-rw-r--r-- | drivers/gpio/gpio-davinci.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c index 84be70157ad6..805552c9c0ef 100644 --- a/drivers/gpio/gpio-davinci.c +++ b/drivers/gpio/gpio-davinci.c | |||
@@ -82,14 +82,14 @@ static inline int __davinci_direction(struct gpio_chip *chip, | |||
82 | u32 mask = 1 << offset; | 82 | u32 mask = 1 << offset; |
83 | 83 | ||
84 | spin_lock_irqsave(&d->lock, flags); | 84 | spin_lock_irqsave(&d->lock, flags); |
85 | temp = __raw_readl(&g->dir); | 85 | temp = readl_relaxed(&g->dir); |
86 | if (out) { | 86 | if (out) { |
87 | temp &= ~mask; | 87 | temp &= ~mask; |
88 | __raw_writel(mask, value ? &g->set_data : &g->clr_data); | 88 | writel_relaxed(mask, value ? &g->set_data : &g->clr_data); |
89 | } else { | 89 | } else { |
90 | temp |= mask; | 90 | temp |= mask; |
91 | } | 91 | } |
92 | __raw_writel(temp, &g->dir); | 92 | writel_relaxed(temp, &g->dir); |
93 | spin_unlock_irqrestore(&d->lock, flags); | 93 | spin_unlock_irqrestore(&d->lock, flags); |
94 | 94 | ||
95 | return 0; | 95 | return 0; |
@@ -118,7 +118,7 @@ static int davinci_gpio_get(struct gpio_chip *chip, unsigned offset) | |||
118 | struct davinci_gpio_controller *d = chip2controller(chip); | 118 | struct davinci_gpio_controller *d = chip2controller(chip); |
119 | struct davinci_gpio_regs __iomem *g = d->regs; | 119 | struct davinci_gpio_regs __iomem *g = d->regs; |
120 | 120 | ||
121 | return (1 << offset) & __raw_readl(&g->in_data); | 121 | return (1 << offset) & readl_relaxed(&g->in_data); |
122 | } | 122 | } |
123 | 123 | ||
124 | /* | 124 | /* |
@@ -130,7 +130,7 @@ davinci_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | |||
130 | struct davinci_gpio_controller *d = chip2controller(chip); | 130 | struct davinci_gpio_controller *d = chip2controller(chip); |
131 | struct davinci_gpio_regs __iomem *g = d->regs; | 131 | struct davinci_gpio_regs __iomem *g = d->regs; |
132 | 132 | ||
133 | __raw_writel((1 << offset), value ? &g->set_data : &g->clr_data); | 133 | writel_relaxed((1 << offset), value ? &g->set_data : &g->clr_data); |
134 | } | 134 | } |
135 | 135 | ||
136 | static int davinci_gpio_probe(struct platform_device *pdev) | 136 | static int davinci_gpio_probe(struct platform_device *pdev) |
@@ -227,8 +227,8 @@ static void gpio_irq_disable(struct irq_data *d) | |||
227 | struct davinci_gpio_regs __iomem *g = irq2regs(d->irq); | 227 | struct davinci_gpio_regs __iomem *g = irq2regs(d->irq); |
228 | u32 mask = (u32) irq_data_get_irq_handler_data(d); | 228 | u32 mask = (u32) irq_data_get_irq_handler_data(d); |
229 | 229 | ||
230 | __raw_writel(mask, &g->clr_falling); | 230 | writel_relaxed(mask, &g->clr_falling); |
231 | __raw_writel(mask, &g->clr_rising); | 231 | writel_relaxed(mask, &g->clr_rising); |
232 | } | 232 | } |
233 | 233 | ||
234 | static void gpio_irq_enable(struct irq_data *d) | 234 | static void gpio_irq_enable(struct irq_data *d) |
@@ -242,9 +242,9 @@ static void gpio_irq_enable(struct irq_data *d) | |||
242 | status = IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING; | 242 | status = IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING; |
243 | 243 | ||
244 | if (status & IRQ_TYPE_EDGE_FALLING) | 244 | if (status & IRQ_TYPE_EDGE_FALLING) |
245 | __raw_writel(mask, &g->set_falling); | 245 | writel_relaxed(mask, &g->set_falling); |
246 | if (status & IRQ_TYPE_EDGE_RISING) | 246 | if (status & IRQ_TYPE_EDGE_RISING) |
247 | __raw_writel(mask, &g->set_rising); | 247 | writel_relaxed(mask, &g->set_rising); |
248 | } | 248 | } |
249 | 249 | ||
250 | static int gpio_irq_type(struct irq_data *d, unsigned trigger) | 250 | static int gpio_irq_type(struct irq_data *d, unsigned trigger) |
@@ -286,10 +286,10 @@ gpio_irq_handler(unsigned irq, struct irq_desc *desc) | |||
286 | int res; | 286 | int res; |
287 | 287 | ||
288 | /* ack any irqs */ | 288 | /* ack any irqs */ |
289 | status = __raw_readl(&g->intstat) & mask; | 289 | status = readl_relaxed(&g->intstat) & mask; |
290 | if (!status) | 290 | if (!status) |
291 | break; | 291 | break; |
292 | __raw_writel(status, &g->intstat); | 292 | writel_relaxed(status, &g->intstat); |
293 | 293 | ||
294 | /* now demux them to the right lowlevel handler */ | 294 | /* now demux them to the right lowlevel handler */ |
295 | n = d->irq_base; | 295 | n = d->irq_base; |
@@ -346,9 +346,9 @@ static int gpio_irq_type_unbanked(struct irq_data *data, unsigned trigger) | |||
346 | if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) | 346 | if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) |
347 | return -EINVAL; | 347 | return -EINVAL; |
348 | 348 | ||
349 | __raw_writel(mask, (trigger & IRQ_TYPE_EDGE_FALLING) | 349 | writel_relaxed(mask, (trigger & IRQ_TYPE_EDGE_FALLING) |
350 | ? &g->set_falling : &g->clr_falling); | 350 | ? &g->set_falling : &g->clr_falling); |
351 | __raw_writel(mask, (trigger & IRQ_TYPE_EDGE_RISING) | 351 | writel_relaxed(mask, (trigger & IRQ_TYPE_EDGE_RISING) |
352 | ? &g->set_rising : &g->clr_rising); | 352 | ? &g->set_rising : &g->clr_rising); |
353 | 353 | ||
354 | return 0; | 354 | return 0; |
@@ -432,8 +432,8 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) | |||
432 | 432 | ||
433 | /* default trigger: both edges */ | 433 | /* default trigger: both edges */ |
434 | g = gpio2regs(0); | 434 | g = gpio2regs(0); |
435 | __raw_writel(~0, &g->set_falling); | 435 | writel_relaxed(~0, &g->set_falling); |
436 | __raw_writel(~0, &g->set_rising); | 436 | writel_relaxed(~0, &g->set_rising); |
437 | 437 | ||
438 | /* set the direct IRQs up to use that irqchip */ | 438 | /* set the direct IRQs up to use that irqchip */ |
439 | for (gpio = 0; gpio < pdata->gpio_unbanked; gpio++, irq++) { | 439 | for (gpio = 0; gpio < pdata->gpio_unbanked; gpio++, irq++) { |
@@ -456,8 +456,8 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) | |||
456 | 456 | ||
457 | /* disabled by default, enabled only as needed */ | 457 | /* disabled by default, enabled only as needed */ |
458 | g = gpio2regs(gpio); | 458 | g = gpio2regs(gpio); |
459 | __raw_writel(~0, &g->clr_falling); | 459 | writel_relaxed(~0, &g->clr_falling); |
460 | __raw_writel(~0, &g->clr_rising); | 460 | writel_relaxed(~0, &g->clr_rising); |
461 | 461 | ||
462 | /* set up all irqs in this bank */ | 462 | /* set up all irqs in this bank */ |
463 | irq_set_chained_handler(bank_irq, gpio_irq_handler); | 463 | irq_set_chained_handler(bank_irq, gpio_irq_handler); |
@@ -485,7 +485,7 @@ done: | |||
485 | * BINTEN -- per-bank interrupt enable. genirq would also let these | 485 | * BINTEN -- per-bank interrupt enable. genirq would also let these |
486 | * bits be set/cleared dynamically. | 486 | * bits be set/cleared dynamically. |
487 | */ | 487 | */ |
488 | __raw_writel(binten, gpio_base + BINTEN); | 488 | writel_relaxed(binten, gpio_base + BINTEN); |
489 | 489 | ||
490 | printk(KERN_INFO "DaVinci: %d gpio irqs\n", irq - gpio_to_irq(0)); | 490 | printk(KERN_INFO "DaVinci: %d gpio irqs\n", irq - gpio_to_irq(0)); |
491 | 491 | ||