ux500: remove build-time changing macros
[deliverable/linux.git] / arch / arm / mach-ux500 / cpu-db5500.c
1 /*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
5 * License terms: GNU General Public License (GPL) version 2
6 */
7
8 #include <linux/platform_device.h>
9 #include <linux/amba/bus.h>
10 #include <linux/io.h>
11 #include <linux/irq.h>
12
13 #include <asm/mach/map.h>
14
15 #include <plat/gpio.h>
16
17 #include <mach/hardware.h>
18 #include <mach/devices.h>
19 #include <mach/setup.h>
20 #include <mach/irqs.h>
21
22 #include "devices-db5500.h"
23
24 static struct map_desc u5500_io_desc[] __initdata = {
25 __IO_DEV_DESC(U5500_UART0_BASE, SZ_4K),
26 __IO_DEV_DESC(U5500_UART2_BASE, SZ_4K),
27 __IO_DEV_DESC(U5500_GIC_CPU_BASE, SZ_4K),
28 __IO_DEV_DESC(U5500_GIC_DIST_BASE, SZ_4K),
29 __IO_DEV_DESC(U5500_L2CC_BASE, SZ_4K),
30 __IO_DEV_DESC(U5500_TWD_BASE, SZ_4K),
31 __IO_DEV_DESC(U5500_MTU0_BASE, SZ_4K),
32 __IO_DEV_DESC(U5500_SCU_BASE, SZ_4K),
33 __IO_DEV_DESC(U5500_BACKUPRAM0_BASE, SZ_8K),
34
35 __IO_DEV_DESC(U5500_GPIO0_BASE, SZ_4K),
36 __IO_DEV_DESC(U5500_GPIO1_BASE, SZ_4K),
37 __IO_DEV_DESC(U5500_GPIO2_BASE, SZ_4K),
38 __IO_DEV_DESC(U5500_GPIO3_BASE, SZ_4K),
39 __IO_DEV_DESC(U5500_GPIO4_BASE, SZ_4K),
40 __IO_DEV_DESC(U5500_PRCMU_BASE, SZ_4K),
41 };
42
43 static struct resource mbox0_resources[] = {
44 {
45 .name = "mbox_peer",
46 .start = U5500_MBOX0_PEER_START,
47 .end = U5500_MBOX0_PEER_END,
48 .flags = IORESOURCE_MEM,
49 },
50 {
51 .name = "mbox_local",
52 .start = U5500_MBOX0_LOCAL_START,
53 .end = U5500_MBOX0_LOCAL_END,
54 .flags = IORESOURCE_MEM,
55 },
56 {
57 .name = "mbox_irq",
58 .start = MBOX_PAIR0_VIRT_IRQ,
59 .end = MBOX_PAIR0_VIRT_IRQ,
60 .flags = IORESOURCE_IRQ,
61 }
62 };
63
64 static struct resource mbox1_resources[] = {
65 {
66 .name = "mbox_peer",
67 .start = U5500_MBOX1_PEER_START,
68 .end = U5500_MBOX1_PEER_END,
69 .flags = IORESOURCE_MEM,
70 },
71 {
72 .name = "mbox_local",
73 .start = U5500_MBOX1_LOCAL_START,
74 .end = U5500_MBOX1_LOCAL_END,
75 .flags = IORESOURCE_MEM,
76 },
77 {
78 .name = "mbox_irq",
79 .start = MBOX_PAIR1_VIRT_IRQ,
80 .end = MBOX_PAIR1_VIRT_IRQ,
81 .flags = IORESOURCE_IRQ,
82 }
83 };
84
85 static struct resource mbox2_resources[] = {
86 {
87 .name = "mbox_peer",
88 .start = U5500_MBOX2_PEER_START,
89 .end = U5500_MBOX2_PEER_END,
90 .flags = IORESOURCE_MEM,
91 },
92 {
93 .name = "mbox_local",
94 .start = U5500_MBOX2_LOCAL_START,
95 .end = U5500_MBOX2_LOCAL_END,
96 .flags = IORESOURCE_MEM,
97 },
98 {
99 .name = "mbox_irq",
100 .start = MBOX_PAIR2_VIRT_IRQ,
101 .end = MBOX_PAIR2_VIRT_IRQ,
102 .flags = IORESOURCE_IRQ,
103 }
104 };
105
106 static struct platform_device mbox0_device = {
107 .id = 0,
108 .name = "mbox",
109 .resource = mbox0_resources,
110 .num_resources = ARRAY_SIZE(mbox0_resources),
111 };
112
113 static struct platform_device mbox1_device = {
114 .id = 1,
115 .name = "mbox",
116 .resource = mbox1_resources,
117 .num_resources = ARRAY_SIZE(mbox1_resources),
118 };
119
120 static struct platform_device mbox2_device = {
121 .id = 2,
122 .name = "mbox",
123 .resource = mbox2_resources,
124 .num_resources = ARRAY_SIZE(mbox2_resources),
125 };
126
127 static struct platform_device *u5500_platform_devs[] __initdata = {
128 &mbox0_device,
129 &mbox1_device,
130 &mbox2_device,
131 };
132
133 static resource_size_t __initdata db5500_gpio_base[] = {
134 U5500_GPIOBANK0_BASE,
135 U5500_GPIOBANK1_BASE,
136 U5500_GPIOBANK2_BASE,
137 U5500_GPIOBANK3_BASE,
138 U5500_GPIOBANK4_BASE,
139 U5500_GPIOBANK5_BASE,
140 U5500_GPIOBANK6_BASE,
141 U5500_GPIOBANK7_BASE,
142 };
143
144 static void __init db5500_add_gpios(void)
145 {
146 struct nmk_gpio_platform_data pdata = {
147 /* No custom data yet */
148 };
149
150 dbx500_add_gpios(ARRAY_AND_SIZE(db5500_gpio_base),
151 IRQ_DB5500_GPIO0, &pdata);
152 }
153
154 void __init u5500_map_io(void)
155 {
156 iotable_init(u5500_io_desc, ARRAY_SIZE(u5500_io_desc));
157 }
158
159 void __init u5500_init_devices(void)
160 {
161 db5500_add_gpios();
162 db5500_dma_init();
163 db5500_add_rtc();
164
165 platform_add_devices(u5500_platform_devs,
166 ARRAY_SIZE(u5500_platform_devs));
167 }
This page took 0.042446 seconds and 5 git commands to generate.