From patchwork Fri Jun 24 10:49:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102092 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp880220qgy; Fri, 24 Jun 2016 03:49:12 -0700 (PDT) X-Received: by 10.67.15.72 with SMTP id fm8mr6415257pad.50.1466765352285; Fri, 24 Jun 2016 03:49:12 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l190si6240928pfc.53.2016.06.24.03.49.12; Fri, 24 Jun 2016 03:49:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751340AbcFXKsz (ORCPT + 30 others); Fri, 24 Jun 2016 06:48:55 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:57770 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751109AbcFXKsw (ORCPT ); Fri, 24 Jun 2016 06:48:52 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0MXH2D-1at8bR06tB-00WIk7; Fri, 24 Jun 2016 12:48:12 +0200 From: Arnd Bergmann To: Shawn Guo Cc: linux-arm-kernel@lists.infradead.org, Sascha Hauer , Fabio Estevam , linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH 3/6] ARM: imx: deconstruct mx3_idle Date: Fri, 24 Jun 2016 12:49:58 +0200 Message-Id: <20160624105001.3166287-4-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160624105001.3166287-1-arnd@arndb.de> References: <20160624105001.3166287-1-arnd@arndb.de> X-Provags-ID: V03:K0:Sn3gyh0sN+HkfDgrTpvhJYoIUCo/hkY+LCfahn3GTz+3YIG0agZ +45CODdIXdp7+HsjmvlPm5Xa7k85khhfJIIJTQs6NV6WMYOSiCiOO+2mA7gBiq16Ui8EegV YS8v6MZVQyg/JHqKUu5m37nlDneUoOJuf57TjLWn9CLV9XBWhEveNkGviGRAf17qRA158yf rjARKukHxZMM6RH0z8HgQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:THi4wjZXt6w=:Pyc2m4KjHAHapbnlmLJZQP UM+xYP8HjS5sP89bYcl9kv+M66gsbc4CRCJqScxvq3oMajtQlMsBDzLR/db3k488Oib8+GUkV YKn1w+w+ZlTuCqkwBITC8wQUey6MNfBLmd7gFjIDMt5Ktczo03Nu2qqGuqcg6OvBOGKGY59q6 y9mu3EvIPY1ATauID3dqZ19TwbdXmDLE6uNZn9uei8CmaOkjlngwfCI822B2GnLvFjKlWpgJm QjMgVd6+3tb8aMilZ+hfo+VwB3JnI2ZeCKeJZjvFQm8xKzAH14ioMaLCCNzujoMqFTApQm9Qb S1fTJ5ej348u074Dwrx+ZuUhw7D7heRrTAAtGgTAeuVJr8V1wHNNeUNsisTq7rWjSC6twsH3K 55D3F4XAcLCW5kjVfJkSQXn2vcqIN4S8xxkhHcrof9FQXGC9qqz3FrSYh7y42MarYQzx+QErX eTOvl3ysYkH8hJ5HoPByVnCSIBWa5gjjKuQfUqDqVoc8CazkNnGzE5DBbnxytt5oslRecuR55 kLY/RVZqWS8U5B0nmcP7Ihk/YK6twKuL5wEXmw/Vs5PN0fM/CsRR6oCasQoRkKe4MEsxFZdc3 5xJSL1WE9RSUIRykT2IrwVxM6kLdZWhzjC9rtEYl+g+Y6A/0Xs/88AgGo+2uz8aWPsq8RLDEB NtEDQed+PW/Krr+TUVgbnU/R3SRme1BKuE4sMQd+yLqmM3rFSrnRe3mXTwOTfPV4S7bw= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The imx31 and imx35 idle functions are almost the same, but we currently have to check the cpu type every time. This can be simplified by moving the logic from mx3_cpu_lp_set() into two separate idle functions, removing the last user of cpu_is_mx35. Signed-off-by: Arnd Bergmann --- arch/arm/mach-imx/Makefile | 4 ++-- arch/arm/mach-imx/mm-imx3.c | 26 ++++++++++++++++++++++---- arch/arm/mach-imx/pm-imx3.c | 38 -------------------------------------- 3 files changed, 24 insertions(+), 44 deletions(-) delete mode 100644 arch/arm/mach-imx/pm-imx3.c -- 2.9.0 diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index 9fbe624a5ef9..9f5fffd62702 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile @@ -8,8 +8,8 @@ obj-$(CONFIG_SOC_IMX25) += cpu-imx25.o mach-imx25.o pm-imx25.o obj-$(CONFIG_SOC_IMX27) += cpu-imx27.o pm-imx27.o obj-$(CONFIG_SOC_IMX27) += mm-imx27.o ehci-imx27.o -obj-$(CONFIG_SOC_IMX31) += mm-imx3.o cpu-imx31.o iomux-imx31.o ehci-imx31.o pm-imx3.o -obj-$(CONFIG_SOC_IMX35) += mm-imx3.o cpu-imx35.o ehci-imx35.o pm-imx3.o +obj-$(CONFIG_SOC_IMX31) += mm-imx3.o cpu-imx31.o iomux-imx31.o ehci-imx31.o +obj-$(CONFIG_SOC_IMX35) += mm-imx3.o cpu-imx35.o ehci-imx35.o imx5-pm-$(CONFIG_PM) += pm-imx5.o obj-$(CONFIG_SOC_IMX5) += cpu-imx5.o $(imx5-pm-y) diff --git a/arch/arm/mach-imx/mm-imx3.c b/arch/arm/mach-imx/mm-imx3.c index 3b135cd4b043..7638a35b3b36 100644 --- a/arch/arm/mach-imx/mm-imx3.c +++ b/arch/arm/mach-imx/mm-imx3.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -38,8 +39,6 @@ static void imx3_idle(void) { unsigned long reg = 0; - mx3_cpu_lp_set(MX3_WAIT); - __asm__ __volatile__( /* disable I and D cache */ "mrc p15, 0, %0, c1, c0, 0\n" @@ -135,11 +134,20 @@ void __init mx31_map_io(void) iotable_init(mx31_io_desc, ARRAY_SIZE(mx31_io_desc)); } +static void imx31_idle(void) +{ + int reg = imx_readl(mx3_ccm_base + MXC_CCM_CCMR); + reg &= ~MXC_CCM_CCMR_LPM_MASK; + imx_writel(reg, mx3_ccm_base + MXC_CCM_CCMR); + + imx3_idle(); +} + void __init imx31_init_early(void) { mxc_set_cpu_type(MXC_CPU_MX31); arch_ioremap_caller = imx3_ioremap_caller; - arm_pm_idle = imx3_idle; + arm_pm_idle = imx31_idle; mx3_ccm_base = MX31_IO_ADDRESS(MX31_CCM_BASE_ADDR); } @@ -218,11 +226,21 @@ void __init mx35_map_io(void) iotable_init(mx35_io_desc, ARRAY_SIZE(mx35_io_desc)); } +static void imx35_idle(void) +{ + int reg = imx_readl(mx3_ccm_base + MXC_CCM_CCMR); + reg &= ~MXC_CCM_CCMR_LPM_MASK; + reg |= MXC_CCM_CCMR_LPM_WAIT_MX35; + imx_writel(reg, mx3_ccm_base + MXC_CCM_CCMR); + + imx3_idle(); +} + void __init imx35_init_early(void) { mxc_set_cpu_type(MXC_CPU_MX35); mxc_iomux_v3_init(MX35_IO_ADDRESS(MX35_IOMUXC_BASE_ADDR)); - arm_pm_idle = imx3_idle; + arm_pm_idle = imx35_idle; arch_ioremap_caller = imx3_ioremap_caller; mx3_ccm_base = MX35_IO_ADDRESS(MX35_CCM_BASE_ADDR); } diff --git a/arch/arm/mach-imx/pm-imx3.c b/arch/arm/mach-imx/pm-imx3.c deleted file mode 100644 index 94c0898751d8..000000000000 --- a/arch/arm/mach-imx/pm-imx3.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2012 Freescale Semiconductor, Inc. All Rights Reserved. - * - * The code contained herein is licensed under the GNU General Public - * License. You may obtain a copy of the GNU General Public License - * Version 2 or later at the following locations: - * - * http://www.opensource.org/licenses/gpl-license.html - * http://www.gnu.org/copyleft/gpl.html - */ -#include - -#include "common.h" -#include "crmregs-imx3.h" -#include "devices/devices-common.h" -#include "hardware.h" - -/* - * Set cpu low power mode before WFI instruction. This function is called - * mx3 because it can be used for mx31 and mx35. - * Currently only WAIT_MODE is supported. - */ -void mx3_cpu_lp_set(enum mx3_cpu_pwr_mode mode) -{ - int reg = imx_readl(mx3_ccm_base + MXC_CCM_CCMR); - reg &= ~MXC_CCM_CCMR_LPM_MASK; - - switch (mode) { - case MX3_WAIT: - if (cpu_is_mx35()) - reg |= MXC_CCM_CCMR_LPM_WAIT_MX35; - imx_writel(reg, mx3_ccm_base + MXC_CCM_CCMR); - break; - default: - pr_err("Unknown cpu power mode: %d\n", mode); - return; - } -}