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