提交 5dafa454 编写于 作者: B Benoît Thébaudeau 提交者: Albert ARIBAUD

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: NBenoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Stefano Babic <sbabic@denx.de>
Acked-by: NStefano Babic <sbabic@denx.de>
上级 5c8d14df
......@@ -116,7 +116,7 @@ int gpio_get_value(unsigned gpio)
regs = (struct gpio_regs *)gpio_ports[port];
val = (readl(&regs->gpio_dr) >> gpio) & 0x01;
val = (readl(&regs->gpio_psr) >> gpio) & 0x01;
return val;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册