use the correct number of GPIOs for bcm6358

SVN-Revision: 16329
This commit is contained in:
Florian Fainelli 2009-06-04 10:01:03 +00:00
parent c95420f06d
commit 1208ffaedb
3 changed files with 12 additions and 6 deletions

View file

@ -117,11 +117,11 @@ static struct gpio_chip bcm63xx_gpio_chip = {
.get = bcm63xx_gpio_get, .get = bcm63xx_gpio_get,
.set = bcm63xx_gpio_set, .set = bcm63xx_gpio_set,
.base = 0, .base = 0,
.ngpio = BCM63XX_GPIO_COUNT,
}; };
int __init bcm63xx_gpio_init(void) int __init bcm63xx_gpio_init(void)
{ {
printk(KERN_INFO "registering %d GPIOs\n", BCM63XX_GPIO_COUNT); bcm63xx_gpio_chip.ngpio = bcm63xx_gpio_count();
printk(KERN_INFO "registering %d GPIOs\n", bcm63xx_gpio_chip.ngpio);
return gpiochip_add(&bcm63xx_gpio_chip); return gpiochip_add(&bcm63xx_gpio_chip);
} }

View file

@ -5,8 +5,16 @@
int __init bcm63xx_gpio_init(void); int __init bcm63xx_gpio_init(void);
/* all helpers will BUG() if gpio count is >= 37. */ static inline unsigned long bcm63xx_gpio_count(void)
#define BCM63XX_GPIO_COUNT 37 {
switch (bcm63xx_get_cpu_id()) {
case BCM6358_CPU_ID:
return 40;
case BCM6348_CPU_ID:
default:
return 37;
}
}
#define GPIO_DIR_OUT 0x0 #define GPIO_DIR_OUT 0x0
#define GPIO_DIR_IN 0x1 #define GPIO_DIR_IN 0x1

View file

@ -3,8 +3,6 @@
#include <bcm63xx_gpio.h> #include <bcm63xx_gpio.h>
#define NR_BUILTIN_GPIO BCM63XX_GPIO_COUNT
#define gpio_to_irq(gpio) NULL #define gpio_to_irq(gpio) NULL
#define gpio_get_value __gpio_get_value #define gpio_get_value __gpio_get_value