linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2.6.34-rc2] s3c: Fix GPIOs bank H and J not being preserved during suspend on S3C24XX
@ 2010-03-30  8:23 Christian Pellegrin
  2010-04-23  6:33 ` Vasily Khoruzhick
  2010-05-04  7:01 ` Ben Dooks
  0 siblings, 2 replies; 5+ messages in thread
From: Christian Pellegrin @ 2010-03-30  8:23 UTC (permalink / raw)
  To: linux-arm-kernel

With this patch the platform-specific define for the last defined GPIO
on S3C machines is used instead of a hard-coded value (which is right
only for the s3c2410). The gpio_nr being incremented by 1 too much (look
for the gpio_nr++ in the for instruction) is fixed too although it
doesn't make any trouble on current S3C implementations.

Signed-off-by: Christian Pellegrin <chripell@fsfe.org>
---
 arch/arm/mach-s3c2410/include/mach/gpio-track.h |    2 +-
 arch/arm/plat-samsung/pm-gpio.c                 |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-s3c2410/include/mach/gpio-track.h b/arch/arm/mach-s3c2410/include/mach/gpio-track.h
index acb2591..6371eaa 100644
--- a/arch/arm/mach-s3c2410/include/mach/gpio-track.h
+++ b/arch/arm/mach-s3c2410/include/mach/gpio-track.h
@@ -23,7 +23,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];
diff --git a/arch/arm/plat-samsung/pm-gpio.c b/arch/arm/plat-samsung/pm-gpio.c
index 69a4c7f..1aac746 100644
--- a/arch/arm/plat-samsung/pm-gpio.c
+++ b/arch/arm/plat-samsung/pm-gpio.c
@@ -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;
 	}
 }
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2.6.34-rc2] s3c: Fix GPIOs bank H and J not being preserved during suspend on S3C24XX
  2010-03-30  8:23 [PATCH v2.6.34-rc2] s3c: Fix GPIOs bank H and J not being preserved during suspend on S3C24XX Christian Pellegrin
@ 2010-04-23  6:33 ` Vasily Khoruzhick
  2010-05-04  7:01 ` Ben Dooks
  1 sibling, 0 replies; 5+ messages in thread
From: Vasily Khoruzhick @ 2010-04-23  6:33 UTC (permalink / raw)
  To: linux-arm-kernel

? ????????? ?? 30 ????? 2010 11:23:06 ????? Christian Pellegrin ???????:
> With this patch the platform-specific define for the last defined GPIO
> on S3C machines is used instead of a hard-coded value (which is right
> only for the s3c2410). The gpio_nr being incremented by 1 too much (look
> for the gpio_nr++ in the for instruction) is fixed too although it
> doesn't make any trouble on current S3C implementations.
> 
> Signed-off-by: Christian Pellegrin <chripell@fsfe.org>
Tested-by: Vasily Khoruzhick <anarsoul@gmail.com>

> ---
>  arch/arm/mach-s3c2410/include/mach/gpio-track.h |    2 +-
>  arch/arm/plat-samsung/pm-gpio.c                 |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-s3c2410/include/mach/gpio-track.h
> b/arch/arm/mach-s3c2410/include/mach/gpio-track.h index acb2591..6371eaa
> 100644
> --- a/arch/arm/mach-s3c2410/include/mach/gpio-track.h
> +++ b/arch/arm/mach-s3c2410/include/mach/gpio-track.h
> @@ -23,7 +23,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];
> diff --git a/arch/arm/plat-samsung/pm-gpio.c
> b/arch/arm/plat-samsung/pm-gpio.c index 69a4c7f..1aac746 100644
> --- a/arch/arm/plat-samsung/pm-gpio.c
> +++ b/arch/arm/plat-samsung/pm-gpio.c
> @@ -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;
>  	}
>  }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100423/4a85e3ff/attachment.sig>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2.6.34-rc2] s3c: Fix GPIOs bank H and J not being preserved during suspend on S3C24XX
  2010-03-30  8:23 [PATCH v2.6.34-rc2] s3c: Fix GPIOs bank H and J not being preserved during suspend on S3C24XX Christian Pellegrin
  2010-04-23  6:33 ` Vasily Khoruzhick
@ 2010-05-04  7:01 ` Ben Dooks
  2010-05-04  7:34   ` christian pellegrin
  1 sibling, 1 reply; 5+ messages in thread
From: Ben Dooks @ 2010-05-04  7:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 30, 2010 at 10:23:06AM +0200, Christian Pellegrin wrote:
> With this patch the platform-specific define for the last defined GPIO
> on S3C machines is used instead of a hard-coded value (which is right
> only for the s3c2410). The gpio_nr being incremented by 1 too much (look
> for the gpio_nr++ in the for instruction) is fixed too although it
> doesn't make any trouble on current S3C implementations.
> 
> Signed-off-by: Christian Pellegrin <chripell@fsfe.org>
> ---
>  arch/arm/mach-s3c2410/include/mach/gpio-track.h |    2 +-
>  arch/arm/plat-samsung/pm-gpio.c                 |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-s3c2410/include/mach/gpio-track.h b/arch/arm/mach-s3c2410/include/mach/gpio-track.h
> index acb2591..6371eaa 100644
> --- a/arch/arm/mach-s3c2410/include/mach/gpio-track.h
> +++ b/arch/arm/mach-s3c2410/include/mach/gpio-track.h
> @@ -23,7 +23,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];

This may get removed in the up-comming s3c2410_gpio fallout, so I'll
keep this in mind if it is needed. Series should be posted in the next
few days.

> diff --git a/arch/arm/plat-samsung/pm-gpio.c b/arch/arm/plat-samsung/pm-gpio.c
> index 69a4c7f..1aac746 100644
> --- a/arch/arm/plat-samsung/pm-gpio.c
> +++ b/arch/arm/plat-samsung/pm-gpio.c
> @@ -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;
>  	}
>  }

Hmm, think a better fix for this would be to remove the gpio_nr++ in
the for() loop.

could you send the gpio fix with the above change as a seperate patch
please?

-- 
Ben

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2.6.34-rc2] s3c: Fix GPIOs bank H and J not being preserved during suspend on S3C24XX
  2010-05-04  7:01 ` Ben Dooks
@ 2010-05-04  7:34   ` christian pellegrin
  2010-05-06  5:51     ` Ben Dooks
  0 siblings, 1 reply; 5+ messages in thread
From: christian pellegrin @ 2010-05-04  7:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, May 4, 2010 at 9:01 AM, Ben Dooks <ben-linux@fluff.org> wrote:

>
> could you send the gpio fix with the above change as a seperate patch
> please?
>

Yes, no problem, I'll just wait for the "up-comming s3c2410_gpio
fallout" patches so I can test everything with the new functions.

BTW there is a nastiness in mixing old-style s3c24xx gpios and gpiolib
ones for the J port found in the s3c2440. For the former you have to
use S3C241?_GPJ* macros in regs-gpioj.h, for the later S3C2410_GPJ().
The reason of this is the "hole" in GPIO registers address which
breaks S3C2410_GPIO_BASE. So I'm looking forward for your
reorganization of s3c24xx gpio to see if a patch is needed for this.
Right now I'm using:

diff --git a/arch/arm/mach-s3c2410/include/mach/regs-gpio.h
b/arch/arm/mach-s3c2410/include/mach/regs-gpio.h
index ebc85c6..a2eab90 100644
--- a/arch/arm/mach-s3c2410/include/mach/regs-gpio.h
+++ b/arch/arm/mach-s3c2410/include/mach/regs-gpio.h
@@ -37,7 +37,16 @@
                                  S3C2400_BASEC2H(pin)+S3C24XX_VA_GPIO)


-#define S3C2410_GPIO_BASE(pin)   ((((pin) & ~31) >> 1) + S3C24XX_VA_GPIO)
+#if !defined(__ASSEMBLER__) && defined(S3C24XX_VA_GPIO)
+static inline void *S3C2410_GPIO_BASE(unsigned int pin)
+{
+	unsigned int off = (pin & ~31) >> 1;
+
+	if ((pin & ~31) == S3C2410_GPIO_J_START)
+		off += 0x50;
+	return S3C24XX_VA_GPIO + off;
+}
+#endif
 #define S3C2410_GPIO_OFFSET(pin) ((pin) & 31)

so if I use, by mistake, S3C2410_GPJ() in s3c2410_gpio_cfgpin I don't
shoot myself in the foot. If I understand you intentions S3C241?_GPJ*
will go away after the mentioned patch series. Anyway I wait for your
reorganization of s3c gpios to resubmit these patches if needed.

Thanks,

-- 
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."

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2.6.34-rc2] s3c: Fix GPIOs bank H and J not being preserved during suspend on S3C24XX
  2010-05-04  7:34   ` christian pellegrin
@ 2010-05-06  5:51     ` Ben Dooks
  0 siblings, 0 replies; 5+ messages in thread
From: Ben Dooks @ 2010-05-06  5:51 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, May 04, 2010 at 09:34:01AM +0200, christian pellegrin wrote:
> On Tue, May 4, 2010 at 9:01 AM, Ben Dooks <ben-linux@fluff.org> wrote:
> 
> >
> > could you send the gpio fix with the above change as a seperate patch
> > please?
> >
> 
> Yes, no problem, I'll just wait for the "up-comming s3c2410_gpio
> fallout" patches so I can test everything with the new functions.
> 
> BTW there is a nastiness in mixing old-style s3c24xx gpios and gpiolib
> ones for the J port found in the s3c2440. For the former you have to
> use S3C241?_GPJ* macros in regs-gpioj.h, for the later S3C2410_GPJ().
> The reason of this is the "hole" in GPIO registers address which
> breaks S3C2410_GPIO_BASE. So I'm looking forward for your
> reorganization of s3c24xx gpio to see if a patch is needed for this.
> Right now I'm using:

Yes, one of the reasons for these changes is to remove the gpio->regaddr
mappings we've been keeping around for a while. Given the new gpiolib code
it makes sense to base all the platform specific calls off the same numbering
scheme and even use the same data structures.

I'll post a series from the following, possibly later today.

http://git.fluff.org/gitweb?p=bjdooks/linux.git;a=shortlog;h=refs/heads/for-2635/s3c24xx-gpio
 
> diff --git a/arch/arm/mach-s3c2410/include/mach/regs-gpio.h
> b/arch/arm/mach-s3c2410/include/mach/regs-gpio.h
> index ebc85c6..a2eab90 100644
> --- a/arch/arm/mach-s3c2410/include/mach/regs-gpio.h
> +++ b/arch/arm/mach-s3c2410/include/mach/regs-gpio.h
> @@ -37,7 +37,16 @@
>                                   S3C2400_BASEC2H(pin)+S3C24XX_VA_GPIO)
> 
> 
> -#define S3C2410_GPIO_BASE(pin)   ((((pin) & ~31) >> 1) + S3C24XX_VA_GPIO)
> +#if !defined(__ASSEMBLER__) && defined(S3C24XX_VA_GPIO)
> +static inline void *S3C2410_GPIO_BASE(unsigned int pin)
> +{
> +	unsigned int off = (pin & ~31) >> 1;
> +
> +	if ((pin & ~31) == S3C2410_GPIO_J_START)
> +		off += 0x50;
> +	return S3C24XX_VA_GPIO + off;
> +}
> +#endif
>  #define S3C2410_GPIO_OFFSET(pin) ((pin) & 31)
> 
> so if I use, by mistake, S3C2410_GPJ() in s3c2410_gpio_cfgpin I don't
> shoot myself in the foot. If I understand you intentions S3C241?_GPJ*
> will go away after the mentioned patch series. Anyway I wait for your
> reorganization of s3c gpios to resubmit these patches if needed.
> 
> Thanks,
> 
> -- 
> 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."
> --
> 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

-- 
-- 
Ben

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-05-06  5:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-30  8:23 [PATCH v2.6.34-rc2] s3c: Fix GPIOs bank H and J not being preserved during suspend on S3C24XX Christian Pellegrin
2010-04-23  6:33 ` Vasily Khoruzhick
2010-05-04  7:01 ` Ben Dooks
2010-05-04  7:34   ` christian pellegrin
2010-05-06  5:51     ` Ben Dooks

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).