Skip to contentSkip to conversation

ARM: EXYNOS4: Fix incorrect mapping of gpio pull-up macro to register setting

PATCH New Thomas Abraham 4 participants 5 messages Jun 7, 2011 – Jun 10, 2011

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

PATCH 1/1 ARM: EXYNOS4: Fix incorrect mapping of gpio pull-up macro to register setting

The S3C_GPIO_PULL_UP macro value incorrectly maps to a reserved setting of GPIO pull up/down registers on Exynos4 platform. Fix this incorrect mapping by adding wrappers to the s3c_gpio_setpull_updown and s3c_gpio_getpull_updown functions.

---
 drivers/gpio/gpio-exynos4.c |   29 +++++++++++++++++++++++++----
 1 files changed, 25 insertions(+), 4 deletions(-)
drivers/gpio/gpio-exynos4.c +25 -4
index d54ca6a..9029835 100644
@@ -21,16 +21,37 @@
 #include <plat/gpio-cfg.h>
 #include <plat/gpio-cfg-helpers.h>
 
+int s3c_gpio_setpull_exynos4(struct s3c_gpio_chip *chip,
+				unsigned int off, s3c_gpio_pull_t pull)
+{
+	if (pull == S3C_GPIO_PULL_UP)
+		pull = 3;
+
+	return s3c_gpio_setpull_updown(chip, off, pull);
+}
+
+s3c_gpio_pull_t s3c_gpio_getpull_exynos4(struct s3c_gpio_chip *chip,
+						unsigned int off)
+{
+	s3c_gpio_pull_t pull;
+
+	pull = s3c_gpio_getpull_updown(chip, off);
+	if (pull == 3)
+		pull = S3C_GPIO_PULL_UP;
+
+	return pull;
+}
+
 static struct s3c_gpio_cfg gpio_cfg = {
 	.set_config	= s3c_gpio_setcfg_s3c64xx_4bit,
-	.set_pull	= s3c_gpio_setpull_updown,
-	.get_pull	= s3c_gpio_getpull_updown,
+	.set_pull	= s3c_gpio_setpull_exynos4,
+	.get_pull	= s3c_gpio_getpull_exynos4,
 };
 
 static struct s3c_gpio_cfg gpio_cfg_noint = {
 	.set_config	= s3c_gpio_setcfg_s3c64xx_4bit,
-	.set_pull	= s3c_gpio_setpull_updown,
-	.get_pull	= s3c_gpio_getpull_updown,
+	.set_pull	= s3c_gpio_setpull_exynos4,
+	.get_pull	= s3c_gpio_getpull_exynos4,
 };
 
 /*
Signature · 1 line
1.6.6.rc2
#1 lore raw

PATCH 1/1 ARM: EXYNOS4: Fix incorrect mapping of gpio pull-up macro to register setting

Quoted 3 lines · Thomas Abraham

The S3C_GPIO_PULL_UP macro value incorrectly maps to a reserved setting of GPIO pull up/down registers on Exynos4 platform. Fix this incorrect mapping by adding wrappers to the s3c_gpio_setpull_updown and s3c_gpio_getpull_updown functions.

Personally I like to use the variable instead of function hooking. set the correct variable at cpu dection and use it
then these thing make a single generic function and each gpio_cfg use the same thing.

Anyway it's next step. current fix the bug first.

Quoted 14 lines

---
?drivers/gpio/gpio-exynos4.c | ? 29 +++++++++++++++++++++++++---- ?1 files changed, 25 insertions(+), 4 deletions(-)

drivers/gpio/gpio-exynos4.c +0 -0
index d54ca6a..9029835 100644
@@ -21,16 +21,37 @@

?#include <plat/gpio-cfg.h>
?#include <plat/gpio-cfg-helpers.h>

drivers/gpio/gpio-exynos4.c line 31

Quoted 8 lines
drivers/gpio/gpio-exynos4.c +8 -0
+int s3c_gpio_setpull_exynos4(struct s3c_gpio_chip *chip,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? unsigned int off, s3c_gpio_pull_t pull)
+{
+ ? ? ? if (pull == S3C_GPIO_PULL_UP)
+ ? ? ? ? ? ? ? pull = 3;
+
+ ? ? ? return s3c_gpio_setpull_updown(chip, off, pull);
+}

static?

drivers/gpio/gpio-exynos4.c line 43

Quoted 12 lines
drivers/gpio/gpio-exynos4.c +12 -0
+
+s3c_gpio_pull_t s3c_gpio_getpull_exynos4(struct s3c_gpio_chip *chip,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? unsigned int off)
+{
+ ? ? ? s3c_gpio_pull_t pull;
+
+ ? ? ? pull = s3c_gpio_getpull_updown(chip, off);
+ ? ? ? if (pull == 3)
+ ? ? ? ? ? ? ? pull = S3C_GPIO_PULL_UP;
+
+ ? ? ? return pull;
+}

ditto.

Quoted 27 lines

+
?static struct s3c_gpio_cfg gpio_cfg = {
? ? ? ?.set_config ? ? = s3c_gpio_setcfg_s3c64xx_4bit,
- ? ? ? .set_pull ? ? ? = s3c_gpio_setpull_updown,
- ? ? ? .get_pull ? ? ? = s3c_gpio_getpull_updown,
+ ? ? ? .set_pull ? ? ? = s3c_gpio_setpull_exynos4,
+ ? ? ? .get_pull ? ? ? = s3c_gpio_getpull_exynos4, ?};

?static struct s3c_gpio_cfg gpio_cfg_noint = { ? ? ? ?.set_config ? ? = s3c_gpio_setcfg_s3c64xx_4bit,
- ? ? ? .set_pull ? ? ? = s3c_gpio_setpull_updown,
- ? ? ? .get_pull ? ? ? = s3c_gpio_getpull_updown,
+ ? ? ? .set_pull ? ? ? = s3c_gpio_setpull_exynos4,
+ ? ? ? .get_pull ? ? ? = s3c_gpio_getpull_exynos4, ?};

?/*
--
1.6.6.rc2

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Applied
#2 lore raw

PATCH 1/1 ARM: EXYNOS4: Fix incorrect mapping of gpio pull-up macro to register setting

Quoted 5 lines · Kyungmin Park
Quoted 3 lines · Thomas Abraham

The S3C_GPIO_PULL_UP macro value incorrectly maps to a reserved setting of GPIO pull up/down registers on Exynos4 platform. Fix this incorrect mapping by adding wrappers to the s3c_gpio_setpull_updown and s3c_gpio_getpull_updown functions.

Quoted 8 lines

Personally I like to use the variable instead of function hooking. set the correct variable at cpu dection and use it
then these thing make a single generic function and each gpio_cfg use the same thing.

Anyway it's next step. current fix the bug first.

Applied, thanks.

g.

Quoted 64 lines
Quoted 15 lines

---
?drivers/gpio/gpio-exynos4.c | ? 29 +++++++++++++++++++++++++---- ?1 files changed, 25 insertions(+), 4 deletions(-)

drivers/gpio/gpio-exynos4.c +0 -0
index d54ca6a..9029835 100644
@@ -21,16 +21,37 @@

?#include <plat/gpio-cfg.h>
?#include <plat/gpio-cfg-helpers.h>

drivers/gpio/gpio-exynos4.c line 31

Quoted 8 lines
drivers/gpio/gpio-exynos4.c +8 -0
+int s3c_gpio_setpull_exynos4(struct s3c_gpio_chip *chip,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? unsigned int off, s3c_gpio_pull_t pull)
+{
+ ? ? ? if (pull == S3C_GPIO_PULL_UP)
+ ? ? ? ? ? ? ? pull = 3;
+
+ ? ? ? return s3c_gpio_setpull_updown(chip, off, pull);
+}

static?

drivers/gpio/gpio-exynos4.c line 43

Quoted 12 lines
drivers/gpio/gpio-exynos4.c +12 -0
+
+s3c_gpio_pull_t s3c_gpio_getpull_exynos4(struct s3c_gpio_chip *chip,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? unsigned int off)
+{
+ ? ? ? s3c_gpio_pull_t pull;
+
+ ? ? ? pull = s3c_gpio_getpull_updown(chip, off);
+ ? ? ? if (pull == 3)
+ ? ? ? ? ? ? ? pull = S3C_GPIO_PULL_UP;
+
+ ? ? ? return pull;
+}

ditto.

Quoted 27 lines

+
?static struct s3c_gpio_cfg gpio_cfg = {
? ? ? ?.set_config ? ? = s3c_gpio_setcfg_s3c64xx_4bit,
- ? ? ? .set_pull ? ? ? = s3c_gpio_setpull_updown,
- ? ? ? .get_pull ? ? ? = s3c_gpio_getpull_updown,
+ ? ? ? .set_pull ? ? ? = s3c_gpio_setpull_exynos4,
+ ? ? ? .get_pull ? ? ? = s3c_gpio_getpull_exynos4, ?};

?static struct s3c_gpio_cfg gpio_cfg_noint = { ? ? ? ?.set_config ? ? = s3c_gpio_setcfg_s3c64xx_4bit,
- ? ? ? .set_pull ? ? ? = s3c_gpio_setpull_updown,
- ? ? ? .get_pull ? ? ? = s3c_gpio_getpull_updown,
+ ? ? ? .set_pull ? ? ? = s3c_gpio_setpull_exynos4,
+ ? ? ? .get_pull ? ? ? = s3c_gpio_getpull_exynos4, ?};

?/*
--
1.6.6.rc2

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#3 lore raw

PATCH 1/1 ARM: EXYNOS4: Fix incorrect mapping of gpio pull-up macro to register setting

Quoted 2 lines · Grant Likely
Quoted 1 line · Kyungmin Park

On Tue, Jun 7, 2011 at 5:34 PM, Thomas Abraham<[email protected]> wrote:

(snip)

Quoted 3 lines

Applied, thanks.

g.

Hi Grant, sorry for late response.

Could you please add my ack on this?

Quoted 1 line
Quoted 1 line
Quoted 1 line

(snip)

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#4 lore raw

PATCH 1/1 ARM: EXYNOS4: Fix incorrect mapping of gpio pull-up macro to register setting

Quoted 11 lines · Kukjin Kim
Quoted 5 lines · Grant Likely
Quoted 3 lines · Kyungmin Park

On Tue, Jun 7, 2011 at 5:34 PM, Thomas Abraham<[email protected]> ?wrote:

(snip)

Quoted 2 lines

Applied, thanks.

Quoted 7 lines
Quoted 1 line

g.

Hi Grant, sorry for late response.

Could you please add my ack on this?

Unfortunately that would require me to rebase my tree, which I'm trying really hard to avoid.

g.