aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSrinidhi Kasagar <srinidhi.kasagar@stericsson.com>2009-11-12 00:20:54 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-11-28 05:22:51 -0500
commit59b559d7a39b590aecef583af58d123ff5876570 (patch)
tree5e5f17bea4e3eb0295e6d85dc72334f23bbc9338
parenta8a8a669ea13d792296737505adc43ccacf3a648 (diff)
ARM: 5786/1: Introduce plat-nomadik, MTU code re-organization
Introduce the plat-nomadik folder for ST-Ericsson machines including the existing nomadik 8815 architecture. This also moves the existing MTU (MultiTimerUnit) of nomadik 8815 to the proposed plat-nomadik and adds HAS_MTU. The patch has been re-based to 2.6.32-rc6 Signed-off-by: srinidhi kasagar <srinidhi.kasagar@stericsson.com> Acked-by: Alessandro Rubini <rubini@unipv.it> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/Makefile1
-rw-r--r--arch/arm/mach-nomadik/Kconfig2
-rw-r--r--arch/arm/mach-nomadik/Makefile2
-rw-r--r--arch/arm/mach-nomadik/board-nhk8815.c27
-rw-r--r--arch/arm/mach-nomadik/include/mach/setup.h2
-rw-r--r--arch/arm/plat-nomadik/Kconfig22
-rw-r--r--arch/arm/plat-nomadik/Makefile5
-rw-r--r--arch/arm/plat-nomadik/include/plat/mtu.h (renamed from arch/arm/mach-nomadik/include/mach/mtu.h)9
-rw-r--r--arch/arm/plat-nomadik/timer.c (renamed from arch/arm/mach-nomadik/timer.c)35
10 files changed, 74 insertions, 32 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 1c4119c60040..76cd466ad48c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -787,6 +787,7 @@ source "arch/arm/mach-at91/Kconfig"
787source "arch/arm/plat-mxc/Kconfig" 787source "arch/arm/plat-mxc/Kconfig"
788 788
789source "arch/arm/mach-nomadik/Kconfig" 789source "arch/arm/mach-nomadik/Kconfig"
790source "arch/arm/plat-nomadik/Kconfig"
790 791
791source "arch/arm/mach-netx/Kconfig" 792source "arch/arm/mach-netx/Kconfig"
792 793
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index a73caaf66763..1bee36fa5fb1 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -176,6 +176,7 @@ machine-$(CONFIG_ARCH_MXC91231) := mxc91231
176plat-$(CONFIG_ARCH_MXC) := mxc 176plat-$(CONFIG_ARCH_MXC) := mxc
177plat-$(CONFIG_ARCH_OMAP) := omap 177plat-$(CONFIG_ARCH_OMAP) := omap
178plat-$(CONFIG_PLAT_IOP) := iop 178plat-$(CONFIG_PLAT_IOP) := iop
179plat-$(CONFIG_PLAT_NOMADIK) := nomadik
179plat-$(CONFIG_PLAT_ORION) := orion 180plat-$(CONFIG_PLAT_ORION) := orion
180plat-$(CONFIG_PLAT_PXA) := pxa 181plat-$(CONFIG_PLAT_PXA) := pxa
181plat-$(CONFIG_PLAT_S3C24XX) := s3c24xx s3c 182plat-$(CONFIG_PLAT_S3C24XX) := s3c24xx s3c
diff --git a/arch/arm/mach-nomadik/Kconfig b/arch/arm/mach-nomadik/Kconfig
index 2a02b49c40f0..3c5e0f522e9c 100644
--- a/arch/arm/mach-nomadik/Kconfig
+++ b/arch/arm/mach-nomadik/Kconfig
@@ -5,13 +5,13 @@ menu "Nomadik boards"
5config MACH_NOMADIK_8815NHK 5config MACH_NOMADIK_8815NHK
6 bool "ST 8815 Nomadik Hardware Kit (evaluation board)" 6 bool "ST 8815 Nomadik Hardware Kit (evaluation board)"
7 select NOMADIK_8815 7 select NOMADIK_8815
8 select HAS_MTU
8 9
9endmenu 10endmenu
10 11
11config NOMADIK_8815 12config NOMADIK_8815
12 bool 13 bool
13 14
14
15config I2C_BITBANG_8815NHK 15config I2C_BITBANG_8815NHK
16 tristate "Driver for bit-bang busses found on the 8815 NHK" 16 tristate "Driver for bit-bang busses found on the 8815 NHK"
17 depends on I2C && MACH_NOMADIK_8815NHK 17 depends on I2C && MACH_NOMADIK_8815NHK
diff --git a/arch/arm/mach-nomadik/Makefile b/arch/arm/mach-nomadik/Makefile
index 412040982a40..36f67fb207d2 100644
--- a/arch/arm/mach-nomadik/Makefile
+++ b/arch/arm/mach-nomadik/Makefile
@@ -7,7 +7,7 @@
7 7
8# Object file lists. 8# Object file lists.
9 9
10obj-y += clock.o timer.o gpio.o 10obj-y += clock.o gpio.o
11 11
12# Cpu revision 12# Cpu revision
13obj-$(CONFIG_NOMADIK_8815) += cpu-8815.o 13obj-$(CONFIG_NOMADIK_8815) += cpu-8815.o
diff --git a/arch/arm/mach-nomadik/board-nhk8815.c b/arch/arm/mach-nomadik/board-nhk8815.c
index 6bfd537d5afb..116394484e71 100644
--- a/arch/arm/mach-nomadik/board-nhk8815.c
+++ b/arch/arm/mach-nomadik/board-nhk8815.c
@@ -25,11 +25,18 @@
25#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
26#include <asm/mach/irq.h> 26#include <asm/mach/irq.h>
27#include <asm/mach/flash.h> 27#include <asm/mach/flash.h>
28
29#include <plat/mtu.h>
30
28#include <mach/setup.h> 31#include <mach/setup.h>
29#include <mach/nand.h> 32#include <mach/nand.h>
30#include <mach/fsmc.h> 33#include <mach/fsmc.h>
31#include "clock.h" 34#include "clock.h"
32 35
36/* Initial value for SRC control register: all timers use MXTAL/8 source */
37#define SRC_CR_INIT_MASK 0x00007fff
38#define SRC_CR_INIT_VAL 0x2aaa8000
39
33/* These adresses span 16MB, so use three individual pages */ 40/* These adresses span 16MB, so use three individual pages */
34static struct resource nhk8815_nand_resources[] = { 41static struct resource nhk8815_nand_resources[] = {
35 { 42 {
@@ -239,6 +246,26 @@ static struct platform_device *nhk8815_platform_devices[] __initdata = {
239 /* will add more devices */ 246 /* will add more devices */
240}; 247};
241 248
249static void __init nomadik_timer_init(void)
250{
251 u32 src_cr;
252
253 /* Configure timer sources in "system reset controller" ctrl reg */
254 src_cr = readl(io_p2v(NOMADIK_SRC_BASE));
255 src_cr &= SRC_CR_INIT_MASK;
256 src_cr |= SRC_CR_INIT_VAL;
257 writel(src_cr, io_p2v(NOMADIK_SRC_BASE));
258
259 /* Save global pointer to mtu, used by platform timer code */
260 mtu_base = io_p2v(NOMADIK_MTU0_BASE);
261
262 nmdk_timer_init();
263}
264
265static struct sys_timer nomadik_timer = {
266 .init = nomadik_timer_init,
267};
268
242static void __init nhk8815_platform_init(void) 269static void __init nhk8815_platform_init(void)
243{ 270{
244 int i; 271 int i;
diff --git a/arch/arm/mach-nomadik/include/mach/setup.h b/arch/arm/mach-nomadik/include/mach/setup.h
index a4e468cf63da..b7897edf1f35 100644
--- a/arch/arm/mach-nomadik/include/mach/setup.h
+++ b/arch/arm/mach-nomadik/include/mach/setup.h
@@ -15,7 +15,7 @@
15extern void cpu8815_map_io(void); 15extern void cpu8815_map_io(void);
16extern void cpu8815_platform_init(void); 16extern void cpu8815_platform_init(void);
17extern void cpu8815_init_irq(void); 17extern void cpu8815_init_irq(void);
18extern struct sys_timer nomadik_timer; 18extern void nmdk_timer_init(void);
19 19
20#endif /* NOMADIK_8815 */ 20#endif /* NOMADIK_8815 */
21 21
diff --git a/arch/arm/plat-nomadik/Kconfig b/arch/arm/plat-nomadik/Kconfig
new file mode 100644
index 000000000000..e27ee3134056
--- /dev/null
+++ b/arch/arm/plat-nomadik/Kconfig
@@ -0,0 +1,22 @@
1# We keep common IP's here for Nomadik and other similar
2# familiy of processors from ST-Ericsson. At the moment we have
3# just MTU, others to follow soon.
4
5config PLAT_NOMADIK
6 bool
7 depends on ARCH_NOMADIK
8 default y
9 help
10 Common platform code for Nomadik and other ST-Ericsson
11 platforms.
12
13if PLAT_NOMADIK
14
15config HAS_MTU
16 bool
17 help
18 Support for Multi Timer Unit. MTU provides access
19 to multiple interrupt generating programmable
20 32-bit free running decrementing counters.
21
22endif
diff --git a/arch/arm/plat-nomadik/Makefile b/arch/arm/plat-nomadik/Makefile
new file mode 100644
index 000000000000..37c7cdd0f8f0
--- /dev/null
+++ b/arch/arm/plat-nomadik/Makefile
@@ -0,0 +1,5 @@
1# arch/arm/plat-nomadik/Makefile
2# Copyright 2009 ST-Ericsson
3# Licensed under GPLv2
4
5obj-$(CONFIG_HAS_MTU) += timer.o
diff --git a/arch/arm/mach-nomadik/include/mach/mtu.h b/arch/arm/plat-nomadik/include/plat/mtu.h
index 76da7f085330..42c907258b14 100644
--- a/arch/arm/mach-nomadik/include/mach/mtu.h
+++ b/arch/arm/plat-nomadik/include/plat/mtu.h
@@ -1,5 +1,8 @@
1#ifndef __ASM_ARCH_MTU_H 1#ifndef __PLAT_MTU_H
2#define __ASM_ARCH_MTU_H 2#define __PLAT_MTU_H
3
4/* should be set by the platform code */
5extern void __iomem *mtu_base;
3 6
4/* 7/*
5 * The MTU device hosts four different counters, with 4 set of 8 * The MTU device hosts four different counters, with 4 set of
@@ -41,5 +44,5 @@
41#define MTU_PCELL2 0xff8 44#define MTU_PCELL2 0xff8
42#define MTU_PCELL3 0xffC 45#define MTU_PCELL3 0xffC
43 46
44#endif /* __ASM_ARCH_MTU_H */ 47#endif /* __PLAT_MTU_H */
45 48
diff --git a/arch/arm/mach-nomadik/timer.c b/arch/arm/plat-nomadik/timer.c
index d1738e7061d4..62f18ad43a28 100644
--- a/arch/arm/mach-nomadik/timer.c
+++ b/arch/arm/plat-nomadik/timer.c
@@ -15,19 +15,14 @@
15#include <linux/clockchips.h> 15#include <linux/clockchips.h>
16#include <linux/jiffies.h> 16#include <linux/jiffies.h>
17#include <asm/mach/time.h> 17#include <asm/mach/time.h>
18#include <mach/mtu.h>
19 18
20#define TIMER_CTRL 0x80 /* No divisor */ 19#include <plat/mtu.h>
21#define TIMER_PERIODIC 0x40
22#define TIMER_SZ32BIT 0x02
23
24/* Initial value for SRC control register: all timers use MXTAL/8 source */
25#define SRC_CR_INIT_MASK 0x00007fff
26#define SRC_CR_INIT_VAL 0x2aaa8000
27 20
28static u32 nmdk_count; /* accumulated count */ 21static u32 nmdk_count; /* accumulated count */
29static u32 nmdk_cycle; /* write-once */ 22static u32 nmdk_cycle; /* write-once */
30static __iomem void *mtu_base; 23
24/* setup by the platform code */
25void __iomem *mtu_base;
31 26
32/* 27/*
33 * clocksource: the MTU device is a decrementing counters, so we negate 28 * clocksource: the MTU device is a decrementing counters, so we negate
@@ -93,7 +88,7 @@ static struct clock_event_device nmdk_clkevt = {
93static irqreturn_t nmdk_timer_interrupt(int irq, void *dev_id) 88static irqreturn_t nmdk_timer_interrupt(int irq, void *dev_id)
94{ 89{
95 /* ack: "interrupt clear register" */ 90 /* ack: "interrupt clear register" */
96 writel( 1 << 0, mtu_base + MTU_ICR); 91 writel(1 << 0, mtu_base + MTU_ICR);
97 92
98 /* we can't count lost ticks, unfortunately */ 93 /* we can't count lost ticks, unfortunately */
99 nmdk_count += nmdk_cycle; 94 nmdk_count += nmdk_cycle;
@@ -125,24 +120,14 @@ static void nmdk_timer_reset(void)
125 writel(cr | MTU_CRn_ENA, mtu_base + MTU_CR(0)); 120 writel(cr | MTU_CRn_ENA, mtu_base + MTU_CR(0));
126} 121}
127 122
128static void __init nmdk_timer_init(void) 123void __init nmdk_timer_init(void)
129{ 124{
130 u32 src_cr;
131 unsigned long rate; 125 unsigned long rate;
132 int bits; 126 int bits;
133 127
134 rate = CLOCK_TICK_RATE; /* 2.4MHz */ 128 rate = CLOCK_TICK_RATE; /* 2.4MHz */
135 nmdk_cycle = (rate + HZ/2) / HZ; 129 nmdk_cycle = (rate + HZ/2) / HZ;
136 130
137 /* Configure timer sources in "system reset controller" ctrl reg */
138 src_cr = readl(io_p2v(NOMADIK_SRC_BASE));
139 src_cr &= SRC_CR_INIT_MASK;
140 src_cr |= SRC_CR_INIT_VAL;
141 writel(src_cr, io_p2v(NOMADIK_SRC_BASE));
142
143 /* Save global pointer to mtu, used by functions above */
144 mtu_base = io_p2v(NOMADIK_MTU0_BASE);
145
146 /* Init the timer and register clocksource */ 131 /* Init the timer and register clocksource */
147 nmdk_timer_reset(); 132 nmdk_timer_reset();
148 133
@@ -150,7 +135,9 @@ static void __init nmdk_timer_init(void)
150 bits = 8*sizeof(nmdk_count); 135 bits = 8*sizeof(nmdk_count);
151 nmdk_clksrc.mask = CLOCKSOURCE_MASK(bits); 136 nmdk_clksrc.mask = CLOCKSOURCE_MASK(bits);
152 137
153 clocksource_register(&nmdk_clksrc); 138 if (clocksource_register(&nmdk_clksrc))
139 printk(KERN_ERR "timer: failed to initialize clock "
140 "source %s\n", nmdk_clksrc.name);
154 141
155 /* Register irq and clockevents */ 142 /* Register irq and clockevents */
156 setup_irq(IRQ_MTU0, &nmdk_timer_irq); 143 setup_irq(IRQ_MTU0, &nmdk_timer_irq);
@@ -158,7 +145,3 @@ static void __init nmdk_timer_init(void)
158 nmdk_clkevt.cpumask = cpumask_of(0); 145 nmdk_clkevt.cpumask = cpumask_of(0);
159 clockevents_register_device(&nmdk_clkevt); 146 clockevents_register_device(&nmdk_clkevt);
160} 147}
161
162struct sys_timer nomadik_timer = {
163 .init = nmdk_timer_init,
164};