From patchwork Wed Apr 24 13:53:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonard Crestez X-Patchwork-Id: 10914835 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 54D5613B5 for ; Wed, 24 Apr 2019 13:53:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4370C285A5 for ; Wed, 24 Apr 2019 13:53:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 377E02892E; Wed, 24 Apr 2019 13:53:38 +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 A546A2892C for ; Wed, 24 Apr 2019 13:53:37 +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=mUm35cMnqAXwvPCrr0dZPmhWaNYXq4Lhl2EoA+bQDXk=; b=Ik8FewYglgqSJA KZd7329E3BtTHOdvtvrIQwnsdl2WyiiSLC5nf5f1kvRcZPrlf5KIzNOH/OwJhYJvTdMUlBpUMnXr3 CoK+l7qd5wldmEUzr4Sd0CSb/7LEFAmXS2GZrCNKxdpFT5oUFHzns/9jmJMBxGDtDXHv2VmwBNG4g FMsy96e0nJ6euTqitKu1PXzo6lp97r0R8X4EaBds+R6h7vg+2pUUTGtupCo5sj3tPRJCJxL4g6hMb RjBfPnK9ljkdBh7e8yNoM0Ve8Uz5/TrWHQfUealgzTGBZkHXvcHKCJemhVrDf8kJ1nlq78HQLSeZo rmdxADkDXGn+zJM++Gxw==; 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 1hJILA-00070M-OS; Wed, 24 Apr 2019 13:53:36 +0000 Received: from mail-eopbgr30053.outbound.protection.outlook.com ([40.107.3.53] helo=EUR03-AM5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hJIL6-0006zW-JL for linux-arm-kernel@lists.infradead.org; Wed, 24 Apr 2019 13:53:34 +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=MiH5xCh5K6Cfdl8UFneV2UO8LuJljBnU96BA7V2MyPU=; b=T+3/KwBdrEIusGiwj/X4GsZ+g5qFwD5ftK/A0moCjFSvacklaTmfPXhABaiMjMuH8cPQ2hLn0KiAVUyOrI2sC5PbN5GFOOCdwEdrhmd00337hgp4OVioaEfh+8MzdKguP3XRRJzzH92QTlJW5qep5Dy8KuVofoBqXetFo/SAzkA= Received: from AM0PR04MB6434.eurprd04.prod.outlook.com (20.179.252.215) by AM0PR04MB4612.eurprd04.prod.outlook.com (52.135.146.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1835.13; Wed, 24 Apr 2019 13:53:29 +0000 Received: from AM0PR04MB6434.eurprd04.prod.outlook.com ([fe80::a1d7:51b5:9893:dcee]) by AM0PR04MB6434.eurprd04.prod.outlook.com ([fe80::a1d7:51b5:9893:dcee%2]) with mapi id 15.20.1813.017; Wed, 24 Apr 2019 13:53:29 +0000 From: Leonard Crestez To: Shawn Guo , Lucas Stach , Abel Vesa Subject: [PATCH] soc/imx: Read imx8mm soc revision from anatop Thread-Topic: [PATCH] soc/imx: Read imx8mm soc revision from anatop Thread-Index: AQHU+qUYzGnEeqIhdUiMKYM0xDOV1g== Date: Wed, 24 Apr 2019 13:53:29 +0000 Message-ID: <8a13e322830af83b1fca13178c3fb74d762d3538.1556113858.git.leonard.crestez@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [89.37.124.34] x-mailer: git-send-email 2.17.1 x-clientproxiedby: VI1PR07CA0172.eurprd07.prod.outlook.com (2603:10a6:802:3e::20) To AM0PR04MB6434.eurprd04.prod.outlook.com (2603:10a6:208:16c::23) 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: 7aba308a-d540-4ab1-eaaf-08d6c8bc3ae9 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:AM0PR04MB4612; x-ms-traffictypediagnostic: AM0PR04MB4612: x-microsoft-antispam-prvs: x-forefront-prvs: 00179089FD x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(366004)(39860400002)(346002)(136003)(396003)(189003)(199004)(2906002)(54906003)(36756003)(25786009)(71200400001)(3846002)(71190400001)(68736007)(6116002)(5660300002)(316002)(44832011)(4326008)(66066001)(486006)(86362001)(6636002)(2616005)(6436002)(97736004)(476003)(110136005)(6512007)(50226002)(6486002)(53936002)(305945005)(186003)(118296001)(256004)(66476007)(66556008)(26005)(66446008)(66946007)(81156014)(8936002)(81166006)(102836004)(73956011)(8676002)(7736002)(52116002)(99286004)(478600001)(386003)(64756008)(6506007)(14454004)(32563001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR04MB4612; H:AM0PR04MB6434.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: YQzmzbLMHlB4UCw3CNXf/UMtYGKLdnf6ZmweSYxd7SKfTch/9VDMcHognK2t9DLHg4BwmPJjHh2g6PBpkZOzRSVgmQy7SDQSBq5XGZHuYOCW6g+p+laYvA1s7QOI/lwdHfQyPB25WXEiZT8xe/PKeNVCMPrnReFA++3EF+bdH3a2hdUtZyLf8Kqb55SHYdF9+tmA9VwDMyhoaHRw9MJdTAPWEagdx5SA6Z9CeTrpkVdoK+ZipWNqfhLCjAqxa6THhKTA7nP5akV6tKTOD8TpkQLvHs1NbgtjB6wA7ar1ykVvOOl7mFpKp2Im2a30SDHRXTKc8aU2FBPitRNkPZQUyfr+kBW0/JhXY9qmjuUGS2cGOzrA8FsyCWwm18oDPlfLekM38ww9VGdjqTOBo4rNUS9bRR8HEOJND0Eqf+KFDvM= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7aba308a-d540-4ab1-eaaf-08d6c8bc3ae9 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Apr 2019 13:53:29.1422 (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: AM0PR04MB4612 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190424_065332_742155_120B9224 X-CRM114-Status: GOOD ( 11.85 ) 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 , Anson Huang , dl-linux-imx , "kernel@pengutronix.de" , Fabio Estevam , "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(+) Based on ATF code. diff --git a/drivers/soc/imx/soc-imx8.c b/drivers/soc/imx/soc-imx8.c index fc6429f9170a..9ca43c231aa1 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 = 0; + + 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 ? \