[PATCH] pinctrl: rockchip: fix get_value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Function gpioinfo returns wrong gpio values.
In the file pinctrl.rockchip.c a wrong register offset is used by the
function rockchip_gpiov2_get_value. Also the bit-mask for this register
is wrong. Change register offset for this function to GPIO_EXT_PORT and
set the bit-mask correctly.

Signed-off-by: Kilian Strasser <kilian.strasser@xxxxxxxxxxxxxx>
---
 drivers/pinctrl/pinctrl-rockchip.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index c99074407f..66d700d324 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -226,6 +226,7 @@ enum {
 	RK_GPIOV2_DR_H	= 0x04,
 	RK_GPIOV2_DDR_L	= 0x08,
 	RK_GPIOV2_DDR_H	= 0x0c,
+	RK_GPIOV2_EXT_PORT = 0x70,
 };
 
 static struct rockchip_pin_bank *gc_to_rockchip_pinctrl(struct gpio_chip *gc)
@@ -306,12 +307,8 @@ static int rockchip_gpiov2_get_value(struct gpio_chip *gc, unsigned int gpio)
 	struct rockchip_pin_bank *bank = gc_to_rockchip_pinctrl(gc);
 	u32 mask, r;
 
-	mask = 1 << (gpio % 16);
-
-	if (gpio < 16)
-		r = readl(bank->reg_base + RK_GPIOV2_DR_L);
-	else
-		r = readl(bank->reg_base + RK_GPIOV2_DR_L);
+	mask = 1 << (gpio % 32);
+	r = readl(bank->reg_base + RK_GPIOV2_EXT_PORT);
 
 	return r & mask ? 1 : 0;
 }
-- 
2.34.1





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux