aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-integrator
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2012-09-04 09:01:37 -0400
committerArnd Bergmann <arnd@arndb.de>2012-09-04 09:01:37 -0400
commit863e99a8c1ea2b0391491904297f57a0f6a1fdd6 (patch)
tree0e7789f83c0ba3a1bc3c19d3ccf5ea6f84f19db6 /arch/arm/mach-integrator
parentdd9bf78040fa0da4cecc228e1682b9682b8cb180 (diff)
parenta849088aa1552b1a28eea3daff599ee22a734ae3 (diff)
Merge commit 'a849088aa1' from rmk/fixes into cleanup/io-pci
As Stephen Rothwell reports, a849088aa155 ("ARM: Fix ioremap() of address zero") from the arm-current tree and commit c2794437091a ("ARM: Add fixed PCI i/o mapping") from the arm-soc tree conflict in a nontrivial way in arch/arm/mm/mmu.c. Rob Herring explains: The PCI i/o reserved area has a dummy physical address of 0 and needs to be skipped by ioremap searches. So we don't set VM_ARM_STATIC_MAPPING to prevent matches by ioremap. The vm_struct settings don't really matter when we do the real mapping of the i/o space. Since commit a849088aa155 is at the start of the fixes branch in the arm tree, we can merge it into the branch that contains the other ioremap changes. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Rob Herring <rob.herring@calxeda.com> Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-integrator')
-rw-r--r--arch/arm/mach-integrator/core.c56
-rw-r--r--arch/arm/mach-integrator/include/mach/clkdev.h26
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c10
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c69
4 files changed, 19 insertions, 142 deletions
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index eaf6c6366ffa..3fa6c51390da 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -11,6 +11,7 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/device.h> 13#include <linux/device.h>
14#include <linux/export.h>
14#include <linux/spinlock.h> 15#include <linux/spinlock.h>
15#include <linux/interrupt.h> 16#include <linux/interrupt.h>
16#include <linux/irq.h> 17#include <linux/irq.h>
@@ -21,7 +22,6 @@
21#include <linux/amba/bus.h> 22#include <linux/amba/bus.h>
22#include <linux/amba/serial.h> 23#include <linux/amba/serial.h>
23#include <linux/io.h> 24#include <linux/io.h>
24#include <linux/clkdev.h>
25 25
26#include <mach/hardware.h> 26#include <mach/hardware.h>
27#include <mach/platform.h> 27#include <mach/platform.h>
@@ -41,17 +41,17 @@ static struct amba_pl010_data integrator_uart_data;
41#define KMI0_IRQ { IRQ_KMIINT0 } 41#define KMI0_IRQ { IRQ_KMIINT0 }
42#define KMI1_IRQ { IRQ_KMIINT1 } 42#define KMI1_IRQ { IRQ_KMIINT1 }
43 43
44static AMBA_APB_DEVICE(rtc, "mb:15", 0, 44static AMBA_APB_DEVICE(rtc, "rtc", 0,
45 INTEGRATOR_RTC_BASE, INTEGRATOR_RTC_IRQ, NULL); 45 INTEGRATOR_RTC_BASE, INTEGRATOR_RTC_IRQ, NULL);
46 46
47static AMBA_APB_DEVICE(uart0, "mb:16", 0, 47static AMBA_APB_DEVICE(uart0, "uart0", 0,
48 INTEGRATOR_UART0_BASE, INTEGRATOR_UART0_IRQ, &integrator_uart_data); 48 INTEGRATOR_UART0_BASE, INTEGRATOR_UART0_IRQ, &integrator_uart_data);
49 49
50static AMBA_APB_DEVICE(uart1, "mb:17", 0, 50static AMBA_APB_DEVICE(uart1, "uart1", 0,
51 INTEGRATOR_UART1_BASE, INTEGRATOR_UART1_IRQ, &integrator_uart_data); 51 INTEGRATOR_UART1_BASE, INTEGRATOR_UART1_IRQ, &integrator_uart_data);
52 52
53static AMBA_APB_DEVICE(kmi0, "mb:18", 0, KMI0_BASE, KMI0_IRQ, NULL); 53static AMBA_APB_DEVICE(kmi0, "kmi0", 0, KMI0_BASE, KMI0_IRQ, NULL);
54static AMBA_APB_DEVICE(kmi1, "mb:19", 0, KMI1_BASE, KMI1_IRQ, NULL); 54static AMBA_APB_DEVICE(kmi1, "kmi1", 0, KMI1_BASE, KMI1_IRQ, NULL);
55 55
56static struct amba_device *amba_devs[] __initdata = { 56static struct amba_device *amba_devs[] __initdata = {
57 &rtc_device, 57 &rtc_device,
@@ -61,50 +61,6 @@ static struct amba_device *amba_devs[] __initdata = {
61 &kmi1_device, 61 &kmi1_device,
62}; 62};
63 63
64/*
65 * These are fixed clocks.
66 */
67static struct clk clk24mhz = {
68 .rate = 24000000,
69};
70
71static struct clk uartclk = {
72 .rate = 14745600,
73};
74
75static struct clk dummy_apb_pclk;
76
77static struct clk_lookup lookups[] = {
78 { /* Bus clock */
79 .con_id = "apb_pclk",
80 .clk = &dummy_apb_pclk,
81 }, {
82 /* Integrator/AP timer frequency */
83 .dev_id = "ap_timer",
84 .clk = &clk24mhz,
85 }, { /* UART0 */
86 .dev_id = "mb:16",
87 .clk = &uartclk,
88 }, { /* UART1 */
89 .dev_id = "mb:17",
90 .clk = &uartclk,
91 }, { /* KMI0 */
92 .dev_id = "mb:18",
93 .clk = &clk24mhz,
94 }, { /* KMI1 */
95 .dev_id = "mb:19",
96 .clk = &clk24mhz,
97 }, { /* MMCI - IntegratorCP */
98 .dev_id = "mb:1c",
99 .clk = &uartclk,
100 }
101};
102
103void __init integrator_init_early(void)
104{
105 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
106}
107
108static int __init integrator_init(void) 64static int __init integrator_init(void)
109{ 65{
110 int i; 66 int i;
diff --git a/arch/arm/mach-integrator/include/mach/clkdev.h b/arch/arm/mach-integrator/include/mach/clkdev.h
deleted file mode 100644
index bfe07679faec..000000000000
--- a/arch/arm/mach-integrator/include/mach/clkdev.h
+++ /dev/null
@@ -1,26 +0,0 @@
1#ifndef __ASM_MACH_CLKDEV_H
2#define __ASM_MACH_CLKDEV_H
3
4#include <linux/module.h>
5#include <plat/clock.h>
6
7struct clk {
8 unsigned long rate;
9 const struct clk_ops *ops;
10 struct module *owner;
11 const struct icst_params *params;
12 void __iomem *vcoreg;
13 void *data;
14};
15
16static inline int __clk_get(struct clk *clk)
17{
18 return try_module_get(clk->owner);
19}
20
21static inline void __clk_put(struct clk *clk)
22{
23 module_put(clk->owner);
24}
25
26#endif
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index fd3bdf8f7223..fd3ef28d2c1a 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -33,6 +33,7 @@
33#include <linux/io.h> 33#include <linux/io.h>
34#include <linux/mtd/physmap.h> 34#include <linux/mtd/physmap.h>
35#include <linux/clk.h> 35#include <linux/clk.h>
36#include <linux/platform_data/clk-integrator.h>
36#include <video/vga.h> 37#include <video/vga.h>
37 38
38#include <mach/hardware.h> 39#include <mach/hardware.h>
@@ -171,6 +172,7 @@ static void __init ap_init_irq(void)
171 172
172 fpga_irq_init(VA_IC_BASE, "SC", IRQ_PIC_START, 173 fpga_irq_init(VA_IC_BASE, "SC", IRQ_PIC_START,
173 -1, INTEGRATOR_SC_VALID_INT, NULL); 174 -1, INTEGRATOR_SC_VALID_INT, NULL);
175 integrator_clk_init(false);
174} 176}
175 177
176#ifdef CONFIG_PM 178#ifdef CONFIG_PM
@@ -437,6 +439,10 @@ static void integrator_clockevent_init(unsigned long inrate)
437 0xffffU); 439 0xffffU);
438} 440}
439 441
442void __init ap_init_early(void)
443{
444}
445
440/* 446/*
441 * Set up timer(s). 447 * Set up timer(s).
442 */ 448 */
@@ -447,7 +453,7 @@ static void __init ap_init_timer(void)
447 453
448 clk = clk_get_sys("ap_timer", NULL); 454 clk = clk_get_sys("ap_timer", NULL);
449 BUG_ON(IS_ERR(clk)); 455 BUG_ON(IS_ERR(clk));
450 clk_enable(clk); 456 clk_prepare_enable(clk);
451 rate = clk_get_rate(clk); 457 rate = clk_get_rate(clk);
452 458
453 writel(0, TIMER0_VA_BASE + TIMER_CTRL); 459 writel(0, TIMER0_VA_BASE + TIMER_CTRL);
@@ -468,7 +474,7 @@ MACHINE_START(INTEGRATOR, "ARM-Integrator")
468 .reserve = integrator_reserve, 474 .reserve = integrator_reserve,
469 .map_io = ap_map_io, 475 .map_io = ap_map_io,
470 .nr_irqs = NR_IRQS_INTEGRATOR_AP, 476 .nr_irqs = NR_IRQS_INTEGRATOR_AP,
471 .init_early = integrator_init_early, 477 .init_early = ap_init_early,
472 .init_irq = ap_init_irq, 478 .init_irq = ap_init_irq,
473 .handle_irq = fpga_handle_irq, 479 .handle_irq = fpga_handle_irq,
474 .timer = &ap_timer, 480 .timer = &ap_timer,
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index a56c53608939..82d5c837cc74 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -21,8 +21,8 @@
21#include <linux/amba/mmci.h> 21#include <linux/amba/mmci.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/gfp.h> 23#include <linux/gfp.h>
24#include <linux/clkdev.h>
25#include <linux/mtd/physmap.h> 24#include <linux/mtd/physmap.h>
25#include <linux/platform_data/clk-integrator.h>
26 26
27#include <mach/hardware.h> 27#include <mach/hardware.h>
28#include <mach/platform.h> 28#include <mach/platform.h>
@@ -171,65 +171,10 @@ static void __init intcp_init_irq(void)
171 171
172 fpga_irq_init(INTCP_VA_SIC_BASE, "SIC", IRQ_SIC_START, 172 fpga_irq_init(INTCP_VA_SIC_BASE, "SIC", IRQ_SIC_START,
173 IRQ_CP_CPPLDINT, sic_mask, NULL); 173 IRQ_CP_CPPLDINT, sic_mask, NULL);
174 integrator_clk_init(true);
174} 175}
175 176
176/* 177/*
177 * Clock handling
178 */
179#define CM_LOCK (__io_address(INTEGRATOR_HDR_BASE)+INTEGRATOR_HDR_LOCK_OFFSET)
180#define CM_AUXOSC (__io_address(INTEGRATOR_HDR_BASE)+0x1c)
181
182static const struct icst_params cp_auxvco_params = {
183 .ref = 24000000,
184 .vco_max = ICST525_VCO_MAX_5V,
185 .vco_min = ICST525_VCO_MIN,
186 .vd_min = 8,
187 .vd_max = 263,
188 .rd_min = 3,
189 .rd_max = 65,
190 .s2div = icst525_s2div,
191 .idx2s = icst525_idx2s,
192};
193
194static void cp_auxvco_set(struct clk *clk, struct icst_vco vco)
195{
196 u32 val;
197
198 val = readl(clk->vcoreg) & ~0x7ffff;
199 val |= vco.v | (vco.r << 9) | (vco.s << 16);
200
201 writel(0xa05f, CM_LOCK);
202 writel(val, clk->vcoreg);
203 writel(0, CM_LOCK);
204}
205
206static const struct clk_ops cp_auxclk_ops = {
207 .round = icst_clk_round,
208 .set = icst_clk_set,
209 .setvco = cp_auxvco_set,
210};
211
212static struct clk cp_auxclk = {
213 .ops = &cp_auxclk_ops,
214 .params = &cp_auxvco_params,
215 .vcoreg = CM_AUXOSC,
216};
217
218static struct clk sp804_clk = {
219 .rate = 1000000,
220};
221
222static struct clk_lookup cp_lookups[] = {
223 { /* CLCD */
224 .dev_id = "mb:c0",
225 .clk = &cp_auxclk,
226 }, { /* SP804 timers */
227 .dev_id = "sp804",
228 .clk = &sp804_clk,
229 },
230};
231
232/*
233 * Flash handling. 178 * Flash handling.
234 */ 179 */
235static int intcp_flash_init(struct platform_device *dev) 180static int intcp_flash_init(struct platform_device *dev)
@@ -336,10 +281,10 @@ static struct mmci_platform_data mmc_data = {
336#define INTEGRATOR_CP_MMC_IRQS { IRQ_CP_MMCIINT0, IRQ_CP_MMCIINT1 } 281#define INTEGRATOR_CP_MMC_IRQS { IRQ_CP_MMCIINT0, IRQ_CP_MMCIINT1 }
337#define INTEGRATOR_CP_AACI_IRQS { IRQ_CP_AACIINT } 282#define INTEGRATOR_CP_AACI_IRQS { IRQ_CP_AACIINT }
338 283
339static AMBA_APB_DEVICE(mmc, "mb:1c", 0, INTEGRATOR_CP_MMC_BASE, 284static AMBA_APB_DEVICE(mmc, "mmci", 0, INTEGRATOR_CP_MMC_BASE,
340 INTEGRATOR_CP_MMC_IRQS, &mmc_data); 285 INTEGRATOR_CP_MMC_IRQS, &mmc_data);
341 286
342static AMBA_APB_DEVICE(aaci, "mb:1d", 0, INTEGRATOR_CP_AACI_BASE, 287static AMBA_APB_DEVICE(aaci, "aaci", 0, INTEGRATOR_CP_AACI_BASE,
343 INTEGRATOR_CP_AACI_IRQS, NULL); 288 INTEGRATOR_CP_AACI_IRQS, NULL);
344 289
345 290
@@ -393,7 +338,7 @@ static struct clcd_board clcd_data = {
393 .remove = versatile_clcd_remove_dma, 338 .remove = versatile_clcd_remove_dma,
394}; 339};
395 340
396static AMBA_AHB_DEVICE(clcd, "mb:c0", 0, INTCP_PA_CLCD_BASE, 341static AMBA_AHB_DEVICE(clcd, "clcd", 0, INTCP_PA_CLCD_BASE,
397 { IRQ_CP_CLCDCINT }, &clcd_data); 342 { IRQ_CP_CLCDCINT }, &clcd_data);
398 343
399static struct amba_device *amba_devs[] __initdata = { 344static struct amba_device *amba_devs[] __initdata = {
@@ -406,10 +351,6 @@ static struct amba_device *amba_devs[] __initdata = {
406 351
407static void __init intcp_init_early(void) 352static void __init intcp_init_early(void)
408{ 353{
409 clkdev_add_table(cp_lookups, ARRAY_SIZE(cp_lookups));
410
411 integrator_init_early();
412
413#ifdef CONFIG_PLAT_VERSATILE_SCHED_CLOCK 354#ifdef CONFIG_PLAT_VERSATILE_SCHED_CLOCK
414 versatile_sched_clock_init(REFCOUNTER, 24000000); 355 versatile_sched_clock_init(REFCOUNTER, 24000000);
415#endif 356#endif