blob: 073bfdd56aa58666f16d74bea0e1dfaa37456623 [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
Bernd Schmidt37fa2422008-04-24 05:19:02 +0800406#if defined(CONFIG_SND_BLACKFIN_AD1836) \
407 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
408static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
409 .enable_dma = 0,
410 .bits_per_word = 16,
411};
412#endif
413
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800414#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
415static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
Michael Hennerichc7d48962007-11-15 21:33:31 +0800416 .cs_change_per_word = 0,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800417 .enable_dma = 0,
418 .bits_per_word = 16,
419};
420
421static const struct ad7877_platform_data bfin_ad7877_ts_info = {
422 .model = 7877,
423 .vref_delay_usecs = 50, /* internal, no capacitor */
424 .x_plate_ohms = 419,
425 .y_plate_ohms = 486,
426 .pressure_max = 1000,
427 .pressure_min = 0,
428 .stopacq_polarity = 1,
429 .first_conversion_delay = 3,
430 .acquisition_time = 1,
431 .averaging = 1,
432 .pen_down_acc_interval = 1,
433};
434#endif
435
Michael Hennerich6e668932008-02-09 01:54:09 +0800436#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
437static struct bfin5xx_spi_chip spidev_chip_info = {
438 .enable_dma = 0,
439 .bits_per_word = 8,
440};
441#endif
442
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800443static struct spi_board_info bf54x_spi_board_info[] __initdata = {
444#if defined(CONFIG_MTD_M25P80) \
445 || defined(CONFIG_MTD_M25P80_MODULE)
446 {
447 /* the modalias must be the same as spi device driver name */
448 .modalias = "m25p80", /* Name of spi_driver for this device */
449 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
450 .bus_num = 0, /* Framework bus number */
451 .chip_select = 1, /* SPI_SSEL1*/
452 .platform_data = &bfin_spi_flash_data,
453 .controller_data = &spi_flash_chip_info,
454 .mode = SPI_MODE_3,
455 },
456#endif
Bernd Schmidt37fa2422008-04-24 05:19:02 +0800457#if defined(CONFIG_SND_BLACKFIN_AD1836) \
458 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
459 {
460 .modalias = "ad1836-spi",
461 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
462 .bus_num = 1,
463 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
464 .controller_data = &ad1836_spi_chip_info,
465 },
466#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800467#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
468{
469 .modalias = "ad7877",
470 .platform_data = &bfin_ad7877_ts_info,
471 .irq = IRQ_PJ11,
472 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
473 .bus_num = 0,
474 .chip_select = 2,
475 .controller_data = &spi_ad7877_chip_info,
476},
477#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800478#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
479 {
480 .modalias = "spidev",
481 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
482 .bus_num = 0,
483 .chip_select = 1,
484 .controller_data = &spidev_chip_info,
485 },
486#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800487};
488
489/* SPI (0) */
490static struct resource bfin_spi0_resource[] = {
491 [0] = {
492 .start = SPI0_REGBASE,
493 .end = SPI0_REGBASE + 0xFF,
494 .flags = IORESOURCE_MEM,
495 },
496 [1] = {
497 .start = CH_SPI0,
498 .end = CH_SPI0,
499 .flags = IORESOURCE_IRQ,
500 }
501};
502
503/* SPI (1) */
504static struct resource bfin_spi1_resource[] = {
505 [0] = {
506 .start = SPI1_REGBASE,
507 .end = SPI1_REGBASE + 0xFF,
508 .flags = IORESOURCE_MEM,
509 },
510 [1] = {
511 .start = CH_SPI1,
512 .end = CH_SPI1,
513 .flags = IORESOURCE_IRQ,
514 }
515};
516
517/* SPI controller data */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800518static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800519 .num_chipselect = 8,
520 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800521 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800522};
523
524static struct platform_device bf54x_spi_master0 = {
525 .name = "bfin-spi",
526 .id = 0, /* Bus number */
527 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
528 .resource = bfin_spi0_resource,
529 .dev = {
Bryan Wu5d448dd2007-11-12 23:24:42 +0800530 .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800531 },
532};
533
Bryan Wu5d448dd2007-11-12 23:24:42 +0800534static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
535 .num_chipselect = 8,
536 .enable_dma = 1, /* master has the ability to do dma transfer */
537 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
538};
539
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800540static struct platform_device bf54x_spi_master1 = {
541 .name = "bfin-spi",
542 .id = 1, /* Bus number */
543 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
544 .resource = bfin_spi1_resource,
545 .dev = {
Bryan Wu5d448dd2007-11-12 23:24:42 +0800546 .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800547 },
548};
549#endif /* spi master and devices */
550
551#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
552static struct resource bfin_twi0_resource[] = {
553 [0] = {
554 .start = TWI0_REGBASE,
555 .end = TWI0_REGBASE + 0xFF,
556 .flags = IORESOURCE_MEM,
557 },
558 [1] = {
559 .start = IRQ_TWI0,
560 .end = IRQ_TWI0,
561 .flags = IORESOURCE_IRQ,
562 },
563};
564
565static struct platform_device i2c_bfin_twi0_device = {
566 .name = "i2c-bfin-twi",
567 .id = 0,
568 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
569 .resource = bfin_twi0_resource,
570};
571
Mike Frysinger7160e9502007-11-21 16:03:07 +0800572#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800573static struct resource bfin_twi1_resource[] = {
574 [0] = {
575 .start = TWI1_REGBASE,
576 .end = TWI1_REGBASE + 0xFF,
577 .flags = IORESOURCE_MEM,
578 },
579 [1] = {
580 .start = IRQ_TWI1,
581 .end = IRQ_TWI1,
582 .flags = IORESOURCE_IRQ,
583 },
584};
585
586static struct platform_device i2c_bfin_twi1_device = {
587 .name = "i2c-bfin-twi",
588 .id = 1,
589 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
590 .resource = bfin_twi1_resource,
591};
592#endif
Mike Frysinger7160e9502007-11-21 16:03:07 +0800593#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800594
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800595#ifdef CONFIG_I2C_BOARDINFO
596static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
597};
598
599#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
600static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
601#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
602 {
603 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
604 .type = "pcf8574_lcd",
605 },
606#endif
607#if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
608 {
609 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
610 .type = "pcf8574_keypad",
611 .irq = 212,
612 },
613#endif
614};
615#endif
616#endif
617
Michael Hennerich2463ef22008-01-27 16:49:48 +0800618#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
619#include <linux/gpio_keys.h>
620
621static struct gpio_keys_button bfin_gpio_keys_table[] = {
622 {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
623 {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
624 {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
625 {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
626};
627
628static struct gpio_keys_platform_data bfin_gpio_keys_data = {
629 .buttons = bfin_gpio_keys_table,
630 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
631};
632
633static struct platform_device bfin_device_gpiokeys = {
634 .name = "gpio-keys",
635 .dev = {
636 .platform_data = &bfin_gpio_keys_data,
637 },
638};
639#endif
640
Mike Frysingercad2ab62008-02-22 17:01:31 +0800641static struct resource bfin_gpios_resources = {
642 .start = 0,
643 .end = MAX_BLACKFIN_GPIOS - 1,
644 .flags = IORESOURCE_IRQ,
645};
646
647static struct platform_device bfin_gpios_device = {
648 .name = "simple-gpio",
649 .id = -1,
650 .num_resources = 1,
651 .resource = &bfin_gpios_resources,
652};
653
Roy Huang24a07a12007-07-12 22:41:45 +0800654static struct platform_device *ezkit_devices[] __initdata = {
655#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
656 &rtc_device,
657#endif
658
659#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
660 &bfin_uart_device,
661#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800662
663#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
664 &bf54x_lq043_device,
665#endif
666
667#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
668 &smsc911x_device,
669#endif
670
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800671#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
672 &musb_device,
673#endif
674
675#if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
676 &bfin_atapi_device,
677#endif
678
679#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
680 &bf5xx_nand_device,
681#endif
682
Michael Hennerich3d7e6cf2008-03-03 17:40:28 -0700683#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800684 &bf54x_sdh_device,
685#endif
686
687#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
688 &bf54x_spi_master0,
Bryan Wud4b1d272007-10-21 17:03:55 +0800689 &bf54x_spi_master1,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800690#endif
691
692#if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
693 &bf54x_kpad_device,
694#endif
695
696#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
697 &i2c_bfin_twi0_device,
Mike Frysinger7160e9502007-11-21 16:03:07 +0800698#if !defined(CONFIG_BF542)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800699 &i2c_bfin_twi1_device,
700#endif
Mike Frysinger7160e9502007-11-21 16:03:07 +0800701#endif
Michael Hennerich2463ef22008-01-27 16:49:48 +0800702
703#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
704 &bfin_device_gpiokeys,
705#endif
Mike Frysingercad2ab62008-02-22 17:01:31 +0800706
707 &bfin_gpios_device,
Mike Frysinger793dc272008-03-26 08:09:12 +0800708
709#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800710 &ezkit_flash_device,
Mike Frysinger793dc272008-03-26 08:09:12 +0800711#endif
Roy Huang24a07a12007-07-12 22:41:45 +0800712};
713
Mike Frysingera01d7a72008-02-02 15:34:56 +0800714static int __init ezkit_init(void)
Roy Huang24a07a12007-07-12 22:41:45 +0800715{
Harvey Harrisonb85d8582008-04-23 09:39:01 +0800716 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800717
718#ifdef CONFIG_I2C_BOARDINFO
719 i2c_register_board_info(0, bfin_i2c_board_info0,
720 ARRAY_SIZE(bfin_i2c_board_info0));
721#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
722 i2c_register_board_info(1, bfin_i2c_board_info1,
723 ARRAY_SIZE(bfin_i2c_board_info1));
724#endif
725#endif
726
Roy Huang24a07a12007-07-12 22:41:45 +0800727 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800728
729#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
730 spi_register_board_info(bf54x_spi_board_info,
731 ARRAY_SIZE(bf54x_spi_board_info));
732#endif
733
Roy Huang24a07a12007-07-12 22:41:45 +0800734 return 0;
735}
736
Mike Frysingera01d7a72008-02-02 15:34:56 +0800737arch_initcall(ezkit_init);