linux-mips
[Top] [All Lists]

[PATCH RESEND 10/17] MIPS: lantiq: fix pull gpio up resistors usage

To: Ralf Baechle <ralf@linux-mips.org>
Subject: [PATCH RESEND 10/17] MIPS: lantiq: fix pull gpio up resistors usage
From: John Crispin <blogic@openwrt.org>
Date: Wed, 11 Jan 2012 21:44:27 +0100
Cc: linux-mips@linux-mips.org, John Crispin <blogic@openwrt.org>, Matti Laakso <malaakso@elisanet.fi>
In-reply-to: <1326314674-9899-1-git-send-email-blogic@openwrt.org>
References: <1326314674-9899-1-git-send-email-blogic@openwrt.org>
Sender: linux-mips-bounce@linux-mips.org
The register that enables a gpios internal pullups was not used. This patch
makes sure the pullups are activated correctly.

Signed-off-by: Matti Laakso <malaakso@elisanet.fi>
Signed-off-by: John Crispin <blogic@openwrt.org>
---
 arch/mips/lantiq/xway/gpio.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/mips/lantiq/xway/gpio.c b/arch/mips/lantiq/xway/gpio.c
index f204f6c..14ff7c7 100644
--- a/arch/mips/lantiq/xway/gpio.c
+++ b/arch/mips/lantiq/xway/gpio.c
@@ -21,6 +21,8 @@
 #define LTQ_GPIO_ALTSEL0       0x0C
 #define LTQ_GPIO_ALTSEL1       0x10
 #define LTQ_GPIO_OD            0x14
+#define LTQ_GPIO_PUDSEL                0x1C
+#define LTQ_GPIO_PUDEN         0x20
 
 #define PINS_PER_PORT          16
 #define MAX_PORTS              3
@@ -106,6 +108,8 @@ static int ltq_gpio_direction_input(struct gpio_chip *chip, 
unsigned int offset)
 
        ltq_gpio_clearbit(ltq_gpio->membase, LTQ_GPIO_OD, offset);
        ltq_gpio_clearbit(ltq_gpio->membase, LTQ_GPIO_DIR, offset);
+       ltq_gpio_setbit(ltq_gpio->membase, LTQ_GPIO_PUDSEL, offset);
+       ltq_gpio_setbit(ltq_gpio->membase, LTQ_GPIO_PUDEN, offset);
 
        return 0;
 }
@@ -117,6 +121,8 @@ static int ltq_gpio_direction_output(struct gpio_chip *chip,
 
        ltq_gpio_setbit(ltq_gpio->membase, LTQ_GPIO_OD, offset);
        ltq_gpio_setbit(ltq_gpio->membase, LTQ_GPIO_DIR, offset);
+       ltq_gpio_clearbit(ltq_gpio->membase, LTQ_GPIO_PUDSEL, offset);
+       ltq_gpio_clearbit(ltq_gpio->membase, LTQ_GPIO_PUDEN, offset);
        ltq_gpio_set(chip, offset, value);
 
        return 0;
-- 
1.7.7.1


<Prev in Thread] Current Thread [Next in Thread>