Commit | Line | Data |
---|---|---|
24a07a12 RH |
1 | /* |
2 | * File: arch/blackfin/mach-bf548/boards/ezkit.c | |
3 | * Based on: arch/blackfin/mach-bf537/boards/ezkit.c | |
4 | * Author: Aidan Williams <aidan@nicta.com.au> | |
5 | * | |
6 | * Created: | |
7 | * Description: | |
8 | * | |
9 | * Modified: | |
10 | * Copyright 2005 National ICT Australia (NICTA) | |
11 | * Copyright 2004-2007 Analog Devices Inc. | |
12 | * | |
13 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ | |
14 | * | |
15 | * This program is free software; you can redistribute it and/or modify | |
16 | * it under the terms of the GNU General Public License as published by | |
17 | * the Free Software Foundation; either version 2 of the License, or | |
18 | * (at your option) any later version. | |
19 | * | |
20 | * This program is distributed in the hope that it will be useful, | |
21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 | * GNU General Public License for more details. | |
24 | * | |
25 | * You should have received a copy of the GNU General Public License | |
26 | * along with this program; if not, see the file COPYING, or write | |
27 | * to the Free Software Foundation, Inc., | |
28 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
29 | */ | |
30 | ||
31 | #include <linux/device.h> | |
32 | #include <linux/platform_device.h> | |
33 | #include <linux/mtd/mtd.h> | |
34 | #include <linux/mtd/partitions.h> | |
de8c43f2 | 35 | #include <linux/mtd/physmap.h> |
24a07a12 RH |
36 | #include <linux/spi/spi.h> |
37 | #include <linux/spi/flash.h> | |
1f83b8f1 | 38 | #include <linux/irq.h> |
81d9c7f2 | 39 | #include <linux/i2c.h> |
24a07a12 | 40 | #include <linux/interrupt.h> |
c6c4d7bb | 41 | #include <linux/usb/musb.h> |
24a07a12 | 42 | #include <asm/bfin5xx_spi.h> |
c6c4d7bb BW |
43 | #include <asm/dma.h> |
44 | #include <asm/gpio.h> | |
45 | #include <asm/nand.h> | |
14b03204 | 46 | #include <asm/dpmc.h> |
5d448dd5 | 47 | #include <asm/portmux.h> |
501674a5 | 48 | #include <asm/bfin_sdh.h> |
639f6571 | 49 | #include <mach/bf54x_keys.h> |
c6c4d7bb BW |
50 | #include <linux/input.h> |
51 | #include <linux/spi/ad7877.h> | |
24a07a12 RH |
52 | |
53 | /* | |
54 | * Name the Board for the /proc/cpuinfo | |
55 | */ | |
fe85cad2 | 56 | const char bfin_board_name[] = "ADI BF548-EZKIT"; |
24a07a12 RH |
57 | |
58 | /* | |
59 | * Driver needs to know address, irq and flag pin. | |
60 | */ | |
61 | ||
0a6304a9 | 62 | #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE) |
3f375690 MH |
63 | #include <linux/usb/isp1760.h> |
64 | static struct resource bfin_isp1760_resources[] = { | |
0a6304a9 | 65 | [0] = { |
0a6304a9 MH |
66 | .start = 0x2C0C0000, |
67 | .end = 0x2C0C0000 + 0xfffff, | |
68 | .flags = IORESOURCE_MEM, | |
69 | }, | |
70 | [1] = { | |
71 | .start = IRQ_PG7, | |
72 | .end = IRQ_PG7, | |
73 | .flags = IORESOURCE_IRQ, | |
74 | }, | |
75 | }; | |
76 | ||
3f375690 MH |
77 | static struct isp1760_platform_data isp1760_priv = { |
78 | .is_isp1761 = 0, | |
79 | .port1_disable = 0, | |
80 | .bus_width_16 = 1, | |
81 | .port1_otg = 0, | |
82 | .analog_oc = 0, | |
83 | .dack_polarity_high = 0, | |
84 | .dreq_polarity_high = 0, | |
0a6304a9 MH |
85 | }; |
86 | ||
3f375690 MH |
87 | static struct platform_device bfin_isp1760_device = { |
88 | .name = "isp1760-hcd", | |
89 | .id = 0, | |
90 | .dev = { | |
91 | .platform_data = &isp1760_priv, | |
92 | }, | |
93 | .num_resources = ARRAY_SIZE(bfin_isp1760_resources), | |
94 | .resource = bfin_isp1760_resources, | |
0a6304a9 | 95 | }; |
0a6304a9 MH |
96 | #endif |
97 | ||
c6c4d7bb BW |
98 | #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE) |
99 | ||
639f6571 | 100 | #include <mach/bf54x-lq043.h> |
c6c4d7bb BW |
101 | |
102 | static struct bfin_bf54xfb_mach_info bf54x_lq043_data = { | |
103 | .width = 480, | |
104 | .height = 272, | |
105 | .xres = {480, 480, 480}, | |
106 | .yres = {272, 272, 272}, | |
107 | .bpp = {24, 24, 24}, | |
108 | .disp = GPIO_PE3, | |
109 | }; | |
110 | ||
111 | static struct resource bf54x_lq043_resources[] = { | |
112 | { | |
113 | .start = IRQ_EPPI0_ERR, | |
114 | .end = IRQ_EPPI0_ERR, | |
115 | .flags = IORESOURCE_IRQ, | |
116 | }, | |
117 | }; | |
118 | ||
119 | static struct platform_device bf54x_lq043_device = { | |
120 | .name = "bf54x-lq043", | |
121 | .id = -1, | |
122 | .num_resources = ARRAY_SIZE(bf54x_lq043_resources), | |
123 | .resource = bf54x_lq043_resources, | |
124 | .dev = { | |
125 | .platform_data = &bf54x_lq043_data, | |
126 | }, | |
127 | }; | |
128 | #endif | |
129 | ||
130 | #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE) | |
8f740ef3 | 131 | static const unsigned int bf548_keymap[] = { |
c6c4d7bb BW |
132 | KEYVAL(0, 0, KEY_ENTER), |
133 | KEYVAL(0, 1, KEY_HELP), | |
134 | KEYVAL(0, 2, KEY_0), | |
135 | KEYVAL(0, 3, KEY_BACKSPACE), | |
136 | KEYVAL(1, 0, KEY_TAB), | |
137 | KEYVAL(1, 1, KEY_9), | |
138 | KEYVAL(1, 2, KEY_8), | |
139 | KEYVAL(1, 3, KEY_7), | |
140 | KEYVAL(2, 0, KEY_DOWN), | |
141 | KEYVAL(2, 1, KEY_6), | |
142 | KEYVAL(2, 2, KEY_5), | |
143 | KEYVAL(2, 3, KEY_4), | |
144 | KEYVAL(3, 0, KEY_UP), | |
145 | KEYVAL(3, 1, KEY_3), | |
146 | KEYVAL(3, 2, KEY_2), | |
147 | KEYVAL(3, 3, KEY_1), | |
148 | }; | |
149 | ||
150 | static struct bfin_kpad_platform_data bf54x_kpad_data = { | |
151 | .rows = 4, | |
152 | .cols = 4, | |
8f740ef3 MH |
153 | .keymap = bf548_keymap, |
154 | .keymapsize = ARRAY_SIZE(bf548_keymap), | |
c6c4d7bb BW |
155 | .repeat = 0, |
156 | .debounce_time = 5000, /* ns (5ms) */ | |
157 | .coldrive_time = 1000, /* ns (1ms) */ | |
158 | .keyup_test_interval = 50, /* ms (50ms) */ | |
159 | }; | |
160 | ||
161 | static struct resource bf54x_kpad_resources[] = { | |
162 | { | |
163 | .start = IRQ_KEY, | |
164 | .end = IRQ_KEY, | |
165 | .flags = IORESOURCE_IRQ, | |
166 | }, | |
167 | }; | |
168 | ||
169 | static struct platform_device bf54x_kpad_device = { | |
170 | .name = "bf54x-keys", | |
171 | .id = -1, | |
172 | .num_resources = ARRAY_SIZE(bf54x_kpad_resources), | |
173 | .resource = bf54x_kpad_resources, | |
174 | .dev = { | |
175 | .platform_data = &bf54x_kpad_data, | |
176 | }, | |
177 | }; | |
178 | #endif | |
179 | ||
aca5e4aa MH |
180 | #if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE) |
181 | #include <asm/bfin_rotary.h> | |
182 | ||
183 | static struct bfin_rotary_platform_data bfin_rotary_data = { | |
184 | /*.rotary_up_key = KEY_UP,*/ | |
185 | /*.rotary_down_key = KEY_DOWN,*/ | |
186 | .rotary_rel_code = REL_WHEEL, | |
187 | .rotary_button_key = KEY_ENTER, | |
188 | .debounce = 10, /* 0..17 */ | |
189 | .mode = ROT_QUAD_ENC | ROT_DEBE, | |
190 | }; | |
191 | ||
192 | static struct resource bfin_rotary_resources[] = { | |
193 | { | |
194 | .start = IRQ_CNT, | |
195 | .end = IRQ_CNT, | |
196 | .flags = IORESOURCE_IRQ, | |
197 | }, | |
198 | }; | |
199 | ||
200 | static struct platform_device bfin_rotary_device = { | |
201 | .name = "bfin-rotary", | |
202 | .id = -1, | |
203 | .num_resources = ARRAY_SIZE(bfin_rotary_resources), | |
204 | .resource = bfin_rotary_resources, | |
205 | .dev = { | |
206 | .platform_data = &bfin_rotary_data, | |
207 | }, | |
208 | }; | |
209 | #endif | |
210 | ||
24a07a12 RH |
211 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) |
212 | static struct platform_device rtc_device = { | |
213 | .name = "rtc-bfin", | |
214 | .id = -1, | |
215 | }; | |
216 | #endif | |
217 | ||
218 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) | |
219 | static struct resource bfin_uart_resources[] = { | |
220 | #ifdef CONFIG_SERIAL_BFIN_UART0 | |
221 | { | |
222 | .start = 0xFFC00400, | |
223 | .end = 0xFFC004FF, | |
224 | .flags = IORESOURCE_MEM, | |
225 | }, | |
226 | #endif | |
227 | #ifdef CONFIG_SERIAL_BFIN_UART1 | |
228 | { | |
229 | .start = 0xFFC02000, | |
230 | .end = 0xFFC020FF, | |
231 | .flags = IORESOURCE_MEM, | |
232 | }, | |
233 | #endif | |
234 | #ifdef CONFIG_SERIAL_BFIN_UART2 | |
235 | { | |
236 | .start = 0xFFC02100, | |
237 | .end = 0xFFC021FF, | |
238 | .flags = IORESOURCE_MEM, | |
239 | }, | |
240 | #endif | |
241 | #ifdef CONFIG_SERIAL_BFIN_UART3 | |
242 | { | |
243 | .start = 0xFFC03100, | |
244 | .end = 0xFFC031FF, | |
cc2e16bd | 245 | .flags = IORESOURCE_MEM, |
24a07a12 RH |
246 | }, |
247 | #endif | |
248 | }; | |
249 | ||
250 | static struct platform_device bfin_uart_device = { | |
251 | .name = "bfin-uart", | |
252 | .id = 1, | |
253 | .num_resources = ARRAY_SIZE(bfin_uart_resources), | |
254 | .resource = bfin_uart_resources, | |
255 | }; | |
256 | #endif | |
257 | ||
5be36d22 | 258 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) |
5be36d22 | 259 | #ifdef CONFIG_BFIN_SIR0 |
42bd8bcb | 260 | static struct resource bfin_sir0_resources[] = { |
5be36d22 GY |
261 | { |
262 | .start = 0xFFC00400, | |
263 | .end = 0xFFC004FF, | |
264 | .flags = IORESOURCE_MEM, | |
265 | }, | |
42bd8bcb GY |
266 | { |
267 | .start = IRQ_UART0_RX, | |
268 | .end = IRQ_UART0_RX+1, | |
269 | .flags = IORESOURCE_IRQ, | |
270 | }, | |
271 | { | |
272 | .start = CH_UART0_RX, | |
273 | .end = CH_UART0_RX+1, | |
274 | .flags = IORESOURCE_DMA, | |
275 | }, | |
276 | }; | |
277 | static struct platform_device bfin_sir0_device = { | |
278 | .name = "bfin_sir", | |
279 | .id = 0, | |
280 | .num_resources = ARRAY_SIZE(bfin_sir0_resources), | |
281 | .resource = bfin_sir0_resources, | |
282 | }; | |
5be36d22 GY |
283 | #endif |
284 | #ifdef CONFIG_BFIN_SIR1 | |
42bd8bcb | 285 | static struct resource bfin_sir1_resources[] = { |
5be36d22 GY |
286 | { |
287 | .start = 0xFFC02000, | |
288 | .end = 0xFFC020FF, | |
289 | .flags = IORESOURCE_MEM, | |
290 | }, | |
42bd8bcb GY |
291 | { |
292 | .start = IRQ_UART1_RX, | |
293 | .end = IRQ_UART1_RX+1, | |
294 | .flags = IORESOURCE_IRQ, | |
295 | }, | |
296 | { | |
297 | .start = CH_UART1_RX, | |
298 | .end = CH_UART1_RX+1, | |
299 | .flags = IORESOURCE_DMA, | |
300 | }, | |
301 | }; | |
302 | static struct platform_device bfin_sir1_device = { | |
303 | .name = "bfin_sir", | |
304 | .id = 1, | |
305 | .num_resources = ARRAY_SIZE(bfin_sir1_resources), | |
306 | .resource = bfin_sir1_resources, | |
307 | }; | |
5be36d22 GY |
308 | #endif |
309 | #ifdef CONFIG_BFIN_SIR2 | |
42bd8bcb | 310 | static struct resource bfin_sir2_resources[] = { |
5be36d22 GY |
311 | { |
312 | .start = 0xFFC02100, | |
313 | .end = 0xFFC021FF, | |
314 | .flags = IORESOURCE_MEM, | |
315 | }, | |
42bd8bcb GY |
316 | { |
317 | .start = IRQ_UART2_RX, | |
318 | .end = IRQ_UART2_RX+1, | |
319 | .flags = IORESOURCE_IRQ, | |
320 | }, | |
321 | { | |
322 | .start = CH_UART2_RX, | |
323 | .end = CH_UART2_RX+1, | |
324 | .flags = IORESOURCE_DMA, | |
325 | }, | |
326 | }; | |
327 | static struct platform_device bfin_sir2_device = { | |
328 | .name = "bfin_sir", | |
329 | .id = 2, | |
330 | .num_resources = ARRAY_SIZE(bfin_sir2_resources), | |
331 | .resource = bfin_sir2_resources, | |
332 | }; | |
5be36d22 GY |
333 | #endif |
334 | #ifdef CONFIG_BFIN_SIR3 | |
42bd8bcb | 335 | static struct resource bfin_sir3_resources[] = { |
5be36d22 GY |
336 | { |
337 | .start = 0xFFC03100, | |
338 | .end = 0xFFC031FF, | |
339 | .flags = IORESOURCE_MEM, | |
340 | }, | |
42bd8bcb GY |
341 | { |
342 | .start = IRQ_UART3_RX, | |
343 | .end = IRQ_UART3_RX+1, | |
344 | .flags = IORESOURCE_IRQ, | |
345 | }, | |
346 | { | |
347 | .start = CH_UART3_RX, | |
348 | .end = CH_UART3_RX+1, | |
349 | .flags = IORESOURCE_DMA, | |
350 | }, | |
5be36d22 | 351 | }; |
42bd8bcb | 352 | static struct platform_device bfin_sir3_device = { |
5be36d22 | 353 | .name = "bfin_sir", |
42bd8bcb GY |
354 | .id = 3, |
355 | .num_resources = ARRAY_SIZE(bfin_sir3_resources), | |
356 | .resource = bfin_sir3_resources, | |
5be36d22 GY |
357 | }; |
358 | #endif | |
42bd8bcb | 359 | #endif |
5be36d22 | 360 | |
c6c4d7bb BW |
361 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) |
362 | static struct resource smsc911x_resources[] = { | |
363 | { | |
364 | .name = "smsc911x-memory", | |
365 | .start = 0x24000000, | |
366 | .end = 0x24000000 + 0xFF, | |
367 | .flags = IORESOURCE_MEM, | |
368 | }, | |
369 | { | |
370 | .start = IRQ_PE8, | |
371 | .end = IRQ_PE8, | |
372 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, | |
373 | }, | |
374 | }; | |
375 | static struct platform_device smsc911x_device = { | |
376 | .name = "smsc911x", | |
377 | .id = 0, | |
378 | .num_resources = ARRAY_SIZE(smsc911x_resources), | |
379 | .resource = smsc911x_resources, | |
380 | }; | |
381 | #endif | |
382 | ||
c6c4d7bb BW |
383 | #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) |
384 | static struct resource musb_resources[] = { | |
385 | [0] = { | |
386 | .start = 0xFFC03C00, | |
387 | .end = 0xFFC040FF, | |
388 | .flags = IORESOURCE_MEM, | |
389 | }, | |
390 | [1] = { /* general IRQ */ | |
391 | .start = IRQ_USB_INT0, | |
392 | .end = IRQ_USB_INT0, | |
393 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, | |
394 | }, | |
395 | [2] = { /* DMA IRQ */ | |
396 | .start = IRQ_USB_DMA, | |
397 | .end = IRQ_USB_DMA, | |
398 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, | |
399 | }, | |
400 | }; | |
401 | ||
50041acb BW |
402 | static struct musb_hdrc_config musb_config = { |
403 | .multipoint = 0, | |
404 | .dyn_fifo = 0, | |
405 | .soft_con = 1, | |
406 | .dma = 1, | |
fea05dac BW |
407 | .num_eps = 8, |
408 | .dma_channels = 8, | |
50041acb BW |
409 | .gpio_vrsel = GPIO_PE7, |
410 | }; | |
411 | ||
c6c4d7bb | 412 | static struct musb_hdrc_platform_data musb_plat = { |
2935077e | 413 | #if defined(CONFIG_USB_MUSB_OTG) |
c6c4d7bb | 414 | .mode = MUSB_OTG, |
2935077e | 415 | #elif defined(CONFIG_USB_MUSB_HDRC_HCD) |
c6c4d7bb | 416 | .mode = MUSB_HOST, |
2935077e | 417 | #elif defined(CONFIG_USB_GADGET_MUSB_HDRC) |
c6c4d7bb BW |
418 | .mode = MUSB_PERIPHERAL, |
419 | #endif | |
50041acb | 420 | .config = &musb_config, |
c6c4d7bb BW |
421 | }; |
422 | ||
423 | static u64 musb_dmamask = ~(u32)0; | |
424 | ||
425 | static struct platform_device musb_device = { | |
426 | .name = "musb_hdrc", | |
427 | .id = 0, | |
428 | .dev = { | |
429 | .dma_mask = &musb_dmamask, | |
430 | .coherent_dma_mask = 0xffffffff, | |
431 | .platform_data = &musb_plat, | |
432 | }, | |
433 | .num_resources = ARRAY_SIZE(musb_resources), | |
434 | .resource = musb_resources, | |
435 | }; | |
436 | #endif | |
437 | ||
438 | #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE) | |
439 | static struct resource bfin_atapi_resources[] = { | |
440 | { | |
441 | .start = 0xFFC03800, | |
442 | .end = 0xFFC0386F, | |
443 | .flags = IORESOURCE_MEM, | |
444 | }, | |
445 | { | |
446 | .start = IRQ_ATAPI_ERR, | |
447 | .end = IRQ_ATAPI_ERR, | |
448 | .flags = IORESOURCE_IRQ, | |
449 | }, | |
450 | }; | |
451 | ||
452 | static struct platform_device bfin_atapi_device = { | |
453 | .name = "pata-bf54x", | |
454 | .id = -1, | |
455 | .num_resources = ARRAY_SIZE(bfin_atapi_resources), | |
456 | .resource = bfin_atapi_resources, | |
457 | }; | |
458 | #endif | |
459 | ||
460 | #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE) | |
461 | static struct mtd_partition partition_info[] = { | |
462 | { | |
aa582977 | 463 | .name = "linux kernel(nand)", |
c6c4d7bb | 464 | .offset = 0, |
f4585a08 | 465 | .size = 4 * 1024 * 1024, |
c6c4d7bb BW |
466 | }, |
467 | { | |
aa582977 | 468 | .name = "file system(nand)", |
edf05641 MF |
469 | .offset = MTDPART_OFS_APPEND, |
470 | .size = MTDPART_SIZ_FULL, | |
c6c4d7bb BW |
471 | }, |
472 | }; | |
473 | ||
474 | static struct bf5xx_nand_platform bf5xx_nand_platform = { | |
475 | .page_size = NFC_PG_SIZE_256, | |
476 | .data_width = NFC_NWIDTH_8, | |
477 | .partitions = partition_info, | |
478 | .nr_partitions = ARRAY_SIZE(partition_info), | |
479 | .rd_dly = 3, | |
480 | .wr_dly = 3, | |
481 | }; | |
482 | ||
483 | static struct resource bf5xx_nand_resources[] = { | |
484 | { | |
485 | .start = 0xFFC03B00, | |
486 | .end = 0xFFC03B4F, | |
487 | .flags = IORESOURCE_MEM, | |
488 | }, | |
489 | { | |
490 | .start = CH_NFC, | |
491 | .end = CH_NFC, | |
492 | .flags = IORESOURCE_IRQ, | |
493 | }, | |
494 | }; | |
495 | ||
496 | static struct platform_device bf5xx_nand_device = { | |
497 | .name = "bf5xx-nand", | |
498 | .id = 0, | |
499 | .num_resources = ARRAY_SIZE(bf5xx_nand_resources), | |
500 | .resource = bf5xx_nand_resources, | |
501 | .dev = { | |
502 | .platform_data = &bf5xx_nand_platform, | |
503 | }, | |
504 | }; | |
505 | #endif | |
506 | ||
3d7e6cf8 | 507 | #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE) |
501674a5 CC |
508 | |
509 | static struct bfin_sd_host bfin_sdh_data = { | |
510 | .dma_chan = CH_SDH, | |
511 | .irq_int0 = IRQ_SDH_MASK0, | |
512 | .pin_req = {P_SD_D0, P_SD_D1, P_SD_D2, P_SD_D3, P_SD_CLK, P_SD_CMD, 0}, | |
513 | }; | |
514 | ||
c6c4d7bb BW |
515 | static struct platform_device bf54x_sdh_device = { |
516 | .name = "bfin-sdh", | |
517 | .id = 0, | |
501674a5 CC |
518 | .dev = { |
519 | .platform_data = &bfin_sdh_data, | |
520 | }, | |
c6c4d7bb BW |
521 | }; |
522 | #endif | |
523 | ||
793dc27b | 524 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
de8c43f2 MF |
525 | static struct mtd_partition ezkit_partitions[] = { |
526 | { | |
aa582977 | 527 | .name = "bootloader(nor)", |
edf05641 | 528 | .size = 0x40000, |
de8c43f2 MF |
529 | .offset = 0, |
530 | }, { | |
aa582977 | 531 | .name = "linux kernel(nor)", |
664d0403 | 532 | .size = 0x400000, |
de8c43f2 MF |
533 | .offset = MTDPART_OFS_APPEND, |
534 | }, { | |
aa582977 | 535 | .name = "file system(nor)", |
de8c43f2 MF |
536 | .size = MTDPART_SIZ_FULL, |
537 | .offset = MTDPART_OFS_APPEND, | |
538 | } | |
539 | }; | |
540 | ||
541 | static struct physmap_flash_data ezkit_flash_data = { | |
542 | .width = 2, | |
543 | .parts = ezkit_partitions, | |
544 | .nr_parts = ARRAY_SIZE(ezkit_partitions), | |
545 | }; | |
546 | ||
547 | static struct resource ezkit_flash_resource = { | |
548 | .start = 0x20000000, | |
664d0403 | 549 | .end = 0x21ffffff, |
de8c43f2 MF |
550 | .flags = IORESOURCE_MEM, |
551 | }; | |
552 | ||
553 | static struct platform_device ezkit_flash_device = { | |
554 | .name = "physmap-flash", | |
555 | .id = 0, | |
556 | .dev = { | |
557 | .platform_data = &ezkit_flash_data, | |
558 | }, | |
559 | .num_resources = 1, | |
560 | .resource = &ezkit_flash_resource, | |
561 | }; | |
793dc27b | 562 | #endif |
de8c43f2 | 563 | |
c6c4d7bb BW |
564 | #if defined(CONFIG_MTD_M25P80) \ |
565 | || defined(CONFIG_MTD_M25P80_MODULE) | |
566 | /* SPI flash chip (m25p16) */ | |
567 | static struct mtd_partition bfin_spi_flash_partitions[] = { | |
568 | { | |
aa582977 | 569 | .name = "bootloader(spi)", |
c6c4d7bb BW |
570 | .size = 0x00040000, |
571 | .offset = 0, | |
572 | .mask_flags = MTD_CAP_ROM | |
573 | }, { | |
aa582977 | 574 | .name = "linux kernel(spi)", |
edf05641 MF |
575 | .size = MTDPART_SIZ_FULL, |
576 | .offset = MTDPART_OFS_APPEND, | |
c6c4d7bb BW |
577 | } |
578 | }; | |
579 | ||
580 | static struct flash_platform_data bfin_spi_flash_data = { | |
581 | .name = "m25p80", | |
582 | .parts = bfin_spi_flash_partitions, | |
583 | .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions), | |
584 | .type = "m25p16", | |
585 | }; | |
586 | ||
587 | static struct bfin5xx_spi_chip spi_flash_chip_info = { | |
588 | .enable_dma = 0, /* use dma transfer with this chip*/ | |
589 | .bits_per_word = 8, | |
590 | .cs_change_per_word = 0, | |
591 | }; | |
592 | #endif | |
593 | ||
37fa2421 BS |
594 | #if defined(CONFIG_SND_BLACKFIN_AD1836) \ |
595 | || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) | |
596 | static struct bfin5xx_spi_chip ad1836_spi_chip_info = { | |
597 | .enable_dma = 0, | |
598 | .bits_per_word = 16, | |
599 | }; | |
600 | #endif | |
601 | ||
c6c4d7bb BW |
602 | #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) |
603 | static struct bfin5xx_spi_chip spi_ad7877_chip_info = { | |
c7d48966 | 604 | .cs_change_per_word = 0, |
c6c4d7bb BW |
605 | .enable_dma = 0, |
606 | .bits_per_word = 16, | |
607 | }; | |
608 | ||
609 | static const struct ad7877_platform_data bfin_ad7877_ts_info = { | |
610 | .model = 7877, | |
611 | .vref_delay_usecs = 50, /* internal, no capacitor */ | |
612 | .x_plate_ohms = 419, | |
613 | .y_plate_ohms = 486, | |
614 | .pressure_max = 1000, | |
615 | .pressure_min = 0, | |
616 | .stopacq_polarity = 1, | |
617 | .first_conversion_delay = 3, | |
618 | .acquisition_time = 1, | |
619 | .averaging = 1, | |
620 | .pen_down_acc_interval = 1, | |
621 | }; | |
622 | #endif | |
623 | ||
6e668936 MH |
624 | #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) |
625 | static struct bfin5xx_spi_chip spidev_chip_info = { | |
626 | .enable_dma = 0, | |
627 | .bits_per_word = 8, | |
628 | }; | |
629 | #endif | |
630 | ||
5bda2723 | 631 | static struct spi_board_info bfin_spi_board_info[] __initdata = { |
c6c4d7bb BW |
632 | #if defined(CONFIG_MTD_M25P80) \ |
633 | || defined(CONFIG_MTD_M25P80_MODULE) | |
634 | { | |
635 | /* the modalias must be the same as spi device driver name */ | |
636 | .modalias = "m25p80", /* Name of spi_driver for this device */ | |
637 | .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ | |
638 | .bus_num = 0, /* Framework bus number */ | |
639 | .chip_select = 1, /* SPI_SSEL1*/ | |
640 | .platform_data = &bfin_spi_flash_data, | |
641 | .controller_data = &spi_flash_chip_info, | |
642 | .mode = SPI_MODE_3, | |
643 | }, | |
644 | #endif | |
37fa2421 BS |
645 | #if defined(CONFIG_SND_BLACKFIN_AD1836) \ |
646 | || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) | |
647 | { | |
648 | .modalias = "ad1836-spi", | |
649 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ | |
650 | .bus_num = 1, | |
651 | .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT, | |
652 | .controller_data = &ad1836_spi_chip_info, | |
653 | }, | |
654 | #endif | |
c6c4d7bb BW |
655 | #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) |
656 | { | |
657 | .modalias = "ad7877", | |
658 | .platform_data = &bfin_ad7877_ts_info, | |
f153c554 | 659 | .irq = IRQ_PB4, /* old boards (<=Rev 1.3) use IRQ_PJ11 */ |
c6c4d7bb BW |
660 | .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ |
661 | .bus_num = 0, | |
662 | .chip_select = 2, | |
663 | .controller_data = &spi_ad7877_chip_info, | |
664 | }, | |
665 | #endif | |
6e668936 MH |
666 | #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) |
667 | { | |
668 | .modalias = "spidev", | |
669 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ | |
670 | .bus_num = 0, | |
671 | .chip_select = 1, | |
672 | .controller_data = &spidev_chip_info, | |
673 | }, | |
674 | #endif | |
c6c4d7bb BW |
675 | }; |
676 | ||
5bda2723 | 677 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
c6c4d7bb BW |
678 | /* SPI (0) */ |
679 | static struct resource bfin_spi0_resource[] = { | |
680 | [0] = { | |
681 | .start = SPI0_REGBASE, | |
682 | .end = SPI0_REGBASE + 0xFF, | |
683 | .flags = IORESOURCE_MEM, | |
684 | }, | |
685 | [1] = { | |
686 | .start = CH_SPI0, | |
687 | .end = CH_SPI0, | |
688 | .flags = IORESOURCE_IRQ, | |
689 | } | |
690 | }; | |
691 | ||
692 | /* SPI (1) */ | |
693 | static struct resource bfin_spi1_resource[] = { | |
694 | [0] = { | |
695 | .start = SPI1_REGBASE, | |
696 | .end = SPI1_REGBASE + 0xFF, | |
697 | .flags = IORESOURCE_MEM, | |
698 | }, | |
699 | [1] = { | |
700 | .start = CH_SPI1, | |
701 | .end = CH_SPI1, | |
702 | .flags = IORESOURCE_IRQ, | |
703 | } | |
704 | }; | |
705 | ||
706 | /* SPI controller data */ | |
5d448dd5 | 707 | static struct bfin5xx_spi_master bf54x_spi_master_info0 = { |
c6c4d7bb BW |
708 | .num_chipselect = 8, |
709 | .enable_dma = 1, /* master has the ability to do dma transfer */ | |
5d448dd5 | 710 | .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0}, |
c6c4d7bb BW |
711 | }; |
712 | ||
713 | static struct platform_device bf54x_spi_master0 = { | |
714 | .name = "bfin-spi", | |
715 | .id = 0, /* Bus number */ | |
716 | .num_resources = ARRAY_SIZE(bfin_spi0_resource), | |
717 | .resource = bfin_spi0_resource, | |
718 | .dev = { | |
5d448dd5 | 719 | .platform_data = &bf54x_spi_master_info0, /* Passed to driver */ |
c6c4d7bb BW |
720 | }, |
721 | }; | |
722 | ||
5d448dd5 BW |
723 | static struct bfin5xx_spi_master bf54x_spi_master_info1 = { |
724 | .num_chipselect = 8, | |
725 | .enable_dma = 1, /* master has the ability to do dma transfer */ | |
726 | .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0}, | |
727 | }; | |
728 | ||
c6c4d7bb BW |
729 | static struct platform_device bf54x_spi_master1 = { |
730 | .name = "bfin-spi", | |
731 | .id = 1, /* Bus number */ | |
732 | .num_resources = ARRAY_SIZE(bfin_spi1_resource), | |
733 | .resource = bfin_spi1_resource, | |
734 | .dev = { | |
5d448dd5 | 735 | .platform_data = &bf54x_spi_master_info1, /* Passed to driver */ |
c6c4d7bb BW |
736 | }, |
737 | }; | |
738 | #endif /* spi master and devices */ | |
739 | ||
740 | #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) | |
741 | static struct resource bfin_twi0_resource[] = { | |
742 | [0] = { | |
743 | .start = TWI0_REGBASE, | |
744 | .end = TWI0_REGBASE + 0xFF, | |
745 | .flags = IORESOURCE_MEM, | |
746 | }, | |
747 | [1] = { | |
748 | .start = IRQ_TWI0, | |
749 | .end = IRQ_TWI0, | |
750 | .flags = IORESOURCE_IRQ, | |
751 | }, | |
752 | }; | |
753 | ||
754 | static struct platform_device i2c_bfin_twi0_device = { | |
755 | .name = "i2c-bfin-twi", | |
756 | .id = 0, | |
757 | .num_resources = ARRAY_SIZE(bfin_twi0_resource), | |
758 | .resource = bfin_twi0_resource, | |
759 | }; | |
760 | ||
7160e950 | 761 | #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */ |
c6c4d7bb BW |
762 | static struct resource bfin_twi1_resource[] = { |
763 | [0] = { | |
764 | .start = TWI1_REGBASE, | |
765 | .end = TWI1_REGBASE + 0xFF, | |
766 | .flags = IORESOURCE_MEM, | |
767 | }, | |
768 | [1] = { | |
769 | .start = IRQ_TWI1, | |
770 | .end = IRQ_TWI1, | |
771 | .flags = IORESOURCE_IRQ, | |
772 | }, | |
773 | }; | |
774 | ||
775 | static struct platform_device i2c_bfin_twi1_device = { | |
776 | .name = "i2c-bfin-twi", | |
777 | .id = 1, | |
778 | .num_resources = ARRAY_SIZE(bfin_twi1_resource), | |
779 | .resource = bfin_twi1_resource, | |
780 | }; | |
781 | #endif | |
7160e950 | 782 | #endif |
c6c4d7bb | 783 | |
81d9c7f2 BW |
784 | #ifdef CONFIG_I2C_BOARDINFO |
785 | static struct i2c_board_info __initdata bfin_i2c_board_info0[] = { | |
786 | }; | |
787 | ||
788 | #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */ | |
789 | static struct i2c_board_info __initdata bfin_i2c_board_info1[] = { | |
790 | #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) | |
791 | { | |
792 | I2C_BOARD_INFO("pcf8574_lcd", 0x22), | |
81d9c7f2 BW |
793 | }, |
794 | #endif | |
795 | #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE) | |
796 | { | |
797 | I2C_BOARD_INFO("pcf8574_keypad", 0x27), | |
81d9c7f2 BW |
798 | .irq = 212, |
799 | }, | |
800 | #endif | |
801 | }; | |
802 | #endif | |
803 | #endif | |
804 | ||
2463ef22 MH |
805 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
806 | #include <linux/gpio_keys.h> | |
807 | ||
808 | static struct gpio_keys_button bfin_gpio_keys_table[] = { | |
809 | {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"}, | |
810 | {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"}, | |
811 | {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"}, | |
812 | {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"}, | |
813 | }; | |
814 | ||
815 | static struct gpio_keys_platform_data bfin_gpio_keys_data = { | |
816 | .buttons = bfin_gpio_keys_table, | |
817 | .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table), | |
818 | }; | |
819 | ||
820 | static struct platform_device bfin_device_gpiokeys = { | |
821 | .name = "gpio-keys", | |
822 | .dev = { | |
823 | .platform_data = &bfin_gpio_keys_data, | |
824 | }, | |
825 | }; | |
826 | #endif | |
827 | ||
cad2ab65 MF |
828 | static struct resource bfin_gpios_resources = { |
829 | .start = 0, | |
830 | .end = MAX_BLACKFIN_GPIOS - 1, | |
831 | .flags = IORESOURCE_IRQ, | |
832 | }; | |
833 | ||
834 | static struct platform_device bfin_gpios_device = { | |
835 | .name = "simple-gpio", | |
836 | .id = -1, | |
837 | .num_resources = 1, | |
838 | .resource = &bfin_gpios_resources, | |
839 | }; | |
840 | ||
14b03204 MH |
841 | static const unsigned int cclk_vlev_datasheet[] = |
842 | { | |
843 | /* | |
844 | * Internal VLEV BF54XSBBC1533 | |
845 | ****temporarily using these values until data sheet is updated | |
846 | */ | |
847 | VRPAIR(VLEV_085, 150000000), | |
848 | VRPAIR(VLEV_090, 250000000), | |
849 | VRPAIR(VLEV_110, 276000000), | |
850 | VRPAIR(VLEV_115, 301000000), | |
851 | VRPAIR(VLEV_120, 525000000), | |
852 | VRPAIR(VLEV_125, 550000000), | |
853 | VRPAIR(VLEV_130, 600000000), | |
854 | }; | |
855 | ||
856 | static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = { | |
857 | .tuple_tab = cclk_vlev_datasheet, | |
858 | .tabsize = ARRAY_SIZE(cclk_vlev_datasheet), | |
859 | .vr_settling_time = 25 /* us */, | |
860 | }; | |
861 | ||
862 | static struct platform_device bfin_dpmc = { | |
863 | .name = "bfin dpmc", | |
864 | .dev = { | |
865 | .platform_data = &bfin_dmpc_vreg_data, | |
866 | }, | |
867 | }; | |
868 | ||
24a07a12 | 869 | static struct platform_device *ezkit_devices[] __initdata = { |
14b03204 MH |
870 | |
871 | &bfin_dpmc, | |
872 | ||
24a07a12 RH |
873 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) |
874 | &rtc_device, | |
875 | #endif | |
876 | ||
877 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) | |
878 | &bfin_uart_device, | |
879 | #endif | |
c6c4d7bb | 880 | |
5be36d22 | 881 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) |
42bd8bcb GY |
882 | #ifdef CONFIG_BFIN_SIR0 |
883 | &bfin_sir0_device, | |
884 | #endif | |
885 | #ifdef CONFIG_BFIN_SIR1 | |
886 | &bfin_sir1_device, | |
887 | #endif | |
888 | #ifdef CONFIG_BFIN_SIR2 | |
889 | &bfin_sir2_device, | |
890 | #endif | |
891 | #ifdef CONFIG_BFIN_SIR3 | |
892 | &bfin_sir3_device, | |
893 | #endif | |
5be36d22 GY |
894 | #endif |
895 | ||
c6c4d7bb BW |
896 | #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE) |
897 | &bf54x_lq043_device, | |
898 | #endif | |
899 | ||
900 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) | |
901 | &smsc911x_device, | |
902 | #endif | |
903 | ||
c6c4d7bb BW |
904 | #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) |
905 | &musb_device, | |
906 | #endif | |
907 | ||
3f375690 MH |
908 | #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE) |
909 | &bfin_isp1760_device, | |
910 | #endif | |
911 | ||
c6c4d7bb BW |
912 | #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE) |
913 | &bfin_atapi_device, | |
914 | #endif | |
915 | ||
916 | #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE) | |
917 | &bf5xx_nand_device, | |
918 | #endif | |
919 | ||
3d7e6cf8 | 920 | #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE) |
c6c4d7bb BW |
921 | &bf54x_sdh_device, |
922 | #endif | |
923 | ||
924 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) | |
925 | &bf54x_spi_master0, | |
d4b1d273 | 926 | &bf54x_spi_master1, |
c6c4d7bb BW |
927 | #endif |
928 | ||
929 | #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE) | |
930 | &bf54x_kpad_device, | |
931 | #endif | |
932 | ||
aca5e4aa MH |
933 | #if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE) |
934 | &bfin_rotary_device, | |
935 | #endif | |
936 | ||
c6c4d7bb BW |
937 | #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) |
938 | &i2c_bfin_twi0_device, | |
7160e950 | 939 | #if !defined(CONFIG_BF542) |
c6c4d7bb BW |
940 | &i2c_bfin_twi1_device, |
941 | #endif | |
7160e950 | 942 | #endif |
2463ef22 MH |
943 | |
944 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | |
945 | &bfin_device_gpiokeys, | |
946 | #endif | |
cad2ab65 MF |
947 | |
948 | &bfin_gpios_device, | |
793dc27b MF |
949 | |
950 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) | |
de8c43f2 | 951 | &ezkit_flash_device, |
793dc27b | 952 | #endif |
24a07a12 RH |
953 | }; |
954 | ||
a01d7a76 | 955 | static int __init ezkit_init(void) |
24a07a12 | 956 | { |
b85d858b | 957 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
81d9c7f2 BW |
958 | |
959 | #ifdef CONFIG_I2C_BOARDINFO | |
960 | i2c_register_board_info(0, bfin_i2c_board_info0, | |
961 | ARRAY_SIZE(bfin_i2c_board_info0)); | |
962 | #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */ | |
963 | i2c_register_board_info(1, bfin_i2c_board_info1, | |
964 | ARRAY_SIZE(bfin_i2c_board_info1)); | |
965 | #endif | |
966 | #endif | |
967 | ||
24a07a12 | 968 | platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices)); |
c6c4d7bb | 969 | |
5bda2723 | 970 | spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); |
c6c4d7bb | 971 | |
24a07a12 RH |
972 | return 0; |
973 | } | |
974 | ||
a01d7a76 | 975 | arch_initcall(ezkit_init); |