[PATCH 03/20] imx/clock-imx21: use a macro to define registers

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Wed Dec 16 13:59:44 EST 2009


This way the base address isn't hard coded in each register definition

Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
Cc: Sascha Hauer <kernel at pengutronix.de>
Cc: Russell King <linux at arm.linux.org.uk>
Cc: Holger Schurig <hs4233 at mail.mn-solutions.de>
Cc: Rabin Vincent <rabin at rab.in>
---
 arch/arm/mach-mx2/clock_imx21.c |   30 ++++++++++++++++--------------
 1 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/arch/arm/mach-mx2/clock_imx21.c b/arch/arm/mach-mx2/clock_imx21.c
index df3ad38..1922e53 100644
--- a/arch/arm/mach-mx2/clock_imx21.c
+++ b/arch/arm/mach-mx2/clock_imx21.c
@@ -28,21 +28,23 @@
 #include <asm/clkdev.h>
 #include <asm/div64.h>
 
+#define IO_ADDR_CCM(off)	(IO_ADDRESS(CCM_BASE_ADDR) + (off))
+
 /* Register offsets */
-#define CCM_CSCR		(IO_ADDRESS(CCM_BASE_ADDR) + 0x0)
-#define CCM_MPCTL0		(IO_ADDRESS(CCM_BASE_ADDR) + 0x4)
-#define CCM_MPCTL1		(IO_ADDRESS(CCM_BASE_ADDR) + 0x8)
-#define CCM_SPCTL0		(IO_ADDRESS(CCM_BASE_ADDR) + 0xC)
-#define CCM_SPCTL1		(IO_ADDRESS(CCM_BASE_ADDR) + 0x10)
-#define CCM_OSC26MCTL		(IO_ADDRESS(CCM_BASE_ADDR) + 0x14)
-#define CCM_PCDR0		(IO_ADDRESS(CCM_BASE_ADDR) + 0x18)
-#define CCM_PCDR1		(IO_ADDRESS(CCM_BASE_ADDR) + 0x1c)
-#define CCM_PCCR0		(IO_ADDRESS(CCM_BASE_ADDR) + 0x20)
-#define CCM_PCCR1		(IO_ADDRESS(CCM_BASE_ADDR) + 0x24)
-#define CCM_CCSR		(IO_ADDRESS(CCM_BASE_ADDR) + 0x28)
-#define CCM_PMCTL		(IO_ADDRESS(CCM_BASE_ADDR) + 0x2c)
-#define CCM_PMCOUNT		(IO_ADDRESS(CCM_BASE_ADDR) + 0x30)
-#define CCM_WKGDCTL		(IO_ADDRESS(CCM_BASE_ADDR) + 0x34)
+#define CCM_CSCR		IO_ADDR_CCM(0x0)
+#define CCM_MPCTL0		IO_ADDR_CCM(0x4)
+#define CCM_MPCTL1		IO_ADDR_CCM(0x8)
+#define CCM_SPCTL0		IO_ADDR_CCM(0xc)
+#define CCM_SPCTL1		IO_ADDR_CCM(0x10)
+#define CCM_OSC26MCTL		IO_ADDR_CCM(0x14)
+#define CCM_PCDR0		IO_ADDR_CCM(0x18)
+#define CCM_PCDR1		IO_ADDR_CCM(0x1c)
+#define CCM_PCCR0		IO_ADDR_CCM(0x20)
+#define CCM_PCCR1		IO_ADDR_CCM(0x24)
+#define CCM_CCSR		IO_ADDR_CCM(0x28)
+#define CCM_PMCTL		IO_ADDR_CCM(0x2c)
+#define CCM_PMCOUNT		IO_ADDR_CCM(0x30)
+#define CCM_WKGDCTL		IO_ADDR_CCM(0x34)
 
 #define CCM_CSCR_PRESC_OFFSET	29
 #define CCM_CSCR_PRESC_MASK	(0x7 << CCM_CSCR_PRESC_OFFSET)
-- 
1.6.5.2




More information about the linux-arm-kernel mailing list