mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-06-09 23:36:03 +09:00
OMAP: Add function to get state of a GPIO output
Read directly from OMAP_GPIO_DATAOUT to get the output state of the GPIO pin Signed-off-by: Joel A Fernandes <agnel.joel@gmail.com> Signed-off-by: Jason Kridner <jkridner@beagleboard.org> Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
This commit is contained in:
parent
043cfcfb7e
commit
569919d8e2
|
@ -151,6 +151,26 @@ int omap_get_gpio_datain(int gpio)
|
||||||
& (1 << get_gpio_index(gpio))) != 0;
|
& (1 << get_gpio_index(gpio))) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int omap_get_gpio_dataout(int gpio)
|
||||||
|
{
|
||||||
|
struct gpio_bank *bank;
|
||||||
|
void *reg;
|
||||||
|
|
||||||
|
if (check_gpio(gpio) < 0)
|
||||||
|
return -EINVAL;
|
||||||
|
bank = get_gpio_bank(gpio);
|
||||||
|
reg = bank->base;
|
||||||
|
switch (bank->method) {
|
||||||
|
case METHOD_GPIO_24XX:
|
||||||
|
reg += OMAP_GPIO_DATAOUT;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
return (__raw_readl(reg)
|
||||||
|
& (1 << get_gpio_index(gpio))) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void _reset_gpio(const struct gpio_bank *bank, int gpio)
|
static void _reset_gpio(const struct gpio_bank *bank, int gpio)
|
||||||
{
|
{
|
||||||
_set_gpio_direction(bank, get_gpio_index(gpio), 1);
|
_set_gpio_direction(bank, get_gpio_index(gpio), 1);
|
||||||
|
|
|
@ -61,5 +61,7 @@ void omap_set_gpio_direction(int gpio, int is_input);
|
||||||
void omap_set_gpio_dataout(int gpio, int enable);
|
void omap_set_gpio_dataout(int gpio, int enable);
|
||||||
/* Get the value of a gpio input */
|
/* Get the value of a gpio input */
|
||||||
int omap_get_gpio_datain(int gpio);
|
int omap_get_gpio_datain(int gpio);
|
||||||
|
/* Get the value of a gpio output */
|
||||||
|
int omap_get_gpio_dataout(int gpio);
|
||||||
|
|
||||||
#endif /* _GPIO_H_ */
|
#endif /* _GPIO_H_ */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user