Skip to content

Commit d52d21b

Browse files
committed
Fix for broken GPIO with 3.2 kernel
1 parent d6911d6 commit d52d21b

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

arch/arm/mach-bcm2708/bcm2708_gpio.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static int bcm2708_set_function(struct gpio_chip *gc, unsigned offset,
7070
unsigned gpio_field_offset = (offset - 10 * gpio_bank) * 3;
7171

7272
//printk(KERN_ERR DRIVER_NAME ": bcm2708_gpio_set_function %p (%d,%d)\n", gc, offset, function);
73-
if (offset >= ARCH_NR_GPIOS)
73+
if (offset >= BCM_NR_GPIOS)
7474
return -EINVAL;
7575

7676
spin_lock_irqsave(&lock, flags);
@@ -108,7 +108,7 @@ static int bcm2708_gpio_get(struct gpio_chip *gc, unsigned offset)
108108
unsigned gpio_field_offset = (offset - 32 * gpio_bank);
109109
unsigned lev;
110110

111-
if (offset >= ARCH_NR_GPIOS)
111+
if (offset >= BCM_NR_GPIOS)
112112
return 0;
113113
lev = readl(gpio->base + GPIOLEV(gpio_bank));
114114
//printk(KERN_ERR DRIVER_NAME ": bcm2708_gpio_get %p (%d)=%d\n", gc, offset, 0x1 & (lev>>gpio_field_offset));
@@ -121,7 +121,7 @@ static void bcm2708_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
121121
unsigned gpio_bank = offset / 32;
122122
unsigned gpio_field_offset = (offset - 32 * gpio_bank);
123123
//printk(KERN_ERR DRIVER_NAME ": bcm2708_gpio_set %p (%d=%d)\n", gc, offset, value);
124-
if (offset >= ARCH_NR_GPIOS)
124+
if (offset >= BCM_NR_GPIOS)
125125
return;
126126
if (value)
127127
writel(1 << gpio_field_offset, gpio->base + GPIOSET(gpio_bank));
@@ -280,7 +280,7 @@ static int bcm2708_gpio_probe(struct platform_device *dev)
280280

281281
ucb->gc.label = "bcm2708_gpio";
282282
ucb->gc.base = 0;
283-
ucb->gc.ngpio = ARCH_NR_GPIOS;
283+
ucb->gc.ngpio = BCM_NR_GPIOS;
284284
ucb->gc.owner = THIS_MODULE;
285285

286286
ucb->gc.direction_input = bcm2708_gpio_dir_in;

arch/arm/mach-bcm2708/include/mach/gpio.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#ifndef __ASM_ARCH_GPIO_H
1010
#define __ASM_ARCH_GPIO_H
1111

12-
#define ARCH_NR_GPIOS 54 // number of gpio lines
12+
#define BCM_NR_GPIOS 54 // number of gpio lines
1313

1414
#include <asm-generic/gpio.h>
1515
#include <mach/platform.h>
@@ -40,6 +40,9 @@ static inline unsigned irq_to_gpio(unsigned irq) {
4040
static inline unsigned gpio_to_irq(unsigned gpio) {
4141
return GPIO_IRQ_START+gpio;
4242
}
43+
#define gpio_to_irq gpio_to_irq
44+
4345
#endif /* CONFIG_GPIOLIB */
4446

4547
#endif
48+

0 commit comments

Comments
 (0)