From patchwork Fri Nov 2 09:13:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dong Aisheng X-Patchwork-Id: 10665173 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C42541751 for ; Fri, 2 Nov 2018 09:14:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AEFA92BA63 for ; Fri, 2 Nov 2018 09:14:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A2F7E2BA78; Fri, 2 Nov 2018 09:14:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0FCAD2BA63 for ; Fri, 2 Nov 2018 09:14:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=r7fDT4ulXhxtRk8MI/II9PWv8d7o2OuyFwb98KVAFVs=; b=s7K1nYyq9OZii7 tkLZlvDRy/8X7gaOAUIr3eR5xshqx5WIB3O5Gn8hrXRDspmVU1lzgts7XhvA4ZnADn95juIsNrhEw mO3HC+ht7t+3RsofL9o9DHgf3dwI/ec8Dug0gfKBFHRTCd0LHHTBiQPWQFrIuerSHdMZVQoLVzWdW S42aNOycGFm26OsWPr2DukRF+CC16d0HqKNE6bUu8wFL8clIavSZVrP8BmCoPIRZxhuq/AluvgVpt 1icc/Y8rou2DTl1BJMkB3DLjn6/nQYUW3LdEwE5gDHJZTAZjMo11+eI+8cEXeiSl9uRDlJ+/Q/tjL HoXzFh7lz0PCT4yNHMNw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gIVWl-00076t-KA; Fri, 02 Nov 2018 09:14:03 +0000 Received: from mail-db5eur03on0618.outbound.protection.outlook.com ([2a01:111:f400:fe0a::618] helo=EUR03-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gIVW2-0005Uz-0R for linux-arm-kernel@lists.infradead.org; Fri, 02 Nov 2018 09:13:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fx8kf0S6n0aqw1R/MJ26qkHYAuqxexSC1YObS3c+aZ0=; b=ux/99LYAst/rBakzSHjwx5q3Zv7g1kMWL8do5OJWqsUYbsJAvIcxjK3gHDVveOXNcDWSJsJrGbLeFCiH2L1G0EfJBIZTvwDjNuCUbWeSZM+ozpn4Qh8UgKTzaLPGahdxvLyHKB80/6sO2/BQTam+q4bpm7W8mHT2kjroc5bS1Z8= Received: from AM0PR04MB4211.eurprd04.prod.outlook.com (52.134.126.21) by AM0PR04MB4113.eurprd04.prod.outlook.com (52.134.125.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.26; Fri, 2 Nov 2018 09:13:07 +0000 Received: from AM0PR04MB4211.eurprd04.prod.outlook.com ([fe80::797a:f972:9281:6d10]) by AM0PR04MB4211.eurprd04.prod.outlook.com ([fe80::797a:f972:9281:6d10%2]) with mapi id 15.20.1294.024; Fri, 2 Nov 2018 09:13:07 +0000 From: "A.s. Dong" To: "linux-arm-kernel@lists.infradead.org" Subject: [PATCH V4 07/10] ARM: imx: add initial support for imx7ulp Thread-Topic: [PATCH V4 07/10] ARM: imx: add initial support for imx7ulp Thread-Index: AQHUcoxEIGBkTbiBA06EiH8tq/mpLg== Date: Fri, 2 Nov 2018 09:13:07 +0000 Message-ID: <1541149669-10857-8-git-send-email-aisheng.dong@nxp.com> References: <1541149669-10857-1-git-send-email-aisheng.dong@nxp.com> In-Reply-To: <1541149669-10857-1-git-send-email-aisheng.dong@nxp.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK0PR04CA0024.apcprd04.prod.outlook.com (2603:1096:203:36::36) To AM0PR04MB4211.eurprd04.prod.outlook.com (2603:10a6:208:66::21) authentication-results: spf=none (sender IP is ) smtp.mailfrom=aisheng.dong@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR04MB4113; 6:xKkyTCB3x+VDWRnfFJOoCy54LjwE168lk00laKHiM5UmHm3bFSsvzwPL5r7SyRlkxOoeJLYTZOxFiKx6xsGzZ0ckxM1TCiG4ZxNwvgvwiSAnO7cDCY8U0qFAGZ0epALICb1n0Tsaufl5FyVK0u03j9y8m/OGJZGs9JhvFQ16J6ffdhJBJGimb5R4NVMDwT+OqsllIWdiCcGn7LK+X424+Z774DwL4k2Z2bFpOS6tTyuTp5wXurITcZe/lzNG+WcXGjWmZcf1TDK36JXucGbZUcyTaaVNe5iJhyQvL3b9JoHZy8whSBpzU+gDBmysAvzFkPd0hAPREvyTUlUvstPBOPN2LnyZA1nTqUl8MO6qyjsg1aEdlr7AYVfgiphKexHvLNhvUQKRLJJD9WwMncBjM8YrV7doUQY50NHgtP/Vgrqd5Leb1NqTt+JJLVzhr/hrzbsubrGIku+TsNiBwRjguA==; 5:bLDO5pKbO/wpfKSXNakmpus/cje+kURg1an2CgEWwywhMZypCDuJI8URE2g0cb+jcsX8UO2jaHHJtO/BDAiBzUBOrSVgaFj3cowb2MF8mPppzOIzvPxXUx/wiJs0OMQk85Hx0ljIWC9fUIPzyKsDXS3qL0+iJV+Qdednjwh5mfc=; 7:se1K8XvYI2MRwIe+7S+XR2xFMeNU2ti/4S1TUHrmVd/tOybbz9+fhqA/fyPxbmjI4cwAOHS3YOp0SGNuabqYFUKBa3d7kb2vON0uucwrWLMvS6WLYJSemW8CWFyjaszq9F0fQAekJxW8azmrowkYKg== x-ms-office365-filtering-correlation-id: 5a657657-c2ef-4341-ab14-08d640a3669f x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM0PR04MB4113; x-ms-traffictypediagnostic: AM0PR04MB4113: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(185117386973197); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(3231382)(944501410)(52105095)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:AM0PR04MB4113; BCL:0; PCL:0; RULEID:; SRVR:AM0PR04MB4113; x-forefront-prvs: 08444C7C87 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(346002)(136003)(366004)(376002)(396003)(189003)(199004)(54534003)(8676002)(53936002)(11346002)(446003)(68736007)(86362001)(575784001)(14444005)(99286004)(81156014)(256004)(81166006)(6436002)(106356001)(2351001)(186003)(5640700003)(2906002)(7736002)(386003)(6506007)(6116002)(102836004)(478600001)(3846002)(305945005)(6486002)(76176011)(52116002)(6512007)(4326008)(6916009)(66066001)(105586002)(2900100001)(36756003)(26005)(25786009)(71190400001)(50226002)(5660300001)(316002)(97736004)(54906003)(2501003)(14454004)(8936002)(486006)(71200400001)(39060400002)(2616005)(476003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR04MB4113; H:AM0PR04MB4211.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-microsoft-antispam-message-info: 6rixkMv6f6Fw8E0HiPZ4RShhhaWodXQHoTerg1XbsTNh6Qx5VfgNMc6eBZViw7indf4/ayw3AY7v7PItbiIHz7R27KdrquHEbP4ugXlGoJKeZUIXzWWOXZv+CSWRKxJiDFztSpnAkmUkK5gVELMPDVQZmlqR3F7GbSejNXGAI4WFYhhgtdRD6d2vdVBUSze0dWi7EO6URWfDtw9m6UL5ifliqe1vP65kc0oMikszCGFEn8G6qKzqBVSqyERhCsGI5NOYe4PxeQMAgej0ayquWtmWaGFdEIMiiJ+0Ct6bFLDd0nUVFf/YhmzKWqAjAs/ItjYTu5mJoNeMNHiO1kM6eCXVfe30iGO327z3cKpYchQ= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5a657657-c2ef-4341-ab14-08d640a3669f X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Nov 2018 09:13:07.2516 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4113 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181102_021318_706409_EC8095E6 X-CRM114-Status: GOOD ( 20.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "A.s. Dong" , "dongas86@gmail.com" , "linux@armlinux.org.uk" , "robh+dt@kernel.org" , dl-linux-imx , "kernel@pengutronix.de" , Fabio Estevam , "shawnguo@kernel.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The i.MX 7ULP family of processors features NXP's advanced implementation of the Arm Cortex-A7 core, the Arm Cortex-M4 core, as well as a 3D and 2D Graphics Processing Units (GPUs). This patch aims to add an initial support for imx7ulp. Note that we need configure power mode to Partial Stop mode 3 with system/bus clock enabled first as the default enabled STOP mode will gate off system/bus clock when execute WFI in MX7ULP SoC. And there's still no MXC_CPU_IMX7ULP IDs read from register as ULP has no anatop as before. So we encode one with 0xff in reverse order in case new ones will be in the future. Cc: Shawn Guo Signed-off-by: Dong Aisheng --- ChangeLog: v3->v4: * add iounmap(smc1_base) * add comments about fixed SoC version v2->v3: * no changes v1->v2: * switch to SPDX license * more description of new SOC in commit message --- arch/arm/mach-imx/Kconfig | 9 +++++++++ arch/arm/mach-imx/Makefile | 1 + arch/arm/mach-imx/common.h | 1 + arch/arm/mach-imx/cpu.c | 3 +++ arch/arm/mach-imx/mach-imx7ulp.c | 33 +++++++++++++++++++++++++++++++++ arch/arm/mach-imx/mxc.h | 1 + arch/arm/mach-imx/pm-imx7ulp.c | 29 +++++++++++++++++++++++++++++ 7 files changed, 77 insertions(+) create mode 100644 arch/arm/mach-imx/mach-imx7ulp.c create mode 100644 arch/arm/mach-imx/pm-imx7ulp.c diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index abc3371..c12a05c 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig @@ -558,6 +558,15 @@ config SOC_IMX7D help This enables support for Freescale i.MX7 Dual processor. +config SOC_IMX7ULP + bool "i.MX7ULP support" + select ARM_GIC + select CLKSRC_IMX_TPM + select HAVE_ARM_ARCH_TIMER + select PINCTRL_IMX7ULP + help + This enables support for Freescale i.MX7 Ultra Low Power processor. + config SOC_VF610 bool "Vybrid Family VF610 support" select ARM_GIC if ARCH_MULTI_V7 diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index bae179a..8af2f7e 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile @@ -83,6 +83,7 @@ obj-$(CONFIG_SOC_IMX6SX) += mach-imx6sx.o obj-$(CONFIG_SOC_IMX6UL) += mach-imx6ul.o obj-$(CONFIG_SOC_IMX7D_CA7) += mach-imx7d.o obj-$(CONFIG_SOC_IMX7D_CM4) += mach-imx7d-cm4.o +obj-$(CONFIG_SOC_IMX7ULP) += mach-imx7ulp.o pm-imx7ulp.o ifeq ($(CONFIG_SUSPEND),y) AFLAGS_suspend-imx6.o :=-Wa,-march=armv7-a diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h index 423dd76..bc915e5 100644 --- a/arch/arm/mach-imx/common.h +++ b/arch/arm/mach-imx/common.h @@ -120,6 +120,7 @@ void imx6dl_pm_init(void); void imx6sl_pm_init(void); void imx6sx_pm_init(void); void imx6ul_pm_init(void); +void imx7ulp_pm_init(void); #ifdef CONFIG_PM void imx51_pm_init(void); diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c index c73593e..0b137ee 100644 --- a/arch/arm/mach-imx/cpu.c +++ b/arch/arm/mach-imx/cpu.c @@ -145,6 +145,9 @@ struct device * __init imx_soc_device_init(void) case MXC_CPU_IMX7D: soc_id = "i.MX7D"; break; + case MXC_CPU_IMX7ULP: + soc_id = "i.MX7ULP"; + break; default: soc_id = "Unknown"; } diff --git a/arch/arm/mach-imx/mach-imx7ulp.c b/arch/arm/mach-imx/mach-imx7ulp.c new file mode 100644 index 0000000..979ad02 --- /dev/null +++ b/arch/arm/mach-imx/mach-imx7ulp.c @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2016 Freescale Semiconductor, Inc. + * Copyright 2017-2018 NXP + * Author: Dong Aisheng + */ + +#include +#include +#include + +#include "common.h" +#include "hardware.h" + +static void __init imx7ulp_init_machine(void) +{ + imx7ulp_pm_init(); + + mxc_set_cpu_type(MXC_CPU_IMX7ULP); + /* FIXME: so far there is still no way to retrieve SoC version */ + imx_print_silicon_rev("i.MX7ULP", IMX_CHIP_REVISION_UNKNOWN); + of_platform_default_populate(NULL, NULL, imx_soc_device_init()); +} + +static const char *const imx7ulp_dt_compat[] __initconst = { + "fsl,imx7ulp", + NULL, +}; + +DT_MACHINE_START(IMX7ulp, "Freescale i.MX7ULP (Device Tree)") + .init_machine = imx7ulp_init_machine, + .dt_compat = imx7ulp_dt_compat, +MACHINE_END diff --git a/arch/arm/mach-imx/mxc.h b/arch/arm/mach-imx/mxc.h index b130a53..8e72d4e 100644 --- a/arch/arm/mach-imx/mxc.h +++ b/arch/arm/mach-imx/mxc.h @@ -44,6 +44,7 @@ #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 diff --git a/arch/arm/mach-imx/pm-imx7ulp.c b/arch/arm/mach-imx/pm-imx7ulp.c new file mode 100644 index 0000000..cf6a380 --- /dev/null +++ b/arch/arm/mach-imx/pm-imx7ulp.c @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2016 Freescale Semiconductor, Inc. + * Copyright 2017-2018 NXP + * Author: Dong Aisheng + */ + +#include +#include +#include + +#define SMC_PMCTRL 0x10 +#define BP_PMCTRL_PSTOPO 16 +#define PSTOPO_PSTOP3 0x3 + +void __init imx7ulp_pm_init(void) +{ + struct device_node *np; + void __iomem *smc1_base; + + np = of_find_compatible_node(NULL, NULL, "fsl,imx7ulp-smc1"); + smc1_base = of_iomap(np, 0); + WARN_ON(!smc1_base); + + /* Partial Stop mode 3 with system/bus clock enabled */ + writel_relaxed(PSTOPO_PSTOP3 << BP_PMCTRL_PSTOPO, + smc1_base + SMC_PMCTRL); + iounmap(smc1_base); +}