All of lore.kernel.org
 help / color / mirror / Atom feed
From: s.hauer@pengutronix.de (Sascha Hauer)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 26/40] ARM i.MX3: Make ccm base address a variable
Date: Tue, 10 Apr 2012 15:45:39 +0200	[thread overview]
Message-ID: <1334065553-7565-27-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1334065553-7565-1-git-send-email-s.hauer@pengutronix.de>

Instead of having a cpu_is_* in each ccm register access it
is mor efficient to make it a variable.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-imx/crmregs-imx3.h |   79 +++++++++++++++++++-------------------
 arch/arm/mach-imx/mm-imx3.c      |    6 +++
 arch/arm/mach-imx/pm-imx3.c      |    4 +-
 3 files changed, 47 insertions(+), 42 deletions(-)

diff --git a/arch/arm/mach-imx/crmregs-imx3.h b/arch/arm/mach-imx/crmregs-imx3.h
index 5314127..a1dfde5 100644
--- a/arch/arm/mach-imx/crmregs-imx3.h
+++ b/arch/arm/mach-imx/crmregs-imx3.h
@@ -24,48 +24,47 @@
 #define CKIH_CLK_FREQ_27MHZ     27000000
 #define CKIL_CLK_FREQ           32768
 
-#define MXC_CCM_BASE		(cpu_is_mx31() ? \
-MX31_IO_ADDRESS(MX31_CCM_BASE_ADDR) : MX35_IO_ADDRESS(MX35_CCM_BASE_ADDR))
+extern void __iomem *mx3_ccm_base;
 
 /* Register addresses */
-#define MXC_CCM_CCMR		(MXC_CCM_BASE + 0x00)
-#define MXC_CCM_PDR0		(MXC_CCM_BASE + 0x04)
-#define MXC_CCM_PDR1		(MXC_CCM_BASE + 0x08)
-#define MX35_CCM_PDR2		(MXC_CCM_BASE + 0x0C)
-#define MXC_CCM_RCSR		(MXC_CCM_BASE + 0x0C)
-#define MX35_CCM_PDR3		(MXC_CCM_BASE + 0x10)
-#define MXC_CCM_MPCTL		(MXC_CCM_BASE + 0x10)
-#define MX35_CCM_PDR4		(MXC_CCM_BASE + 0x14)
-#define MXC_CCM_UPCTL		(MXC_CCM_BASE + 0x14)
-#define MX35_CCM_RCSR		(MXC_CCM_BASE + 0x18)
-#define MXC_CCM_SRPCTL		(MXC_CCM_BASE + 0x18)
-#define MX35_CCM_MPCTL		(MXC_CCM_BASE + 0x1C)
-#define MXC_CCM_COSR		(MXC_CCM_BASE + 0x1C)
-#define MX35_CCM_PPCTL		(MXC_CCM_BASE + 0x20)
-#define MXC_CCM_CGR0		(MXC_CCM_BASE + 0x20)
-#define MX35_CCM_ACMR		(MXC_CCM_BASE + 0x24)
-#define MXC_CCM_CGR1		(MXC_CCM_BASE + 0x24)
-#define MX35_CCM_COSR		(MXC_CCM_BASE + 0x28)
-#define MXC_CCM_CGR2		(MXC_CCM_BASE + 0x28)
-#define MX35_CCM_CGR0		(MXC_CCM_BASE + 0x2C)
-#define MXC_CCM_WIMR		(MXC_CCM_BASE + 0x2C)
-#define MX35_CCM_CGR1		(MXC_CCM_BASE + 0x30)
-#define MXC_CCM_LDC		(MXC_CCM_BASE + 0x30)
-#define MX35_CCM_CGR2		(MXC_CCM_BASE + 0x34)
-#define MXC_CCM_DCVR0		(MXC_CCM_BASE + 0x34)
-#define MX35_CCM_CGR3		(MXC_CCM_BASE + 0x38)
-#define MXC_CCM_DCVR1		(MXC_CCM_BASE + 0x38)
-#define MXC_CCM_DCVR2		(MXC_CCM_BASE + 0x3C)
-#define MXC_CCM_DCVR3		(MXC_CCM_BASE + 0x40)
-#define MXC_CCM_LTR0		(MXC_CCM_BASE + 0x44)
-#define MXC_CCM_LTR1		(MXC_CCM_BASE + 0x48)
-#define MXC_CCM_LTR2		(MXC_CCM_BASE + 0x4C)
-#define MXC_CCM_LTR3		(MXC_CCM_BASE + 0x50)
-#define MXC_CCM_LTBR0		(MXC_CCM_BASE + 0x54)
-#define MXC_CCM_LTBR1		(MXC_CCM_BASE + 0x58)
-#define MXC_CCM_PMCR0		(MXC_CCM_BASE + 0x5C)
-#define MXC_CCM_PMCR1		(MXC_CCM_BASE + 0x60)
-#define MXC_CCM_PDR2		(MXC_CCM_BASE + 0x64)
+#define MXC_CCM_CCMR		0x00
+#define MXC_CCM_PDR0		0x04
+#define MXC_CCM_PDR1		0x08
+#define MX35_CCM_PDR2		0x0C
+#define MXC_CCM_RCSR		0x0C
+#define MX35_CCM_PDR3		0x10
+#define MXC_CCM_MPCTL		0x10
+#define MX35_CCM_PDR4		0x14
+#define MXC_CCM_UPCTL		0x14
+#define MX35_CCM_RCSR		0x18
+#define MXC_CCM_SRPCTL		0x18
+#define MX35_CCM_MPCTL		0x1C
+#define MXC_CCM_COSR		0x1C
+#define MX35_CCM_PPCTL		0x20
+#define MXC_CCM_CGR0		0x20
+#define MX35_CCM_ACMR		0x24
+#define MXC_CCM_CGR1		0x24
+#define MX35_CCM_COSR		0x28
+#define MXC_CCM_CGR2		0x28
+#define MX35_CCM_CGR0		0x2C
+#define MXC_CCM_WIMR		0x2C
+#define MX35_CCM_CGR1		0x30
+#define MXC_CCM_LDC		0x30
+#define MX35_CCM_CGR2		0x34
+#define MXC_CCM_DCVR0		0x34
+#define MX35_CCM_CGR3		0x38
+#define MXC_CCM_DCVR1		0x38
+#define MXC_CCM_DCVR2		0x3C
+#define MXC_CCM_DCVR3		0x40
+#define MXC_CCM_LTR0		0x44
+#define MXC_CCM_LTR1		0x48
+#define MXC_CCM_LTR2		0x4C
+#define MXC_CCM_LTR3		0x50
+#define MXC_CCM_LTBR0		0x54
+#define MXC_CCM_LTBR1		0x58
+#define MXC_CCM_PMCR0		0x5C
+#define MXC_CCM_PMCR1		0x60
+#define MXC_CCM_PDR2		0x64
 
 /* Register bit definitions */
 #define MXC_CCM_CCMR_WBEN                       (1 << 27)
diff --git a/arch/arm/mach-imx/mm-imx3.c b/arch/arm/mach-imx/mm-imx3.c
index 7412738..57b39f8 100644
--- a/arch/arm/mach-imx/mm-imx3.c
+++ b/arch/arm/mach-imx/mm-imx3.c
@@ -31,6 +31,10 @@
 #include <mach/iomux-v3.h>
 #include <mach/irqs.h>
 
+#include "crmregs-imx3.h"
+
+void __iomem *mx3_ccm_base;
+
 static void imx3_idle(void)
 {
 	unsigned long reg = 0;
@@ -137,6 +141,7 @@ void __init imx31_init_early(void)
 	mxc_arch_reset_init(MX31_IO_ADDRESS(MX31_WDOG_BASE_ADDR));
 	arch_ioremap_caller = imx3_ioremap_caller;
 	arm_pm_idle = imx3_idle;
+	mx3_ccm_base = MX31_IO_ADDRESS(MX31_CCM_BASE_ADDR);
 }
 
 void __init mx31_init_irq(void)
@@ -210,6 +215,7 @@ void __init imx35_init_early(void)
 	mxc_arch_reset_init(MX35_IO_ADDRESS(MX35_WDOG_BASE_ADDR));
 	arm_pm_idle = imx3_idle;
 	arch_ioremap_caller = imx3_ioremap_caller;
+	mx3_ccm_base = MX35_IO_ADDRESS(MX35_CCM_BASE_ADDR);
 }
 
 void __init mx35_init_irq(void)
diff --git a/arch/arm/mach-imx/pm-imx3.c b/arch/arm/mach-imx/pm-imx3.c
index b375243..822103b 100644
--- a/arch/arm/mach-imx/pm-imx3.c
+++ b/arch/arm/mach-imx/pm-imx3.c
@@ -21,14 +21,14 @@
  */
 void mx3_cpu_lp_set(enum mx3_cpu_pwr_mode mode)
 {
-	int reg = __raw_readl(MXC_CCM_CCMR);
+	int reg = __raw_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;
-		__raw_writel(reg, MXC_CCM_CCMR);
+		__raw_writel(reg, mx3_ccm_base + MXC_CCM_CCMR);
 		break;
 	default:
 		pr_err("Unknown cpu power mode: %d\n", mode);
-- 
1.7.9.5

  parent reply	other threads:[~2012-04-10 13:45 UTC|newest]

Thread overview: 101+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-10 13:45 Convert i.MX architecture to generic clock framework Sascha Hauer
2012-04-10 13:45 ` [PATCH 01/40] clkdev: add clkname to struct clk_lookup Sascha Hauer
2012-04-10 14:30   ` Russell King - ARM Linux
2012-04-10 16:11     ` Sascha Hauer
2012-04-11  1:11       ` Richard Zhao
2012-04-11  8:24         ` Mark Brown
2012-04-11  8:45           ` Richard Zhao
2012-04-11  9:15             ` Mark Brown
2012-04-11  9:21               ` Russell King - ARM Linux
2012-04-11  9:32                 ` Mark Brown
2012-04-11  9:41                   ` Russell King - ARM Linux
2012-04-11 10:31                     ` Mark Brown
2012-04-11 11:43                       ` Russell King - ARM Linux
2012-04-12 16:33                         ` Mark Brown
2012-04-11  9:20             ` Russell King - ARM Linux
2012-04-11  9:42               ` Sascha Hauer
2012-04-11  9:47                 ` Russell King - ARM Linux
2012-04-13  3:33                   ` Viresh Kumar
2012-04-13  4:17                     ` Shawn Guo
2012-04-13  5:06                       ` Viresh Kumar
2012-04-13  5:22                         ` Shawn Guo
2012-04-13  8:59                           ` Mark Brown
2012-04-13  9:10                             ` Viresh Kumar
2012-04-13  9:17                               ` Richard Zhao
2012-04-13  9:26                                 ` Russell King - ARM Linux
2012-04-13  9:27                                   ` Viresh Kumar
2012-04-13  9:36                                     ` Russell King - ARM Linux
2012-04-13 10:02                                       ` Viresh Kumar
2012-04-13 10:08                                         ` Mark Brown
2012-04-13 10:20                                         ` Russell King - ARM Linux
2012-04-13 10:43                                           ` Viresh Kumar
2012-04-13 23:19                                           ` Turquette, Mike
2012-04-24  2:17               ` Richard Zhao
2012-04-10 13:45 ` [PATCH 02/40] clk: add a fixed factor clock Sascha Hauer
2012-04-17 10:15   ` Viresh Kumar
2012-04-19  3:48   ` Viresh Kumar
2012-04-19  6:16     ` Domenico Andreoli
2012-04-19  6:19       ` Viresh Kumar
2012-04-19  6:45     ` Sascha Hauer
2012-04-10 13:45 ` [PATCH 03/40] clk: declare clk_ops of basic clks in clk-provider.h Sascha Hauer
2012-04-10 13:45 ` [PATCH 04/40] dmaengine i.MX SDMA: do not depend on grouped clocks Sascha Hauer
2012-04-10 13:45 ` [PATCH 05/40] spi i.MX: " Sascha Hauer
2012-04-10 13:45 ` [PATCH 06/40] video imxfb: " Sascha Hauer
2012-04-10 13:45 ` [PATCH 07/40] net fec: " Sascha Hauer
2012-04-10 13:45 ` [PATCH 08/40] mmc mxcmmc: " Sascha Hauer
2012-04-10 13:45 ` [PATCH 09/40] mmc sdhc i.MX: " Sascha Hauer
2012-04-20  2:06   ` Richard Zhao
2012-04-20  2:42     ` Richard Zhao
2012-04-10 13:45 ` [PATCH 10/40] serial " Sascha Hauer
2012-04-10 13:45 ` [PATCH 11/40] mtd mxc_nand: prepare/unprepare clock Sascha Hauer
2012-04-10 13:45 ` [PATCH 12/40] USB ehci mxc: " Sascha Hauer
2012-04-10 13:45 ` [PATCH 13/40] w1 i.MX: " Sascha Hauer
2012-04-10 13:45 ` [PATCH 14/40] watchdog imx2: prepare clk before enabling it Sascha Hauer
2012-04-10 13:45 ` [PATCH 15/40] media mx3 camera: " Sascha Hauer
2012-04-10 13:45 ` [PATCH 16/40] dmaengine i.MX ipu: clk_prepare/unprepare clock Sascha Hauer
2012-04-10 13:45 ` [PATCH 17/40] ARM i.MX5: prepare gpc_dvfs_clk Sascha Hauer
2012-04-10 13:45 ` [PATCH 18/40] ARM i.MX: prepare for common clock framework Sascha Hauer
2012-04-10 13:45 ` [PATCH 19/40] ARM i.MX timer: request correct clock Sascha Hauer
2012-04-10 13:45 ` [PATCH 20/40] ARM i.MX: Add common clock support for pllv1 Sascha Hauer
2012-04-10 13:45 ` [PATCH 21/40] ARM i.MX: Add common clock support for pllv2 Sascha Hauer
2012-04-10 13:45 ` [PATCH 22/40] ARM: imx: add common clock support for pllv3 Sascha Hauer
2012-04-10 13:45 ` [PATCH 23/40] ARM i.MX: Add common clock support for 2bit gate Sascha Hauer
2012-04-19  7:00   ` Shawn Guo
2012-04-19  7:15     ` Richard Zhao
2012-04-19  7:26     ` Lei Wen
2012-04-19  7:52       ` Domenico Andreoli
2012-04-10 13:45 ` [PATCH 24/40] ARM: imx: add common clock support for pfd Sascha Hauer
2012-04-10 13:45 ` [PATCH 25/40] ARM: imx: add common clock support for clk busy Sascha Hauer
2012-04-10 18:59   ` Stephen Boyd
2012-04-11  6:53     ` Sascha Hauer
2012-04-11 22:21       ` Stephen Boyd
2012-04-12  3:30         ` Shawn Guo
2012-04-12  1:50   ` Richard Zhao
2012-04-12  2:44     ` Shawn Guo
2012-04-13  2:09   ` [PATCH] ARM: imx: remove clk_hw from clk_busy Shawn Guo
2012-04-13 14:34     ` Sascha Hauer
2012-04-10 13:45 ` Sascha Hauer [this message]
2012-04-10 13:45 ` [PATCH 27/40] ARM i.MX25: implement clocks using common clock framework Sascha Hauer
2012-04-10 20:10   ` Roberto Nibali
2012-04-10 20:45     ` Fabio Estevam
2012-04-11  7:01       ` Roberto Nibali
2012-04-10 13:45 ` [PATCH 28/40] ARM i.MX1: " Sascha Hauer
2012-04-16 21:07   ` Sascha Hauer
2012-04-10 13:45 ` [PATCH 29/40] ARM i.MX21: " Sascha Hauer
2012-04-10 13:45 ` [PATCH 30/40] ARM i.MX27: " Sascha Hauer
2012-04-10 13:45 ` [PATCH 31/40] ARM i.MX31: " Sascha Hauer
2012-04-10 13:45 ` [PATCH 32/40] ARM i.MX5: " Sascha Hauer
2012-04-23  6:39   ` Richard Zhao
2012-04-23  6:54     ` Sascha Hauer
2012-04-23  7:28       ` Richard Zhao
2012-04-10 13:45 ` [PATCH 33/40] ARM i.MX35: " Sascha Hauer
2012-04-10 13:45 ` [PATCH 34/40] ARM: imx6: " Sascha Hauer
2012-04-18 11:33   ` Sascha Hauer
2012-04-19 13:56     ` Shawn Guo
2012-04-19 14:06       ` Sascha Hauer
2012-04-10 13:45 ` [PATCH 35/40] ARM i.MX: remove now unused old clock support Sascha Hauer
2012-04-10 13:45 ` [PATCH 36/40] ARM i.MX pllv1: move mxc_decode_pll to its only user Sascha Hauer
2012-04-10 13:45 ` [PATCH 37/40] ARM i.MX: remove unused legacy clock support Sascha Hauer
2012-04-10 13:45 ` [PATCH 38/40] USB gadget i.MX: fix clock handling Sascha Hauer
2012-04-10 13:45 ` [PATCH 39/40] USB ehci i.MX: Fix " Sascha Hauer
2012-04-10 13:45 ` [PATCH 40/40] ARM i.MX: Remove now unused struct clk argument from mxc_timer_init 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=1334065553-7565-27-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.