diff options
author | David S. Miller <davem@davemloft.net> | 2008-09-16 17:11:43 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-09-16 17:11:43 -0400 |
commit | 2e57572a50a4de41c6cbc879a4866a312d4cd316 (patch) | |
tree | c4f58ec96c06642c4b415b881d3f0a3b673d5b44 /arch/powerpc/sysdev/cpm_common.c | |
parent | 9b2e43ae4e9609f80034dfe8de895045cac52d77 (diff) | |
parent | f948cc6ab9e61a8e88d70ee9aafc690e6d26f92c (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
Conflicts:
arch/sparc64/kernel/pci_psycho.c
Diffstat (limited to 'arch/powerpc/sysdev/cpm_common.c')
-rw-r--r-- | arch/powerpc/sysdev/cpm_common.c | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/arch/powerpc/sysdev/cpm_common.c b/arch/powerpc/sysdev/cpm_common.c index 53da8a079f96..00d3d17c84a3 100644 --- a/arch/powerpc/sysdev/cpm_common.c +++ b/arch/powerpc/sysdev/cpm_common.c | |||
@@ -254,15 +254,11 @@ static int cpm2_gpio32_get(struct gpio_chip *gc, unsigned int gpio) | |||
254 | return !!(in_be32(&iop->dat) & pin_mask); | 254 | return !!(in_be32(&iop->dat) & pin_mask); |
255 | } | 255 | } |
256 | 256 | ||
257 | static void cpm2_gpio32_set(struct gpio_chip *gc, unsigned int gpio, int value) | 257 | static void __cpm2_gpio32_set(struct of_mm_gpio_chip *mm_gc, u32 pin_mask, |
258 | int value) | ||
258 | { | 259 | { |
259 | struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); | ||
260 | struct cpm2_gpio32_chip *cpm2_gc = to_cpm2_gpio32_chip(mm_gc); | 260 | struct cpm2_gpio32_chip *cpm2_gc = to_cpm2_gpio32_chip(mm_gc); |
261 | struct cpm2_ioports __iomem *iop = mm_gc->regs; | 261 | struct cpm2_ioports __iomem *iop = mm_gc->regs; |
262 | unsigned long flags; | ||
263 | u32 pin_mask = 1 << (31 - gpio); | ||
264 | |||
265 | spin_lock_irqsave(&cpm2_gc->lock, flags); | ||
266 | 262 | ||
267 | if (value) | 263 | if (value) |
268 | cpm2_gc->cpdata |= pin_mask; | 264 | cpm2_gc->cpdata |= pin_mask; |
@@ -270,6 +266,18 @@ static void cpm2_gpio32_set(struct gpio_chip *gc, unsigned int gpio, int value) | |||
270 | cpm2_gc->cpdata &= ~pin_mask; | 266 | cpm2_gc->cpdata &= ~pin_mask; |
271 | 267 | ||
272 | out_be32(&iop->dat, cpm2_gc->cpdata); | 268 | out_be32(&iop->dat, cpm2_gc->cpdata); |
269 | } | ||
270 | |||
271 | static void cpm2_gpio32_set(struct gpio_chip *gc, unsigned int gpio, int value) | ||
272 | { | ||
273 | struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); | ||
274 | struct cpm2_gpio32_chip *cpm2_gc = to_cpm2_gpio32_chip(mm_gc); | ||
275 | unsigned long flags; | ||
276 | u32 pin_mask = 1 << (31 - gpio); | ||
277 | |||
278 | spin_lock_irqsave(&cpm2_gc->lock, flags); | ||
279 | |||
280 | __cpm2_gpio32_set(mm_gc, pin_mask, value); | ||
273 | 281 | ||
274 | spin_unlock_irqrestore(&cpm2_gc->lock, flags); | 282 | spin_unlock_irqrestore(&cpm2_gc->lock, flags); |
275 | } | 283 | } |
@@ -277,14 +285,17 @@ static void cpm2_gpio32_set(struct gpio_chip *gc, unsigned int gpio, int value) | |||
277 | static int cpm2_gpio32_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) | 285 | static int cpm2_gpio32_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) |
278 | { | 286 | { |
279 | struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); | 287 | struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); |
288 | struct cpm2_gpio32_chip *cpm2_gc = to_cpm2_gpio32_chip(mm_gc); | ||
280 | struct cpm2_ioports __iomem *iop = mm_gc->regs; | 289 | struct cpm2_ioports __iomem *iop = mm_gc->regs; |
281 | u32 pin_mask; | 290 | unsigned long flags; |
291 | u32 pin_mask = 1 << (31 - gpio); | ||
282 | 292 | ||
283 | pin_mask = 1 << (31 - gpio); | 293 | spin_lock_irqsave(&cpm2_gc->lock, flags); |
284 | 294 | ||
285 | setbits32(&iop->dir, pin_mask); | 295 | setbits32(&iop->dir, pin_mask); |
296 | __cpm2_gpio32_set(mm_gc, pin_mask, val); | ||
286 | 297 | ||
287 | cpm2_gpio32_set(gc, gpio, val); | 298 | spin_unlock_irqrestore(&cpm2_gc->lock, flags); |
288 | 299 | ||
289 | return 0; | 300 | return 0; |
290 | } | 301 | } |
@@ -292,13 +303,17 @@ static int cpm2_gpio32_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) | |||
292 | static int cpm2_gpio32_dir_in(struct gpio_chip *gc, unsigned int gpio) | 303 | static int cpm2_gpio32_dir_in(struct gpio_chip *gc, unsigned int gpio) |
293 | { | 304 | { |
294 | struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); | 305 | struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); |
306 | struct cpm2_gpio32_chip *cpm2_gc = to_cpm2_gpio32_chip(mm_gc); | ||
295 | struct cpm2_ioports __iomem *iop = mm_gc->regs; | 307 | struct cpm2_ioports __iomem *iop = mm_gc->regs; |
296 | u32 pin_mask; | 308 | unsigned long flags; |
309 | u32 pin_mask = 1 << (31 - gpio); | ||
297 | 310 | ||
298 | pin_mask = 1 << (31 - gpio); | 311 | spin_lock_irqsave(&cpm2_gc->lock, flags); |
299 | 312 | ||
300 | clrbits32(&iop->dir, pin_mask); | 313 | clrbits32(&iop->dir, pin_mask); |
301 | 314 | ||
315 | spin_unlock_irqrestore(&cpm2_gc->lock, flags); | ||
316 | |||
302 | return 0; | 317 | return 0; |
303 | } | 318 | } |
304 | 319 | ||