blob: 397ddf6b810677cd502031035ed34a1ec8ac8f4e [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>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080041#include <linux/usb/musb.h>
Roy Huang24a07a12007-07-12 22:41:45 +080042#include <asm/bfin5xx_spi.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080043#include <asm/dma.h>
44#include <asm/gpio.h>
45#include <asm/nand.h>
Michael Hennerich14b03202008-05-07 11:41:26 +080046#include <asm/dpmc.h>
Bryan Wu5d448dd2007-11-12 23:24:42 +080047#include <asm/portmux.h>
Bryan Wu639f6572008-08-27 10:51:02 +080048#include <mach/bf54x_keys.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080049#include <linux/input.h>
50#include <linux/spi/ad7877.h>
Roy Huang24a07a12007-07-12 22:41:45 +080051
52/*
53 * Name the Board for the /proc/cpuinfo
54 */
Mike Frysinger066954a2007-10-21 22:36:06 +080055const char bfin_board_name[] = "ADSP-BF548-EZKIT";
Roy Huang24a07a12007-07-12 22:41:45 +080056
57/*
58 * Driver needs to know address, irq and flag pin.
59 */
60
Michael Hennerich0a6304a2008-07-26 16:14:57 +080061#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
62static struct resource bfin_isp1761_resources[] = {
63 [0] = {
64 .name = "isp1761-regs",
65 .start = 0x2C0C0000,
66 .end = 0x2C0C0000 + 0xfffff,
67 .flags = IORESOURCE_MEM,
68 },
69 [1] = {
70 .start = IRQ_PG7,
71 .end = IRQ_PG7,
72 .flags = IORESOURCE_IRQ,
73 },
74};
75
76static struct platform_device bfin_isp1761_device = {
77 .name = "isp1761",
78 .id = 0,
79 .num_resources = ARRAY_SIZE(bfin_isp1761_resources),
80 .resource = bfin_isp1761_resources,
81};
82
83static struct platform_device *bfin_isp1761_devices[] = {
84 &bfin_isp1761_device,
85};
86
87int __init bfin_isp1761_init(void)
88{
89 unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
90
91 printk(KERN_INFO "%s(): registering device resources\n", __func__);
92 set_irq_type(bfin_isp1761_resources[1].start, IRQF_TRIGGER_FALLING);
93
94 return platform_add_devices(bfin_isp1761_devices, num_devices);
95}
96
97void __exit bfin_isp1761_exit(void)
98{
99 platform_device_unregister(&bfin_isp1761_device);
100}
101arch_initcall(bfin_isp1761_init);
102#endif
103
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800104#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
105
Bryan Wu639f6572008-08-27 10:51:02 +0800106#include <mach/bf54x-lq043.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800107
108static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
109 .width = 480,
110 .height = 272,
111 .xres = {480, 480, 480},
112 .yres = {272, 272, 272},
113 .bpp = {24, 24, 24},
114 .disp = GPIO_PE3,
115};
116
117static struct resource bf54x_lq043_resources[] = {
118 {
119 .start = IRQ_EPPI0_ERR,
120 .end = IRQ_EPPI0_ERR,
121 .flags = IORESOURCE_IRQ,
122 },
123};
124
125static struct platform_device bf54x_lq043_device = {
126 .name = "bf54x-lq043",
127 .id = -1,
128 .num_resources = ARRAY_SIZE(bf54x_lq043_resources),
129 .resource = bf54x_lq043_resources,
130 .dev = {
131 .platform_data = &bf54x_lq043_data,
132 },
133};
134#endif
135
136#if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
Michael Hennerich8f740ef2007-10-13 00:36:46 -0400137static const unsigned int bf548_keymap[] = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800138 KEYVAL(0, 0, KEY_ENTER),
139 KEYVAL(0, 1, KEY_HELP),
140 KEYVAL(0, 2, KEY_0),
141 KEYVAL(0, 3, KEY_BACKSPACE),
142 KEYVAL(1, 0, KEY_TAB),
143 KEYVAL(1, 1, KEY_9),
144 KEYVAL(1, 2, KEY_8),
145 KEYVAL(1, 3, KEY_7),
146 KEYVAL(2, 0, KEY_DOWN),
147 KEYVAL(2, 1, KEY_6),
148 KEYVAL(2, 2, KEY_5),
149 KEYVAL(2, 3, KEY_4),
150 KEYVAL(3, 0, KEY_UP),
151 KEYVAL(3, 1, KEY_3),
152 KEYVAL(3, 2, KEY_2),
153 KEYVAL(3, 3, KEY_1),
154};
155
156static struct bfin_kpad_platform_data bf54x_kpad_data = {
157 .rows = 4,
158 .cols = 4,
Michael Hennerich8f740ef2007-10-13 00:36:46 -0400159 .keymap = bf548_keymap,
160 .keymapsize = ARRAY_SIZE(bf548_keymap),
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800161 .repeat = 0,
162 .debounce_time = 5000, /* ns (5ms) */
163 .coldrive_time = 1000, /* ns (1ms) */
164 .keyup_test_interval = 50, /* ms (50ms) */
165};
166
167static struct resource bf54x_kpad_resources[] = {
168 {
169 .start = IRQ_KEY,
170 .end = IRQ_KEY,
171 .flags = IORESOURCE_IRQ,
172 },
173};
174
175static struct platform_device bf54x_kpad_device = {
176 .name = "bf54x-keys",
177 .id = -1,
178 .num_resources = ARRAY_SIZE(bf54x_kpad_resources),
179 .resource = bf54x_kpad_resources,
180 .dev = {
181 .platform_data = &bf54x_kpad_data,
182 },
183};
184#endif
185
Roy Huang24a07a12007-07-12 22:41:45 +0800186#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
187static struct platform_device rtc_device = {
188 .name = "rtc-bfin",
189 .id = -1,
190};
191#endif
192
193#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
194static struct resource bfin_uart_resources[] = {
195#ifdef CONFIG_SERIAL_BFIN_UART0
196 {
197 .start = 0xFFC00400,
198 .end = 0xFFC004FF,
199 .flags = IORESOURCE_MEM,
200 },
201#endif
202#ifdef CONFIG_SERIAL_BFIN_UART1
203 {
204 .start = 0xFFC02000,
205 .end = 0xFFC020FF,
206 .flags = IORESOURCE_MEM,
207 },
208#endif
209#ifdef CONFIG_SERIAL_BFIN_UART2
210 {
211 .start = 0xFFC02100,
212 .end = 0xFFC021FF,
213 .flags = IORESOURCE_MEM,
214 },
215#endif
216#ifdef CONFIG_SERIAL_BFIN_UART3
217 {
218 .start = 0xFFC03100,
219 .end = 0xFFC031FF,
Mike Frysingercc2e16b2008-07-19 16:43:51 +0800220 .flags = IORESOURCE_MEM,
Roy Huang24a07a12007-07-12 22:41:45 +0800221 },
222#endif
223};
224
225static struct platform_device bfin_uart_device = {
226 .name = "bfin-uart",
227 .id = 1,
228 .num_resources = ARRAY_SIZE(bfin_uart_resources),
229 .resource = bfin_uart_resources,
230};
231#endif
232
Graf Yang5be36d22008-04-25 03:09:15 +0800233#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
234static struct resource bfin_sir_resources[] = {
235#ifdef CONFIG_BFIN_SIR0
236 {
237 .start = 0xFFC00400,
238 .end = 0xFFC004FF,
239 .flags = IORESOURCE_MEM,
240 },
241#endif
242#ifdef CONFIG_BFIN_SIR1
243 {
244 .start = 0xFFC02000,
245 .end = 0xFFC020FF,
246 .flags = IORESOURCE_MEM,
247 },
248#endif
249#ifdef CONFIG_BFIN_SIR2
250 {
251 .start = 0xFFC02100,
252 .end = 0xFFC021FF,
253 .flags = IORESOURCE_MEM,
254 },
255#endif
256#ifdef CONFIG_BFIN_SIR3
257 {
258 .start = 0xFFC03100,
259 .end = 0xFFC031FF,
260 .flags = IORESOURCE_MEM,
261 },
262#endif
263};
264
265static struct platform_device bfin_sir_device = {
266 .name = "bfin_sir",
267 .id = 0,
268 .num_resources = ARRAY_SIZE(bfin_sir_resources),
269 .resource = bfin_sir_resources,
270};
271#endif
272
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800273#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
274static struct resource smsc911x_resources[] = {
275 {
276 .name = "smsc911x-memory",
277 .start = 0x24000000,
278 .end = 0x24000000 + 0xFF,
279 .flags = IORESOURCE_MEM,
280 },
281 {
282 .start = IRQ_PE8,
283 .end = IRQ_PE8,
284 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
285 },
286};
287static struct platform_device smsc911x_device = {
288 .name = "smsc911x",
289 .id = 0,
290 .num_resources = ARRAY_SIZE(smsc911x_resources),
291 .resource = smsc911x_resources,
292};
293#endif
294
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800295#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
296static struct resource musb_resources[] = {
297 [0] = {
298 .start = 0xFFC03C00,
299 .end = 0xFFC040FF,
300 .flags = IORESOURCE_MEM,
301 },
302 [1] = { /* general IRQ */
303 .start = IRQ_USB_INT0,
304 .end = IRQ_USB_INT0,
305 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
306 },
307 [2] = { /* DMA IRQ */
308 .start = IRQ_USB_DMA,
309 .end = IRQ_USB_DMA,
310 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
311 },
312};
313
Bryan Wu50041ac2008-10-08 13:39:40 +0800314static struct musb_hdrc_config musb_config = {
315 .multipoint = 0,
316 .dyn_fifo = 0,
317 .soft_con = 1,
318 .dma = 1,
319 .num_eps = 7,
320 .dma_channels = 7,
321 .gpio_vrsel = GPIO_PE7,
322};
323
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800324static struct musb_hdrc_platform_data musb_plat = {
Bryan Wu29350772007-12-24 12:20:19 +0800325#if defined(CONFIG_USB_MUSB_OTG)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800326 .mode = MUSB_OTG,
Bryan Wu29350772007-12-24 12:20:19 +0800327#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800328 .mode = MUSB_HOST,
Bryan Wu29350772007-12-24 12:20:19 +0800329#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800330 .mode = MUSB_PERIPHERAL,
331#endif
Bryan Wu50041ac2008-10-08 13:39:40 +0800332 .config = &musb_config,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800333};
334
335static u64 musb_dmamask = ~(u32)0;
336
337static struct platform_device musb_device = {
338 .name = "musb_hdrc",
339 .id = 0,
340 .dev = {
341 .dma_mask = &musb_dmamask,
342 .coherent_dma_mask = 0xffffffff,
343 .platform_data = &musb_plat,
344 },
345 .num_resources = ARRAY_SIZE(musb_resources),
346 .resource = musb_resources,
347};
348#endif
349
350#if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
351static struct resource bfin_atapi_resources[] = {
352 {
353 .start = 0xFFC03800,
354 .end = 0xFFC0386F,
355 .flags = IORESOURCE_MEM,
356 },
357 {
358 .start = IRQ_ATAPI_ERR,
359 .end = IRQ_ATAPI_ERR,
360 .flags = IORESOURCE_IRQ,
361 },
362};
363
364static struct platform_device bfin_atapi_device = {
365 .name = "pata-bf54x",
366 .id = -1,
367 .num_resources = ARRAY_SIZE(bfin_atapi_resources),
368 .resource = bfin_atapi_resources,
369};
370#endif
371
372#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
373static struct mtd_partition partition_info[] = {
374 {
Robin Getzaa582972008-08-05 17:47:29 +0800375 .name = "linux kernel(nand)",
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800376 .offset = 0,
Mike Frysingerf4585a02008-10-13 14:45:21 +0800377 .size = 4 * 1024 * 1024,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800378 },
379 {
Robin Getzaa582972008-08-05 17:47:29 +0800380 .name = "file system(nand)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800381 .offset = MTDPART_OFS_APPEND,
382 .size = MTDPART_SIZ_FULL,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800383 },
384};
385
386static struct bf5xx_nand_platform bf5xx_nand_platform = {
387 .page_size = NFC_PG_SIZE_256,
388 .data_width = NFC_NWIDTH_8,
389 .partitions = partition_info,
390 .nr_partitions = ARRAY_SIZE(partition_info),
391 .rd_dly = 3,
392 .wr_dly = 3,
393};
394
395static struct resource bf5xx_nand_resources[] = {
396 {
397 .start = 0xFFC03B00,
398 .end = 0xFFC03B4F,
399 .flags = IORESOURCE_MEM,
400 },
401 {
402 .start = CH_NFC,
403 .end = CH_NFC,
404 .flags = IORESOURCE_IRQ,
405 },
406};
407
408static struct platform_device bf5xx_nand_device = {
409 .name = "bf5xx-nand",
410 .id = 0,
411 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
412 .resource = bf5xx_nand_resources,
413 .dev = {
414 .platform_data = &bf5xx_nand_platform,
415 },
416};
417#endif
418
Michael Hennerich3d7e6cf2008-03-03 17:40:28 -0700419#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800420static struct platform_device bf54x_sdh_device = {
421 .name = "bfin-sdh",
422 .id = 0,
423};
424#endif
425
Mike Frysinger793dc272008-03-26 08:09:12 +0800426#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800427static struct mtd_partition ezkit_partitions[] = {
428 {
Robin Getzaa582972008-08-05 17:47:29 +0800429 .name = "bootloader(nor)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800430 .size = 0x40000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800431 .offset = 0,
432 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800433 .name = "linux kernel(nor)",
Grace Panac76d882008-04-24 06:33:56 +0800434 .size = 0x1C0000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800435 .offset = MTDPART_OFS_APPEND,
436 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800437 .name = "file system(nor)",
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800438 .size = MTDPART_SIZ_FULL,
439 .offset = MTDPART_OFS_APPEND,
440 }
441};
442
443static struct physmap_flash_data ezkit_flash_data = {
444 .width = 2,
445 .parts = ezkit_partitions,
446 .nr_parts = ARRAY_SIZE(ezkit_partitions),
447};
448
449static struct resource ezkit_flash_resource = {
450 .start = 0x20000000,
451 .end = 0x20ffffff,
452 .flags = IORESOURCE_MEM,
453};
454
455static struct platform_device ezkit_flash_device = {
456 .name = "physmap-flash",
457 .id = 0,
458 .dev = {
459 .platform_data = &ezkit_flash_data,
460 },
461 .num_resources = 1,
462 .resource = &ezkit_flash_resource,
463};
Mike Frysinger793dc272008-03-26 08:09:12 +0800464#endif
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800465
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800466#if defined(CONFIG_MTD_M25P80) \
467 || defined(CONFIG_MTD_M25P80_MODULE)
468/* SPI flash chip (m25p16) */
469static struct mtd_partition bfin_spi_flash_partitions[] = {
470 {
Robin Getzaa582972008-08-05 17:47:29 +0800471 .name = "bootloader(spi)",
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800472 .size = 0x00040000,
473 .offset = 0,
474 .mask_flags = MTD_CAP_ROM
475 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800476 .name = "linux kernel(spi)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800477 .size = MTDPART_SIZ_FULL,
478 .offset = MTDPART_OFS_APPEND,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800479 }
480};
481
482static struct flash_platform_data bfin_spi_flash_data = {
483 .name = "m25p80",
484 .parts = bfin_spi_flash_partitions,
485 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
486 .type = "m25p16",
487};
488
489static struct bfin5xx_spi_chip spi_flash_chip_info = {
490 .enable_dma = 0, /* use dma transfer with this chip*/
491 .bits_per_word = 8,
492 .cs_change_per_word = 0,
493};
494#endif
495
Bernd Schmidt37fa2422008-04-24 05:19:02 +0800496#if defined(CONFIG_SND_BLACKFIN_AD1836) \
497 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
498static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
499 .enable_dma = 0,
500 .bits_per_word = 16,
501};
502#endif
503
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800504#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
505static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
Michael Hennerichc7d48962007-11-15 21:33:31 +0800506 .cs_change_per_word = 0,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800507 .enable_dma = 0,
508 .bits_per_word = 16,
509};
510
511static const struct ad7877_platform_data bfin_ad7877_ts_info = {
512 .model = 7877,
513 .vref_delay_usecs = 50, /* internal, no capacitor */
514 .x_plate_ohms = 419,
515 .y_plate_ohms = 486,
516 .pressure_max = 1000,
517 .pressure_min = 0,
518 .stopacq_polarity = 1,
519 .first_conversion_delay = 3,
520 .acquisition_time = 1,
521 .averaging = 1,
522 .pen_down_acc_interval = 1,
523};
524#endif
525
Michael Hennerich6e668932008-02-09 01:54:09 +0800526#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
527static struct bfin5xx_spi_chip spidev_chip_info = {
528 .enable_dma = 0,
529 .bits_per_word = 8,
530};
531#endif
532
Mike Frysinger5bda2722008-06-07 15:03:01 +0800533static struct spi_board_info bfin_spi_board_info[] __initdata = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800534#if defined(CONFIG_MTD_M25P80) \
535 || defined(CONFIG_MTD_M25P80_MODULE)
536 {
537 /* the modalias must be the same as spi device driver name */
538 .modalias = "m25p80", /* Name of spi_driver for this device */
539 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
540 .bus_num = 0, /* Framework bus number */
541 .chip_select = 1, /* SPI_SSEL1*/
542 .platform_data = &bfin_spi_flash_data,
543 .controller_data = &spi_flash_chip_info,
544 .mode = SPI_MODE_3,
545 },
546#endif
Bernd Schmidt37fa2422008-04-24 05:19:02 +0800547#if defined(CONFIG_SND_BLACKFIN_AD1836) \
548 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
549 {
550 .modalias = "ad1836-spi",
551 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
552 .bus_num = 1,
553 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
554 .controller_data = &ad1836_spi_chip_info,
555 },
556#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800557#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
558{
559 .modalias = "ad7877",
560 .platform_data = &bfin_ad7877_ts_info,
Mike Frysinger1ffb9be2008-10-07 16:06:27 +0800561 .irq = IRQ_PJ11, /* newer boards (Rev 1.4+) use IRQ_PB4 */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800562 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
563 .bus_num = 0,
564 .chip_select = 2,
565 .controller_data = &spi_ad7877_chip_info,
566},
567#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800568#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
569 {
570 .modalias = "spidev",
571 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
572 .bus_num = 0,
573 .chip_select = 1,
574 .controller_data = &spidev_chip_info,
575 },
576#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800577};
578
Mike Frysinger5bda2722008-06-07 15:03:01 +0800579#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800580/* SPI (0) */
581static struct resource bfin_spi0_resource[] = {
582 [0] = {
583 .start = SPI0_REGBASE,
584 .end = SPI0_REGBASE + 0xFF,
585 .flags = IORESOURCE_MEM,
586 },
587 [1] = {
588 .start = CH_SPI0,
589 .end = CH_SPI0,
590 .flags = IORESOURCE_IRQ,
591 }
592};
593
594/* SPI (1) */
595static struct resource bfin_spi1_resource[] = {
596 [0] = {
597 .start = SPI1_REGBASE,
598 .end = SPI1_REGBASE + 0xFF,
599 .flags = IORESOURCE_MEM,
600 },
601 [1] = {
602 .start = CH_SPI1,
603 .end = CH_SPI1,
604 .flags = IORESOURCE_IRQ,
605 }
606};
607
608/* SPI controller data */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800609static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800610 .num_chipselect = 8,
611 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800612 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800613};
614
615static struct platform_device bf54x_spi_master0 = {
616 .name = "bfin-spi",
617 .id = 0, /* Bus number */
618 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
619 .resource = bfin_spi0_resource,
620 .dev = {
Bryan Wu5d448dd2007-11-12 23:24:42 +0800621 .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800622 },
623};
624
Bryan Wu5d448dd2007-11-12 23:24:42 +0800625static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
626 .num_chipselect = 8,
627 .enable_dma = 1, /* master has the ability to do dma transfer */
628 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
629};
630
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800631static struct platform_device bf54x_spi_master1 = {
632 .name = "bfin-spi",
633 .id = 1, /* Bus number */
634 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
635 .resource = bfin_spi1_resource,
636 .dev = {
Bryan Wu5d448dd2007-11-12 23:24:42 +0800637 .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800638 },
639};
640#endif /* spi master and devices */
641
642#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
643static struct resource bfin_twi0_resource[] = {
644 [0] = {
645 .start = TWI0_REGBASE,
646 .end = TWI0_REGBASE + 0xFF,
647 .flags = IORESOURCE_MEM,
648 },
649 [1] = {
650 .start = IRQ_TWI0,
651 .end = IRQ_TWI0,
652 .flags = IORESOURCE_IRQ,
653 },
654};
655
656static struct platform_device i2c_bfin_twi0_device = {
657 .name = "i2c-bfin-twi",
658 .id = 0,
659 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
660 .resource = bfin_twi0_resource,
661};
662
Mike Frysinger7160e952007-11-21 16:03:07 +0800663#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800664static struct resource bfin_twi1_resource[] = {
665 [0] = {
666 .start = TWI1_REGBASE,
667 .end = TWI1_REGBASE + 0xFF,
668 .flags = IORESOURCE_MEM,
669 },
670 [1] = {
671 .start = IRQ_TWI1,
672 .end = IRQ_TWI1,
673 .flags = IORESOURCE_IRQ,
674 },
675};
676
677static struct platform_device i2c_bfin_twi1_device = {
678 .name = "i2c-bfin-twi",
679 .id = 1,
680 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
681 .resource = bfin_twi1_resource,
682};
683#endif
Mike Frysinger7160e952007-11-21 16:03:07 +0800684#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800685
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800686#ifdef CONFIG_I2C_BOARDINFO
687static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
688};
689
690#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
691static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
692#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
693 {
694 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800695 },
696#endif
697#if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
698 {
699 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800700 .irq = 212,
701 },
702#endif
703};
704#endif
705#endif
706
Michael Hennerich2463ef22008-01-27 16:49:48 +0800707#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
708#include <linux/gpio_keys.h>
709
710static struct gpio_keys_button bfin_gpio_keys_table[] = {
711 {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
712 {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
713 {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
714 {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
715};
716
717static struct gpio_keys_platform_data bfin_gpio_keys_data = {
718 .buttons = bfin_gpio_keys_table,
719 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
720};
721
722static struct platform_device bfin_device_gpiokeys = {
723 .name = "gpio-keys",
724 .dev = {
725 .platform_data = &bfin_gpio_keys_data,
726 },
727};
728#endif
729
Mike Frysingercad2ab62008-02-22 17:01:31 +0800730static struct resource bfin_gpios_resources = {
731 .start = 0,
732 .end = MAX_BLACKFIN_GPIOS - 1,
733 .flags = IORESOURCE_IRQ,
734};
735
736static struct platform_device bfin_gpios_device = {
737 .name = "simple-gpio",
738 .id = -1,
739 .num_resources = 1,
740 .resource = &bfin_gpios_resources,
741};
742
Michael Hennerich14b03202008-05-07 11:41:26 +0800743static const unsigned int cclk_vlev_datasheet[] =
744{
745/*
746 * Internal VLEV BF54XSBBC1533
747 ****temporarily using these values until data sheet is updated
748 */
749 VRPAIR(VLEV_085, 150000000),
750 VRPAIR(VLEV_090, 250000000),
751 VRPAIR(VLEV_110, 276000000),
752 VRPAIR(VLEV_115, 301000000),
753 VRPAIR(VLEV_120, 525000000),
754 VRPAIR(VLEV_125, 550000000),
755 VRPAIR(VLEV_130, 600000000),
756};
757
758static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
759 .tuple_tab = cclk_vlev_datasheet,
760 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
761 .vr_settling_time = 25 /* us */,
762};
763
764static struct platform_device bfin_dpmc = {
765 .name = "bfin dpmc",
766 .dev = {
767 .platform_data = &bfin_dmpc_vreg_data,
768 },
769};
770
Roy Huang24a07a12007-07-12 22:41:45 +0800771static struct platform_device *ezkit_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +0800772
773 &bfin_dpmc,
774
Roy Huang24a07a12007-07-12 22:41:45 +0800775#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
776 &rtc_device,
777#endif
778
779#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
780 &bfin_uart_device,
781#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800782
Graf Yang5be36d22008-04-25 03:09:15 +0800783#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
784 &bfin_sir_device,
785#endif
786
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800787#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
788 &bf54x_lq043_device,
789#endif
790
791#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
792 &smsc911x_device,
793#endif
794
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800795#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
796 &musb_device,
797#endif
798
799#if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
800 &bfin_atapi_device,
801#endif
802
803#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
804 &bf5xx_nand_device,
805#endif
806
Michael Hennerich3d7e6cf2008-03-03 17:40:28 -0700807#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800808 &bf54x_sdh_device,
809#endif
810
811#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
812 &bf54x_spi_master0,
Bryan Wud4b1d272007-10-21 17:03:55 +0800813 &bf54x_spi_master1,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800814#endif
815
816#if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
817 &bf54x_kpad_device,
818#endif
819
820#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
821 &i2c_bfin_twi0_device,
Mike Frysinger7160e952007-11-21 16:03:07 +0800822#if !defined(CONFIG_BF542)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800823 &i2c_bfin_twi1_device,
824#endif
Mike Frysinger7160e952007-11-21 16:03:07 +0800825#endif
Michael Hennerich2463ef22008-01-27 16:49:48 +0800826
827#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
828 &bfin_device_gpiokeys,
829#endif
Mike Frysingercad2ab62008-02-22 17:01:31 +0800830
831 &bfin_gpios_device,
Mike Frysinger793dc272008-03-26 08:09:12 +0800832
833#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800834 &ezkit_flash_device,
Mike Frysinger793dc272008-03-26 08:09:12 +0800835#endif
Roy Huang24a07a12007-07-12 22:41:45 +0800836};
837
Mike Frysingera01d7a72008-02-02 15:34:56 +0800838static int __init ezkit_init(void)
Roy Huang24a07a12007-07-12 22:41:45 +0800839{
Harvey Harrisonb85d8582008-04-23 09:39:01 +0800840 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800841
842#ifdef CONFIG_I2C_BOARDINFO
843 i2c_register_board_info(0, bfin_i2c_board_info0,
844 ARRAY_SIZE(bfin_i2c_board_info0));
845#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
846 i2c_register_board_info(1, bfin_i2c_board_info1,
847 ARRAY_SIZE(bfin_i2c_board_info1));
848#endif
849#endif
850
Roy Huang24a07a12007-07-12 22:41:45 +0800851 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800852
Mike Frysinger5bda2722008-06-07 15:03:01 +0800853 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800854
Roy Huang24a07a12007-07-12 22:41:45 +0800855 return 0;
856}
857
Mike Frysingera01d7a72008-02-02 15:34:56 +0800858arch_initcall(ezkit_init);