From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Reding Subject: [PATCH 6/9] soc/tegra: fuse: Implement tegra_is_silicon() Date: Thu, 16 Jul 2020 16:18:53 +0200 Message-ID: <20200716141856.544718-7-thierry.reding@gmail.com> References: <20200716141856.544718-1-thierry.reding@gmail.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Return-path: In-Reply-To: <20200716141856.544718-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Sender: linux-tegra-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Thierry Reding Cc: Jon Hunter , linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org List-Id: linux-tegra@vger.kernel.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 --- drivers/soc/tegra/fuse/tegra-apbmisc.c | 13 +++++++++++++ include/soc/tegra/fuse.h | 1 + 2 files changed, 14 insertions(+) diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c index 89f1479b4d0e..be6b7fc169ca 100644 --- a/drivers/soc/tegra/fuse/tegra-apbmisc.c +++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c @@ -52,6 +52,19 @@ 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; + } + + return false; +} + 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, -- 2.27.0 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 X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A42DDC433E3 for ; Thu, 16 Jul 2020 14:21:35 +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 6C3E6206F4 for ; Thu, 16 Jul 2020 14:21:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="z6UNxtrd"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WUa+a2j2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6C3E6206F4 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+linux-arm-kernel=archiver.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=zR4O/urFAWXTugo6Bjsjw7i1rW8BzNWBYi1+wro+9os=; b=z6UNxtrdNP8KQtEoytN95+hSS TY6k+mWM4VZgUEyQtJ9ixevCrLjkgLvjhC9rIBzzDTsUkasSOqno3Ki/09Um3NDw22Ztp7Ep4pi7A T4UPeB4zhGM4MlH3qe8XgTwoRPej7ZNEoLrzyebeFLynb6tbIXJk74lwkVmi8pW+1riPOQni9LTSH c22R4C6w68rgkhifFsBp1yoFipYr3/5O8zD7pTcei+Q820LWLKlid52GO2E1Xl1Vp2f8E+6JWo6ka WXiNefSQqJlVq3S4+6PgKACXDmail/4pebnanAC94Ah7LGZQeHCEMmNTPHpPk5I6LUHCzehFZWkJr rvWqMP/iw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jw4k1-0004Br-NE; Thu, 16 Jul 2020 14:20:05 +0000 Received: from mail-ed1-x544.google.com ([2a00:1450:4864:20::544]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jw4jF-0003w9-Ng for linux-arm-kernel@lists.infradead.org; Thu, 16 Jul 2020 14:19:18 +0000 Received: by mail-ed1-x544.google.com with SMTP id e22so4877503edq.8 for ; Thu, 16 Jul 2020 07:19:17 -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=1JxFS1+GP3Puv1gzomSYgZUeomAGb2SWboVlMfgMHm0=; b=WUa+a2j24vhFvbxF9nF90vTJ66wiB5M/I+EtRDm6ihsr/anOdS5rfbRZ5xoB0fu01E MfRvhW314d5OR60blxxnhR0aFp9B1vIqK24nm7O5kjcUNiX6HDsnCuM1/ZUsYi+Ht/7Q eaTNYcqNIAQReeoFkrakIY0XpgBSonNxhrpDSWPJWWZYRQZIiRErwCoVNMJpSAe+24Vn 90zzWRrKc+u4qCb6MgU2xq3tbJIY1ZKruUI7B+GcO9jVM9Ovjk92PlNmh0M4z+FFsCCw tstOvhFoaQk2pV39XKaRq2U72CeF6NOMYyVxGMSunA25O0R391uOm0UdOMdTYRkScGDA CFiQ== 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=1JxFS1+GP3Puv1gzomSYgZUeomAGb2SWboVlMfgMHm0=; b=RcA4j/6EEd77zb3nDKPmJfZpYFNKIzpBbSJ9F4T/nETQ0SGDP6eosd0F76aJgrlnpQ I3tDGp0kXh9RC4PHibITGKqNkjhWtMhrQAiB2ZAVispJaOArGUpyzU1TzRK9aQLWQCM4 2nC7hJOpKLT0sXC1zzp0pC5xifwifbKUD6QLg9sZH+zXyzqJMfl9BgoW41lRBQolx1ow JfSsIZudm6XeNwxTurOVDZ0Utt1JNXvSoqcs+xfPkr2WuivMYWKiQA4RnjrunSe26WAa 9Z92elFgQeT+TkMU1QT0OazF066T1GHfzSBNC761viglQqIXDfRZQQ07vk8fPGwcP80Y NDjw== X-Gm-Message-State: AOAM5318DtZcvxcrj/BOazT2ia51oCzM+ZLKcvx4GruOoJuq0tiZ17/j YTWGh6Ud5oqqj8QAWUlJbbk= X-Google-Smtp-Source: ABdhPJxbhHQkLSqySIi71LfXhfPFOw0h8nZ8U86OJQ+pcdcSEOwZyDks/CUFy1EVrwOkm8j14jodPA== X-Received: by 2002:a50:931e:: with SMTP id m30mr4907020eda.341.1594909156295; Thu, 16 Jul 2020 07:19:16 -0700 (PDT) Received: from localhost ([62.96.65.119]) by smtp.gmail.com with ESMTPSA id bc23sm5416893edb.90.2020.07.16.07.19.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2020 07:19:14 -0700 (PDT) From: Thierry Reding To: Thierry Reding Subject: [PATCH 6/9] soc/tegra: fuse: Implement tegra_is_silicon() Date: Thu, 16 Jul 2020 16:18:53 +0200 Message-Id: <20200716141856.544718-7-thierry.reding@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200716141856.544718-1-thierry.reding@gmail.com> References: <20200716141856.544718-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-20200716_101917_872119_E77CC74B X-CRM114-Status: GOOD ( 11.78 ) 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.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 --- drivers/soc/tegra/fuse/tegra-apbmisc.c | 13 +++++++++++++ include/soc/tegra/fuse.h | 1 + 2 files changed, 14 insertions(+) diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c index 89f1479b4d0e..be6b7fc169ca 100644 --- a/drivers/soc/tegra/fuse/tegra-apbmisc.c +++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c @@ -52,6 +52,19 @@ 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; + } + + return false; +} + 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, -- 2.27.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel