From patchwork Wed May 20 05:51:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 11559363 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 C9F5590 for ; Wed, 20 May 2020 06:01:39 +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 868632053B for ; Wed, 20 May 2020 06:01:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="feBEt0fi"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="WYK960i6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 868632053B 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:References:In-Reply-To: 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=0qNrg4RSbhxkfmhqkie+cNcLXHy1vTGgFr+WPyklLJw=; b=feBEt0fitvH5dg NPtUflbNveix4tkUYmMWVYXGT/xK9BISSvYdQ8iPhJXKdHkCfI2lqYbBqHSrYNJiNWlZO8Q/OBsBH e5B48JJirUDPbWCQHx+XLMUotJNnPUp31zISajd5GliIAkev3G9epdtmozvyWY2JTx0daQrfp++In mm01naYZUTUDk/bB/W82eW4AB/sgSAkcLBzWnB4b8m7s0ncaE7njBn25vips1epl6V2iDvvc+ijBx 4BMx8fGtR10lhsrrYdOeY41z98d9w9Nfs+TYs8MeZPLAO/nBoN+oM8WeeFjIyfJDVH/FMisSFEjqF N5gIihA8vq8O8nPDlnjw==; 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 1jbHnL-0005sd-TL; Wed, 20 May 2020 06:01:35 +0000 Received: from mail-db8eur05on2085.outbound.protection.outlook.com ([40.107.20.85] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jbHnF-0005l7-Aa for linux-arm-kernel@lists.infradead.org; Wed, 20 May 2020 06:01:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gAlR98Pr6dnTdW3F7R7hRVTlloNM3WY+40RuDvcL09/VsiUK1rnXaO0askcAkoLihdk/9MCO2AopRZYtoFGhFuWSYylnVZjIvkO+pb0v3rudLMxk3BI8IqDnbakljGcFYCOowSBdOyc7Xxf9OZ7D/gL0WIFgEnFoKUGB1mptvtXeBzhgLTqdjeEh1p3+yFTxKFr9QjUU8ns4hhLJW3OOqkLfMaz5T+5MftA64C1uIiPp14+Z6nfF9AsZw751Nft3+kxXUFNRHYDqwi2Em+vqJhnqQt3dAKCvWWaQn8ed6acsbg+czTNZWMg9o5FS1dDyPhe1081F0EE+KkKk5Uz6Xg== 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=j90AY/pb5J8s1Prk3FmQC1a6R7yqpKcOPjnvxSYuDWM=; b=TTatUcluDIA0/5MjU0C+UW87oNnbXoGnWQi3+GdRBLofKCBo4mSs0fnUPstZ9KUlCGvRjLbtmCeYRbqamU/cI7u+F6NnfMfvn32onxJwqcCrY2PSn62B+GRnZkUT0O+1EmcrHJn3OA4TWJxTIKIoyumhBTqQhm9twvEIep5yMSFzlBOf0la67auCkf14wD7pVC+lBGxXHeBpqS0CLUAU1njIxwcNjUWNMZe2UNKKeNbcHbChCk8ADfeajTmK7Nc2ruoi/bvhjThIsPf2F94CIlleIMDkBhDh88FXmQQrlpNr0VI+zxXEYe0Nw/gXLySIWfprO6vLAcvKgcZr5+XgIg== 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=j90AY/pb5J8s1Prk3FmQC1a6R7yqpKcOPjnvxSYuDWM=; b=WYK960i6oyF1oJWlji4cFxajaFWWHvEvdoF4SS366f7UspS8nppqJ6gnO6tRunoJxQ/m61+5u/W0eU1wEnformqr9emEsTK9VnLlF+4nrqBkXIqA5ELhlnCocOTI1SD01PbMkHqvmR/QlWpLoVK7BNj3Jf7ZQ96lJ60r6gcCMRI= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=nxp.com; Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) by DB6PR0402MB2790.eurprd04.prod.outlook.com (2603:10a6:4:97::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.20; Wed, 20 May 2020 06:01:26 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::d17b:d767:19c3:b871]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::d17b:d767:19c3:b871%6]) with mapi id 15.20.3021.020; Wed, 20 May 2020 06:01:26 +0000 From: peng.fan@nxp.com To: shawnguo@kernel.org, s.hauer@pengutronix.de Subject: [PATCH V3 1/3] ARM: imx: use device_initcall for imx_soc_device_init Date: Wed, 20 May 2020 13:51:27 +0800 Message-Id: <1589953889-30955-2-git-send-email-peng.fan@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1589953889-30955-1-git-send-email-peng.fan@nxp.com> References: <1589953889-30955-1-git-send-email-peng.fan@nxp.com> X-ClientProxiedBy: SG2PR02CA0038.apcprd02.prod.outlook.com (2603:1096:3:18::26) To DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.66) by SG2PR02CA0038.apcprd02.prod.outlook.com (2603:1096:3:18::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3000.31 via Frontend Transport; Wed, 20 May 2020 06:01:21 +0000 X-Mailer: git-send-email 2.7.4 X-Originating-IP: [119.31.174.66] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 21b5da77-fe60-44dc-cef4-08d7fc833b72 X-MS-TrafficTypeDiagnostic: DB6PR0402MB2790: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:229; X-Forefront-PRVS: 04097B7F7F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sVIFzRHZUfR+mD/4N9N/wG2MMsArk7dRfPCLJeuYoxE05OfJjI9UMG6mnDSFchkmMEDYBoL7K881cSGblwhgzhhApKYDNyOUSw3FvY5A2/UqJ/aQmF4PqUtTsRLLkxika4Q+OkokfWmy9JrEgYKH7TDPl/M4OJL6d9eFdCKqBFJQwqpUmjwVZ0Xw5lRKjHvge1qP4cwuuReV5za+vHYvE51k/ooMNvpVrhzmkKen5yuPPZMCylBWITBGj87bnoYM7QAcdv0yeOaUkARHiH1XGmKDsENWcMmed5zklDnIWDDD92hTok1qjmLmr7LMpoL5tLYZrttBrNxURaFOZUsv8FvH5D4Wcd+dg4zENjSYYnAJdj4DPi7pzeYz1k1pL9HRsV+3T5/eF6F3ZdKpHQP9mFsBjgAXRFThGVJ4FkqGuRxLrisb6yYaPbFQeZ9Q+S99X/dMCuoxF6QxgHyzt/Q54xt0omoZflmkYKGGkF6wQP7WbwkbnQ+S3nXcB0mY4ORI X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR0402MB2760.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(396003)(376002)(366004)(136003)(346002)(39860400002)(7416002)(2906002)(16526019)(186003)(66556008)(6486002)(86362001)(956004)(66476007)(2616005)(66946007)(69590400007)(316002)(26005)(5660300002)(4326008)(8676002)(6512007)(478600001)(9686003)(36756003)(52116002)(6506007)(8936002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: QO6CyJNBagFTW+49ZKd2wnhicsaQhkHgrSh87TWnhFeDmoXQLSKKzOLgKzfAVYUlUrjf49bceLZkiy4dcO9UeLgQiEeunMWUsT5DriscwNoXoBeulTKgakW6xpkH9Hh92eplUtn6GLFE776LXyNoQCVkpJoHjduLB/pqMd3VBj+szjpndAxKWtrULGTX1hfnb6IK89b4xgpepMWdXdRq8Il54iNQNdsoyZ+wU7TnY0JDvwWq+i7twtHHCrokwemGeowdWZsqbs7CPty3cDldVOZzn18/SHiqAixlQc9kR6KJG/nx7KSF5mlXLZee59SlWGBajS+9jUGnY4Y0Okv9g7o77KX34zZM/mK58NK9kVEtG1yOgXjmZJJ51U9d1ZLONwOD858v7kqhnX5KRzCjmEn/p1Q2jAXBeOVVcAUMPVg1GfBwCcbgj+fUbk8QRzO1cQ8ZHJjseoSFzSzkgD2DHTdsFeDNNdKBjtnEIWobPUbFdPsuYaqtxAQsqRYG0rw6 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 21b5da77-fe60-44dc-cef4-08d7fc833b72 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2020 06:01:26.8098 (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: eoKalDxBxFeld2lBnpnipE7c6bwoqK0NcGBHvHW4smcox5oOafHX0gwttAPBvRXjUCPCVnXeK/aojk8ZMmAofw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0402MB2790 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200519_230129_408206_4E18CD48 X-CRM114-Status: GOOD ( 14.41 ) X-Spam-Score: -0.9 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [40.107.20.85 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [40.107.20.85 listed in wl.mailspike.net] -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay 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@nxp.com, Anson.Huang@nxp.com, andrew.smirnov@gmail.com, festevam@gmail.com, linux-kernel@vger.kernel.org, linux-imx@nxp.com, kernel@pengutronix.de, git@andred.net, leonard.crestez@nxp.com, info@metux.net, cphealy@gmail.com, 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 | 21 ++++++++++++++------- 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 +- arch/arm/mach-imx/mach-vf610.c | 8 +------- 9 files changed, 20 insertions(+), 50 deletions(-) diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h index 5aa5796cff0e..72c3fcc32910 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 e3d12b21d6f6..75ffcba9f878 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 -ENOMEM; soc_dev_attr->family = "Freescale i.MX"; @@ -224,18 +224,24 @@ struct device * __init imx_soc_device_init(void) soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%d.%d", (imx_soc_revision >> 4) & 0xf, imx_soc_revision & 0xf); - if (!soc_dev_attr->revision) + if (!soc_dev_attr->revision) { + ret = -ENOMEM; goto free_soc; + } soc_dev_attr->serial_number = kasprintf(GFP_KERNEL, "%016llX", soc_uid); - if (!soc_dev_attr->serial_number) + if (!soc_dev_attr->serial_number) { + ret = -ENOMEM; goto free_rev; + } soc_dev = soc_device_register(soc_dev_attr); - if (IS_ERR(soc_dev)) + if (IS_ERR(soc_dev)) { + ret = PTR_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); @@ -243,5 +249,6 @@ struct device * __init imx_soc_device_init(void) kfree(soc_dev_attr->revision); free_soc: kfree(soc_dev_attr); - return NULL; + return ret; } +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 284bce1112d2..85c084a716ab 100644 --- a/arch/arm/mach-imx/mach-imx6q.c +++ b/arch/arm/mach-imx/mach-imx6q.c @@ -245,21 +245,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 e27a6889cc56..f6e87363d605 100644 --- a/arch/arm/mach-imx/mach-imx6sl.c +++ b/arch/arm/mach-imx/mach-imx6sl.c @@ -45,13 +45,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 3b0e16ccd59d..e018e716735f 100644 --- a/arch/arm/mach-imx/mach-imx6ul.c +++ b/arch/arm/mach-imx/mach-imx6ul.c @@ -55,13 +55,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 = { diff --git a/arch/arm/mach-imx/mach-vf610.c b/arch/arm/mach-imx/mach-vf610.c index 565dc08412a2..208ff640698d 100644 --- a/arch/arm/mach-imx/mach-vf610.c +++ b/arch/arm/mach-imx/mach-vf610.c @@ -49,15 +49,9 @@ static void __init vf610_detect_cpu(void) static void __init vf610_init_machine(void) { - struct device *parent; - vf610_detect_cpu(); - 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); } static const char * const vf610_dt_compat[] __initconst = { From patchwork Wed May 20 05:51:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 11559365 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 F12EF90 for ; Wed, 20 May 2020 06:02:00 +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 CE9482053B for ; Wed, 20 May 2020 06:02:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="a4zQ5O4z"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="XJTYkbeL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CE9482053B 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:References:In-Reply-To: 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=F/s7s0vgROMkNZ9gn7GBV+/G7btap24z4Qz60f1vRVg=; b=a4zQ5O4zdXm8Qw b4cYvvckZt+7w4ajy5BbDO+uZPc5Ebl6Dl/dwBpiKsDyKjL3u4R/+c8O3m5wcJa1xNEEBy+IryPHb QGOXvz9KiYyh/hr+mNJyLPwhgO4EQgnDGW4ccVQC7+bqTVzxRpFAGAUCTP8xIf8rUr2KqWsypxi6a tRJZl6uQByypam/rmrpTxo90Ria0fsY451EMhdzqRzm3bdhWtQ+FNCqnKuZ1Wr3jV+TCQM9tjfnzx sj4eRok82TmQWkILcR1gSx4bhlWUBj1wDy5jXeoiwv26ZSH+xd5WKmFAFT5nLQLUWZz3EtvdZDiQI DzD2AxV32/dIA+odoyjg==; 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 1jbHni-0006D9-Cv; Wed, 20 May 2020 06:01:58 +0000 Received: from mail-db8eur05on2084.outbound.protection.outlook.com ([40.107.20.84] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jbHnL-0005rO-2j for linux-arm-kernel@lists.infradead.org; Wed, 20 May 2020 06:01:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YSb7B0a0SpZrupKW+rGtIptVRRqk88pftqHDz7F4XDJRT8XdFfwS6O4ExOwsb9Us0oBbx1hsRga4NRJ7QakYD1QynaHpubpoNx1EFV+fFJaFuQtOI6g3fXPqTKoOIG1oaPpARF2F9NrN/uQFviJHZIXaFDuZw4/WGbTRscuanogsk9c9SVIRuteu3oouBPQA7qD93BGf9MrbtktviKV06reMq9L/TujkLbLiLKpAVQm5sN0z0x5YlvtBoLEU7dHuTSsUdOUSFji/cV0HWmjowzqjQRSFlwMbvdIJ18QN4bWaBpAUlekVhZTpaKkkMUEMQ9VSc7/n7MxKqrKkonXOgw== 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=FO+ZJwaqo/jwsFAgbxJpnhA0S+05/BD1fyNiDWk72Zc=; b=XEvJw/aR2ImEYhqONgDCyc+MjSnOg8YmO5I1Ddd5DeRImxwO9K0o/ajEC99X+eC1IgLrVt8RHg+wCwRMkmh+Rum9uDcyuuBsHB3CBLqm/hyBNJ1/tGuKajQjwvx+AR1HvH7ZclxjDi/RNcr71+LD1mygt0szV1C2QLxerMD/o48qJEO7zcUDRvRpN+o2hn0eaIjEQ2GGxd/icfHOfzL64fuzShdlX3jEuu+lRuwtD2CD9TAkaliTvuW3+igxVC/3ORvylsu1WY/kc8EmDqY4lwGiGugWtEjTAuoFZn/Le9VjRhkyacwQEdMv29nedcI9Yt5sxgLVKikXHxGtPrIWBg== 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=FO+ZJwaqo/jwsFAgbxJpnhA0S+05/BD1fyNiDWk72Zc=; b=XJTYkbeLPk1U3NKlmJYCyQ9X2sqx89hRqiY3ru/InCcB7W6AQ1dytV9Bt1ZqAndYf0AOvki99k3wE5C2FddFHyAB7laq/WYr/uj8GsooAFfs6OiVvLv/XUYE1vj5rCu34GACdC5j6E56agVVfGmi26oB7jUiMKofPrUIfrE1vxY= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=nxp.com; Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) by DB6PR0402MB2790.eurprd04.prod.outlook.com (2603:10a6:4:97::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.20; Wed, 20 May 2020 06:01:32 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::d17b:d767:19c3:b871]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::d17b:d767:19c3:b871%6]) with mapi id 15.20.3021.020; Wed, 20 May 2020 06:01:32 +0000 From: peng.fan@nxp.com To: shawnguo@kernel.org, s.hauer@pengutronix.de Subject: [PATCH V3 2/3] ARM: imx: move cpu definitions into a header Date: Wed, 20 May 2020 13:51:28 +0800 Message-Id: <1589953889-30955-3-git-send-email-peng.fan@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1589953889-30955-1-git-send-email-peng.fan@nxp.com> References: <1589953889-30955-1-git-send-email-peng.fan@nxp.com> X-ClientProxiedBy: SG2PR02CA0038.apcprd02.prod.outlook.com (2603:1096:3:18::26) To DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.66) by SG2PR02CA0038.apcprd02.prod.outlook.com (2603:1096:3:18::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3000.31 via Frontend Transport; Wed, 20 May 2020 06:01:27 +0000 X-Mailer: git-send-email 2.7.4 X-Originating-IP: [119.31.174.66] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 08a32479-0450-450a-9043-08d7fc833efd X-MS-TrafficTypeDiagnostic: DB6PR0402MB2790: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-Forefront-PRVS: 04097B7F7F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OwFkwDi4b9hmfE4hToYK5FzULNMYvGmFqK6VSbtTrg0OAeqY73uNsNgC9OZON/IxkfZAXEyF8ETQOYYuilmO45bpvgeQ2mA2SemLXhbliB27zInaFIV2+J/gv6baW86zL5wtwVsAsA4rv5+7mdBLsCawhWBLawQiaMxvX1CWYeytw4VlhtjTvg7os5HCjRnCNFphcG2Wmu/IfAWOgG7lQtBBxbPgx+nzFxx7yNa/emioe71FyLzKKfU3U4s1MyousibU99mIYT3OcgAqAzUMkiMLEXFuAXV3bEtI1UDPKp3EXICY7M0MQq4kg5HvquQoIkV7ekV1S2cw5IVnJO7k2kUdbqBmbaFFMD6nlB9NSyWVWR+eyypX1UZ0I4LFXfDjAAZnAlPk9R+eJSwfIbDKE6X/xcu3qDMBprKApFe2v96OzpS19vW5UXz7cIbtL8N6sQqAPBX7dIjQ7YMeT9w2semOeSgYyBf3rD7EulQcpe0NHdH2/1rOmrtgnm6a/pIY X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR0402MB2760.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(396003)(376002)(366004)(136003)(346002)(39860400002)(7416002)(2906002)(16526019)(186003)(66556008)(6486002)(86362001)(956004)(66476007)(2616005)(66946007)(69590400007)(316002)(26005)(5660300002)(4326008)(8676002)(6512007)(478600001)(9686003)(36756003)(52116002)(6506007)(8936002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: pqfMFHJn13pQlrUxFXfYRgcHe6u8rJq0coJGNI9Sx9nXmtAuznFKoqCIYKEsAMcaBrerh0Hx/zxnGr7Og0YJr1O/nsNyFdnbvOFznfiGqlznv0t2yT4DdOb6kXyBkUej4+09gvgIJHb5NWwcfno4eCUJ/gxbrm2locUGX0w/otFNisLU1ybUYHX9PC/0r8OO/QYL6w4u7DetrpZ7VCz5FDZEGjygtOUQe0+nX7YX7tHiAkw3bLd227b3OwNHUVk0iLaAjMP8ZHwmvZp67+9djL5mpp5rMEqnbnVox7C1KLWDALd4M41/qVu/7g+/CldIK2cPcyHKZlG8Jv0dXTejkA3dVAAS+xTjX+FIKU8eokPLMh88oPXb5u0qNheYOx7oRyzGALGjlgbnw33r1HDv6bk3OoDcF7Ap2HGD33G3ascVHBGC3vTgCDI2x5NcW9dqHzXrcchc2VuMxlirZMQnMqKCMtE1s/vrgr4Ec9wYGEhF/MnxNIeeGjmreaMeM5Uu X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 08a32479-0450-450a-9043-08d7fc833efd X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2020 06:01:32.6813 (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: MYVJCsgKRWvhswEK+hlccibCkLmkam06/adbs2/kURvr1QwAupwMOV177JQ0qPOfnUKZwV+OV+QhbjJJ3eKjug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0402MB2790 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200519_230135_146669_D4CEB59B X-CRM114-Status: GOOD ( 11.85 ) X-Spam-Score: -0.9 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [40.107.20.84 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [40.107.20.84 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay 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@nxp.com, Anson.Huang@nxp.com, andrew.smirnov@gmail.com, festevam@gmail.com, linux-kernel@vger.kernel.org, linux-imx@nxp.com, kernel@pengutronix.de, git@andred.net, leonard.crestez@nxp.com, info@metux.net, cphealy@gmail.com, 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 | 28 +--------------------------- include/soc/imx/cpu.h | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 27 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 48e6d781f15b..fe2d0f5abfcc 100644 --- a/arch/arm/mach-imx/mxc.h +++ b/arch/arm/mach-imx/mxc.h @@ -8,41 +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 MXC_CPU_VFx10 0x010 -#define MXC_CPU_VF500 0x500 -#define MXC_CPU_VF510 (MXC_CPU_VF500 | MXC_CPU_VFx10) -#define MXC_CPU_VF600 0x600 -#define MXC_CPU_VF610 (MXC_CPU_VF600 | MXC_CPU_VFx10) - #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..42d6aeb951fa --- /dev/null +++ b/include/soc/imx/cpu.h @@ -0,0 +1,36 @@ +/* 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 + +#define MXC_CPU_VFx10 0x010 +#define MXC_CPU_VF500 0x500 +#define MXC_CPU_VF510 (MXC_CPU_VF500 | MXC_CPU_VFx10) +#define MXC_CPU_VF600 0x600 +#define MXC_CPU_VF610 (MXC_CPU_VF600 | MXC_CPU_VFx10) + +#ifndef __ASSEMBLY__ +extern unsigned int __mxc_cpu_type; +#endif + +#endif From patchwork Wed May 20 05:51:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 11559367 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 BEFD190 for ; Wed, 20 May 2020 06:02: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 977072053B for ; Wed, 20 May 2020 06:02: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="Lkc1cpBr"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="Nr66gr9i" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 977072053B 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:References:In-Reply-To: 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=QvhnfGJV1JJit4XlcjlQhF6cjv8MuTtbE5/GIoYGpXE=; b=Lkc1cpBreSYg4P dIedAuHdJWArWNAN1wer1dWVoYmfzxiN9Q3j84d9EQnGurheTqfJkQ/UCLK2ftcwkGjSczvlznnsQ TUu5zyMyeCnzy3fktJnvybr/wVB/kpnL5hIzdIiQVOnQfMZ0e4SWAvgkO6ftmNWNyvNfL0edNVJQz BsIY7ML7vyqzXdquL6OQ6KS+qzA4n2rErOcFQcS4S/SOPEY90SQRKEmHm0ttt7p+VAomnS1ws136e qXxUK8rA2eQCb20TagL2zm3PL6qQ9qC2Uv03rdUkWjN2A6aCNw7ITkNuvPUo070QtOcobJTREPHdx wQ4o/SjpmIZbJxdamGEQ==; 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 1jbHo1-0006Sb-0X; Wed, 20 May 2020 06:02:17 +0000 Received: from mail-eopbgr70042.outbound.protection.outlook.com ([40.107.7.42] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jbHnR-0005yI-Io for linux-arm-kernel@lists.infradead.org; Wed, 20 May 2020 06:01:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B6ASWrAe/y70+n7BGchIQ5sX6+2/dWS04Q2NU8BdSyhU73j3hRHAC6W8tMuVTiBs2ZKIGj64rfJ5IDn9mBGKAgIKO0ICz/9b6kTCjnmXIhTwBjQybZaSqQuu7RXukOQHZ8hSB7kXvQI8ndCLL1+TyziDN/G8fwVQD+7+OxIpBcxwp2/vbgrIjUWv++6xkTgeCp8hdej/TkIuGh5v+lg9yzZCpBelUcHCIwD9H8h+AabPcpfvYUVzNdY/82vHBbNLZpF2rC0iuFvzcqi1Ee0ERIM6l8CGL3Dd5vPiE8S/X2R0nRtIFV44u9lm3WtWYtagqfXSgwSpztOAQRmJjBgKyw== 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=gMmlLBIO2EW1mEDrbxUCq5DrtctmJuawlVaXE2qzKag=; b=hRVbinoVe2k9sRlE5BN5nHjAuEvwRe2zl6vcRx9jtcDSwxa9HN8nNnS0FFaHi2gi4TGLEOeXCs1dg3XvFW/gSArozR5Oxc3I+m1gcvGxQaU7mUx9baCTY+rTodCwI8riJWIYtaRSCQYncKQ4ACWnl1uOuRPTEWSK2jpENi1V7A7WWt/O4o6Gw8aUnrsCy1Eolfab4DXcR2S1+wE52ebVGkJL6IlAI72XnthMob4Bynmb55ovb05wDEhzDQT0+XxjVit9y3u8OVoz/NrRsiAwMW7gNb+GBanGqpBboJ/klnfpoShSve/IcyPb1MTbostpaf38T1EG8jRKMqtRhkuFwQ== 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=gMmlLBIO2EW1mEDrbxUCq5DrtctmJuawlVaXE2qzKag=; b=Nr66gr9i/HkcMfbxku9kymc67qRfHMpAYksuvLk16Msp0ROaUKRqGVn3z7UrRrJ/6JhEVO88yl7+inRg3pnYKkXCEcQdMq1Zkkodw/XiC0t08HLk61jj0ATjjpQtEp2c8TCzSDfVdqxs6lHU9MWc90PpU1FgrWl5uRqhtzyBsTg= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=nxp.com; Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) by DB6PR0402MB2790.eurprd04.prod.outlook.com (2603:10a6:4:97::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.20; Wed, 20 May 2020 06:01:38 +0000 Received: from DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::d17b:d767:19c3:b871]) by DB6PR0402MB2760.eurprd04.prod.outlook.com ([fe80::d17b:d767:19c3:b871%6]) with mapi id 15.20.3021.020; Wed, 20 May 2020 06:01:38 +0000 From: peng.fan@nxp.com To: shawnguo@kernel.org, s.hauer@pengutronix.de Subject: [PATCH V3 3/3] soc: imx: move cpu code to drivers/soc/imx Date: Wed, 20 May 2020 13:51:29 +0800 Message-Id: <1589953889-30955-4-git-send-email-peng.fan@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1589953889-30955-1-git-send-email-peng.fan@nxp.com> References: <1589953889-30955-1-git-send-email-peng.fan@nxp.com> X-ClientProxiedBy: SG2PR02CA0038.apcprd02.prod.outlook.com (2603:1096:3:18::26) To DB6PR0402MB2760.eurprd04.prod.outlook.com (2603:10a6:4:a1::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.66) by SG2PR02CA0038.apcprd02.prod.outlook.com (2603:1096:3:18::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3000.31 via Frontend Transport; Wed, 20 May 2020 06:01:33 +0000 X-Mailer: git-send-email 2.7.4 X-Originating-IP: [119.31.174.66] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c3bd93cb-7fd0-49f3-fd07-08d7fc83423a X-MS-TrafficTypeDiagnostic: DB6PR0402MB2790: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:108; X-Forefront-PRVS: 04097B7F7F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3x6ydBqct7c1+hwaVYwfowpmcpwSuffNBCQkIg5QWbDu7MuvBH65Ni7EFsP2CTfMOrCX+ZA/5YSf21DiK1uk1CLvJBkU6dJ17+IbiqxhZ6RduUt0mnTgP5cDYf7wXxptTvQQd3N5zje0dcUOh7AgYMacioifKgdIEMMwZRAa1NFVxjcgw5h8XSkuLqSKn27o7NkNXFXCqj+UdbinLCk8EL5NHmxpk+UU0rBRPCeHTS+WGzPZRbcc0sjGu6GNMVYovWOBIzMHhBuntbp7gmpBwf++FXTq8oYiRcVdpczfLZgQVIEXP2aD+ogrpDhBhuXbrIz7Z3EDkoUjbOjYXi2mJk69ytzSPbxrWm1RumO7F499gNx3uWsgZtDscj7dJ6sQJ3wXC1eAb+Gy2+5KFD5RPo/B+woGJVKXafqADXl6cQlXl3ZKoylRYHXvUmGNctUyyc6u8owztgGm1BdXvY+vYF0aSkSvMMNsUkqEb9LdTfE2AXDE3SXn7prDjrF5uV4c X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB6PR0402MB2760.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(396003)(376002)(366004)(136003)(346002)(39860400002)(7416002)(2906002)(16526019)(186003)(66556008)(6486002)(86362001)(956004)(66476007)(2616005)(66946007)(69590400007)(6666004)(316002)(26005)(5660300002)(4326008)(8676002)(6512007)(478600001)(9686003)(36756003)(52116002)(6506007)(8936002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: WfE/0f3PAPMSqJD5wMkC01CUTrQdmvR+Tyzd+eXSEouYBNzo7eaGGRXXW3WxAMnfvt6EmmSiqNG6ggIgEm1q/DOVSngzuQ2Otey2BMhcvENDUBtFzGdNAirYEFQ+wPaAJP3eP7y1lnj5XdS9TyeXWtjd/MSP/noPSspN+GC0+/zIFFMC3v3xeIhzTVqvT77V5oocGB7ByJCpFSjJn41BJW7ocyPaGoh5J2YRgX03pnEby9mb0ES0KofncUhRp6qJqRLeJE4Xc/+MUYff+0XmHLYT1Yv6DrekvvbgldJEoTjXn54XeQudaJFiOF9ajc1SWKtmcdggjKyETfYz4HlMlq2HeLdX4VWM0cJ/iZrNYBS8+FRDUqo7YjlAR3g5KURJjdwBKCAfX9RCe0l4pQ7qIuG25BQ/T2Qv2Z7Uq9NYX2ipP85PRUiSIPCdkkEXzExqH+SYJYcoAnK1FnQl0xwxErqh2jOtgcd3CHHwEs79kypxfOWDbpFF90qNTNjALj1h X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c3bd93cb-7fd0-49f3-fd07-08d7fc83423a X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2020 06:01:38.2580 (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: PWXfMLW0TgbSlgASKqEEHB+l7WnDrHvjjXfklT1AaDRC5VfEbWF8WzMpsXr49SnEKhfazZ9dXLRqBIocTI1WCQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0402MB2790 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200519_230142_067653_12EB1702 X-CRM114-Status: GOOD ( 17.04 ) X-Spam-Score: -0.9 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [40.107.7.42 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [40.107.7.42 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay 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@nxp.com, Anson.Huang@nxp.com, andrew.smirnov@gmail.com, festevam@gmail.com, linux-kernel@vger.kernel.org, linux-imx@nxp.com, kernel@pengutronix.de, git@andred.net, leonard.crestez@nxp.com, info@metux.net, cphealy@gmail.com, 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 | 182 ------------------------------------------- drivers/soc/imx/Makefile | 3 + drivers/soc/imx/soc-imx.c | 192 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 195 insertions(+), 182 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 75ffcba9f878..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,173 +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 -ENOMEM; - - 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_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"; - 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; - case MXC_CPU_VF500: - ocotp_compat = "fsl,vf610-ocotp"; - soc_id = "VF500"; - break; - case MXC_CPU_VF510: - ocotp_compat = "fsl,vf610-ocotp"; - soc_id = "VF510"; - break; - case MXC_CPU_VF600: - ocotp_compat = "fsl,vf610-ocotp"; - soc_id = "VF600"; - break; - case MXC_CPU_VF610: - ocotp_compat = "fsl,vf610-ocotp"; - soc_id = "VF610"; - 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) { - ret = -ENOMEM; - goto free_soc; - } - - soc_dev_attr->serial_number = kasprintf(GFP_KERNEL, "%016llX", soc_uid); - if (!soc_dev_attr->serial_number) { - ret = -ENOMEM; - goto free_rev; - } - - soc_dev = soc_device_register(soc_dev_attr); - if (IS_ERR(soc_dev)) { - ret = PTR_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 ret; -} -device_initcall(imx_soc_device_init); diff --git a/drivers/soc/imx/Makefile b/drivers/soc/imx/Makefile index 103e2c93c342..446143241fe7 100644 --- a/drivers/soc/imx/Makefile +++ b/drivers/soc/imx/Makefile @@ -1,4 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only +ifeq ($(CONFIG_ARM),y) +obj-$(CONFIG_ARCH_MXC) += soc-imx.o +endif obj-$(CONFIG_HAVE_IMX_GPC) += gpc.o obj-$(CONFIG_IMX_GPCV2_PM_DOMAINS) += gpcv2.o obj-$(CONFIG_SOC_IMX8M) += soc-imx8m.o diff --git a/drivers/soc/imx/soc-imx.c b/drivers/soc/imx/soc-imx.c new file mode 100644 index 000000000000..fec3d672b606 --- /dev/null +++ b/drivers/soc/imx/soc-imx.c @@ -0,0 +1,192 @@ +// 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 -ENOMEM; + + 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_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"; + 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; + case MXC_CPU_VF500: + ocotp_compat = "fsl,vf610-ocotp"; + soc_id = "VF500"; + break; + case MXC_CPU_VF510: + ocotp_compat = "fsl,vf610-ocotp"; + soc_id = "VF510"; + break; + case MXC_CPU_VF600: + ocotp_compat = "fsl,vf610-ocotp"; + soc_id = "VF600"; + break; + case MXC_CPU_VF610: + ocotp_compat = "fsl,vf610-ocotp"; + soc_id = "VF610"; + 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) { + ret = -ENOMEM; + goto free_soc; + } + + soc_dev_attr->serial_number = kasprintf(GFP_KERNEL, "%016llX", soc_uid); + if (!soc_dev_attr->serial_number) { + ret = -ENOMEM; + goto free_rev; + } + + soc_dev = soc_device_register(soc_dev_attr); + if (IS_ERR(soc_dev)) { + ret = PTR_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 ret; +} +device_initcall(imx_soc_device_init);