blob: 231dfbd3bc1ffcefc1a9c11b94ad885ab1d376d3 [file] [log] [blame]
Roy Huang24a07a12007-07-12 22:41:45 +08001/*
2 * File: arch/blackfin/mach-bf548/boards/ezkit.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-2007 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 Frysingerde8c43f2008-01-24 17:14:04 +080035#include <linux/mtd/physmap.h>
Roy Huang24a07a12007-07-12 22:41:45 +080036#include <linux/spi/spi.h>
37#include <linux/spi/flash.h>
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080038#include <linux/irq.h>
Bryan Wu81d9c7f2008-03-26 10:02:13 +080039#include <linux/i2c.h>
Roy Huang24a07a12007-07-12 22:41:45 +080040#include <linux/interrupt.h>
Mike Frysinger67f2d332008-02-09 01:49:23 +080041#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080042#include <linux/usb/musb.h>
Mike Frysinger67f2d332008-02-09 01:49:23 +080043#endif
Roy Huang24a07a12007-07-12 22:41:45 +080044#include <asm/bfin5xx_spi.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080045#include <asm/cplb.h>
46#include <asm/dma.h>
47#include <asm/gpio.h>
48#include <asm/nand.h>
Bryan Wu5d448dd2007-11-12 23:24:42 +080049#include <asm/portmux.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080050#include <asm/mach/bf54x_keys.h>
51#include <linux/input.h>
52#include <linux/spi/ad7877.h>
Roy Huang24a07a12007-07-12 22:41:45 +080053
54/*
55 * Name the Board for the /proc/cpuinfo
56 */
Mike Frysinger066954a2007-10-21 22:36:06 +080057const char bfin_board_name[] = "ADSP-BF548-EZKIT";
Roy Huang24a07a12007-07-12 22:41:45 +080058
59/*
60 * Driver needs to know address, irq and flag pin.
61 */
62
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080063#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
64
65#include <asm/mach/bf54x-lq043.h>
66
67static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
68 .width = 480,
69 .height = 272,
70 .xres = {480, 480, 480},
71 .yres = {272, 272, 272},
72 .bpp = {24, 24, 24},
73 .disp = GPIO_PE3,
74};
75
76static struct resource bf54x_lq043_resources[] = {
77 {
78 .start = IRQ_EPPI0_ERR,
79 .end = IRQ_EPPI0_ERR,
80 .flags = IORESOURCE_IRQ,
81 },
82};
83
84static struct platform_device bf54x_lq043_device = {
85 .name = "bf54x-lq043",
86 .id = -1,
87 .num_resources = ARRAY_SIZE(bf54x_lq043_resources),
88 .resource = bf54x_lq043_resources,
89 .dev = {
90 .platform_data = &bf54x_lq043_data,
91 },
92};
93#endif
94
95#if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
Michael Hennerich8f740ef2007-10-13 00:36:46 -040096static const unsigned int bf548_keymap[] = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080097 KEYVAL(0, 0, KEY_ENTER),
98 KEYVAL(0, 1, KEY_HELP),
99 KEYVAL(0, 2, KEY_0),
100 KEYVAL(0, 3, KEY_BACKSPACE),
101 KEYVAL(1, 0, KEY_TAB),
102 KEYVAL(1, 1, KEY_9),
103 KEYVAL(1, 2, KEY_8),
104 KEYVAL(1, 3, KEY_7),
105 KEYVAL(2, 0, KEY_DOWN),
106 KEYVAL(2, 1, KEY_6),
107 KEYVAL(2, 2, KEY_5),
108 KEYVAL(2, 3, KEY_4),
109 KEYVAL(3, 0, KEY_UP),
110 KEYVAL(3, 1, KEY_3),
111 KEYVAL(3, 2, KEY_2),
112 KEYVAL(3, 3, KEY_1),
113};
114
115static struct bfin_kpad_platform_data bf54x_kpad_data = {
116 .rows = 4,
117 .cols = 4,
Michael Hennerich8f740ef2007-10-13 00:36:46 -0400118 .keymap = bf548_keymap,
119 .keymapsize = ARRAY_SIZE(bf548_keymap),
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800120 .repeat = 0,
121 .debounce_time = 5000, /* ns (5ms) */
122 .coldrive_time = 1000, /* ns (1ms) */
123 .keyup_test_interval = 50, /* ms (50ms) */
124};
125
126static struct resource bf54x_kpad_resources[] = {
127 {
128 .start = IRQ_KEY,
129 .end = IRQ_KEY,
130 .flags = IORESOURCE_IRQ,
131 },
132};
133
134static struct platform_device bf54x_kpad_device = {
135 .name = "bf54x-keys",
136 .id = -1,
137 .num_resources = ARRAY_SIZE(bf54x_kpad_resources),
138 .resource = bf54x_kpad_resources,
139 .dev = {
140 .platform_data = &bf54x_kpad_data,
141 },
142};
143#endif
144
Roy Huang24a07a12007-07-12 22:41:45 +0800145#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
146static struct platform_device rtc_device = {
147 .name = "rtc-bfin",
148 .id = -1,
149};
150#endif
151
152#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
153static struct resource bfin_uart_resources[] = {
154#ifdef CONFIG_SERIAL_BFIN_UART0
155 {
156 .start = 0xFFC00400,
157 .end = 0xFFC004FF,
158 .flags = IORESOURCE_MEM,
159 },
160#endif
161#ifdef CONFIG_SERIAL_BFIN_UART1
162 {
163 .start = 0xFFC02000,
164 .end = 0xFFC020FF,
165 .flags = IORESOURCE_MEM,
166 },
167#endif
168#ifdef CONFIG_SERIAL_BFIN_UART2
169 {
170 .start = 0xFFC02100,
171 .end = 0xFFC021FF,
172 .flags = IORESOURCE_MEM,
173 },
174#endif
175#ifdef CONFIG_SERIAL_BFIN_UART3
176 {
177 .start = 0xFFC03100,
178 .end = 0xFFC031FF,
179 },
180#endif
181};
182
183static struct platform_device bfin_uart_device = {
184 .name = "bfin-uart",
185 .id = 1,
186 .num_resources = ARRAY_SIZE(bfin_uart_resources),
187 .resource = bfin_uart_resources,
188};
189#endif
190
Graf Yang5be36d22008-04-25 03:09:15 +0800191#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
192static struct resource bfin_sir_resources[] = {
193#ifdef CONFIG_BFIN_SIR0
194 {
195 .start = 0xFFC00400,
196 .end = 0xFFC004FF,
197 .flags = IORESOURCE_MEM,
198 },
199#endif
200#ifdef CONFIG_BFIN_SIR1
201 {
202 .start = 0xFFC02000,
203 .end = 0xFFC020FF,
204 .flags = IORESOURCE_MEM,
205 },
206#endif
207#ifdef CONFIG_BFIN_SIR2
208 {
209 .start = 0xFFC02100,
210 .end = 0xFFC021FF,
211 .flags = IORESOURCE_MEM,
212 },
213#endif
214#ifdef CONFIG_BFIN_SIR3
215 {
216 .start = 0xFFC03100,
217 .end = 0xFFC031FF,
218 .flags = IORESOURCE_MEM,
219 },
220#endif
221};
222
223static struct platform_device bfin_sir_device = {
224 .name = "bfin_sir",
225 .id = 0,
226 .num_resources = ARRAY_SIZE(bfin_sir_resources),
227 .resource = bfin_sir_resources,
228};
229#endif
230
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800231#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
232static struct resource smsc911x_resources[] = {
233 {
234 .name = "smsc911x-memory",
235 .start = 0x24000000,
236 .end = 0x24000000 + 0xFF,
237 .flags = IORESOURCE_MEM,
238 },
239 {
240 .start = IRQ_PE8,
241 .end = IRQ_PE8,
242 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
243 },
244};
245static struct platform_device smsc911x_device = {
246 .name = "smsc911x",
247 .id = 0,
248 .num_resources = ARRAY_SIZE(smsc911x_resources),
249 .resource = smsc911x_resources,
250};
251#endif
252
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800253#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
254static struct resource musb_resources[] = {
255 [0] = {
256 .start = 0xFFC03C00,
257 .end = 0xFFC040FF,
258 .flags = IORESOURCE_MEM,
259 },
260 [1] = { /* general IRQ */
261 .start = IRQ_USB_INT0,
262 .end = IRQ_USB_INT0,
263 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
264 },
265 [2] = { /* DMA IRQ */
266 .start = IRQ_USB_DMA,
267 .end = IRQ_USB_DMA,
268 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
269 },
270};
271
272static struct musb_hdrc_platform_data musb_plat = {
Bryan Wu29350772007-12-24 12:20:19 +0800273#if defined(CONFIG_USB_MUSB_OTG)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800274 .mode = MUSB_OTG,
Bryan Wu29350772007-12-24 12:20:19 +0800275#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800276 .mode = MUSB_HOST,
Bryan Wu29350772007-12-24 12:20:19 +0800277#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800278 .mode = MUSB_PERIPHERAL,
279#endif
Bryan Wu29350772007-12-24 12:20:19 +0800280 .multipoint = 0,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800281};
282
283static u64 musb_dmamask = ~(u32)0;
284
285static struct platform_device musb_device = {
286 .name = "musb_hdrc",
287 .id = 0,
288 .dev = {
289 .dma_mask = &musb_dmamask,
290 .coherent_dma_mask = 0xffffffff,
291 .platform_data = &musb_plat,
292 },
293 .num_resources = ARRAY_SIZE(musb_resources),
294 .resource = musb_resources,
295};
296#endif
297
298#if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
299static struct resource bfin_atapi_resources[] = {
300 {
301 .start = 0xFFC03800,
302 .end = 0xFFC0386F,
303 .flags = IORESOURCE_MEM,
304 },
305 {
306 .start = IRQ_ATAPI_ERR,
307 .end = IRQ_ATAPI_ERR,
308 .flags = IORESOURCE_IRQ,
309 },
310};
311
312static struct platform_device bfin_atapi_device = {
313 .name = "pata-bf54x",
314 .id = -1,
315 .num_resources = ARRAY_SIZE(bfin_atapi_resources),
316 .resource = bfin_atapi_resources,
317};
318#endif
319
320#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
321static struct mtd_partition partition_info[] = {
322 {
323 .name = "Linux Kernel",
324 .offset = 0,
325 .size = 4 * SIZE_1M,
326 },
327 {
328 .name = "File System",
Mike Frysingeredf05642008-02-25 11:38:11 +0800329 .offset = MTDPART_OFS_APPEND,
330 .size = MTDPART_SIZ_FULL,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800331 },
332};
333
334static struct bf5xx_nand_platform bf5xx_nand_platform = {
335 .page_size = NFC_PG_SIZE_256,
336 .data_width = NFC_NWIDTH_8,
337 .partitions = partition_info,
338 .nr_partitions = ARRAY_SIZE(partition_info),
339 .rd_dly = 3,
340 .wr_dly = 3,
341};
342
343static struct resource bf5xx_nand_resources[] = {
344 {
345 .start = 0xFFC03B00,
346 .end = 0xFFC03B4F,
347 .flags = IORESOURCE_MEM,
348 },
349 {
350 .start = CH_NFC,
351 .end = CH_NFC,
352 .flags = IORESOURCE_IRQ,
353 },
354};
355
356static struct platform_device bf5xx_nand_device = {
357 .name = "bf5xx-nand",
358 .id = 0,
359 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
360 .resource = bf5xx_nand_resources,
361 .dev = {
362 .platform_data = &bf5xx_nand_platform,
363 },
364};
365#endif
366
Michael Hennerich3d7e6cf2008-03-03 17:40:28 -0700367#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800368static struct platform_device bf54x_sdh_device = {
369 .name = "bfin-sdh",
370 .id = 0,
371};
372#endif
373
Mike Frysinger793dc272008-03-26 08:09:12 +0800374#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800375static struct mtd_partition ezkit_partitions[] = {
376 {
377 .name = "Bootloader",
Mike Frysingeredf05642008-02-25 11:38:11 +0800378 .size = 0x40000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800379 .offset = 0,
380 }, {
381 .name = "Kernel",
Grace Panac76d882008-04-24 06:33:56 +0800382 .size = 0x1C0000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800383 .offset = MTDPART_OFS_APPEND,
384 }, {
385 .name = "RootFS",
386 .size = MTDPART_SIZ_FULL,
387 .offset = MTDPART_OFS_APPEND,
388 }
389};
390
391static struct physmap_flash_data ezkit_flash_data = {
392 .width = 2,
393 .parts = ezkit_partitions,
394 .nr_parts = ARRAY_SIZE(ezkit_partitions),
395};
396
397static struct resource ezkit_flash_resource = {
398 .start = 0x20000000,
399 .end = 0x20ffffff,
400 .flags = IORESOURCE_MEM,
401};
402
403static struct platform_device ezkit_flash_device = {
404 .name = "physmap-flash",
405 .id = 0,
406 .dev = {
407 .platform_data = &ezkit_flash_data,
408 },
409 .num_resources = 1,
410 .resource = &ezkit_flash_resource,
411};
Mike Frysinger793dc272008-03-26 08:09:12 +0800412#endif
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800413
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800414#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
415/* all SPI peripherals info goes here */
416#if defined(CONFIG_MTD_M25P80) \
417 || defined(CONFIG_MTD_M25P80_MODULE)
418/* SPI flash chip (m25p16) */
419static struct mtd_partition bfin_spi_flash_partitions[] = {
420 {
421 .name = "bootloader",
422 .size = 0x00040000,
423 .offset = 0,
424 .mask_flags = MTD_CAP_ROM
425 }, {
426 .name = "linux kernel",
Mike Frysingeredf05642008-02-25 11:38:11 +0800427 .size = MTDPART_SIZ_FULL,
428 .offset = MTDPART_OFS_APPEND,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800429 }
430};
431
432static struct flash_platform_data bfin_spi_flash_data = {
433 .name = "m25p80",
434 .parts = bfin_spi_flash_partitions,
435 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
436 .type = "m25p16",
437};
438
439static struct bfin5xx_spi_chip spi_flash_chip_info = {
440 .enable_dma = 0, /* use dma transfer with this chip*/
441 .bits_per_word = 8,
442 .cs_change_per_word = 0,
443};
444#endif
445
Bernd Schmidt37fa2422008-04-24 05:19:02 +0800446#if defined(CONFIG_SND_BLACKFIN_AD1836) \
447 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
448static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
449 .enable_dma = 0,
450 .bits_per_word = 16,
451};
452#endif
453
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800454#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
455static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
Michael Hennerichc7d48962007-11-15 21:33:31 +0800456 .cs_change_per_word = 0,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800457 .enable_dma = 0,
458 .bits_per_word = 16,
459};
460
461static const struct ad7877_platform_data bfin_ad7877_ts_info = {
462 .model = 7877,
463 .vref_delay_usecs = 50, /* internal, no capacitor */
464 .x_plate_ohms = 419,
465 .y_plate_ohms = 486,
466 .pressure_max = 1000,
467 .pressure_min = 0,
468 .stopacq_polarity = 1,
469 .first_conversion_delay = 3,
470 .acquisition_time = 1,
471 .averaging = 1,
472 .pen_down_acc_interval = 1,
473};
474#endif
475
Michael Hennerich6e668932008-02-09 01:54:09 +0800476#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
477static struct bfin5xx_spi_chip spidev_chip_info = {
478 .enable_dma = 0,
479 .bits_per_word = 8,
480};
481#endif
482
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800483static struct spi_board_info bf54x_spi_board_info[] __initdata = {
484#if defined(CONFIG_MTD_M25P80) \
485 || defined(CONFIG_MTD_M25P80_MODULE)
486 {
487 /* the modalias must be the same as spi device driver name */
488 .modalias = "m25p80", /* Name of spi_driver for this device */
489 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
490 .bus_num = 0, /* Framework bus number */
491 .chip_select = 1, /* SPI_SSEL1*/
492 .platform_data = &bfin_spi_flash_data,
493 .controller_data = &spi_flash_chip_info,
494 .mode = SPI_MODE_3,
495 },
496#endif
Bernd Schmidt37fa2422008-04-24 05:19:02 +0800497#if defined(CONFIG_SND_BLACKFIN_AD1836) \
498 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
499 {
500 .modalias = "ad1836-spi",
501 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
502 .bus_num = 1,
503 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
504 .controller_data = &ad1836_spi_chip_info,
505 },
506#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800507#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
508{
509 .modalias = "ad7877",
510 .platform_data = &bfin_ad7877_ts_info,
511 .irq = IRQ_PJ11,
512 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
513 .bus_num = 0,
514 .chip_select = 2,
515 .controller_data = &spi_ad7877_chip_info,
516},
517#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800518#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
519 {
520 .modalias = "spidev",
521 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
522 .bus_num = 0,
523 .chip_select = 1,
524 .controller_data = &spidev_chip_info,
525 },
526#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800527};
528
529/* SPI (0) */
530static struct resource bfin_spi0_resource[] = {
531 [0] = {
532 .start = SPI0_REGBASE,
533 .end = SPI0_REGBASE + 0xFF,
534 .flags = IORESOURCE_MEM,
535 },
536 [1] = {
537 .start = CH_SPI0,
538 .end = CH_SPI0,
539 .flags = IORESOURCE_IRQ,
540 }
541};
542
543/* SPI (1) */
544static struct resource bfin_spi1_resource[] = {
545 [0] = {
546 .start = SPI1_REGBASE,
547 .end = SPI1_REGBASE + 0xFF,
548 .flags = IORESOURCE_MEM,
549 },
550 [1] = {
551 .start = CH_SPI1,
552 .end = CH_SPI1,
553 .flags = IORESOURCE_IRQ,
554 }
555};
556
557/* SPI controller data */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800558static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800559 .num_chipselect = 8,
560 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800561 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800562};
563
564static struct platform_device bf54x_spi_master0 = {
565 .name = "bfin-spi",
566 .id = 0, /* Bus number */
567 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
568 .resource = bfin_spi0_resource,
569 .dev = {
Bryan Wu5d448dd2007-11-12 23:24:42 +0800570 .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800571 },
572};
573
Bryan Wu5d448dd2007-11-12 23:24:42 +0800574static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
575 .num_chipselect = 8,
576 .enable_dma = 1, /* master has the ability to do dma transfer */
577 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
578};
579
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800580static struct platform_device bf54x_spi_master1 = {
581 .name = "bfin-spi",
582 .id = 1, /* Bus number */
583 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
584 .resource = bfin_spi1_resource,
585 .dev = {
Bryan Wu5d448dd2007-11-12 23:24:42 +0800586 .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800587 },
588};
589#endif /* spi master and devices */
590
591#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
592static struct resource bfin_twi0_resource[] = {
593 [0] = {
594 .start = TWI0_REGBASE,
595 .end = TWI0_REGBASE + 0xFF,
596 .flags = IORESOURCE_MEM,
597 },
598 [1] = {
599 .start = IRQ_TWI0,
600 .end = IRQ_TWI0,
601 .flags = IORESOURCE_IRQ,
602 },
603};
604
605static struct platform_device i2c_bfin_twi0_device = {
606 .name = "i2c-bfin-twi",
607 .id = 0,
608 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
609 .resource = bfin_twi0_resource,
610};
611
Mike Frysinger7160e952007-11-21 16:03:07 +0800612#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800613static struct resource bfin_twi1_resource[] = {
614 [0] = {
615 .start = TWI1_REGBASE,
616 .end = TWI1_REGBASE + 0xFF,
617 .flags = IORESOURCE_MEM,
618 },
619 [1] = {
620 .start = IRQ_TWI1,
621 .end = IRQ_TWI1,
622 .flags = IORESOURCE_IRQ,
623 },
624};
625
626static struct platform_device i2c_bfin_twi1_device = {
627 .name = "i2c-bfin-twi",
628 .id = 1,
629 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
630 .resource = bfin_twi1_resource,
631};
632#endif
Mike Frysinger7160e952007-11-21 16:03:07 +0800633#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800634
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800635#ifdef CONFIG_I2C_BOARDINFO
636static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
637};
638
639#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
640static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
641#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
642 {
643 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
644 .type = "pcf8574_lcd",
645 },
646#endif
647#if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
648 {
649 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
650 .type = "pcf8574_keypad",
651 .irq = 212,
652 },
653#endif
654};
655#endif
656#endif
657
Michael Hennerich2463ef22008-01-27 16:49:48 +0800658#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
659#include <linux/gpio_keys.h>
660
661static struct gpio_keys_button bfin_gpio_keys_table[] = {
662 {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
663 {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
664 {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
665 {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
666};
667
668static struct gpio_keys_platform_data bfin_gpio_keys_data = {
669 .buttons = bfin_gpio_keys_table,
670 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
671};
672
673static struct platform_device bfin_device_gpiokeys = {
674 .name = "gpio-keys",
675 .dev = {
676 .platform_data = &bfin_gpio_keys_data,
677 },
678};
679#endif
680
Mike Frysingercad2ab62008-02-22 17:01:31 +0800681static struct resource bfin_gpios_resources = {
682 .start = 0,
683 .end = MAX_BLACKFIN_GPIOS - 1,
684 .flags = IORESOURCE_IRQ,
685};
686
687static struct platform_device bfin_gpios_device = {
688 .name = "simple-gpio",
689 .id = -1,
690 .num_resources = 1,
691 .resource = &bfin_gpios_resources,
692};
693
Roy Huang24a07a12007-07-12 22:41:45 +0800694static struct platform_device *ezkit_devices[] __initdata = {
695#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
696 &rtc_device,
697#endif
698
699#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
700 &bfin_uart_device,
701#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800702
Graf Yang5be36d22008-04-25 03:09:15 +0800703#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
704 &bfin_sir_device,
705#endif
706
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800707#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
708 &bf54x_lq043_device,
709#endif
710
711#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
712 &smsc911x_device,
713#endif
714
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800715#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
716 &musb_device,
717#endif
718
719#if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
720 &bfin_atapi_device,
721#endif
722
723#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
724 &bf5xx_nand_device,
725#endif
726
Michael Hennerich3d7e6cf2008-03-03 17:40:28 -0700727#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800728 &bf54x_sdh_device,
729#endif
730
731#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
732 &bf54x_spi_master0,
Bryan Wud4b1d272007-10-21 17:03:55 +0800733 &bf54x_spi_master1,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800734#endif
735
736#if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
737 &bf54x_kpad_device,
738#endif
739
740#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
741 &i2c_bfin_twi0_device,
Mike Frysinger7160e952007-11-21 16:03:07 +0800742#if !defined(CONFIG_BF542)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800743 &i2c_bfin_twi1_device,
744#endif
Mike Frysinger7160e952007-11-21 16:03:07 +0800745#endif
Michael Hennerich2463ef22008-01-27 16:49:48 +0800746
747#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
748 &bfin_device_gpiokeys,
749#endif
Mike Frysingercad2ab62008-02-22 17:01:31 +0800750
751 &bfin_gpios_device,
Mike Frysinger793dc272008-03-26 08:09:12 +0800752
753#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800754 &ezkit_flash_device,
Mike Frysinger793dc272008-03-26 08:09:12 +0800755#endif
Roy Huang24a07a12007-07-12 22:41:45 +0800756};
757
Mike Frysingera01d7a72008-02-02 15:34:56 +0800758static int __init ezkit_init(void)
Roy Huang24a07a12007-07-12 22:41:45 +0800759{
Harvey Harrisonb85d8582008-04-23 09:39:01 +0800760 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800761
762#ifdef CONFIG_I2C_BOARDINFO
763 i2c_register_board_info(0, bfin_i2c_board_info0,
764 ARRAY_SIZE(bfin_i2c_board_info0));
765#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
766 i2c_register_board_info(1, bfin_i2c_board_info1,
767 ARRAY_SIZE(bfin_i2c_board_info1));
768#endif
769#endif
770
Roy Huang24a07a12007-07-12 22:41:45 +0800771 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800772
773#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
774 spi_register_board_info(bf54x_spi_board_info,
775 ARRAY_SIZE(bf54x_spi_board_info));
776#endif
777
Roy Huang24a07a12007-07-12 22:41:45 +0800778 return 0;
779}
780
Mike Frysingera01d7a72008-02-02 15:34:56 +0800781arch_initcall(ezkit_init);