From patchwork Thu Aug 6 16:56:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anson Huang X-Patchwork-Id: 6957481 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EFE5A9F38B for ; Thu, 6 Aug 2015 09:48:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 11530205D1 for ; Thu, 6 Aug 2015 09:48:25 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DA6AE2050E for ; Thu, 6 Aug 2015 09:48:23 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZNHkc-00070w-Ov; Thu, 06 Aug 2015 09:46:14 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZNHka-00070Y-1O for linux-arm-kernel@bombadil.infradead.org; Thu, 06 Aug 2015 09:46:12 +0000 Received: from mail-bl2on0104.outbound.protection.outlook.com ([65.55.169.104] helo=na01-bl2-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.85 #2 (Red Hat Linux)) id 1ZNH7I-000179-As for linux-arm-kernel@lists.infradead.org; Thu, 06 Aug 2015 09:05:37 +0000 Received: from CH1PR03CA008.namprd03.prod.outlook.com (10.255.156.153) by CY1PR0301MB1273.namprd03.prod.outlook.com (10.161.214.21) with Microsoft SMTP Server (TLS) id 15.1.225.19; Thu, 6 Aug 2015 09:05:13 +0000 Received: from BL2FFO11FD026.protection.gbl (10.255.156.132) by CH1PR03CA008.outlook.office365.com (10.255.156.153) with Microsoft SMTP Server (TLS) id 15.1.225.19 via Frontend Transport; Thu, 6 Aug 2015 09:05:12 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; pengutronix.de; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BL2FFO11FD026.mail.protection.outlook.com (10.173.161.105) with Microsoft SMTP Server (TLS) id 15.1.243.9 via Frontend Transport; Thu, 6 Aug 2015 09:05:12 +0000 Received: from anson-OptiPlex-790.ap.freescale.net (anson-OptiPlex-790.ap.freescale.net [10.192.242.118]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id t769592b025435; Thu, 6 Aug 2015 02:05:10 -0700 From: Anson Huang To: Subject: [PATCH V3] ARM: imx: add cpuidle support for i.mx6ul Date: Fri, 7 Aug 2015 00:56:22 +0800 Message-ID: <1438880182-6260-1-git-send-email-b20788@freescale.com> X-Mailer: git-send-email 1.9.1 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD026; 1:n8xkbflmqr2hPHeZAgqaoZGA/fwny8AMIVUyD+ksoB4LWJaw+CpW4bp6jAbIYeX3ty6Ti4bpAtiDHbYo0tDw1+af1acxZcz9p8k4mnW3GsNiyJzimaSxk666AOiAuI0Fm4DSHD5eH6R1VbeMTTQgOu9G+640fyZ2/6bhbuPqiBJGD1gF0v8z2nnmy4qpdja29W2Yo4s8IL1Pmz+TtFrI0l8XRgKSK4/xvWvPa1UvqX8E488t3p05tzGonWOc8isecBlx/zxF4OQlaCFDwnB41CpaSoDWgNiD1gufapxgEQwv5Yx8hzIbToqYveFP+l/q X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(339900001)(189002)(199003)(51164003)(64706001)(5001960100002)(87936001)(97736004)(5001830100001)(5001920100001)(5001860100001)(19580395003)(19580405001)(110136002)(6806004)(105606002)(47776003)(50226001)(81156007)(50986999)(106466001)(33646002)(69596002)(92566002)(50466002)(48376002)(104016003)(2351001)(229853001)(85426001)(62966003)(46102003)(189998001)(5003940100001)(4001540100001)(68736005)(77096005)(36756003)(77156002)(21314002)(2004002)(42262002); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR0301MB1273; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1273; 2:Gd2sZYrovP9vxeW/A2hHGZoMeWAn3S4w/TQldWhk7SczxlAZrZ6a2vPXPR/Cd6/BNScR5FL8Fvae3HCZr+knWk42q3mbaHjwuI511dGqFs7RFCFSwCN/zY2R9FgaJ6apXPPcQ+7aWoToFyGEgIT64Z3VUNjpuPrCQS3VAuAR9Lk=; 3:3NkHzQKhMfO+S0KktMkSf9IfjujUw2q6RasP/Nty1wG2iyihEKUrMsxZXfS4rjd0TOgWunoifIl+wpZNbzkAW7w16dEKLpDHhK0tOUPq/jrOr/gX5mPi7loyIE5pZhdsPP5ziW8seBBS+RkjAWaGQnAINa4VGxUcpSgLIcXcmhM/zTee093qs1UXDOnI0sar7y+bJHeu96cMdvtV+o4XT8MD9jNvkuSuuTSwnJMzoqg=; 25:pfgNI1okjwUjnmTM/Hc+eJ+W1NDaORxg2SLlbPwlQAT1569TtKqc8Jocq7DAn+JPmejwVWcyZKTIgDbpeG33n0f8gMXSfJ6aeX/tmm0VZ843uSOrGTAN5yn8RUX5T+mzyuBSkUX0QafrfKaOXoHNoy9cUETM+dyWByTH/ALSfxWvk1kUOren3TQREEaKIp+NwyWScP5UdpKt607/g6e7HbgRRu2VMRWIiPz4D7ONjhwGhPRnhv9g9ryDDQx1TxLQN4MmVnTrjDchrIqE1sog4w== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB1273; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1273; 20:4F0MdzvEjLFo5yTrItL4kj8+LCCCr2J9I9ZmFhCbhQovN7awfpbLhiQZmVF5rRi+3+OEWfiz/r6vIsmiPGJwi2Qg7XlknuJsJsqM48bMb+FRGdqrfiLE8PFRd//ZFDDvdCtlaFZcrRHkDiWG16C89rexE0teKt/sr87s+8GG/YUGHBc0BvQvAt+AHjIBZSKxinFgxjQi5KvaEFgslTRdpx0qrF/wc1Fmf4lr+IAVMP1jCjVrRVCIJq/zg/agCP2zick2JA6weFeIGFv+VrVVxCLLCwVER1OyWr6M7npejvCwEV3yxbQ2x84x9oEBcKjdcyZig3DK75qKmpwxkpFbvcjJQtpgIsTrVnASEPDLBd4=; 4:UcS5C2emlOe0PiWNBmoOvozERSThvwoUkXsfyAS9KtCmcy9GB97cXu+JedZIwfNU+nayHe+JF3EIjSk1fNUM64M73yeULwM4ciOtV/qxq7qNYRHQEya4Lzx3SWsuHoDaAeIsO9rpfJawT9HPNYLFRh+37OR9O3tc+af9Rre70nnk90g2aD8JEjRIAlvD3dI4fqy8FCcaKHaFHDbJbzNO8s8BldR6C0MhO/4izhPa8QXLvDvsl0TaIFSY/GuJD8ocMOIRUCpdtpulIeYz3wslQILDr+p9QU2lWuYhvGJTe9k= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:CY1PR0301MB1273; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0301MB1273; X-Forefront-PRVS: 06607E485E X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB1273; 23:JBWJxhh+SOEGuVVtOS+jIA1/t9Mp/g27Qgsr4et?=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aoHvsxWU1TBX8wEkP6oT6GL?= =?us-ascii?Q?G3DKBlhZD28FSrB9OgqE8Ki2NsVG7C2k5O9YYzgGdRH83I5mA/tagvkl6VCR?= =?us-ascii?Q?GyzIj9Au/fvEW5aYqKP2DXLZcjXMTvUEmfsT3CxHitghxT/GTOgTkLyNfiFz?= =?us-ascii?Q?xQpPjqoxRq9rJxfF4JV6/BlLeeR9FHcHGwfr2TtJaSu+DPanvBj7dLAufOv4?= =?us-ascii?Q?OTXBtaDnlePGJAMr93hVovU/rr3WQj2iy3PtbTk1v/tSbUcLI2exFHw=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1273; 5:LIOg/HWvrBOnZrfRreZXy++ckO0Amu2nHZrr8vmq9qJSlkw21ymRryFLr3fTgM7wBRnXU9GTPYgY4FtsyumeU5tGWS62nR5RunZytxt5YJh6OBIEyp00iCzZQ98fBvshjIVNUe2JIt0S6stqTBswKg==; 24:QkS5qVSbw/WohPBdqFwzuG/JDsX80GFHviYGVDpxesd41lARXozpS7XBjNnPWeA8ipRdeMi4f0rUoDhuxZArQyGdDUjRanNfDvghjXNTibU=; 20:iBTDvwNQFoiQ5vD0vUsQ30LanixYpiiGd1VZ3a5jBiUVhp7fVEtvMKNmSgKsktfYBR5hUkoaQGw9JAPK95OWZg== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Aug 2015 09:05:12.2148 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0301MB1273 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150806_050536_557892_1E0B2D56 X-CRM114-Status: GOOD ( 20.13 ) X-Spam-Score: 0.0 (/) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: shawnguo@kernel.org, kernel@pengutronix.de Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.4 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, DATE_IN_FUTURE_06_12, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds cpuidle support for i.MX6UL, it shares cpuidle driver with i.MX6SX, total 3 levels of cpuidle are supported as below: 1. ARM WFI; 2. SOC in WAIT mode; 3. SOC in WAIT mode + ARM power off. Signed-off-by: Anson Huang --- I am NOT sure if using cpu_is_xxx() here to distinguish i.MX6UL from i.MX6SX is good enough, as I saw many other patches are trying to avoid using such cpu_is_xxx() API. Obviously we have many other ways to identify if the ARM core is a Cortex-A9 or Cortex-A7, they have different L2 cache implemented, so cache operation is different. Please advise if you have better idea about this point, thanks! arch/arm/mach-imx/cpuidle-imx6sx.c | 8 +++++++- arch/arm/mach-imx/mach-imx6ul.c | 9 +++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-imx/cpuidle-imx6sx.c b/arch/arm/mach-imx/cpuidle-imx6sx.c index 3c6672b..e1ce40c 100644 --- a/arch/arm/mach-imx/cpuidle-imx6sx.c +++ b/arch/arm/mach-imx/cpuidle-imx6sx.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014 Freescale Semiconductor, Inc. + * Copyright (C) 2014-2015 Freescale Semiconductor, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -9,14 +9,20 @@ #include #include #include +#include #include #include #include "common.h" #include "cpuidle.h" +#include "hardware.h" static int imx6sx_idle_finish(unsigned long val) { + /* flush internal L2 cache if necessary */ + if (cpu_is_imx6ul()) + flush_cache_all(); + cpu_do_idle(); return 0; diff --git a/arch/arm/mach-imx/mach-imx6ul.c b/arch/arm/mach-imx/mach-imx6ul.c index f206506..3fe37ab 100644 --- a/arch/arm/mach-imx/mach-imx6ul.c +++ b/arch/arm/mach-imx/mach-imx6ul.c @@ -11,6 +11,7 @@ #include #include "common.h" +#include "cpuidle.h" static void __init imx6ul_init_machine(void) { @@ -29,6 +30,13 @@ static void __init imx6ul_init_irq(void) imx_init_revision_from_anatop(); imx_src_init(); irqchip_init(); + imx6_pm_ccm_init("fsl,imx6ul-ccm"); +} + +static void __init imx6ul_init_late(void) +{ + /* share cpuidle driver with i.MX6SX */ + imx6sx_cpuidle_init(); } static const char *imx6ul_dt_compat[] __initconst = { @@ -40,4 +48,5 @@ DT_MACHINE_START(IMX6UL, "Freescale i.MX6 Ultralite (Device Tree)") .init_irq = imx6ul_init_irq, .init_machine = imx6ul_init_machine, .dt_compat = imx6ul_dt_compat, + .init_late = imx6ul_init_late, MACHINE_END