[PATCH 02/18] km: qrio: add function to read SLFTEST pin status

Aleksandar Gerasimovski aleksandar.gerasimovski at hitachienergy.com
Tue Nov 16 13:48:46 CET 2021


There is a request from HW designers to use this QRIO pin for detecting
DIC26_SELFTEST status instead of a GPIO pin.
This pin is typically used during production for executing POST tests and
starting test ESW bank.

Signed-off-by: Aleksandar Gerasimovski <aleksandar.gerasimovski at hitachienergy.com>
---
 board/keymile/common/qrio.c | 13 +++++++++++++
 board/keymile/common/qrio.h |  1 +
 2 files changed, 14 insertions(+)

diff --git a/board/keymile/common/qrio.c b/board/keymile/common/qrio.c
index da51691..ed5e472 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 757bcbf..c341cd9 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);
-- 
1.8.3.1


More information about the U-Boot mailing list