blob: 290b6e9ec21ed8521f031aed7d6679650d7c8677 [file] [log] [blame]
Michael Hennerichdb682542008-04-24 03:18:59 +08001/*
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>
Mike Frysinger2de73e72008-11-18 17:48:22 +080035#include <linux/mtd/physmap.h>
Michael Hennerichdb682542008-04-24 03:18:59 +080036#include <linux/spi/spi.h>
37#include <linux/spi/flash.h>
38#include <linux/irq.h>
39#include <linux/interrupt.h>
40#include <linux/usb/musb.h>
41#include <asm/bfin5xx_spi.h>
Michael Hennerichdb682542008-04-24 03:18:59 +080042#include <asm/dma.h>
43#include <asm/gpio.h>
44#include <asm/nand.h>
45#include <asm/portmux.h>
Mike Frysinger8d8921a2009-01-07 23:14:39 +080046#include <asm/bfin_sdh.h>
Bryan Wu639f6572008-08-27 10:51:02 +080047#include <mach/bf54x_keys.h>
Michael Hennerich14b03202008-05-07 11:41:26 +080048#include <asm/dpmc.h>
Michael Hennerichdb682542008-04-24 03:18:59 +080049#include <linux/input.h>
50#include <linux/spi/ad7877.h>
51
52/*
53 * Name the Board for the /proc/cpuinfo
54 */
55const char bfin_board_name[] = "Bluetechnix CM-BF548";
56
57/*
58 * Driver needs to know address, irq and flag pin.
59 */
60
61#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
62
Bryan Wu639f6572008-08-27 10:51:02 +080063#include <mach/bf54x-lq043.h>
Michael Hennerichdb682542008-04-24 03:18:59 +080064
65static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
66 .width = 480,
67 .height = 272,
68 .xres = {480, 480, 480},
69 .yres = {272, 272, 272},
70 .bpp = {24, 24, 24},
71 .disp = GPIO_PE3,
72};
73
74static struct resource bf54x_lq043_resources[] = {
75 {
76 .start = IRQ_EPPI0_ERR,
77 .end = IRQ_EPPI0_ERR,
78 .flags = IORESOURCE_IRQ,
79 },
80};
81
82static struct platform_device bf54x_lq043_device = {
83 .name = "bf54x-lq043",
84 .id = -1,
85 .num_resources = ARRAY_SIZE(bf54x_lq043_resources),
86 .resource = bf54x_lq043_resources,
87 .dev = {
88 .platform_data = &bf54x_lq043_data,
89 },
90};
91#endif
92
93#if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
94static unsigned int bf548_keymap[] = {
95 KEYVAL(0, 0, KEY_ENTER),
96 KEYVAL(0, 1, KEY_HELP),
97 KEYVAL(0, 2, KEY_0),
98 KEYVAL(0, 3, KEY_BACKSPACE),
99 KEYVAL(1, 0, KEY_TAB),
100 KEYVAL(1, 1, KEY_9),
101 KEYVAL(1, 2, KEY_8),
102 KEYVAL(1, 3, KEY_7),
103 KEYVAL(2, 0, KEY_DOWN),
104 KEYVAL(2, 1, KEY_6),
105 KEYVAL(2, 2, KEY_5),
106 KEYVAL(2, 3, KEY_4),
107 KEYVAL(3, 0, KEY_UP),
108 KEYVAL(3, 1, KEY_3),
109 KEYVAL(3, 2, KEY_2),
110 KEYVAL(3, 3, KEY_1),
111};
112
113static struct bfin_kpad_platform_data bf54x_kpad_data = {
114 .rows = 4,
115 .cols = 4,
116 .keymap = bf548_keymap,
117 .keymapsize = ARRAY_SIZE(bf548_keymap),
118 .repeat = 0,
119 .debounce_time = 5000, /* ns (5ms) */
120 .coldrive_time = 1000, /* ns (1ms) */
121 .keyup_test_interval = 50, /* ms (50ms) */
122};
123
124static struct resource bf54x_kpad_resources[] = {
125 {
126 .start = IRQ_KEY,
127 .end = IRQ_KEY,
128 .flags = IORESOURCE_IRQ,
129 },
130};
131
132static struct platform_device bf54x_kpad_device = {
133 .name = "bf54x-keys",
134 .id = -1,
135 .num_resources = ARRAY_SIZE(bf54x_kpad_resources),
136 .resource = bf54x_kpad_resources,
137 .dev = {
138 .platform_data = &bf54x_kpad_data,
139 },
140};
141#endif
142
143#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
144static struct platform_device rtc_device = {
145 .name = "rtc-bfin",
146 .id = -1,
147};
148#endif
149
150#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
151static struct resource bfin_uart_resources[] = {
152#ifdef CONFIG_SERIAL_BFIN_UART0
153 {
154 .start = 0xFFC00400,
155 .end = 0xFFC004FF,
156 .flags = IORESOURCE_MEM,
157 },
158#endif
159#ifdef CONFIG_SERIAL_BFIN_UART1
160 {
161 .start = 0xFFC02000,
162 .end = 0xFFC020FF,
163 .flags = IORESOURCE_MEM,
164 },
165#endif
166#ifdef CONFIG_SERIAL_BFIN_UART2
167 {
168 .start = 0xFFC02100,
169 .end = 0xFFC021FF,
170 .flags = IORESOURCE_MEM,
171 },
172#endif
173#ifdef CONFIG_SERIAL_BFIN_UART3
174 {
175 .start = 0xFFC03100,
176 .end = 0xFFC031FF,
Sonic Zhang86068012008-10-09 13:55:33 +0800177 .flags = IORESOURCE_MEM,
Michael Hennerichdb682542008-04-24 03:18:59 +0800178 },
179#endif
180};
181
182static 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
Graf Yang5be36d22008-04-25 03:09:15 +0800190#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang5be36d22008-04-25 03:09:15 +0800191#ifdef CONFIG_BFIN_SIR0
Graf Yang42bd8bc2009-01-07 23:14:39 +0800192static struct resource bfin_sir0_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800193 {
194 .start = 0xFFC00400,
195 .end = 0xFFC004FF,
196 .flags = IORESOURCE_MEM,
197 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800198 {
199 .start = IRQ_UART0_RX,
200 .end = IRQ_UART0_RX+1,
201 .flags = IORESOURCE_IRQ,
202 },
203 {
204 .start = CH_UART0_RX,
205 .end = CH_UART0_RX+1,
206 .flags = IORESOURCE_DMA,
207 },
208};
209static struct platform_device bfin_sir0_device = {
210 .name = "bfin_sir",
211 .id = 0,
212 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
213 .resource = bfin_sir0_resources,
214};
Graf Yang5be36d22008-04-25 03:09:15 +0800215#endif
216#ifdef CONFIG_BFIN_SIR1
Graf Yang42bd8bc2009-01-07 23:14:39 +0800217static struct resource bfin_sir1_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800218 {
219 .start = 0xFFC02000,
220 .end = 0xFFC020FF,
221 .flags = IORESOURCE_MEM,
222 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800223 {
224 .start = IRQ_UART1_RX,
225 .end = IRQ_UART1_RX+1,
226 .flags = IORESOURCE_IRQ,
227 },
228 {
229 .start = CH_UART1_RX,
230 .end = CH_UART1_RX+1,
231 .flags = IORESOURCE_DMA,
232 },
233};
234static struct platform_device bfin_sir1_device = {
235 .name = "bfin_sir",
236 .id = 1,
237 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
238 .resource = bfin_sir1_resources,
239};
Graf Yang5be36d22008-04-25 03:09:15 +0800240#endif
241#ifdef CONFIG_BFIN_SIR2
Graf Yang42bd8bc2009-01-07 23:14:39 +0800242static struct resource bfin_sir2_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800243 {
244 .start = 0xFFC02100,
245 .end = 0xFFC021FF,
246 .flags = IORESOURCE_MEM,
247 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800248 {
249 .start = IRQ_UART2_RX,
250 .end = IRQ_UART2_RX+1,
251 .flags = IORESOURCE_IRQ,
252 },
253 {
254 .start = CH_UART2_RX,
255 .end = CH_UART2_RX+1,
256 .flags = IORESOURCE_DMA,
257 },
258};
259static struct platform_device bfin_sir2_device = {
260 .name = "bfin_sir",
261 .id = 2,
262 .num_resources = ARRAY_SIZE(bfin_sir2_resources),
263 .resource = bfin_sir2_resources,
264};
Graf Yang5be36d22008-04-25 03:09:15 +0800265#endif
266#ifdef CONFIG_BFIN_SIR3
Graf Yang42bd8bc2009-01-07 23:14:39 +0800267static struct resource bfin_sir3_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800268 {
269 .start = 0xFFC03100,
270 .end = 0xFFC031FF,
271 .flags = IORESOURCE_MEM,
272 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800273 {
274 .start = IRQ_UART3_RX,
275 .end = IRQ_UART3_RX+1,
276 .flags = IORESOURCE_IRQ,
277 },
278 {
279 .start = CH_UART3_RX,
280 .end = CH_UART3_RX+1,
281 .flags = IORESOURCE_DMA,
282 },
Graf Yang5be36d22008-04-25 03:09:15 +0800283};
Graf Yang42bd8bc2009-01-07 23:14:39 +0800284static struct platform_device bfin_sir3_device = {
Graf Yang5be36d22008-04-25 03:09:15 +0800285 .name = "bfin_sir",
Graf Yang42bd8bc2009-01-07 23:14:39 +0800286 .id = 3,
287 .num_resources = ARRAY_SIZE(bfin_sir3_resources),
288 .resource = bfin_sir3_resources,
Graf Yang5be36d22008-04-25 03:09:15 +0800289};
290#endif
Graf Yang42bd8bc2009-01-07 23:14:39 +0800291#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800292
Michael Hennerichdb682542008-04-24 03:18:59 +0800293#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
294static struct resource smsc911x_resources[] = {
295 {
296 .name = "smsc911x-memory",
297 .start = 0x24000000,
298 .end = 0x24000000 + 0xFF,
299 .flags = IORESOURCE_MEM,
300 },
301 {
302 .start = IRQ_PE6,
303 .end = IRQ_PE6,
304 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
305 },
306};
307static struct platform_device smsc911x_device = {
308 .name = "smsc911x",
309 .id = 0,
310 .num_resources = ARRAY_SIZE(smsc911x_resources),
311 .resource = smsc911x_resources,
312};
313#endif
314
315#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
316static struct resource musb_resources[] = {
317 [0] = {
318 .start = 0xFFC03C00,
319 .end = 0xFFC040FF,
320 .flags = IORESOURCE_MEM,
321 },
322 [1] = { /* general IRQ */
323 .start = IRQ_USB_INT0,
324 .end = IRQ_USB_INT0,
325 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
326 },
327 [2] = { /* DMA IRQ */
328 .start = IRQ_USB_DMA,
329 .end = IRQ_USB_DMA,
330 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
331 },
332};
333
Bryan Wu50041ac2008-10-08 13:39:40 +0800334static struct musb_hdrc_config musb_config = {
335 .multipoint = 0,
336 .dyn_fifo = 0,
337 .soft_con = 1,
338 .dma = 1,
Bryan Wufea05da2009-01-07 23:14:39 +0800339 .num_eps = 8,
340 .dma_channels = 8,
Bryan Wu50041ac2008-10-08 13:39:40 +0800341 .gpio_vrsel = GPIO_PH6,
342};
343
Michael Hennerichdb682542008-04-24 03:18:59 +0800344static struct musb_hdrc_platform_data musb_plat = {
345#if defined(CONFIG_USB_MUSB_OTG)
346 .mode = MUSB_OTG,
347#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
348 .mode = MUSB_HOST,
349#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
350 .mode = MUSB_PERIPHERAL,
351#endif
Bryan Wu50041ac2008-10-08 13:39:40 +0800352 .config = &musb_config,
Michael Hennerichdb682542008-04-24 03:18:59 +0800353};
354
355static u64 musb_dmamask = ~(u32)0;
356
357static struct platform_device musb_device = {
358 .name = "musb_hdrc",
359 .id = 0,
360 .dev = {
361 .dma_mask = &musb_dmamask,
362 .coherent_dma_mask = 0xffffffff,
363 .platform_data = &musb_plat,
364 },
365 .num_resources = ARRAY_SIZE(musb_resources),
366 .resource = musb_resources,
367};
368#endif
369
Mike Frysingerc97618d2009-01-07 23:14:38 +0800370static struct resource bfin_gpios_resources = {
371 .start = 0,
372 .end = MAX_BLACKFIN_GPIOS - 1,
373 .flags = IORESOURCE_IRQ,
374};
375
376static struct platform_device bfin_gpios_device = {
377 .name = "simple-gpio",
378 .id = -1,
379 .num_resources = 1,
380 .resource = &bfin_gpios_resources,
381};
382
Michael Hennerichdb682542008-04-24 03:18:59 +0800383#if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
384static struct resource bfin_atapi_resources[] = {
385 {
386 .start = 0xFFC03800,
387 .end = 0xFFC0386F,
388 .flags = IORESOURCE_MEM,
389 },
390 {
391 .start = IRQ_ATAPI_ERR,
392 .end = IRQ_ATAPI_ERR,
393 .flags = IORESOURCE_IRQ,
394 },
395};
396
397static struct platform_device bfin_atapi_device = {
398 .name = "pata-bf54x",
399 .id = -1,
400 .num_resources = ARRAY_SIZE(bfin_atapi_resources),
401 .resource = bfin_atapi_resources,
402};
403#endif
404
405#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
406static struct mtd_partition partition_info[] = {
407 {
Robin Getzaa582972008-08-05 17:47:29 +0800408 .name = "linux kernel(nand)",
Michael Hennerichdb682542008-04-24 03:18:59 +0800409 .offset = 0,
Mike Frysingerf4585a02008-10-13 14:45:21 +0800410 .size = 4 * 1024 * 1024,
Michael Hennerichdb682542008-04-24 03:18:59 +0800411 },
412 {
Robin Getzaa582972008-08-05 17:47:29 +0800413 .name = "file system(nand)",
Mike Frysingerf4585a02008-10-13 14:45:21 +0800414 .offset = 4 * 1024 * 1024,
415 .size = (256 - 4) * 1024 * 1024,
Michael Hennerichdb682542008-04-24 03:18:59 +0800416 },
417};
418
419static struct bf5xx_nand_platform bf5xx_nand_platform = {
420 .page_size = NFC_PG_SIZE_256,
421 .data_width = NFC_NWIDTH_8,
422 .partitions = partition_info,
423 .nr_partitions = ARRAY_SIZE(partition_info),
424 .rd_dly = 3,
425 .wr_dly = 3,
426};
427
428static struct resource bf5xx_nand_resources[] = {
429 {
430 .start = 0xFFC03B00,
431 .end = 0xFFC03B4F,
432 .flags = IORESOURCE_MEM,
433 },
434 {
435 .start = CH_NFC,
436 .end = CH_NFC,
437 .flags = IORESOURCE_IRQ,
438 },
439};
440
441static struct platform_device bf5xx_nand_device = {
442 .name = "bf5xx-nand",
443 .id = 0,
444 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
445 .resource = bf5xx_nand_resources,
446 .dev = {
447 .platform_data = &bf5xx_nand_platform,
448 },
449};
450#endif
451
452#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
Mike Frysinger8d8921a2009-01-07 23:14:39 +0800453static struct bfin_sd_host bfin_sdh_data = {
454 .dma_chan = CH_SDH,
455 .irq_int0 = IRQ_SDH_MASK0,
456 .pin_req = {P_SD_D0, P_SD_D1, P_SD_D2, P_SD_D3, P_SD_CLK, P_SD_CMD, 0},
457};
458
Michael Hennerichdb682542008-04-24 03:18:59 +0800459static struct platform_device bf54x_sdh_device = {
460 .name = "bfin-sdh",
461 .id = 0,
Mike Frysinger8d8921a2009-01-07 23:14:39 +0800462 .dev = {
463 .platform_data = &bfin_sdh_data,
464 },
Michael Hennerichdb682542008-04-24 03:18:59 +0800465};
466#endif
467
Mike Frysinger2de73e72008-11-18 17:48:22 +0800468#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
469static struct mtd_partition para_partitions[] = {
470 {
471 .name = "bootloader(nor)",
472 .size = 0x40000,
473 .offset = 0,
474 }, {
475 .name = "linux kernel(nor)",
476 .size = 0x400000,
477 .offset = MTDPART_OFS_APPEND,
478 }, {
479 .name = "file system(nor)",
480 .size = MTDPART_SIZ_FULL,
481 .offset = MTDPART_OFS_APPEND,
482 }
483};
484
485static struct physmap_flash_data para_flash_data = {
486 .width = 2,
487 .parts = para_partitions,
488 .nr_parts = ARRAY_SIZE(para_partitions),
489};
490
491static struct resource para_flash_resource = {
492 .start = 0x20000000,
493 .end = 0x207fffff,
494 .flags = IORESOURCE_MEM,
495};
496
497static struct platform_device para_flash_device = {
498 .name = "physmap-flash",
499 .id = 0,
500 .dev = {
501 .platform_data = &para_flash_data,
502 },
503 .num_resources = 1,
504 .resource = &para_flash_resource,
505};
506#endif
507
Michael Hennerichdb682542008-04-24 03:18:59 +0800508#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
509/* all SPI peripherals info goes here */
510#if defined(CONFIG_MTD_M25P80) \
511 || defined(CONFIG_MTD_M25P80_MODULE)
512/* SPI flash chip (m25p16) */
513static struct mtd_partition bfin_spi_flash_partitions[] = {
514 {
Robin Getzaa582972008-08-05 17:47:29 +0800515 .name = "bootloader(spi)",
Michael Hennerichdb682542008-04-24 03:18:59 +0800516 .size = 0x00040000,
517 .offset = 0,
518 .mask_flags = MTD_CAP_ROM
519 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800520 .name = "linux kernel(spi)",
Michael Hennerichdb682542008-04-24 03:18:59 +0800521 .size = 0x1c0000,
522 .offset = 0x40000
523 }
524};
525
526static struct flash_platform_data bfin_spi_flash_data = {
527 .name = "m25p80",
528 .parts = bfin_spi_flash_partitions,
529 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
530 .type = "m25p16",
531};
532
533static struct bfin5xx_spi_chip spi_flash_chip_info = {
534 .enable_dma = 0, /* use dma transfer with this chip*/
535 .bits_per_word = 8,
536 .cs_change_per_word = 0,
537};
538#endif
539
540#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
541static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
542 .cs_change_per_word = 0,
543 .enable_dma = 0,
544 .bits_per_word = 16,
545};
546
547static const struct ad7877_platform_data bfin_ad7877_ts_info = {
548 .model = 7877,
549 .vref_delay_usecs = 50, /* internal, no capacitor */
550 .x_plate_ohms = 419,
551 .y_plate_ohms = 486,
552 .pressure_max = 1000,
553 .pressure_min = 0,
554 .stopacq_polarity = 1,
555 .first_conversion_delay = 3,
556 .acquisition_time = 1,
557 .averaging = 1,
558 .pen_down_acc_interval = 1,
559};
560#endif
561
562#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
563static struct bfin5xx_spi_chip spidev_chip_info = {
564 .enable_dma = 0,
565 .bits_per_word = 8,
566};
567#endif
568
569static struct spi_board_info bf54x_spi_board_info[] __initdata = {
570#if defined(CONFIG_MTD_M25P80) \
571 || defined(CONFIG_MTD_M25P80_MODULE)
572 {
573 /* the modalias must be the same as spi device driver name */
574 .modalias = "m25p80", /* Name of spi_driver for this device */
575 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
576 .bus_num = 0, /* Framework bus number */
577 .chip_select = 1, /* SPI_SSEL1*/
578 .platform_data = &bfin_spi_flash_data,
579 .controller_data = &spi_flash_chip_info,
580 .mode = SPI_MODE_3,
581 },
582#endif
583#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
584{
585 .modalias = "ad7877",
586 .platform_data = &bfin_ad7877_ts_info,
587 .irq = IRQ_PJ11,
588 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
589 .bus_num = 0,
590 .chip_select = 2,
591 .controller_data = &spi_ad7877_chip_info,
592},
593#endif
594#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
595 {
596 .modalias = "spidev",
597 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
598 .bus_num = 0,
599 .chip_select = 1,
600 .controller_data = &spidev_chip_info,
601 },
602#endif
603};
604
605/* SPI (0) */
606static struct resource bfin_spi0_resource[] = {
607 [0] = {
608 .start = SPI0_REGBASE,
609 .end = SPI0_REGBASE + 0xFF,
610 .flags = IORESOURCE_MEM,
611 },
612 [1] = {
613 .start = CH_SPI0,
614 .end = CH_SPI0,
Yi Li53122692009-06-05 12:11:11 +0000615 .flags = IORESOURCE_DMA,
616 },
617 [2] = {
618 .start = IRQ_SPI0,
619 .end = IRQ_SPI0,
Michael Hennerichdb682542008-04-24 03:18:59 +0800620 .flags = IORESOURCE_IRQ,
621 }
622};
623
624/* SPI (1) */
625static struct resource bfin_spi1_resource[] = {
626 [0] = {
627 .start = SPI1_REGBASE,
628 .end = SPI1_REGBASE + 0xFF,
629 .flags = IORESOURCE_MEM,
630 },
631 [1] = {
632 .start = CH_SPI1,
633 .end = CH_SPI1,
Yi Li53122692009-06-05 12:11:11 +0000634 .flags = IORESOURCE_DMA,
635 },
636 [2] = {
637 .start = IRQ_SPI1,
638 .end = IRQ_SPI1,
Michael Hennerichdb682542008-04-24 03:18:59 +0800639 .flags = IORESOURCE_IRQ,
640 }
641};
642
643/* SPI controller data */
644static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
Yi Li4e4d4962009-08-30 20:45:50 +0000645 .num_chipselect = 3,
Michael Hennerichdb682542008-04-24 03:18:59 +0800646 .enable_dma = 1, /* master has the ability to do dma transfer */
647 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
648};
649
650static struct platform_device bf54x_spi_master0 = {
651 .name = "bfin-spi",
652 .id = 0, /* Bus number */
653 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
654 .resource = bfin_spi0_resource,
655 .dev = {
656 .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
657 },
658};
659
660static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
Yi Li4e4d4962009-08-30 20:45:50 +0000661 .num_chipselect = 3,
Michael Hennerichdb682542008-04-24 03:18:59 +0800662 .enable_dma = 1, /* master has the ability to do dma transfer */
663 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
664};
665
666static struct platform_device bf54x_spi_master1 = {
667 .name = "bfin-spi",
668 .id = 1, /* Bus number */
669 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
670 .resource = bfin_spi1_resource,
671 .dev = {
672 .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
673 },
674};
675#endif /* spi master and devices */
676
677#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
678static struct resource bfin_twi0_resource[] = {
679 [0] = {
680 .start = TWI0_REGBASE,
681 .end = TWI0_REGBASE + 0xFF,
682 .flags = IORESOURCE_MEM,
683 },
684 [1] = {
685 .start = IRQ_TWI0,
686 .end = IRQ_TWI0,
687 .flags = IORESOURCE_IRQ,
688 },
689};
690
691static struct platform_device i2c_bfin_twi0_device = {
692 .name = "i2c-bfin-twi",
693 .id = 0,
694 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
695 .resource = bfin_twi0_resource,
696};
697
698#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
699static struct resource bfin_twi1_resource[] = {
700 [0] = {
701 .start = TWI1_REGBASE,
702 .end = TWI1_REGBASE + 0xFF,
703 .flags = IORESOURCE_MEM,
704 },
705 [1] = {
706 .start = IRQ_TWI1,
707 .end = IRQ_TWI1,
708 .flags = IORESOURCE_IRQ,
709 },
710};
711
712static struct platform_device i2c_bfin_twi1_device = {
713 .name = "i2c-bfin-twi",
714 .id = 1,
715 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
716 .resource = bfin_twi1_resource,
717};
718#endif
719#endif
720
721#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
722#include <linux/gpio_keys.h>
723
724static struct gpio_keys_button bfin_gpio_keys_table[] = {
725 {BTN_0, GPIO_PH7, 1, "gpio-keys: BTN0"},
726};
727
728static struct gpio_keys_platform_data bfin_gpio_keys_data = {
729 .buttons = bfin_gpio_keys_table,
730 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
731};
732
733static struct platform_device bfin_device_gpiokeys = {
734 .name = "gpio-keys",
735 .dev = {
736 .platform_data = &bfin_gpio_keys_data,
737 },
738};
739#endif
740
Michael Hennerich14b03202008-05-07 11:41:26 +0800741static const unsigned int cclk_vlev_datasheet[] =
742{
743/*
744 * Internal VLEV BF54XSBBC1533
745 ****temporarily using these values until data sheet is updated
746 */
747 VRPAIR(VLEV_085, 150000000),
748 VRPAIR(VLEV_090, 250000000),
749 VRPAIR(VLEV_110, 276000000),
750 VRPAIR(VLEV_115, 301000000),
751 VRPAIR(VLEV_120, 525000000),
752 VRPAIR(VLEV_125, 550000000),
753 VRPAIR(VLEV_130, 600000000),
754};
755
756static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
757 .tuple_tab = cclk_vlev_datasheet,
758 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
759 .vr_settling_time = 25 /* us */,
760};
761
762static struct platform_device bfin_dpmc = {
763 .name = "bfin dpmc",
764 .dev = {
765 .platform_data = &bfin_dmpc_vreg_data,
766 },
767};
768
Michael Hennerichdb682542008-04-24 03:18:59 +0800769static struct platform_device *cm_bf548_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +0800770
771 &bfin_dpmc,
772
Michael Hennerichdb682542008-04-24 03:18:59 +0800773#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
774 &rtc_device,
775#endif
776
777#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
778 &bfin_uart_device,
779#endif
780
Graf Yang5be36d22008-04-25 03:09:15 +0800781#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang42bd8bc2009-01-07 23:14:39 +0800782#ifdef CONFIG_BFIN_SIR0
783 &bfin_sir0_device,
784#endif
785#ifdef CONFIG_BFIN_SIR1
786 &bfin_sir1_device,
787#endif
788#ifdef CONFIG_BFIN_SIR2
789 &bfin_sir2_device,
790#endif
791#ifdef CONFIG_BFIN_SIR3
792 &bfin_sir3_device,
793#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800794#endif
795
Michael Hennerichdb682542008-04-24 03:18:59 +0800796#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
797 &bf54x_lq043_device,
798#endif
799
800#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
801 &smsc911x_device,
802#endif
803
804#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
805 &musb_device,
806#endif
807
808#if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
809 &bfin_atapi_device,
810#endif
811
812#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
813 &bf5xx_nand_device,
814#endif
815
816#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
817 &bf54x_sdh_device,
818#endif
819
820#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
821 &bf54x_spi_master0,
822 &bf54x_spi_master1,
823#endif
824
825#if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
826 &bf54x_kpad_device,
827#endif
828
829#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
Mike Frysinger10a88a22008-11-18 17:48:22 +0800830 &i2c_bfin_twi0_device,
Michael Hennerichdb682542008-04-24 03:18:59 +0800831#if !defined(CONFIG_BF542)
832 &i2c_bfin_twi1_device,
833#endif
834#endif
835
836#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
837 &bfin_device_gpiokeys,
838#endif
Mike Frysinger2de73e72008-11-18 17:48:22 +0800839
840#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
841 &para_flash_device,
842#endif
Mike Frysingerc97618d2009-01-07 23:14:38 +0800843
844 &bfin_gpios_device,
Michael Hennerichdb682542008-04-24 03:18:59 +0800845};
846
847static int __init cm_bf548_init(void)
848{
Michael Hennerichf086f232008-05-20 16:42:39 +0800849 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Michael Hennerichdb682542008-04-24 03:18:59 +0800850 platform_add_devices(cm_bf548_devices, ARRAY_SIZE(cm_bf548_devices));
851
852#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
853 spi_register_board_info(bf54x_spi_board_info,
854 ARRAY_SIZE(bf54x_spi_board_info));
855#endif
856
857 return 0;
858}
859
860arch_initcall(cm_bf548_init);