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