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.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 9B73FC43461 for ; Mon, 7 Sep 2020 19:30:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 57ABA2145D for ; Mon, 7 Sep 2020 19:30:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="UodgoEny" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728834AbgIGTaw (ORCPT ); Mon, 7 Sep 2020 15:30:52 -0400 Received: from hqnvemgate25.nvidia.com ([216.228.121.64]:9273 "EHLO hqnvemgate25.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726458AbgIGTav (ORCPT ); Mon, 7 Sep 2020 15:30:51 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 07 Sep 2020 12:29:59 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 07 Sep 2020 12:30:49 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 07 Sep 2020 12:30:49 -0700 Received: from [10.26.73.157] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 7 Sep 2020 19:30:48 +0000 Subject: Re: [PATCH 5/9] soc/tegra: fuse: Extract tegra_get_platform() To: Thierry Reding CC: , References: <20200716141856.544718-1-thierry.reding@gmail.com> <20200716141856.544718-6-thierry.reding@gmail.com> From: Jon Hunter Message-ID: <51bf8b18-495e-5675-3feb-4ba5bcae4cdc@nvidia.com> Date: Mon, 7 Sep 2020 20:30:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200716141856.544718-6-thierry.reding@gmail.com> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1599506999; bh=9C+JD0AF55GBbjW1rT2wVVNXWeMOPHXb/T9PiTFUe1Q=; h=X-PGP-Universal:Subject:To:CC:References:From:Message-ID:Date: User-Agent:MIME-Version:In-Reply-To:X-Originating-IP: X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=UodgoEny+kvOFwY9UvN1d+CC7xA36RB8ZIduCf881PhlNmMQ4berBJpubBwnEfH5F oz8Jxdj8h978P1n9D3xVlcKnao3EaP5weawYbiCIQz9TPL4r+1+viJWHRRhuJrPMi7 SP886e6VldRdBgzly425DE36GIdgH/MTViyWoVuMb8rnoGHfsEjSD0dbLa8tG3liaC X4WIjcG79j9iaamU4c2cPXiq5xm2e6XYdakeyb1sTbcdi/Wr3zsA9T8Uf3cL5lDBC4 M3h+30uUABEPm4jMZhvkjsom/UtHKUKIntT+Nk40E4MTIMGyZBcFm5sjQWMwxu2Pup j7qRhl0i8xpiA== Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org On 16/07/2020 15:18, Thierry Reding wrote: > From: Thierry Reding > > This function extracts the PRE_SI_PLATFORM field from the HIDREV > register and can be used to determine which platform the kernel runs on > (silicon, simulation, ...). Note that while only Tegra194 and later > define this field, it should be safe to call this on prior generations > as well since this field should read as 0, indicating silicon. > > Signed-off-by: Thierry Reding > --- > drivers/soc/tegra/fuse/fuse-tegra.c | 2 +- > drivers/soc/tegra/fuse/tegra-apbmisc.c | 5 +++++ > include/soc/tegra/fuse.h | 1 + > 3 files changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c > index d1f8dd0289e6..7e6b6ee59120 100644 > --- a/drivers/soc/tegra/fuse/fuse-tegra.c > +++ b/drivers/soc/tegra/fuse/fuse-tegra.c > @@ -336,7 +336,7 @@ static ssize_t platform_show(struct device *dev, struct device_attribute *attr, > * platform type is silicon and all other non-zero values indicate > * the type of simulation platform is being used. > */ > - return sprintf(buf, "%d\n", (tegra_read_chipid() >> 20) & 0xf); > + return sprintf(buf, "%d\n", tegra_get_platform()); > } > > static DEVICE_ATTR_RO(platform); > diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c > index 3cdd69d1bd4d..89f1479b4d0e 100644 > --- a/drivers/soc/tegra/fuse/tegra-apbmisc.c > +++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c > @@ -47,6 +47,11 @@ u8 tegra_get_minor_rev(void) > return (tegra_read_chipid() >> 16) & 0xf; > } > > +u8 tegra_get_platform(void) > +{ > + return (tegra_read_chipid() >> 20) & 0xf; > +} > + > 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 1097feca41ed..214908fc5581 100644 > --- a/include/soc/tegra/fuse.h > +++ b/include/soc/tegra/fuse.h > @@ -23,6 +23,7 @@ > > u32 tegra_read_chipid(void); > u8 tegra_get_chip_id(void); > +u8 tegra_get_platform(void); > > enum tegra_revision { > TEGRA_REVISION_UNKNOWN = 0, > Reviewed-by: Jon Hunter Cheers Jon -- nvpublic 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.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 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 E85B9C43461 for ; Mon, 7 Sep 2020 19:32:10 +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 9B7582145D for ; Mon, 7 Sep 2020 19:32:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ooOo/WKt"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="UodgoEny" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9B7582145D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.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:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=PGrCtzuqhQJG3SMXmFXOj4Uk1ubmqpBZR2CR0eSRqb8=; b=ooOo/WKtcd8zzrQycggMOXX+5 RJwRta/joaRI1cndPf6EKjC46V+ptxAaFgVABFq6vvMGur1or774HHCCicGA/SjvlJv6PMzRMdYO3 BgF6wIiWYySdlYygnkUsmDEya7ntH1cbh4dxgVoeQ022K9N/CX/As02tCaKwW7cieuiqUcnkyF2Hm 6250yqFkOJ4CP3imd0sblVr3Rih0ew/jxKZ1jO4h0tN8S7NcYbt3XuA5vUqYQ0xoCq4zEj0Q3v4Jt dWAZG0OhSmHkicGskWxtVeMLQhYFXRf6EX4lwPxLsZCDc81r3AphN1qSTNeDXnZA+9GNE2WfQ627m c5vdOwlgQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFMqr-0001Oc-Et; Mon, 07 Sep 2020 19:30:53 +0000 Received: from hqnvemgate25.nvidia.com ([216.228.121.64]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFMqo-0001Nm-TR for linux-arm-kernel@lists.infradead.org; Mon, 07 Sep 2020 19:30:51 +0000 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 07 Sep 2020 12:29:59 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 07 Sep 2020 12:30:49 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 07 Sep 2020 12:30:49 -0700 Received: from [10.26.73.157] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 7 Sep 2020 19:30:48 +0000 Subject: Re: [PATCH 5/9] soc/tegra: fuse: Extract tegra_get_platform() To: Thierry Reding References: <20200716141856.544718-1-thierry.reding@gmail.com> <20200716141856.544718-6-thierry.reding@gmail.com> From: Jon Hunter Message-ID: <51bf8b18-495e-5675-3feb-4ba5bcae4cdc@nvidia.com> Date: Mon, 7 Sep 2020 20:30:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200716141856.544718-6-thierry.reding@gmail.com> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) Content-Language: en-US DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1599506999; bh=9C+JD0AF55GBbjW1rT2wVVNXWeMOPHXb/T9PiTFUe1Q=; h=X-PGP-Universal:Subject:To:CC:References:From:Message-ID:Date: User-Agent:MIME-Version:In-Reply-To:X-Originating-IP: X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=UodgoEny+kvOFwY9UvN1d+CC7xA36RB8ZIduCf881PhlNmMQ4berBJpubBwnEfH5F oz8Jxdj8h978P1n9D3xVlcKnao3EaP5weawYbiCIQz9TPL4r+1+viJWHRRhuJrPMi7 SP886e6VldRdBgzly425DE36GIdgH/MTViyWoVuMb8rnoGHfsEjSD0dbLa8tG3liaC X4WIjcG79j9iaamU4c2cPXiq5xm2e6XYdakeyb1sTbcdi/Wr3zsA9T8Uf3cL5lDBC4 M3h+30uUABEPm4jMZhvkjsom/UtHKUKIntT+Nk40E4MTIMGyZBcFm5sjQWMwxu2Pup j7qRhl0i8xpiA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200907_153051_015070_8DF5A59B X-CRM114-Status: GOOD ( 23.79 ) 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 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 On 16/07/2020 15:18, Thierry Reding wrote: > From: Thierry Reding > > This function extracts the PRE_SI_PLATFORM field from the HIDREV > register and can be used to determine which platform the kernel runs on > (silicon, simulation, ...). Note that while only Tegra194 and later > define this field, it should be safe to call this on prior generations > as well since this field should read as 0, indicating silicon. > > Signed-off-by: Thierry Reding > --- > drivers/soc/tegra/fuse/fuse-tegra.c | 2 +- > drivers/soc/tegra/fuse/tegra-apbmisc.c | 5 +++++ > include/soc/tegra/fuse.h | 1 + > 3 files changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c > index d1f8dd0289e6..7e6b6ee59120 100644 > --- a/drivers/soc/tegra/fuse/fuse-tegra.c > +++ b/drivers/soc/tegra/fuse/fuse-tegra.c > @@ -336,7 +336,7 @@ static ssize_t platform_show(struct device *dev, struct device_attribute *attr, > * platform type is silicon and all other non-zero values indicate > * the type of simulation platform is being used. > */ > - return sprintf(buf, "%d\n", (tegra_read_chipid() >> 20) & 0xf); > + return sprintf(buf, "%d\n", tegra_get_platform()); > } > > static DEVICE_ATTR_RO(platform); > diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c > index 3cdd69d1bd4d..89f1479b4d0e 100644 > --- a/drivers/soc/tegra/fuse/tegra-apbmisc.c > +++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c > @@ -47,6 +47,11 @@ u8 tegra_get_minor_rev(void) > return (tegra_read_chipid() >> 16) & 0xf; > } > > +u8 tegra_get_platform(void) > +{ > + return (tegra_read_chipid() >> 20) & 0xf; > +} > + > 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 1097feca41ed..214908fc5581 100644 > --- a/include/soc/tegra/fuse.h > +++ b/include/soc/tegra/fuse.h > @@ -23,6 +23,7 @@ > > u32 tegra_read_chipid(void); > u8 tegra_get_chip_id(void); > +u8 tegra_get_platform(void); > > enum tegra_revision { > TEGRA_REVISION_UNKNOWN = 0, > Reviewed-by: Jon Hunter Cheers Jon -- nvpublic _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel