]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
km: qrio: add function to read PGY_PRES pin status
authorAleksandar Gerasimovski <aleksandar.gerasimovski@hitachienergy.com>
Tue, 16 Nov 2021 12:50:54 +0000 (12:50 +0000)
committerPriyanka Jain <priyanka.jain@nxp.com>
Tue, 1 Feb 2022 09:34:24 +0000 (15:04 +0530)
It is necessary to read the status of the PGY_PRES pin
so that u-boot can react accordingly.

Signed-off-by: Rainer Boschung <rainer.boschung@hitachienergy.com>
Signed-off-by: Aleksandar Gerasimovski <aleksandar.gerasimovski@hitachienergy.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
board/keymile/common/qrio.c
board/keymile/common/qrio.h

index ed5e472034313767092656d657a9d80474d4a582..89a9726a1fc1d5584a4b4fc1518a8b642269a72e 100644 (file)
@@ -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;
index c341cd9cb62a365a015f7e8052805c442af95262..2b997d90590ce04d450065849379346a2f4b6202 100644 (file)
@@ -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);