U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: U-Boot Mailing List <u-boot@lists.denx.de>
Cc: Enrico Leto <enrico.leto@siemens.com>,
	Walter Schweizer <walter.schweizer@siemens.com>,
	Alexander Sverdlin <alexander.sverdlin@siemens.com>,
	Heiko Schocher <hs@denx.de>,
	Alessandro Zini <alessandro.zini@siemens.com>,
	Anatolij Gustschin <agust@denx.de>,
	Michal Simek <michal.simek@amd.com>, Nishanth Menon <nm@ti.com>,
	Simon Glass <sjg@chromium.org>, Tom Rini <trini@konsulko.com>
Subject: [PATCH v1 17/22] siemens: capricorn: add HW version information to boot log
Date: Fri,  8 Nov 2024 06:21:38 +0100	[thread overview]
Message-ID: <20241108052143.26874-18-hs@denx.de> (raw)
In-Reply-To: <20241108052143.26874-1-hs@denx.de>

Add the HW version read directly from EEPROM.

EEPROM chip data structure is now in a .h file common to draco
and capricorn.

Therefore move out the definitions in drace board to siemens
common place.

Signed-off-by: Alessandro Zini <alessandro.zini@siemens.com>
Signed-off-by: Heiko Schocher <hs@denx.de>
---

 board/siemens/capricorn/board.c | 24 ++++++++++++++++++
 board/siemens/common/board.h    | 44 +++++++++++++++++++++++++++++++++
 board/siemens/draco/board.h     | 10 ++------
 3 files changed, 70 insertions(+), 8 deletions(-)
 create mode 100644 board/siemens/common/board.h

diff --git a/board/siemens/capricorn/board.c b/board/siemens/capricorn/board.c
index 99681d68c3f..74856aaf8f6 100644
--- a/board/siemens/capricorn/board.c
+++ b/board/siemens/capricorn/board.c
@@ -26,6 +26,7 @@
 #include <asm/arch-imx8/clock.h>
 #endif
 #include <linux/delay.h>
+#include "../common/board.h"
 #include "../common/eeprom.h"
 #include "../common/factoryset.h"
 
@@ -282,6 +283,29 @@ int checkboard(void)
 
 int board_init(void)
 {
+#ifndef CONFIG_XPL_BUILD
+	struct chip_data eeprom_data = {};
+	int ret;
+
+	ret = siemens_ee_setup();
+	if (ret) {
+		printf("'siemens_ee_setup' failed, ret: %d\n", ret);
+		goto skip;
+	}
+
+	ret = siemens_ee_read_data(SIEMENS_EE_ADDR_CHIP,
+				   (uchar *)&eeprom_data,
+				   sizeof(eeprom_data));
+	if (ret) {
+		printf("'siemens_ee_read_data' failed, ret: %d\n", ret);
+		goto skip;
+	}
+
+	printf("HW Version: %s\n", eeprom_data.shwver);
+
+skip:
+#endif
+
 	setup_fec();
 	return 0;
 }
diff --git a/board/siemens/common/board.h b/board/siemens/common/board.h
new file mode 100644
index 00000000000..db34bc78711
--- /dev/null
+++ b/board/siemens/common/board.h
@@ -0,0 +1,44 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Common board functions for siemens based boards
+ * (C) Copyright 2022 Siemens Schweiz AG
+ */
+
+#ifndef __COMMON_BOARD_H
+#define __COMMON_BOARD_H
+
+/*
+ * Chip data
+ * Offset in EEPROM: 0x120 - 0x14F
+ *
+ * -----------------------------------------------------------------------------------
+ * | Address range |                          Content                                |
+ * -----------------------------------------------------------------------------------
+ * | 0x120 - 0x123 |  Magic Number - 0x43484950 (4 byte)                             |
+ * -----------------------------------------------------------------------------------
+ * | 0x124 - 0x133 |  Device Nomenclature (15 + 1 byte)                              |
+ * -----------------------------------------------------------------------------------
+ * | 0x134 - 0x13A |  HW Version of the form "v00.00" (6 + 1 byte)                 |
+ * |               |   - First 2 digits: Layout revision (starting from 1)           |
+ * |               |   - Last 2 digits: Assembly variant revision (starting from 1)  |
+ * -----------------------------------------------------------------------------------
+ * | 0x13B - 0x13F |  Flash Size in Gibit (4 + 1 byte)                               |
+ * -----------------------------------------------------------------------------------
+ * | 0x140 - 0x144 |  Ram Size in Gibit (4 + 1 byte)                                 |
+ * -----------------------------------------------------------------------------------
+ * | 0x145 - 0x14F |  Sequence number, equals DMC-code (10 + 1 byte) [OBSOLETE]      |
+ * -----------------------------------------------------------------------------------
+ */
+
+#define MAGIC_CHIP		0x50494843
+#define EEPROM_CHIP_OFFSET	0x120
+
+struct chip_data {
+	unsigned int magic;
+	char sdevname[16];
+	char shwver[7];
+	char flash_size[5];
+	char ram_size[5];
+};
+
+#endif /* __COMMON_BOARD_H */
diff --git a/board/siemens/draco/board.h b/board/siemens/draco/board.h
index 935f340a8f2..77f35a6ab7b 100644
--- a/board/siemens/draco/board.h
+++ b/board/siemens/draco/board.h
@@ -11,6 +11,8 @@
 #ifndef _BOARD_DRACO_H_
 #define _BOARD_DRACO_H_
 
+#include "../common/board.h"
+
 #define PARGS(x)	#x , /* Parameter Name */ \
 			settings.ddr3.x, /* EEPROM Value */ \
 			ddr3_default.x, /* Default Value */ \
@@ -18,8 +20,6 @@
 
 #define PRINTARGS(y)	printf("%-20s, %8x, %8x, %4d\n", PARGS(y))
 
-#define MAGIC_CHIP	0x50494843
-
 /* Automatic generated definition */
 /* Wed, 16 Apr 2014 16:50:41 +0200 */
 /* From file: draco/ddr3-data-universal-default@303MHz-i0-ES3.txt */
@@ -43,12 +43,6 @@ struct ddr3_data {
 	char manu_marking[32];			/* "default \0" */
 };
 
-struct chip_data {
-	unsigned int  magic;
-	char sdevname[16];
-	char shwver[7];
-};
-
 struct draco_baseboard_id {
 	struct ddr3_data ddr3;
 	struct chip_data chip;
-- 
2.20.1


  parent reply	other threads:[~2024-11-08  5:24 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-08  5:21 [PATCH v1 00/22] imx8qxp: siemens board: updates / sync with mainline Heiko Schocher
2024-11-08  5:21 ` [PATCH v1 01/22] wdt: imx8qxp: add option to control external PMIC wdt via IMX8 SCU Heiko Schocher
2024-11-08  7:19   ` Stefan Roese
2024-11-08 11:47     ` Sverdlin, Alexander
2024-11-08  5:21 ` [PATCH v1 02/22] net: fec_mxc: fix probing for imx8qxp Heiko Schocher
2024-11-08  5:21 ` [PATCH v1 03/22] tools: imx8image: Improve error message Heiko Schocher
2024-11-11  8:03   ` Sverdlin, Alexander
2024-11-08  5:21 ` [PATCH v1 04/22] imx: imx_cntr_image.sh: prevent warning for missing spl Heiko Schocher
2024-11-08  5:21 ` [PATCH v1 05/22] imx8qxp: Fix build when using SPL Heiko Schocher
2024-11-08  5:21 ` [PATCH v1 06/22] siemens: capricorn: move to cxg3 reference project with deneb board Heiko Schocher
2024-11-08  5:21 ` [PATCH v1 07/22] siemens: imx8qxp-capricorn-u-boot.dtsi: fix boot Heiko Schocher
2024-11-11  8:34   ` Sverdlin, Alexander
2024-11-08  5:21 ` [PATCH v1 08/22] siemens: capricorn: use DCD_SKIP entry Heiko Schocher
2024-11-11  8:35   ` Schweizer, Walter
2024-11-11  8:49     ` Heiko Schocher
2024-11-08  5:21 ` [PATCH v1 09/22] siemens: imximage.cfg: correct comment Heiko Schocher
2024-11-11  8:41   ` Sverdlin, Alexander
2024-11-08  5:21 ` [PATCH v1 10/22] siemens: imximage.cfg: sync image names Heiko Schocher
2024-11-08  5:21 ` [PATCH v1 11/22] siemens: imx8-capricorn-u-boot.dtsi: add fec2 Heiko Schocher
2024-11-08  5:21 ` [PATCH v1 12/22] siemens: capricorn: add missing ARCH_MISC_INIT Heiko Schocher
2024-11-09 12:03   ` Fabio Estevam
2024-11-08  5:21 ` [PATCH v1 13/22] siemens: configs/capricorn_cxg3_defconfig: updates Heiko Schocher
2024-11-09 12:10   ` Fabio Estevam
2024-11-11 10:04   ` Sverdlin, Alexander
2024-11-08  5:21 ` [PATCH v1 14/22] siemens: capricorn: sync spl code with 8qxp-mek Heiko Schocher
2024-11-08  5:21 ` [PATCH v1 15/22] siemens: imx8-capricorn.dtsi: small adaptions Heiko Schocher
2024-11-09 12:03   ` Fabio Estevam
2024-11-11  5:52     ` Heiko Schocher
2024-11-11  8:25       ` Leto, Enrico
2024-11-11  8:47         ` Heiko Schocher
2024-11-11  9:24           ` Leto, Enrico
2024-11-11 12:08           ` Sverdlin, Alexander
2024-11-11 10:36       ` Sverdlin, Alexander
2024-11-08  5:21 ` [PATCH v1 16/22] siemens: capricorn: board.c fixes Heiko Schocher
2024-11-09 16:38   ` Fabio Estevam
2024-11-11  6:01     ` Heiko Schocher
2024-11-08  5:21 ` Heiko Schocher [this message]
2024-11-09 12:09   ` [PATCH v1 17/22] siemens: capricorn: add HW version information to boot log Fabio Estevam
2024-11-11  5:57     ` Heiko Schocher
2024-11-08  5:21 ` [PATCH v1 18/22] siemens: capricorn: get ram size from system controller Heiko Schocher
2024-11-08  5:21 ` [PATCH v1 19/22] siemens: capricorn: get module name from eeprom Heiko Schocher
2024-11-08  5:21 ` [PATCH v1 20/22] siemens: add ddr full memory test Heiko Schocher
2024-11-09 12:06   ` Fabio Estevam
2024-11-11  5:55     ` Heiko Schocher
2024-11-11  8:48       ` Leto, Enrico
2024-11-08  5:21 ` [PATCH v1 21/22] siemens: add ddr signal integrity test Heiko Schocher
2024-11-08  5:21 ` [PATCH v1 22/22] siemens: capricorn: update maintainers Heiko Schocher
2024-11-08 11:51   ` Sverdlin, Alexander

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=20241108052143.26874-18-hs@denx.de \
    --to=hs@denx.de \
    --cc=agust@denx.de \
    --cc=alessandro.zini@siemens.com \
    --cc=alexander.sverdlin@siemens.com \
    --cc=enrico.leto@siemens.com \
    --cc=michal.simek@amd.com \
    --cc=nm@ti.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=walter.schweizer@siemens.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox