blob: ccdcd6da2e9fc09f00b7e1f19bb2b26bbfbdccce [file] [log] [blame]
Michael Hennerichdb682542008-04-24 03:18:59 +08001/*
Robin Getz96f10502009-09-24 14:11:24 +00002 * Copyright 2004-2009 Analog Devices Inc.
3 * 2008-2009 Bluetechnix
4 * 2005 National ICT Australia (NICTA)
5 * Aidan Williams <aidan@nicta.com.au>
Michael Hennerichdb682542008-04-24 03:18:59 +08006 *
Robin Getz96f10502009-09-24 14:11:24 +00007 * Licensed under the GPL-2 or later.
Michael Hennerichdb682542008-04-24 03:18:59 +08008 */
9
10#include <linux/device.h>
11#include <linux/platform_device.h>
12#include <linux/mtd/mtd.h>
13#include <linux/mtd/partitions.h>
Mike Frysinger2de73e72008-11-18 17:48:22 +080014#include <linux/mtd/physmap.h>
Michael Hennerichdb682542008-04-24 03:18:59 +080015#include <linux/spi/spi.h>
16#include <linux/spi/flash.h>
17#include <linux/irq.h>
18#include <linux/interrupt.h>
19#include <linux/usb/musb.h>
20#include <asm/bfin5xx_spi.h>
Michael Hennerichdb682542008-04-24 03:18:59 +080021#include <asm/dma.h>
22#include <asm/gpio.h>
23#include <asm/nand.h>
24#include <asm/portmux.h>
Mike Frysinger8d8921a2009-01-07 23:14:39 +080025#include <asm/bfin_sdh.h>
Bryan Wu639f6572008-08-27 10:51:02 +080026#include <mach/bf54x_keys.h>
Michael Hennerich14b03202008-05-07 11:41:26 +080027#include <asm/dpmc.h>
Michael Hennerichdb682542008-04-24 03:18:59 +080028#include <linux/input.h>
29#include <linux/spi/ad7877.h>
30
31/*
32 * Name the Board for the /proc/cpuinfo
33 */
34const char bfin_board_name[] = "Bluetechnix CM-BF548";
35
36/*
37 * Driver needs to know address, irq and flag pin.
38 */
39
40#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
41
Bryan Wu639f6572008-08-27 10:51:02 +080042#include <mach/bf54x-lq043.h>
Michael Hennerichdb682542008-04-24 03:18:59 +080043
44static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
45 .width = 480,
46 .height = 272,
47 .xres = {480, 480, 480},
48 .yres = {272, 272, 272},
49 .bpp = {24, 24, 24},
50 .disp = GPIO_PE3,
51};
52
53static struct resource bf54x_lq043_resources[] = {
54 {
55 .start = IRQ_EPPI0_ERR,
56 .end = IRQ_EPPI0_ERR,
57 .flags = IORESOURCE_IRQ,
58 },
59};
60
61static struct platform_device bf54x_lq043_device = {
62 .name = "bf54x-lq043",
63 .id = -1,
64 .num_resources = ARRAY_SIZE(bf54x_lq043_resources),
65 .resource = bf54x_lq043_resources,
66 .dev = {
67 .platform_data = &bf54x_lq043_data,
68 },
69};
70#endif
71
72#if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
73static unsigned int bf548_keymap[] = {
74 KEYVAL(0, 0, KEY_ENTER),
75 KEYVAL(0, 1, KEY_HELP),
76 KEYVAL(0, 2, KEY_0),
77 KEYVAL(0, 3, KEY_BACKSPACE),
78 KEYVAL(1, 0, KEY_TAB),
79 KEYVAL(1, 1, KEY_9),
80 KEYVAL(1, 2, KEY_8),
81 KEYVAL(1, 3, KEY_7),
82 KEYVAL(2, 0, KEY_DOWN),
83 KEYVAL(2, 1, KEY_6),
84 KEYVAL(2, 2, KEY_5),
85 KEYVAL(2, 3, KEY_4),
86 KEYVAL(3, 0, KEY_UP),
87 KEYVAL(3, 1, KEY_3),
88 KEYVAL(3, 2, KEY_2),
89 KEYVAL(3, 3, KEY_1),
90};
91
92static struct bfin_kpad_platform_data bf54x_kpad_data = {
93 .rows = 4,
94 .cols = 4,
95 .keymap = bf548_keymap,
96 .keymapsize = ARRAY_SIZE(bf548_keymap),
97 .repeat = 0,
98 .debounce_time = 5000, /* ns (5ms) */
99 .coldrive_time = 1000, /* ns (1ms) */
100 .keyup_test_interval = 50, /* ms (50ms) */
101};
102
103static struct resource bf54x_kpad_resources[] = {
104 {
105 .start = IRQ_KEY,
106 .end = IRQ_KEY,
107 .flags = IORESOURCE_IRQ,
108 },
109};
110
111static struct platform_device bf54x_kpad_device = {
112 .name = "bf54x-keys",
113 .id = -1,
114 .num_resources = ARRAY_SIZE(bf54x_kpad_resources),
115 .resource = bf54x_kpad_resources,
116 .dev = {
117 .platform_data = &bf54x_kpad_data,
118 },
119};
120#endif
121
122#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
123static struct platform_device rtc_device = {
124 .name = "rtc-bfin",
125 .id = -1,
126};
127#endif
128
129#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
130static struct resource bfin_uart_resources[] = {
131#ifdef CONFIG_SERIAL_BFIN_UART0
132 {
133 .start = 0xFFC00400,
134 .end = 0xFFC004FF,
135 .flags = IORESOURCE_MEM,
136 },
137#endif
138#ifdef CONFIG_SERIAL_BFIN_UART1
139 {
140 .start = 0xFFC02000,
141 .end = 0xFFC020FF,
142 .flags = IORESOURCE_MEM,
143 },
144#endif
145#ifdef CONFIG_SERIAL_BFIN_UART2
146 {
147 .start = 0xFFC02100,
148 .end = 0xFFC021FF,
149 .flags = IORESOURCE_MEM,
150 },
151#endif
152#ifdef CONFIG_SERIAL_BFIN_UART3
153 {
154 .start = 0xFFC03100,
155 .end = 0xFFC031FF,
Sonic Zhang86068012008-10-09 13:55:33 +0800156 .flags = IORESOURCE_MEM,
Michael Hennerichdb682542008-04-24 03:18:59 +0800157 },
158#endif
159};
160
161static struct platform_device bfin_uart_device = {
162 .name = "bfin-uart",
163 .id = 1,
164 .num_resources = ARRAY_SIZE(bfin_uart_resources),
165 .resource = bfin_uart_resources,
166};
167#endif
168
Graf Yang5be36d22008-04-25 03:09:15 +0800169#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang5be36d22008-04-25 03:09:15 +0800170#ifdef CONFIG_BFIN_SIR0
Graf Yang42bd8bc2009-01-07 23:14:39 +0800171static struct resource bfin_sir0_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800172 {
173 .start = 0xFFC00400,
174 .end = 0xFFC004FF,
175 .flags = IORESOURCE_MEM,
176 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800177 {
178 .start = IRQ_UART0_RX,
179 .end = IRQ_UART0_RX+1,
180 .flags = IORESOURCE_IRQ,
181 },
182 {
183 .start = CH_UART0_RX,
184 .end = CH_UART0_RX+1,
185 .flags = IORESOURCE_DMA,
186 },
187};
188static struct platform_device bfin_sir0_device = {
189 .name = "bfin_sir",
190 .id = 0,
191 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
192 .resource = bfin_sir0_resources,
193};
Graf Yang5be36d22008-04-25 03:09:15 +0800194#endif
195#ifdef CONFIG_BFIN_SIR1
Graf Yang42bd8bc2009-01-07 23:14:39 +0800196static struct resource bfin_sir1_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800197 {
198 .start = 0xFFC02000,
199 .end = 0xFFC020FF,
200 .flags = IORESOURCE_MEM,
201 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800202 {
203 .start = IRQ_UART1_RX,
204 .end = IRQ_UART1_RX+1,
205 .flags = IORESOURCE_IRQ,
206 },
207 {
208 .start = CH_UART1_RX,
209 .end = CH_UART1_RX+1,
210 .flags = IORESOURCE_DMA,
211 },
212};
213static struct platform_device bfin_sir1_device = {
214 .name = "bfin_sir",
215 .id = 1,
216 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
217 .resource = bfin_sir1_resources,
218};
Graf Yang5be36d22008-04-25 03:09:15 +0800219#endif
220#ifdef CONFIG_BFIN_SIR2
Graf Yang42bd8bc2009-01-07 23:14:39 +0800221static struct resource bfin_sir2_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800222 {
223 .start = 0xFFC02100,
224 .end = 0xFFC021FF,
225 .flags = IORESOURCE_MEM,
226 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800227 {
228 .start = IRQ_UART2_RX,
229 .end = IRQ_UART2_RX+1,
230 .flags = IORESOURCE_IRQ,
231 },
232 {
233 .start = CH_UART2_RX,
234 .end = CH_UART2_RX+1,
235 .flags = IORESOURCE_DMA,
236 },
237};
238static struct platform_device bfin_sir2_device = {
239 .name = "bfin_sir",
240 .id = 2,
241 .num_resources = ARRAY_SIZE(bfin_sir2_resources),
242 .resource = bfin_sir2_resources,
243};
Graf Yang5be36d22008-04-25 03:09:15 +0800244#endif
245#ifdef CONFIG_BFIN_SIR3
Graf Yang42bd8bc2009-01-07 23:14:39 +0800246static struct resource bfin_sir3_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800247 {
248 .start = 0xFFC03100,
249 .end = 0xFFC031FF,
250 .flags = IORESOURCE_MEM,
251 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800252 {
253 .start = IRQ_UART3_RX,
254 .end = IRQ_UART3_RX+1,
255 .flags = IORESOURCE_IRQ,
256 },
257 {
258 .start = CH_UART3_RX,
259 .end = CH_UART3_RX+1,
260 .flags = IORESOURCE_DMA,
261 },
Graf Yang5be36d22008-04-25 03:09:15 +0800262};
Graf Yang42bd8bc2009-01-07 23:14:39 +0800263static struct platform_device bfin_sir3_device = {
Graf Yang5be36d22008-04-25 03:09:15 +0800264 .name = "bfin_sir",
Graf Yang42bd8bc2009-01-07 23:14:39 +0800265 .id = 3,
266 .num_resources = ARRAY_SIZE(bfin_sir3_resources),
267 .resource = bfin_sir3_resources,
Graf Yang5be36d22008-04-25 03:09:15 +0800268};
269#endif
Graf Yang42bd8bc2009-01-07 23:14:39 +0800270#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800271
Michael Hennerichdb682542008-04-24 03:18:59 +0800272#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
Harald Krapfenbauer9c214532009-09-10 15:30:03 +0000273#include <linux/smsc911x.h>
274
Michael Hennerichdb682542008-04-24 03:18:59 +0800275static struct resource smsc911x_resources[] = {
276 {
277 .name = "smsc911x-memory",
278 .start = 0x24000000,
279 .end = 0x24000000 + 0xFF,
280 .flags = IORESOURCE_MEM,
281 },
282 {
283 .start = IRQ_PE6,
284 .end = IRQ_PE6,
285 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
286 },
287};
Harald Krapfenbauer9c214532009-09-10 15:30:03 +0000288
289static struct smsc911x_platform_config smsc911x_config = {
290 .flags = SMSC911X_USE_16BIT,
291 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
292 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
293 .phy_interface = PHY_INTERFACE_MODE_MII,
294};
295
Michael Hennerichdb682542008-04-24 03:18:59 +0800296static struct platform_device smsc911x_device = {
297 .name = "smsc911x",
298 .id = 0,
299 .num_resources = ARRAY_SIZE(smsc911x_resources),
300 .resource = smsc911x_resources,
Harald Krapfenbauer9c214532009-09-10 15:30:03 +0000301 .dev = {
302 .platform_data = &smsc911x_config,
303 },
Michael Hennerichdb682542008-04-24 03:18:59 +0800304};
305#endif
306
307#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
308static struct resource musb_resources[] = {
309 [0] = {
310 .start = 0xFFC03C00,
311 .end = 0xFFC040FF,
312 .flags = IORESOURCE_MEM,
313 },
314 [1] = { /* general IRQ */
315 .start = IRQ_USB_INT0,
316 .end = IRQ_USB_INT0,
317 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
318 },
319 [2] = { /* DMA IRQ */
320 .start = IRQ_USB_DMA,
321 .end = IRQ_USB_DMA,
322 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
323 },
324};
325
Bryan Wu50041ac2008-10-08 13:39:40 +0800326static struct musb_hdrc_config musb_config = {
327 .multipoint = 0,
328 .dyn_fifo = 0,
329 .soft_con = 1,
330 .dma = 1,
Bryan Wufea05da2009-01-07 23:14:39 +0800331 .num_eps = 8,
332 .dma_channels = 8,
Bryan Wu50041ac2008-10-08 13:39:40 +0800333 .gpio_vrsel = GPIO_PH6,
334};
335
Michael Hennerichdb682542008-04-24 03:18:59 +0800336static struct musb_hdrc_platform_data musb_plat = {
337#if defined(CONFIG_USB_MUSB_OTG)
338 .mode = MUSB_OTG,
339#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
340 .mode = MUSB_HOST,
341#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
342 .mode = MUSB_PERIPHERAL,
343#endif
Bryan Wu50041ac2008-10-08 13:39:40 +0800344 .config = &musb_config,
Michael Hennerichdb682542008-04-24 03:18:59 +0800345};
346
347static u64 musb_dmamask = ~(u32)0;
348
349static struct platform_device musb_device = {
350 .name = "musb_hdrc",
351 .id = 0,
352 .dev = {
353 .dma_mask = &musb_dmamask,
354 .coherent_dma_mask = 0xffffffff,
355 .platform_data = &musb_plat,
356 },
357 .num_resources = ARRAY_SIZE(musb_resources),
358 .resource = musb_resources,
359};
360#endif
361
362#if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
363static struct resource bfin_atapi_resources[] = {
364 {
365 .start = 0xFFC03800,
366 .end = 0xFFC0386F,
367 .flags = IORESOURCE_MEM,
368 },
369 {
370 .start = IRQ_ATAPI_ERR,
371 .end = IRQ_ATAPI_ERR,
372 .flags = IORESOURCE_IRQ,
373 },
374};
375
376static struct platform_device bfin_atapi_device = {
377 .name = "pata-bf54x",
378 .id = -1,
379 .num_resources = ARRAY_SIZE(bfin_atapi_resources),
380 .resource = bfin_atapi_resources,
381};
382#endif
383
384#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
385static struct mtd_partition partition_info[] = {
386 {
Robin Getzaa582972008-08-05 17:47:29 +0800387 .name = "linux kernel(nand)",
Michael Hennerichdb682542008-04-24 03:18:59 +0800388 .offset = 0,
Mike Frysingerf4585a02008-10-13 14:45:21 +0800389 .size = 4 * 1024 * 1024,
Michael Hennerichdb682542008-04-24 03:18:59 +0800390 },
391 {
Robin Getzaa582972008-08-05 17:47:29 +0800392 .name = "file system(nand)",
Mike Frysingerf4585a02008-10-13 14:45:21 +0800393 .offset = 4 * 1024 * 1024,
394 .size = (256 - 4) * 1024 * 1024,
Michael Hennerichdb682542008-04-24 03:18:59 +0800395 },
396};
397
398static struct bf5xx_nand_platform bf5xx_nand_platform = {
399 .page_size = NFC_PG_SIZE_256,
400 .data_width = NFC_NWIDTH_8,
401 .partitions = partition_info,
402 .nr_partitions = ARRAY_SIZE(partition_info),
403 .rd_dly = 3,
404 .wr_dly = 3,
405};
406
407static struct resource bf5xx_nand_resources[] = {
408 {
409 .start = 0xFFC03B00,
410 .end = 0xFFC03B4F,
411 .flags = IORESOURCE_MEM,
412 },
413 {
414 .start = CH_NFC,
415 .end = CH_NFC,
416 .flags = IORESOURCE_IRQ,
417 },
418};
419
420static struct platform_device bf5xx_nand_device = {
421 .name = "bf5xx-nand",
422 .id = 0,
423 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
424 .resource = bf5xx_nand_resources,
425 .dev = {
426 .platform_data = &bf5xx_nand_platform,
427 },
428};
429#endif
430
431#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
Mike Frysinger8d8921a2009-01-07 23:14:39 +0800432static struct bfin_sd_host bfin_sdh_data = {
433 .dma_chan = CH_SDH,
434 .irq_int0 = IRQ_SDH_MASK0,
435 .pin_req = {P_SD_D0, P_SD_D1, P_SD_D2, P_SD_D3, P_SD_CLK, P_SD_CMD, 0},
436};
437
Michael Hennerichdb682542008-04-24 03:18:59 +0800438static struct platform_device bf54x_sdh_device = {
439 .name = "bfin-sdh",
440 .id = 0,
Mike Frysinger8d8921a2009-01-07 23:14:39 +0800441 .dev = {
442 .platform_data = &bfin_sdh_data,
443 },
Michael Hennerichdb682542008-04-24 03:18:59 +0800444};
445#endif
446
Mike Frysinger2de73e72008-11-18 17:48:22 +0800447#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
448static struct mtd_partition para_partitions[] = {
449 {
450 .name = "bootloader(nor)",
451 .size = 0x40000,
452 .offset = 0,
453 }, {
454 .name = "linux kernel(nor)",
Harald Krapfenbauer9c214532009-09-10 15:30:03 +0000455 .size = 0x100000,
Mike Frysinger2de73e72008-11-18 17:48:22 +0800456 .offset = MTDPART_OFS_APPEND,
457 }, {
458 .name = "file system(nor)",
459 .size = MTDPART_SIZ_FULL,
460 .offset = MTDPART_OFS_APPEND,
461 }
462};
463
464static struct physmap_flash_data para_flash_data = {
465 .width = 2,
466 .parts = para_partitions,
467 .nr_parts = ARRAY_SIZE(para_partitions),
468};
469
470static struct resource para_flash_resource = {
471 .start = 0x20000000,
472 .end = 0x207fffff,
473 .flags = IORESOURCE_MEM,
474};
475
476static struct platform_device para_flash_device = {
477 .name = "physmap-flash",
478 .id = 0,
479 .dev = {
480 .platform_data = &para_flash_data,
481 },
482 .num_resources = 1,
483 .resource = &para_flash_resource,
484};
485#endif
486
Michael Hennerichdb682542008-04-24 03:18:59 +0800487#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
488/* all SPI peripherals info goes here */
489#if defined(CONFIG_MTD_M25P80) \
490 || defined(CONFIG_MTD_M25P80_MODULE)
491/* SPI flash chip (m25p16) */
492static struct mtd_partition bfin_spi_flash_partitions[] = {
493 {
Robin Getzaa582972008-08-05 17:47:29 +0800494 .name = "bootloader(spi)",
Michael Hennerichdb682542008-04-24 03:18:59 +0800495 .size = 0x00040000,
496 .offset = 0,
497 .mask_flags = MTD_CAP_ROM
498 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800499 .name = "linux kernel(spi)",
Michael Hennerichdb682542008-04-24 03:18:59 +0800500 .size = 0x1c0000,
501 .offset = 0x40000
502 }
503};
504
505static struct flash_platform_data bfin_spi_flash_data = {
506 .name = "m25p80",
507 .parts = bfin_spi_flash_partitions,
508 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
509 .type = "m25p16",
510};
511
512static struct bfin5xx_spi_chip spi_flash_chip_info = {
513 .enable_dma = 0, /* use dma transfer with this chip*/
514 .bits_per_word = 8,
Michael Hennerichdb682542008-04-24 03:18:59 +0800515};
516#endif
517
518#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
519static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
Michael Hennerichdb682542008-04-24 03:18:59 +0800520 .enable_dma = 0,
521 .bits_per_word = 16,
522};
523
524static const struct ad7877_platform_data bfin_ad7877_ts_info = {
525 .model = 7877,
526 .vref_delay_usecs = 50, /* internal, no capacitor */
527 .x_plate_ohms = 419,
528 .y_plate_ohms = 486,
529 .pressure_max = 1000,
530 .pressure_min = 0,
531 .stopacq_polarity = 1,
532 .first_conversion_delay = 3,
533 .acquisition_time = 1,
534 .averaging = 1,
535 .pen_down_acc_interval = 1,
536};
537#endif
538
539#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
540static struct bfin5xx_spi_chip spidev_chip_info = {
541 .enable_dma = 0,
542 .bits_per_word = 8,
543};
544#endif
545
546static struct spi_board_info bf54x_spi_board_info[] __initdata = {
547#if defined(CONFIG_MTD_M25P80) \
548 || defined(CONFIG_MTD_M25P80_MODULE)
549 {
550 /* the modalias must be the same as spi device driver name */
551 .modalias = "m25p80", /* Name of spi_driver for this device */
552 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
553 .bus_num = 0, /* Framework bus number */
554 .chip_select = 1, /* SPI_SSEL1*/
555 .platform_data = &bfin_spi_flash_data,
556 .controller_data = &spi_flash_chip_info,
557 .mode = SPI_MODE_3,
558 },
559#endif
560#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
561{
562 .modalias = "ad7877",
563 .platform_data = &bfin_ad7877_ts_info,
564 .irq = IRQ_PJ11,
565 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
566 .bus_num = 0,
567 .chip_select = 2,
568 .controller_data = &spi_ad7877_chip_info,
569},
570#endif
571#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
572 {
573 .modalias = "spidev",
574 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
575 .bus_num = 0,
576 .chip_select = 1,
577 .controller_data = &spidev_chip_info,
578 },
579#endif
580};
581
582/* SPI (0) */
583static struct resource bfin_spi0_resource[] = {
584 [0] = {
585 .start = SPI0_REGBASE,
586 .end = SPI0_REGBASE + 0xFF,
587 .flags = IORESOURCE_MEM,
588 },
589 [1] = {
590 .start = CH_SPI0,
591 .end = CH_SPI0,
Yi Li53122692009-06-05 12:11:11 +0000592 .flags = IORESOURCE_DMA,
593 },
594 [2] = {
595 .start = IRQ_SPI0,
596 .end = IRQ_SPI0,
Michael Hennerichdb682542008-04-24 03:18:59 +0800597 .flags = IORESOURCE_IRQ,
598 }
599};
600
601/* SPI (1) */
602static struct resource bfin_spi1_resource[] = {
603 [0] = {
604 .start = SPI1_REGBASE,
605 .end = SPI1_REGBASE + 0xFF,
606 .flags = IORESOURCE_MEM,
607 },
608 [1] = {
609 .start = CH_SPI1,
610 .end = CH_SPI1,
Yi Li53122692009-06-05 12:11:11 +0000611 .flags = IORESOURCE_DMA,
612 },
613 [2] = {
614 .start = IRQ_SPI1,
615 .end = IRQ_SPI1,
Michael Hennerichdb682542008-04-24 03:18:59 +0800616 .flags = IORESOURCE_IRQ,
617 }
618};
619
620/* SPI controller data */
621static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
Yi Li4e4d4962009-08-30 20:45:50 +0000622 .num_chipselect = 3,
Michael Hennerichdb682542008-04-24 03:18:59 +0800623 .enable_dma = 1, /* master has the ability to do dma transfer */
624 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
625};
626
627static struct platform_device bf54x_spi_master0 = {
628 .name = "bfin-spi",
629 .id = 0, /* Bus number */
630 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
631 .resource = bfin_spi0_resource,
632 .dev = {
633 .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
634 },
635};
636
637static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
Yi Li4e4d4962009-08-30 20:45:50 +0000638 .num_chipselect = 3,
Michael Hennerichdb682542008-04-24 03:18:59 +0800639 .enable_dma = 1, /* master has the ability to do dma transfer */
640 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
641};
642
643static struct platform_device bf54x_spi_master1 = {
644 .name = "bfin-spi",
645 .id = 1, /* Bus number */
646 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
647 .resource = bfin_spi1_resource,
648 .dev = {
649 .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
650 },
651};
652#endif /* spi master and devices */
653
654#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
655static struct resource bfin_twi0_resource[] = {
656 [0] = {
657 .start = TWI0_REGBASE,
658 .end = TWI0_REGBASE + 0xFF,
659 .flags = IORESOURCE_MEM,
660 },
661 [1] = {
662 .start = IRQ_TWI0,
663 .end = IRQ_TWI0,
664 .flags = IORESOURCE_IRQ,
665 },
666};
667
668static struct platform_device i2c_bfin_twi0_device = {
669 .name = "i2c-bfin-twi",
670 .id = 0,
671 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
672 .resource = bfin_twi0_resource,
673};
674
675#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
676static struct resource bfin_twi1_resource[] = {
677 [0] = {
678 .start = TWI1_REGBASE,
679 .end = TWI1_REGBASE + 0xFF,
680 .flags = IORESOURCE_MEM,
681 },
682 [1] = {
683 .start = IRQ_TWI1,
684 .end = IRQ_TWI1,
685 .flags = IORESOURCE_IRQ,
686 },
687};
688
689static struct platform_device i2c_bfin_twi1_device = {
690 .name = "i2c-bfin-twi",
691 .id = 1,
692 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
693 .resource = bfin_twi1_resource,
694};
695#endif
696#endif
697
698#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
699#include <linux/gpio_keys.h>
700
701static struct gpio_keys_button bfin_gpio_keys_table[] = {
702 {BTN_0, GPIO_PH7, 1, "gpio-keys: BTN0"},
703};
704
705static struct gpio_keys_platform_data bfin_gpio_keys_data = {
706 .buttons = bfin_gpio_keys_table,
707 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
708};
709
710static struct platform_device bfin_device_gpiokeys = {
711 .name = "gpio-keys",
712 .dev = {
713 .platform_data = &bfin_gpio_keys_data,
714 },
715};
716#endif
717
Michael Hennerich14b03202008-05-07 11:41:26 +0800718static const unsigned int cclk_vlev_datasheet[] =
719{
720/*
721 * Internal VLEV BF54XSBBC1533
722 ****temporarily using these values until data sheet is updated
723 */
724 VRPAIR(VLEV_085, 150000000),
725 VRPAIR(VLEV_090, 250000000),
726 VRPAIR(VLEV_110, 276000000),
727 VRPAIR(VLEV_115, 301000000),
728 VRPAIR(VLEV_120, 525000000),
729 VRPAIR(VLEV_125, 550000000),
730 VRPAIR(VLEV_130, 600000000),
731};
732
733static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
734 .tuple_tab = cclk_vlev_datasheet,
735 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
736 .vr_settling_time = 25 /* us */,
737};
738
739static struct platform_device bfin_dpmc = {
740 .name = "bfin dpmc",
741 .dev = {
742 .platform_data = &bfin_dmpc_vreg_data,
743 },
744};
745
Michael Hennerichdb682542008-04-24 03:18:59 +0800746static struct platform_device *cm_bf548_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +0800747
748 &bfin_dpmc,
749
Michael Hennerichdb682542008-04-24 03:18:59 +0800750#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
751 &rtc_device,
752#endif
753
754#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
755 &bfin_uart_device,
756#endif
757
Graf Yang5be36d22008-04-25 03:09:15 +0800758#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang42bd8bc2009-01-07 23:14:39 +0800759#ifdef CONFIG_BFIN_SIR0
760 &bfin_sir0_device,
761#endif
762#ifdef CONFIG_BFIN_SIR1
763 &bfin_sir1_device,
764#endif
765#ifdef CONFIG_BFIN_SIR2
766 &bfin_sir2_device,
767#endif
768#ifdef CONFIG_BFIN_SIR3
769 &bfin_sir3_device,
770#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800771#endif
772
Michael Hennerichdb682542008-04-24 03:18:59 +0800773#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
774 &bf54x_lq043_device,
775#endif
776
777#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
778 &smsc911x_device,
779#endif
780
781#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
782 &musb_device,
783#endif
784
785#if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
786 &bfin_atapi_device,
787#endif
788
789#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
790 &bf5xx_nand_device,
791#endif
792
793#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
794 &bf54x_sdh_device,
795#endif
796
797#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
798 &bf54x_spi_master0,
799 &bf54x_spi_master1,
800#endif
801
802#if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
803 &bf54x_kpad_device,
804#endif
805
806#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
Mike Frysinger10a88a22008-11-18 17:48:22 +0800807 &i2c_bfin_twi0_device,
Michael Hennerichdb682542008-04-24 03:18:59 +0800808#if !defined(CONFIG_BF542)
809 &i2c_bfin_twi1_device,
810#endif
811#endif
812
813#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
814 &bfin_device_gpiokeys,
815#endif
Mike Frysinger2de73e72008-11-18 17:48:22 +0800816
817#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
818 &para_flash_device,
819#endif
Michael Hennerichdb682542008-04-24 03:18:59 +0800820};
821
822static int __init cm_bf548_init(void)
823{
Michael Hennerichf086f232008-05-20 16:42:39 +0800824 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Michael Hennerichdb682542008-04-24 03:18:59 +0800825 platform_add_devices(cm_bf548_devices, ARRAY_SIZE(cm_bf548_devices));
826
827#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
828 spi_register_board_info(bf54x_spi_board_info,
829 ARRAY_SIZE(bf54x_spi_board_info));
830#endif
831
832 return 0;
833}
834
835arch_initcall(cm_bf548_init);