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