diff options
Diffstat (limited to 'board/keymile/common')
-rw-r--r-- | board/keymile/common/qrio.c | 13 | ||||
-rw-r--r-- | board/keymile/common/qrio.h | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/board/keymile/common/qrio.c b/board/keymile/common/qrio.c index da516918af1..ed5e4720343 100644 --- a/board/keymile/common/qrio.c +++ b/board/keymile/common/qrio.c @@ -27,6 +27,19 @@ void show_qrio(void) (id_rev >> 8) & 0xff, id_rev & 0xff); } +#define SLFTEST_OFF 0x06 + +bool qrio_get_selftest_pin(void) +{ + u8 slftest; + + void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE; + + slftest = in_8(qrio_base + SLFTEST_OFF); + + return (slftest & 1) > 0; +} + int qrio_get_gpio(u8 port_off, u8 gpio_nr) { u32 gprt; diff --git a/board/keymile/common/qrio.h b/board/keymile/common/qrio.h index 757bcbf2f3d..c341cd9cb62 100644 --- a/board/keymile/common/qrio.h +++ b/board/keymile/common/qrio.h @@ -12,6 +12,7 @@ #define QRIO_GPIO_B 0x60 void show_qrio(void); +bool qrio_get_selftest_pin(void); int qrio_get_gpio(u8 port_off, u8 gpio_nr); void qrio_set_opendrain_gpio(u8 port_off, u8 gpio_nr, u8 val); void qrio_set_gpio(u8 port_off, u8 gpio_nr, bool value); |