From patchwork Thu Jan 16 09:36:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 11336431 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 080FC138D for ; Thu, 16 Jan 2020 09:51:22 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 D572220661 for ; Thu, 16 Jan 2020 09:51:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="tTUErRTY"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="pB6LrRy2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D572220661 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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:In-Reply-To:References: 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=30fLDjEvF7soBjcctH46tv+KkAfomJQxuBrTUrFW5to=; b=tTUErRTYbaqAMm VTBGyNjeVsIcSevmmFs/cVWIwj7lf0Q0/hSw9Aq5MMzC5+53dVi99WLDq4j7uYvZKa0OQxv7kPdlI r8fRVvaPFVuUDEk+41O1Othj4avuLt613GOPeaUSV+dSTO/seUk8a3gXa3VLc6bzOCMnjnD5rkAJX oZcppBRUXPooFMZG2FlbYcOwBdVYD37lWVwD30sz8lYwm8HFfYhutgfhQu9olVUredTfFfMogTMmV QorVjq6wm/oO4I+YhTiGE5hvxDSRa4gSQQ3fov1c+TyAg/vyh43gEksANudm6QkOl74+CDkArnSsO IdS4rCBjv+Dz+LYdYI9A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1is1o8-0001Dd-0r; Thu, 16 Jan 2020 09:51:20 +0000 Received: from mail-db5eur03on0624.outbound.protection.outlook.com ([2a01:111:f400:fe0a::624] helo=EUR03-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1is1o2-0001CW-55 for linux-arm-kernel@lists.infradead.org; Thu, 16 Jan 2020 09:51:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cmxy7hYNeJwBuFRughBtBK0JTRSOhyp7tJrT8EfvsuqztO3yRTDrzJ3m7jZ67SnJ8KTIRNWLUdUGz7GOKwIlVvwbDDvbTkL5QNBl1/7Dc/NeZeBgMWRSnPdLoiKzVYiEkbHcjzT3r7szrHejtI5kcUjFS23XzEKbzSyvp1lrNy9YaceIEEPgBU0o9rqUTxzTwSHRHcUalVIlEiHptr9srZAYFBidUs6bqm6dpuxg5f4B6BDuimuqsxP3Vl3wvl4e/+R4NyakdXuFaBMLKBcrS3wDK4ssBDpPnHZr0ZVvtEFYDLP9Lb6qJIIskmEFKniDWj5/45cWu3uHBIG5i+XXPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bDBjEp4ekHynZOedeToWfedR2/wJxwlLC2SQXexxIzs=; b=kyApLmTPFdlafhj0JLpoymvsuQsWZsTOaSr5O/sjzu6pHx0iuTatkbUpfLr9qPKx5kTejxcvfE3qsgs4OsNDoOIjl2UEbccwy949npmdUizdxQLsG3vxRJ9+lHXugRepMmenpFToVEyEFElhuT2TDdv+3BBM+fYbnT8C+wzqn8Wg7AN9BGFs/LxPBwK7fRB3H9KpZrAgc9cth/LtSf12DBZdk+JcKBVK5+zqkrdOjcoWRotQ+yS3yNKnnFTM7DxfUPlYoAScaJZPptnTSOIlAA62ObgcpJaPnIDnvGLum1fAvhUKUtQJUZD2SL3k52wbxCIN8hzk44CvW1HuyZotfA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bDBjEp4ekHynZOedeToWfedR2/wJxwlLC2SQXexxIzs=; b=pB6LrRy203Pf/igPHp7tiBmw+JVzFLcU3CAKtxSOF3lE7CzZvrJSxt2rbnZdT6XhxPKz6DhsC6of8A/jxBfTKC2Hp3029/W8nwFgs7Q8bvz4bDPlJ376pQ5ruCYxn8yR8qjeTVJ/7Q+HWqIQ/IJDCOljK2eINwJCK+FAZoZrOJA= Received: from AM0PR04MB4481.eurprd04.prod.outlook.com (52.135.147.15) by AM0PR04MB4337.eurprd04.prod.outlook.com (52.134.124.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.10; Thu, 16 Jan 2020 09:36:48 +0000 Received: from AM0PR04MB4481.eurprd04.prod.outlook.com ([fe80::91e2:17:b3f4:d422]) by AM0PR04MB4481.eurprd04.prod.outlook.com ([fe80::91e2:17:b3f4:d422%3]) with mapi id 15.20.2623.018; Thu, 16 Jan 2020 09:36:48 +0000 Received: from localhost.localdomain (119.31.174.66) by HK2PR0302CA0022.apcprd03.prod.outlook.com (2603:1096:202::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2644.6 via Frontend Transport; Thu, 16 Jan 2020 09:36:43 +0000 From: Peng Fan To: "shawnguo@kernel.org" , "s.hauer@pengutronix.de" Subject: [RFC 1/4] ARM: imx: use device_initcall for imx_soc_device_init Thread-Topic: [RFC 1/4] ARM: imx: use device_initcall for imx_soc_device_init Thread-Index: AQHVzFB5yGe49vkt3U6MybEMHs/GuA== Date: Thu, 16 Jan 2020 09:36:48 +0000 Message-ID: <1579167145-1480-2-git-send-email-peng.fan@nxp.com> References: <1579167145-1480-1-git-send-email-peng.fan@nxp.com> In-Reply-To: <1579167145-1480-1-git-send-email-peng.fan@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK2PR0302CA0022.apcprd03.prod.outlook.com (2603:1096:202::32) To AM0PR04MB4481.eurprd04.prod.outlook.com (2603:10a6:208:70::15) authentication-results: spf=none (sender IP is ) smtp.mailfrom=peng.fan@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 61d910c8-ccbe-4489-dc4f-08d79a679b79 x-ms-traffictypediagnostic: AM0PR04MB4337:|AM0PR04MB4337: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:229; x-forefront-prvs: 02843AA9E0 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(346002)(396003)(39860400002)(136003)(366004)(199004)(189003)(8936002)(86362001)(69590400006)(71200400001)(6512007)(186003)(16526019)(52116002)(956004)(44832011)(2616005)(6486002)(26005)(6506007)(478600001)(4326008)(7416002)(2906002)(81166006)(66556008)(81156014)(66476007)(66446008)(8676002)(110136005)(316002)(54906003)(5660300002)(36756003)(66946007)(64756008); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR04MB4337; H:AM0PR04MB4481.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: BCL:0; x-microsoft-antispam-message-info: /fwPvO3Fq8djF21uqcEi+nmDfUXt6dIP1x1oGNXK3RcqEZF+48qzAgwRGZ7YTIwQjpeA9Lvx03BqRDCgvwyC/qZKMCf3CcNR/YYETkpQDaSm+MXArBjphz7s3X0j5FEh1npzzJpTG8BCOph2z/5SrUUmj2gyDLkmtSO7eKxgayYT7RXzrhQ0XpuAuGwQB7zdd2/8OjIGkOHLzYY43ROOKSGN0eTP/e5TolzMcF0m/v6bXR2MMTDVytrN4+H0qdqiBHsrvWUQ4CGn276GFENxaRZU/tvxuBcqjW7OmKN2RVEEvwEh96ImVKKQzB+tHaKsxkFJOMob9D/Bit3X3w6LCenPH+UlDjnf9h1tNJNT3orLCA+piCSQv1FwOh2vC715DGDa9CjKS09tj6+p01cMHsDHWyhKf6a58OLWVBytZ/bpAMwXlzNO1nqHaOdxfmX6Usj3/kPhcO0h6ljJu1M47KUyU0uKH8XE+hptESk9MT42BCO/OZOH/KzlazhZoBkf MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 61d910c8-ccbe-4489-dc4f-08d79a679b79 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Jan 2020 09:36:48.0875 (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-CrossTenant-userprincipalname: exzDltkTiyf2S5S9HKpxHbG5J1GwM9rh2FATlXw1OFRGNcCfnnBLp7d3848X4DWC6okw83wAozjNpBa6teTodg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4337 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200116_015114_199807_C5DFF6E4 X-CRM114-Status: GOOD ( 14.66 ) X-Spam-Score: 0.8 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a01:111:f400:fe0a:0:0:0:624 listed in] [list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.0 T_SPF_PERMERROR SPF: test of record failed (permerror) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 1.0 FORGED_SPF_HELO No description available. 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-arm-kernel@lists.infradead.org" , Peng Fan , Abel Vesa , Anson Huang , "ard.biesheuvel@linaro.org" , "festevam@gmail.com" , "linux-kernel@vger.kernel.org" , dl-linux-imx , "kernel@pengutronix.de" , "git@andred.net" , Leonard Crestez , "info@metux.net" , "allison@lohutok.net" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Peng Fan This is preparation to move imx_soc_device_init to drivers/soc/imx/ There is no reason to must put dt devices under /sys/devices/soc0, they could also be under /sys/devices/platform, so we could pass NULL as parent when calling of_platform_default_populate. Following soc-imx8.c soc-imx-scu.c using device_initcall, need to change return type to int type for imx_soc_device_init. Signed-off-by: Peng Fan --- arch/arm/mach-imx/common.h | 1 - arch/arm/mach-imx/cpu.c | 9 +++++---- arch/arm/mach-imx/mach-imx6q.c | 8 +------- arch/arm/mach-imx/mach-imx6sl.c | 8 +------- arch/arm/mach-imx/mach-imx6sx.c | 8 +------- arch/arm/mach-imx/mach-imx6ul.c | 8 +------- arch/arm/mach-imx/mach-imx7d.c | 6 ------ arch/arm/mach-imx/mach-imx7ulp.c | 2 +- 8 files changed, 10 insertions(+), 40 deletions(-) diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h index 912aeceb4ff8..09e89aa7be50 100644 --- a/arch/arm/mach-imx/common.h +++ b/arch/arm/mach-imx/common.h @@ -49,7 +49,6 @@ void imx_aips_allow_unprivileged_access(const char *compat); int mxc_device_init(void); void imx_set_soc_revision(unsigned int rev); void imx_init_revision_from_anatop(void); -struct device *imx_soc_device_init(void); void imx6_enable_rbc(bool enable); void imx_gpc_check_dt(void); void imx_gpc_set_arm_power_in_lpm(bool power_off); diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c index 06f8d64b65af..2df649a84697 100644 --- a/arch/arm/mach-imx/cpu.c +++ b/arch/arm/mach-imx/cpu.c @@ -83,7 +83,7 @@ void __init imx_aips_allow_unprivileged_access( } } -struct device * __init imx_soc_device_init(void) +static int __init imx_soc_device_init(void) { struct soc_device_attribute *soc_dev_attr; const char *ocotp_compat = NULL; @@ -97,7 +97,7 @@ struct device * __init imx_soc_device_init(void) soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); if (!soc_dev_attr) - return NULL; + return PTR_ERR(soc_dev_attr); soc_dev_attr->family = "Freescale i.MX"; @@ -219,7 +219,7 @@ struct device * __init imx_soc_device_init(void) if (IS_ERR(soc_dev)) goto free_serial_number; - return soc_device_to_device(soc_dev); + return 0; free_serial_number: kfree(soc_dev_attr->serial_number); @@ -227,5 +227,6 @@ struct device * __init imx_soc_device_init(void) kfree(soc_dev_attr->revision); free_soc: kfree(soc_dev_attr); - return NULL; + return -ENOMEM; } +device_initcall(imx_soc_device_init); diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c index edd26e0ffeec..735da3311320 100644 --- a/arch/arm/mach-imx/mach-imx6q.c +++ b/arch/arm/mach-imx/mach-imx6q.c @@ -258,21 +258,15 @@ static void __init imx6q_axi_init(void) static void __init imx6q_init_machine(void) { - struct device *parent; - if (cpu_is_imx6q() && imx_get_soc_revision() == IMX_CHIP_REVISION_2_0) imx_print_silicon_rev("i.MX6QP", IMX_CHIP_REVISION_1_0); else imx_print_silicon_rev(cpu_is_imx6dl() ? "i.MX6DL" : "i.MX6Q", imx_get_soc_revision()); - parent = imx_soc_device_init(); - if (parent == NULL) - pr_warn("failed to initialize soc device\n"); - imx6q_enet_phy_init(); - of_platform_default_populate(NULL, NULL, parent); + of_platform_default_populate(NULL, NULL, NULL); imx_anatop_init(); cpu_is_imx6q() ? imx6q_pm_init() : imx6dl_pm_init(); diff --git a/arch/arm/mach-imx/mach-imx6sl.c b/arch/arm/mach-imx/mach-imx6sl.c index e00818abe54d..0f046a37dc73 100644 --- a/arch/arm/mach-imx/mach-imx6sl.c +++ b/arch/arm/mach-imx/mach-imx6sl.c @@ -46,13 +46,7 @@ static void __init imx6sl_init_late(void) static void __init imx6sl_init_machine(void) { - struct device *parent; - - parent = imx_soc_device_init(); - if (parent == NULL) - pr_warn("failed to initialize soc device\n"); - - of_platform_default_populate(NULL, NULL, parent); + of_platform_default_populate(NULL, NULL, NULL); if (cpu_is_imx6sl()) imx6sl_fec_init(); diff --git a/arch/arm/mach-imx/mach-imx6sx.c b/arch/arm/mach-imx/mach-imx6sx.c index d5310bf307ff..781e2a94fdd7 100644 --- a/arch/arm/mach-imx/mach-imx6sx.c +++ b/arch/arm/mach-imx/mach-imx6sx.c @@ -63,13 +63,7 @@ static inline void imx6sx_enet_init(void) static void __init imx6sx_init_machine(void) { - struct device *parent; - - parent = imx_soc_device_init(); - if (parent == NULL) - pr_warn("failed to initialize soc device\n"); - - of_platform_default_populate(NULL, NULL, parent); + of_platform_default_populate(NULL, NULL, NULL); imx6sx_enet_init(); imx_anatop_init(); diff --git a/arch/arm/mach-imx/mach-imx6ul.c b/arch/arm/mach-imx/mach-imx6ul.c index 311f5e4ff723..9db8e567c6b5 100644 --- a/arch/arm/mach-imx/mach-imx6ul.c +++ b/arch/arm/mach-imx/mach-imx6ul.c @@ -56,13 +56,7 @@ static inline void imx6ul_enet_init(void) static void __init imx6ul_init_machine(void) { - struct device *parent; - - parent = imx_soc_device_init(); - if (parent == NULL) - pr_warn("failed to initialize soc device\n"); - - of_platform_default_populate(NULL, NULL, parent); + of_platform_default_populate(NULL, NULL, NULL); imx6ul_enet_init(); imx_anatop_init(); imx6ul_pm_init(); diff --git a/arch/arm/mach-imx/mach-imx7d.c b/arch/arm/mach-imx/mach-imx7d.c index ebb27592a9f7..879c35929a13 100644 --- a/arch/arm/mach-imx/mach-imx7d.c +++ b/arch/arm/mach-imx/mach-imx7d.c @@ -78,12 +78,6 @@ static inline void imx7d_enet_init(void) static void __init imx7d_init_machine(void) { - struct device *parent; - - parent = imx_soc_device_init(); - if (parent == NULL) - pr_warn("failed to initialize soc device\n"); - imx_anatop_init(); imx7d_enet_init(); } diff --git a/arch/arm/mach-imx/mach-imx7ulp.c b/arch/arm/mach-imx/mach-imx7ulp.c index 11ac71aaf965..128cf4c92aab 100644 --- a/arch/arm/mach-imx/mach-imx7ulp.c +++ b/arch/arm/mach-imx/mach-imx7ulp.c @@ -57,7 +57,7 @@ static void __init imx7ulp_init_machine(void) mxc_set_cpu_type(MXC_CPU_IMX7ULP); imx7ulp_set_revision(); - of_platform_default_populate(NULL, NULL, imx_soc_device_init()); + of_platform_default_populate(NULL, NULL, NULL); } static const char *const imx7ulp_dt_compat[] __initconst = { From patchwork Thu Jan 16 09:36:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 11336435 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 44075138D for ; Thu, 16 Jan 2020 09:53:08 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 213792073A for ; Thu, 16 Jan 2020 09:53:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="FxEHxX24"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="US4K8Aps" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 213792073A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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:In-Reply-To:References: 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=hIG7vDBKJ2RympxihjT+qGCUDxcQGEYJlt/v5FEGflk=; b=FxEHxX2486DywW QWar0B9WjVIl4MvMozxH1upFQkphmql4JsN9+ddwGRzY+y306Tiw61ew3qm70WgImUs6qjOXhuWuL PgPA9eO/5GyjGuwlwIHuUlbS7WuCoC6677HoqKGDo0qmFlOsQiZ2LFCqJ23w1ix29bW6xlEm1IsxK 5T9vzNDWksq2XlcqD+G9ZVSqAOGRQOcd1jvpap+wDJTa3dxG9FwRgz1uoJJSwfGr8S4fDIgSN/R+E 2i0lpo7HszvfcEhmGeVkO5ZwZ5LmnUND/VVqhnSaUifsuD63tPUGaSo9kcskqdUmw6FylXtm9Jsl9 aAOAEjQ9VWK6LBKccGXQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1is1pn-0001vF-7O; Thu, 16 Jan 2020 09:53:03 +0000 Received: from mail-db5eur03on0601.outbound.protection.outlook.com ([2a01:111:f400:fe0a::601] helo=EUR03-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1is1ph-0001lS-6s for linux-arm-kernel@lists.infradead.org; Thu, 16 Jan 2020 09:53:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ED3HeCh895ZxaGNyYX48sqg4/4al1WELIxBqms5RJ5pCiKB43lwkP5A6PXZVecV9W6JeaHuZ75yi/QwgCMNSqHhn+nMw3A9FtACJQDPVG0v6LKNvstfxRW4e0otjLUSFpoeNPhfo7vCuKFt5wZfK3xGQ7D9YR5/Ttag0s4IY1R5Z4WS8DVV3GQfGoxOKzGhiqWCGD/ahtVOLXxxKGgfpzQP6uOruarTtilKKnHrOUOB9Ch9wlztPH5TqHhqUwaJ/DiqRI+f1T5EBfNbE77SiGm3m8UHBzRWcymVmTdjIrvSbNZu6XzEdIp3MzrAyvqb5n3Y6wnNjd61lql18OQmmiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QANZ/0sdNkmcOgoO/G0FOwceTWYpZY88EkD6FW4Y0jQ=; b=koPbCUho6cjr6DRzY/evs4TBzvKMnXBfkRyGdISMf9/BAPC///I11oCp3s4Jtprz3kDbw26cx/djiNW8HYFGEG71ZiVboayJQO2auODederiho1iEWeWUe+i+0+WeWahCxLTav48MulJKsdMzkGajanVYlECp6J7DhAE7O911r7SSBr3NPdwcej/Z2BnLQMKpMp4OG/4Hy8A6jrx2ZIt2maUaE0Xzd/pvxrn0hn7stzK9HICoUK/z6qyGuMLyWadI7Qh2nXKBJFoslyih0+V51kGQYmvSc3Bm3n5fe+If3UWWLr2uT03uZsyM72pf3rnxJ9Q/9YbHoMyaLvSvcKdyA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QANZ/0sdNkmcOgoO/G0FOwceTWYpZY88EkD6FW4Y0jQ=; b=US4K8ApssTvc69CSRITXtUI4TdccLf3aAmHGu/dHSADfe/R3/4nR/id3I/VZO+o0olHxKj5ZMcMkiOA9chVmOOT4adOZbefFf0iTlW8NRdxRXHglZDeu/63w5f1AMQnDf93oN5JqEypz1U0agkKy5Qp9YnFjF0vbn5P0LR2GSjg= Received: from AM0PR04MB4481.eurprd04.prod.outlook.com (52.135.147.15) by AM0PR04MB4337.eurprd04.prod.outlook.com (52.134.124.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.10; Thu, 16 Jan 2020 09:36:53 +0000 Received: from AM0PR04MB4481.eurprd04.prod.outlook.com ([fe80::91e2:17:b3f4:d422]) by AM0PR04MB4481.eurprd04.prod.outlook.com ([fe80::91e2:17:b3f4:d422%3]) with mapi id 15.20.2623.018; Thu, 16 Jan 2020 09:36:53 +0000 Received: from localhost.localdomain (119.31.174.66) by HK2PR0302CA0022.apcprd03.prod.outlook.com (2603:1096:202::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2644.6 via Frontend Transport; Thu, 16 Jan 2020 09:36:48 +0000 From: Peng Fan To: "shawnguo@kernel.org" , "s.hauer@pengutronix.de" Subject: [RFC 2/4] ARM: imx: cpu: drop dead code Thread-Topic: [RFC 2/4] ARM: imx: cpu: drop dead code Thread-Index: AQHVzFB8b6e6R1l3A0aB7jlzoE7ofA== Date: Thu, 16 Jan 2020 09:36:53 +0000 Message-ID: <1579167145-1480-3-git-send-email-peng.fan@nxp.com> References: <1579167145-1480-1-git-send-email-peng.fan@nxp.com> In-Reply-To: <1579167145-1480-1-git-send-email-peng.fan@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK2PR0302CA0022.apcprd03.prod.outlook.com (2603:1096:202::32) To AM0PR04MB4481.eurprd04.prod.outlook.com (2603:10a6:208:70::15) authentication-results: spf=none (sender IP is ) smtp.mailfrom=peng.fan@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 6931b8e7-9be1-4282-c67c-08d79a679e8a x-ms-traffictypediagnostic: AM0PR04MB4337:|AM0PR04MB4337: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2958; x-forefront-prvs: 02843AA9E0 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(346002)(396003)(39860400002)(136003)(366004)(199004)(189003)(8936002)(86362001)(69590400006)(71200400001)(6512007)(186003)(16526019)(52116002)(956004)(44832011)(2616005)(6486002)(26005)(6506007)(478600001)(6666004)(4326008)(7416002)(2906002)(81166006)(66556008)(81156014)(66476007)(66446008)(8676002)(110136005)(316002)(54906003)(5660300002)(36756003)(66946007)(64756008); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR04MB4337; H:AM0PR04MB4481.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: BCL:0; x-microsoft-antispam-message-info: cUAIbWBpTUPOoCVa4qLpaSnl+U2PXtf+OP0X7HgYG1x7jMtXyVcMEr3VAzT8MArwVLOJHQKM2A/WkAyitttVEOOxXiIi96W/GKM/W1wtA3eQ7tsFQwN4l6hOSWgxrmFOZmZ7oInN0RjfFXrAiunzu3hccm6rUrEUNOFJtnPQZT5JDue25T3YtksGl1tWqZENlJFPCD6o3A5WOaPSebGE+oJDR7uSErLEr7TZiAvMorlGQ3gI848BxkJlhYsX7IdQwVuLCSS5z3xEuQNI2d8DuH7DjMqlFnnDMsBzhXiUdgvo10B5bye4UQ9AnhFNb5Up8UCTbn4d/hOmdfa+IF4I19tzpvdiTKTEBAvCQCZs/Ph8kLCqp52ipzv3jG6rIWl0+SZ1syxilEWZfl3lgOohfGI6QYuy43YbScCkM/J2pa+52HHSPRXS4Rc5axkoamXVqbj9Sh1W5cjuSSa8rkQXtB8SHLPNA5cyGlAiZKm5gWJzng19xeJD0iG9PLGKDl7R MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6931b8e7-9be1-4282-c67c-08d79a679e8a X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Jan 2020 09:36:53.1806 (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-CrossTenant-userprincipalname: DUHME6ycwLYmsYqZogSTzwgJqr/Zuv3raYf7mJuQexhsXIXEfufuE+6MLPXTjr/iwWA/kzEuc0TPzsBOM0GTFA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4337 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200116_015257_257081_AD99A51B X-CRM114-Status: UNSURE ( 9.66 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.8 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a01:111:f400:fe0a:0:0:0:601 listed in] [list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.0 T_SPF_PERMERROR SPF: test of record failed (permerror) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 1.0 FORGED_SPF_HELO No description available. 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-arm-kernel@lists.infradead.org" , Peng Fan , Abel Vesa , Anson Huang , "ard.biesheuvel@linaro.org" , "festevam@gmail.com" , "linux-kernel@vger.kernel.org" , dl-linux-imx , "kernel@pengutronix.de" , "git@andred.net" , Leonard Crestez , "info@metux.net" , "allison@lohutok.net" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Peng Fan imx_soc_device_init is only called by i.MX6Q/SL/SX/UL/7D/7ULP. So we could drop the switch case for i.MX1/2/3/5 which are dead code that never be executed. Signed-off-by: Peng Fan --- arch/arm/mach-imx/cpu.c | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c index 2df649a84697..0302cb66134b 100644 --- a/arch/arm/mach-imx/cpu.c +++ b/arch/arm/mach-imx/cpu.c @@ -108,30 +108,6 @@ static int __init imx_soc_device_init(void) goto free_soc; switch (__mxc_cpu_type) { - case MXC_CPU_MX1: - soc_id = "i.MX1"; - break; - case MXC_CPU_MX21: - soc_id = "i.MX21"; - break; - case MXC_CPU_MX25: - soc_id = "i.MX25"; - break; - case MXC_CPU_MX27: - soc_id = "i.MX27"; - break; - case MXC_CPU_MX31: - soc_id = "i.MX31"; - break; - case MXC_CPU_MX35: - soc_id = "i.MX35"; - break; - case MXC_CPU_MX51: - soc_id = "i.MX51"; - break; - case MXC_CPU_MX53: - soc_id = "i.MX53"; - break; case MXC_CPU_IMX6SL: ocotp_compat = "fsl,imx6sl-ocotp"; soc_id = "i.MX6SL"; From patchwork Thu Jan 16 09:36:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 11336411 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5CA1517EA for ; Thu, 16 Jan 2020 09:37:08 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 387F9207E0 for ; Thu, 16 Jan 2020 09:37:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="TOfRCYoi"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="E6bi9Nty" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 387F9207E0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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:In-Reply-To:References: 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=MbEVcgF2fqxsX4S9ItQrnagjA0fl2klsnOhh+qsOwg4=; b=TOfRCYoiptR80H IGUJ0gtqr5BFMesLt4F3PX4qHQOKpJNyK8b+8SoLAI3aIw99HfzDfcUkS70csqNQ+sKQTE7RQyg3Q J0O6vzeRxJFKiMX7Dge4nAf3mlkN1OY/qNDhWrksEqmdxEi8Y+f+vcpAeV89NBWz/GIaHTRVTgMCc HXBf8dW3Xa75dMdqN/W6vSJOjJ0poMO6UHk18zqMx/ThHcMTkBpc5/PFz2cHuSC6y/rsqyIw6e+Dl mrLCXRjFtkXZFc0lM3z4e/bNJEYF3TRb6ZrTWmpFy2cHwmjkHXxwMeqFw4pw9VF6ajhBYYSj8VrLH 8lQPE+Gqmp38pR9vLf7g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1is1aM-0002zO-Ap; Thu, 16 Jan 2020 09:37:06 +0000 Received: from mail-db8eur05on2076.outbound.protection.outlook.com ([40.107.20.76] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1is1aG-0002xr-73 for linux-arm-kernel@lists.infradead.org; Thu, 16 Jan 2020 09:37:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VaP1V70G5VYMR4CeOcIMM1CiDWyA4RpXVEamDnWW9Wfxk+phPqplNWSnUSpgOkeS+Cse3uRvsPA8896ioC32hmjzYrT0cl1apl9qB90unA3lMlkoqHa/phu4kYZ5hDLgfpqRXCGuev74Cs/9d8jNuIDbIiVpSAthjGCEkVk5+90G6TQ7oFlta6agZs32DK0EHJXPKWZjBcanFArhSJecWW0Q44zXzbEEEVDpsSeuSHeWsDWJWPkYyYyciMv+Jg6rDMUQXjd/ht22swNPYMtxrW/COSy1YSGpOmx7e7VC+iCT3bufXhmtQBlIAEof8tgZ7gTPSxEcAAzanx4K1aPzew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jlJoconKYcpTSaPKk3IB2Ja8D3tpGGcnW8ypi+qaPVQ=; b=oObD36QkZj6AQh4bH58kgsdPUgQgx3DkXMCE0HYgbYfq+7V/92HOPaJ3iecFECIxec+Ghk9oeDlAXVUP7SeyLF3eSDPNAiYgWDrn0Jkna+EwjfDtUOIfF7Ewc3h3gmybQASTDu2inTk/GOv2nlXtfwm/GZxXY7tTreX1kEjEiVdJfRtu+vxwyBPeNNqKZtmnZBt3i66oBUG4P+qwK3u5rvNQA3EbL5PvpFziw3PKBJHA2boPFv7+JgO4xxhZWhrNyttfyJ0A9R7AOBSxtGTbvhmm1w1BfiebqM/xG3IpNQwJ++DTJvN3yWjRbeGIvJjIotkLqA0WLTRZ8AN4fuSIzg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jlJoconKYcpTSaPKk3IB2Ja8D3tpGGcnW8ypi+qaPVQ=; b=E6bi9Ntycb33x0JenSDvEjIOVVswUkZyKxjR78eUzBmo1V5FNbwMfjwBoe3BN4QHKa/sJWKYYzJMHlYjG5hsFKT8sE4Pr49DK/ShughgS0oyqlxL/s5fLUKDkvKYduWrU5CSYS+y4AXd6a8djqx4ZnMZ1vhHHqlCnCHP+ly1SUo= Received: from AM0PR04MB4481.eurprd04.prod.outlook.com (52.135.147.15) by AM0PR04MB4337.eurprd04.prod.outlook.com (52.134.124.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.10; Thu, 16 Jan 2020 09:36:57 +0000 Received: from AM0PR04MB4481.eurprd04.prod.outlook.com ([fe80::91e2:17:b3f4:d422]) by AM0PR04MB4481.eurprd04.prod.outlook.com ([fe80::91e2:17:b3f4:d422%3]) with mapi id 15.20.2623.018; Thu, 16 Jan 2020 09:36:57 +0000 Received: from localhost.localdomain (119.31.174.66) by HK2PR0302CA0022.apcprd03.prod.outlook.com (2603:1096:202::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2644.6 via Frontend Transport; Thu, 16 Jan 2020 09:36:53 +0000 From: Peng Fan To: "shawnguo@kernel.org" , "s.hauer@pengutronix.de" Subject: [RFC 3/4] ARM: imx: move cpu definitions into a header Thread-Topic: [RFC 3/4] ARM: imx: move cpu definitions into a header Thread-Index: AQHVzFB+G3o1/8PlD0Sf3//E6frY/A== Date: Thu, 16 Jan 2020 09:36:57 +0000 Message-ID: <1579167145-1480-4-git-send-email-peng.fan@nxp.com> References: <1579167145-1480-1-git-send-email-peng.fan@nxp.com> In-Reply-To: <1579167145-1480-1-git-send-email-peng.fan@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK2PR0302CA0022.apcprd03.prod.outlook.com (2603:1096:202::32) To AM0PR04MB4481.eurprd04.prod.outlook.com (2603:10a6:208:70::15) authentication-results: spf=none (sender IP is ) smtp.mailfrom=peng.fan@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 6e41dfa4-2b21-48ac-ad83-08d79a67a14e x-ms-traffictypediagnostic: AM0PR04MB4337:|AM0PR04MB4337: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4941; x-forefront-prvs: 02843AA9E0 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(346002)(396003)(39860400002)(136003)(366004)(199004)(189003)(8936002)(86362001)(69590400006)(71200400001)(6512007)(186003)(16526019)(52116002)(956004)(44832011)(2616005)(6486002)(26005)(6506007)(478600001)(4326008)(7416002)(2906002)(81166006)(66556008)(81156014)(66476007)(66446008)(8676002)(110136005)(316002)(54906003)(5660300002)(36756003)(66946007)(64756008); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR04MB4337; H:AM0PR04MB4481.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: BCL:0; x-microsoft-antispam-message-info: UjHwxXi9OLfgWozZHI+n2W0hWQu+9DZZsngWID2s5UoGUaEXqC6HwO4iLwR6sop1pFhllhvxJjltE6ee9/Q53ud9e3yIBRgo6DyWSPm/UHqjSiiTYXzxvRzqckk1zOeaHN0wE62E5KMZvOyoMWvPvVyveraziW6YwwCo2sdYEdzv0/huwD40FoZGOST83upuL9emayNan5Oi6WE7ThQd6rx2UdmocDX7E8vtav69S/8VAY5ux8DgP2pB/FU93uMDi0RQP+kckG3og6s3Y53ZUuuKdkQ2EWcdPcr0EfBDTZBmugljB5D7T7NCf75QOcH9BHPnpHqC/xD6aWFf3ewBsV3N41bR2yN+CN5jyVHIwMCyfg/BxaX20XL+9SiXM1Ssll+SlE2557wqmx7aaSwqyWAaKcj9M1cj8GfvNHJqAagNJZecqqEx+XdooOULmJUyafFRBpFmQVFtYhI+eGxKaNjCqU2yFhBNuolqyFBjNzlxdbImoS2CRl+Y/Ogu+DV/ MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6e41dfa4-2b21-48ac-ad83-08d79a67a14e X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Jan 2020 09:36:57.6330 (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-CrossTenant-userprincipalname: ALl+g3ALjXIZXavXA4/xVKtWHaW3K6dEEchDGfBdg6g7u+BvLVU9vm2FLfwQAT1MORqhyIo/LaiMQR88Dsue8w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4337 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200116_013700_251981_34740039 X-CRM114-Status: GOOD ( 13.11 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [40.107.20.76 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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-arm-kernel@lists.infradead.org" , Peng Fan , Abel Vesa , Anson Huang , "ard.biesheuvel@linaro.org" , "festevam@gmail.com" , "linux-kernel@vger.kernel.org" , dl-linux-imx , "kernel@pengutronix.de" , "git@andred.net" , Leonard Crestez , "info@metux.net" , "allison@lohutok.net" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Peng Fan The soc device register code will be moved to drivers/soc/imx/, the code needs the cpu type definitions. So let's move the cpu type definitions to a header. Signed-off-by: Peng Fan --- arch/arm/mach-imx/mxc.h | 22 +--------------------- include/soc/imx/cpu.h | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 21 deletions(-) create mode 100644 include/soc/imx/cpu.h diff --git a/arch/arm/mach-imx/mxc.h b/arch/arm/mach-imx/mxc.h index 2bfd2d59b4a6..fe2d0f5abfcc 100644 --- a/arch/arm/mach-imx/mxc.h +++ b/arch/arm/mach-imx/mxc.h @@ -8,35 +8,15 @@ #define __ASM_ARCH_MXC_H__ #include +#include #ifndef __ASM_ARCH_MXC_HARDWARE_H__ #error "Do not include directly." #endif -#define MXC_CPU_MX1 1 -#define MXC_CPU_MX21 21 -#define MXC_CPU_MX25 25 -#define MXC_CPU_MX27 27 -#define MXC_CPU_MX31 31 -#define MXC_CPU_MX35 35 -#define MXC_CPU_MX51 51 -#define MXC_CPU_MX53 53 -#define MXC_CPU_IMX6SL 0x60 -#define MXC_CPU_IMX6DL 0x61 -#define MXC_CPU_IMX6SX 0x62 -#define MXC_CPU_IMX6Q 0x63 -#define MXC_CPU_IMX6UL 0x64 -#define MXC_CPU_IMX6ULL 0x65 -/* virtual cpu id for i.mx6ulz */ -#define MXC_CPU_IMX6ULZ 0x6b -#define MXC_CPU_IMX6SLL 0x67 -#define MXC_CPU_IMX7D 0x72 -#define MXC_CPU_IMX7ULP 0xff - #define IMX_DDR_TYPE_LPDDR2 1 #ifndef __ASSEMBLY__ -extern unsigned int __mxc_cpu_type; #ifdef CONFIG_SOC_IMX6SL static inline bool cpu_is_imx6sl(void) diff --git a/include/soc/imx/cpu.h b/include/soc/imx/cpu.h new file mode 100644 index 000000000000..0669fc08a501 --- /dev/null +++ b/include/soc/imx/cpu.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef __IMX_CPU_H__ +#define __IMX_CPU_H__ + +#define MXC_CPU_MX1 1 +#define MXC_CPU_MX21 21 +#define MXC_CPU_MX25 25 +#define MXC_CPU_MX27 27 +#define MXC_CPU_MX31 31 +#define MXC_CPU_MX35 35 +#define MXC_CPU_MX51 51 +#define MXC_CPU_MX53 53 +#define MXC_CPU_IMX6SL 0x60 +#define MXC_CPU_IMX6DL 0x61 +#define MXC_CPU_IMX6SX 0x62 +#define MXC_CPU_IMX6Q 0x63 +#define MXC_CPU_IMX6UL 0x64 +#define MXC_CPU_IMX6ULL 0x65 +/* virtual cpu id for i.mx6ulz */ +#define MXC_CPU_IMX6ULZ 0x6b +#define MXC_CPU_IMX6SLL 0x67 +#define MXC_CPU_IMX7D 0x72 +#define MXC_CPU_IMX7ULP 0xff + +#ifndef __ASSEMBLY__ +extern unsigned int __mxc_cpu_type; +#endif + +#endif From patchwork Thu Jan 16 09:37:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 11336415 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C236992A for ; Thu, 16 Jan 2020 09:37:21 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 956D52075B for ; Thu, 16 Jan 2020 09:37:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="W6csG6Z4"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="fJVGKGya" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 956D52075B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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:In-Reply-To:References: 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=/VMwANQGt9rF8S97zxUvJS/sHkk1sxiJHZK6KgnBwmA=; b=W6csG6Z4pZvAto hzIge5cESnVYouZLxb1mVHjECNA/Q8uCgzi8D1D367ET972oTEqkTxskawczHH0u/XdJ4+/E02NNW n8adIH1ADzqGhJysT7C47Fam2vWIg2JOhyHJwrTwpFfvGIV4McXPy06yPfS8nBicqTtq80KyX47kk 3bj/t0kWp+rEt+KUsXBGQWPSMv6ETn/2zQd3Pcl2qai0ALARUyqlzl2V2B4XQP6neKE2+DB5hmrHS mvCrAUSGoMix8uW7Ki5GD6U/Mi9YcOMkT46PMMC146wNpAuJ6SDCudVfclAnl5SnVU/3sh4Non2QT FuYknsbnjD7QeKx3EEbg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1is1aZ-0003AZ-TT; Thu, 16 Jan 2020 09:37:19 +0000 Received: from mail-eopbgr150089.outbound.protection.outlook.com ([40.107.15.89] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1is1aL-0002yU-1S for linux-arm-kernel@lists.infradead.org; Thu, 16 Jan 2020 09:37:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MVIWpj5JmHCPBJRA6oPoDSEK2ttRK+s1d4uulVBA4hjQld9R/81aJ2qEjS+7cxsV2vmF1Cxj6haQ/bqmb6IlR1g9njGxgIOGjxcXLArkEi9cmiF+9lmE0K0lzAX65CG6EAbf+/cW/clDKdnTAXMGJqLPwpG0zuDbifkj7DAKp87gMSCi9ab6VQYICj7a/XhONJv+9iU+Fg3+zjTy5zvKS+GUsB+vMKZu9U1OI9FQmE6Dfzh2z22hEh2P826mICKqlDj2ocbVQPIvVY7u+1Y+AdOYAI6T2AF/ZFJ8fyH7o6rynDTo6U405TaDdb7Tqieu76fQFHkx+ZSkcGYiuR8r3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oI7ubkJpPBZ/+6HpkR2P1adzymlue4qOjFPzX3A6ePA=; b=S06GIRDtinOihftGLP9n9ulqBNp1YQ+9c2740zLKg0Qv/Qa1NqdMh74Xa59SMBNTg1nQ5ZlAaFJ6KTqkKNQ0Rv8Nuc05a4hGwyzvkDG5u+D4bvvEWLQo7m6hWjVr9WF/3A4aga2EFm2cS3mlyq2cBIQ4HpeaJyw+xoRkm1Uwikg+OQIo4DDWtMuxGx73mukB+VrNZBpWHqiWdxWZwx00zHp5K3MCBC9J+tAI9UHDhVwEaHabWVJKZfzcRqQ9wZUVd6pO5+PCJbzrthhpKBqn5vINq/3SXlAR54VzKUaDHY0ELcfgrvL1RnO3Pz8zqnhTnQhkCTiLVt5n9mn5lsx/hw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oI7ubkJpPBZ/+6HpkR2P1adzymlue4qOjFPzX3A6ePA=; b=fJVGKGyamDxKm0ZNu2PSp17cJpxNDrGsiPdueSx3aytiPMTIMCZ6Psua/QFvXCBev8b2spqH5M4RWa3wF0f59s1ILQuz4GusQQ5o65r17Y7rNvrTeOSCBYZJr2KdkPaik94CqWkTvdQSrq1fNumt3i50CI3TaOR199l0mqXDXh4= Received: from AM0PR04MB4481.eurprd04.prod.outlook.com (52.135.147.15) by AM0PR04MB4355.eurprd04.prod.outlook.com (52.134.92.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.20; Thu, 16 Jan 2020 09:37:02 +0000 Received: from AM0PR04MB4481.eurprd04.prod.outlook.com ([fe80::91e2:17:b3f4:d422]) by AM0PR04MB4481.eurprd04.prod.outlook.com ([fe80::91e2:17:b3f4:d422%3]) with mapi id 15.20.2623.018; Thu, 16 Jan 2020 09:37:02 +0000 Received: from localhost.localdomain (119.31.174.66) by HK2PR0302CA0022.apcprd03.prod.outlook.com (2603:1096:202::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2644.6 via Frontend Transport; Thu, 16 Jan 2020 09:36:57 +0000 From: Peng Fan To: "shawnguo@kernel.org" , "s.hauer@pengutronix.de" Subject: [RFC 4/4] soc: imx: move cpu code to drivers/soc/imx Thread-Topic: [RFC 4/4] soc: imx: move cpu code to drivers/soc/imx Thread-Index: AQHVzFCBOFtkNAt6cEKTo8Rz1318mw== Date: Thu, 16 Jan 2020 09:37:02 +0000 Message-ID: <1579167145-1480-5-git-send-email-peng.fan@nxp.com> References: <1579167145-1480-1-git-send-email-peng.fan@nxp.com> In-Reply-To: <1579167145-1480-1-git-send-email-peng.fan@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK2PR0302CA0022.apcprd03.prod.outlook.com (2603:1096:202::32) To AM0PR04MB4481.eurprd04.prod.outlook.com (2603:10a6:208:70::15) authentication-results: spf=none (sender IP is ) smtp.mailfrom=peng.fan@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: d5a3d0e7-f9ed-4c8a-b0c5-08d79a67a3f4 x-ms-traffictypediagnostic: AM0PR04MB4355:|AM0PR04MB4355: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:108; x-forefront-prvs: 02843AA9E0 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(366004)(136003)(346002)(396003)(376002)(39860400002)(189003)(199004)(66446008)(64756008)(66556008)(66476007)(66946007)(26005)(16526019)(186003)(52116002)(2906002)(4326008)(478600001)(36756003)(6666004)(7416002)(8936002)(6512007)(5660300002)(44832011)(71200400001)(86362001)(6506007)(69590400006)(6486002)(956004)(316002)(81166006)(81156014)(54906003)(110136005)(8676002)(2616005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR04MB4355; H:AM0PR04MB4481.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: BCL:0; x-microsoft-antispam-message-info: A3OgCaDZxsktCmvpMEM54k4v+np+H2wV4l72+G0L1Amkwfxbfl51R2AFzxrayfpX8DBzmk9zt5ULxKoNtRAB7OFovxfsKRx3x0Q4mZBJ1wAYsKXjZeKAEprz7MtLJ0cn0pELRFr8nC/MpgZooFUTG3jyKCq2ZUQhfmRb8FCpdG1IzsHj/D/9G6VanSGycfO3Cg42GAsf4NhHpmmmrbVsJrRo5V5ANhqPpowDW8J+mQefZQl1+UcSiIPburFEYWMh9nkAUmu6jsaNsl/1rSkdEIuAkNUxHUiUs4D7ZBtFR3d3X5GRu5U8uzrjpmdrPfUINw/GnJOg8Z0Ogl6TMOuqlEe696yzsx+B2Ty9iGZoXrXeucY3C3iZU57ITMhfmspYpfWTNe4EjiJah8y+EuuZnmhjm/I2vYZYloxdQV9B3ni8wYGHBNkGqFOZEeQH+zw1IlBPppJvbGt1FFxvvawhjYf4MtTo53YxiP6eft4ehIMBa3pw+dwLKjUP0lLuS2Rh MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d5a3d0e7-f9ed-4c8a-b0c5-08d79a67a3f4 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Jan 2020 09:37:02.2703 (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-CrossTenant-userprincipalname: ttnybayV7MG4xS5sPGeqH8ykATJCnQJ799oVmDSkYLr5OV+yop3cJYMhc45on2BXjsUqCRPr9GmUQV7M2wgMnQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4355 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200116_013705_214697_E107C112 X-CRM114-Status: GOOD ( 17.27 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [40.107.15.89 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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-arm-kernel@lists.infradead.org" , Peng Fan , Abel Vesa , Anson Huang , "ard.biesheuvel@linaro.org" , "festevam@gmail.com" , "linux-kernel@vger.kernel.org" , dl-linux-imx , "kernel@pengutronix.de" , "git@andred.net" , Leonard Crestez , "info@metux.net" , "allison@lohutok.net" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Peng Fan Move the soc device register code to drivers/soc/imx to align with i.MX8. Signed-off-by: Peng Fan --- arch/arm/mach-imx/cpu.c | 136 ------------------------------------------ drivers/soc/imx/Makefile | 3 + drivers/soc/imx/soc-imx.c | 146 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 149 insertions(+), 136 deletions(-) create mode 100644 drivers/soc/imx/soc-imx.c diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c index 0302cb66134b..65c7224f5250 100644 --- a/arch/arm/mach-imx/cpu.c +++ b/arch/arm/mach-imx/cpu.c @@ -1,25 +1,13 @@ // SPDX-License-Identifier: GPL-2.0 #include -#include #include #include #include #include -#include -#include -#include #include "hardware.h" #include "common.h" -#define OCOTP_UID_H 0x420 -#define OCOTP_UID_L 0x410 - -#define OCOTP_ULP_UID_1 0x4b0 -#define OCOTP_ULP_UID_2 0x4c0 -#define OCOTP_ULP_UID_3 0x4d0 -#define OCOTP_ULP_UID_4 0x4e0 - unsigned int __mxc_cpu_type; static unsigned int imx_soc_revision; @@ -82,127 +70,3 @@ void __init imx_aips_allow_unprivileged_access( imx_set_aips(aips_base_addr); } } - -static int __init imx_soc_device_init(void) -{ - struct soc_device_attribute *soc_dev_attr; - const char *ocotp_compat = NULL; - struct soc_device *soc_dev; - struct device_node *root; - struct regmap *ocotp = NULL; - const char *soc_id; - u64 soc_uid = 0; - u32 val; - int ret; - - soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); - if (!soc_dev_attr) - return PTR_ERR(soc_dev_attr); - - soc_dev_attr->family = "Freescale i.MX"; - - root = of_find_node_by_path("/"); - ret = of_property_read_string(root, "model", &soc_dev_attr->machine); - of_node_put(root); - if (ret) - goto free_soc; - - switch (__mxc_cpu_type) { - case MXC_CPU_IMX6SL: - ocotp_compat = "fsl,imx6sl-ocotp"; - soc_id = "i.MX6SL"; - break; - case MXC_CPU_IMX6DL: - ocotp_compat = "fsl,imx6q-ocotp"; - soc_id = "i.MX6DL"; - break; - case MXC_CPU_IMX6SX: - ocotp_compat = "fsl,imx6sx-ocotp"; - soc_id = "i.MX6SX"; - break; - case MXC_CPU_IMX6Q: - ocotp_compat = "fsl,imx6q-ocotp"; - soc_id = "i.MX6Q"; - break; - case MXC_CPU_IMX6UL: - ocotp_compat = "fsl,imx6ul-ocotp"; - soc_id = "i.MX6UL"; - break; - case MXC_CPU_IMX6ULL: - ocotp_compat = "fsl,imx6ull-ocotp"; - soc_id = "i.MX6ULL"; - break; - case MXC_CPU_IMX6ULZ: - ocotp_compat = "fsl,imx6ull-ocotp"; - soc_id = "i.MX6ULZ"; - break; - case MXC_CPU_IMX6SLL: - ocotp_compat = "fsl,imx6sll-ocotp"; - soc_id = "i.MX6SLL"; - break; - case MXC_CPU_IMX7D: - ocotp_compat = "fsl,imx7d-ocotp"; - soc_id = "i.MX7D"; - break; - case MXC_CPU_IMX7ULP: - ocotp_compat = "fsl,imx7ulp-ocotp"; - soc_id = "i.MX7ULP"; - break; - default: - soc_id = "Unknown"; - } - soc_dev_attr->soc_id = soc_id; - - if (ocotp_compat) { - ocotp = syscon_regmap_lookup_by_compatible(ocotp_compat); - if (IS_ERR(ocotp)) - pr_err("%s: failed to find %s regmap!\n", __func__, ocotp_compat); - } - - if (!IS_ERR_OR_NULL(ocotp)) { - if (__mxc_cpu_type == MXC_CPU_IMX7ULP) { - regmap_read(ocotp, OCOTP_ULP_UID_4, &val); - soc_uid = val & 0xffff; - regmap_read(ocotp, OCOTP_ULP_UID_3, &val); - soc_uid <<= 16; - soc_uid |= val & 0xffff; - regmap_read(ocotp, OCOTP_ULP_UID_2, &val); - soc_uid <<= 16; - soc_uid |= val & 0xffff; - regmap_read(ocotp, OCOTP_ULP_UID_1, &val); - soc_uid <<= 16; - soc_uid |= val & 0xffff; - } else { - regmap_read(ocotp, OCOTP_UID_H, &val); - soc_uid = val; - regmap_read(ocotp, OCOTP_UID_L, &val); - soc_uid <<= 32; - soc_uid |= val; - } - } - - soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%d.%d", - (imx_soc_revision >> 4) & 0xf, - imx_soc_revision & 0xf); - if (!soc_dev_attr->revision) - goto free_soc; - - soc_dev_attr->serial_number = kasprintf(GFP_KERNEL, "%016llX", soc_uid); - if (!soc_dev_attr->serial_number) - goto free_rev; - - soc_dev = soc_device_register(soc_dev_attr); - if (IS_ERR(soc_dev)) - goto free_serial_number; - - return 0; - -free_serial_number: - kfree(soc_dev_attr->serial_number); -free_rev: - kfree(soc_dev_attr->revision); -free_soc: - kfree(soc_dev_attr); - return -ENOMEM; -} -device_initcall(imx_soc_device_init); diff --git a/drivers/soc/imx/Makefile b/drivers/soc/imx/Makefile index 103e2c93c342..45dd49df3044 100644 --- a/drivers/soc/imx/Makefile +++ b/drivers/soc/imx/Makefile @@ -1,5 +1,8 @@ # SPDX-License-Identifier: GPL-2.0-only obj-$(CONFIG_HAVE_IMX_GPC) += gpc.o obj-$(CONFIG_IMX_GPCV2_PM_DOMAINS) += gpcv2.o +obj-$(CONFIG_SOC_IMX6)+= soc-imx.o +obj-$(CONFIG_SOC_IMX7D)+= soc-imx.o +obj-$(CONFIG_SOC_IMX7ULP)+= soc-imx.o obj-$(CONFIG_SOC_IMX8M) += soc-imx8m.o obj-$(CONFIG_IMX_SCU_SOC) += soc-imx-scu.o diff --git a/drivers/soc/imx/soc-imx.c b/drivers/soc/imx/soc-imx.c new file mode 100644 index 000000000000..e01c7ccf1f4b --- /dev/null +++ b/drivers/soc/imx/soc-imx.c @@ -0,0 +1,146 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2020 NXP. + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +#define OCOTP_UID_H 0x420 +#define OCOTP_UID_L 0x410 + +#define OCOTP_ULP_UID_1 0x4b0 +#define OCOTP_ULP_UID_2 0x4c0 +#define OCOTP_ULP_UID_3 0x4d0 +#define OCOTP_ULP_UID_4 0x4e0 + +static int __init imx_soc_device_init(void) +{ + struct soc_device_attribute *soc_dev_attr; + const char *ocotp_compat = NULL; + struct soc_device *soc_dev; + struct device_node *root; + struct regmap *ocotp = NULL; + const char *soc_id; + u64 soc_uid = 0; + u32 val; + int ret; + + soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); + if (!soc_dev_attr) + return PTR_ERR(soc_dev_attr); + + soc_dev_attr->family = "Freescale i.MX"; + + root = of_find_node_by_path("/"); + ret = of_property_read_string(root, "model", &soc_dev_attr->machine); + of_node_put(root); + if (ret) + goto free_soc; + + switch (__mxc_cpu_type) { + case MXC_CPU_IMX6SL: + ocotp_compat = "fsl,imx6sl-ocotp"; + soc_id = "i.MX6SL"; + break; + case MXC_CPU_IMX6DL: + ocotp_compat = "fsl,imx6q-ocotp"; + soc_id = "i.MX6DL"; + break; + case MXC_CPU_IMX6SX: + ocotp_compat = "fsl,imx6sx-ocotp"; + soc_id = "i.MX6SX"; + break; + case MXC_CPU_IMX6Q: + ocotp_compat = "fsl,imx6q-ocotp"; + soc_id = "i.MX6Q"; + break; + case MXC_CPU_IMX6UL: + ocotp_compat = "fsl,imx6ul-ocotp"; + soc_id = "i.MX6UL"; + break; + case MXC_CPU_IMX6ULL: + ocotp_compat = "fsl,imx6ull-ocotp"; + soc_id = "i.MX6ULL"; + break; + case MXC_CPU_IMX6ULZ: + ocotp_compat = "fsl,imx6ull-ocotp"; + soc_id = "i.MX6ULZ"; + break; + case MXC_CPU_IMX6SLL: + ocotp_compat = "fsl,imx6sll-ocotp"; + soc_id = "i.MX6SLL"; + break; + case MXC_CPU_IMX7D: + ocotp_compat = "fsl,imx7d-ocotp"; + soc_id = "i.MX7D"; + break; + case MXC_CPU_IMX7ULP: + ocotp_compat = "fsl,imx7ulp-ocotp"; + soc_id = "i.MX7ULP"; + break; + default: + soc_id = "Unknown"; + } + soc_dev_attr->soc_id = soc_id; + + if (ocotp_compat) { + ocotp = syscon_regmap_lookup_by_compatible(ocotp_compat); + if (IS_ERR(ocotp)) + pr_err("%s: failed to find %s regmap!\n", __func__, ocotp_compat); + } + + if (!IS_ERR_OR_NULL(ocotp)) { + if (__mxc_cpu_type == MXC_CPU_IMX7ULP) { + regmap_read(ocotp, OCOTP_ULP_UID_4, &val); + soc_uid = val & 0xffff; + regmap_read(ocotp, OCOTP_ULP_UID_3, &val); + soc_uid <<= 16; + soc_uid |= val & 0xffff; + regmap_read(ocotp, OCOTP_ULP_UID_2, &val); + soc_uid <<= 16; + soc_uid |= val & 0xffff; + regmap_read(ocotp, OCOTP_ULP_UID_1, &val); + soc_uid <<= 16; + soc_uid |= val & 0xffff; + } else { + regmap_read(ocotp, OCOTP_UID_H, &val); + soc_uid = val; + regmap_read(ocotp, OCOTP_UID_L, &val); + soc_uid <<= 32; + soc_uid |= val; + } + } + + soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%d.%d", + (imx_get_soc_revision() >> 4) & 0xf, + imx_get_soc_revision() & 0xf); + if (!soc_dev_attr->revision) + goto free_soc; + + soc_dev_attr->serial_number = kasprintf(GFP_KERNEL, "%016llX", soc_uid); + if (!soc_dev_attr->serial_number) + goto free_rev; + + soc_dev = soc_device_register(soc_dev_attr); + if (IS_ERR(soc_dev)) + goto free_serial_number; + + return 0; + +free_serial_number: + kfree(soc_dev_attr->serial_number); +free_rev: + kfree(soc_dev_attr->revision); +free_soc: + kfree(soc_dev_attr); + return -ENOMEM; +} +device_initcall(imx_soc_device_init);