blob: af7c211a580eaf0763f3765d0882d15f932f00dd [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>
Michael Hennerich14b03202008-05-07 11:41:26 +080049#include <asm/dpmc.h>
Bryan Wu5d448dd2007-11-12 23:24:42 +080050#include <asm/portmux.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080051#include <asm/mach/bf54x_keys.h>
52#include <linux/input.h>
53#include <linux/spi/ad7877.h>
Roy Huang24a07a12007-07-12 22:41:45 +080054
55/*
56 * Name the Board for the /proc/cpuinfo
57 */
Mike Frysinger066954a2007-10-21 22:36:06 +080058const char bfin_board_name[] = "ADSP-BF548-EZKIT";
Roy Huang24a07a12007-07-12 22:41:45 +080059
60/*
61 * Driver needs to know address, irq and flag pin.
62 */
63
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080064#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
65
66#include <asm/mach/bf54x-lq043.h>
67
68static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
69 .width = 480,
70 .height = 272,
71 .xres = {480, 480, 480},
72 .yres = {272, 272, 272},
73 .bpp = {24, 24, 24},
74 .disp = GPIO_PE3,
75};
76
77static struct resource bf54x_lq043_resources[] = {
78 {
79 .start = IRQ_EPPI0_ERR,
80 .end = IRQ_EPPI0_ERR,
81 .flags = IORESOURCE_IRQ,
82 },
83};
84
85static struct platform_device bf54x_lq043_device = {
86 .name = "bf54x-lq043",
87 .id = -1,
88 .num_resources = ARRAY_SIZE(bf54x_lq043_resources),
89 .resource = bf54x_lq043_resources,
90 .dev = {
91 .platform_data = &bf54x_lq043_data,
92 },
93};
94#endif
95
96#if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
Michael Hennerich8f740ef2007-10-13 00:36:46 -040097static const unsigned int bf548_keymap[] = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080098 KEYVAL(0, 0, KEY_ENTER),
99 KEYVAL(0, 1, KEY_HELP),
100 KEYVAL(0, 2, KEY_0),
101 KEYVAL(0, 3, KEY_BACKSPACE),
102 KEYVAL(1, 0, KEY_TAB),
103 KEYVAL(1, 1, KEY_9),
104 KEYVAL(1, 2, KEY_8),
105 KEYVAL(1, 3, KEY_7),
106 KEYVAL(2, 0, KEY_DOWN),
107 KEYVAL(2, 1, KEY_6),
108 KEYVAL(2, 2, KEY_5),
109 KEYVAL(2, 3, KEY_4),
110 KEYVAL(3, 0, KEY_UP),
111 KEYVAL(3, 1, KEY_3),
112 KEYVAL(3, 2, KEY_2),
113 KEYVAL(3, 3, KEY_1),
114};
115
116static struct bfin_kpad_platform_data bf54x_kpad_data = {
117 .rows = 4,
118 .cols = 4,
Michael Hennerich8f740ef2007-10-13 00:36:46 -0400119 .keymap = bf548_keymap,
120 .keymapsize = ARRAY_SIZE(bf548_keymap),
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800121 .repeat = 0,
122 .debounce_time = 5000, /* ns (5ms) */
123 .coldrive_time = 1000, /* ns (1ms) */
124 .keyup_test_interval = 50, /* ms (50ms) */
125};
126
127static struct resource bf54x_kpad_resources[] = {
128 {
129 .start = IRQ_KEY,
130 .end = IRQ_KEY,
131 .flags = IORESOURCE_IRQ,
132 },
133};
134
135static struct platform_device bf54x_kpad_device = {
136 .name = "bf54x-keys",
137 .id = -1,
138 .num_resources = ARRAY_SIZE(bf54x_kpad_resources),
139 .resource = bf54x_kpad_resources,
140 .dev = {
141 .platform_data = &bf54x_kpad_data,
142 },
143};
144#endif
145
Roy Huang24a07a12007-07-12 22:41:45 +0800146#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
147static struct platform_device rtc_device = {
148 .name = "rtc-bfin",
149 .id = -1,
150};
151#endif
152
153#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
154static struct resource bfin_uart_resources[] = {
155#ifdef CONFIG_SERIAL_BFIN_UART0
156 {
157 .start = 0xFFC00400,
158 .end = 0xFFC004FF,
159 .flags = IORESOURCE_MEM,
160 },
161#endif
162#ifdef CONFIG_SERIAL_BFIN_UART1
163 {
164 .start = 0xFFC02000,
165 .end = 0xFFC020FF,
166 .flags = IORESOURCE_MEM,
167 },
168#endif
169#ifdef CONFIG_SERIAL_BFIN_UART2
170 {
171 .start = 0xFFC02100,
172 .end = 0xFFC021FF,
173 .flags = IORESOURCE_MEM,
174 },
175#endif
176#ifdef CONFIG_SERIAL_BFIN_UART3
177 {
178 .start = 0xFFC03100,
179 .end = 0xFFC031FF,
180 },
181#endif
182};
183
184static struct platform_device bfin_uart_device = {
185 .name = "bfin-uart",
186 .id = 1,
187 .num_resources = ARRAY_SIZE(bfin_uart_resources),
188 .resource = bfin_uart_resources,
189};
190#endif
191
Graf Yang5be36d22008-04-25 03:09:15 +0800192#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
193static struct resource bfin_sir_resources[] = {
194#ifdef CONFIG_BFIN_SIR0
195 {
196 .start = 0xFFC00400,
197 .end = 0xFFC004FF,
198 .flags = IORESOURCE_MEM,
199 },
200#endif
201#ifdef CONFIG_BFIN_SIR1
202 {
203 .start = 0xFFC02000,
204 .end = 0xFFC020FF,
205 .flags = IORESOURCE_MEM,
206 },
207#endif
208#ifdef CONFIG_BFIN_SIR2
209 {
210 .start = 0xFFC02100,
211 .end = 0xFFC021FF,
212 .flags = IORESOURCE_MEM,
213 },
214#endif
215#ifdef CONFIG_BFIN_SIR3
216 {
217 .start = 0xFFC03100,
218 .end = 0xFFC031FF,
219 .flags = IORESOURCE_MEM,
220 },
221#endif
222};
223
224static struct platform_device bfin_sir_device = {
225 .name = "bfin_sir",
226 .id = 0,
227 .num_resources = ARRAY_SIZE(bfin_sir_resources),
228 .resource = bfin_sir_resources,
229};
230#endif
231
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800232#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
233static struct resource smsc911x_resources[] = {
234 {
235 .name = "smsc911x-memory",
236 .start = 0x24000000,
237 .end = 0x24000000 + 0xFF,
238 .flags = IORESOURCE_MEM,
239 },
240 {
241 .start = IRQ_PE8,
242 .end = IRQ_PE8,
243 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
244 },
245};
246static struct platform_device smsc911x_device = {
247 .name = "smsc911x",
248 .id = 0,
249 .num_resources = ARRAY_SIZE(smsc911x_resources),
250 .resource = smsc911x_resources,
251};
252#endif
253
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800254#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
255static struct resource musb_resources[] = {
256 [0] = {
257 .start = 0xFFC03C00,
258 .end = 0xFFC040FF,
259 .flags = IORESOURCE_MEM,
260 },
261 [1] = { /* general IRQ */
262 .start = IRQ_USB_INT0,
263 .end = IRQ_USB_INT0,
264 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
265 },
266 [2] = { /* DMA IRQ */
267 .start = IRQ_USB_DMA,
268 .end = IRQ_USB_DMA,
269 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
270 },
271};
272
273static struct musb_hdrc_platform_data musb_plat = {
Bryan Wu29350772007-12-24 12:20:19 +0800274#if defined(CONFIG_USB_MUSB_OTG)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800275 .mode = MUSB_OTG,
Bryan Wu29350772007-12-24 12:20:19 +0800276#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800277 .mode = MUSB_HOST,
Bryan Wu29350772007-12-24 12:20:19 +0800278#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800279 .mode = MUSB_PERIPHERAL,
280#endif
Bryan Wu29350772007-12-24 12:20:19 +0800281 .multipoint = 0,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800282};
283
284static u64 musb_dmamask = ~(u32)0;
285
286static struct platform_device musb_device = {
287 .name = "musb_hdrc",
288 .id = 0,
289 .dev = {
290 .dma_mask = &musb_dmamask,
291 .coherent_dma_mask = 0xffffffff,
292 .platform_data = &musb_plat,
293 },
294 .num_resources = ARRAY_SIZE(musb_resources),
295 .resource = musb_resources,
296};
297#endif
298
299#if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
300static struct resource bfin_atapi_resources[] = {
301 {
302 .start = 0xFFC03800,
303 .end = 0xFFC0386F,
304 .flags = IORESOURCE_MEM,
305 },
306 {
307 .start = IRQ_ATAPI_ERR,
308 .end = IRQ_ATAPI_ERR,
309 .flags = IORESOURCE_IRQ,
310 },
311};
312
313static struct platform_device bfin_atapi_device = {
314 .name = "pata-bf54x",
315 .id = -1,
316 .num_resources = ARRAY_SIZE(bfin_atapi_resources),
317 .resource = bfin_atapi_resources,
318};
319#endif
320
321#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
322static struct mtd_partition partition_info[] = {
323 {
324 .name = "Linux Kernel",
325 .offset = 0,
326 .size = 4 * SIZE_1M,
327 },
328 {
329 .name = "File System",
Mike Frysingeredf05642008-02-25 11:38:11 +0800330 .offset = MTDPART_OFS_APPEND,
331 .size = MTDPART_SIZ_FULL,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800332 },
333};
334
335static struct bf5xx_nand_platform bf5xx_nand_platform = {
336 .page_size = NFC_PG_SIZE_256,
337 .data_width = NFC_NWIDTH_8,
338 .partitions = partition_info,
339 .nr_partitions = ARRAY_SIZE(partition_info),
340 .rd_dly = 3,
341 .wr_dly = 3,
342};
343
344static struct resource bf5xx_nand_resources[] = {
345 {
346 .start = 0xFFC03B00,
347 .end = 0xFFC03B4F,
348 .flags = IORESOURCE_MEM,
349 },
350 {
351 .start = CH_NFC,
352 .end = CH_NFC,
353 .flags = IORESOURCE_IRQ,
354 },
355};
356
357static struct platform_device bf5xx_nand_device = {
358 .name = "bf5xx-nand",
359 .id = 0,
360 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
361 .resource = bf5xx_nand_resources,
362 .dev = {
363 .platform_data = &bf5xx_nand_platform,
364 },
365};
366#endif
367
Michael Hennerich3d7e6cf2008-03-03 17:40:28 -0700368#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800369static struct platform_device bf54x_sdh_device = {
370 .name = "bfin-sdh",
371 .id = 0,
372};
373#endif
374
Mike Frysinger793dc272008-03-26 08:09:12 +0800375#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800376static struct mtd_partition ezkit_partitions[] = {
377 {
378 .name = "Bootloader",
Mike Frysingeredf05642008-02-25 11:38:11 +0800379 .size = 0x40000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800380 .offset = 0,
381 }, {
382 .name = "Kernel",
Grace Panac76d882008-04-24 06:33:56 +0800383 .size = 0x1C0000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800384 .offset = MTDPART_OFS_APPEND,
385 }, {
386 .name = "RootFS",
387 .size = MTDPART_SIZ_FULL,
388 .offset = MTDPART_OFS_APPEND,
389 }
390};
391
392static struct physmap_flash_data ezkit_flash_data = {
393 .width = 2,
394 .parts = ezkit_partitions,
395 .nr_parts = ARRAY_SIZE(ezkit_partitions),
396};
397
398static struct resource ezkit_flash_resource = {
399 .start = 0x20000000,
400 .end = 0x20ffffff,
401 .flags = IORESOURCE_MEM,
402};
403
404static struct platform_device ezkit_flash_device = {
405 .name = "physmap-flash",
406 .id = 0,
407 .dev = {
408 .platform_data = &ezkit_flash_data,
409 },
410 .num_resources = 1,
411 .resource = &ezkit_flash_resource,
412};
Mike Frysinger793dc272008-03-26 08:09:12 +0800413#endif
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800414
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800415#if defined(CONFIG_MTD_M25P80) \
416 || defined(CONFIG_MTD_M25P80_MODULE)
417/* SPI flash chip (m25p16) */
418static struct mtd_partition bfin_spi_flash_partitions[] = {
419 {
420 .name = "bootloader",
421 .size = 0x00040000,
422 .offset = 0,
423 .mask_flags = MTD_CAP_ROM
424 }, {
425 .name = "linux kernel",
Mike Frysingeredf05642008-02-25 11:38:11 +0800426 .size = MTDPART_SIZ_FULL,
427 .offset = MTDPART_OFS_APPEND,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800428 }
429};
430
431static struct flash_platform_data bfin_spi_flash_data = {
432 .name = "m25p80",
433 .parts = bfin_spi_flash_partitions,
434 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
435 .type = "m25p16",
436};
437
438static struct bfin5xx_spi_chip spi_flash_chip_info = {
439 .enable_dma = 0, /* use dma transfer with this chip*/
440 .bits_per_word = 8,
441 .cs_change_per_word = 0,
442};
443#endif
444
Bernd Schmidt37fa2422008-04-24 05:19:02 +0800445#if defined(CONFIG_SND_BLACKFIN_AD1836) \
446 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
447static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
448 .enable_dma = 0,
449 .bits_per_word = 16,
450};
451#endif
452
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800453#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
454static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
Michael Hennerichc7d48962007-11-15 21:33:31 +0800455 .cs_change_per_word = 0,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800456 .enable_dma = 0,
457 .bits_per_word = 16,
458};
459
460static const struct ad7877_platform_data bfin_ad7877_ts_info = {
461 .model = 7877,
462 .vref_delay_usecs = 50, /* internal, no capacitor */
463 .x_plate_ohms = 419,
464 .y_plate_ohms = 486,
465 .pressure_max = 1000,
466 .pressure_min = 0,
467 .stopacq_polarity = 1,
468 .first_conversion_delay = 3,
469 .acquisition_time = 1,
470 .averaging = 1,
471 .pen_down_acc_interval = 1,
472};
473#endif
474
Michael Hennerich6e668932008-02-09 01:54:09 +0800475#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
476static struct bfin5xx_spi_chip spidev_chip_info = {
477 .enable_dma = 0,
478 .bits_per_word = 8,
479};
480#endif
481
Mike Frysinger5bda2722008-06-07 15:03:01 +0800482static struct spi_board_info bfin_spi_board_info[] __initdata = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800483#if defined(CONFIG_MTD_M25P80) \
484 || defined(CONFIG_MTD_M25P80_MODULE)
485 {
486 /* the modalias must be the same as spi device driver name */
487 .modalias = "m25p80", /* Name of spi_driver for this device */
488 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
489 .bus_num = 0, /* Framework bus number */
490 .chip_select = 1, /* SPI_SSEL1*/
491 .platform_data = &bfin_spi_flash_data,
492 .controller_data = &spi_flash_chip_info,
493 .mode = SPI_MODE_3,
494 },
495#endif
Bernd Schmidt37fa2422008-04-24 05:19:02 +0800496#if defined(CONFIG_SND_BLACKFIN_AD1836) \
497 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
498 {
499 .modalias = "ad1836-spi",
500 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
501 .bus_num = 1,
502 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
503 .controller_data = &ad1836_spi_chip_info,
504 },
505#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800506#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
507{
508 .modalias = "ad7877",
509 .platform_data = &bfin_ad7877_ts_info,
510 .irq = IRQ_PJ11,
511 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
512 .bus_num = 0,
513 .chip_select = 2,
514 .controller_data = &spi_ad7877_chip_info,
515},
516#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800517#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
518 {
519 .modalias = "spidev",
520 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
521 .bus_num = 0,
522 .chip_select = 1,
523 .controller_data = &spidev_chip_info,
524 },
525#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800526};
527
Mike Frysinger5bda2722008-06-07 15:03:01 +0800528#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800529/* 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),
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800644 },
645#endif
646#if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
647 {
648 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800649 .irq = 212,
650 },
651#endif
652};
653#endif
654#endif
655
Michael Hennerich2463ef22008-01-27 16:49:48 +0800656#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
657#include <linux/gpio_keys.h>
658
659static struct gpio_keys_button bfin_gpio_keys_table[] = {
660 {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
661 {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
662 {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
663 {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
664};
665
666static struct gpio_keys_platform_data bfin_gpio_keys_data = {
667 .buttons = bfin_gpio_keys_table,
668 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
669};
670
671static struct platform_device bfin_device_gpiokeys = {
672 .name = "gpio-keys",
673 .dev = {
674 .platform_data = &bfin_gpio_keys_data,
675 },
676};
677#endif
678
Mike Frysingercad2ab62008-02-22 17:01:31 +0800679static struct resource bfin_gpios_resources = {
680 .start = 0,
681 .end = MAX_BLACKFIN_GPIOS - 1,
682 .flags = IORESOURCE_IRQ,
683};
684
685static struct platform_device bfin_gpios_device = {
686 .name = "simple-gpio",
687 .id = -1,
688 .num_resources = 1,
689 .resource = &bfin_gpios_resources,
690};
691
Michael Hennerich14b03202008-05-07 11:41:26 +0800692static const unsigned int cclk_vlev_datasheet[] =
693{
694/*
695 * Internal VLEV BF54XSBBC1533
696 ****temporarily using these values until data sheet is updated
697 */
698 VRPAIR(VLEV_085, 150000000),
699 VRPAIR(VLEV_090, 250000000),
700 VRPAIR(VLEV_110, 276000000),
701 VRPAIR(VLEV_115, 301000000),
702 VRPAIR(VLEV_120, 525000000),
703 VRPAIR(VLEV_125, 550000000),
704 VRPAIR(VLEV_130, 600000000),
705};
706
707static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
708 .tuple_tab = cclk_vlev_datasheet,
709 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
710 .vr_settling_time = 25 /* us */,
711};
712
713static struct platform_device bfin_dpmc = {
714 .name = "bfin dpmc",
715 .dev = {
716 .platform_data = &bfin_dmpc_vreg_data,
717 },
718};
719
Roy Huang24a07a12007-07-12 22:41:45 +0800720static struct platform_device *ezkit_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +0800721
722 &bfin_dpmc,
723
Roy Huang24a07a12007-07-12 22:41:45 +0800724#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
725 &rtc_device,
726#endif
727
728#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
729 &bfin_uart_device,
730#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800731
Graf Yang5be36d22008-04-25 03:09:15 +0800732#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
733 &bfin_sir_device,
734#endif
735
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800736#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
737 &bf54x_lq043_device,
738#endif
739
740#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
741 &smsc911x_device,
742#endif
743
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800744#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
745 &musb_device,
746#endif
747
748#if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
749 &bfin_atapi_device,
750#endif
751
752#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
753 &bf5xx_nand_device,
754#endif
755
Michael Hennerich3d7e6cf2008-03-03 17:40:28 -0700756#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800757 &bf54x_sdh_device,
758#endif
759
760#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
761 &bf54x_spi_master0,
Bryan Wud4b1d272007-10-21 17:03:55 +0800762 &bf54x_spi_master1,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800763#endif
764
765#if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
766 &bf54x_kpad_device,
767#endif
768
769#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
770 &i2c_bfin_twi0_device,
Mike Frysinger7160e952007-11-21 16:03:07 +0800771#if !defined(CONFIG_BF542)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800772 &i2c_bfin_twi1_device,
773#endif
Mike Frysinger7160e952007-11-21 16:03:07 +0800774#endif
Michael Hennerich2463ef22008-01-27 16:49:48 +0800775
776#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
777 &bfin_device_gpiokeys,
778#endif
Mike Frysingercad2ab62008-02-22 17:01:31 +0800779
780 &bfin_gpios_device,
Mike Frysinger793dc272008-03-26 08:09:12 +0800781
782#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800783 &ezkit_flash_device,
Mike Frysinger793dc272008-03-26 08:09:12 +0800784#endif
Roy Huang24a07a12007-07-12 22:41:45 +0800785};
786
Mike Frysingera01d7a72008-02-02 15:34:56 +0800787static int __init ezkit_init(void)
Roy Huang24a07a12007-07-12 22:41:45 +0800788{
Harvey Harrisonb85d8582008-04-23 09:39:01 +0800789 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800790
791#ifdef CONFIG_I2C_BOARDINFO
792 i2c_register_board_info(0, bfin_i2c_board_info0,
793 ARRAY_SIZE(bfin_i2c_board_info0));
794#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
795 i2c_register_board_info(1, bfin_i2c_board_info1,
796 ARRAY_SIZE(bfin_i2c_board_info1));
797#endif
798#endif
799
Roy Huang24a07a12007-07-12 22:41:45 +0800800 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800801
Mike Frysinger5bda2722008-06-07 15:03:01 +0800802 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800803
Roy Huang24a07a12007-07-12 22:41:45 +0800804 return 0;
805}
806
Mike Frysingera01d7a72008-02-02 15:34:56 +0800807arch_initcall(ezkit_init);