]>
Commit | Line | Data |
---|---|---|
9e4e7fe1 RV |
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/kernel.h> | |
9 | #include <linux/platform_device.h> | |
10 | #include <linux/interrupt.h> | |
11 | #include <linux/io.h> | |
5b1f7ddf | 12 | #include <linux/gpio.h> |
9e4e7fe1 RV |
13 | #include <linux/amba/bus.h> |
14 | ||
7b8ddb06 LW |
15 | #include <plat/ste_dma40.h> |
16 | ||
9e4e7fe1 RV |
17 | #include <mach/hardware.h> |
18 | #include <mach/setup.h> | |
19 | ||
7b8ddb06 LW |
20 | #include "ste-dma40-db8500.h" |
21 | ||
5b1f7ddf RV |
22 | static struct nmk_gpio_platform_data u8500_gpio_data[] = { |
23 | GPIO_DATA("GPIO-0-31", 0), | |
24 | GPIO_DATA("GPIO-32-63", 32), /* 37..63 not routed to pin */ | |
25 | GPIO_DATA("GPIO-64-95", 64), | |
26 | GPIO_DATA("GPIO-96-127", 96), /* 98..127 not routed to pin */ | |
27 | GPIO_DATA("GPIO-128-159", 128), | |
28 | GPIO_DATA("GPIO-160-191", 160), /* 172..191 not routed to pin */ | |
29 | GPIO_DATA("GPIO-192-223", 192), | |
30 | GPIO_DATA("GPIO-224-255", 224), /* 231..255 not routed to pin */ | |
31 | GPIO_DATA("GPIO-256-288", 256), /* 268..288 not routed to pin */ | |
32 | }; | |
33 | ||
34 | static struct resource u8500_gpio_resources[] = { | |
35 | GPIO_RESOURCE(0), | |
36 | GPIO_RESOURCE(1), | |
37 | GPIO_RESOURCE(2), | |
38 | GPIO_RESOURCE(3), | |
39 | GPIO_RESOURCE(4), | |
40 | GPIO_RESOURCE(5), | |
41 | GPIO_RESOURCE(6), | |
42 | GPIO_RESOURCE(7), | |
43 | GPIO_RESOURCE(8), | |
44 | }; | |
45 | ||
46 | struct platform_device u8500_gpio_devs[] = { | |
47 | GPIO_DEVICE(0), | |
48 | GPIO_DEVICE(1), | |
49 | GPIO_DEVICE(2), | |
50 | GPIO_DEVICE(3), | |
51 | GPIO_DEVICE(4), | |
52 | GPIO_DEVICE(5), | |
53 | GPIO_DEVICE(6), | |
54 | GPIO_DEVICE(7), | |
55 | GPIO_DEVICE(8), | |
56 | }; | |
57 | ||
9e4e7fe1 RV |
58 | struct amba_device u8500_ssp0_device = { |
59 | .dev = { | |
60 | .coherent_dma_mask = ~0, | |
61 | .init_name = "ssp0", | |
62 | }, | |
63 | .res = { | |
64 | .start = U8500_SSP0_BASE, | |
65 | .end = U8500_SSP0_BASE + SZ_4K - 1, | |
66 | .flags = IORESOURCE_MEM, | |
67 | }, | |
6055930c | 68 | .irq = {IRQ_DB8500_SSP0, NO_IRQ }, |
9e4e7fe1 RV |
69 | /* ST-Ericsson modified id */ |
70 | .periphid = SSP_PER_ID, | |
71 | }; | |
f9faf237 RV |
72 | |
73 | static struct resource u8500_i2c0_resources[] = { | |
74 | [0] = { | |
75 | .start = U8500_I2C0_BASE, | |
76 | .end = U8500_I2C0_BASE + SZ_4K - 1, | |
77 | .flags = IORESOURCE_MEM, | |
78 | }, | |
79 | [1] = { | |
6055930c RV |
80 | .start = IRQ_DB8500_I2C0, |
81 | .end = IRQ_DB8500_I2C0, | |
f9faf237 RV |
82 | .flags = IORESOURCE_IRQ, |
83 | } | |
84 | }; | |
85 | ||
86 | struct platform_device u8500_i2c0_device = { | |
87 | .name = "nmk-i2c", | |
88 | .id = 0, | |
89 | .resource = u8500_i2c0_resources, | |
90 | .num_resources = ARRAY_SIZE(u8500_i2c0_resources), | |
91 | }; | |
92 | ||
93 | static struct resource u8500_i2c4_resources[] = { | |
94 | [0] = { | |
95 | .start = U8500_I2C4_BASE, | |
96 | .end = U8500_I2C4_BASE + SZ_4K - 1, | |
97 | .flags = IORESOURCE_MEM, | |
98 | }, | |
99 | [1] = { | |
6055930c RV |
100 | .start = IRQ_DB8500_I2C4, |
101 | .end = IRQ_DB8500_I2C4, | |
f9faf237 RV |
102 | .flags = IORESOURCE_IRQ, |
103 | } | |
104 | }; | |
105 | ||
106 | struct platform_device u8500_i2c4_device = { | |
107 | .name = "nmk-i2c", | |
108 | .id = 4, | |
109 | .resource = u8500_i2c4_resources, | |
110 | .num_resources = ARRAY_SIZE(u8500_i2c4_resources), | |
111 | }; | |
7b8ddb06 | 112 | |
1c833abc HP |
113 | /* |
114 | * SD/MMC | |
115 | */ | |
116 | ||
117 | struct amba_device u8500_sdi0_device = { | |
118 | .dev = { | |
119 | .init_name = "sdi0", | |
120 | }, | |
121 | .res = { | |
122 | .start = U8500_SDI0_BASE, | |
123 | .end = U8500_SDI0_BASE + SZ_4K - 1, | |
124 | .flags = IORESOURCE_MEM, | |
125 | }, | |
126 | .irq = {IRQ_DB8500_SDMMC0, NO_IRQ}, | |
127 | }; | |
128 | ||
129 | struct amba_device u8500_sdi1_device = { | |
130 | .dev = { | |
131 | .init_name = "sdi1", | |
132 | }, | |
133 | .res = { | |
134 | .start = U8500_SDI1_BASE, | |
135 | .end = U8500_SDI1_BASE + SZ_4K - 1, | |
136 | .flags = IORESOURCE_MEM, | |
137 | }, | |
138 | .irq = {IRQ_DB8500_SDMMC1, NO_IRQ}, | |
139 | }; | |
140 | ||
141 | struct amba_device u8500_sdi2_device = { | |
142 | .dev = { | |
143 | .init_name = "sdi2", | |
144 | }, | |
145 | .res = { | |
146 | .start = U8500_SDI2_BASE, | |
147 | .end = U8500_SDI2_BASE + SZ_4K - 1, | |
148 | .flags = IORESOURCE_MEM, | |
149 | }, | |
150 | .irq = {IRQ_DB8500_SDMMC2, NO_IRQ}, | |
151 | }; | |
152 | ||
153 | struct amba_device u8500_sdi3_device = { | |
154 | .dev = { | |
155 | .init_name = "sdi3", | |
156 | }, | |
157 | .res = { | |
158 | .start = U8500_SDI3_BASE, | |
159 | .end = U8500_SDI3_BASE + SZ_4K - 1, | |
160 | .flags = IORESOURCE_MEM, | |
161 | }, | |
162 | .irq = {IRQ_DB8500_SDMMC3, NO_IRQ}, | |
163 | }; | |
164 | ||
165 | struct amba_device u8500_sdi4_device = { | |
166 | .dev = { | |
167 | .init_name = "sdi4", | |
168 | }, | |
169 | .res = { | |
170 | .start = U8500_SDI4_BASE, | |
171 | .end = U8500_SDI4_BASE + SZ_4K - 1, | |
172 | .flags = IORESOURCE_MEM, | |
173 | }, | |
174 | .irq = {IRQ_DB8500_SDMMC4, NO_IRQ}, | |
175 | }; | |
176 | ||
177 | struct amba_device u8500_sdi5_device = { | |
178 | .dev = { | |
179 | .init_name = "sdi5", | |
180 | }, | |
181 | .res = { | |
182 | .start = U8500_SDI5_BASE, | |
183 | .end = U8500_SDI5_BASE + SZ_4K - 1, | |
184 | .flags = IORESOURCE_MEM, | |
185 | }, | |
186 | .irq = {IRQ_DB8500_SDMMC5, NO_IRQ}, | |
187 | }; | |
188 | ||
7b8ddb06 LW |
189 | static struct resource dma40_resources[] = { |
190 | [0] = { | |
191 | .start = U8500_DMA_BASE, | |
5aa12e8c | 192 | .end = U8500_DMA_BASE + SZ_4K - 1, |
7b8ddb06 | 193 | .flags = IORESOURCE_MEM, |
5aa12e8c | 194 | .name = "base", |
7b8ddb06 LW |
195 | }, |
196 | [1] = { | |
197 | .start = U8500_DMA_LCPA_BASE, | |
5aa12e8c | 198 | .end = U8500_DMA_LCPA_BASE + 2 * SZ_1K - 1, |
7b8ddb06 | 199 | .flags = IORESOURCE_MEM, |
5aa12e8c | 200 | .name = "lcpa", |
7b8ddb06 LW |
201 | }, |
202 | [2] = { | |
6055930c RV |
203 | .start = IRQ_DB8500_DMA, |
204 | .end = IRQ_DB8500_DMA, | |
5aa12e8c JA |
205 | .flags = IORESOURCE_IRQ, |
206 | } | |
7b8ddb06 LW |
207 | }; |
208 | ||
209 | /* Default configuration for physcial memcpy */ | |
210 | struct stedma40_chan_cfg dma40_memcpy_conf_phy = { | |
38bdbf02 | 211 | .mode = STEDMA40_MODE_PHYSICAL, |
7b8ddb06 LW |
212 | .dir = STEDMA40_MEM_TO_MEM, |
213 | ||
7b8ddb06 LW |
214 | .src_info.data_width = STEDMA40_BYTE_WIDTH, |
215 | .src_info.psize = STEDMA40_PSIZE_PHY_1, | |
ef934aea | 216 | .src_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL, |
7b8ddb06 | 217 | |
7b8ddb06 LW |
218 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, |
219 | .dst_info.psize = STEDMA40_PSIZE_PHY_1, | |
ef934aea | 220 | .dst_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL, |
7b8ddb06 LW |
221 | }; |
222 | /* Default configuration for logical memcpy */ | |
223 | struct stedma40_chan_cfg dma40_memcpy_conf_log = { | |
7b8ddb06 LW |
224 | .dir = STEDMA40_MEM_TO_MEM, |
225 | ||
7b8ddb06 LW |
226 | .src_info.data_width = STEDMA40_BYTE_WIDTH, |
227 | .src_info.psize = STEDMA40_PSIZE_LOG_1, | |
ef934aea | 228 | .src_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL, |
7b8ddb06 | 229 | |
7b8ddb06 LW |
230 | .dst_info.data_width = STEDMA40_BYTE_WIDTH, |
231 | .dst_info.psize = STEDMA40_PSIZE_LOG_1, | |
ef934aea | 232 | .dst_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL, |
7b8ddb06 LW |
233 | }; |
234 | ||
235 | /* | |
236 | * Mapping between destination event lines and physical device address. | |
237 | * The event line is tied to a device and therefor the address is constant. | |
238 | */ | |
1d7e3565 | 239 | static const dma_addr_t dma40_tx_map[DB8500_DMA_NR_DEV]; |
7b8ddb06 LW |
240 | |
241 | /* Mapping between source event lines and physical device address */ | |
1d7e3565 | 242 | static const dma_addr_t dma40_rx_map[DB8500_DMA_NR_DEV]; |
7b8ddb06 LW |
243 | |
244 | /* Reserved event lines for memcpy only */ | |
245 | static int dma40_memcpy_event[] = { | |
1d7e3565 RV |
246 | DB8500_DMA_MEMCPY_TX_0, |
247 | DB8500_DMA_MEMCPY_TX_1, | |
248 | DB8500_DMA_MEMCPY_TX_2, | |
249 | DB8500_DMA_MEMCPY_TX_3, | |
250 | DB8500_DMA_MEMCPY_TX_4, | |
251 | DB8500_DMA_MEMCPY_TX_5, | |
7b8ddb06 LW |
252 | }; |
253 | ||
254 | static struct stedma40_platform_data dma40_plat_data = { | |
1d7e3565 | 255 | .dev_len = DB8500_DMA_NR_DEV, |
7b8ddb06 LW |
256 | .dev_rx = dma40_rx_map, |
257 | .dev_tx = dma40_tx_map, | |
258 | .memcpy = dma40_memcpy_event, | |
259 | .memcpy_len = ARRAY_SIZE(dma40_memcpy_event), | |
260 | .memcpy_conf_phy = &dma40_memcpy_conf_phy, | |
261 | .memcpy_conf_log = &dma40_memcpy_conf_log, | |
59516725 | 262 | .disabled_channels = {-1}, |
7b8ddb06 LW |
263 | }; |
264 | ||
265 | struct platform_device u8500_dma40_device = { | |
266 | .dev = { | |
267 | .platform_data = &dma40_plat_data, | |
268 | }, | |
269 | .name = "dma40", | |
270 | .id = 0, | |
271 | .num_resources = ARRAY_SIZE(dma40_resources), | |
272 | .resource = dma40_resources | |
273 | }; | |
274 | ||
275 | void dma40_u8500ed_fixup(void) | |
276 | { | |
277 | dma40_plat_data.memcpy = NULL; | |
278 | dma40_plat_data.memcpy_len = 0; | |
279 | dma40_resources[0].start = U8500_DMA_BASE_ED; | |
280 | dma40_resources[0].end = U8500_DMA_BASE_ED + SZ_4K - 1; | |
f4185592 LW |
281 | dma40_resources[1].start = U8500_DMA_LCPA_BASE_ED; |
282 | dma40_resources[1].end = U8500_DMA_LCPA_BASE_ED + 2 * SZ_1K - 1; | |
7b8ddb06 | 283 | } |
4c61c845 SI |
284 | |
285 | struct resource keypad_resources[] = { | |
286 | [0] = { | |
287 | .start = U8500_SKE_BASE, | |
288 | .end = U8500_SKE_BASE + SZ_4K - 1, | |
289 | .flags = IORESOURCE_MEM, | |
290 | }, | |
291 | [1] = { | |
292 | .start = IRQ_DB8500_KB, | |
293 | .end = IRQ_DB8500_KB, | |
294 | .flags = IORESOURCE_IRQ, | |
295 | }, | |
296 | }; | |
297 | ||
298 | struct platform_device ux500_ske_keypad_device = { | |
299 | .name = "nmk-ske-keypad", | |
300 | .id = -1, | |
301 | .num_resources = ARRAY_SIZE(keypad_resources), | |
302 | .resource = keypad_resources, | |
303 | }; |