From patchwork Thu Apr 25 17:17:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonard Crestez X-Patchwork-Id: 10917515 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D83A592A for ; Thu, 25 Apr 2019 17:17:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B7EC32074F for ; Thu, 25 Apr 2019 17:17:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A851D27F97; Thu, 25 Apr 2019 17:17:53 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 22E2A2074F for ; Thu, 25 Apr 2019 17:17:53 +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=6tQKuNdjsVxZpKpzzFhF+Q9Et9igkQGNwKY0LcLwddQ=; b=UpeW+1QYBu053q I6rvTapXZMEoG33STv08alFH9uboC/hnWLvrVlwkc9nxkcj2hBxV0StNFtcG0xQTzX4Af6EGa2nEF DvDLiLMl2Pbw/nliUME9SpSLpnQddPvVmLSyvF6c7oUXIe1u1P+LTuICokmcgyyf6IKqytX9J4ckJ g1pknJxIWD/tEeK/PpDtYCdhBkb55B2HTdehogQC7kIuRIQASeirUF9bYA8/545qd7mTEEU2+kDDO RNim8bjJ6kEzqpnUUMm/Ckyo1d4hBY4OHkTqhuxSjNkaP/cMMTs4nbbgVMvAaKpseWQt6QSP7T0B1 /2/r4j3zvqtQurGwWRyA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hJi0O-0003VQ-C2; Thu, 25 Apr 2019 17:17:52 +0000 Received: from mail-eopbgr130041.outbound.protection.outlook.com ([40.107.13.41] helo=EUR01-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hJi0F-0003Ub-54 for linux-arm-kernel@lists.infradead.org; Thu, 25 Apr 2019 17:17: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:X-MS-Exchange-SenderADCheck; bh=27WIIOKkCTRlPwbzvdBkMSkW+4wl+/5P1S0RqTCvBEg=; b=bC7M9IOqjKDorN7qmmNGSPdULfwdwV+ZocO0/DydEi35h/RdF6CKQtRbyAnsgqnRXamULRJaqIk3+JELPr94imaev+QKeEKhRu5AbcZCph45rZjS66olwiLwoN3Pl8GmyDdRLbbfMjb0LGg5MPb2gTNVA2pZopgXq7TrZfPrBT8= Received: from AM6PR04MB6440.eurprd04.prod.outlook.com (20.179.244.217) by AM6PR04MB5640.eurprd04.prod.outlook.com (20.179.0.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1835.12; Thu, 25 Apr 2019 17:17:39 +0000 Received: from AM6PR04MB6440.eurprd04.prod.outlook.com ([fe80::14c2:1e08:524c:6ff4]) by AM6PR04MB6440.eurprd04.prod.outlook.com ([fe80::14c2:1e08:524c:6ff4%2]) with mapi id 15.20.1835.010; Thu, 25 Apr 2019 17:17:39 +0000 From: Leonard Crestez To: Fabio Estevam , Shawn Guo Subject: [PATCH v2] soc/imx: Read imx8mm soc revision from anatop Thread-Topic: [PATCH v2] soc/imx: Read imx8mm soc revision from anatop Thread-Index: AQHU+4rIT/ijyv4jiUSPqAI7rf6iRA== Date: Thu, 25 Apr 2019 17:17:39 +0000 Message-ID: <95ae35956d5488989833e2287f3c6fef55ba2aa8.1556212347.git.leonard.crestez@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [212.146.100.6] x-mailer: git-send-email 2.17.1 x-clientproxiedby: VI1PR0202CA0030.eurprd02.prod.outlook.com (2603:10a6:803:14::43) To AM6PR04MB6440.eurprd04.prod.outlook.com (2603:10a6:20b:f4::25) authentication-results: spf=none (sender IP is ) smtp.mailfrom=leonard.crestez@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ca5b0008-86fc-4d1c-e81a-08d6c9a1eb02 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:AM6PR04MB5640; x-ms-traffictypediagnostic: AM6PR04MB5640: x-ms-exchange-purlcount: 1 x-microsoft-antispam-prvs: x-forefront-prvs: 0018A2705B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(366004)(376002)(136003)(346002)(396003)(199004)(189003)(486006)(476003)(256004)(66556008)(305945005)(64756008)(66946007)(3846002)(6486002)(6436002)(8936002)(5660300002)(118296001)(7736002)(6116002)(52116002)(66066001)(6506007)(386003)(8676002)(81166006)(81156014)(50226002)(478600001)(186003)(14454004)(6512007)(316002)(110136005)(44832011)(53936002)(71200400001)(71190400001)(6306002)(99286004)(68736007)(966005)(66476007)(97736004)(102836004)(66446008)(2906002)(73956011)(36756003)(4326008)(25786009)(54906003)(2616005)(86362001)(26005)(32563001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR04MB5640; H:AM6PR04MB6440.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: yKR+DEDOBMupoZsQmfbCPF+Hb6N2PYfcz31ciEW8cYVeU31TUd509erA7zNTTvpoIS/Ay2BoV8AXOcISs/bUj7ewBr1I9QJD5rWsZvB3ypxlT+3kM+4W9EFoezzh+zMWfCK7TfAIdrSKwAWctTj/e0YWwjOjHlQdFP7XUtnTWU27Ag5/TX017bk8k/HQydnGYjfD8sT/TPkYXfRUgOL2XOZ+3H9xwEEeVtXnQwVOFw07uBR5pejRQm+pNeUAyt77nre/GYkVN8tfAVVnxxkylzuaEAUZUidZDlKy6m7OTmD5VAKcnCEE39U/RtxuCie3NSZizOgZqbiWy7IFa2YMe0q+l/yaL1/utCWj5wyWoNqA1W3wbBD4EHxQx1HyaMFuXzvkMEJEdqDNYVCmEdq0XE9SG26hzns2oAKWaBSU0oc= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ca5b0008-86fc-4d1c-e81a-08d6c9a1eb02 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Apr 2019 17:17:39.1449 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB5640 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190425_101748_737044_5162DB78 X-CRM114-Status: GOOD ( 11.76 ) 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 , Abel Vesa , Anson Huang , dl-linux-imx , "kernel@pengutronix.de" , "linux-arm-kernel@lists.infradead.org" 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 Like on imx6/7 we can read version information from a register in anatop, and in the same format. Signed-off-by: Leonard Crestez Reviewed-by: Fabio Estevam --- drivers/soc/imx/soc-imx8.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) Changes since v1: * Remove redundant initialization of "rev" (Fabio) Link: https://patchwork.kernel.org/patch/10914835/ diff --git a/drivers/soc/imx/soc-imx8.c b/drivers/soc/imx/soc-imx8.c index fc6429f9170a..cd10726e64e4 100644 --- a/drivers/soc/imx/soc-imx8.c +++ b/drivers/soc/imx/soc-imx8.c @@ -14,10 +14,13 @@ #define REV_B1 0x21 #define IMX8MQ_SW_INFO_B1 0x40 #define IMX8MQ_SW_MAGIC_B1 0xff0055aa +/* Same as ANADIG_DIGPROG_IMX7D */ +#define ANADIG_DIGPROG_IMX8MM 0x800 + struct imx8_soc_data { char *name; u32 (*soc_revision)(void); }; @@ -44,17 +47,43 @@ static u32 __init imx8mq_soc_revision(void) out: of_node_put(np); return rev; } +static u32 __init imx8mm_soc_revision(void) +{ + struct device_node *np; + void __iomem *anatop_base; + u32 rev; + + np = of_find_compatible_node(NULL, NULL, "fsl,imx8mm-anatop"); + if (!np) + return 0; + + anatop_base = of_iomap(np, 0); + WARN_ON(!anatop_base); + + rev = readl_relaxed(anatop_base + ANADIG_DIGPROG_IMX8MM); + + iounmap(anatop_base); + of_node_put(np); + return rev; +} + static const struct imx8_soc_data imx8mq_soc_data = { .name = "i.MX8MQ", .soc_revision = imx8mq_soc_revision, }; +static const struct imx8_soc_data imx8mm_soc_data = { + .name = "i.MX8MM", + .soc_revision = imx8mm_soc_revision, +}; + static const struct of_device_id imx8_soc_match[] = { { .compatible = "fsl,imx8mq", .data = &imx8mq_soc_data, }, + { .compatible = "fsl,imx8mm", .data = &imx8mm_soc_data, }, { } }; #define imx8_revision(soc_rev) \ soc_rev ? \