aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-realview
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-realview')
-rw-r--r--arch/arm/mach-realview/Makefile2
-rw-r--r--arch/arm/mach-realview/clock.c64
-rw-r--r--arch/arm/mach-realview/clock.h19
-rw-r--r--arch/arm/mach-realview/core.c194
-rw-r--r--arch/arm/mach-realview/hotplug.c2
-rw-r--r--arch/arm/mach-realview/include/mach/clkdev.h9
-rw-r--r--arch/arm/mach-realview/include/mach/irqs-pb1176.h1
-rw-r--r--arch/arm/mach-realview/include/mach/irqs-pba8.h8
-rw-r--r--arch/arm/mach-realview/include/mach/irqs-pbx.h14
-rw-r--r--arch/arm/mach-realview/include/mach/platform.h20
-rw-r--r--arch/arm/mach-realview/realview_eb.c34
-rw-r--r--arch/arm/mach-realview/realview_pb1176.c17
-rw-r--r--arch/arm/mach-realview/realview_pb11mp.c34
-rw-r--r--arch/arm/mach-realview/realview_pba8.c17
-rw-r--r--arch/arm/mach-realview/realview_pbx.c32
15 files changed, 171 insertions, 296 deletions
diff --git a/arch/arm/mach-realview/Makefile b/arch/arm/mach-realview/Makefile
index e704edb733c0..a01b76b7c956 100644
--- a/arch/arm/mach-realview/Makefile
+++ b/arch/arm/mach-realview/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5obj-y := core.o clock.o 5obj-y := core.o
6obj-$(CONFIG_MACH_REALVIEW_EB) += realview_eb.o 6obj-$(CONFIG_MACH_REALVIEW_EB) += realview_eb.o
7obj-$(CONFIG_MACH_REALVIEW_PB11MP) += realview_pb11mp.o 7obj-$(CONFIG_MACH_REALVIEW_PB11MP) += realview_pb11mp.o
8obj-$(CONFIG_MACH_REALVIEW_PB1176) += realview_pb1176.o 8obj-$(CONFIG_MACH_REALVIEW_PB1176) += realview_pb1176.o
diff --git a/arch/arm/mach-realview/clock.c b/arch/arm/mach-realview/clock.c
deleted file mode 100644
index a7043115de72..000000000000
--- a/arch/arm/mach-realview/clock.c
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2 * linux/arch/arm/mach-realview/clock.c
3 *
4 * Copyright (C) 2004 ARM Limited.
5 * Written by Deep Blue Solutions Limited.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#include <linux/module.h>
12#include <linux/kernel.h>
13#include <linux/device.h>
14#include <linux/list.h>
15#include <linux/errno.h>
16#include <linux/err.h>
17#include <linux/string.h>
18#include <linux/clk.h>
19#include <linux/mutex.h>
20
21#include <asm/hardware/icst307.h>
22
23#include "clock.h"
24
25int clk_enable(struct clk *clk)
26{
27 return 0;
28}
29EXPORT_SYMBOL(clk_enable);
30
31void clk_disable(struct clk *clk)
32{
33}
34EXPORT_SYMBOL(clk_disable);
35
36unsigned long clk_get_rate(struct clk *clk)
37{
38 return clk->rate;
39}
40EXPORT_SYMBOL(clk_get_rate);
41
42long clk_round_rate(struct clk *clk, unsigned long rate)
43{
44 struct icst307_vco vco;
45 vco = icst307_khz_to_vco(clk->params, rate / 1000);
46 return icst307_khz(clk->params, vco) * 1000;
47}
48EXPORT_SYMBOL(clk_round_rate);
49
50int clk_set_rate(struct clk *clk, unsigned long rate)
51{
52 int ret = -EIO;
53
54 if (clk->setvco) {
55 struct icst307_vco vco;
56
57 vco = icst307_khz_to_vco(clk->params, rate / 1000);
58 clk->rate = icst307_khz(clk->params, vco) * 1000;
59 clk->setvco(clk, vco);
60 ret = 0;
61 }
62 return ret;
63}
64EXPORT_SYMBOL(clk_set_rate);
diff --git a/arch/arm/mach-realview/clock.h b/arch/arm/mach-realview/clock.h
deleted file mode 100644
index ebbb0f06b600..000000000000
--- a/arch/arm/mach-realview/clock.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * linux/arch/arm/mach-realview/clock.h
3 *
4 * Copyright (C) 2004 ARM Limited.
5 * Written by Deep Blue Solutions Limited.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11struct module;
12struct icst307_params;
13
14struct clk {
15 unsigned long rate;
16 const struct icst307_params *params;
17 void *data;
18 void (*setvco)(struct clk *, struct icst307_vco vco);
19};
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index d5a95738f85b..595be19f8ad5 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -25,8 +25,6 @@
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/amba/bus.h> 26#include <linux/amba/bus.h>
27#include <linux/amba/clcd.h> 27#include <linux/amba/clcd.h>
28#include <linux/clocksource.h>
29#include <linux/clockchips.h>
30#include <linux/io.h> 28#include <linux/io.h>
31#include <linux/smsc911x.h> 29#include <linux/smsc911x.h>
32#include <linux/ata_platform.h> 30#include <linux/ata_platform.h>
@@ -40,7 +38,7 @@
40#include <asm/leds.h> 38#include <asm/leds.h>
41#include <asm/mach-types.h> 39#include <asm/mach-types.h>
42#include <asm/hardware/arm_timer.h> 40#include <asm/hardware/arm_timer.h>
43#include <asm/hardware/icst307.h> 41#include <asm/hardware/icst.h>
44 42
45#include <asm/mach/arch.h> 43#include <asm/mach/arch.h>
46#include <asm/mach/flash.h> 44#include <asm/mach/flash.h>
@@ -49,13 +47,12 @@
49 47
50#include <asm/hardware/gic.h> 48#include <asm/hardware/gic.h>
51 49
50#include <mach/clkdev.h>
52#include <mach/platform.h> 51#include <mach/platform.h>
53#include <mach/irqs.h> 52#include <mach/irqs.h>
53#include <plat/timer-sp.h>
54 54
55#include "core.h" 55#include "core.h"
56#include "clock.h"
57
58#define REALVIEW_REFCOUNTER (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_24MHz_OFFSET)
59 56
60/* used by entry-macro.S and platsmp.c */ 57/* used by entry-macro.S and platsmp.c */
61void __iomem *gic_cpu_base_addr; 58void __iomem *gic_cpu_base_addr;
@@ -79,20 +76,6 @@ void __init realview_adjust_zones(int node, unsigned long *size,
79} 76}
80#endif 77#endif
81 78
82/*
83 * This is the RealView sched_clock implementation. This has
84 * a resolution of 41.7ns, and a maximum value of about 179s.
85 */
86unsigned long long sched_clock(void)
87{
88 unsigned long long v;
89
90 v = (unsigned long long)readl(REALVIEW_REFCOUNTER) * 125;
91 do_div(v, 3);
92
93 return v;
94}
95
96 79
97#define REALVIEW_FLASHCTRL (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_FLASH_OFFSET) 80#define REALVIEW_FLASHCTRL (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_FLASH_OFFSET)
98 81
@@ -274,37 +257,40 @@ struct mmci_platform_data realview_mmc1_plat_data = {
274/* 257/*
275 * Clock handling 258 * Clock handling
276 */ 259 */
277static const struct icst307_params realview_oscvco_params = { 260static const struct icst_params realview_oscvco_params = {
278 .ref = 24000, 261 .ref = 24000000,
279 .vco_max = 200000, 262 .vco_max = ICST307_VCO_MAX,
263 .vco_min = ICST307_VCO_MIN,
280 .vd_min = 4 + 8, 264 .vd_min = 4 + 8,
281 .vd_max = 511 + 8, 265 .vd_max = 511 + 8,
282 .rd_min = 1 + 2, 266 .rd_min = 1 + 2,
283 .rd_max = 127 + 2, 267 .rd_max = 127 + 2,
268 .s2div = icst307_s2div,
269 .idx2s = icst307_idx2s,
284}; 270};
285 271
286static void realview_oscvco_set(struct clk *clk, struct icst307_vco vco) 272static void realview_oscvco_set(struct clk *clk, struct icst_vco vco)
287{ 273{
288 void __iomem *sys_lock = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LOCK_OFFSET; 274 void __iomem *sys_lock = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LOCK_OFFSET;
289 void __iomem *sys_osc;
290 u32 val; 275 u32 val;
291 276
292 if (machine_is_realview_pb1176()) 277 val = readl(clk->vcoreg) & ~0x7ffff;
293 sys_osc = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_OSC0_OFFSET;
294 else
295 sys_osc = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_OSC4_OFFSET;
296
297 val = readl(sys_osc) & ~0x7ffff;
298 val |= vco.v | (vco.r << 9) | (vco.s << 16); 278 val |= vco.v | (vco.r << 9) | (vco.s << 16);
299 279
300 writel(0xa05f, sys_lock); 280 writel(0xa05f, sys_lock);
301 writel(val, sys_osc); 281 writel(val, clk->vcoreg);
302 writel(0, sys_lock); 282 writel(0, sys_lock);
303} 283}
304 284
285static const struct clk_ops oscvco_clk_ops = {
286 .round = icst_clk_round,
287 .set = icst_clk_set,
288 .setvco = realview_oscvco_set,
289};
290
305static struct clk oscvco_clk = { 291static struct clk oscvco_clk = {
292 .ops = &oscvco_clk_ops,
306 .params = &realview_oscvco_params, 293 .params = &realview_oscvco_params,
307 .setvco = realview_oscvco_set,
308}; 294};
309 295
310/* 296/*
@@ -347,7 +333,13 @@ static struct clk_lookup lookups[] = {
347 333
348static int __init clk_init(void) 334static int __init clk_init(void)
349{ 335{
336 if (machine_is_realview_pb1176())
337 oscvco_clk.vcoreg = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_OSC0_OFFSET;
338 else
339 oscvco_clk.vcoreg = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_OSC4_OFFSET;
340
350 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 341 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
342
351 return 0; 343 return 0;
352} 344}
353arch_initcall(clk_init); 345arch_initcall(clk_init);
@@ -644,133 +636,6 @@ void __iomem *timer2_va_base;
644void __iomem *timer3_va_base; 636void __iomem *timer3_va_base;
645 637
646/* 638/*
647 * How long is the timer interval?
648 */
649#define TIMER_INTERVAL (TICKS_PER_uSEC * mSEC_10)
650#if TIMER_INTERVAL >= 0x100000
651#define TIMER_RELOAD (TIMER_INTERVAL >> 8)
652#define TIMER_DIVISOR (TIMER_CTRL_DIV256)
653#define TICKS2USECS(x) (256 * (x) / TICKS_PER_uSEC)
654#elif TIMER_INTERVAL >= 0x10000
655#define TIMER_RELOAD (TIMER_INTERVAL >> 4) /* Divide by 16 */
656#define TIMER_DIVISOR (TIMER_CTRL_DIV16)
657#define TICKS2USECS(x) (16 * (x) / TICKS_PER_uSEC)
658#else
659#define TIMER_RELOAD (TIMER_INTERVAL)
660#define TIMER_DIVISOR (TIMER_CTRL_DIV1)
661#define TICKS2USECS(x) ((x) / TICKS_PER_uSEC)
662#endif
663
664static void timer_set_mode(enum clock_event_mode mode,
665 struct clock_event_device *clk)
666{
667 unsigned long ctrl;
668
669 switch(mode) {
670 case CLOCK_EVT_MODE_PERIODIC:
671 writel(TIMER_RELOAD, timer0_va_base + TIMER_LOAD);
672
673 ctrl = TIMER_CTRL_PERIODIC;
674 ctrl |= TIMER_CTRL_32BIT | TIMER_CTRL_IE | TIMER_CTRL_ENABLE;
675 break;
676 case CLOCK_EVT_MODE_ONESHOT:
677 /* period set, and timer enabled in 'next_event' hook */
678 ctrl = TIMER_CTRL_ONESHOT;
679 ctrl |= TIMER_CTRL_32BIT | TIMER_CTRL_IE;
680 break;
681 case CLOCK_EVT_MODE_UNUSED:
682 case CLOCK_EVT_MODE_SHUTDOWN:
683 default:
684 ctrl = 0;
685 }
686
687 writel(ctrl, timer0_va_base + TIMER_CTRL);
688}
689
690static int timer_set_next_event(unsigned long evt,
691 struct clock_event_device *unused)
692{
693 unsigned long ctrl = readl(timer0_va_base + TIMER_CTRL);
694
695 writel(evt, timer0_va_base + TIMER_LOAD);
696 writel(ctrl | TIMER_CTRL_ENABLE, timer0_va_base + TIMER_CTRL);
697
698 return 0;
699}
700
701static struct clock_event_device timer0_clockevent = {
702 .name = "timer0",
703 .shift = 32,
704 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
705 .set_mode = timer_set_mode,
706 .set_next_event = timer_set_next_event,
707 .rating = 300,
708 .cpumask = cpu_all_mask,
709};
710
711static void __init realview_clockevents_init(unsigned int timer_irq)
712{
713 timer0_clockevent.irq = timer_irq;
714 timer0_clockevent.mult =
715 div_sc(1000000, NSEC_PER_SEC, timer0_clockevent.shift);
716 timer0_clockevent.max_delta_ns =
717 clockevent_delta2ns(0xffffffff, &timer0_clockevent);
718 timer0_clockevent.min_delta_ns =
719 clockevent_delta2ns(0xf, &timer0_clockevent);
720
721 clockevents_register_device(&timer0_clockevent);
722}
723
724/*
725 * IRQ handler for the timer
726 */
727static irqreturn_t realview_timer_interrupt(int irq, void *dev_id)
728{
729 struct clock_event_device *evt = &timer0_clockevent;
730
731 /* clear the interrupt */
732 writel(1, timer0_va_base + TIMER_INTCLR);
733
734 evt->event_handler(evt);
735
736 return IRQ_HANDLED;
737}
738
739static struct irqaction realview_timer_irq = {
740 .name = "RealView Timer Tick",
741 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
742 .handler = realview_timer_interrupt,
743};
744
745static cycle_t realview_get_cycles(struct clocksource *cs)
746{
747 return ~readl(timer3_va_base + TIMER_VALUE);
748}
749
750static struct clocksource clocksource_realview = {
751 .name = "timer3",
752 .rating = 200,
753 .read = realview_get_cycles,
754 .mask = CLOCKSOURCE_MASK(32),
755 .shift = 20,
756 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
757};
758
759static void __init realview_clocksource_init(void)
760{
761 /* setup timer 0 as free-running clocksource */
762 writel(0, timer3_va_base + TIMER_CTRL);
763 writel(0xffffffff, timer3_va_base + TIMER_LOAD);
764 writel(0xffffffff, timer3_va_base + TIMER_VALUE);
765 writel(TIMER_CTRL_32BIT | TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC,
766 timer3_va_base + TIMER_CTRL);
767
768 clocksource_realview.mult =
769 clocksource_khz2mult(1000, clocksource_realview.shift);
770 clocksource_register(&clocksource_realview);
771}
772
773/*
774 * Set up the clock source and clock events devices 639 * Set up the clock source and clock events devices
775 */ 640 */
776void __init realview_timer_init(unsigned int timer_irq) 641void __init realview_timer_init(unsigned int timer_irq)
@@ -797,13 +662,8 @@ void __init realview_timer_init(unsigned int timer_irq)
797 writel(0, timer2_va_base + TIMER_CTRL); 662 writel(0, timer2_va_base + TIMER_CTRL);
798 writel(0, timer3_va_base + TIMER_CTRL); 663 writel(0, timer3_va_base + TIMER_CTRL);
799 664
800 /* 665 sp804_clocksource_init(timer3_va_base);
801 * Make irqs happen for the system timer 666 sp804_clockevents_init(timer0_va_base, timer_irq);
802 */
803 setup_irq(timer_irq, &realview_timer_irq);
804
805 realview_clocksource_init();
806 realview_clockevents_init(timer_irq);
807} 667}
808 668
809/* 669/*
diff --git a/arch/arm/mach-realview/hotplug.c b/arch/arm/mach-realview/hotplug.c
index be048e3e8799..f95521a5e5ce 100644
--- a/arch/arm/mach-realview/hotplug.c
+++ b/arch/arm/mach-realview/hotplug.c
@@ -131,7 +131,7 @@ void platform_cpu_die(unsigned int cpu)
131 cpu_leave_lowpower(); 131 cpu_leave_lowpower();
132} 132}
133 133
134int mach_cpu_disable(unsigned int cpu) 134int platform_cpu_disable(unsigned int cpu)
135{ 135{
136 /* 136 /*
137 * we don't allow CPU 0 to be shutdown (it is still too special 137 * we don't allow CPU 0 to be shutdown (it is still too special
diff --git a/arch/arm/mach-realview/include/mach/clkdev.h b/arch/arm/mach-realview/include/mach/clkdev.h
index 04b37a89801c..e58d0771b64e 100644
--- a/arch/arm/mach-realview/include/mach/clkdev.h
+++ b/arch/arm/mach-realview/include/mach/clkdev.h
@@ -1,6 +1,15 @@
1#ifndef __ASM_MACH_CLKDEV_H 1#ifndef __ASM_MACH_CLKDEV_H
2#define __ASM_MACH_CLKDEV_H 2#define __ASM_MACH_CLKDEV_H
3 3
4#include <plat/clock.h>
5
6struct clk {
7 unsigned long rate;
8 const struct clk_ops *ops;
9 const struct icst_params *params;
10 void __iomem *vcoreg;
11};
12
4#define __clk_get(clk) ({ 1; }) 13#define __clk_get(clk) ({ 1; })
5#define __clk_put(clk) do { } while (0) 14#define __clk_put(clk) do { } while (0)
6 15
diff --git a/arch/arm/mach-realview/include/mach/irqs-pb1176.h b/arch/arm/mach-realview/include/mach/irqs-pb1176.h
index 2410d4f8ddd3..830055bb8628 100644
--- a/arch/arm/mach-realview/include/mach/irqs-pb1176.h
+++ b/arch/arm/mach-realview/include/mach/irqs-pb1176.h
@@ -31,6 +31,7 @@
31#define IRQ_DC1176_SOFTINT (IRQ_DC1176_GIC_START + 1) /* Software interrupt */ 31#define IRQ_DC1176_SOFTINT (IRQ_DC1176_GIC_START + 1) /* Software interrupt */
32#define IRQ_DC1176_COMMRx (IRQ_DC1176_GIC_START + 2) /* Debug Comm Rx interrupt */ 32#define IRQ_DC1176_COMMRx (IRQ_DC1176_GIC_START + 2) /* Debug Comm Rx interrupt */
33#define IRQ_DC1176_COMMTx (IRQ_DC1176_GIC_START + 3) /* Debug Comm Tx interrupt */ 33#define IRQ_DC1176_COMMTx (IRQ_DC1176_GIC_START + 3) /* Debug Comm Tx interrupt */
34#define IRQ_DC1176_CORE_PMU (IRQ_DC1176_GIC_START + 7) /* Core PMU interrupt */
34#define IRQ_DC1176_TIMER0 (IRQ_DC1176_GIC_START + 8) /* Timer 0 */ 35#define IRQ_DC1176_TIMER0 (IRQ_DC1176_GIC_START + 8) /* Timer 0 */
35#define IRQ_DC1176_TIMER1 (IRQ_DC1176_GIC_START + 9) /* Timer 1 */ 36#define IRQ_DC1176_TIMER1 (IRQ_DC1176_GIC_START + 9) /* Timer 1 */
36#define IRQ_DC1176_TIMER2 (IRQ_DC1176_GIC_START + 10) /* Timer 2 */ 37#define IRQ_DC1176_TIMER2 (IRQ_DC1176_GIC_START + 10) /* Timer 2 */
diff --git a/arch/arm/mach-realview/include/mach/irqs-pba8.h b/arch/arm/mach-realview/include/mach/irqs-pba8.h
index 86792a9f2ab6..4a88a4edb651 100644
--- a/arch/arm/mach-realview/include/mach/irqs-pba8.h
+++ b/arch/arm/mach-realview/include/mach/irqs-pba8.h
@@ -23,12 +23,6 @@
23 23
24#define IRQ_PBA8_GIC_START 32 24#define IRQ_PBA8_GIC_START 32
25 25
26/* L220
27#define IRQ_PBA8_L220_EVENT (IRQ_PBA8_GIC_START + 29)
28#define IRQ_PBA8_L220_SLAVE (IRQ_PBA8_GIC_START + 30)
29#define IRQ_PBA8_L220_DECODE (IRQ_PBA8_GIC_START + 31)
30*/
31
32/* 26/*
33 * PB-A8 on-board gic irq sources 27 * PB-A8 on-board gic irq sources
34 */ 28 */
@@ -65,6 +59,8 @@
65#define IRQ_PBA8_TSPEN (IRQ_PBA8_GIC_START + 30) /* Touchscreen pen */ 59#define IRQ_PBA8_TSPEN (IRQ_PBA8_GIC_START + 30) /* Touchscreen pen */
66#define IRQ_PBA8_TSKPAD (IRQ_PBA8_GIC_START + 31) /* Touchscreen keypad */ 60#define IRQ_PBA8_TSKPAD (IRQ_PBA8_GIC_START + 31) /* Touchscreen keypad */
67 61
62#define IRQ_PBA8_PMU (IRQ_PBA8_GIC_START + 47) /* Cortex-A8 PMU */
63
68/* ... */ 64/* ... */
69#define IRQ_PBA8_PCI0 (IRQ_PBA8_GIC_START + 50) 65#define IRQ_PBA8_PCI0 (IRQ_PBA8_GIC_START + 50)
70#define IRQ_PBA8_PCI1 (IRQ_PBA8_GIC_START + 51) 66#define IRQ_PBA8_PCI1 (IRQ_PBA8_GIC_START + 51)
diff --git a/arch/arm/mach-realview/include/mach/irqs-pbx.h b/arch/arm/mach-realview/include/mach/irqs-pbx.h
index deaad4302b17..206a3001f46b 100644
--- a/arch/arm/mach-realview/include/mach/irqs-pbx.h
+++ b/arch/arm/mach-realview/include/mach/irqs-pbx.h
@@ -22,12 +22,6 @@
22 22
23#define IRQ_PBX_GIC_START 32 23#define IRQ_PBX_GIC_START 32
24 24
25/* L220
26#define IRQ_PBX_L220_EVENT (IRQ_PBX_GIC_START + 29)
27#define IRQ_PBX_L220_SLAVE (IRQ_PBX_GIC_START + 30)
28#define IRQ_PBX_L220_DECODE (IRQ_PBX_GIC_START + 31)
29*/
30
31/* 25/*
32 * PBX on-board gic irq sources 26 * PBX on-board gic irq sources
33 */ 27 */
@@ -77,10 +71,10 @@
77#define IRQ_PBX_TIMER4_5 (IRQ_PBX_GIC_START + 41) /* Timer 0/1 (default timer) */ 71#define IRQ_PBX_TIMER4_5 (IRQ_PBX_GIC_START + 41) /* Timer 0/1 (default timer) */
78#define IRQ_PBX_TIMER6_7 (IRQ_PBX_GIC_START + 42) /* Timer 2/3 */ 72#define IRQ_PBX_TIMER6_7 (IRQ_PBX_GIC_START + 42) /* Timer 2/3 */
79/* ... */ 73/* ... */
80#define IRQ_PBX_PMU_CPU3 (IRQ_PBX_GIC_START + 44) /* CPU PMU Interrupts */ 74#define IRQ_PBX_PMU_CPU0 (IRQ_PBX_GIC_START + 44) /* CPU PMU Interrupts */
81#define IRQ_PBX_PMU_CPU2 (IRQ_PBX_GIC_START + 45) 75#define IRQ_PBX_PMU_CPU1 (IRQ_PBX_GIC_START + 45)
82#define IRQ_PBX_PMU_CPU1 (IRQ_PBX_GIC_START + 46) 76#define IRQ_PBX_PMU_CPU2 (IRQ_PBX_GIC_START + 46)
83#define IRQ_PBX_PMU_CPU0 (IRQ_PBX_GIC_START + 47) 77#define IRQ_PBX_PMU_CPU3 (IRQ_PBX_GIC_START + 47)
84 78
85/* ... */ 79/* ... */
86#define IRQ_PBX_PCI0 (IRQ_PBX_GIC_START + 50) 80#define IRQ_PBX_PCI0 (IRQ_PBX_GIC_START + 50)
diff --git a/arch/arm/mach-realview/include/mach/platform.h b/arch/arm/mach-realview/include/mach/platform.h
index 86c0c4435a46..1b77a27badaf 100644
--- a/arch/arm/mach-realview/include/mach/platform.h
+++ b/arch/arm/mach-realview/include/mach/platform.h
@@ -231,12 +231,6 @@
231#define REALVIEW_INTREG_OFFSET 0x8 /* Interrupt control */ 231#define REALVIEW_INTREG_OFFSET 0x8 /* Interrupt control */
232#define REALVIEW_DECODE_OFFSET 0xC /* Fitted logic modules */ 232#define REALVIEW_DECODE_OFFSET 0xC /* Fitted logic modules */
233 233
234/*
235 * Clean base - dummy
236 *
237 */
238#define CLEAN_BASE REALVIEW_BOOT_ROM_HI
239
240/* 234/*
241 * System controller bit assignment 235 * System controller bit assignment
242 */ 236 */
@@ -249,20 +243,6 @@
249#define REALVIEW_TIMER4_EnSel 21 243#define REALVIEW_TIMER4_EnSel 21
250 244
251 245
252#define MAX_TIMER 2
253#define MAX_PERIOD 699050
254#define TICKS_PER_uSEC 1
255
256/*
257 * These are useconds NOT ticks.
258 *
259 */
260#define mSEC_1 1000
261#define mSEC_5 (mSEC_1 * 5)
262#define mSEC_10 (mSEC_1 * 10)
263#define mSEC_25 (mSEC_1 * 25)
264#define SEC_1 (mSEC_1 * 1000)
265
266#define REALVIEW_CSR_BASE 0x10000000 246#define REALVIEW_CSR_BASE 0x10000000
267#define REALVIEW_CSR_SIZE 0x10000000 247#define REALVIEW_CSR_SIZE 0x10000000
268 248
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c
index 7d857d300558..422ccd70d5f5 100644
--- a/arch/arm/mach-realview/realview_eb.c
+++ b/arch/arm/mach-realview/realview_eb.c
@@ -31,8 +31,8 @@
31#include <asm/irq.h> 31#include <asm/irq.h>
32#include <asm/leds.h> 32#include <asm/leds.h>
33#include <asm/mach-types.h> 33#include <asm/mach-types.h>
34#include <asm/pmu.h>
34#include <asm/hardware/gic.h> 35#include <asm/hardware/gic.h>
35#include <asm/hardware/icst307.h>
36#include <asm/hardware/cache-l2x0.h> 36#include <asm/hardware/cache-l2x0.h>
37#include <asm/localtimer.h> 37#include <asm/localtimer.h>
38 38
@@ -44,7 +44,6 @@
44#include <mach/irqs.h> 44#include <mach/irqs.h>
45 45
46#include "core.h" 46#include "core.h"
47#include "clock.h"
48 47
49static struct map_desc realview_eb_io_desc[] __initdata = { 48static struct map_desc realview_eb_io_desc[] __initdata = {
50 { 49 {
@@ -294,6 +293,36 @@ static struct resource realview_eb_isp1761_resources[] = {
294 }, 293 },
295}; 294};
296 295
296static struct resource pmu_resources[] = {
297 [0] = {
298 .start = IRQ_EB11MP_PMU_CPU0,
299 .end = IRQ_EB11MP_PMU_CPU0,
300 .flags = IORESOURCE_IRQ,
301 },
302 [1] = {
303 .start = IRQ_EB11MP_PMU_CPU1,
304 .end = IRQ_EB11MP_PMU_CPU1,
305 .flags = IORESOURCE_IRQ,
306 },
307 [2] = {
308 .start = IRQ_EB11MP_PMU_CPU2,
309 .end = IRQ_EB11MP_PMU_CPU2,
310 .flags = IORESOURCE_IRQ,
311 },
312 [3] = {
313 .start = IRQ_EB11MP_PMU_CPU3,
314 .end = IRQ_EB11MP_PMU_CPU3,
315 .flags = IORESOURCE_IRQ,
316 },
317};
318
319static struct platform_device pmu_device = {
320 .name = "arm-pmu",
321 .id = ARM_PMU_DEVICE_CPU,
322 .num_resources = ARRAY_SIZE(pmu_resources),
323 .resource = pmu_resources,
324};
325
297static void __init gic_init_irq(void) 326static void __init gic_init_irq(void)
298{ 327{
299 if (core_tile_eb11mp() || core_tile_a9mp()) { 328 if (core_tile_eb11mp() || core_tile_a9mp()) {
@@ -407,6 +436,7 @@ static void __init realview_eb_init(void)
407 * Bits: .... ...0 0111 1001 0000 .... .... .... */ 436 * Bits: .... ...0 0111 1001 0000 .... .... .... */
408 l2x0_init(__io_address(REALVIEW_EB11MP_L220_BASE), 0x00790000, 0xfe000fff); 437 l2x0_init(__io_address(REALVIEW_EB11MP_L220_BASE), 0x00790000, 0xfe000fff);
409#endif 438#endif
439 platform_device_register(&pmu_device);
410 } 440 }
411 441
412 realview_flash_register(&realview_eb_flash_resource, 1); 442 realview_flash_register(&realview_eb_flash_resource, 1);
diff --git a/arch/arm/mach-realview/realview_pb1176.c b/arch/arm/mach-realview/realview_pb1176.c
index 44392e51dd50..96568ebfa2bb 100644
--- a/arch/arm/mach-realview/realview_pb1176.c
+++ b/arch/arm/mach-realview/realview_pb1176.c
@@ -31,8 +31,8 @@
31#include <asm/irq.h> 31#include <asm/irq.h>
32#include <asm/leds.h> 32#include <asm/leds.h>
33#include <asm/mach-types.h> 33#include <asm/mach-types.h>
34#include <asm/pmu.h>
34#include <asm/hardware/gic.h> 35#include <asm/hardware/gic.h>
35#include <asm/hardware/icst307.h>
36#include <asm/hardware/cache-l2x0.h> 36#include <asm/hardware/cache-l2x0.h>
37 37
38#include <asm/mach/arch.h> 38#include <asm/mach/arch.h>
@@ -44,7 +44,6 @@
44#include <mach/irqs.h> 44#include <mach/irqs.h>
45 45
46#include "core.h" 46#include "core.h"
47#include "clock.h"
48 47
49static struct map_desc realview_pb1176_io_desc[] __initdata = { 48static struct map_desc realview_pb1176_io_desc[] __initdata = {
50 { 49 {
@@ -263,6 +262,19 @@ static struct resource realview_pb1176_isp1761_resources[] = {
263 }, 262 },
264}; 263};
265 264
265static struct resource pmu_resource = {
266 .start = IRQ_DC1176_CORE_PMU,
267 .end = IRQ_DC1176_CORE_PMU,
268 .flags = IORESOURCE_IRQ,
269};
270
271static struct platform_device pmu_device = {
272 .name = "arm-pmu",
273 .id = ARM_PMU_DEVICE_CPU,
274 .num_resources = 1,
275 .resource = &pmu_resource,
276};
277
266static void __init gic_init_irq(void) 278static void __init gic_init_irq(void)
267{ 279{
268 /* ARM1176 DevChip GIC, primary */ 280 /* ARM1176 DevChip GIC, primary */
@@ -324,6 +336,7 @@ static void __init realview_pb1176_init(void)
324 realview_eth_register(NULL, realview_pb1176_smsc911x_resources); 336 realview_eth_register(NULL, realview_pb1176_smsc911x_resources);
325 platform_device_register(&realview_i2c_device); 337 platform_device_register(&realview_i2c_device);
326 realview_usb_register(realview_pb1176_isp1761_resources); 338 realview_usb_register(realview_pb1176_isp1761_resources);
339 platform_device_register(&pmu_device);
327 340
328 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 341 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
329 struct amba_device *d = amba_devs[i]; 342 struct amba_device *d = amba_devs[i];
diff --git a/arch/arm/mach-realview/realview_pb11mp.c b/arch/arm/mach-realview/realview_pb11mp.c
index 3e02731af959..7fbefbbebaf0 100644
--- a/arch/arm/mach-realview/realview_pb11mp.c
+++ b/arch/arm/mach-realview/realview_pb11mp.c
@@ -31,8 +31,8 @@
31#include <asm/irq.h> 31#include <asm/irq.h>
32#include <asm/leds.h> 32#include <asm/leds.h>
33#include <asm/mach-types.h> 33#include <asm/mach-types.h>
34#include <asm/pmu.h>
34#include <asm/hardware/gic.h> 35#include <asm/hardware/gic.h>
35#include <asm/hardware/icst307.h>
36#include <asm/hardware/cache-l2x0.h> 36#include <asm/hardware/cache-l2x0.h>
37#include <asm/localtimer.h> 37#include <asm/localtimer.h>
38 38
@@ -45,7 +45,6 @@
45#include <mach/irqs.h> 45#include <mach/irqs.h>
46 46
47#include "core.h" 47#include "core.h"
48#include "clock.h"
49 48
50static struct map_desc realview_pb11mp_io_desc[] __initdata = { 49static struct map_desc realview_pb11mp_io_desc[] __initdata = {
51 { 50 {
@@ -260,6 +259,36 @@ static struct resource realview_pb11mp_isp1761_resources[] = {
260 }, 259 },
261}; 260};
262 261
262static struct resource pmu_resources[] = {
263 [0] = {
264 .start = IRQ_TC11MP_PMU_CPU0,
265 .end = IRQ_TC11MP_PMU_CPU0,
266 .flags = IORESOURCE_IRQ,
267 },
268 [1] = {
269 .start = IRQ_TC11MP_PMU_CPU1,
270 .end = IRQ_TC11MP_PMU_CPU1,
271 .flags = IORESOURCE_IRQ,
272 },
273 [2] = {
274 .start = IRQ_TC11MP_PMU_CPU2,
275 .end = IRQ_TC11MP_PMU_CPU2,
276 .flags = IORESOURCE_IRQ,
277 },
278 [3] = {
279 .start = IRQ_TC11MP_PMU_CPU3,
280 .end = IRQ_TC11MP_PMU_CPU3,
281 .flags = IORESOURCE_IRQ,
282 },
283};
284
285static struct platform_device pmu_device = {
286 .name = "arm-pmu",
287 .id = ARM_PMU_DEVICE_CPU,
288 .num_resources = ARRAY_SIZE(pmu_resources),
289 .resource = pmu_resources,
290};
291
263static void __init gic_init_irq(void) 292static void __init gic_init_irq(void)
264{ 293{
265 unsigned int pldctrl; 294 unsigned int pldctrl;
@@ -329,6 +358,7 @@ static void __init realview_pb11mp_init(void)
329 platform_device_register(&realview_i2c_device); 358 platform_device_register(&realview_i2c_device);
330 platform_device_register(&realview_cf_device); 359 platform_device_register(&realview_cf_device);
331 realview_usb_register(realview_pb11mp_isp1761_resources); 360 realview_usb_register(realview_pb11mp_isp1761_resources);
361 platform_device_register(&pmu_device);
332 362
333 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 363 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
334 struct amba_device *d = amba_devs[i]; 364 struct amba_device *d = amba_devs[i];
diff --git a/arch/arm/mach-realview/realview_pba8.c b/arch/arm/mach-realview/realview_pba8.c
index fe4e25c4201a..d3c113b3dfce 100644
--- a/arch/arm/mach-realview/realview_pba8.c
+++ b/arch/arm/mach-realview/realview_pba8.c
@@ -30,8 +30,8 @@
30#include <asm/irq.h> 30#include <asm/irq.h>
31#include <asm/leds.h> 31#include <asm/leds.h>
32#include <asm/mach-types.h> 32#include <asm/mach-types.h>
33#include <asm/pmu.h>
33#include <asm/hardware/gic.h> 34#include <asm/hardware/gic.h>
34#include <asm/hardware/icst307.h>
35 35
36#include <asm/mach/arch.h> 36#include <asm/mach/arch.h>
37#include <asm/mach/map.h> 37#include <asm/mach/map.h>
@@ -42,7 +42,6 @@
42#include <mach/irqs.h> 42#include <mach/irqs.h>
43 43
44#include "core.h" 44#include "core.h"
45#include "clock.h"
46 45
47static struct map_desc realview_pba8_io_desc[] __initdata = { 46static struct map_desc realview_pba8_io_desc[] __initdata = {
48 { 47 {
@@ -250,6 +249,19 @@ static struct resource realview_pba8_isp1761_resources[] = {
250 }, 249 },
251}; 250};
252 251
252static struct resource pmu_resource = {
253 .start = IRQ_PBA8_PMU,
254 .end = IRQ_PBA8_PMU,
255 .flags = IORESOURCE_IRQ,
256};
257
258static struct platform_device pmu_device = {
259 .name = "arm-pmu",
260 .id = ARM_PMU_DEVICE_CPU,
261 .num_resources = 1,
262 .resource = &pmu_resource,
263};
264
253static void __init gic_init_irq(void) 265static void __init gic_init_irq(void)
254{ 266{
255 /* ARM PB-A8 on-board GIC */ 267 /* ARM PB-A8 on-board GIC */
@@ -296,6 +308,7 @@ static void __init realview_pba8_init(void)
296 platform_device_register(&realview_i2c_device); 308 platform_device_register(&realview_i2c_device);
297 platform_device_register(&realview_cf_device); 309 platform_device_register(&realview_cf_device);
298 realview_usb_register(realview_pba8_isp1761_resources); 310 realview_usb_register(realview_pba8_isp1761_resources);
311 platform_device_register(&pmu_device);
299 312
300 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 313 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
301 struct amba_device *d = amba_devs[i]; 314 struct amba_device *d = amba_devs[i];
diff --git a/arch/arm/mach-realview/realview_pbx.c b/arch/arm/mach-realview/realview_pbx.c
index d94857eb0690..a235ba30996b 100644
--- a/arch/arm/mach-realview/realview_pbx.c
+++ b/arch/arm/mach-realview/realview_pbx.c
@@ -29,6 +29,7 @@
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <asm/leds.h> 30#include <asm/leds.h>
31#include <asm/mach-types.h> 31#include <asm/mach-types.h>
32#include <asm/pmu.h>
32#include <asm/smp_twd.h> 33#include <asm/smp_twd.h>
33#include <asm/hardware/gic.h> 34#include <asm/hardware/gic.h>
34#include <asm/hardware/cache-l2x0.h> 35#include <asm/hardware/cache-l2x0.h>
@@ -270,6 +271,36 @@ static struct resource realview_pbx_isp1761_resources[] = {
270 }, 271 },
271}; 272};
272 273
274static struct resource pmu_resources[] = {
275 [0] = {
276 .start = IRQ_PBX_PMU_CPU0,
277 .end = IRQ_PBX_PMU_CPU0,
278 .flags = IORESOURCE_IRQ,
279 },
280 [1] = {
281 .start = IRQ_PBX_PMU_CPU1,
282 .end = IRQ_PBX_PMU_CPU1,
283 .flags = IORESOURCE_IRQ,
284 },
285 [2] = {
286 .start = IRQ_PBX_PMU_CPU2,
287 .end = IRQ_PBX_PMU_CPU2,
288 .flags = IORESOURCE_IRQ,
289 },
290 [3] = {
291 .start = IRQ_PBX_PMU_CPU3,
292 .end = IRQ_PBX_PMU_CPU3,
293 .flags = IORESOURCE_IRQ,
294 },
295};
296
297static struct platform_device pmu_device = {
298 .name = "arm-pmu",
299 .id = ARM_PMU_DEVICE_CPU,
300 .num_resources = ARRAY_SIZE(pmu_resources),
301 .resource = pmu_resources,
302};
303
273static void __init gic_init_irq(void) 304static void __init gic_init_irq(void)
274{ 305{
275 /* ARM PBX on-board GIC */ 306 /* ARM PBX on-board GIC */
@@ -354,6 +385,7 @@ static void __init realview_pbx_init(void)
354 /* 16KB way size, 8-way associativity, parity disabled 385 /* 16KB way size, 8-way associativity, parity disabled
355 * Bits: .. 0 0 0 0 1 00 1 0 1 001 0 000 0 .... .... .... */ 386 * Bits: .. 0 0 0 0 1 00 1 0 1 001 0 000 0 .... .... .... */
356 l2x0_init(l2x0_base, 0x02520000, 0xc0000fff); 387 l2x0_init(l2x0_base, 0x02520000, 0xc0000fff);
388 platform_device_register(&pmu_device);
357 } 389 }
358#endif 390#endif
359 391