From: shawn.guo@freescale.com (Shawn Guo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 15/20] ARM: imx5: reuse clock CCM mapping in pm code
Date: Tue, 20 May 2014 16:45:33 +0800 [thread overview]
Message-ID: <1400575538-21136-16-git-send-email-shawn.guo@freescale.com> (raw)
In-Reply-To: <1400575538-21136-1-git-send-email-shawn.guo@freescale.com>
The imx5 pm code needs to access CCM registers. Let's remove the use
of CCM static mapping in pm code by reusing the dynamic mapping created
in clock code.
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
---
arch/arm/mach-imx/clk-imx51-imx53.c | 2 ++
arch/arm/mach-imx/common.h | 2 ++
arch/arm/mach-imx/pm-imx5.c | 17 +++++++++++++----
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c b/arch/arm/mach-imx/clk-imx51-imx53.c
index 4b69183..4e95865 100644
--- a/arch/arm/mach-imx/clk-imx51-imx53.c
+++ b/arch/arm/mach-imx/clk-imx51-imx53.c
@@ -133,6 +133,8 @@ static void __init mx5_clocks_common_init(void __iomem *ccm_base)
{
int i;
+ imx5_pm_set_ccm_base(ccm_base);
+
clk[IMX5_CLK_DUMMY] = imx_clk_fixed("dummy", 0);
clk[IMX5_CLK_CKIL] = imx_obtain_fixed_clock("ckil", 0);
clk[IMX5_CLK_OSC] = imx_obtain_fixed_clock("osc", 0);
diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index 1d6cf4d..8aa198c 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -143,8 +143,10 @@ void imx6q_pm_set_ccm_base(void __iomem *base);
#ifdef CONFIG_PM
void imx5_pm_init(void);
+void imx5_pm_set_ccm_base(void __iomem *base);
#else
static inline void imx5_pm_init(void) {}
+static inline void imx5_pm_set_ccm_base(void __iomem *base) {}
#endif
#ifdef CONFIG_NEON
diff --git a/arch/arm/mach-imx/pm-imx5.c b/arch/arm/mach-imx/pm-imx5.c
index 7dfd005..3544c25 100644
--- a/arch/arm/mach-imx/pm-imx5.c
+++ b/arch/arm/mach-imx/pm-imx5.c
@@ -21,8 +21,7 @@
#include "cpuidle.h"
#include "hardware.h"
-#define MX51_CCM_BASE MX51_IO_ADDRESS(MX51_CCM_BASE_ADDR)
-#define MXC_CCM_CLPCR (MX51_CCM_BASE + 0x54)
+#define MXC_CCM_CLPCR 0x54
#define MXC_CCM_CLPCR_LPM_OFFSET 0
#define MXC_CCM_CLPCR_LPM_MASK 0x3
#define MXC_CCM_CLPCR_STBY_COUNT_OFFSET 9
@@ -57,6 +56,13 @@
*/
#define IMX5_DEFAULT_CPU_IDLE_STATE WAIT_UNCLOCKED_POWER_OFF
+static void __iomem *ccm_base;
+
+void __init imx5_pm_set_ccm_base(void __iomem *base)
+{
+ ccm_base = base;
+}
+
/*
* set cpu low power mode before WFI instruction. This function is called
* mx5 because it can be used for mx51, and mx53.
@@ -70,7 +76,8 @@ static void mx5_cpu_lp_set(enum mxc_cpu_pwr_mode mode)
/* always allow platform to issue a deep sleep mode request */
plat_lpc = __raw_readl(MXC_CORTEXA8_PLAT_LPC) &
~(MXC_CORTEXA8_PLAT_LPC_DSM);
- ccm_clpcr = __raw_readl(MXC_CCM_CLPCR) & ~(MXC_CCM_CLPCR_LPM_MASK);
+ ccm_clpcr = __raw_readl(ccm_base + MXC_CCM_CLPCR) &
+ ~(MXC_CCM_CLPCR_LPM_MASK);
arm_srpgcr = __raw_readl(MXC_SRPG_ARM_SRPGCR) & ~(MXC_SRPGCR_PCR);
empgc0 = __raw_readl(MXC_SRPG_EMPGC0_SRPGCR) & ~(MXC_SRPGCR_PCR);
empgc1 = __raw_readl(MXC_SRPG_EMPGC1_SRPGCR) & ~(MXC_SRPGCR_PCR);
@@ -108,7 +115,7 @@ static void mx5_cpu_lp_set(enum mxc_cpu_pwr_mode mode)
}
__raw_writel(plat_lpc, MXC_CORTEXA8_PLAT_LPC);
- __raw_writel(ccm_clpcr, MXC_CCM_CLPCR);
+ __raw_writel(ccm_clpcr, ccm_base + MXC_CCM_CLPCR);
__raw_writel(arm_srpgcr, MXC_SRPG_ARM_SRPGCR);
__raw_writel(arm_srpgcr, MXC_SRPG_NEON_SRPGCR);
@@ -188,6 +195,8 @@ static int __init imx5_pm_common_init(void)
arm_pm_idle = imx5_pm_idle;
+ WARN_ON(!ccm_base);
+
/* Set the registers to the default cpu idle state. */
mx5_cpu_lp_set(IMX5_DEFAULT_CPU_IDLE_STATE);
--
1.8.3.2
next prev parent reply other threads:[~2014-05-20 8:45 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-20 8:45 [PATCH v2 00/20] ARM: imx: clean up i.MX5 support Shawn Guo
2014-05-20 8:45 ` [PATCH 01/20] ARM: imx: move EHCI platform defines out of platform_data header Shawn Guo
2014-05-20 8:45 ` [PATCH 02/20] ARM: imx5: move SOC_IMX5 and SOC_IMX51 into 'Device tree only' Shawn Guo
2014-05-20 8:45 ` [PATCH 03/20] ARM: imx5: drop option MACH_IMX51_DT Shawn Guo
2014-05-20 8:45 ` [PATCH 04/20] ARM: imx5: remove imx51 non-DT support files Shawn Guo
2014-05-20 8:45 ` [PATCH 05/20] ARM: imx5: remove i.MX5 non-DT device registration helpers Shawn Guo
2014-05-20 9:02 ` Alexander Shiyan
2014-05-20 11:47 ` Shawn Guo
2014-05-20 8:45 ` [PATCH 06/20] ARM: imx5: make mx51_clocks_init() a DT call Shawn Guo
2014-05-20 8:45 ` [PATCH 07/20] ARM: imx5: drop arguments from mx5_clocks_common_init() Shawn Guo
2014-05-20 8:45 ` [PATCH 08/20] ARM: imx5: tzic_init_irq() can directly be .init_irq hook Shawn Guo
2014-05-20 8:45 ` [PATCH 09/20] ARM: imx5: remove function imx51_soc_init() Shawn Guo
2014-05-20 8:45 ` [PATCH 10/20] ARM: imx5: call mxc_timer_init_dt() on imx51 Shawn Guo
2014-05-20 8:45 ` [PATCH 11/20] ARM: imx5: retrieve iim base from device tree Shawn Guo
2014-05-20 8:45 ` [PATCH 12/20] ARM: imx5: remove header crm-regs-imx5.h Shawn Guo
2014-05-20 8:45 ` [PATCH 13/20] ARM: imx5: use dynamic mapping for CCM block Shawn Guo
2014-05-20 8:45 ` [PATCH 14/20] ARM: imx5: use dynamic mapping for DPLL block Shawn Guo
2014-05-20 8:45 ` Shawn Guo [this message]
2014-05-20 8:45 ` [PATCH 16/20] ARM: imx5: use dynamic mapping for Cortex and GPC block Shawn Guo
2014-05-20 8:45 ` [PATCH 17/20] ARM: imx5: move init hooks into mach-imx5x.c Shawn Guo
2014-05-20 11:53 ` Shawn Guo
2014-05-20 8:45 ` [PATCH 18/20] ARM: imx5: remove file mm-imx5.c Shawn Guo
2014-05-20 9:42 ` Alexander Shiyan
2014-05-20 11:50 ` Shawn Guo
2014-05-20 8:45 ` [PATCH 19/20] ARM: imx5: clean function declarations in mx51.h Shawn Guo
2014-05-20 8:45 ` [PATCH 20/20] ARM: imx5: remove mx51.h and mx53.h Shawn Guo
2014-05-21 6:21 ` [PATCH v2 00/20] ARM: imx: clean up i.MX5 support Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1400575538-21136-16-git-send-email-shawn.guo@freescale.com \
--to=shawn.guo@freescale.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).