10 #include <linux/kernel.h>
11 #include <linux/module.h>
21 #ifndef BCMCPU_RUNTIME_DETECT
22 #define gpio_out_low_reg GPIO_DATA_LO_REG
23 #ifdef CONFIG_BCM63XX_CPU_6345
24 #ifdef gpio_out_low_reg
25 #undef gpio_out_low_reg
26 #define gpio_out_low_reg GPIO_DATA_LO_REG_6345
30 static inline void bcm63xx_gpio_out_low_reg_init(
void)
36 static void bcm63xx_gpio_out_low_reg_init(
void)
38 switch (bcm63xx_get_cpu_id()) {
50 static u32 gpio_out_low, gpio_out_high;
52 static void bcm63xx_gpio_set(
struct gpio_chip *
chip,
60 if (gpio >= chip->ngpio)
69 mask = 1 << (gpio - 32);
79 spin_unlock_irqrestore(&bcm63xx_gpio_lock, flags);
82 static int bcm63xx_gpio_get(
struct gpio_chip *chip,
unsigned gpio)
87 if (gpio >= chip->ngpio)
95 mask = 1 << (gpio - 32);
101 static int bcm63xx_gpio_set_direction(
struct gpio_chip *chip,
102 unsigned gpio,
int dir)
109 if (gpio >= chip->ngpio)
117 mask = 1 << (gpio - 32);
127 spin_unlock_irqrestore(&bcm63xx_gpio_lock, flags);
132 static int bcm63xx_gpio_direction_input(
struct gpio_chip *chip,
unsigned gpio)
137 static int bcm63xx_gpio_direction_output(
struct gpio_chip *chip,
138 unsigned gpio,
int value)
140 bcm63xx_gpio_set(chip, gpio, value);
145 static struct gpio_chip bcm63xx_gpio_chip = {
146 .label =
"bcm63xx-gpio",
147 .direction_input = bcm63xx_gpio_direction_input,
148 .direction_output = bcm63xx_gpio_direction_output,
149 .get = bcm63xx_gpio_get,
150 .set = bcm63xx_gpio_set,
156 bcm63xx_gpio_out_low_reg_init();
161 bcm63xx_gpio_chip.ngpio = bcm63xx_gpio_count();
162 pr_info(
"registering %d GPIOs\n", bcm63xx_gpio_chip.ngpio);