diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-12 20:24:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-12 20:24:29 -0400 |
commit | 1bc4a5be0acbd16de4df6e4fb73a76fa92e9a521 (patch) | |
tree | 207efb416a3704ef6b13cb9eb2cd0a001983876b | |
parent | cf00c55e3d30b242d6f6530e61a7bc828124f0a3 (diff) | |
parent | 2760f7adbb6c4e39bd3ae733f56d4ac8fb5e3521 (diff) |
Merge tag 'gpio-for-linus' of git://git.secretlab.ca/git/linux-2.6
Pull a few more GPIO bug fixes from Grant Likely:
"Oops, missed a couple. Here's an updated pull req for GPIO"
A set of PCH bug fixes, and one patch to fix up compile warnings
* tag 'gpio-for-linus' of git://git.secretlab.ca/git/linux-2.6:
gpio/exynos: Fix compiler warnings when non-exynos machines are selected
gpio: pch9: Use proper flow type handlers
-rw-r--r-- | drivers/gpio/gpio-pch.c | 57 | ||||
-rw-r--r-- | drivers/gpio/gpio-samsung.c | 18 |
2 files changed, 40 insertions, 35 deletions
diff --git a/drivers/gpio/gpio-pch.c b/drivers/gpio/gpio-pch.c index e8729cc2ba2b..2cd958e0b822 100644 --- a/drivers/gpio/gpio-pch.c +++ b/drivers/gpio/gpio-pch.c | |||
@@ -230,16 +230,12 @@ static void pch_gpio_setup(struct pch_gpio *chip) | |||
230 | 230 | ||
231 | static int pch_irq_type(struct irq_data *d, unsigned int type) | 231 | static int pch_irq_type(struct irq_data *d, unsigned int type) |
232 | { | 232 | { |
233 | u32 im; | ||
234 | u32 __iomem *im_reg; | ||
235 | u32 ien; | ||
236 | u32 im_pos; | ||
237 | int ch; | ||
238 | unsigned long flags; | ||
239 | u32 val; | ||
240 | int irq = d->irq; | ||
241 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | 233 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); |
242 | struct pch_gpio *chip = gc->private; | 234 | struct pch_gpio *chip = gc->private; |
235 | u32 im, im_pos, val; | ||
236 | u32 __iomem *im_reg; | ||
237 | unsigned long flags; | ||
238 | int ch, irq = d->irq; | ||
243 | 239 | ||
244 | ch = irq - chip->irq_base; | 240 | ch = irq - chip->irq_base; |
245 | if (irq <= chip->irq_base + 7) { | 241 | if (irq <= chip->irq_base + 7) { |
@@ -270,30 +266,22 @@ static int pch_irq_type(struct irq_data *d, unsigned int type) | |||
270 | case IRQ_TYPE_LEVEL_LOW: | 266 | case IRQ_TYPE_LEVEL_LOW: |
271 | val = PCH_LEVEL_L; | 267 | val = PCH_LEVEL_L; |
272 | break; | 268 | break; |
273 | case IRQ_TYPE_PROBE: | ||
274 | goto end; | ||
275 | default: | 269 | default: |
276 | dev_warn(chip->dev, "%s: unknown type(%dd)", | 270 | goto unlock; |
277 | __func__, type); | ||
278 | goto end; | ||
279 | } | 271 | } |
280 | 272 | ||
281 | /* Set interrupt mode */ | 273 | /* Set interrupt mode */ |
282 | im = ioread32(im_reg) & ~(PCH_IM_MASK << (im_pos * 4)); | 274 | im = ioread32(im_reg) & ~(PCH_IM_MASK << (im_pos * 4)); |
283 | iowrite32(im | (val << (im_pos * 4)), im_reg); | 275 | iowrite32(im | (val << (im_pos * 4)), im_reg); |
284 | 276 | ||
285 | /* iclr */ | 277 | /* And the handler */ |
286 | iowrite32(BIT(ch), &chip->reg->iclr); | 278 | if (type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) |
279 | __irq_set_handler_locked(d->irq, handle_level_irq); | ||
280 | else if (type & (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) | ||
281 | __irq_set_handler_locked(d->irq, handle_edge_irq); | ||
287 | 282 | ||
288 | /* IMASKCLR */ | 283 | unlock: |
289 | iowrite32(BIT(ch), &chip->reg->imaskclr); | ||
290 | |||
291 | /* Enable interrupt */ | ||
292 | ien = ioread32(&chip->reg->ien); | ||
293 | iowrite32(ien | BIT(ch), &chip->reg->ien); | ||
294 | end: | ||
295 | spin_unlock_irqrestore(&chip->spinlock, flags); | 284 | spin_unlock_irqrestore(&chip->spinlock, flags); |
296 | |||
297 | return 0; | 285 | return 0; |
298 | } | 286 | } |
299 | 287 | ||
@@ -313,18 +301,24 @@ static void pch_irq_mask(struct irq_data *d) | |||
313 | iowrite32(1 << (d->irq - chip->irq_base), &chip->reg->imask); | 301 | iowrite32(1 << (d->irq - chip->irq_base), &chip->reg->imask); |
314 | } | 302 | } |
315 | 303 | ||
304 | static void pch_irq_ack(struct irq_data *d) | ||
305 | { | ||
306 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | ||
307 | struct pch_gpio *chip = gc->private; | ||
308 | |||
309 | iowrite32(1 << (d->irq - chip->irq_base), &chip->reg->iclr); | ||
310 | } | ||
311 | |||
316 | static irqreturn_t pch_gpio_handler(int irq, void *dev_id) | 312 | static irqreturn_t pch_gpio_handler(int irq, void *dev_id) |
317 | { | 313 | { |
318 | struct pch_gpio *chip = dev_id; | 314 | struct pch_gpio *chip = dev_id; |
319 | u32 reg_val = ioread32(&chip->reg->istatus); | 315 | u32 reg_val = ioread32(&chip->reg->istatus); |
320 | int i; | 316 | int i, ret = IRQ_NONE; |
321 | int ret = IRQ_NONE; | ||
322 | 317 | ||
323 | for (i = 0; i < gpio_pins[chip->ioh]; i++) { | 318 | for (i = 0; i < gpio_pins[chip->ioh]; i++) { |
324 | if (reg_val & BIT(i)) { | 319 | if (reg_val & BIT(i)) { |
325 | dev_dbg(chip->dev, "%s:[%d]:irq=%d status=0x%x\n", | 320 | dev_dbg(chip->dev, "%s:[%d]:irq=%d status=0x%x\n", |
326 | __func__, i, irq, reg_val); | 321 | __func__, i, irq, reg_val); |
327 | iowrite32(BIT(i), &chip->reg->iclr); | ||
328 | generic_handle_irq(chip->irq_base + i); | 322 | generic_handle_irq(chip->irq_base + i); |
329 | ret = IRQ_HANDLED; | 323 | ret = IRQ_HANDLED; |
330 | } | 324 | } |
@@ -343,6 +337,7 @@ static __devinit void pch_gpio_alloc_generic_chip(struct pch_gpio *chip, | |||
343 | gc->private = chip; | 337 | gc->private = chip; |
344 | ct = gc->chip_types; | 338 | ct = gc->chip_types; |
345 | 339 | ||
340 | ct->chip.irq_ack = pch_irq_ack; | ||
346 | ct->chip.irq_mask = pch_irq_mask; | 341 | ct->chip.irq_mask = pch_irq_mask; |
347 | ct->chip.irq_unmask = pch_irq_unmask; | 342 | ct->chip.irq_unmask = pch_irq_unmask; |
348 | ct->chip.irq_set_type = pch_irq_type; | 343 | ct->chip.irq_set_type = pch_irq_type; |
@@ -357,6 +352,7 @@ static int __devinit pch_gpio_probe(struct pci_dev *pdev, | |||
357 | s32 ret; | 352 | s32 ret; |
358 | struct pch_gpio *chip; | 353 | struct pch_gpio *chip; |
359 | int irq_base; | 354 | int irq_base; |
355 | u32 msk; | ||
360 | 356 | ||
361 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | 357 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
362 | if (chip == NULL) | 358 | if (chip == NULL) |
@@ -408,8 +404,13 @@ static int __devinit pch_gpio_probe(struct pci_dev *pdev, | |||
408 | } | 404 | } |
409 | chip->irq_base = irq_base; | 405 | chip->irq_base = irq_base; |
410 | 406 | ||
407 | /* Mask all interrupts, but enable them */ | ||
408 | msk = (1 << gpio_pins[chip->ioh]) - 1; | ||
409 | iowrite32(msk, &chip->reg->imask); | ||
410 | iowrite32(msk, &chip->reg->ien); | ||
411 | |||
411 | ret = request_irq(pdev->irq, pch_gpio_handler, | 412 | ret = request_irq(pdev->irq, pch_gpio_handler, |
412 | IRQF_SHARED, KBUILD_MODNAME, chip); | 413 | IRQF_SHARED, KBUILD_MODNAME, chip); |
413 | if (ret != 0) { | 414 | if (ret != 0) { |
414 | dev_err(&pdev->dev, | 415 | dev_err(&pdev->dev, |
415 | "%s request_irq failed\n", __func__); | 416 | "%s request_irq failed\n", __func__); |
@@ -418,8 +419,6 @@ static int __devinit pch_gpio_probe(struct pci_dev *pdev, | |||
418 | 419 | ||
419 | pch_gpio_alloc_generic_chip(chip, irq_base, gpio_pins[chip->ioh]); | 420 | pch_gpio_alloc_generic_chip(chip, irq_base, gpio_pins[chip->ioh]); |
420 | 421 | ||
421 | /* Initialize interrupt ien register */ | ||
422 | iowrite32(0, &chip->reg->ien); | ||
423 | end: | 422 | end: |
424 | return 0; | 423 | return 0; |
425 | 424 | ||
diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c index 19d6fc0229c3..e991d9171961 100644 --- a/drivers/gpio/gpio-samsung.c +++ b/drivers/gpio/gpio-samsung.c | |||
@@ -452,12 +452,14 @@ static struct samsung_gpio_cfg s3c24xx_gpiocfg_banka = { | |||
452 | }; | 452 | }; |
453 | #endif | 453 | #endif |
454 | 454 | ||
455 | #if defined(CONFIG_ARCH_EXYNOS4) || defined(CONFIG_ARCH_EXYNOS5) | ||
455 | static struct samsung_gpio_cfg exynos_gpio_cfg = { | 456 | static struct samsung_gpio_cfg exynos_gpio_cfg = { |
456 | .set_pull = exynos_gpio_setpull, | 457 | .set_pull = exynos_gpio_setpull, |
457 | .get_pull = exynos_gpio_getpull, | 458 | .get_pull = exynos_gpio_getpull, |
458 | .set_config = samsung_gpio_setcfg_4bit, | 459 | .set_config = samsung_gpio_setcfg_4bit, |
459 | .get_config = samsung_gpio_getcfg_4bit, | 460 | .get_config = samsung_gpio_getcfg_4bit, |
460 | }; | 461 | }; |
462 | #endif | ||
461 | 463 | ||
462 | #if defined(CONFIG_CPU_S5P6440) || defined(CONFIG_CPU_S5P6450) | 464 | #if defined(CONFIG_CPU_S5P6440) || defined(CONFIG_CPU_S5P6450) |
463 | static struct samsung_gpio_cfg s5p64x0_gpio_cfg_rbank = { | 465 | static struct samsung_gpio_cfg s5p64x0_gpio_cfg_rbank = { |
@@ -2123,8 +2125,8 @@ static struct samsung_gpio_chip s5pv210_gpios_4bit[] = { | |||
2123 | * uses the above macro and depends on the banks being listed in order here. | 2125 | * uses the above macro and depends on the banks being listed in order here. |
2124 | */ | 2126 | */ |
2125 | 2127 | ||
2126 | static struct samsung_gpio_chip exynos4_gpios_1[] = { | ||
2127 | #ifdef CONFIG_ARCH_EXYNOS4 | 2128 | #ifdef CONFIG_ARCH_EXYNOS4 |
2129 | static struct samsung_gpio_chip exynos4_gpios_1[] = { | ||
2128 | { | 2130 | { |
2129 | .chip = { | 2131 | .chip = { |
2130 | .base = EXYNOS4_GPA0(0), | 2132 | .base = EXYNOS4_GPA0(0), |
@@ -2222,11 +2224,11 @@ static struct samsung_gpio_chip exynos4_gpios_1[] = { | |||
2222 | .label = "GPF3", | 2224 | .label = "GPF3", |
2223 | }, | 2225 | }, |
2224 | }, | 2226 | }, |
2225 | #endif | ||
2226 | }; | 2227 | }; |
2228 | #endif | ||
2227 | 2229 | ||
2228 | static struct samsung_gpio_chip exynos4_gpios_2[] = { | ||
2229 | #ifdef CONFIG_ARCH_EXYNOS4 | 2230 | #ifdef CONFIG_ARCH_EXYNOS4 |
2231 | static struct samsung_gpio_chip exynos4_gpios_2[] = { | ||
2230 | { | 2232 | { |
2231 | .chip = { | 2233 | .chip = { |
2232 | .base = EXYNOS4_GPJ0(0), | 2234 | .base = EXYNOS4_GPJ0(0), |
@@ -2367,11 +2369,11 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = { | |||
2367 | .to_irq = samsung_gpiolib_to_irq, | 2369 | .to_irq = samsung_gpiolib_to_irq, |
2368 | }, | 2370 | }, |
2369 | }, | 2371 | }, |
2370 | #endif | ||
2371 | }; | 2372 | }; |
2373 | #endif | ||
2372 | 2374 | ||
2373 | static struct samsung_gpio_chip exynos4_gpios_3[] = { | ||
2374 | #ifdef CONFIG_ARCH_EXYNOS4 | 2375 | #ifdef CONFIG_ARCH_EXYNOS4 |
2376 | static struct samsung_gpio_chip exynos4_gpios_3[] = { | ||
2375 | { | 2377 | { |
2376 | .chip = { | 2378 | .chip = { |
2377 | .base = EXYNOS4_GPZ(0), | 2379 | .base = EXYNOS4_GPZ(0), |
@@ -2379,8 +2381,8 @@ static struct samsung_gpio_chip exynos4_gpios_3[] = { | |||
2379 | .label = "GPZ", | 2381 | .label = "GPZ", |
2380 | }, | 2382 | }, |
2381 | }, | 2383 | }, |
2382 | #endif | ||
2383 | }; | 2384 | }; |
2385 | #endif | ||
2384 | 2386 | ||
2385 | #ifdef CONFIG_ARCH_EXYNOS5 | 2387 | #ifdef CONFIG_ARCH_EXYNOS5 |
2386 | static struct samsung_gpio_chip exynos5_gpios_1[] = { | 2388 | static struct samsung_gpio_chip exynos5_gpios_1[] = { |
@@ -2719,7 +2721,9 @@ static __init int samsung_gpiolib_init(void) | |||
2719 | { | 2721 | { |
2720 | struct samsung_gpio_chip *chip; | 2722 | struct samsung_gpio_chip *chip; |
2721 | int i, nr_chips; | 2723 | int i, nr_chips; |
2724 | #if defined(CONFIG_CPU_EXYNOS4210) || defined(CONFIG_SOC_EXYNOS5250) | ||
2722 | void __iomem *gpio_base1, *gpio_base2, *gpio_base3, *gpio_base4; | 2725 | void __iomem *gpio_base1, *gpio_base2, *gpio_base3, *gpio_base4; |
2726 | #endif | ||
2723 | int group = 0; | 2727 | int group = 0; |
2724 | 2728 | ||
2725 | samsung_gpiolib_set_cfg(samsung_gpio_cfgs, ARRAY_SIZE(samsung_gpio_cfgs)); | 2729 | samsung_gpiolib_set_cfg(samsung_gpio_cfgs, ARRAY_SIZE(samsung_gpio_cfgs)); |
@@ -2971,6 +2975,7 @@ static __init int samsung_gpiolib_init(void) | |||
2971 | 2975 | ||
2972 | return 0; | 2976 | return 0; |
2973 | 2977 | ||
2978 | #if defined(CONFIG_CPU_EXYNOS4210) || defined(CONFIG_SOC_EXYNOS5250) | ||
2974 | err_ioremap4: | 2979 | err_ioremap4: |
2975 | iounmap(gpio_base3); | 2980 | iounmap(gpio_base3); |
2976 | err_ioremap3: | 2981 | err_ioremap3: |
@@ -2979,6 +2984,7 @@ err_ioremap2: | |||
2979 | iounmap(gpio_base1); | 2984 | iounmap(gpio_base1); |
2980 | err_ioremap1: | 2985 | err_ioremap1: |
2981 | return -ENOMEM; | 2986 | return -ENOMEM; |
2987 | #endif | ||
2982 | } | 2988 | } |
2983 | core_initcall(samsung_gpiolib_init); | 2989 | core_initcall(samsung_gpiolib_init); |
2984 | 2990 | ||