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