From mboxrd@z Thu Jan 1 00:00:00 1970 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 B4707C7EE43 for ; Mon, 12 Jun 2023 19:53:15 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7E91386146; Mon, 12 Jun 2023 21:52:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.b="mnxFzbg4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9087885F29; Mon, 12 Jun 2023 21:52:23 +0200 (CEST) Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) (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 59FD585FD2 for ; Mon, 12 Jun 2023 21:52:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=detlev.casanova@collabora.com Received: from arisu.mtl.collabora.ca (mtl.collabora.ca [66.171.169.34]) (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) (Authenticated sender: detlev) by madras.collabora.co.uk (Postfix) with ESMTPSA id 649316606EBB; Mon, 12 Jun 2023 20:52:15 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1686599536; bh=zZ/ca/Grv1dZ+cicsjBNoHINhbnDTcon0xiorNDuAdE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mnxFzbg43iRGNY5nVPmvmIidPklXyUQDGs0NQoLRtFsvke3G90MkqoQvoSmvMwy94 vzu43wglctFJEX7Tavlsg7IQH8SvlfEqKnYh/8iknZuKCuPlp0AmTyXo6rSIy2EJWM v/hqk6Cn/kWdHFb3caDjjBXczjkpAWFbzqQMbnuSanlmA64Jgf6+wp8spp7aYPvm19 6mKASsDNxbJs5w7IVu+BrNyenMAXvdRPzloSYu3FF20AQJtsybv4GLDhjISNJxV1ri Clz0SxVbfd9yWxPQZWCxkWjpgdtbRkRVmyLv3KCDxiJ2+Ytq7BijYWVebG8sD8q6cN wSiaWSHeeJgUA== From: Detlev Casanova To: u-boot@lists.denx.de Cc: Marek Vasut , Hai Pham , Tam Nguyen , Detlev Casanova Subject: [PATCH v2 2/3] renesas: rcar3: Expose the board revision in sysinfo Date: Mon, 12 Jun 2023 15:51:06 -0400 Message-Id: <20230612195107.171748-3-detlev.casanova@collabora.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20230612195107.171748-1-detlev.casanova@collabora.com> References: <20230612195107.171748-1-detlev.casanova@collabora.com> 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 The board revision is needed to determine which linux device tree to load. Signed-off-by: Detlev Casanova --- .../arm/mach-rmobile/include/mach/sys_proto.h | 6 ++ drivers/sysinfo/rcar3.c | 60 +++++++++++-------- 2 files changed, 40 insertions(+), 26 deletions(-) diff --git a/arch/arm/mach-rmobile/include/mach/sys_proto.h b/arch/arm/mach-rmobile/include/mach/sys_proto.h index e020b24f7c2..1f204f06c17 100644 --- a/arch/arm/mach-rmobile/include/mach/sys_proto.h +++ b/arch/arm/mach-rmobile/include/mach/sys_proto.h @@ -22,4 +22,10 @@ #define BOARD_EBISU_4D 0xD #define BOARD_CONDOR_I 0x10 +/* + * Renesas sysinfo board revision + */ +#define RCAR_SYSINFO_REV_MAJOR SYSINFO_ID_USER +#define RCAR_SYSINFO_REV_MINOR (SYSINFO_ID_USER + 1) + #endif diff --git a/drivers/sysinfo/rcar3.c b/drivers/sysinfo/rcar3.c index b8b837341a2..3223875a99c 100644 --- a/drivers/sysinfo/rcar3.c +++ b/drivers/sysinfo/rcar3.c @@ -22,6 +22,8 @@ struct sysinfo_rcar_priv { char boardmodel[64]; u8 board_id; + u8 rev_major; + u8 rev_minor; u8 val; }; @@ -40,6 +42,12 @@ static int sysinfo_rcar_get_int(struct udevice *dev, int id, int *val) case SYSINFO_ID_BOARD_MODEL: *val = priv->board_id; return 0; + case RCAR_SYSINFO_REV_MAJOR: + *val = priv->rev_major; + return 0; + case RCAR_SYSINFO_REV_MINOR: + *val = priv->rev_minor; + return 0; default: return -EINVAL; }; @@ -74,8 +82,8 @@ static void sysinfo_rcar_parse(struct sysinfo_rcar_priv *priv) bool condor_i = false; priv->board_id = board_id; - char rev_major = '?'; - char rev_minor = '?'; + priv->rev_major = '?'; + priv->rev_minor = '?'; switch (board_id) { case BOARD_SALVATOR_XS: @@ -83,81 +91,81 @@ static void sysinfo_rcar_parse(struct sysinfo_rcar_priv *priv) fallthrough; case BOARD_SALVATOR_X: if (!(board_rev & ~1)) { /* Only rev 0 and 1 is valid */ - rev_major = '1'; - rev_minor = '0' + (board_rev & BIT(0)); + priv->rev_major = '1'; + priv->rev_minor = '0' + (board_rev & BIT(0)); } snprintf(priv->boardmodel, sizeof(priv->boardmodel), "Renesas Salvator-X%s board rev %c.%c", - salvator_xs ? "S" : "", rev_major, rev_minor); + salvator_xs ? "S" : "", priv->rev_major, priv->rev_minor); return; case BOARD_STARTER_KIT: if (!(board_rev & ~1)) { /* Only rev 0 and 1 is valid */ - rev_major = (board_rev & BIT(0)) ? '3' : '1'; - rev_minor = '0'; + priv->rev_major = (board_rev & BIT(0)) ? '3' : '1'; + priv->rev_minor = '0'; } snprintf(priv->boardmodel, sizeof(priv->boardmodel), "Renesas Starter Kit board rev %c.%c", - rev_major, rev_minor); + priv->rev_major, priv->rev_minor); return; case BOARD_STARTER_KIT_PRE: if (!(board_rev & ~3)) { /* Only rev 0..3 is valid */ - rev_major = (board_rev & BIT(1)) ? '2' : '1'; - rev_minor = (board_rev == 3) ? '1' : '0'; + priv->rev_major = (board_rev & BIT(1)) ? '2' : '1'; + priv->rev_minor = (board_rev == 3) ? '1' : '0'; } snprintf(priv->boardmodel, sizeof(priv->boardmodel), "Renesas Starter Kit Premier board rev %c.%c", - rev_major, rev_minor); + priv->rev_major, priv->rev_minor); return; case BOARD_EAGLE: if (!board_rev) { /* Only rev 0 is valid */ - rev_major = '1'; - rev_minor = '0'; + priv->rev_major = '1'; + priv->rev_minor = '0'; } snprintf(priv->boardmodel, sizeof(priv->boardmodel), "Renesas Eagle board rev %c.%c", - rev_major, rev_minor); + priv->rev_major, priv->rev_minor); return; case BOARD_EBISU_4D: ebisu_4d = true; fallthrough; case BOARD_EBISU: if (!board_rev) { /* Only rev 0 is valid */ - rev_major = '1'; - rev_minor = '0'; + priv->rev_major = '1'; + priv->rev_minor = '0'; } snprintf(priv->boardmodel, sizeof(priv->boardmodel), "Renesas Ebisu%s board rev %c.%c", - ebisu_4d ? "-4D" : "", rev_major, rev_minor); + ebisu_4d ? "-4D" : "", priv->rev_major, priv->rev_minor); return; case BOARD_DRAAK: if (!board_rev) { /* Only rev 0 is valid */ - rev_major = '1'; - rev_minor = '0'; + priv->rev_major = '1'; + priv->rev_minor = '0'; } snprintf(priv->boardmodel, sizeof(priv->boardmodel), "Renesas Draak board rev %c.%c", - rev_major, rev_minor); + priv->rev_major, priv->rev_minor); return; case BOARD_KRIEK: if (!board_rev) { /* Only rev 0 is valid */ - rev_major = '1'; - rev_minor = '0'; + priv->rev_major = '1'; + priv->rev_minor = '0'; } snprintf(priv->boardmodel, sizeof(priv->boardmodel), "Renesas Kriek board rev %c.%c", - rev_major, rev_minor); + priv->rev_major, priv->rev_minor); return; case BOARD_CONDOR_I: condor_i = true; fallthrough; case BOARD_CONDOR: if (!board_rev) { /* Only rev 0 is valid */ - rev_major = '1'; - rev_minor = '0'; + priv->rev_major = '1'; + priv->rev_minor = '0'; } snprintf(priv->boardmodel, sizeof(priv->boardmodel), "Renesas Condor%s board rev %c.%c", - condor_i ? "-I" : "", rev_major, rev_minor); + condor_i ? "-I" : "", priv->rev_major, priv->rev_minor); return; default: snprintf(priv->boardmodel, sizeof(priv->boardmodel), -- 2.39.3