aboutsummaryrefslogtreecommitdiff
path: root/board/keymile
diff options
context:
space:
mode:
authorAleksandar Gerasimovski <aleksandar.gerasimovski@hitachi-powergrids.com>2021-01-13 16:20:51 +0000
committerPriyanka Jain <priyanka.jain@nxp.com>2021-02-08 14:01:17 +0530
commitd141f4b298de23019405c68ccfb2a0de059e5565 (patch)
treeb2eeb485afd2f79dc199bef7110bc6d202ddb665 /board/keymile
parentb99cc27111be8d0732c3bb7b9f5ad3814904da38 (diff)
downloadu-boot-d141f4b298de23019405c68ccfb2a0de059e5565.zip
u-boot-d141f4b298de23019405c68ccfb2a0de059e5565.tar.gz
u-boot-d141f4b298de23019405c68ccfb2a0de059e5565.tar.bz2
keymile: common: qrio: print QRIO id and revision number
Add show_qrio function to print chip id and revision information. There are already multiple QRIO chip versions available and the upcoming designs may want to show used version. Signed-off-by: Rainer Boschung <rainer.boschung@hitachi-powergrids.com> Signed-off-by: Aleksandar Gerasimovski <aleksandar.gerasimovski@hitachi-powergrids.com> Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
Diffstat (limited to 'board/keymile')
-rw-r--r--board/keymile/common/qrio.c12
-rw-r--r--board/keymile/common/qrio.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/board/keymile/common/qrio.c b/board/keymile/common/qrio.c
index d4e75f2..25937ee 100644
--- a/board/keymile/common/qrio.c
+++ b/board/keymile/common/qrio.c
@@ -11,10 +11,22 @@
#include "common.h"
#include "qrio.h"
+/* QRIO ID register offset */
+#define ID_REV_OFF 0x00
+
/* QRIO GPIO register offsets */
#define DIRECT_OFF 0x18
#define GPRT_OFF 0x1c
+void show_qrio(void)
+{
+ void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
+ u16 id_rev = in_be16(qrio_base + ID_REV_OFF);
+
+ printf("QRIO: id = %u, revision = %u\n",
+ (id_rev >> 8) & 0xff, id_rev & 0xff);
+}
+
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 a04a732..757bcbf 100644
--- a/board/keymile/common/qrio.h
+++ b/board/keymile/common/qrio.h
@@ -11,6 +11,7 @@
#define QRIO_GPIO_A 0x40
#define QRIO_GPIO_B 0x60
+void show_qrio(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);