From 7980dc9700bdeb610cfa91b4b53abe450c688b9b Mon Sep 17 00:00:00 2001 From: Ye Li Date: Fri, 28 Apr 2017 09:36:57 -0500 Subject: [PATCH] MLK-14938-22 mxc_gpio: Change to get value from DR register Currently the driver gets value from PSR register, but this register is only for input mode. For output mode, it always return 0 not the value we set for output. This patch changes to use DR register, which returns the DR value for output mode, and PSR value for input mode. Signed-off-by: Ye Li (cherry picked from commit 4afc3f90943c6b117f79b66d2cd04e64f437b0c2) (cherry picked from commit 8cca3efba0d508b2c267f8a32b302970dd05244d) --- drivers/gpio/mxc_gpio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c index a3ba4ea161..9933c35626 100644 --- a/drivers/gpio/mxc_gpio.c +++ b/drivers/gpio/mxc_gpio.c @@ -175,7 +175,7 @@ int gpio_get_value(unsigned gpio) regs = (struct gpio_regs *)gpio_ports[port]; - val = (readl(®s->gpio_psr) >> gpio) & 0x01; + val = (readl(®s->gpio_dr) >> gpio) & 0x01; RDC_SPINLOCK_DOWN(port); @@ -258,7 +258,7 @@ static void mxc_gpio_bank_set_value(struct gpio_regs *regs, int offset, static int mxc_gpio_bank_get_value(struct gpio_regs *regs, int offset) { - return (readl(®s->gpio_psr) >> offset) & 0x01; + return (readl(®s->gpio_dr) >> offset) & 0x01; } /* set GPIO pin 'gpio' as an input */ -- 2.17.1