Skip to contentSkip to conversation

ARM : SAMSUNG : Add GPIO_EXTRA for S3C2416.

PATCH In review Paul Schilling 2 participants 2 messages Oct 22, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 5/14 ARM : SAMSUNG : Add GPIO_EXTRA for S3C2416.

The S3C2416 has more GPIO than other S3C24XX processors.

---
 arch/arm/mach-s3c2410/include/mach/gpio.h |   15 ++++++++++-----
 arch/arm/plat-s3c24xx/gpiolib.c           |   10 ++++++++--
 2 files changed, 18 insertions(+), 7 deletions(-)
arch/arm/mach-s3c2410/include/mach/gpio.h +10 -5
index f7f6b07..65a0bce 100644
@@ -20,22 +20,27 @@
  * devices that need GPIO.
  */
 
+#if defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416)
+#define ARCH_NR_GPIOS	(32 * 12 + CONFIG_S3C24XX_GPIO_EXTRA)
+#else
 #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
+#endif
 
 #include <asm-generic/gpio.h>
 #include <mach/gpio-nrs.h>
 #include <mach/gpio-fns.h>
 
-#ifdef CONFIG_CPU_S3C244X
-#define S3C_GPIO_END	(S3C2410_GPJ(0) + 32)
-#elif defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416)
+
+#if defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416)
 #define S3C_GPIO_END	(S3C2410_GPM(0) + 32)
 #else
+#ifdef CONFIG_CPU_S3C244X
+#define S3C_GPIO_END	(S3C2410_GPJ(0) + 32)
+else
 #define S3C_GPIO_END	(S3C2410_GPH(0) + 32)
 #endif
+#endif
arch/arm/plat-s3c24xx/gpiolib.c +8 -2
index 243b641..93d4734 100644
@@ -34,6 +34,11 @@ static int s3c24xx_gpiolib_banka_input(struct gpio_chip *chip, unsigned offset)
 	return -EINVAL;
 }
 
+static int s3c24xx_gpiolib_bankm_output(struct gpio_chip *chip, unsigned offset, int value)
+{
+	return -EINVAL;
+}
+
 static int s3c24xx_gpiolib_banka_output(struct gpio_chip *chip,
 					unsigned offset, int value)
 {
@@ -93,7 +98,7 @@ struct s3c_gpio_chip s3c24xx_gpios[] = {
 			.base			= S3C2410_GPA(0),
 			.owner			= THIS_MODULE,
 			.label			= "GPIOA",
-			.ngpio			= 24,
+			.ngpio			= 27,
 			.direction_input	= s3c24xx_gpiolib_banka_input,
 			.direction_output	= s3c24xx_gpiolib_banka_output,
 		},
@@ -167,7 +172,7 @@ struct s3c_gpio_chip s3c24xx_gpios[] = {
 			.base			= S3C2410_GPH(0),
 			.owner			= THIS_MODULE,
 			.label			= "GPIOH",
-			.ngpio			= 11,
+			.ngpio			= 15,
 		},
 	},
 		/* GPIOS for the S3C2443 and later devices. */
@@ -206,6 +211,7 @@ struct s3c_gpio_chip s3c24xx_gpios[] = {
 			.owner			= THIS_MODULE,
 			.label			= "GPIOM",
 			.ngpio			= 2,
+			.direction_output	= s3c24xx_gpiolib_bankm_output,
 		},
 	},
 };
Signature · 1 line
1.7.6.4
#1 lore raw

Am Samstag 22 Oktober 2011, 06:08:12 schrieb Paul Schilling:

Quoted 17 lines

The S3C2416 has more GPIO than other S3C24XX processors.

---
 arch/arm/mach-s3c2410/include/mach/gpio.h |   15 ++++++++++-----
 arch/arm/plat-s3c24xx/gpiolib.c           |   10 ++++++++--
 2 files changed, 18 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/arch/arm/mach-s3c2410/include/mach/gpio.h index f7f6b07..65a0bce 100644

arch/arm/mach-s3c2410/include/mach/gpio.h +1 -0
@@ -20,22 +20,27 @@
  * devices that need GPIO.
  */
 
+#if defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416)

arch/arm/mach-s3c2410/include/mach/gpio.h line 31

Quoted 10 lines
arch/arm/mach-s3c2410/include/mach/gpio.h +3 -2
+#define ARCH_NR_GPIOS	(32 * 12 + CONFIG_S3C24XX_GPIO_EXTRA)
+#else
 #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
+#endif

why are you moving these around? I don't see a functional change.

Quoted 7 lines
arch/arm/mach-s3c2410/include/mach/gpio.h +0 -3
 #include <asm-generic/gpio.h>
 #include <mach/gpio-nrs.h>
 #include <mach/gpio-fns.h>
 
-#ifdef CONFIG_CPU_S3C244X
-#define S3C_GPIO_END	(S3C2410_GPJ(0) + 32)
-#elif defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416)

arch/arm/mach-s3c2410/include/mach/gpio.h line 46

Quoted 10 lines
arch/arm/mach-s3c2410/include/mach/gpio.h +6 -0
+
+#if defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416)
 #define S3C_GPIO_END	(S3C2410_GPM(0) + 32)
 #else
+#ifdef CONFIG_CPU_S3C244X
+#define S3C_GPIO_END	(S3C2410_GPJ(0) + 32)
+else
 #define S3C_GPIO_END	(S3C2410_GPH(0) + 32)
 #endif
+#endif

same as above

Quoted 35 lines
(quoted diff) +0 -0

b/arch/arm/plat-s3c24xx/gpiolib.c index 243b641..93d4734 100644

arch/arm/plat-s3c24xx/gpiolib.c +6 -2
@@ -34,6 +34,11 @@ static int s3c24xx_gpiolib_banka_input(struct gpio_chip
 *chip, unsigned offset) return -EINVAL;
 }
 
+static int s3c24xx_gpiolib_bankm_output(struct gpio_chip *chip, unsigned
 offset, int value) +{
+	return -EINVAL;
+}
+
 static int s3c24xx_gpiolib_banka_output(struct gpio_chip *chip,
 					unsigned offset, int value)
 {
@@ -93,7 +98,7 @@ struct s3c_gpio_chip s3c24xx_gpios[] = {
 			.base			= S3C2410_GPA(0),
 			.owner			= THIS_MODULE,
 			.label			= "GPIOA",
-			.ngpio			= 24,
+			.ngpio			= 27,
 			.direction_input	= s3c24xx_gpiolib_banka_input,
 			.direction_output	= s3c24xx_gpiolib_banka_output,
 		},
@@ -167,7 +172,7 @@ struct s3c_gpio_chip s3c24xx_gpios[] = {
 			.base			= S3C2410_GPH(0),
 			.owner			= THIS_MODULE,
 			.label			= "GPIOH",
-			.ngpio			= 11,
+			.ngpio			= 15,
 		},
 	},
 		/* GPIOS for the S3C2443 and later devices. */

arch/arm/plat-s3c24xx/gpiolib.c struct s3c_gpio_chip s3c24xx_gpios[] = { · line 217

Quoted 7 lines
arch/arm/plat-s3c24xx/gpiolib.c +1 -0
@@ -206,6 +211,7 @@ struct s3c_gpio_chip s3c24xx_gpios[] = {
 			.owner			= THIS_MODULE,
 			.label			= "GPIOM",
 			.ngpio			= 2,
+			.direction_output	= s3c24xx_gpiolib_bankm_output,
 		},
 	},
 };

looks ok, but you will probably have to coordinate with Kgene as the Samsung gpio support gets consolidated for 3.2 (i.e. in linux-next it currently sits in drivers/gpio/gpio-samsung.c)

Heiko