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