static void __init s3c24xx_gpiolib_add_chips(struct samsung_gpio_chip *chip, int nr_chips, void __iomem *base) { int i; struct gpio_chip *gc = &chip->chip; for (i = 0 ; i < nr_chips; i++, chip++) { /* skip banks not present on SoC */ if (chip->chip.base >= S3C_GPIO_END) continue; if (!chip->config) chip->config = &s3c24xx_gpiocfg_default; if (!chip->pm) chip->pm = __gpio_pm(&samsung_gpio_pm_2bit); if ((base != NULL) && (chip->base == NULL)) chip->base = base + ((i) * 0x10); if (!gc->direction_input) gc->direction_input = samsung_gpiolib_2bit_input; if (!gc->direction_output) gc->direction_output = samsung_gpiolib_2bit_output; samsung_gpiolib_add(chip); } }
static void __init samsung_gpiolib_add_4bit2_chips(struct samsung_gpio_chip *chip, int nr_chips) { for (; nr_chips > 0; nr_chips--, chip++) { chip->chip.direction_input = samsung_gpiolib_4bit2_input; chip->chip.direction_output = samsung_gpiolib_4bit2_output; if (!chip->config) chip->config = &samsung_gpio_cfgs[2]; if (!chip->pm) chip->pm = __gpio_pm(&samsung_gpio_pm_4bit); samsung_gpiolib_add(chip); } }
static void __init samsung_gpiolib_add_2bit_chips(struct samsung_gpio_chip *chip, int nr_chips, void __iomem *base, unsigned int offset) { int i; for (i = 0 ; i < nr_chips; i++, chip++) { chip->chip.direction_input = samsung_gpiolib_2bit_input; chip->chip.direction_output = samsung_gpiolib_2bit_output; if (!chip->config) chip->config = &samsung_gpio_cfgs[7]; if (!chip->pm) chip->pm = __gpio_pm(&samsung_gpio_pm_2bit); if ((base != NULL) && (chip->base == NULL)) chip->base = base + ((i) * offset); samsung_gpiolib_add(chip); } }
static void __init samsung_gpiolib_add_4bit_chips(struct samsung_gpio_chip *chip, int nr_chips, void __iomem *base) { int i; for (i = 0 ; i < nr_chips; i++, chip++) { chip->chip.direction_input = samsung_gpiolib_4bit_input; chip->chip.direction_output = samsung_gpiolib_4bit_output; if (!chip->config) chip->config = &samsung_gpio_cfgs[2]; if (!chip->pm) chip->pm = __gpio_pm(&samsung_gpio_pm_4bit); if ((base != NULL) && (chip->base == NULL)) chip->base = base + ((i) * 0x20); chip->bitmap_gpio_int = 0; samsung_gpiolib_add(chip); } }
static __init void s5pc1xx_gpiolib_link(struct s3c_gpio_chip *chip) { chip->chip.direction_input = s5pc1xx_gpiolib_input; chip->chip.direction_output = s5pc1xx_gpiolib_output; chip->pm = __gpio_pm(&s3c_gpio_pm_4bit); /* Interrupt */ if (chip->config == &gpio_cfg) { int i, irq; chip->chip.to_irq = s5pc1xx_gpiolib_to_irq; for (i = 0; i < chip->chip.ngpio; i++) { irq = S3C_IRQ_GPIO_BASE + chip->chip.base + i; set_irq_chip(irq, &s5pc1xx_gpioint); set_irq_data(irq, &chip->chip); set_irq_handler(irq, handle_level_irq); set_irq_flags(irq, IRQF_VALID); } } else if (chip->config == &gpio_cfg_eint) chip->chip.to_irq = s5pc1xx_gpiolib_to_eint; }
static __init void s3c64xx_gpiolib_add_2bit(struct s3c_gpio_chip *chip) { chip->pm = __gpio_pm(&s3c_gpio_pm_2bit); }
void __init samsung_gpiolib_add_4bit2(struct s3c_gpio_chip *chip) { chip->chip.direction_input = samsung_gpiolib_4bit2_input; chip->chip.direction_output = samsung_gpiolib_4bit2_output; chip->pm = __gpio_pm(&s3c_gpio_pm_4bit); }
static __init void s5pv2xx_gpiolib_link(struct s3c_gpio_chip *chip) { chip->chip.direction_input = s5pv2xx_gpiolib_input; chip->chip.direction_output = s5pv2xx_gpiolib_output; chip->pm = __gpio_pm(&s3c_gpio_pm_4bit); }
} static struct s3c_gpio_cfg s3c24xx_gpiocfg_banka = { .set_config = s3c_gpio_setcfg_s3c24xx_a, .get_config = s3c_gpio_getcfg_s3c24xx_a, }; struct s3c_gpio_cfg s3c24xx_gpiocfg_default = { .set_config = s3c_gpio_setcfg_s3c24xx, .get_config = s3c_gpio_getcfg_s3c24xx, }; struct s3c_gpio_chip s3c24xx_gpios[] = { [0] = { .base = S3C2410_GPACON, .pm = __gpio_pm(&s3c_gpio_pm_1bit), .config = &s3c24xx_gpiocfg_banka, .chip = { .base = S3C2410_GPA(0), .owner = THIS_MODULE, .label = "GPIOA", .ngpio = 24, .direction_input = s3c24xx_gpiolib_banka_input, .direction_output = s3c24xx_gpiolib_banka_output, }, }, [1] = { .base = S3C2410_GPBCON, .pm = __gpio_pm(&s3c_gpio_pm_2bit), .chip = { .base = S3C2410_GPB(0),