[PATCH] pinctrl: rockchip: fix get_value
Sascha Hauer
sha at pengutronix.de
Fri Feb 10 01:50:11 PST 2023
On Thu, Feb 09, 2023 at 10:56:40AM +0100, Kilian Strasser wrote:
> 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 at wolfvision.net>
> ---
> drivers/pinctrl/pinctrl-rockchip.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
Applied, thanks
Sascha
>
> 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
>
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list