From patchwork Sat Nov 10 15:13:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dong Aisheng X-Patchwork-Id: 995912 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="iOmksYvs"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="Ww75BSLA"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42sgXb0Wzfz9s9G for ; Sun, 11 Nov 2018 02:14:07 +1100 (AEDT) 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=iOmksYvsCnSIoz 55ySdKcU6qRon7cQquhrLiOrZtJ/g3tx1NOtC6jDrmJem0CG+6o1V9/d5bwnPrrEe7mktIhqWUlS5 Zj/O81Brg5+FO72EXxdKRIoTjt1iJrSc+rSb6WUZDkpDevu2HcGE3y1w04PMlvJwDRp41NGN/Mlks o16Zn/DZzj1kD+eGmwdPG4RtTqS4qSn0yCyRVDtO9yR6Y1oe53EXuuJJEoUftI99Bl4JYyFUAraAA C8Ldu8is5Devk7SIh9eT9Ec/MaRkiQziYZ6sxggKg/ndsnOy25H2+bxPwwRYkh2uSabPQDL3CVI5u yx7KUg66fxGWIeXb0y0g==; 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 1gLUxT-0006oW-Ju; Sat, 10 Nov 2018 15:13:59 +0000 Received: from mail-ve1eur02on062d.outbound.protection.outlook.com ([2a01:111:f400:fe06::62d] helo=EUR02-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gLUwz-0006G1-7V for linux-arm-kernel@lists.infradead.org; Sat, 10 Nov 2018 15:13:30 +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=Ww75BSLAzv8MKpI0u5djkAzgpKd4bTFAcBmsjTsOIDJPVr8nIIxxyfYrXwvZJLlFAF/KiryrM2xtqz2oF0SN7ABo1lHzFFUl1Y60uriJBOtR+CQJwOUvlMR6SBP1j48yWyh0fjQQld6rxr9sNg5C6mDsw9xkq7RC2Wl42yFbD7Y= Received: from AM0PR04MB4211.eurprd04.prod.outlook.com (52.134.126.21) by AM0PR04MB4818.eurprd04.prod.outlook.com (20.176.215.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.21; Sat, 10 Nov 2018 15:13:04 +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.039; Sat, 10 Nov 2018 15:13:04 +0000 From: "A.s. Dong" To: "linux-arm-kernel@lists.infradead.org" Subject: [PATCH V5 3/6] ARM: imx: add initial support for imx7ulp Thread-Topic: [PATCH V5 3/6] ARM: imx: add initial support for imx7ulp Thread-Index: AQHUeQfguvVV65vLYEacvXQo5LM9MQ== Date: Sat, 10 Nov 2018 15:13:04 +0000 Message-ID: <1541862478-7839-4-git-send-email-aisheng.dong@nxp.com> References: <1541862478-7839-1-git-send-email-aisheng.dong@nxp.com> In-Reply-To: <1541862478-7839-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: HK0PR01CA0010.apcprd01.prod.exchangelabs.com (2603:1096:203:92::22) 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; AM0PR04MB4818; 6:1SO6K9HokjYbC3MgIA/uQFGQ9CYXSmGLcWX01mlw2NSO2TAyzjTWe+GwiRFO0Q56e94lnVMi0ZdBYWRzGl9KArx0BJTSOH8lLPgoDyfzncX2q+4I0vuwkIvNAJ0AucmWBbDkS4PNbg0WPwmWMykCn2WSmGUJkeoylBR/Iyb2RmMJHft54ziJDRUPlviP+o626I0xvqwlBTGnZyxygkbKDjf7KMDk3Gtuv0cteiDi00fE7KDci1+nVovwrbozkKR3apoj2OXyaIBvoJIugYZmP7k42wfryLBs6X0gEIprwqbHXU+3JoSJsagIwqMwIs6DQQ3HxUkksh8fB2dtTvpZFOWIuzUtQebPunbNWdo4ZmcYzBNq0dSpvLVGjXuIXNV32Oe5TfAS+HtTrXp7Pp5cSCvBsS0up2EWfIgkxsbtiTWM9H4st2+cAiCOaS+sa6nI6hICdnUEZSu0bewUdo7UeQ==; 5:UeK3tz6kc3vloukTZ3yntEbHGyKTf5Ou1DII1V+IIWyJoDmxg9ailP5rB7r1ND2+kyiw0X8VfcYNpXlWV1+oNV1gEDnDNtT9Kq8bbPt60Fb4FMYFhKM/KuoIgdNbMetjXkRvGsW69MUSNSNgk6ryIE3rAQnghxHhzjzGqL5v6hs=; 7:4sreUZAjtPZM0Ih9fQDge+y7UYKwD9JCE53yk5JWXZkisHeOcww/MV3T/kBOj6nUlrMiIKfsGj5cc7IwZMeeyN6yEH30iaFf+gJAq/ZGz7b2oVFxGM6uiwSFcaB61bW6yiax7XKlDHmp/8UfTv9ciQ== x-ms-office365-filtering-correlation-id: 35c9c1db-4aaa-4a01-5cb0-08d6471f02ed x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390040)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM0PR04MB4818; x-ms-traffictypediagnostic: AM0PR04MB4818: 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)(20161123564045)(20161123560045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:AM0PR04MB4818; BCL:0; PCL:0; RULEID:; SRVR:AM0PR04MB4818; x-forefront-prvs: 0852EB6797 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(396003)(346002)(39850400004)(366004)(136003)(199004)(189003)(54534003)(54906003)(50226002)(2501003)(76176011)(316002)(386003)(106356001)(102836004)(105586002)(6506007)(68736007)(3846002)(6116002)(36756003)(6916009)(52116002)(2906002)(66066001)(99286004)(97736004)(5660300001)(305945005)(575784001)(86362001)(7736002)(2616005)(5640700003)(4326008)(39060400002)(53936002)(6512007)(476003)(2900100001)(25786009)(14454004)(26005)(11346002)(486006)(6486002)(186003)(256004)(478600001)(2351001)(8936002)(8676002)(446003)(81156014)(6436002)(71190400001)(71200400001)(14444005)(81166006); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR04MB4818; H:AM0PR04MB4211.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-microsoft-antispam-message-info: iqlAVjf8dvLz+GLMvqQ4WaI3Ms5zc44qmuT2h6I/NRcdFgeDvGKlTyjheWa2L3Ve0ho/iMgk2lePgbMRErYffcdo2t4B2F+OSWvB50I0w2YgE2DNET/HXcVqU+U7+l+IZVWf3fD/9r6z55FwCDkUrwCw5Tmk+Z/4e9Xn5EWQ2e73mmvizQKbUNQdplZV1sAAFDQqOWQ0IQl0EKRPp1iS/Nt0MWp95yFU+UGAYhJt3iCuzr+wwhavAtUpi7s1s514I3bLRZjJbIh5bWg6pIo9OIVpqaBAQP2InpUZspc5bSJblaBbWt7pImTclwtZHKrlImb0rndqup0/R42VAV0XnCxtYdYE10yb6PoccLHaj/A= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 35c9c1db-4aaa-4a01-5cb0-08d6471f02ed X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Nov 2018 15:13:04.2565 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4818 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181110_071329_291757_C65B7BCD X-CRM114-Status: GOOD ( 20.79 ) 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 http://www.dnswl.org/, no trust [2a01:111:f400:fe06:0:0:0:62d listed in] [list.dnswl.org] 0.0 T_SPF_PERMERROR SPF: test of record failed (permerror) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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_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.21 Precedence: list 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+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org 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 Reviewed-by: Fabio Estevam --- 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); +}