Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 096E2E6ADDD for ; Sat, 23 Nov 2024 16:55:22 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9688F893FA; Sat, 23 Nov 2024 17:53:30 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1732380810; bh=Ms/tNQ8u2x1HQWho6Vn6v+8ePrA+9+gmWrNSAmJVT2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=PC7+gHiaiTDkedzaMyaa5hdbhfLKXhY9TAxpEcB98tD/ytZKfLmZOTDEq67D8Zv3m V6Ah39uAJXCXG94Ji9IOM/Kifj0YSA1YGbo8sqN4vvtDn3SCqwVX+ajNwJeucJo3ED M3LzUumHDItQprQGhnyAnwiKp13iSngwAjWC7oK5acNx/cYrxzLCf7rB4AHbGK/5Hp fOJUfIpxYtvFCm6NlgnYZFPZaouar2yvYXk8uzDFbGF63bnd463zAe9U+DLPHugDvn b63FLq6+/wahEEEhfd28QEZ3RZIDxeU+gGk5vRVp0tvMWxMmAgorwGAKm7+V9sP6+o 2JSRc8kzoBtpg== Received: from localhost.localdomain (82-131-203-244.pool.digikabel.hu [82.131.203.244]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: hs@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 661D289364; Sat, 23 Nov 2024 17:53:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1732380805; bh=Ms/tNQ8u2x1HQWho6Vn6v+8ePrA+9+gmWrNSAmJVT2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sPor6PiYhDlxIaiJnFSzqAuyp7zSlcur/WSvw+dpHCY5z3KqPk1fDvZXYmZsqy/y3 62s22KjLabqi+WgC2W1z+12UmqLijyXy3b2QvM889FiNENotKRw4TozZlVUrsxojhm 9h718CR2CjxjysfAC6X9spi4RL0OS0ohyqd+yeP4OTIdVmhvwtvF3mkJuKyB0JOu8U J96A4zUBYnkAgLNdg4a6wc5Dn7ssgUfN6AVF2aOYZ9FX85fZpaW0AFbs4Z1k5knWQ6 hUinYSjfQOZqDtWqwgFzIvPcSDHKY4cxxWPaG5dS26gHytSnJBEiaoPalzeE1aGzRv pGB2RF9OTuBZA== From: Heiko Schocher To: U-Boot Mailing List Cc: Alexander Sverdlin , Walter Schweizer , Enrico Leto , Alessandro Zini , Heiko Schocher , Anatolij Gustschin , Michal Simek , Simon Glass , Tom Rini Subject: [PATCH v4 15/20] siemens: capricorn: add HW version information to boot log Date: Sat, 23 Nov 2024 17:52:59 +0100 Message-Id: <20241123165304.100538-16-hs@denx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20241123165304.100538-1-hs@denx.de> References: <20241123165304.100538-1-hs@denx.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Alessandro Zini 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 draco board to siemens common place. From: Alessandro Zini Signed-off-by: Alessandro Zini Signed-off-by: Heiko Schocher --- (no changes since v2) Changes in v2: - add comment from Fabio add From line, as patch is from Alessandro fix typo in commit description: drace -> draco - remove CONFIG_XPL_BUILD in board_init as board_init is not called from SPL. board/siemens/capricorn/board.c | 21 ++++++++++++++++ board/siemens/common/board.h | 44 +++++++++++++++++++++++++++++++++ board/siemens/draco/board.h | 10 ++------ 3 files changed, 67 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 bf04f12c75b..decac63db3b 100644 --- a/board/siemens/capricorn/board.c +++ b/board/siemens/capricorn/board.c @@ -26,6 +26,7 @@ #include #endif #include +#include "../common/board.h" #include "../common/eeprom.h" #include "../common/factoryset.h" @@ -278,6 +279,26 @@ int checkboard(void) int board_init(void) { + 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: + 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