From patchwork Wed Oct 31 14:43:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aisheng Dong X-Patchwork-Id: 10662839 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 A8CC217DB for ; Wed, 31 Oct 2018 15:13:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 967302AFDB for ; Wed, 31 Oct 2018 15:13:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9407C2B02E; Wed, 31 Oct 2018 15:13:13 +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 D1E352B02E for ; Wed, 31 Oct 2018 15:13:12 +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=69GlZCdGYFoMBzuvGA1JWoCUTAloRaRTzVC2AOkrkVI=; b=IU97lFJL9SjS0C v2PqKbu8mLLqXw1cjq4t0/JqQyau/claYE03gmGa80mK+oIxc7y0wIiHbl4ppsBFSYxnItSMIfPls YQAVRyoSDAHvinoLRyzTAVsrCXNAT87rERF8UxAbojFMx94xf8ra+FJCbbrbrFKDSwmkZnZsnCacg 5+dRGJRSj1K1Ot0kd/JabWmcNWgOAC7SK+oO9vSbkURN8glFSvfGhKwmxnYIgfvcRMj+SOBp+4rr3 xZBUXlusXKjdSZHc36googFwvKp3pwl+pJ78XxwsIWPkexuixeWgHcLf+VcKiXFeFj6XTO6+o7/NE u/klK6/Z7dzQw/+JJtcQ==; 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 1gHsBD-0002Gq-Ij; Wed, 31 Oct 2018 15:13:11 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHrxn-0004h2-PJ for linux-arm-kernel@bombadil.infradead.org; Wed, 31 Oct 2018 14:59:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=MIME-Version:Content-Transfer-Encoding: Content-Type:In-Reply-To:References:Message-ID:Date:Subject:CC:To:From:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=YlrObyVA1LVTNDIE3jkodWlgpZvftUPegw74FJ0RTB8=; b=aNzqNvJPqGmssqJGsSR/Kf6bwI ZTROYzozrq52PdBBUQFK9e0/zr9aMaZ9OJi3Yu2lE9ZFaKvcjSz2sYUf/hI5NJkksZuFidC+mT2Ri PrtUB6qQOFEhEhUcKGcltgzvX3UCgeAvzb+zZu6RqoHkcwq4Gh2vq0C4TzhmcPT/N9GNaXMTeKK0H rg24/HBjO/XVjcAS1xUfyshCyG1tA1pGJtvJCZ5XViBX1RZrpuAIR2FJtQql9LQKHb20ClzaxTNSc De35ndz0hMVPfYtwqr3lWImfJQ9Am7x7X/3s2g05THMYaSNHAu1e97Y2R8erigKEJU1VP3m17A+4L 6H3daWZQ==; Received: from mail-db5eur01on0074.outbound.protection.outlook.com ([104.47.2.74] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHrj2-0004OH-Iq for linux-arm-kernel@lists.infradead.org; Wed, 31 Oct 2018 14:44:06 +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=YlrObyVA1LVTNDIE3jkodWlgpZvftUPegw74FJ0RTB8=; b=dv9l4GguEWrvV/eR08GHszDDY3CRq6o3ZEFk4hIZsQhy4kk4MeFrsePoFirH99IAtIZY+KLWED9aHGnRuUv29dDGDtTI4TXfqRC7tmWHSDc6pjHxpDkyd96K/0WYf7A4S2/TOXUP+u5w/WmkfHqyfIAua7E8flflZVVaUi9nuoE= Received: from AM0PR04MB4211.eurprd04.prod.outlook.com (52.134.126.21) by AM0PR04MB4514.eurprd04.prod.outlook.com (52.135.148.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1273.26; Wed, 31 Oct 2018 14:43:22 +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.1273.028; Wed, 31 Oct 2018 14:43:22 +0000 From: "A.s. Dong" To: "linux-arm-kernel@lists.infradead.org" Subject: [PATCH V3 07/10] ARM: imx: add initial support for imx7ulp Thread-Topic: [PATCH V3 07/10] ARM: imx: add initial support for imx7ulp Thread-Index: AQHUcSgSGoBTxrm3N0ujJ+Ju8eeGiQ== Date: Wed, 31 Oct 2018 14:43:22 +0000 Message-ID: <1540996688-23681-8-git-send-email-aisheng.dong@nxp.com> References: <1540996688-23681-1-git-send-email-aisheng.dong@nxp.com> In-Reply-To: <1540996688-23681-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: HK0PR03CA0016.apcprd03.prod.outlook.com (2603:1096:203:2e::28) 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; AM0PR04MB4514; 6:M3aLjv442X19J874mpMI29BvHEavbkof7ixmBCHFAjbYlwDxcUdLkHdYUslkEuoWRmCxA6Ol6raM9N1Zhr/5xMKqkHvYNEGsWgvyg4DMU9bq7n1D4ATaPuwNLq487lE2cL3zLEgc9uWaq6SIUsZ9umLjNSVaBdPn0WY60mq5/BBJLm1W6dWw4hT8iG2Qv4M+gOtZ3RNkECr6Q3rtfJ7sAuCCJP3JK1TagC+NHAz28mP965q5cNTn/v7yJoJLcuZqnOlqnfPgxoO4XxDwN9FBuDUVGTeDBruzJEDsEd26vXJEed7iVmHs4SStVx2p278y2oEeIpcxWW/OvTQsE8Nu809mQF7Wi1f6f0HqkeWWfl3NPRgb9Dy8aR7vQikJ/xmZrqgHj3m79fYcrCT0medGhk4l+oJ2JPQ2jAJLTzwx5hIezw1LsrXyqm+xxQgoIRZxAPvh4iMp07vw2AS2sM3Jyw==; 5:TW6j3fRHYAVM6qHqX4Ob+X5q9fdIs2J+ysZlk5pf7oGUBMBUsmNwTmvts1o96ENSsf3EG5hNELDklfhtfruz9K6E/lCL0B1PuH+exBO5uMlMmXNviGuCzW0BI07P1p7ElBCjm9NJ0NlWFAd7HX4xbD4dryzoxilvIAB9knm4O1s=; 7:4HVh5XVUJeG76casgIOEqLekg8Vsf7+h0VOzw7S9daty8YVwhgwRshHU8WvVwh8y9n7BPTsfk4myCRJfvkCD+msoCmNuQduoYgkU+c+ErxBUUYtTTpFdeKp4+/g0nseVSjhDCANMwsrGSeiukWafcQ== x-ms-office365-filtering-correlation-id: 0bdc7167-bbe1-489a-5f3b-08d63f3f3488 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM0PR04MB4514; x-ms-traffictypediagnostic: AM0PR04MB4514: 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)(3231382)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:AM0PR04MB4514; BCL:0; PCL:0; RULEID:; SRVR:AM0PR04MB4514; x-forefront-prvs: 084285FC5C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(136003)(366004)(346002)(396003)(376002)(54534003)(189003)(199004)(11346002)(14444005)(446003)(14454004)(2351001)(476003)(2616005)(305945005)(7736002)(6916009)(486006)(105586002)(106356001)(2900100001)(6486002)(6436002)(256004)(2501003)(97736004)(53936002)(5640700003)(186003)(316002)(6506007)(6512007)(4326008)(54906003)(5250100002)(71190400001)(71200400001)(52116002)(575784001)(86362001)(478600001)(66066001)(99286004)(76176011)(39060400002)(36756003)(3846002)(6116002)(68736007)(25786009)(102836004)(50226002)(2906002)(81166006)(8676002)(5660300001)(386003)(8936002)(26005)(81156014); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR04MB4514; 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: HMnYPViGjg9VRp2OVSR2xwSqbttlF7D3bK6MzkPQB/1H/3Zco+5rGh1LxemCAXRL7kqDqDn/l8+47byStGNy9ucpqbNrgAVj1GFLkNZ2PsTzAb+vHnxONn0/5T9VdDWVVLogsxVXEcXkMXPhnclHZi8gSq01Cfji+W3KnaUMSNx6oL8zeekqyd5N61HzmE/iTj/4BTbGHz4ucLzCjug2PTrqkn2KlGG52uh5Z2EuSjQG2FUToeLpk3e8Sk5wiIXSnmcJAkGH7J+5BrLFWykHGhMNk6CojAFuAmp6azWiSxElkZp0T4VMHAW4bVq5lqQnr/h4YRcB3KLs4oFDJLnZjmYZidiCEpHTRODEz6Ck80U= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0bdc7167-bbe1-489a-5f3b-08d63f3f3488 X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Oct 2018 14:43:22.1789 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4514 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181031_144404_631300_DF73C15A X-CRM114-Status: GOOD ( 22.90 ) 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: 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 | 32 ++++++++++++++++++++++++++++++++ arch/arm/mach-imx/mxc.h | 1 + arch/arm/mach-imx/pm-imx7ulp.c | 28 ++++++++++++++++++++++++++++ 7 files changed, 75 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..ad8be07 --- /dev/null +++ b/arch/arm/mach-imx/mach-imx7ulp.c @@ -0,0 +1,32 @@ +// 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); + imx_print_silicon_rev("i.MX7ULP", IMX_CHIP_REVISION_1_0); + 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..9fb7da0 --- /dev/null +++ b/arch/arm/mach-imx/pm-imx7ulp.c @@ -0,0 +1,28 @@ +// 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); +}