gpio_get_value should return 0 or 1, not 1 << pin

Signed-off-by: Julien Beraud <[email protected]>
---
 drivers/gpio/altera_pio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/altera_pio.c b/drivers/gpio/altera_pio.c
index 59e30979f0..997c32e56d 100644
--- a/drivers/gpio/altera_pio.c
+++ b/drivers/gpio/altera_pio.c
@@ -56,7 +56,7 @@ static int altera_pio_get_value(struct udevice *dev, unsigned 
pin)
        struct altera_pio_platdata *plat = dev_get_platdata(dev);
        struct altera_pio_regs *const regs = plat->regs;
 
-       return readl(&regs->data) & (1 << pin);
+       return (readl(&regs->data) >> pin) & 1;
 }
 
 
-- 
2.20.1

_______________________________________________
U-Boot mailing list
[email protected]
https://lists.denx.de/listinfo/u-boot

Reply via email to