ARM: s3c24xx: get rid of custom <mach/gpio.h>
authorLinus Walleij <linus.walleij@linaro.org>
Fri, 6 Dec 2013 09:05:49 +0000 (10:05 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Fri, 20 Dec 2013 17:19:26 +0000 (18:19 +0100)
This isolates the custom S3C24xx GPIO definition table to
<linux/platform_data/gpio-samsung-s3x24xx.h> as this is
used in a few different places in the kernel, removing the
need to depend on the implicit inclusion of <mach/gpio.h>
from <linux/gpio.h> and thus getting rid of a few nasty
cross-dependencies.

We also delete the nifty CONFIG_S3C24XX_GPIO_EXTRA stuff.
The biggest this can ever be for the S3C24XX is
CONFIG_S3C24XX_GPIO_EXTRA = 128, and then for CPU_S3C2443 or
CPU_S3C2416 32*12 GPIOs are added, so 32*12+128 = 512
is the absolute roof value on this platform. So we set
the size of ARCH_NR_GPIO to this and the GPIOs array will
fit any S3C24XX platform, as per pattern from other archs.

ChangeLog v2->v3:
- Move the movement of the S3C64XX gpio.h file out of
  this patch and into the follow-up patch where it belongs.
ChangeLog v1->v2:
- Added an #ifdef ARCH_S3C24XX around the header inclusion
  in drivers/gpio/gpio-samsung.c as we would otherwise
  have colliding definitions when compiling S3C64XX.
- Rename inclusion guard in the header file.

Cc: Tomasz Figa <tomasz.figa@gmail.com>
Cc: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: linux-samsung-soc@vger.kernel.org
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
38 files changed:
arch/arm/Kconfig
arch/arm/mach-s3c24xx/Kconfig
arch/arm/mach-s3c24xx/common-smdk.c
arch/arm/mach-s3c24xx/h1940-bluetooth.c
arch/arm/mach-s3c24xx/include/mach/gpio.h [deleted file]
arch/arm/mach-s3c24xx/mach-amlm5900.c
arch/arm/mach-s3c24xx/mach-anubis.c
arch/arm/mach-s3c24xx/mach-at2440evb.c
arch/arm/mach-s3c24xx/mach-bast.c
arch/arm/mach-s3c24xx/mach-gta02.c
arch/arm/mach-s3c24xx/mach-h1940.c
arch/arm/mach-s3c24xx/mach-jive.c
arch/arm/mach-s3c24xx/mach-mini2440.c
arch/arm/mach-s3c24xx/mach-n30.c
arch/arm/mach-s3c24xx/mach-nexcoder.c
arch/arm/mach-s3c24xx/mach-osiris.c
arch/arm/mach-s3c24xx/mach-qt2410.c
arch/arm/mach-s3c24xx/mach-rx1950.c
arch/arm/mach-s3c24xx/mach-rx3715.c
arch/arm/mach-s3c24xx/mach-smdk2413.c
arch/arm/mach-s3c24xx/mach-smdk2416.c
arch/arm/mach-s3c24xx/mach-vr1000.c
arch/arm/mach-s3c24xx/pm-s3c2410.c
arch/arm/mach-s3c24xx/pm.c
arch/arm/mach-s3c24xx/s3c2410.c
arch/arm/mach-s3c24xx/s3c2416.c
arch/arm/mach-s3c24xx/s3c2440.c
arch/arm/mach-s3c24xx/s3c2442.c
arch/arm/mach-s3c24xx/s3c2443.c
arch/arm/mach-s3c24xx/setup-i2c.c
arch/arm/mach-s3c24xx/setup-sdhci-gpio.c
arch/arm/mach-s3c24xx/setup-ts.c
arch/arm/mach-s3c24xx/simtec-usb.c
arch/arm/plat-samsung/pm-gpio.c
arch/arm/plat-samsung/setup-camif.c
drivers/gpio/gpio-samsung.c
drivers/mmc/host/s3cmci.c
include/linux/platform_data/gpio-samsung-s3c24xx.h [new file with mode: 0644]

index c1f1a7e..6a26bcb 100644 (file)
@@ -710,7 +710,6 @@ config ARCH_S3C24XX
        select HAVE_S3C2410_WATCHDOG if WATCHDOG
        select HAVE_S3C_RTC if RTC_CLASS
        select MULTI_IRQ_HANDLER
-       select NEED_MACH_GPIO_H
        select NEED_MACH_IO_H
        select SAMSUNG_ATAGS
        help
@@ -1593,7 +1592,7 @@ config ARM_PSCI
 config ARCH_NR_GPIO
        int
        default 1024 if ARCH_SHMOBILE || ARCH_TEGRA
-       default 512 if ARCH_EXYNOS || ARCH_KEYSTONE || SOC_OMAP5 || SOC_DRA7XX
+       default 512 if ARCH_EXYNOS || ARCH_KEYSTONE || SOC_OMAP5 || SOC_DRA7XX || ARCH_S3C24XX
        default 392 if ARCH_U8500
        default 352 if ARCH_VT8500
        default 288 if ARCH_SUNXI
index 8f1d327..d876431 100644 (file)
@@ -180,27 +180,6 @@ config CPU_LLSERIAL_S3C2440
          Selected if there is an S3C2440 (or register compatible) serial
          low-level implementation needed
 
-# gpio configurations
-
-config S3C24XX_GPIO_EXTRA
-       int
-       default 128 if S3C24XX_GPIO_EXTRA128
-       default 64 if S3C24XX_GPIO_EXTRA64
-       default 16 if ARCH_H1940
-       default 0
-
-config S3C24XX_GPIO_EXTRA64
-       bool
-       help
-         Add an extra 64 gpio numbers to the available GPIO pool. This is
-         available for boards that need extra gpios for external devices.
-
-config S3C24XX_GPIO_EXTRA128
-       bool
-       help
-         Add an extra 128 gpio numbers to the available GPIO pool. This is
-         available for boards that need extra gpios for external devices.
-
 config S3C24XX_PLL
        bool "Support CPUfreq changing of PLL frequency (EXPERIMENTAL)"
        depends on ARM_S3C24XX_CPUFREQ
index 404444d..0a84a9c 100644 (file)
@@ -38,7 +38,7 @@
 
 #include <mach/regs-gpio.h>
 #include <linux/platform_data/leds-s3c24xx.h>
-
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 #include <linux/platform_data/mtd-nand-s3c2410.h>
 
 #include <plat/gpio-cfg.h>
index 5b98bfd..f2b859f 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/leds.h>
 #include <linux/gpio.h>
 #include <linux/rfkill.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 
 #include <mach/hardware.h>
 #include <mach/regs-gpio.h>
diff --git a/arch/arm/mach-s3c24xx/include/mach/gpio.h b/arch/arm/mach-s3c24xx/include/mach/gpio.h
deleted file mode 100644 (file)
index 1459156..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (c) 2008 Simtec Electronics
- *     http://armlinux.simtec.co.uk/
- *     Ben Dooks <ben@simtec.co.uk>
- *
- * S3C2410 - GPIO lib support
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
-*/
-
-/* some boards require extra gpio capacity to support external
- * devices that need GPIO.
- */
-
-#ifndef __MACH_GPIO_H
-#define __MACH_GPIO_H __FILE__
-
-#ifdef CONFIG_CPU_S3C244X
-#define ARCH_NR_GPIOS  (32 * 9 + CONFIG_S3C24XX_GPIO_EXTRA)
-#elif defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416)
-#define ARCH_NR_GPIOS  (32 * 12 + CONFIG_S3C24XX_GPIO_EXTRA)
-#else
-#define ARCH_NR_GPIOS  (256 + CONFIG_S3C24XX_GPIO_EXTRA)
-#endif
-
-/*
- * GPIO sizes for various SoCs:
- *
- *   2410 2412 2440 2443 2416
- *             2442
- *   ---- ---- ---- ---- ----
- * A  23   22   25   16   25
- * B  11   11   11   11   9
- * C  16   15   16   16   16
- * D  16   16   16   16   16
- * E  16   16   16   16   16
- * F  8    8    8    8    8
- * G  16   16   16   16   8
- * H  11   11   9    15   15
- * J  --   --   13   16   --
- * K  --   --   --   --   16
- * L  --   --   --   15   7
- * M  --   --   --   2    2
- */
-
-/* GPIO bank sizes */
-
-#define S3C2410_GPIO_A_NR      (32)
-#define S3C2410_GPIO_B_NR      (32)
-#define S3C2410_GPIO_C_NR      (32)
-#define S3C2410_GPIO_D_NR      (32)
-#define S3C2410_GPIO_E_NR      (32)
-#define S3C2410_GPIO_F_NR      (32)
-#define S3C2410_GPIO_G_NR      (32)
-#define S3C2410_GPIO_H_NR      (32)
-#define S3C2410_GPIO_J_NR      (32)    /* technically 16. */
-#define S3C2410_GPIO_K_NR      (32)    /* technically 16. */
-#define S3C2410_GPIO_L_NR      (32)    /* technically 15. */
-#define S3C2410_GPIO_M_NR      (32)    /* technically 2. */
-
-#if CONFIG_S3C_GPIO_SPACE != 0
-#error CONFIG_S3C_GPIO_SPACE cannot be nonzero at the moment
-#endif
-
-#define S3C2410_GPIO_NEXT(__gpio) \
-       ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 0)
-
-#ifndef __ASSEMBLY__
-
-enum s3c_gpio_number {
-       S3C2410_GPIO_A_START = 0,
-       S3C2410_GPIO_B_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_A),
-       S3C2410_GPIO_C_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_B),
-       S3C2410_GPIO_D_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_C),
-       S3C2410_GPIO_E_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_D),
-       S3C2410_GPIO_F_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_E),
-       S3C2410_GPIO_G_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_F),
-       S3C2410_GPIO_H_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_G),
-       S3C2410_GPIO_J_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_H),
-       S3C2410_GPIO_K_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_J),
-       S3C2410_GPIO_L_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_K),
-       S3C2410_GPIO_M_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_L),
-};
-
-#endif /* __ASSEMBLY__ */
-
-/* S3C2410 GPIO number definitions. */
-
-#define S3C2410_GPA(_nr)       (S3C2410_GPIO_A_START + (_nr))
-#define S3C2410_GPB(_nr)       (S3C2410_GPIO_B_START + (_nr))
-#define S3C2410_GPC(_nr)       (S3C2410_GPIO_C_START + (_nr))
-#define S3C2410_GPD(_nr)       (S3C2410_GPIO_D_START + (_nr))
-#define S3C2410_GPE(_nr)       (S3C2410_GPIO_E_START + (_nr))
-#define S3C2410_GPF(_nr)       (S3C2410_GPIO_F_START + (_nr))
-#define S3C2410_GPG(_nr)       (S3C2410_GPIO_G_START + (_nr))
-#define S3C2410_GPH(_nr)       (S3C2410_GPIO_H_START + (_nr))
-#define S3C2410_GPJ(_nr)       (S3C2410_GPIO_J_START + (_nr))
-#define S3C2410_GPK(_nr)       (S3C2410_GPIO_K_START + (_nr))
-#define S3C2410_GPL(_nr)       (S3C2410_GPIO_L_START + (_nr))
-#define S3C2410_GPM(_nr)       (S3C2410_GPIO_M_START + (_nr))
-
-#include <plat/gpio-cfg.h>
-
-#ifdef CONFIG_CPU_S3C244X
-#define S3C_GPIO_END   (S3C2410_GPJ(0) + 32)
-#elif defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416)
-#define S3C_GPIO_END   (S3C2410_GPM(0) + 32)
-#else
-#define S3C_GPIO_END   (S3C2410_GPH(0) + 32)
-#endif
-
-#endif /* __MACH_GPIO_H */
index e27b5c9..530e9a6 100644 (file)
@@ -54,6 +54,7 @@
 #include <mach/regs-gpio.h>
 
 #include <linux/platform_data/i2c-s3c2410.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <plat/gpio-cfg.h>
index c1fb6c3..b60a248 100644 (file)
@@ -37,6 +37,7 @@
 #include <mach/regs-lcd.h>
 #include <linux/platform_data/mtd-nand-s3c2410.h>
 #include <linux/platform_data/i2c-s3c2410.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
index 6dfeeb7..7440119 100644 (file)
@@ -38,6 +38,7 @@
 #include <mach/regs-lcd.h>
 #include <linux/platform_data/mtd-nand-s3c2410.h>
 #include <linux/platform_data/i2c-s3c2410.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
index 22d6ae9..47fe7af 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/platform_data/hwmon-s3c.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <linux/platform_data/mtd-nand-s3c2410.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 
 #include <net/ax88796.h>
 
index 13d8d07..c2c2ac7 100644 (file)
@@ -70,6 +70,7 @@
 #include <linux/platform_data/touchscreen-s3c2410.h>
 #include <linux/platform_data/usb-ohci-s3c2410.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 
 #include <mach/fb.h>
 #include <mach/hardware.h>
index 952b6a0..d25d8b1 100644 (file)
@@ -46,6 +46,7 @@
 #include <linux/platform_data/mmc-s3cmci.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 
 #include <sound/uda1380.h>
 
index 43c23e2..434dbf2 100644 (file)
@@ -34,6 +34,7 @@
 #include <plat/regs-serial.h>
 #include <linux/platform_data/mtd-nand-s3c2410.h>
 #include <linux/platform_data/i2c-s3c2410.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 
 #include <mach/regs-gpio.h>
 #include <mach/regs-lcd.h>
index 4a18d49..48af11f 100644 (file)
@@ -46,6 +46,7 @@
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <linux/platform_data/mmc-s3cmci.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
index 2cb46c3..7fcb887 100644 (file)
@@ -42,6 +42,7 @@
 #include <asm/mach/map.h>
 
 #include <linux/platform_data/i2c-s3c2410.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 #include <plat/regs-serial.h>
 
 #include <plat/clock.h>
index 01f4354..0f27ac4 100644 (file)
@@ -39,6 +39,7 @@
 #include <mach/regs-gpio.h>
 #include <plat/regs-serial.h>
 #include <linux/platform_data/i2c-s3c2410.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 
 #include <plat/gpio-cfg.h>
 #include <plat/clock.h>
index 58d6fbe..040b16a 100644 (file)
@@ -33,6 +33,7 @@
 
 #include <linux/platform_data/mtd-nand-s3c2410.h>
 #include <linux/platform_data/i2c-s3c2410.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
index f8feaea..96c3bc8 100644 (file)
@@ -54,6 +54,7 @@
 #include <linux/platform_data/mtd-nand-s3c2410.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
 #include <linux/platform_data/i2c-s3c2410.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 
 #include <plat/gpio-cfg.h>
 #include <plat/devs.h>
index 034b7fe..d492fb9 100644 (file)
@@ -45,6 +45,7 @@
 #include <linux/platform_data/mtd-nand-s3c2410.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
 #include <linux/platform_data/usb-s3c2410_udc.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 
 #include <sound/uda1380.h>
 
index 3bc6231..319ed80 100644 (file)
@@ -35,6 +35,7 @@
 #include <asm/mach/map.h>
 
 #include <linux/platform_data/mtd-nand-s3c2410.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 
 #include <asm/irq.h>
 #include <asm/mach-types.h>
index c9d31ef..86e2501 100644 (file)
@@ -39,6 +39,7 @@
 
 #include <linux/platform_data/usb-s3c2410_udc.h>
 #include <linux/platform_data/i2c-s3c2410.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 #include <mach/fb.h>
 
 #include <plat/clock.h>
index f88e672..0cc691d 100644 (file)
@@ -41,6 +41,7 @@
 
 #include <linux/platform_data/leds-s3c24xx.h>
 #include <linux/platform_data/i2c-s3c2410.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 
 #include <plat/gpio-cfg.h>
 #include <plat/clock.h>
index 42e7187..86e7ffd 100644 (file)
@@ -37,6 +37,7 @@
 #include <linux/platform_data/leds-s3c24xx.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <linux/platform_data/asoc-s3c24xx_simtec.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 
 #include <mach/hardware.h>
 #include <mach/regs-gpio.h>
index 2d82c4f..e4cd56e 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/syscore_ops.h>
 #include <linux/gpio.h>
 #include <linux/io.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 
 #include <asm/mach-types.h>
 
index caa5b72..2baa887 100644 (file)
@@ -34,6 +34,7 @@
 #include <linux/interrupt.h>
 #include <linux/serial_core.h>
 #include <linux/io.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 
 #include <plat/regs-serial.h>
 #include <mach/regs-clock.h>
index 34676d1..db22f74 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/platform_device.h>
 #include <linux/reboot.h>
 #include <linux/io.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
index 9ef3ccf..cb77880 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/reboot.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
index 5f9d656..22e5dbd 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/gpio.h>
 #include <linux/clk.h>
 #include <linux/io.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
index 6819961..4ba093b 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/gpio.h>
 #include <linux/clk.h>
 #include <linux/io.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 
 #include <mach/hardware.h>
 #include <linux/atomic.h>
index b6c7191..faa1086 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/reboot.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
index 7b4f333..3d1fd5c 100644 (file)
@@ -17,6 +17,7 @@ struct platform_device;
 
 #include <plat/gpio-cfg.h>
 #include <linux/platform_data/i2c-s3c2410.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 #include <mach/hardware.h>
 #include <mach/regs-gpio.h>
 
index f65cb3e..2835241 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/gpio.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 
 #include <mach/regs-gpio.h>
 #include <plat/gpio-cfg.h>
index 4e11aff..1ea4056 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <linux/kernel.h>
 #include <linux/gpio.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 
 struct platform_device; /* don't need the contents */
 
index 2ed2e32..a007e5f 100644 (file)
@@ -32,6 +32,7 @@
 #include <asm/irq.h>
 
 #include <linux/platform_data/usb-ohci-s3c2410.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 #include <plat/devs.h>
 
 #include "bast.h"
index a8de3cf..41fef69 100644 (file)
@@ -19,6 +19,9 @@
 #include <linux/io.h>
 #include <linux/gpio.h>
 
+#ifdef CONFIG_ARCH_S3C24XX
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
+#endif
 #include <plat/gpio-core.h>
 #include <plat/pm.h>
 
index e01bf76..70cf503 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 #include <linux/gpio.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 #include <plat/gpio-cfg.h>
 
 /* Number of camera port pins, without FIELD */
index 76e02b9..268214c 100644 (file)
@@ -27,6 +27,9 @@
 #include <linux/of.h>
 #include <linux/slab.h>
 #include <linux/of_address.h>
+#ifdef CONFIG_ARCH_S3C24XX
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
+#endif
 
 #include <asm/irq.h>
 
index 2fce5ea..11ba3cb 100644 (file)
@@ -26,6 +26,7 @@
 #include <mach/dma.h>
 
 #include <linux/platform_data/mmc-s3cmci.h>
+#include <linux/platform_data/gpio-samsung-s3c24xx.h>
 
 #include "s3cmci.h"
 
diff --git a/include/linux/platform_data/gpio-samsung-s3c24xx.h b/include/linux/platform_data/gpio-samsung-s3c24xx.h
new file mode 100644 (file)
index 0000000..5ce750c
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2008 Simtec Electronics
+ *     http://armlinux.simtec.co.uk/
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C2410 - GPIO lib support
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+/* some boards require extra gpio capacity to support external
+ * devices that need GPIO.
+ */
+
+#ifndef GPIO_SAMSUNG_S3C24XX_H
+#define GPIO_SAMSUNG_S3C24XX_H
+
+/*
+ * GPIO sizes for various SoCs:
+ *
+ *   2410 2412 2440 2443 2416
+ *             2442
+ *   ---- ---- ---- ---- ----
+ * A  23   22   25   16   25
+ * B  11   11   11   11   9
+ * C  16   15   16   16   16
+ * D  16   16   16   16   16
+ * E  16   16   16   16   16
+ * F  8    8    8    8    8
+ * G  16   16   16   16   8
+ * H  11   11   9    15   15
+ * J  --   --   13   16   --
+ * K  --   --   --   --   16
+ * L  --   --   --   15   7
+ * M  --   --   --   2    2
+ */
+
+/* GPIO bank sizes */
+
+#define S3C2410_GPIO_A_NR      (32)
+#define S3C2410_GPIO_B_NR      (32)
+#define S3C2410_GPIO_C_NR      (32)
+#define S3C2410_GPIO_D_NR      (32)
+#define S3C2410_GPIO_E_NR      (32)
+#define S3C2410_GPIO_F_NR      (32)
+#define S3C2410_GPIO_G_NR      (32)
+#define S3C2410_GPIO_H_NR      (32)
+#define S3C2410_GPIO_J_NR      (32)    /* technically 16. */
+#define S3C2410_GPIO_K_NR      (32)    /* technically 16. */
+#define S3C2410_GPIO_L_NR      (32)    /* technically 15. */
+#define S3C2410_GPIO_M_NR      (32)    /* technically 2. */
+
+#if CONFIG_S3C_GPIO_SPACE != 0
+#error CONFIG_S3C_GPIO_SPACE cannot be nonzero at the moment
+#endif
+
+#define S3C2410_GPIO_NEXT(__gpio) \
+       ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 0)
+
+#ifndef __ASSEMBLY__
+
+enum s3c_gpio_number {
+       S3C2410_GPIO_A_START = 0,
+       S3C2410_GPIO_B_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_A),
+       S3C2410_GPIO_C_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_B),
+       S3C2410_GPIO_D_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_C),
+       S3C2410_GPIO_E_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_D),
+       S3C2410_GPIO_F_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_E),
+       S3C2410_GPIO_G_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_F),
+       S3C2410_GPIO_H_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_G),
+       S3C2410_GPIO_J_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_H),
+       S3C2410_GPIO_K_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_J),
+       S3C2410_GPIO_L_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_K),
+       S3C2410_GPIO_M_START = S3C2410_GPIO_NEXT(S3C2410_GPIO_L),
+};
+
+#endif /* __ASSEMBLY__ */
+
+/* S3C2410 GPIO number definitions. */
+
+#define S3C2410_GPA(_nr)       (S3C2410_GPIO_A_START + (_nr))
+#define S3C2410_GPB(_nr)       (S3C2410_GPIO_B_START + (_nr))
+#define S3C2410_GPC(_nr)       (S3C2410_GPIO_C_START + (_nr))
+#define S3C2410_GPD(_nr)       (S3C2410_GPIO_D_START + (_nr))
+#define S3C2410_GPE(_nr)       (S3C2410_GPIO_E_START + (_nr))
+#define S3C2410_GPF(_nr)       (S3C2410_GPIO_F_START + (_nr))
+#define S3C2410_GPG(_nr)       (S3C2410_GPIO_G_START + (_nr))
+#define S3C2410_GPH(_nr)       (S3C2410_GPIO_H_START + (_nr))
+#define S3C2410_GPJ(_nr)       (S3C2410_GPIO_J_START + (_nr))
+#define S3C2410_GPK(_nr)       (S3C2410_GPIO_K_START + (_nr))
+#define S3C2410_GPL(_nr)       (S3C2410_GPIO_L_START + (_nr))
+#define S3C2410_GPM(_nr)       (S3C2410_GPIO_M_START + (_nr))
+
+#include <plat/gpio-cfg.h>
+
+#ifdef CONFIG_CPU_S3C244X
+#define S3C_GPIO_END   (S3C2410_GPJ(0) + 32)
+#elif defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416)
+#define S3C_GPIO_END   (S3C2410_GPM(0) + 32)
+#else
+#define S3C_GPIO_END   (S3C2410_GPH(0) + 32)
+#endif
+
+#endif /* GPIO_SAMSUNG_S3C24XX_H */