All of lore.kernel.org
 help / color / mirror / Atom feed
From: Camelia Groza <camelia.groza@oss.nxp.com>
To: wd@denx.de, Shengzhou.Liu@nxp.com, priyanka.jain@nxp.com,
	Zhiqiang.Hou@nxp.com, u-boot@lists.denx.de
Cc: Camelia Groza <camelia.groza@nxp.com>
Subject: [PATCH 1/4] board: freescale: t208xrdb: detect the board revision letter
Date: Thu, 10 Jun 2021 15:39:36 +0300	[thread overview]
Message-ID: <0dd271b486334c9c4c330261d34cbd19438aeae6.1623327658.git.camelia.groza@nxp.com> (raw)
In-Reply-To: <cover.1623327658.git.camelia.groza@nxp.com>

From: Camelia Groza <camelia.groza@nxp.com>

Detect and print the board revision letter based on the CPLD registers.
Account for the upcoming D and E revisions.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
---
 board/freescale/t208xrdb/t208xrdb.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/board/freescale/t208xrdb/t208xrdb.c b/board/freescale/t208xrdb/t208xrdb.c
index 7ccb205c6473..47e20d15a7fe 100644
--- a/board/freescale/t208xrdb/t208xrdb.c
+++ b/board/freescale/t208xrdb/t208xrdb.c
@@ -27,14 +27,29 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+u8 get_hw_revision(void)
+{
+	u8 ver = CPLD_READ(hw_ver);
+
+	switch (ver) {
+	default:
+	case 0x1:
+		return 'C';
+	case 0x0:
+		return 'D';
+	case 0x2:
+		return 'E';
+	}
+}
+
 int checkboard(void)
 {
 	struct cpu_type *cpu = gd->arch.cpu;
 	static const char *freq[3] = {"100.00MHZ", "125.00MHz", "156.25MHZ"};
 
 	printf("Board: %sRDB, ", cpu->name);
-	printf("Board rev: 0x%02x CPLD ver: 0x%02x, boot from ",
-	       CPLD_READ(hw_ver), CPLD_READ(sw_ver));
+	printf("Board rev: %c CPLD ver: 0x%02x, boot from ",
+	       get_hw_revision(), CPLD_READ(sw_ver));
 
 #ifdef CONFIG_SDCARD
 	puts("SD/MMC\n");
-- 
2.17.1


  reply	other threads:[~2021-06-10 12:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10 12:39 [PATCH 0/4] board: freescale: add T2080RDB rev D support Camelia Groza
2021-06-10 12:39 ` Camelia Groza [this message]
2021-06-10 12:39 ` [PATCH 2/4] board: freescale: t208xrdb: add rev D support for the non-DM_ETH mode Camelia Groza
2021-06-10 12:39 ` [PATCH 3/4] board: freescale: t208xrdb: add Linux fdt fixups for rev D Camelia Groza
2021-06-10 12:39 ` [PATCH 4/4] board: freescale: t208xrdb: add a config option for rev D dts fixups Camelia Groza
2021-06-10 19:19 ` [PATCH 0/4] board: freescale: add T2080RDB rev D support Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0dd271b486334c9c4c330261d34cbd19438aeae6.1623327658.git.camelia.groza@nxp.com \
    --to=camelia.groza@oss.nxp.com \
    --cc=Shengzhou.Liu@nxp.com \
    --cc=Zhiqiang.Hou@nxp.com \
    --cc=camelia.groza@nxp.com \
    --cc=priyanka.jain@nxp.com \
    --cc=u-boot@lists.denx.de \
    --cc=wd@denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.