From patchwork Tue Jan 9 08:30:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacky Bai X-Patchwork-Id: 10151145 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A6CD6602B3 for ; Tue, 9 Jan 2018 08:28:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96C962856E for ; Tue, 9 Jan 2018 08:28:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A9112885D; Tue, 9 Jan 2018 08:28:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BBC482856E for ; Tue, 9 Jan 2018 08:28:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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:In-Reply-To:References: List-Owner; bh=ryzWtXVKg6m5DfKb/M1GGLpQmJdlMGXbMp3ogretkgE=; b=Aq0D5YisBGAJXz CByTJzOI5odDZAs1k60f71DC7PjSUcZUo3AYQX3vRedCDzdvJ5+8b8uRoxKD/EF3sFvndVMJX2qLF 5w2z3swpUoZtsUz9BsQ4SOj1CMAn7dUmXaiN1O4vyFE6L7OYubfUHn9OIGKBL5ZGBFhcReDWfRdbM hgBOXq0EopxQ7sCMoyEY1CgS+6iL2xBjiA5kuy29O/WaI0tac/DvDMDQwawtDQ4yQ4kw44L44k03E WHZhPt5pdt+sYq555zgnfLGn0OUlTuBgKqiNUxiKTRLYc6A7GQbVhR/cpylpg0lk6NkeGSf8uUrid cL4U8OqHUiHsNrAWm7fQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eYpHB-0006Qk-6W; Tue, 09 Jan 2018 08:28:53 +0000 Received: from mail-ve1eur01on0061.outbound.protection.outlook.com ([104.47.1.61] helo=EUR01-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eYpH7-0006PQ-0i for linux-arm-kernel@lists.infradead.org; Tue, 09 Jan 2018 08:28:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=jg9s3doKLRFKx59S5AuA02y28aTN9XE3FdJOcQX4JG8=; b=LVUNu7h61UGhH/t5NsEztnAaLwFSO+hL2uZUT4ke9F8OUmh7MbwAx3K2PYYyImkqlikjXtCQegOMYnsIHlzL3lY0qwOT6JcoUc6d7eiKoKnOO3hV0zAMIWAqWEfXq2wjsVPfkm2IVQ3GAkTZcPqBfSr3+kZZ+8CcBwr2/rY+fCA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ping.bai@nxp.com; Received: from localhost.localdomain (92.121.68.129) by DB6PR04MB3109.eurprd04.prod.outlook.com (2603:10a6:6:c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Tue, 9 Jan 2018 08:28:29 +0000 From: Bai Ping To: shawnguo@kernel.org, kernel@pengutronix.de, fabio.estevam@nxp.com Subject: [PATCH] ARM: imx: Improve the soc revision calculation flow Date: Tue, 9 Jan 2018 16:30:32 +0800 Message-Id: <1515486632-18488-1-git-send-email-ping.bai@nxp.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [92.121.68.129] X-ClientProxiedBy: HK2PR0302CA0008.apcprd03.prod.outlook.com (2603:1096:202::18) To DB6PR04MB3109.eurprd04.prod.outlook.com (2603:10a6:6:c::13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 82f42d99-acaf-49cd-caba-08d5573af829 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:DB6PR04MB3109; X-Microsoft-Exchange-Diagnostics: 1; DB6PR04MB3109; 3:a5eIuDCTfJCx1KxQ49SNnlSIPFowbJoN2Bicff4gZGk4wkJz6cVW8F4a6lwbtZJ38CDheXd7Kk5CsTQz82Vcq5R+OJEECBxsfkBUgJ1RMP2sp4vWKjwhMYP/YZWoqg9YCP+FgrS4kUGzRIBTt+tXA/VXe/FhfbfiffyMAk04G9KHJZzpMcwSJ7SUkdYj8zySSSyDFjR5SePgcKPYhG9rPoYB+uYS2NQUTrx+Y39Mgn1sONgrWHyJm8JZYXV2iv7h; 25:pxhh0ztbsJ7hW7F1zJIqEmT3X2qYx5bsx30BQdby4Ynos3ZXx5eu/ZsdylX6Pd3jXboMx7NRmTidC0ReSJLNfYY6W7Vj1OwD3VSPtzwgfWLSFbD7uq5RZHC+KkPFbA5ORh/E9pNMV8/o4UE8HFWq0v/9GMAv9HVj+qaJca7jZiKtfbKEjx6JFJqE67dNu41mFKovzoyCuqVKR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GgiIIFbSJiLnAxO3DGJO+DeKTVYLvXHLfTzLQTTeS0z/Dk8YFF3/141fzUIkr2FdYXT/tRv0ByNvAHDRzZP+D7igZgrTjh4uz+CeoweRxn91Bpw7052BCpEadS0e89ro8c59nUpv1/0dD8NXIbzCtr9mdscTOPfUKAsF4/IZTr5SPaR5nOPpZogmEW8SPZr1JpZSgbubWdl78qmEEQtb/7gP/R4yrlpLkffmllIloBv X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3231023)(944501075)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041268)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(6072148)(201708071742011); SRVR:DB6PR04MB3109; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DB6PR04MB3109; X-Forefront-PRVS: 0547116B72 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(396003)(39860400002)(376002)(346002)(39380400002)(366004)(189003)(199004)(43544003)(8936002)(50466002)(81166006)(6116002)(25786009)(52116002)(2906002)(97736004)(3846002)(50226002)(6512007)(81156014)(6486002)(48376002)(51416003)(68736007)(4326008)(8676002)(36756003)(7736002)(305945005)(16526018)(105586002)(106356001)(316002)(39060400002)(478600001)(66066001)(86362001)(16586007)(6636002)(53936002)(47776003)(6506007)(6666003)(5660300001)(386003)(25903002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR04MB3109; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR04MB3109; 23:wDzj/48Zige001uzGu0IS1IzHRTYec5EP3s2tKp/Q?= =?us-ascii?Q?F295NNbKi0YvI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Wr7f6u7n7s3cdBKMrwK5xS5cQVMZiVFuVSwPZf2jDBd9C+MDIDGVnZ9bw5a3R60fEsfGbItfCce4yc1m+RMWc7FeORWSiIQPSZ+wzx SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2018 08:28:29.2563 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 82f42d99-acaf-49cd-caba-08d5573af829 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR04MB3109 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180109_002849_300305_9009F4C9 X-CRM114-Status: GOOD ( 14.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: aisheng.dong@nxp.com, linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, jacky.baip@gmail.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On our i.MX6 SOC, the DIGPROG register is used for representing the SOC ID and silicon revision. The revision has two part: MAJOR and MINOR. each is represented in 8 bits in the register. bits [15:8]: reflect the MAJOR part of the revision; bits [7:0]: reflect the MINOR part of the revision; In our linux kernel, the soc revision is represented in 8 bits. MAJOR part and MINOR each occupy 4 bits. previous method does NOT take care about the MAJOR part in DIGPROG register. So reformat the revision read from the HW to be compatible with the revision format used in kernel. Signed-off-by: Bai Ping Acked-by: Dong Aisheng --- arch/arm/mach-imx/anatop.c | 58 +++++++++++++++++----------------------------- 1 file changed, 21 insertions(+), 37 deletions(-) diff --git a/arch/arm/mach-imx/anatop.c b/arch/arm/mach-imx/anatop.c index 649a84c..170cb30 100644 --- a/arch/arm/mach-imx/anatop.c +++ b/arch/arm/mach-imx/anatop.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2013-2015 Freescale Semiconductor, Inc. + * Copyright NXP 2017. * * The code contained herein is licensed under the GNU General Public * License. You may obtain a copy of the GNU General Public License @@ -116,6 +117,8 @@ void __init imx_init_revision_from_anatop(void) unsigned int revision; u32 digprog; u16 offset = ANADIG_DIGPROG; + u16 major_part, minor_part; + np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-anatop"); anatop_base = of_iomap(np, 0); @@ -127,45 +130,26 @@ void __init imx_init_revision_from_anatop(void) digprog = readl_relaxed(anatop_base + offset); iounmap(anatop_base); - switch (digprog & 0xff) { - case 0: - /* - * For i.MX6QP, most of the code for i.MX6Q can be resued, - * so internally, we identify it as i.MX6Q Rev 2.0 - */ - if (digprog >> 8 & 0x01) - revision = IMX_CHIP_REVISION_2_0; - else - revision = IMX_CHIP_REVISION_1_0; - break; - case 1: - revision = IMX_CHIP_REVISION_1_1; - break; - case 2: - revision = IMX_CHIP_REVISION_1_2; - break; - case 3: - revision = IMX_CHIP_REVISION_1_3; - break; - case 4: - revision = IMX_CHIP_REVISION_1_4; - break; - case 5: - /* - * i.MX6DQ TO1.5 is defined as Rev 1.3 in Data Sheet, marked - * as 'D' in Part Number last character. - */ - revision = IMX_CHIP_REVISION_1_5; - break; - default: - /* - * Fail back to return raw register value instead of 0xff. - * It will be easy to know version information in SOC if it - * can't be recognized by known version. And some chip's (i.MX7D) - * digprog value match linux version format, so it needn't map - * again and we can use register value directly. + /* + * On i.MX7D digprog value match linux version format, so + * it needn't map again and we can use register value directly. + */ + if (of_device_is_compatible(np, "fsl,imx7d-anatop")) { + revision = digprog & 0xff; + } else { + + /* MAJOR: [15:8], the major silicon revison; + * MINOR: [7: 0], the minor silicon revison; + * + * please refer to the i.MX RM for the detailed + * silicon revison bit define. + * format the major part and minor part to match the + * linux kernel soc version format. */ revision = digprog & 0xff; + major_part = (digprog >> 8) & 0xf; + minor_part = digprog & 0xf; + revision = ((major_part + 1) << 4) | minor_part; } mxc_set_cpu_type(digprog >> 16 & 0xff);