register gpiochip earlier, allowing gpio-based runtime detection to be performed in board_init callback

SVN-Revision: 16328
This commit is contained in:
Florian Fainelli 2009-06-04 09:59:28 +00:00
parent 74dfd77f41
commit c95420f06d
3 changed files with 9 additions and 2 deletions

View file

@ -120,9 +120,8 @@ static struct gpio_chip bcm63xx_gpio_chip = {
.ngpio = BCM63XX_GPIO_COUNT, .ngpio = BCM63XX_GPIO_COUNT,
}; };
static int __init bcm63xx_gpio_init(void) int __init bcm63xx_gpio_init(void)
{ {
printk(KERN_INFO "registering %d GPIOs\n", BCM63XX_GPIO_COUNT); printk(KERN_INFO "registering %d GPIOs\n", BCM63XX_GPIO_COUNT);
return gpiochip_add(&bcm63xx_gpio_chip); return gpiochip_add(&bcm63xx_gpio_chip);
} }
arch_initcall(bcm63xx_gpio_init);

View file

@ -13,6 +13,7 @@
#include <bcm63xx_cpu.h> #include <bcm63xx_cpu.h>
#include <bcm63xx_io.h> #include <bcm63xx_io.h>
#include <bcm63xx_regs.h> #include <bcm63xx_regs.h>
#include <bcm63xx_gpio.h>
void __init prom_init(void) void __init prom_init(void)
{ {
@ -42,6 +43,9 @@ void __init prom_init(void)
/* assign command line from kernel config */ /* assign command line from kernel config */
strcpy(arcs_cmdline, CONFIG_CMDLINE); strcpy(arcs_cmdline, CONFIG_CMDLINE);
/* register gpiochip */
bcm63xx_gpio_init();
/* do low level board init */ /* do low level board init */
board_prom_init(); board_prom_init();
} }

View file

@ -1,6 +1,10 @@
#ifndef BCM63XX_GPIO_H #ifndef BCM63XX_GPIO_H
#define BCM63XX_GPIO_H #define BCM63XX_GPIO_H
#include <linux/init.h>
int __init bcm63xx_gpio_init(void);
/* all helpers will BUG() if gpio count is >= 37. */ /* all helpers will BUG() if gpio count is >= 37. */
#define BCM63XX_GPIO_COUNT 37 #define BCM63XX_GPIO_COUNT 37