ARM: 6164/1: Add kto and kfrom to input operands list.
[safe/jmp/linux-2.6] / arch / arm / plat-s3c24xx / gpiolib.c
index 5c0491b..4c0896f 100644 (file)
@@ -1,6 +1,6 @@
 /* linux/arch/arm/plat-s3c24xx/gpiolib.c
  *
- * Copyright (c) 2008 Simtec Electronics
+ * Copyright (c) 2008-2010 Simtec Electronics
  *     http://armlinux.simtec.co.uk/
  *     Ben Dooks <ben@simtec.co.uk>
  *
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
+#include <linux/sysdev.h>
 #include <linux/ioport.h>
 #include <linux/io.h>
 #include <linux/gpio.h>
 
-#include <mach/gpio-core.h>
+#include <plat/gpio-core.h>
+#include <plat/gpio-cfg.h>
+#include <plat/gpio-cfg-helpers.h>
 #include <mach/hardware.h>
 #include <asm/irq.h>
+#include <plat/pm.h>
 
 #include <mach/regs-gpio.h>
 
@@ -75,11 +79,23 @@ static int s3c24xx_gpiolib_bankg_toirq(struct gpio_chip *chip, unsigned offset)
        return IRQ_EINT8 + offset;
 }
 
+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   = S3C24XX_GPIO_BASE(S3C2410_GPA0),
+               .base   = S3C2410_GPACON,
+               .pm     = __gpio_pm(&s3c_gpio_pm_1bit),
+               .config = &s3c24xx_gpiocfg_banka,
                .chip   = {
-                       .base                   = S3C2410_GPA0,
+                       .base                   = S3C2410_GPA(0),
                        .owner                  = THIS_MODULE,
                        .label                  = "GPIOA",
                        .ngpio                  = 24,
@@ -88,45 +104,50 @@ struct s3c_gpio_chip s3c24xx_gpios[] = {
                },
        },
        [1] = {
-               .base   = S3C24XX_GPIO_BASE(S3C2410_GPB0),
+               .base   = S3C2410_GPBCON,
+               .pm     = __gpio_pm(&s3c_gpio_pm_2bit),
                .chip   = {
-                       .base                   = S3C2410_GPB0,
+                       .base                   = S3C2410_GPB(0),
                        .owner                  = THIS_MODULE,
                        .label                  = "GPIOB",
                        .ngpio                  = 16,
                },
        },
        [2] = {
-               .base   = S3C24XX_GPIO_BASE(S3C2410_GPC0),
+               .base   = S3C2410_GPCCON,
+               .pm     = __gpio_pm(&s3c_gpio_pm_2bit),
                .chip   = {
-                       .base                   = S3C2410_GPC0,
+                       .base                   = S3C2410_GPC(0),
                        .owner                  = THIS_MODULE,
                        .label                  = "GPIOC",
                        .ngpio                  = 16,
                },
        },
        [3] = {
-               .base   = S3C24XX_GPIO_BASE(S3C2410_GPD0),
+               .base   = S3C2410_GPDCON,
+               .pm     = __gpio_pm(&s3c_gpio_pm_2bit),
                .chip   = {
-                       .base                   = S3C2410_GPD0,
+                       .base                   = S3C2410_GPD(0),
                        .owner                  = THIS_MODULE,
                        .label                  = "GPIOD",
                        .ngpio                  = 16,
                },
        },
        [4] = {
-               .base   = S3C24XX_GPIO_BASE(S3C2410_GPE0),
+               .base   = S3C2410_GPECON,
+               .pm     = __gpio_pm(&s3c_gpio_pm_2bit),
                .chip   = {
-                       .base                   = S3C2410_GPE0,
+                       .base                   = S3C2410_GPE(0),
                        .label                  = "GPIOE",
                        .owner                  = THIS_MODULE,
                        .ngpio                  = 16,
                },
        },
        [5] = {
-               .base   = S3C24XX_GPIO_BASE(S3C2410_GPF0),
+               .base   = S3C2410_GPFCON,
+               .pm     = __gpio_pm(&s3c_gpio_pm_2bit),
                .chip   = {
-                       .base                   = S3C2410_GPF0,
+                       .base                   = S3C2410_GPF(0),
                        .owner                  = THIS_MODULE,
                        .label                  = "GPIOF",
                        .ngpio                  = 8,
@@ -134,26 +155,79 @@ struct s3c_gpio_chip s3c24xx_gpios[] = {
                },
        },
        [6] = {
-               .base   = S3C24XX_GPIO_BASE(S3C2410_GPG0),
+               .base   = S3C2410_GPGCON,
+               .pm     = __gpio_pm(&s3c_gpio_pm_2bit),
                .chip   = {
-                       .base                   = S3C2410_GPG0,
+                       .base                   = S3C2410_GPG(0),
                        .owner                  = THIS_MODULE,
                        .label                  = "GPIOG",
-                       .ngpio                  = 10,
+                       .ngpio                  = 16,
                        .to_irq                 = s3c24xx_gpiolib_bankg_toirq,
                },
+       }, {
+               .base   = S3C2410_GPHCON,
+               .pm     = __gpio_pm(&s3c_gpio_pm_2bit),
+               .chip   = {
+                       .base                   = S3C2410_GPH(0),
+                       .owner                  = THIS_MODULE,
+                       .label                  = "GPIOH",
+                       .ngpio                  = 11,
+               },
+       },
+               /* GPIOS for the S3C2443 and later devices. */
+       {
+               .base   = S3C2440_GPJCON,
+               .pm     = __gpio_pm(&s3c_gpio_pm_2bit),
+               .chip   = {
+                       .base                   = S3C2410_GPJ(0),
+                       .owner                  = THIS_MODULE,
+                       .label                  = "GPIOJ",
+                       .ngpio                  = 16,
+               },
+       }, {
+               .base   = S3C2443_GPKCON,
+               .pm     = __gpio_pm(&s3c_gpio_pm_2bit),
+               .chip   = {
+                       .base                   = S3C2410_GPK(0),
+                       .owner                  = THIS_MODULE,
+                       .label                  = "GPIOK",
+                       .ngpio                  = 16,
+               },
+       }, {
+               .base   = S3C2443_GPLCON,
+               .pm     = __gpio_pm(&s3c_gpio_pm_2bit),
+               .chip   = {
+                       .base                   = S3C2410_GPL(0),
+                       .owner                  = THIS_MODULE,
+                       .label                  = "GPIOL",
+                       .ngpio                  = 15,
+               },
+       }, {
+               .base   = S3C2443_GPMCON,
+               .pm     = __gpio_pm(&s3c_gpio_pm_2bit),
+               .chip   = {
+                       .base                   = S3C2410_GPM(0),
+                       .owner                  = THIS_MODULE,
+                       .label                  = "GPIOM",
+                       .ngpio                  = 2,
+               },
        },
 };
 
+
 static __init int s3c24xx_gpiolib_init(void)
 {
        struct s3c_gpio_chip *chip = s3c24xx_gpios;
        int gpn;
 
-       for (gpn = 0; gpn < ARRAY_SIZE(s3c24xx_gpios); gpn++, chip++)
+       for (gpn = 0; gpn < ARRAY_SIZE(s3c24xx_gpios); gpn++, chip++) {
+               if (!chip->config)
+                       chip->config = &s3c24xx_gpiocfg_default;
+
                s3c_gpiolib_add(chip);
+       }
 
        return 0;
 }
 
-arch_initcall(s3c24xx_gpiolib_init);
+core_initcall(s3c24xx_gpiolib_init);