mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-22 07:01:39 +00:00
mxc: Make gpio_get_value() use PSR
gpio_get_value() should use PSR like Linux, not DR, because DR does not always reflect the pin state, while PSR does. This is especially useful to detect a short circuit on a GPIO pin configured as output, or to read the level of a pin controlled by a non-GPIO IOMUX function. Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com> Cc: Stefano Babic <sbabic@denx.de> Acked-by: Stefano Babic <sbabic@denx.de>
This commit is contained in:
parent
5c8d14dfd9
commit
5dafa4543c
1 changed files with 1 additions and 1 deletions
|
@ -116,7 +116,7 @@ int gpio_get_value(unsigned gpio)
|
||||||
|
|
||||||
regs = (struct gpio_regs *)gpio_ports[port];
|
regs = (struct gpio_regs *)gpio_ports[port];
|
||||||
|
|
||||||
val = (readl(®s->gpio_dr) >> gpio) & 0x01;
|
val = (readl(®s->gpio_psr) >> gpio) & 0x01;
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue