diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/include/asm/hardware/arm_timer.h | 5 | ||||
-rw-r--r-- | arch/arm/mach-vexpress/core.h | 9 | ||||
-rw-r--r-- | arch/arm/mach-vexpress/ct-ca9x4.c | 58 | ||||
-rw-r--r-- | arch/arm/mach-vexpress/include/mach/ct-ca9x4.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-vexpress/include/mach/motherboard.h | 52 | ||||
-rw-r--r-- | arch/arm/mach-vexpress/platsmp.c | 5 | ||||
-rw-r--r-- | arch/arm/mach-vexpress/v2m.c | 68 |
7 files changed, 102 insertions, 98 deletions
diff --git a/arch/arm/include/asm/hardware/arm_timer.h b/arch/arm/include/asm/hardware/arm_timer.h index c0f4e7bf22de..d6030ff599db 100644 --- a/arch/arm/include/asm/hardware/arm_timer.h +++ b/arch/arm/include/asm/hardware/arm_timer.h | |||
@@ -9,7 +9,12 @@ | |||
9 | * | 9 | * |
10 | * Integrator AP has 16-bit timers, Integrator CP, Versatile and Realview | 10 | * Integrator AP has 16-bit timers, Integrator CP, Versatile and Realview |
11 | * can have 16-bit or 32-bit selectable via a bit in the control register. | 11 | * can have 16-bit or 32-bit selectable via a bit in the control register. |
12 | * | ||
13 | * Every SP804 contains two identical timers. | ||
12 | */ | 14 | */ |
15 | #define TIMER_1_BASE 0x00 | ||
16 | #define TIMER_2_BASE 0x20 | ||
17 | |||
13 | #define TIMER_LOAD 0x00 /* ACVR rw */ | 18 | #define TIMER_LOAD 0x00 /* ACVR rw */ |
14 | #define TIMER_VALUE 0x04 /* ACVR ro */ | 19 | #define TIMER_VALUE 0x04 /* ACVR ro */ |
15 | #define TIMER_CTRL 0x08 /* ACVR rw */ | 20 | #define TIMER_CTRL 0x08 /* ACVR rw */ |
diff --git a/arch/arm/mach-vexpress/core.h b/arch/arm/mach-vexpress/core.h index f4397159c173..3508f6ef78ea 100644 --- a/arch/arm/mach-vexpress/core.h +++ b/arch/arm/mach-vexpress/core.h | |||
@@ -1,6 +1,3 @@ | |||
1 | #define __MMIO_P2V(x) (((x) & 0xfffff) | (((x) & 0x0f000000) >> 4) | 0xf8000000) | ||
2 | #define MMIO_P2V(x) ((void __iomem *)__MMIO_P2V(x)) | ||
3 | |||
4 | #define AMBA_DEVICE(name,busid,base,plat) \ | 1 | #define AMBA_DEVICE(name,busid,base,plat) \ |
5 | struct amba_device name##_device = { \ | 2 | struct amba_device name##_device = { \ |
6 | .dev = { \ | 3 | .dev = { \ |
@@ -17,3 +14,9 @@ struct amba_device name##_device = { \ | |||
17 | .irq = IRQ_##base, \ | 14 | .irq = IRQ_##base, \ |
18 | /* .dma = DMA_##base,*/ \ | 15 | /* .dma = DMA_##base,*/ \ |
19 | } | 16 | } |
17 | |||
18 | /* 2MB large area for motherboard's peripherals static mapping */ | ||
19 | #define V2M_PERIPH 0xf8000000 | ||
20 | |||
21 | /* Tile's peripherals static mappings should start here */ | ||
22 | #define V2T_PERIPH 0xf8200000 | ||
diff --git a/arch/arm/mach-vexpress/ct-ca9x4.c b/arch/arm/mach-vexpress/ct-ca9x4.c index b1e87c184e54..a2f7d5d3ca40 100644 --- a/arch/arm/mach-vexpress/ct-ca9x4.c +++ b/arch/arm/mach-vexpress/ct-ca9x4.c | |||
@@ -30,57 +30,29 @@ | |||
30 | 30 | ||
31 | #include <plat/clcd.h> | 31 | #include <plat/clcd.h> |
32 | 32 | ||
33 | #define V2M_PA_CS7 0x10000000 | ||
34 | |||
35 | static struct map_desc ct_ca9x4_io_desc[] __initdata = { | 33 | static struct map_desc ct_ca9x4_io_desc[] __initdata = { |
36 | { | 34 | { |
37 | .virtual = __MMIO_P2V(CT_CA9X4_MPIC), | 35 | .virtual = V2T_PERIPH, |
38 | .pfn = __phys_to_pfn(CT_CA9X4_MPIC), | 36 | .pfn = __phys_to_pfn(CT_CA9X4_MPIC), |
39 | .length = SZ_16K, | 37 | .length = SZ_8K, |
40 | .type = MT_DEVICE, | 38 | .type = MT_DEVICE, |
41 | }, { | ||
42 | .virtual = __MMIO_P2V(CT_CA9X4_SP804_TIMER), | ||
43 | .pfn = __phys_to_pfn(CT_CA9X4_SP804_TIMER), | ||
44 | .length = SZ_4K, | ||
45 | .type = MT_DEVICE, | ||
46 | }, { | ||
47 | .virtual = __MMIO_P2V(CT_CA9X4_L2CC), | ||
48 | .pfn = __phys_to_pfn(CT_CA9X4_L2CC), | ||
49 | .length = SZ_4K, | ||
50 | .type = MT_DEVICE, | ||
51 | }, | 39 | }, |
52 | }; | 40 | }; |
53 | 41 | ||
54 | static void __init ct_ca9x4_map_io(void) | 42 | static void __init ct_ca9x4_map_io(void) |
55 | { | 43 | { |
44 | iotable_init(ct_ca9x4_io_desc, ARRAY_SIZE(ct_ca9x4_io_desc)); | ||
56 | #ifdef CONFIG_LOCAL_TIMERS | 45 | #ifdef CONFIG_LOCAL_TIMERS |
57 | twd_base = MMIO_P2V(A9_MPCORE_TWD); | 46 | twd_base = ioremap(A9_MPCORE_TWD, SZ_32); |
58 | #endif | 47 | #endif |
59 | iotable_init(ct_ca9x4_io_desc, ARRAY_SIZE(ct_ca9x4_io_desc)); | ||
60 | } | 48 | } |
61 | 49 | ||
62 | static void __init ct_ca9x4_init_irq(void) | 50 | static void __init ct_ca9x4_init_irq(void) |
63 | { | 51 | { |
64 | gic_init(0, 29, MMIO_P2V(A9_MPCORE_GIC_DIST), | 52 | gic_init(0, 29, ioremap(A9_MPCORE_GIC_DIST, SZ_4K), |
65 | MMIO_P2V(A9_MPCORE_GIC_CPU)); | 53 | ioremap(A9_MPCORE_GIC_CPU, SZ_256)); |
66 | } | ||
67 | |||
68 | #if 0 | ||
69 | static void __init ct_ca9x4_timer_init(void) | ||
70 | { | ||
71 | writel(0, MMIO_P2V(CT_CA9X4_TIMER0) + TIMER_CTRL); | ||
72 | writel(0, MMIO_P2V(CT_CA9X4_TIMER1) + TIMER_CTRL); | ||
73 | |||
74 | sp804_clocksource_init(MMIO_P2V(CT_CA9X4_TIMER1), "ct-timer1"); | ||
75 | sp804_clockevents_init(MMIO_P2V(CT_CA9X4_TIMER0), IRQ_CT_CA9X4_TIMER0, | ||
76 | "ct-timer0"); | ||
77 | } | 54 | } |
78 | 55 | ||
79 | static struct sys_timer ct_ca9x4_timer = { | ||
80 | .init = ct_ca9x4_timer_init, | ||
81 | }; | ||
82 | #endif | ||
83 | |||
84 | static void ct_ca9x4_clcd_enable(struct clcd_fb *fb) | 56 | static void ct_ca9x4_clcd_enable(struct clcd_fb *fb) |
85 | { | 57 | { |
86 | v2m_cfg_write(SYS_CFG_MUXFPGA | SYS_CFG_SITE_DB1, 0); | 58 | v2m_cfg_write(SYS_CFG_MUXFPGA | SYS_CFG_SITE_DB1, 0); |
@@ -201,7 +173,7 @@ static void __init ct_ca9x4_init(void) | |||
201 | int i; | 173 | int i; |
202 | 174 | ||
203 | #ifdef CONFIG_CACHE_L2X0 | 175 | #ifdef CONFIG_CACHE_L2X0 |
204 | void __iomem *l2x0_base = MMIO_P2V(CT_CA9X4_L2CC); | 176 | void __iomem *l2x0_base = ioremap(CT_CA9X4_L2CC, SZ_4K); |
205 | 177 | ||
206 | /* set RAM latencies to 1 cycle for this core tile. */ | 178 | /* set RAM latencies to 1 cycle for this core tile. */ |
207 | writel(0, l2x0_base + L2X0_TAG_LATENCY_CTRL); | 179 | writel(0, l2x0_base + L2X0_TAG_LATENCY_CTRL); |
@@ -217,9 +189,17 @@ static void __init ct_ca9x4_init(void) | |||
217 | } | 189 | } |
218 | 190 | ||
219 | #ifdef CONFIG_SMP | 191 | #ifdef CONFIG_SMP |
192 | static void *ct_ca9x4_scu_base __initdata; | ||
193 | |||
220 | static void __init ct_ca9x4_init_cpu_map(void) | 194 | static void __init ct_ca9x4_init_cpu_map(void) |
221 | { | 195 | { |
222 | int i, ncores = scu_get_core_count(MMIO_P2V(A9_MPCORE_SCU)); | 196 | int i, ncores; |
197 | |||
198 | ct_ca9x4_scu_base = ioremap(A9_MPCORE_SCU, SZ_128); | ||
199 | if (WARN_ON(!ct_ca9x4_scu_base)) | ||
200 | return; | ||
201 | |||
202 | ncores = scu_get_core_count(ct_ca9x4_scu_base); | ||
223 | 203 | ||
224 | if (ncores > nr_cpu_ids) { | 204 | if (ncores > nr_cpu_ids) { |
225 | pr_warn("SMP: %u cores greater than maximum (%u), clipping\n", | 205 | pr_warn("SMP: %u cores greater than maximum (%u), clipping\n", |
@@ -235,7 +215,7 @@ static void __init ct_ca9x4_init_cpu_map(void) | |||
235 | 215 | ||
236 | static void __init ct_ca9x4_smp_enable(unsigned int max_cpus) | 216 | static void __init ct_ca9x4_smp_enable(unsigned int max_cpus) |
237 | { | 217 | { |
238 | scu_enable(MMIO_P2V(A9_MPCORE_SCU)); | 218 | scu_enable(ct_ca9x4_scu_base); |
239 | } | 219 | } |
240 | #endif | 220 | #endif |
241 | 221 | ||
diff --git a/arch/arm/mach-vexpress/include/mach/ct-ca9x4.h b/arch/arm/mach-vexpress/include/mach/ct-ca9x4.h index a34d3d4faae1..2260fde86614 100644 --- a/arch/arm/mach-vexpress/include/mach/ct-ca9x4.h +++ b/arch/arm/mach-vexpress/include/mach/ct-ca9x4.h | |||
@@ -22,9 +22,6 @@ | |||
22 | #define CT_CA9X4_SYSWDT (0x1e007000) | 22 | #define CT_CA9X4_SYSWDT (0x1e007000) |
23 | #define CT_CA9X4_L2CC (0x1e00a000) | 23 | #define CT_CA9X4_L2CC (0x1e00a000) |
24 | 24 | ||
25 | #define CT_CA9X4_TIMER0 (CT_CA9X4_SP804_TIMER + 0x000) | ||
26 | #define CT_CA9X4_TIMER1 (CT_CA9X4_SP804_TIMER + 0x020) | ||
27 | |||
28 | #define A9_MPCORE_SCU (CT_CA9X4_MPIC + 0x0000) | 25 | #define A9_MPCORE_SCU (CT_CA9X4_MPIC + 0x0000) |
29 | #define A9_MPCORE_GIC_CPU (CT_CA9X4_MPIC + 0x0100) | 26 | #define A9_MPCORE_GIC_CPU (CT_CA9X4_MPIC + 0x0100) |
30 | #define A9_MPCORE_GIT (CT_CA9X4_MPIC + 0x0200) | 27 | #define A9_MPCORE_GIT (CT_CA9X4_MPIC + 0x0200) |
diff --git a/arch/arm/mach-vexpress/include/mach/motherboard.h b/arch/arm/mach-vexpress/include/mach/motherboard.h index 0a3a37518405..b4c498c1dbee 100644 --- a/arch/arm/mach-vexpress/include/mach/motherboard.h +++ b/arch/arm/mach-vexpress/include/mach/motherboard.h | |||
@@ -39,33 +39,30 @@ | |||
39 | #define V2M_CF (V2M_PA_CS7 + 0x0001a000) | 39 | #define V2M_CF (V2M_PA_CS7 + 0x0001a000) |
40 | #define V2M_CLCD (V2M_PA_CS7 + 0x0001f000) | 40 | #define V2M_CLCD (V2M_PA_CS7 + 0x0001f000) |
41 | 41 | ||
42 | #define V2M_SYS_ID (V2M_SYSREGS + 0x000) | 42 | /* |
43 | #define V2M_SYS_SW (V2M_SYSREGS + 0x004) | 43 | * Offsets from SYSREGS base |
44 | #define V2M_SYS_LED (V2M_SYSREGS + 0x008) | 44 | */ |
45 | #define V2M_SYS_100HZ (V2M_SYSREGS + 0x024) | 45 | #define V2M_SYS_ID 0x000 |
46 | #define V2M_SYS_FLAGS (V2M_SYSREGS + 0x030) | 46 | #define V2M_SYS_SW 0x004 |
47 | #define V2M_SYS_FLAGSSET (V2M_SYSREGS + 0x030) | 47 | #define V2M_SYS_LED 0x008 |
48 | #define V2M_SYS_FLAGSCLR (V2M_SYSREGS + 0x034) | 48 | #define V2M_SYS_100HZ 0x024 |
49 | #define V2M_SYS_NVFLAGS (V2M_SYSREGS + 0x038) | 49 | #define V2M_SYS_FLAGS 0x030 |
50 | #define V2M_SYS_NVFLAGSSET (V2M_SYSREGS + 0x038) | 50 | #define V2M_SYS_FLAGSSET 0x030 |
51 | #define V2M_SYS_NVFLAGSCLR (V2M_SYSREGS + 0x03c) | 51 | #define V2M_SYS_FLAGSCLR 0x034 |
52 | #define V2M_SYS_MCI (V2M_SYSREGS + 0x048) | 52 | #define V2M_SYS_NVFLAGS 0x038 |
53 | #define V2M_SYS_FLASH (V2M_SYSREGS + 0x03c) | 53 | #define V2M_SYS_NVFLAGSSET 0x038 |
54 | #define V2M_SYS_CFGSW (V2M_SYSREGS + 0x058) | 54 | #define V2M_SYS_NVFLAGSCLR 0x03c |
55 | #define V2M_SYS_24MHZ (V2M_SYSREGS + 0x05c) | 55 | #define V2M_SYS_MCI 0x048 |
56 | #define V2M_SYS_MISC (V2M_SYSREGS + 0x060) | 56 | #define V2M_SYS_FLASH 0x03c |
57 | #define V2M_SYS_DMA (V2M_SYSREGS + 0x064) | 57 | #define V2M_SYS_CFGSW 0x058 |
58 | #define V2M_SYS_PROCID0 (V2M_SYSREGS + 0x084) | 58 | #define V2M_SYS_24MHZ 0x05c |
59 | #define V2M_SYS_PROCID1 (V2M_SYSREGS + 0x088) | 59 | #define V2M_SYS_MISC 0x060 |
60 | #define V2M_SYS_CFGDATA (V2M_SYSREGS + 0x0a0) | 60 | #define V2M_SYS_DMA 0x064 |
61 | #define V2M_SYS_CFGCTRL (V2M_SYSREGS + 0x0a4) | 61 | #define V2M_SYS_PROCID0 0x084 |
62 | #define V2M_SYS_CFGSTAT (V2M_SYSREGS + 0x0a8) | 62 | #define V2M_SYS_PROCID1 0x088 |
63 | 63 | #define V2M_SYS_CFGDATA 0x0a0 | |
64 | #define V2M_TIMER0 (V2M_TIMER01 + 0x000) | 64 | #define V2M_SYS_CFGCTRL 0x0a4 |
65 | #define V2M_TIMER1 (V2M_TIMER01 + 0x020) | 65 | #define V2M_SYS_CFGSTAT 0x0a8 |
66 | |||
67 | #define V2M_TIMER2 (V2M_TIMER23 + 0x000) | ||
68 | #define V2M_TIMER3 (V2M_TIMER23 + 0x020) | ||
69 | 66 | ||
70 | 67 | ||
71 | /* | 68 | /* |
@@ -117,6 +114,7 @@ | |||
117 | 114 | ||
118 | int v2m_cfg_write(u32 devfn, u32 data); | 115 | int v2m_cfg_write(u32 devfn, u32 data); |
119 | int v2m_cfg_read(u32 devfn, u32 *data); | 116 | int v2m_cfg_read(u32 devfn, u32 *data); |
117 | void v2m_flags_set(u32 data); | ||
120 | 118 | ||
121 | /* | 119 | /* |
122 | * Core tile IDs | 120 | * Core tile IDs |
diff --git a/arch/arm/mach-vexpress/platsmp.c b/arch/arm/mach-vexpress/platsmp.c index 124ffb169093..a1ed6d68597d 100644 --- a/arch/arm/mach-vexpress/platsmp.c +++ b/arch/arm/mach-vexpress/platsmp.c | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/io.h> | 14 | #include <linux/io.h> |
15 | 15 | ||
16 | #include <mach/motherboard.h> | 16 | #include <mach/motherboard.h> |
17 | #define V2M_PA_CS7 0x10000000 | ||
18 | 17 | ||
19 | #include "core.h" | 18 | #include "core.h" |
20 | 19 | ||
@@ -43,7 +42,5 @@ void __init platform_smp_prepare_cpus(unsigned int max_cpus) | |||
43 | * until it receives a soft interrupt, and then the | 42 | * until it receives a soft interrupt, and then the |
44 | * secondary CPU branches to this address. | 43 | * secondary CPU branches to this address. |
45 | */ | 44 | */ |
46 | writel(~0, MMIO_P2V(V2M_SYS_FLAGSCLR)); | 45 | v2m_flags_set(virt_to_phys(versatile_secondary_startup)); |
47 | writel(virt_to_phys(versatile_secondary_startup), | ||
48 | MMIO_P2V(V2M_SYS_FLAGSSET)); | ||
49 | } | 46 | } |
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c index b4a28ca0e50a..c76f9144898a 100644 --- a/arch/arm/mach-vexpress/v2m.c +++ b/arch/arm/mach-vexpress/v2m.c | |||
@@ -40,29 +40,45 @@ | |||
40 | 40 | ||
41 | static struct map_desc v2m_io_desc[] __initdata = { | 41 | static struct map_desc v2m_io_desc[] __initdata = { |
42 | { | 42 | { |
43 | .virtual = __MMIO_P2V(V2M_PA_CS7), | 43 | .virtual = V2M_PERIPH, |
44 | .pfn = __phys_to_pfn(V2M_PA_CS7), | 44 | .pfn = __phys_to_pfn(V2M_PA_CS7), |
45 | .length = SZ_128K, | 45 | .length = SZ_128K, |
46 | .type = MT_DEVICE, | 46 | .type = MT_DEVICE, |
47 | }, | 47 | }, |
48 | }; | 48 | }; |
49 | 49 | ||
50 | static void __init v2m_timer_init(void) | 50 | static void __iomem *v2m_sysreg_base; |
51 | |||
52 | static void __init v2m_sysctl_init(void __iomem *base) | ||
51 | { | 53 | { |
52 | u32 scctrl; | 54 | u32 scctrl; |
53 | 55 | ||
56 | if (WARN_ON(!base)) | ||
57 | return; | ||
58 | |||
54 | /* Select 1MHz TIMCLK as the reference clock for SP804 timers */ | 59 | /* Select 1MHz TIMCLK as the reference clock for SP804 timers */ |
55 | scctrl = readl(MMIO_P2V(V2M_SYSCTL + SCCTRL)); | 60 | scctrl = readl(base + SCCTRL); |
56 | scctrl |= SCCTRL_TIMEREN0SEL_TIMCLK; | 61 | scctrl |= SCCTRL_TIMEREN0SEL_TIMCLK; |
57 | scctrl |= SCCTRL_TIMEREN1SEL_TIMCLK; | 62 | scctrl |= SCCTRL_TIMEREN1SEL_TIMCLK; |
58 | writel(scctrl, MMIO_P2V(V2M_SYSCTL + SCCTRL)); | 63 | writel(scctrl, base + SCCTRL); |
64 | } | ||
59 | 65 | ||
60 | writel(0, MMIO_P2V(V2M_TIMER0) + TIMER_CTRL); | 66 | static void __init v2m_sp804_init(void __iomem *base, unsigned int irq) |
61 | writel(0, MMIO_P2V(V2M_TIMER1) + TIMER_CTRL); | 67 | { |
68 | if (WARN_ON(!base || irq == NO_IRQ)) | ||
69 | return; | ||
70 | |||
71 | writel(0, base + TIMER_1_BASE + TIMER_CTRL); | ||
72 | writel(0, base + TIMER_2_BASE + TIMER_CTRL); | ||
62 | 73 | ||
63 | sp804_clocksource_init(MMIO_P2V(V2M_TIMER1), "v2m-timer1"); | 74 | sp804_clocksource_init(base + TIMER_2_BASE, "v2m-timer1"); |
64 | sp804_clockevents_init(MMIO_P2V(V2M_TIMER0), IRQ_V2M_TIMER0, | 75 | sp804_clockevents_init(base + TIMER_1_BASE, irq, "v2m-timer0"); |
65 | "v2m-timer0"); | 76 | } |
77 | |||
78 | static void __init v2m_timer_init(void) | ||
79 | { | ||
80 | v2m_sysctl_init(ioremap(V2M_SYSCTL, SZ_4K)); | ||
81 | v2m_sp804_init(ioremap(V2M_TIMER01, SZ_4K), IRQ_V2M_TIMER0); | ||
66 | } | 82 | } |
67 | 83 | ||
68 | static struct sys_timer v2m_timer = { | 84 | static struct sys_timer v2m_timer = { |
@@ -82,14 +98,14 @@ int v2m_cfg_write(u32 devfn, u32 data) | |||
82 | devfn |= SYS_CFG_START | SYS_CFG_WRITE; | 98 | devfn |= SYS_CFG_START | SYS_CFG_WRITE; |
83 | 99 | ||
84 | spin_lock(&v2m_cfg_lock); | 100 | spin_lock(&v2m_cfg_lock); |
85 | val = readl(MMIO_P2V(V2M_SYS_CFGSTAT)); | 101 | val = readl(v2m_sysreg_base + V2M_SYS_CFGSTAT); |
86 | writel(val & ~SYS_CFG_COMPLETE, MMIO_P2V(V2M_SYS_CFGSTAT)); | 102 | writel(val & ~SYS_CFG_COMPLETE, v2m_sysreg_base + V2M_SYS_CFGSTAT); |
87 | 103 | ||
88 | writel(data, MMIO_P2V(V2M_SYS_CFGDATA)); | 104 | writel(data, v2m_sysreg_base + V2M_SYS_CFGDATA); |
89 | writel(devfn, MMIO_P2V(V2M_SYS_CFGCTRL)); | 105 | writel(devfn, v2m_sysreg_base + V2M_SYS_CFGCTRL); |
90 | 106 | ||
91 | do { | 107 | do { |
92 | val = readl(MMIO_P2V(V2M_SYS_CFGSTAT)); | 108 | val = readl(v2m_sysreg_base + V2M_SYS_CFGSTAT); |
93 | } while (val == 0); | 109 | } while (val == 0); |
94 | spin_unlock(&v2m_cfg_lock); | 110 | spin_unlock(&v2m_cfg_lock); |
95 | 111 | ||
@@ -103,22 +119,28 @@ int v2m_cfg_read(u32 devfn, u32 *data) | |||
103 | devfn |= SYS_CFG_START; | 119 | devfn |= SYS_CFG_START; |
104 | 120 | ||
105 | spin_lock(&v2m_cfg_lock); | 121 | spin_lock(&v2m_cfg_lock); |
106 | writel(0, MMIO_P2V(V2M_SYS_CFGSTAT)); | 122 | writel(0, v2m_sysreg_base + V2M_SYS_CFGSTAT); |
107 | writel(devfn, MMIO_P2V(V2M_SYS_CFGCTRL)); | 123 | writel(devfn, v2m_sysreg_base + V2M_SYS_CFGCTRL); |
108 | 124 | ||
109 | mb(); | 125 | mb(); |
110 | 126 | ||
111 | do { | 127 | do { |
112 | cpu_relax(); | 128 | cpu_relax(); |
113 | val = readl(MMIO_P2V(V2M_SYS_CFGSTAT)); | 129 | val = readl(v2m_sysreg_base + V2M_SYS_CFGSTAT); |
114 | } while (val == 0); | 130 | } while (val == 0); |
115 | 131 | ||
116 | *data = readl(MMIO_P2V(V2M_SYS_CFGDATA)); | 132 | *data = readl(v2m_sysreg_base + V2M_SYS_CFGDATA); |
117 | spin_unlock(&v2m_cfg_lock); | 133 | spin_unlock(&v2m_cfg_lock); |
118 | 134 | ||
119 | return !!(val & SYS_CFG_ERR); | 135 | return !!(val & SYS_CFG_ERR); |
120 | } | 136 | } |
121 | 137 | ||
138 | void __init v2m_flags_set(u32 data) | ||
139 | { | ||
140 | writel(~0, v2m_sysreg_base + V2M_SYS_FLAGSCLR); | ||
141 | writel(data, v2m_sysreg_base + V2M_SYS_FLAGSSET); | ||
142 | } | ||
143 | |||
122 | 144 | ||
123 | static struct resource v2m_pcie_i2c_resource = { | 145 | static struct resource v2m_pcie_i2c_resource = { |
124 | .start = V2M_SERIAL_BUS_PCI, | 146 | .start = V2M_SERIAL_BUS_PCI, |
@@ -204,7 +226,7 @@ static struct platform_device v2m_usb_device = { | |||
204 | 226 | ||
205 | static void v2m_flash_set_vpp(struct platform_device *pdev, int on) | 227 | static void v2m_flash_set_vpp(struct platform_device *pdev, int on) |
206 | { | 228 | { |
207 | writel(on != 0, MMIO_P2V(V2M_SYS_FLASH)); | 229 | writel(on != 0, v2m_sysreg_base + V2M_SYS_FLASH); |
208 | } | 230 | } |
209 | 231 | ||
210 | static struct physmap_flash_data v2m_flash_data = { | 232 | static struct physmap_flash_data v2m_flash_data = { |
@@ -258,7 +280,7 @@ static struct platform_device v2m_cf_device = { | |||
258 | 280 | ||
259 | static unsigned int v2m_mmci_status(struct device *dev) | 281 | static unsigned int v2m_mmci_status(struct device *dev) |
260 | { | 282 | { |
261 | return readl(MMIO_P2V(V2M_SYS_MCI)) & (1 << 0); | 283 | return readl(v2m_sysreg_base + V2M_SYS_MCI) & (1 << 0); |
262 | } | 284 | } |
263 | 285 | ||
264 | static struct mmci_platform_data v2m_mmci_data = { | 286 | static struct mmci_platform_data v2m_mmci_data = { |
@@ -371,7 +393,7 @@ static void __init v2m_init_early(void) | |||
371 | { | 393 | { |
372 | ct_desc->init_early(); | 394 | ct_desc->init_early(); |
373 | clkdev_add_table(v2m_lookups, ARRAY_SIZE(v2m_lookups)); | 395 | clkdev_add_table(v2m_lookups, ARRAY_SIZE(v2m_lookups)); |
374 | versatile_sched_clock_init(MMIO_P2V(V2M_SYS_24MHZ), 24000000); | 396 | versatile_sched_clock_init(v2m_sysreg_base + V2M_SYS_24MHZ, 24000000); |
375 | } | 397 | } |
376 | 398 | ||
377 | static void v2m_power_off(void) | 399 | static void v2m_power_off(void) |
@@ -400,7 +422,8 @@ static void __init v2m_populate_ct_desc(void) | |||
400 | u32 current_tile_id; | 422 | u32 current_tile_id; |
401 | 423 | ||
402 | ct_desc = NULL; | 424 | ct_desc = NULL; |
403 | current_tile_id = readl(MMIO_P2V(V2M_SYS_PROCID0)) & V2M_CT_ID_MASK; | 425 | current_tile_id = readl(v2m_sysreg_base + V2M_SYS_PROCID0) |
426 | & V2M_CT_ID_MASK; | ||
404 | 427 | ||
405 | for (i = 0; i < ARRAY_SIZE(ct_descs) && !ct_desc; ++i) | 428 | for (i = 0; i < ARRAY_SIZE(ct_descs) && !ct_desc; ++i) |
406 | if (ct_descs[i]->id == current_tile_id) | 429 | if (ct_descs[i]->id == current_tile_id) |
@@ -414,6 +437,7 @@ static void __init v2m_populate_ct_desc(void) | |||
414 | static void __init v2m_map_io(void) | 437 | static void __init v2m_map_io(void) |
415 | { | 438 | { |
416 | iotable_init(v2m_io_desc, ARRAY_SIZE(v2m_io_desc)); | 439 | iotable_init(v2m_io_desc, ARRAY_SIZE(v2m_io_desc)); |
440 | v2m_sysreg_base = ioremap(V2M_SYSREGS, SZ_4K); | ||
417 | v2m_populate_ct_desc(); | 441 | v2m_populate_ct_desc(); |
418 | ct_desc->map_io(); | 442 | ct_desc->map_io(); |
419 | } | 443 | } |