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