From patchwork Thu Sep 17 10:07:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11782133 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E2B5059D for ; Thu, 17 Sep 2020 10:11:23 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ADD242087D for ; Thu, 17 Sep 2020 10:11:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="3ZjBjBhy"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Y1kc3i+c" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ADD242087D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Md4PBiaat4yF5mLVL37DHtM9We6C++PV+0+bDwUfdbc=; b=3ZjBjBhyRia63k4GvT48KrMna dvEs210KZeKjn5Fet7WUmKaEpFGYwuydOnoGTqXQhTG3f9osYzdVo4fVe7khfvdX0+Io4vSDT21tY qVa+d6Lv63lNEuNjLweV5v8UxeNMYkvmA4Cj3ZWxs0oc9MAT8YvmPEF/NeYLHnTXsuGwCfyqW78Qz gKzQoR6Wg54fXWUcyjnUSdm7+M4JW85Jr012TUHp5uBapRZ25wnc9j//5PIu85wVEXpYDGMYZaOp8 AecwA8+MQ8Ad856qFCJ9TT5cQkDVTvm5rj0e4zAYI7z3xmlQpFyNxUi3T5/u1iDKbHS+y9fLFjW98 tP71Uhy1g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIqr2-0000Pd-Bt; Thu, 17 Sep 2020 10:09:28 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIqpx-0008MM-3D for linux-arm-kernel@lists.infradead.org; Thu, 17 Sep 2020 10:08:22 +0000 Received: by mail-wr1-x444.google.com with SMTP id t10so1419472wrv.1 for ; Thu, 17 Sep 2020 03:08:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=czdPuULQn7FXaX//w2/IuNy72dljJKMueVpajrgEMGA=; b=Y1kc3i+cLkTZfUYpVNr3/Tt0RQyTgiU9SEedoROI54EgQXgxtHdTdtvff5YiCXZObX nwJkfeZX2FVl8Pbq/OHERdX67hcA56er5Otjf/w10OYzFWiD7sUaBDQDtjFKpqG1kZPq t7oM42g95hMQ+hhrfVCHML01DMqabJ/XkHtbaOQBfiHBfaKOG0KNZGjM4rJnV/sK2Z7A k54rVdPO96NJtecrHKY+AaJqycIuuyN+ryJRfMEBz2bR3pTSGJzVkTNh7hFYFRvdQ4Rx cgXvPTTlBy/L8657GEBxlDJn0Pzm2Aue9DZf48UYWFwfdE5puCfGJu7TPnS6vBIhSXb1 Uj/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=czdPuULQn7FXaX//w2/IuNy72dljJKMueVpajrgEMGA=; b=HWH9AfcH5tRfGYxyroAvY1zpv2gSdCw7ctm8NfH9PeQ2e8d6EylpfkyVcfAV6eKsZl XOKPmQXN1tr7BP0lMlwL6yvkrW92FC+sJQzbTx2l3NENl5n/d0BT2Bz2PYKgdO00P6jz PPOXo3J+rXlFNJibubh4W3lCUpClnO4FUPjRqYOZ+SD4/e5Az8K7yKyonoKCI6Lc/uwq 3AkiYmwr5VRSb85ZviabP36h+pcR08xIaValwuiQxPH2WqmgQrx71iUam43+TNnFh6gu IBodxiEA8OndhMX/kurX5aQs6rBFcSA/NB0h8FJaNXztMYXcbr5SvXgbNJUPm/x78np9 kx6g== X-Gm-Message-State: AOAM532ANkbFXlxMuYUhEG8cYx/o9cn2lfJQS7FU4vt+ZU6J3DxXV9oU RKmfFcRUIRvhmw6RVD63fslQ/dHVK/GzKQ== X-Google-Smtp-Source: ABdhPJzwajaKK7EDJ5+O0dX6h6sN+JcQShuZCuXKogyfNUjco+ykT2nWvjnmMPUymdEl2HwB0AkFtQ== X-Received: by 2002:a5d:6acf:: with SMTP id u15mr31044659wrw.221.1600337299786; Thu, 17 Sep 2020 03:08:19 -0700 (PDT) Received: from localhost ([217.111.27.204]) by smtp.gmail.com with ESMTPSA id o4sm38072371wrv.86.2020.09.17.03.08.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2020 03:08:18 -0700 (PDT) From: Thierry Reding To: Thierry Reding Subject: [PATCH v2 08/14] soc/tegra: fuse: Implement tegra_is_silicon() Date: Thu, 17 Sep 2020 12:07:46 +0200 Message-Id: <20200917100752.3516153-9-thierry.reding@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200917100752.3516153-1-thierry.reding@gmail.com> References: <20200917100752.3516153-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200917_060821_257419_06BA6C01 X-CRM114-Status: GOOD ( 15.03 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:444 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [thierry.reding[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jon Hunter Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Thierry Reding This function can be used by drivers to determine whether code is running on silicon or on a simulation platform. Signed-off-by: Thierry Reding --- Changes in v2: - fix return value for pre-Tegra194 chips and add comment explaining why we always return true for those chips drivers/soc/tegra/fuse/tegra-apbmisc.c | 19 +++++++++++++++++++ include/soc/tegra/fuse.h | 1 + 2 files changed, 20 insertions(+) diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c index 92a2d646c183..946a2d9ad117 100644 --- a/drivers/soc/tegra/fuse/tegra-apbmisc.c +++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c @@ -52,6 +52,25 @@ u8 tegra_get_platform(void) return (tegra_read_chipid() >> 20) & 0xf; } +bool tegra_is_silicon(void) +{ + switch (tegra_get_chip_id()) { + case TEGRA194: + if (tegra_get_platform() == 0) + return true; + + return false; + } + + /* + * Chips prior to Tegra194 have a different way of determining whether + * they are silicon or not. Since we never supported simulation on the + * older Tegra chips, don't bother extracting the information and just + * report that we're running on silicon. + */ + return true; +} + u32 tegra_read_straps(void) { WARN(!chipid, "Tegra ABP MISC not yet available\n"); diff --git a/include/soc/tegra/fuse.h b/include/soc/tegra/fuse.h index 214908fc5581..a9db917a1d06 100644 --- a/include/soc/tegra/fuse.h +++ b/include/soc/tegra/fuse.h @@ -24,6 +24,7 @@ u32 tegra_read_chipid(void); u8 tegra_get_chip_id(void); u8 tegra_get_platform(void); +bool tegra_is_silicon(void); enum tegra_revision { TEGRA_REVISION_UNKNOWN = 0,