summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksandar Gerasimovski <[email protected]>2021-11-16 12:50:54 +0000
committerPriyanka Jain <[email protected]>2022-02-01 15:04:24 +0530
commit639ca4b7f121b50a88516717313fdff507b82cba (patch)
tree957728ecc4c58cc039a040cc63a328018f8f1671
parent8af140d8fd9e0a8bf4c37cdb4b5d74298c9b4a8d (diff)
km: qrio: add function to read PGY_PRES pin status
It is necessary to read the status of the PGY_PRES pin so that u-boot can react accordingly. Signed-off-by: Rainer Boschung <[email protected]> Signed-off-by: Aleksandar Gerasimovski <[email protected]> Reviewed-by: Priyanka Jain <[email protected]>
-rw-r--r--board/keymile/common/qrio.c13
-rw-r--r--board/keymile/common/qrio.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/board/keymile/common/qrio.c b/board/keymile/common/qrio.c
index ed5e4720343..89a9726a1fc 100644
--- a/board/keymile/common/qrio.c
+++ b/board/keymile/common/qrio.c
@@ -40,6 +40,19 @@ bool qrio_get_selftest_pin(void)
return (slftest & 1) > 0;
}
+#define BPRTH_OFF 0x04
+
+bool qrio_get_pgy_pres_pin(void)
+{
+ u8 pgy_pres;
+
+ void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
+
+ pgy_pres = in_8(qrio_base + BPRTH_OFF);
+
+ return (pgy_pres & 0x80) > 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 c341cd9cb62..2b997d90590 100644
--- a/board/keymile/common/qrio.h
+++ b/board/keymile/common/qrio.h
@@ -13,6 +13,7 @@
void show_qrio(void);
bool qrio_get_selftest_pin(void);
+bool qrio_get_pgy_pres_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);