Skip to contentSkip to conversation

This patch adds support for GPIO bank J present on S3C244X CPUs. It

PATCH New Christian Pellegrin 3 participants 17 messages Mar 2, 2010 – Mar 12, 2010

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

PATCH 1/1 This patch adds support for GPIO bank J present on S3C244X CPUs. It

---
 arch/arm/mach-s3c2410/include/mach/gpio-core.h |    5 +++++
 arch/arm/mach-s3c2410/include/mach/gpio-nrs.h  |    4 ++++
 arch/arm/mach-s3c2410/include/mach/gpio.h      |    8 ++++++++
 arch/arm/plat-s3c/pm-gpio.c                    |    5 +++--
 arch/arm/plat-s3c24xx/gpiolib.c                |   16 +++++++++++++++-
 5 files changed, 35 insertions(+), 3 deletions(-)
arch/arm/mach-s3c2410/include/mach/gpio-core.h +5 -0
index f8b879a..de9697c 100644
@@ -24,8 +24,13 @@ static inline struct s3c_gpio_chip *s3c_gpiolib_getchip(unsigned int pin)
 {
 	struct s3c_gpio_chip *chip;
 
+#ifdef CONFIG_CPU_S3C244X
+	if (pin > S3C2410_GPJ(15))
+		return NULL;
+#else
 	if (pin > S3C2410_GPG(10))
 		return NULL;
+#endif
 
 	chip = &s3c24xx_gpios[pin/32];
 	return (S3C2410_GPIO_OFFSET(pin) < chip->chip.ngpio) ? chip : NULL;
arch/arm/mach-s3c2410/include/mach/gpio-nrs.h +4 -0
index 2edbb9c..f1f32e2 100644
@@ -24,6 +24,7 @@
 #define S3C2410_GPIO_BANKF   (32*5)
 #define S3C2410_GPIO_BANKG   (32*6)
 #define S3C2410_GPIO_BANKH   (32*7)
+#define S3C2410_GPIO_BANKJ   (32*8)
 
 /* GPIO bank sizes */
 #define S3C2410_GPIO_A_NR	(32)
@@ -34,6 +35,7 @@
 #define S3C2410_GPIO_F_NR	(32)
 #define S3C2410_GPIO_G_NR	(32)
 #define S3C2410_GPIO_H_NR	(32)
+#define S3C2410_GPIO_J_NR	(32)
 
 #if CONFIG_S3C_GPIO_SPACE != 0
 #error CONFIG_S3C_GPIO_SPACE cannot be zero at the moment
@@ -53,6 +55,7 @@ enum s3c_gpio_number {
 	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),
 };
 
 #endif /* __ASSEMBLY__ */
@@ -67,6 +70,7 @@ enum s3c_gpio_number {
 #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))
 
 /* compatibility until drivers can be modified */
 
arch/arm/mach-s3c2410/include/mach/gpio.h +8 -0
index 15f0b3e..1528fc7 100644
@@ -20,10 +20,18 @@
  * devices that need GPIO.
  */
 
+#ifdef CONFIG_CPU_S3C244X
+#define ARCH_NR_GPIOS	(32 * 9 + CONFIG_S3C24XX_GPIO_EXTRA)
+#else
 #define ARCH_NR_GPIOS	(256 + CONFIG_S3C24XX_GPIO_EXTRA)
+#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_GPIO_BANKJ + 32)
+#else
 #define S3C_GPIO_END	(S3C2410_GPIO_BANKH + 32)
+#endif
arch/arm/plat-s3c/pm-gpio.c +3 -2
index cfd326a..8ef2c9d 100644
@@ -20,6 +20,7 @@
 #include <linux/gpio.h>
 
 #include <mach/gpio-core.h>
+#include <mach/regs-gpioj.h>
 #include <plat/pm.h>
 
 /* PM GPIO helpers */
@@ -343,7 +344,7 @@ void s3c_pm_save_gpios(void)
 			  ourchip->pm_save[2],
 			  ourchip->pm_save[3]);
 
-		gpio_nr += ourchip->chip.ngpio;
+		gpio_nr += ourchip->chip.ngpio - 1;
 		gpio_nr += CONFIG_S3C_GPIO_SPACE;
 	}
 }
@@ -374,7 +375,7 @@ void s3c_pm_restore_gpios(void)
 
 		s3c_pm_resume_gpio(ourchip);
 
-		gpio_nr += ourchip->chip.ngpio;
+		gpio_nr += ourchip->chip.ngpio - 1;
 		gpio_nr += CONFIG_S3C_GPIO_SPACE;
 	}
 }
arch/arm/plat-s3c24xx/gpiolib.c +15 -1
index 6d7a961..815b2b1 100644
@@ -26,6 +26,7 @@
 #include <plat/pm.h>
 
 #include <mach/regs-gpio.h>
+#include <mach/regs-gpioj.h>
 
 static int s3c24xx_gpiolib_banka_input(struct gpio_chip *chip, unsigned offset)
 {
@@ -151,7 +152,8 @@ struct s3c_gpio_chip s3c24xx_gpios[] = {
 			.ngpio			= 16,
 			.to_irq			= s3c24xx_gpiolib_bankg_toirq,
 		},
-	}, {
+	},
+	[7] = {
 		.base	= S3C2410_GPHCON,
 		.pm	= __gpio_pm(&s3c_gpio_pm_2bit),
 		.chip	= {
@@ -161,6 +163,18 @@ struct s3c_gpio_chip s3c24xx_gpios[] = {
 			.ngpio			= 11,
 		},
 	},
+#ifdef CONFIG_CPU_S3C244X
+	[8] = {
+		.base	= S3C2440_GPJCON,
+		.pm	= __gpio_pm(&s3c_gpio_pm_2bit),
+		.chip	= {
+			.base			= S3C2410_GPJ(0),
+			.owner			= THIS_MODULE,
+			.label			= "GPIOJ",
+			.ngpio			= 13,
+		},
+	},
+#endif
 };
 
 static __init int s3c24xx_gpiolib_init(void)
Signature · 1 line
1.5.6.5
#1 lore raw

PATCH 1/1 This patch adds support for GPIO bank J present on S3C244X CPUs. It

Sorry, blundered the description line. Sending a better one in response to this mail.

Signature · 5 lines
Christian Pellegrin, see http://www.evolware.org/chri/
"Real Programmers don't play tennis, or any other sport which requires
you to change clothes. Mountain climbing is OK, and Real Programmers
wear their climbing boots to work in case a mountain should suddenly
spring up in the middle of the computer room."
#2 lore raw

PATCH RESEND 1/1 Fix support for banks H and J on S3C244X CPUs

This patch adds support to gpiolib for GPIO bank J present on S3C244X CPUs. It solves a bug causing bank H not being saved and restored during suspend.

---
 arch/arm/mach-s3c2410/include/mach/gpio-core.h |    5 +++++
 arch/arm/mach-s3c2410/include/mach/gpio-nrs.h  |    4 ++++
 arch/arm/mach-s3c2410/include/mach/gpio.h      |    8 ++++++++
 arch/arm/plat-s3c/pm-gpio.c                    |    5 +++--
 arch/arm/plat-s3c24xx/gpiolib.c                |   16 +++++++++++++++-
 5 files changed, 35 insertions(+), 3 deletions(-)
arch/arm/mach-s3c2410/include/mach/gpio-core.h +5 -0
index f8b879a..de9697c 100644
@@ -24,8 +24,13 @@ static inline struct s3c_gpio_chip *s3c_gpiolib_getchip(unsigned int pin)
 {
 	struct s3c_gpio_chip *chip;
 
+#ifdef CONFIG_CPU_S3C244X
+	if (pin > S3C2410_GPJ(15))
+		return NULL;
+#else
 	if (pin > S3C2410_GPG(10))
 		return NULL;
+#endif
 
 	chip = &s3c24xx_gpios[pin/32];
 	return (S3C2410_GPIO_OFFSET(pin) < chip->chip.ngpio) ? chip : NULL;
arch/arm/mach-s3c2410/include/mach/gpio-nrs.h +4 -0
index 2edbb9c..f1f32e2 100644
@@ -24,6 +24,7 @@
 #define S3C2410_GPIO_BANKF   (32*5)
 #define S3C2410_GPIO_BANKG   (32*6)
 #define S3C2410_GPIO_BANKH   (32*7)
+#define S3C2410_GPIO_BANKJ   (32*8)
 
 /* GPIO bank sizes */
 #define S3C2410_GPIO_A_NR	(32)
@@ -34,6 +35,7 @@
 #define S3C2410_GPIO_F_NR	(32)
 #define S3C2410_GPIO_G_NR	(32)
 #define S3C2410_GPIO_H_NR	(32)
+#define S3C2410_GPIO_J_NR	(32)
 
 #if CONFIG_S3C_GPIO_SPACE != 0
 #error CONFIG_S3C_GPIO_SPACE cannot be zero at the moment
@@ -53,6 +55,7 @@ enum s3c_gpio_number {
 	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),
 };
 
 #endif /* __ASSEMBLY__ */
@@ -67,6 +70,7 @@ enum s3c_gpio_number {
 #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))
 
 /* compatibility until drivers can be modified */
 
arch/arm/mach-s3c2410/include/mach/gpio.h +8 -0
index 15f0b3e..1528fc7 100644
@@ -20,10 +20,18 @@
  * devices that need GPIO.
  */
 
+#ifdef CONFIG_CPU_S3C244X
+#define ARCH_NR_GPIOS	(32 * 9 + CONFIG_S3C24XX_GPIO_EXTRA)
+#else
 #define ARCH_NR_GPIOS	(256 + CONFIG_S3C24XX_GPIO_EXTRA)
+#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_GPIO_BANKJ + 32)
+#else
 #define S3C_GPIO_END	(S3C2410_GPIO_BANKH + 32)
+#endif
arch/arm/plat-s3c/pm-gpio.c +3 -2
index cfd326a..8ef2c9d 100644
@@ -20,6 +20,7 @@
 #include <linux/gpio.h>
 
 #include <mach/gpio-core.h>
+#include <mach/regs-gpioj.h>
 #include <plat/pm.h>
 
 /* PM GPIO helpers */
@@ -343,7 +344,7 @@ void s3c_pm_save_gpios(void)
 			  ourchip->pm_save[2],
 			  ourchip->pm_save[3]);
 
-		gpio_nr += ourchip->chip.ngpio;
+		gpio_nr += ourchip->chip.ngpio - 1;
 		gpio_nr += CONFIG_S3C_GPIO_SPACE;
 	}
 }
@@ -374,7 +375,7 @@ void s3c_pm_restore_gpios(void)
 
 		s3c_pm_resume_gpio(ourchip);
 
-		gpio_nr += ourchip->chip.ngpio;
+		gpio_nr += ourchip->chip.ngpio - 1;
 		gpio_nr += CONFIG_S3C_GPIO_SPACE;
 	}
 }
arch/arm/plat-s3c24xx/gpiolib.c +15 -1
index 6d7a961..815b2b1 100644
@@ -26,6 +26,7 @@
 #include <plat/pm.h>
 
 #include <mach/regs-gpio.h>
+#include <mach/regs-gpioj.h>
 
 static int s3c24xx_gpiolib_banka_input(struct gpio_chip *chip, unsigned offset)
 {
@@ -151,7 +152,8 @@ struct s3c_gpio_chip s3c24xx_gpios[] = {
 			.ngpio			= 16,
 			.to_irq			= s3c24xx_gpiolib_bankg_toirq,
 		},
-	}, {
+	},
+	[7] = {
 		.base	= S3C2410_GPHCON,
 		.pm	= __gpio_pm(&s3c_gpio_pm_2bit),
 		.chip	= {
@@ -161,6 +163,18 @@ struct s3c_gpio_chip s3c24xx_gpios[] = {
 			.ngpio			= 11,
 		},
 	},
+#ifdef CONFIG_CPU_S3C244X
+	[8] = {
+		.base	= S3C2440_GPJCON,
+		.pm	= __gpio_pm(&s3c_gpio_pm_2bit),
+		.chip	= {
+			.base			= S3C2410_GPJ(0),
+			.owner			= THIS_MODULE,
+			.label			= "GPIOJ",
+			.ngpio			= 13,
+		},
+	},
+#endif
 };
 
 static __init int s3c24xx_gpiolib_init(void)
Signature · 1 line
1.5.6.5
#3 lore raw

PATCH 1/1 This patch adds support for GPIO bank J present on S3C244X CPUs. It

In reply to Christian Pellegrin
Quoted 100 lines · Christian Pellegrin
---
 arch/arm/mach-s3c2410/include/mach/gpio-core.h |    5 +++++
 arch/arm/mach-s3c2410/include/mach/gpio-nrs.h  |    4 ++++
 arch/arm/mach-s3c2410/include/mach/gpio.h      |    8 ++++++++
 arch/arm/plat-s3c/pm-gpio.c                    |    5 +++--
 arch/arm/plat-s3c24xx/gpiolib.c                |   16 +++++++++++++++-
 5 files changed, 35 insertions(+), 3 deletions(-)
arch/arm/mach-s3c2410/include/mach/gpio-core.h +5 -0
index f8b879a..de9697c 100644
@@ -24,8 +24,13 @@ static inline struct s3c_gpio_chip *s3c_gpiolib_getchip(unsigned int pin)
 {
 	struct s3c_gpio_chip *chip;
 
+#ifdef CONFIG_CPU_S3C244X
+	if (pin > S3C2410_GPJ(15))
+		return NULL;
+#else
 	if (pin > S3C2410_GPG(10))
 		return NULL;
+#endif
 
 	chip = &s3c24xx_gpios[pin/32];
 	return (S3C2410_GPIO_OFFSET(pin) < chip->chip.ngpio) ? chip : NULL;
arch/arm/mach-s3c2410/include/mach/gpio-nrs.h +4 -0
index 2edbb9c..f1f32e2 100644
@@ -24,6 +24,7 @@
 #define S3C2410_GPIO_BANKF   (32*5)
 #define S3C2410_GPIO_BANKG   (32*6)
 #define S3C2410_GPIO_BANKH   (32*7)
+#define S3C2410_GPIO_BANKJ   (32*8)
 
 /* GPIO bank sizes */
 #define S3C2410_GPIO_A_NR	(32)
@@ -34,6 +35,7 @@
 #define S3C2410_GPIO_F_NR	(32)
 #define S3C2410_GPIO_G_NR	(32)
 #define S3C2410_GPIO_H_NR	(32)
+#define S3C2410_GPIO_J_NR	(32)
 
 #if CONFIG_S3C_GPIO_SPACE != 0
 #error CONFIG_S3C_GPIO_SPACE cannot be zero at the moment
@@ -53,6 +55,7 @@ enum s3c_gpio_number {
 	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),
 };
 
 #endif /* __ASSEMBLY__ */
@@ -67,6 +70,7 @@ enum s3c_gpio_number {
 #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))
 
 /* compatibility until drivers can be modified */
 
arch/arm/mach-s3c2410/include/mach/gpio.h +8 -0
index 15f0b3e..1528fc7 100644
@@ -20,10 +20,18 @@
  * devices that need GPIO.
  */
 
+#ifdef CONFIG_CPU_S3C244X
+#define ARCH_NR_GPIOS	(32 * 9 + CONFIG_S3C24XX_GPIO_EXTRA)
+#else
 #define ARCH_NR_GPIOS	(256 + CONFIG_S3C24XX_GPIO_EXTRA)
+#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_GPIO_BANKJ + 32)
+#else
 #define S3C_GPIO_END	(S3C2410_GPIO_BANKH + 32)
+#endif
arch/arm/plat-s3c/pm-gpio.c +1 -0
index cfd326a..8ef2c9d 100644
@@ -20,6 +20,7 @@
 #include <linux/gpio.h>
 
 #include <mach/gpio-core.h>
+#include <mach/regs-gpioj.h>
 #include <plat/pm.h>
 
 /* PM GPIO helpers */

arch/arm/plat-s3c/pm-gpio.c void s3c_pm_save_gpios(void) · line 347

Quoted 5 lines
arch/arm/plat-s3c/pm-gpio.c +1 -1
@@ -343,7 +344,7 @@ void s3c_pm_save_gpios(void)
 			  ourchip->pm_save[2],
 			  ourchip->pm_save[3]);
 
-		gpio_nr += ourchip->chip.ngpio;
+		gpio_nr += ourchip->chip.ngpio - 1;

This seems to be a seperate fix to the original change.

arch/arm/plat-s3c/pm-gpio.c void s3c_pm_restore_gpios(void) · line 381

Quoted 12 lines
arch/arm/plat-s3c/pm-gpio.c +1 -1
 		gpio_nr += CONFIG_S3C_GPIO_SPACE;
 	}
 }
@@ -374,7 +375,7 @@ void s3c_pm_restore_gpios(void)
 
 		s3c_pm_resume_gpio(ourchip);
 
-		gpio_nr += ourchip->chip.ngpio;
+		gpio_nr += ourchip->chip.ngpio - 1;
 		gpio_nr += CONFIG_S3C_GPIO_SPACE;
 	}
 }

and again.

Quoted 39 lines
arch/arm/plat-s3c24xx/gpiolib.c +15 -1
index 6d7a961..815b2b1 100644
@@ -26,6 +26,7 @@
 #include <plat/pm.h>
 
 #include <mach/regs-gpio.h>
+#include <mach/regs-gpioj.h>
 
 static int s3c24xx_gpiolib_banka_input(struct gpio_chip *chip, unsigned offset)
 {
@@ -151,7 +152,8 @@ struct s3c_gpio_chip s3c24xx_gpios[] = {
 			.ngpio			= 16,
 			.to_irq			= s3c24xx_gpiolib_bankg_toirq,
 		},
-	}, {
+	},
+	[7] = {
 		.base	= S3C2410_GPHCON,
 		.pm	= __gpio_pm(&s3c_gpio_pm_2bit),
 		.chip	= {
@@ -161,6 +163,18 @@ struct s3c_gpio_chip s3c24xx_gpios[] = {
 			.ngpio			= 11,
 		},
 	},
+#ifdef CONFIG_CPU_S3C244X
+	[8] = {
+		.base	= S3C2440_GPJCON,
+		.pm	= __gpio_pm(&s3c_gpio_pm_2bit),
+		.chip	= {
+			.base			= S3C2410_GPJ(0),
+			.owner			= THIS_MODULE,
+			.label			= "GPIOJ",
+			.ngpio			= 13,
+		},
+	},
+#endif
 };
Signature · 4 lines
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.
#4 lore raw

PATCH 1/1 This patch adds support for GPIO bank J present on S3C244X CPUs. It

Quoted 3 lines · Ben Dooks

and again.

ack, I will split this patch in 2 separate ones and send them in response to this mail. Thanks.

Signature · 5 lines
Christian Pellegrin, see http://www.evolware.org/chri/
"Real Programmers don't play tennis, or any other sport which requires
you to change clothes. Mountain climbing is OK, and Real Programmers
wear their climbing boots to work in case a mountain should suddenly
spring up in the middle of the computer room."
#5 lore raw

PATCH 1/1 Adds support for banks H and J on S3C244X CPUs

This patch adds support to gpiolib for GPIO bank J present on S3C244X CPUs.

---
 arch/arm/mach-s3c2410/include/mach/gpio-nrs.h |    4 ++++
 arch/arm/mach-s3c2410/include/mach/gpio.h     |    8 ++++++++
 arch/arm/plat-s3c24xx/gpiolib.c               |   16 +++++++++++++++-
 3 files changed, 27 insertions(+), 1 deletions(-)
arch/arm/mach-s3c2410/include/mach/gpio-nrs.h +4 -0
index 2edbb9c..f1f32e2 100644
@@ -24,6 +24,7 @@
 #define S3C2410_GPIO_BANKF   (32*5)
 #define S3C2410_GPIO_BANKG   (32*6)
 #define S3C2410_GPIO_BANKH   (32*7)
+#define S3C2410_GPIO_BANKJ   (32*8)
 
 /* GPIO bank sizes */
 #define S3C2410_GPIO_A_NR	(32)
@@ -34,6 +35,7 @@
 #define S3C2410_GPIO_F_NR	(32)
 #define S3C2410_GPIO_G_NR	(32)
 #define S3C2410_GPIO_H_NR	(32)
+#define S3C2410_GPIO_J_NR	(32)
 
 #if CONFIG_S3C_GPIO_SPACE != 0
 #error CONFIG_S3C_GPIO_SPACE cannot be zero at the moment
@@ -53,6 +55,7 @@ enum s3c_gpio_number {
 	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),
 };
 
 #endif /* __ASSEMBLY__ */
@@ -67,6 +70,7 @@ enum s3c_gpio_number {
 #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))
 
 /* compatibility until drivers can be modified */
 
arch/arm/mach-s3c2410/include/mach/gpio.h +8 -0
index 15f0b3e..1528fc7 100644
@@ -20,10 +20,18 @@
  * devices that need GPIO.
  */
 
+#ifdef CONFIG_CPU_S3C244X
+#define ARCH_NR_GPIOS	(32 * 9 + CONFIG_S3C24XX_GPIO_EXTRA)
+#else
 #define ARCH_NR_GPIOS	(256 + CONFIG_S3C24XX_GPIO_EXTRA)
+#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_GPIO_BANKJ + 32)
+#else
 #define S3C_GPIO_END	(S3C2410_GPIO_BANKH + 32)
+#endif
arch/arm/plat-s3c24xx/gpiolib.c +15 -1
index 6d7a961..815b2b1 100644
@@ -26,6 +26,7 @@
 #include <plat/pm.h>
 
 #include <mach/regs-gpio.h>
+#include <mach/regs-gpioj.h>
 
 static int s3c24xx_gpiolib_banka_input(struct gpio_chip *chip, unsigned offset)
 {
@@ -151,7 +152,8 @@ struct s3c_gpio_chip s3c24xx_gpios[] = {
 			.ngpio			= 16,
 			.to_irq			= s3c24xx_gpiolib_bankg_toirq,
 		},
-	}, {
+	},
+	[7] = {
 		.base	= S3C2410_GPHCON,
 		.pm	= __gpio_pm(&s3c_gpio_pm_2bit),
 		.chip	= {
@@ -161,6 +163,18 @@ struct s3c_gpio_chip s3c24xx_gpios[] = {
 			.ngpio			= 11,
 		},
 	},
+#ifdef CONFIG_CPU_S3C244X
+	[8] = {
+		.base	= S3C2440_GPJCON,
+		.pm	= __gpio_pm(&s3c_gpio_pm_2bit),
+		.chip	= {
+			.base			= S3C2410_GPJ(0),
+			.owner			= THIS_MODULE,
+			.label			= "GPIOJ",
+			.ngpio			= 13,
+		},
+	},
+#endif
 };
 
 static __init int s3c24xx_gpiolib_init(void)
Signature · 1 line
1.5.6.5
#6 lore raw

omap gpio help

Hi all
My System is :Kernel 2.6.22.18 omap mistral
I wrote an driver to the activation of " GPIO " according to the kernel instructions (gpio.txt) and when I request to free the GPIO I receive always that the GPIO is reserved .
What the required steps in order to toggle the GPIO MUXED and not MUXED

Regards Doron Sandroy

#7 lore raw

PATCH 1/1 Fix GPIOs bank H and J not being preserved during suspend

In reply to christian pellegrin

This patch adds bank H and J GPIOs (present on S3C244X CPUs) to the list of registers that must be saved/resumed during suspend.

---
 arch/arm/mach-s3c2410/include/mach/gpio-core.h |    5 +++++
 arch/arm/plat-s3c/pm-gpio.c                    |    4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)
arch/arm/mach-s3c2410/include/mach/gpio-core.h +5 -0
index f8b879a..de9697c 100644
@@ -24,8 +24,13 @@ static inline struct s3c_gpio_chip *s3c_gpiolib_getchip(unsigned int pin)
 {
 	struct s3c_gpio_chip *chip;
 
+#ifdef CONFIG_CPU_S3C244X
+	if (pin > S3C2410_GPJ(15))
+		return NULL;
+#else
 	if (pin > S3C2410_GPG(10))
 		return NULL;
+#endif
 
 	chip = &s3c24xx_gpios[pin/32];
 	return (S3C2410_GPIO_OFFSET(pin) < chip->chip.ngpio) ? chip : NULL;
arch/arm/plat-s3c/pm-gpio.c +2 -2
index cfd326a..b3cc8db 100644
@@ -343,7 +343,7 @@ void s3c_pm_save_gpios(void)
 			  ourchip->pm_save[2],
 			  ourchip->pm_save[3]);
 
-		gpio_nr += ourchip->chip.ngpio;
+		gpio_nr += ourchip->chip.ngpio - 1;
 		gpio_nr += CONFIG_S3C_GPIO_SPACE;
 	}
 }
@@ -374,7 +374,7 @@ void s3c_pm_restore_gpios(void)
 
 		s3c_pm_resume_gpio(ourchip);
 
-		gpio_nr += ourchip->chip.ngpio;
+		gpio_nr += ourchip->chip.ngpio - 1;
 		gpio_nr += CONFIG_S3C_GPIO_SPACE;
 	}
 }
Signature · 1 line
1.5.6.5
#8 lore raw

PATCH 1/1 Fix GPIOs bank H and J not being preserved during suspend

Quoted 14 lines · Christian Pellegrin

This patch adds bank H and J GPIOs (present on S3C244X CPUs) to the list of registers that must be saved/resumed during suspend.

---
 arch/arm/mach-s3c2410/include/mach/gpio-core.h |    5 +++++
 arch/arm/plat-s3c/pm-gpio.c                    |    4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)
arch/arm/mach-s3c2410/include/mach/gpio-core.h +0 -0
index f8b879a..de9697c 100644

arch/arm/mach-s3c2410/include/mach/gpio-core.h static inline struct s3c_gpio_chip *s3c_gpiolib_getchip(unsigned int pin) · line 30

Quoted 7 lines
arch/arm/mach-s3c2410/include/mach/gpio-core.h +4 -0
@@ -24,8 +24,13 @@ static inline struct s3c_gpio_chip *s3c_gpiolib_getchip(unsigned int pin)
 {
 	struct s3c_gpio_chip *chip;
 
+#ifdef CONFIG_CPU_S3C244X
+	if (pin > S3C2410_GPJ(15))
+		return NULL;
+#else

Hmm, could we use the arch define for number of GPIOs here instead of an ifdef?

if (pin > S3C2410_GPG(10))

Quoted 35 lines
arch/arm/mach-s3c2410/include/mach/gpio-core.h +1 -0
 		return NULL;
+#endif
 
 	chip = &s3c24xx_gpios[pin/32];
 	return (S3C2410_GPIO_OFFSET(pin) < chip->chip.ngpio) ? chip : NULL;
arch/arm/plat-s3c/pm-gpio.c +2 -2
index cfd326a..b3cc8db 100644
@@ -343,7 +343,7 @@ void s3c_pm_save_gpios(void)
 			  ourchip->pm_save[2],
 			  ourchip->pm_save[3]);
 
-		gpio_nr += ourchip->chip.ngpio;
+		gpio_nr += ourchip->chip.ngpio - 1;
 		gpio_nr += CONFIG_S3C_GPIO_SPACE;
 	}
 }
@@ -374,7 +374,7 @@ void s3c_pm_restore_gpios(void)
 
 		s3c_pm_resume_gpio(ourchip);
 
-		gpio_nr += ourchip->chip.ngpio;
+		gpio_nr += ourchip->chip.ngpio - 1;
 		gpio_nr += CONFIG_S3C_GPIO_SPACE;
 	}
 }
Signature · 7 lines
1.5.6.5


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 5 lines
-- 
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.
#9 lore raw

PATCH 1/1 Fix GPIOs bank H and J not being preserved during suspend

Quoted 8 lines · Ben Dooks

arch/arm/mach-s3c2410/include/mach/gpio-core.h static inline struct s3c_gpio_chip *s3c_gpiolib_getchip(unsigned int pin) · line 30

Quoted 4 lines
arch/arm/mach-s3c2410/include/mach/gpio-core.h +4 -0
+#ifdef CONFIG_CPU_S3C244X
+ ? ? if (pin > S3C2410_GPJ(15))
+ ? ? ? ? ? ? return NULL;
+#else

Hmm, could we use the arch define for number of GPIOs here instead of an ifdef?

ack, good idea. I'm sending the new patchi in response to this. Tested on s3c2440 custom board.

Signature · 5 lines
Christian Pellegrin, see http://www.evolware.org/chri/
"Real Programmers don't play tennis, or any other sport which requires
you to change clothes. Mountain climbing is OK, and Real Programmers
wear their climbing boots to work in case a mountain should suddenly
spring up in the middle of the computer room."
#10 lore raw

PATCH v2 1/1 Fix GPIOs bank H and J not being preserved during suspend

This patch adds bank H and J GPIOs (present on S3C244X CPUs) to the list of registers that must be saved/resumed during suspend.

---
 arch/arm/mach-s3c2410/include/mach/gpio-core.h |    2 +-
 arch/arm/plat-s3c/pm-gpio.c                    |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-s3c2410/include/mach/gpio-core.h +1 -1
index f8b879a..7c33ecf 100644
@@ -24,7 +24,7 @@ static inline struct s3c_gpio_chip *s3c_gpiolib_getchip(unsigned int pin)
 {
 	struct s3c_gpio_chip *chip;
 
-	if (pin > S3C2410_GPG(10))
+	if (pin > S3C_GPIO_END)
 		return NULL;
 
 	chip = &s3c24xx_gpios[pin/32];
arch/arm/plat-s3c/pm-gpio.c +2 -2
index cfd326a..b3cc8db 100644
@@ -343,7 +343,7 @@ void s3c_pm_save_gpios(void)
 			  ourchip->pm_save[2],
 			  ourchip->pm_save[3]);
 
-		gpio_nr += ourchip->chip.ngpio;
+		gpio_nr += ourchip->chip.ngpio - 1;
 		gpio_nr += CONFIG_S3C_GPIO_SPACE;
 	}
 }
@@ -374,7 +374,7 @@ void s3c_pm_restore_gpios(void)
 
 		s3c_pm_resume_gpio(ourchip);
 
-		gpio_nr += ourchip->chip.ngpio;
+		gpio_nr += ourchip->chip.ngpio - 1;
 		gpio_nr += CONFIG_S3C_GPIO_SPACE;
 	}
 }
Signature · 1 line
1.5.6.5
#11 lore raw

PATCH v2 1/1 Fix GPIOs bank H and J not being preserved during suspend

Quoted 36 lines · Christian Pellegrin

This patch adds bank H and J GPIOs (present on S3C244X CPUs) to the list of registers that must be saved/resumed during suspend.

---
 arch/arm/mach-s3c2410/include/mach/gpio-core.h |    2 +-
 arch/arm/plat-s3c/pm-gpio.c                    |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-s3c2410/include/mach/gpio-core.h +1 -1
index f8b879a..7c33ecf 100644
@@ -24,7 +24,7 @@ static inline struct s3c_gpio_chip *s3c_gpiolib_getchip(unsigned int pin)
 {
 	struct s3c_gpio_chip *chip;
 
-	if (pin > S3C2410_GPG(10))
+	if (pin > S3C_GPIO_END)
 		return NULL;
 
 	chip = &s3c24xx_gpios[pin/32];
arch/arm/plat-s3c/pm-gpio.c +1 -1
index cfd326a..b3cc8db 100644
@@ -343,7 +343,7 @@ void s3c_pm_save_gpios(void)
 			  ourchip->pm_save[2],
 			  ourchip->pm_save[3]);
 
-		gpio_nr += ourchip->chip.ngpio;
+		gpio_nr += ourchip->chip.ngpio - 1;
 		gpio_nr += CONFIG_S3C_GPIO_SPACE;
 	}
 }

arch/arm/plat-s3c/pm-gpio.c void s3c_pm_restore_gpios(void) · line 380

Quoted 8 lines
arch/arm/plat-s3c/pm-gpio.c +1 -1
@@ -374,7 +374,7 @@ void s3c_pm_restore_gpios(void)
 
 		s3c_pm_resume_gpio(ourchip);
 
-		gpio_nr += ourchip->chip.ngpio;
+		gpio_nr += ourchip->chip.ngpio - 1;
 		gpio_nr += CONFIG_S3C_GPIO_SPACE;
 	}
 }

Still not getting why you're changing this from x, to x - 1.

Quoted 6 lines

1.5.6.5

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 5 lines
-- 
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.
#12 lore raw

PATCH v2 1/1 Fix GPIOs bank H and J not being preserved during suspend

Quoted 3 lines · Ben Dooks

Still not getting why you're changing this from x, to x - 1.

ok: the reason is that gpio_nr is already incremented by one in the for instruction. So gpio_nr is not pointing to the first pin of a bank after the first iteration. Of course this doesn't matter because we don't have 32 banks of gpio pins and s3c_gpiolib_getchip works even if we point to a pin in the middle of a bank. But if we get a s3c device with more than 32 banks the 33rd will be skipped. Or at least this is the reason why I did this, maybe I'm mistaken.

Anyway this is a minor point, I fixed it when catching why bank H was not preserved (and so my serial console ttyS1 was dead).

Signature · 5 lines
Christian Pellegrin, see http://www.evolware.org/chri/
"Real Programmers don't play tennis, or any other sport which requires
you to change clothes. Mountain climbing is OK, and Real Programmers
wear their climbing boots to work in case a mountain should suddenly
spring up in the middle of the computer room."
#13 lore raw

PATCH v2 1/1 Fix GPIOs bank H and J not being preserved during suspend

Quoted 13 lines · christian pellegrin
Quoted 3 lines · Ben Dooks

Still not getting why you're changing this from x, to x - 1.

ok: the reason is that gpio_nr is already incremented by one in the for instruction. So gpio_nr is not pointing to the first pin of a bank after the first iteration. Of course this doesn't matter because we don't have 32 banks of gpio pins and s3c_gpiolib_getchip works even if we point to a pin in the middle of a bank. But if we get a s3c device with more than 32 banks the 33rd will be skipped. Or at least this is the reason why I did this, maybe I'm mistaken.

Quoted 2 lines

Anyway this is a minor point, I fixed it when catching why bank H was not preserved (and so my serial console ttyS1 was dead).

Can we have that as a seperate patch with that information in it, to show what is being changed. Thanks.

Signature · 4 lines
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.
#14 lore raw

PATCH v2 1/1 Fix GPIOs bank H and J not being preserved during suspend

Quoted 3 lines · Ben Dooks

Can we have that as a seperate patch with that information in it, to show what is being changed. Thanks.

ack, the patches in-reply-to to this email. Thanks.

Signature · 5 lines
Christian Pellegrin, see http://www.evolware.org/chri/
"Real Programmers don't play tennis, or any other sport which requires
you to change clothes. Mountain climbing is OK, and Real Programmers
wear their climbing boots to work in case a mountain should suddenly
spring up in the middle of the computer room."
#15 lore raw

PATCH v2 1/1 Fix GPIOs banks not being preserved during suspend

This patch corrects the list of registers that must be saved/resumed during suspend.

---
 arch/arm/mach-s3c2410/include/mach/gpio-core.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-s3c2410/include/mach/gpio-core.h +1 -1
index f8b879a..7c33ecf 100644
@@ -24,7 +24,7 @@ static inline struct s3c_gpio_chip *s3c_gpiolib_getchip(unsigned int pin)
 {
 	struct s3c_gpio_chip *chip;
 
-	if (pin > S3C2410_GPG(10))
+	if (pin > S3C_GPIO_END)
 		return NULL;
 
 	chip = &s3c24xx_gpios[pin/32];
Signature · 1 line
1.5.6.5
#16 lore raw

PATCH v2 1/1 Fix one-too-much bug when building list of regs to be preserved on PM

In reply to christian pellegrin

gpio_nr is already incremented in the for loop, so if we will have 32 banks of GPIOs someday the 33rd won't be saved/restored during PM

---
 arch/arm/plat-s3c/pm-gpio.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/plat-s3c/pm-gpio.c +2 -2
index cfd326a..b3cc8db 100644
@@ -343,7 +343,7 @@ void s3c_pm_save_gpios(void)
 			  ourchip->pm_save[2],
 			  ourchip->pm_save[3]);
 
-		gpio_nr += ourchip->chip.ngpio;
+		gpio_nr += ourchip->chip.ngpio - 1;
 		gpio_nr += CONFIG_S3C_GPIO_SPACE;
 	}
 }
@@ -374,7 +374,7 @@ void s3c_pm_restore_gpios(void)
 
 		s3c_pm_resume_gpio(ourchip);
 
-		gpio_nr += ourchip->chip.ngpio;
+		gpio_nr += ourchip->chip.ngpio - 1;
 		gpio_nr += CONFIG_S3C_GPIO_SPACE;
 	}
 }
Signature · 1 line
1.5.6.5