blob: 04c0c8df6e965f9ea5ffe17b6021d0ab6814385f [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
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800191#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
192static struct resource smsc911x_resources[] = {
193 {
194 .name = "smsc911x-memory",
195 .start = 0x24000000,
196 .end = 0x24000000 + 0xFF,
197 .flags = IORESOURCE_MEM,
198 },
199 {
200 .start = IRQ_PE8,
201 .end = IRQ_PE8,
202 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
203 },
204};
205static struct platform_device smsc911x_device = {
206 .name = "smsc911x",
207 .id = 0,
208 .num_resources = ARRAY_SIZE(smsc911x_resources),
209 .resource = smsc911x_resources,
210};
211#endif
212
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800213#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
214static struct resource musb_resources[] = {
215 [0] = {
216 .start = 0xFFC03C00,
217 .end = 0xFFC040FF,
218 .flags = IORESOURCE_MEM,
219 },
220 [1] = { /* general IRQ */
221 .start = IRQ_USB_INT0,
222 .end = IRQ_USB_INT0,
223 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
224 },
225 [2] = { /* DMA IRQ */
226 .start = IRQ_USB_DMA,
227 .end = IRQ_USB_DMA,
228 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
229 },
230};
231
232static struct musb_hdrc_platform_data musb_plat = {
Bryan Wu29350772007-12-24 12:20:19 +0800233#if defined(CONFIG_USB_MUSB_OTG)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800234 .mode = MUSB_OTG,
Bryan Wu29350772007-12-24 12:20:19 +0800235#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800236 .mode = MUSB_HOST,
Bryan Wu29350772007-12-24 12:20:19 +0800237#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800238 .mode = MUSB_PERIPHERAL,
239#endif
Bryan Wu29350772007-12-24 12:20:19 +0800240 .multipoint = 0,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800241};
242
243static u64 musb_dmamask = ~(u32)0;
244
245static struct platform_device musb_device = {
246 .name = "musb_hdrc",
247 .id = 0,
248 .dev = {
249 .dma_mask = &musb_dmamask,
250 .coherent_dma_mask = 0xffffffff,
251 .platform_data = &musb_plat,
252 },
253 .num_resources = ARRAY_SIZE(musb_resources),
254 .resource = musb_resources,
255};
256#endif
257
258#if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
259static struct resource bfin_atapi_resources[] = {
260 {
261 .start = 0xFFC03800,
262 .end = 0xFFC0386F,
263 .flags = IORESOURCE_MEM,
264 },
265 {
266 .start = IRQ_ATAPI_ERR,
267 .end = IRQ_ATAPI_ERR,
268 .flags = IORESOURCE_IRQ,
269 },
270};
271
272static struct platform_device bfin_atapi_device = {
273 .name = "pata-bf54x",
274 .id = -1,
275 .num_resources = ARRAY_SIZE(bfin_atapi_resources),
276 .resource = bfin_atapi_resources,
277};
278#endif
279
280#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
281static struct mtd_partition partition_info[] = {
282 {
283 .name = "Linux Kernel",
284 .offset = 0,
285 .size = 4 * SIZE_1M,
286 },
287 {
288 .name = "File System",
Mike Frysingeredf05642008-02-25 11:38:11 +0800289 .offset = MTDPART_OFS_APPEND,
290 .size = MTDPART_SIZ_FULL,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800291 },
292};
293
294static struct bf5xx_nand_platform bf5xx_nand_platform = {
295 .page_size = NFC_PG_SIZE_256,
296 .data_width = NFC_NWIDTH_8,
297 .partitions = partition_info,
298 .nr_partitions = ARRAY_SIZE(partition_info),
299 .rd_dly = 3,
300 .wr_dly = 3,
301};
302
303static struct resource bf5xx_nand_resources[] = {
304 {
305 .start = 0xFFC03B00,
306 .end = 0xFFC03B4F,
307 .flags = IORESOURCE_MEM,
308 },
309 {
310 .start = CH_NFC,
311 .end = CH_NFC,
312 .flags = IORESOURCE_IRQ,
313 },
314};
315
316static struct platform_device bf5xx_nand_device = {
317 .name = "bf5xx-nand",
318 .id = 0,
319 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
320 .resource = bf5xx_nand_resources,
321 .dev = {
322 .platform_data = &bf5xx_nand_platform,
323 },
324};
325#endif
326
Michael Hennerich3d7e6cf2008-03-03 17:40:28 -0700327#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800328static struct platform_device bf54x_sdh_device = {
329 .name = "bfin-sdh",
330 .id = 0,
331};
332#endif
333
Mike Frysinger793dc272008-03-26 08:09:12 +0800334#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800335static struct mtd_partition ezkit_partitions[] = {
336 {
337 .name = "Bootloader",
Mike Frysingeredf05642008-02-25 11:38:11 +0800338 .size = 0x40000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800339 .offset = 0,
340 }, {
341 .name = "Kernel",
342 .size = 0xE0000,
343 .offset = MTDPART_OFS_APPEND,
344 }, {
345 .name = "RootFS",
346 .size = MTDPART_SIZ_FULL,
347 .offset = MTDPART_OFS_APPEND,
348 }
349};
350
351static struct physmap_flash_data ezkit_flash_data = {
352 .width = 2,
353 .parts = ezkit_partitions,
354 .nr_parts = ARRAY_SIZE(ezkit_partitions),
355};
356
357static struct resource ezkit_flash_resource = {
358 .start = 0x20000000,
359 .end = 0x20ffffff,
360 .flags = IORESOURCE_MEM,
361};
362
363static struct platform_device ezkit_flash_device = {
364 .name = "physmap-flash",
365 .id = 0,
366 .dev = {
367 .platform_data = &ezkit_flash_data,
368 },
369 .num_resources = 1,
370 .resource = &ezkit_flash_resource,
371};
Mike Frysinger793dc272008-03-26 08:09:12 +0800372#endif
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800373
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800374#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
375/* all SPI peripherals info goes here */
376#if defined(CONFIG_MTD_M25P80) \
377 || defined(CONFIG_MTD_M25P80_MODULE)
378/* SPI flash chip (m25p16) */
379static struct mtd_partition bfin_spi_flash_partitions[] = {
380 {
381 .name = "bootloader",
382 .size = 0x00040000,
383 .offset = 0,
384 .mask_flags = MTD_CAP_ROM
385 }, {
386 .name = "linux kernel",
Mike Frysingeredf05642008-02-25 11:38:11 +0800387 .size = MTDPART_SIZ_FULL,
388 .offset = MTDPART_OFS_APPEND,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800389 }
390};
391
392static struct flash_platform_data bfin_spi_flash_data = {
393 .name = "m25p80",
394 .parts = bfin_spi_flash_partitions,
395 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
396 .type = "m25p16",
397};
398
399static struct bfin5xx_spi_chip spi_flash_chip_info = {
400 .enable_dma = 0, /* use dma transfer with this chip*/
401 .bits_per_word = 8,
402 .cs_change_per_word = 0,
403};
404#endif
405
406#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
407static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
Michael Hennerichc7d48962007-11-15 21:33:31 +0800408 .cs_change_per_word = 0,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800409 .enable_dma = 0,
410 .bits_per_word = 16,
411};
412
413static const struct ad7877_platform_data bfin_ad7877_ts_info = {
414 .model = 7877,
415 .vref_delay_usecs = 50, /* internal, no capacitor */
416 .x_plate_ohms = 419,
417 .y_plate_ohms = 486,
418 .pressure_max = 1000,
419 .pressure_min = 0,
420 .stopacq_polarity = 1,
421 .first_conversion_delay = 3,
422 .acquisition_time = 1,
423 .averaging = 1,
424 .pen_down_acc_interval = 1,
425};
426#endif
427
Michael Hennerich6e668932008-02-09 01:54:09 +0800428#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
429static struct bfin5xx_spi_chip spidev_chip_info = {
430 .enable_dma = 0,
431 .bits_per_word = 8,
432};
433#endif
434
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800435static struct spi_board_info bf54x_spi_board_info[] __initdata = {
436#if defined(CONFIG_MTD_M25P80) \
437 || defined(CONFIG_MTD_M25P80_MODULE)
438 {
439 /* the modalias must be the same as spi device driver name */
440 .modalias = "m25p80", /* Name of spi_driver for this device */
441 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
442 .bus_num = 0, /* Framework bus number */
443 .chip_select = 1, /* SPI_SSEL1*/
444 .platform_data = &bfin_spi_flash_data,
445 .controller_data = &spi_flash_chip_info,
446 .mode = SPI_MODE_3,
447 },
448#endif
449#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
450{
451 .modalias = "ad7877",
452 .platform_data = &bfin_ad7877_ts_info,
453 .irq = IRQ_PJ11,
454 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
455 .bus_num = 0,
456 .chip_select = 2,
457 .controller_data = &spi_ad7877_chip_info,
458},
459#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800460#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
461 {
462 .modalias = "spidev",
463 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
464 .bus_num = 0,
465 .chip_select = 1,
466 .controller_data = &spidev_chip_info,
467 },
468#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800469};
470
471/* SPI (0) */
472static struct resource bfin_spi0_resource[] = {
473 [0] = {
474 .start = SPI0_REGBASE,
475 .end = SPI0_REGBASE + 0xFF,
476 .flags = IORESOURCE_MEM,
477 },
478 [1] = {
479 .start = CH_SPI0,
480 .end = CH_SPI0,
481 .flags = IORESOURCE_IRQ,
482 }
483};
484
485/* SPI (1) */
486static struct resource bfin_spi1_resource[] = {
487 [0] = {
488 .start = SPI1_REGBASE,
489 .end = SPI1_REGBASE + 0xFF,
490 .flags = IORESOURCE_MEM,
491 },
492 [1] = {
493 .start = CH_SPI1,
494 .end = CH_SPI1,
495 .flags = IORESOURCE_IRQ,
496 }
497};
498
499/* SPI controller data */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800500static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800501 .num_chipselect = 8,
502 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800503 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800504};
505
506static struct platform_device bf54x_spi_master0 = {
507 .name = "bfin-spi",
508 .id = 0, /* Bus number */
509 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
510 .resource = bfin_spi0_resource,
511 .dev = {
Bryan Wu5d448dd2007-11-12 23:24:42 +0800512 .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800513 },
514};
515
Bryan Wu5d448dd2007-11-12 23:24:42 +0800516static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
517 .num_chipselect = 8,
518 .enable_dma = 1, /* master has the ability to do dma transfer */
519 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
520};
521
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800522static struct platform_device bf54x_spi_master1 = {
523 .name = "bfin-spi",
524 .id = 1, /* Bus number */
525 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
526 .resource = bfin_spi1_resource,
527 .dev = {
Bryan Wu5d448dd2007-11-12 23:24:42 +0800528 .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800529 },
530};
531#endif /* spi master and devices */
532
533#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
534static struct resource bfin_twi0_resource[] = {
535 [0] = {
536 .start = TWI0_REGBASE,
537 .end = TWI0_REGBASE + 0xFF,
538 .flags = IORESOURCE_MEM,
539 },
540 [1] = {
541 .start = IRQ_TWI0,
542 .end = IRQ_TWI0,
543 .flags = IORESOURCE_IRQ,
544 },
545};
546
547static struct platform_device i2c_bfin_twi0_device = {
548 .name = "i2c-bfin-twi",
549 .id = 0,
550 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
551 .resource = bfin_twi0_resource,
552};
553
Mike Frysinger7160e9502007-11-21 16:03:07 +0800554#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800555static struct resource bfin_twi1_resource[] = {
556 [0] = {
557 .start = TWI1_REGBASE,
558 .end = TWI1_REGBASE + 0xFF,
559 .flags = IORESOURCE_MEM,
560 },
561 [1] = {
562 .start = IRQ_TWI1,
563 .end = IRQ_TWI1,
564 .flags = IORESOURCE_IRQ,
565 },
566};
567
568static struct platform_device i2c_bfin_twi1_device = {
569 .name = "i2c-bfin-twi",
570 .id = 1,
571 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
572 .resource = bfin_twi1_resource,
573};
574#endif
Mike Frysinger7160e9502007-11-21 16:03:07 +0800575#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800576
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800577#ifdef CONFIG_I2C_BOARDINFO
578static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
579};
580
581#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
582static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
583#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
584 {
585 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
586 .type = "pcf8574_lcd",
587 },
588#endif
589#if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
590 {
591 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
592 .type = "pcf8574_keypad",
593 .irq = 212,
594 },
595#endif
596};
597#endif
598#endif
599
Michael Hennerich2463ef22008-01-27 16:49:48 +0800600#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
601#include <linux/gpio_keys.h>
602
603static struct gpio_keys_button bfin_gpio_keys_table[] = {
604 {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
605 {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
606 {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
607 {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
608};
609
610static struct gpio_keys_platform_data bfin_gpio_keys_data = {
611 .buttons = bfin_gpio_keys_table,
612 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
613};
614
615static struct platform_device bfin_device_gpiokeys = {
616 .name = "gpio-keys",
617 .dev = {
618 .platform_data = &bfin_gpio_keys_data,
619 },
620};
621#endif
622
Mike Frysingercad2ab62008-02-22 17:01:31 +0800623static struct resource bfin_gpios_resources = {
624 .start = 0,
625 .end = MAX_BLACKFIN_GPIOS - 1,
626 .flags = IORESOURCE_IRQ,
627};
628
629static struct platform_device bfin_gpios_device = {
630 .name = "simple-gpio",
631 .id = -1,
632 .num_resources = 1,
633 .resource = &bfin_gpios_resources,
634};
635
Roy Huang24a07a12007-07-12 22:41:45 +0800636static struct platform_device *ezkit_devices[] __initdata = {
637#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
638 &rtc_device,
639#endif
640
641#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
642 &bfin_uart_device,
643#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800644
645#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
646 &bf54x_lq043_device,
647#endif
648
649#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
650 &smsc911x_device,
651#endif
652
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800653#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
654 &musb_device,
655#endif
656
657#if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
658 &bfin_atapi_device,
659#endif
660
661#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
662 &bf5xx_nand_device,
663#endif
664
Michael Hennerich3d7e6cf2008-03-03 17:40:28 -0700665#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800666 &bf54x_sdh_device,
667#endif
668
669#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
670 &bf54x_spi_master0,
Bryan Wud4b1d272007-10-21 17:03:55 +0800671 &bf54x_spi_master1,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800672#endif
673
674#if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
675 &bf54x_kpad_device,
676#endif
677
678#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
679 &i2c_bfin_twi0_device,
Mike Frysinger7160e9502007-11-21 16:03:07 +0800680#if !defined(CONFIG_BF542)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800681 &i2c_bfin_twi1_device,
682#endif
Mike Frysinger7160e9502007-11-21 16:03:07 +0800683#endif
Michael Hennerich2463ef22008-01-27 16:49:48 +0800684
685#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
686 &bfin_device_gpiokeys,
687#endif
Mike Frysingercad2ab62008-02-22 17:01:31 +0800688
689 &bfin_gpios_device,
Mike Frysinger793dc272008-03-26 08:09:12 +0800690
691#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800692 &ezkit_flash_device,
Mike Frysinger793dc272008-03-26 08:09:12 +0800693#endif
Roy Huang24a07a12007-07-12 22:41:45 +0800694};
695
Mike Frysingera01d7a72008-02-02 15:34:56 +0800696static int __init ezkit_init(void)
Roy Huang24a07a12007-07-12 22:41:45 +0800697{
698 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800699
700#ifdef CONFIG_I2C_BOARDINFO
701 i2c_register_board_info(0, bfin_i2c_board_info0,
702 ARRAY_SIZE(bfin_i2c_board_info0));
703#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
704 i2c_register_board_info(1, bfin_i2c_board_info1,
705 ARRAY_SIZE(bfin_i2c_board_info1));
706#endif
707#endif
708
Roy Huang24a07a12007-07-12 22:41:45 +0800709 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800710
711#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
712 spi_register_board_info(bf54x_spi_board_info,
713 ARRAY_SIZE(bf54x_spi_board_info));
714#endif
715
Roy Huang24a07a12007-07-12 22:41:45 +0800716 return 0;
717}
718
Mike Frysingera01d7a72008-02-02 15:34:56 +0800719arch_initcall(ezkit_init);