From patchwork Fri Nov 27 16:28:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Agner X-Patchwork-Id: 1407317 X-Patchwork-Delegate: narmstrong@baylibre.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=agner.ch Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=agner.ch header.i=@agner.ch header.a=rsa-sha256 header.s=dkim header.b=rXL9zqGi; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CjKp05YXYz9sSf for ; Sat, 28 Nov 2020 03:29:12 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3D50582751; Fri, 27 Nov 2020 17:29:06 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=agner.ch Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=agner.ch header.i=@agner.ch header.b="rXL9zqGi"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 27A9D82757; Fri, 27 Nov 2020 17:29:04 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail.kmu-office.ch (mail.kmu-office.ch [IPv6:2a02:418:6a02::a2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5625882730 for ; Fri, 27 Nov 2020 17:29:00 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=agner.ch Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=stefan@agner.ch Received: from allenwind.lan (unknown [IPv6:2a02:169:3df5::4db]) by mail.kmu-office.ch (Postfix) with ESMTPSA id A18DA5C22CE; Fri, 27 Nov 2020 17:28:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1606494539; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=gh+wRplxNJQ2GjDdknr78tRVtOXAwPdpfW06HF9+6hI=; b=rXL9zqGinR29V8OHczgOHXNGvK+2E7pF0jaEhzuaYwQjl2QaTrlIc182SSgmx2WW7u1z8R Ob2iH/Gf8M3/grs9qCYdkr+sGM3vWZyJdDKCUXf9oO2m2fdTugrtX/5gFt8Y0BNeUondMk DL0QCGA+qwjsDMNKV3Trg4TgQO6rttI= From: Stefan Agner To: u-boot-amlogic@groups.io, narmstrong@baylibre.com, u-boot@lists.denx.de Cc: Stefan Agner , Tom Rini Subject: [PATCH 1/2] ARM: meson: isolate loading of socinfo Date: Fri, 27 Nov 2020 17:28:20 +0100 Message-Id: <537d604eeb14149783c1bb398af9f4c9a82374d0.1606492351.git.stefan@agner.ch> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Move loading of socinfo into a separate function so the value can be reused later. Signed-off-by: Stefan Agner Reviewed-by: Neil Armstrong --- arch/arm/mach-meson/board-info.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-meson/board-info.c b/arch/arm/mach-meson/board-info.c index e61d1adb10..a0bcf38f29 100644 --- a/arch/arm/mach-meson/board-info.c +++ b/arch/arm/mach-meson/board-info.c @@ -131,7 +131,7 @@ static void print_board_model(void) printf("Model: %s\n", model ? model : "Unknown"); } -int show_board_info(void) +static unsigned int get_socinfo(void) { struct regmap *regmap; int nodeoffset, ret; @@ -163,8 +163,20 @@ int show_board_info(void) return 0; } + return socinfo; +} + +int show_board_info(void) +{ + unsigned int socinfo; + /* print board information */ print_board_model(); + + socinfo = get_socinfo(); + if (!socinfo) + return 0; + printf("SoC: Amlogic Meson %s (%s) Revision %x:%x (%x:%x)\n", socinfo_to_soc_id(socinfo), socinfo_to_package_id(socinfo), From patchwork Fri Nov 27 16:28:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Agner X-Patchwork-Id: 1407318 X-Patchwork-Delegate: narmstrong@baylibre.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=agner.ch Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=agner.ch header.i=@agner.ch header.a=rsa-sha256 header.s=dkim header.b=gtl518ss; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CjKpD3Yfwz9sRR for ; Sat, 28 Nov 2020 03:29:24 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 32F5282759; Fri, 27 Nov 2020 17:29:12 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=agner.ch Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=agner.ch header.i=@agner.ch header.b="gtl518ss"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9F94282731; Fri, 27 Nov 2020 17:29:05 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail.kmu-office.ch (mail.kmu-office.ch [IPv6:2a02:418:6a02::a2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 889B482731 for ; Fri, 27 Nov 2020 17:29:00 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=agner.ch Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=stefan@agner.ch Received: from allenwind.lan (unknown [IPv6:2a02:169:3df5::4db]) by mail.kmu-office.ch (Postfix) with ESMTPSA id F338C5C1251; Fri, 27 Nov 2020 17:28:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1606494540; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kYlRYBYmkQb47yX+O3NLFV+1BITUpp3Dj9WC6ty4jUQ=; b=gtl518ssd5rWnHfv9aW8P0cfDcbvlemwVb1FGfu76EnfOyQAGytYp6XL3UEHjZ8ugIsmnU 5KJc/KiB1Ayj1kmxOH91F6Pz6R6Dr8xFZ5NR1Qh3+XtZauWyFvWIw3bAnY/aG3JfoLXyJv qDgMjM7DiEq+VRc9t6Mruwn70M4QtZ8= From: Stefan Agner To: u-boot-amlogic@groups.io, narmstrong@baylibre.com, u-boot@lists.denx.de Cc: Pascal Vizeli , Stefan Agner Subject: [PATCH 2/2] meson: Add soc_rev to environment Date: Fri, 27 Nov 2020 17:28:21 +0100 Message-Id: X-Mailer: git-send-email 2.29.2 In-Reply-To: <537d604eeb14149783c1bb398af9f4c9a82374d0.1606492351.git.stefan@agner.ch> References: <537d604eeb14149783c1bb398af9f4c9a82374d0.1606492351.git.stefan@agner.ch> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean From: Pascal Vizeli Add SoC revision to environment. This can be useful to select the correct device tree at runtime (N2/N2+). Signed-off-by: Pascal Vizeli Signed-off-by: Stefan Agner Reviewed-by: Neil Armstrong --- arch/arm/include/asm/arch-meson/boot.h | 4 ++++ arch/arm/mach-meson/board-info.c | 12 ++++++++++++ board/amlogic/odroid-n2/odroid-n2.c | 5 +++++ 3 files changed, 21 insertions(+) diff --git a/arch/arm/include/asm/arch-meson/boot.h b/arch/arm/include/asm/arch-meson/boot.h index a90fe55081..c67d12d06c 100644 --- a/arch/arm/include/asm/arch-meson/boot.h +++ b/arch/arm/include/asm/arch-meson/boot.h @@ -7,6 +7,8 @@ #ifndef __MESON_BOOT_H__ #define __MESON_BOOT_H__ +#include + /* Boot device */ #define BOOT_DEVICE_RESERVED 0 #define BOOT_DEVICE_EMMC 1 @@ -17,4 +19,6 @@ int meson_get_boot_device(void); +int meson_get_soc_rev(char *buff, size_t buff_len); + #endif /* __MESON_BOOT_H__ */ diff --git a/arch/arm/mach-meson/board-info.c b/arch/arm/mach-meson/board-info.c index a0bcf38f29..90e7dfaa3c 100644 --- a/arch/arm/mach-meson/board-info.c +++ b/arch/arm/mach-meson/board-info.c @@ -187,3 +187,15 @@ int show_board_info(void) return 0; } + +int meson_get_soc_rev(char *buff, size_t buff_len) +{ + unsigned int socinfo; + + socinfo = get_socinfo(); + if (!socinfo) + return -1; + + /* Write SoC info */ + return snprintf(buff, buff_len, "%x", socinfo_to_minor(socinfo)); +} diff --git a/board/amlogic/odroid-n2/odroid-n2.c b/board/amlogic/odroid-n2/odroid-n2.c index caf7fd6810..dc0d933a39 100644 --- a/board/amlogic/odroid-n2/odroid-n2.c +++ b/board/amlogic/odroid-n2/odroid-n2.c @@ -12,6 +12,7 @@ #include #include #include +#include #define EFUSE_MAC_OFFSET 20 #define EFUSE_MAC_SIZE 12 @@ -23,6 +24,10 @@ int misc_init_r(void) char efuse_mac_addr[EFUSE_MAC_SIZE], tmp[3]; ssize_t len; + if (IS_ENABLED(CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG) && + meson_get_soc_rev(tmp, sizeof(tmp)) > 0) + env_set("soc_rev", tmp); + meson_eth_init(PHY_INTERFACE_MODE_RGMII, 0); if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {