blob: 7c08b9f1838a381e444c6447ab8e37ef88a72cfb [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
Michael Hennerichaca5e4a2008-10-08 14:27:59 +0800186#if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE)
187#include <asm/bfin_rotary.h>
188
189static struct bfin_rotary_platform_data bfin_rotary_data = {
190 /*.rotary_up_key = KEY_UP,*/
191 /*.rotary_down_key = KEY_DOWN,*/
192 .rotary_rel_code = REL_WHEEL,
193 .rotary_button_key = KEY_ENTER,
194 .debounce = 10, /* 0..17 */
195 .mode = ROT_QUAD_ENC | ROT_DEBE,
196};
197
198static struct resource bfin_rotary_resources[] = {
199 {
200 .start = IRQ_CNT,
201 .end = IRQ_CNT,
202 .flags = IORESOURCE_IRQ,
203 },
204};
205
206static struct platform_device bfin_rotary_device = {
207 .name = "bfin-rotary",
208 .id = -1,
209 .num_resources = ARRAY_SIZE(bfin_rotary_resources),
210 .resource = bfin_rotary_resources,
211 .dev = {
212 .platform_data = &bfin_rotary_data,
213 },
214};
215#endif
216
Roy Huang24a07a12007-07-12 22:41:45 +0800217#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
218static struct platform_device rtc_device = {
219 .name = "rtc-bfin",
220 .id = -1,
221};
222#endif
223
224#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
225static struct resource bfin_uart_resources[] = {
226#ifdef CONFIG_SERIAL_BFIN_UART0
227 {
228 .start = 0xFFC00400,
229 .end = 0xFFC004FF,
230 .flags = IORESOURCE_MEM,
231 },
232#endif
233#ifdef CONFIG_SERIAL_BFIN_UART1
234 {
235 .start = 0xFFC02000,
236 .end = 0xFFC020FF,
237 .flags = IORESOURCE_MEM,
238 },
239#endif
240#ifdef CONFIG_SERIAL_BFIN_UART2
241 {
242 .start = 0xFFC02100,
243 .end = 0xFFC021FF,
244 .flags = IORESOURCE_MEM,
245 },
246#endif
247#ifdef CONFIG_SERIAL_BFIN_UART3
248 {
249 .start = 0xFFC03100,
250 .end = 0xFFC031FF,
Mike Frysingercc2e16b2008-07-19 16:43:51 +0800251 .flags = IORESOURCE_MEM,
Roy Huang24a07a12007-07-12 22:41:45 +0800252 },
253#endif
254};
255
256static struct platform_device bfin_uart_device = {
257 .name = "bfin-uart",
258 .id = 1,
259 .num_resources = ARRAY_SIZE(bfin_uart_resources),
260 .resource = bfin_uart_resources,
261};
262#endif
263
Graf Yang5be36d22008-04-25 03:09:15 +0800264#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
265static struct resource bfin_sir_resources[] = {
266#ifdef CONFIG_BFIN_SIR0
267 {
268 .start = 0xFFC00400,
269 .end = 0xFFC004FF,
270 .flags = IORESOURCE_MEM,
271 },
272#endif
273#ifdef CONFIG_BFIN_SIR1
274 {
275 .start = 0xFFC02000,
276 .end = 0xFFC020FF,
277 .flags = IORESOURCE_MEM,
278 },
279#endif
280#ifdef CONFIG_BFIN_SIR2
281 {
282 .start = 0xFFC02100,
283 .end = 0xFFC021FF,
284 .flags = IORESOURCE_MEM,
285 },
286#endif
287#ifdef CONFIG_BFIN_SIR3
288 {
289 .start = 0xFFC03100,
290 .end = 0xFFC031FF,
291 .flags = IORESOURCE_MEM,
292 },
293#endif
294};
295
296static struct platform_device bfin_sir_device = {
297 .name = "bfin_sir",
298 .id = 0,
299 .num_resources = ARRAY_SIZE(bfin_sir_resources),
300 .resource = bfin_sir_resources,
301};
302#endif
303
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800304#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
305static struct resource smsc911x_resources[] = {
306 {
307 .name = "smsc911x-memory",
308 .start = 0x24000000,
309 .end = 0x24000000 + 0xFF,
310 .flags = IORESOURCE_MEM,
311 },
312 {
313 .start = IRQ_PE8,
314 .end = IRQ_PE8,
315 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
316 },
317};
318static struct platform_device smsc911x_device = {
319 .name = "smsc911x",
320 .id = 0,
321 .num_resources = ARRAY_SIZE(smsc911x_resources),
322 .resource = smsc911x_resources,
323};
324#endif
325
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800326#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
327static struct resource musb_resources[] = {
328 [0] = {
329 .start = 0xFFC03C00,
330 .end = 0xFFC040FF,
331 .flags = IORESOURCE_MEM,
332 },
333 [1] = { /* general IRQ */
334 .start = IRQ_USB_INT0,
335 .end = IRQ_USB_INT0,
336 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
337 },
338 [2] = { /* DMA IRQ */
339 .start = IRQ_USB_DMA,
340 .end = IRQ_USB_DMA,
341 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
342 },
343};
344
Bryan Wu50041ac2008-10-08 13:39:40 +0800345static struct musb_hdrc_config musb_config = {
346 .multipoint = 0,
347 .dyn_fifo = 0,
348 .soft_con = 1,
349 .dma = 1,
350 .num_eps = 7,
351 .dma_channels = 7,
352 .gpio_vrsel = GPIO_PE7,
353};
354
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800355static struct musb_hdrc_platform_data musb_plat = {
Bryan Wu29350772007-12-24 12:20:19 +0800356#if defined(CONFIG_USB_MUSB_OTG)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800357 .mode = MUSB_OTG,
Bryan Wu29350772007-12-24 12:20:19 +0800358#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800359 .mode = MUSB_HOST,
Bryan Wu29350772007-12-24 12:20:19 +0800360#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800361 .mode = MUSB_PERIPHERAL,
362#endif
Bryan Wu50041ac2008-10-08 13:39:40 +0800363 .config = &musb_config,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800364};
365
366static u64 musb_dmamask = ~(u32)0;
367
368static struct platform_device musb_device = {
369 .name = "musb_hdrc",
370 .id = 0,
371 .dev = {
372 .dma_mask = &musb_dmamask,
373 .coherent_dma_mask = 0xffffffff,
374 .platform_data = &musb_plat,
375 },
376 .num_resources = ARRAY_SIZE(musb_resources),
377 .resource = musb_resources,
378};
379#endif
380
381#if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
382static struct resource bfin_atapi_resources[] = {
383 {
384 .start = 0xFFC03800,
385 .end = 0xFFC0386F,
386 .flags = IORESOURCE_MEM,
387 },
388 {
389 .start = IRQ_ATAPI_ERR,
390 .end = IRQ_ATAPI_ERR,
391 .flags = IORESOURCE_IRQ,
392 },
393};
394
395static struct platform_device bfin_atapi_device = {
396 .name = "pata-bf54x",
397 .id = -1,
398 .num_resources = ARRAY_SIZE(bfin_atapi_resources),
399 .resource = bfin_atapi_resources,
400};
401#endif
402
403#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
404static struct mtd_partition partition_info[] = {
405 {
Robin Getzaa582972008-08-05 17:47:29 +0800406 .name = "linux kernel(nand)",
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800407 .offset = 0,
Mike Frysingerf4585a02008-10-13 14:45:21 +0800408 .size = 4 * 1024 * 1024,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800409 },
410 {
Robin Getzaa582972008-08-05 17:47:29 +0800411 .name = "file system(nand)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800412 .offset = MTDPART_OFS_APPEND,
413 .size = MTDPART_SIZ_FULL,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800414 },
415};
416
417static struct bf5xx_nand_platform bf5xx_nand_platform = {
418 .page_size = NFC_PG_SIZE_256,
419 .data_width = NFC_NWIDTH_8,
420 .partitions = partition_info,
421 .nr_partitions = ARRAY_SIZE(partition_info),
422 .rd_dly = 3,
423 .wr_dly = 3,
424};
425
426static struct resource bf5xx_nand_resources[] = {
427 {
428 .start = 0xFFC03B00,
429 .end = 0xFFC03B4F,
430 .flags = IORESOURCE_MEM,
431 },
432 {
433 .start = CH_NFC,
434 .end = CH_NFC,
435 .flags = IORESOURCE_IRQ,
436 },
437};
438
439static struct platform_device bf5xx_nand_device = {
440 .name = "bf5xx-nand",
441 .id = 0,
442 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
443 .resource = bf5xx_nand_resources,
444 .dev = {
445 .platform_data = &bf5xx_nand_platform,
446 },
447};
448#endif
449
Michael Hennerich3d7e6cf2008-03-03 17:40:28 -0700450#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800451static struct platform_device bf54x_sdh_device = {
452 .name = "bfin-sdh",
453 .id = 0,
454};
455#endif
456
Mike Frysinger793dc272008-03-26 08:09:12 +0800457#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800458static struct mtd_partition ezkit_partitions[] = {
459 {
Robin Getzaa582972008-08-05 17:47:29 +0800460 .name = "bootloader(nor)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800461 .size = 0x40000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800462 .offset = 0,
463 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800464 .name = "linux kernel(nor)",
Grace Panac76d882008-04-24 06:33:56 +0800465 .size = 0x1C0000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800466 .offset = MTDPART_OFS_APPEND,
467 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800468 .name = "file system(nor)",
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800469 .size = MTDPART_SIZ_FULL,
470 .offset = MTDPART_OFS_APPEND,
471 }
472};
473
474static struct physmap_flash_data ezkit_flash_data = {
475 .width = 2,
476 .parts = ezkit_partitions,
477 .nr_parts = ARRAY_SIZE(ezkit_partitions),
478};
479
480static struct resource ezkit_flash_resource = {
481 .start = 0x20000000,
482 .end = 0x20ffffff,
483 .flags = IORESOURCE_MEM,
484};
485
486static struct platform_device ezkit_flash_device = {
487 .name = "physmap-flash",
488 .id = 0,
489 .dev = {
490 .platform_data = &ezkit_flash_data,
491 },
492 .num_resources = 1,
493 .resource = &ezkit_flash_resource,
494};
Mike Frysinger793dc272008-03-26 08:09:12 +0800495#endif
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800496
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800497#if defined(CONFIG_MTD_M25P80) \
498 || defined(CONFIG_MTD_M25P80_MODULE)
499/* SPI flash chip (m25p16) */
500static struct mtd_partition bfin_spi_flash_partitions[] = {
501 {
Robin Getzaa582972008-08-05 17:47:29 +0800502 .name = "bootloader(spi)",
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800503 .size = 0x00040000,
504 .offset = 0,
505 .mask_flags = MTD_CAP_ROM
506 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800507 .name = "linux kernel(spi)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800508 .size = MTDPART_SIZ_FULL,
509 .offset = MTDPART_OFS_APPEND,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800510 }
511};
512
513static struct flash_platform_data bfin_spi_flash_data = {
514 .name = "m25p80",
515 .parts = bfin_spi_flash_partitions,
516 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
517 .type = "m25p16",
518};
519
520static struct bfin5xx_spi_chip spi_flash_chip_info = {
521 .enable_dma = 0, /* use dma transfer with this chip*/
522 .bits_per_word = 8,
523 .cs_change_per_word = 0,
524};
525#endif
526
Bernd Schmidt37fa2422008-04-24 05:19:02 +0800527#if defined(CONFIG_SND_BLACKFIN_AD1836) \
528 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
529static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
530 .enable_dma = 0,
531 .bits_per_word = 16,
532};
533#endif
534
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800535#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
536static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
Michael Hennerichc7d48962007-11-15 21:33:31 +0800537 .cs_change_per_word = 0,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800538 .enable_dma = 0,
539 .bits_per_word = 16,
540};
541
542static const struct ad7877_platform_data bfin_ad7877_ts_info = {
543 .model = 7877,
544 .vref_delay_usecs = 50, /* internal, no capacitor */
545 .x_plate_ohms = 419,
546 .y_plate_ohms = 486,
547 .pressure_max = 1000,
548 .pressure_min = 0,
549 .stopacq_polarity = 1,
550 .first_conversion_delay = 3,
551 .acquisition_time = 1,
552 .averaging = 1,
553 .pen_down_acc_interval = 1,
554};
555#endif
556
Michael Hennerich6e668932008-02-09 01:54:09 +0800557#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
558static struct bfin5xx_spi_chip spidev_chip_info = {
559 .enable_dma = 0,
560 .bits_per_word = 8,
561};
562#endif
563
Mike Frysinger5bda2722008-06-07 15:03:01 +0800564static struct spi_board_info bfin_spi_board_info[] __initdata = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800565#if defined(CONFIG_MTD_M25P80) \
566 || defined(CONFIG_MTD_M25P80_MODULE)
567 {
568 /* the modalias must be the same as spi device driver name */
569 .modalias = "m25p80", /* Name of spi_driver for this device */
570 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
571 .bus_num = 0, /* Framework bus number */
572 .chip_select = 1, /* SPI_SSEL1*/
573 .platform_data = &bfin_spi_flash_data,
574 .controller_data = &spi_flash_chip_info,
575 .mode = SPI_MODE_3,
576 },
577#endif
Bernd Schmidt37fa2422008-04-24 05:19:02 +0800578#if defined(CONFIG_SND_BLACKFIN_AD1836) \
579 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
580 {
581 .modalias = "ad1836-spi",
582 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
583 .bus_num = 1,
584 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
585 .controller_data = &ad1836_spi_chip_info,
586 },
587#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800588#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
589{
590 .modalias = "ad7877",
591 .platform_data = &bfin_ad7877_ts_info,
Mike Frysinger1ffb9be2008-10-07 16:06:27 +0800592 .irq = IRQ_PJ11, /* newer boards (Rev 1.4+) use IRQ_PB4 */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800593 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
594 .bus_num = 0,
595 .chip_select = 2,
596 .controller_data = &spi_ad7877_chip_info,
597},
598#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800599#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
600 {
601 .modalias = "spidev",
602 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
603 .bus_num = 0,
604 .chip_select = 1,
605 .controller_data = &spidev_chip_info,
606 },
607#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800608};
609
Mike Frysinger5bda2722008-06-07 15:03:01 +0800610#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800611/* SPI (0) */
612static struct resource bfin_spi0_resource[] = {
613 [0] = {
614 .start = SPI0_REGBASE,
615 .end = SPI0_REGBASE + 0xFF,
616 .flags = IORESOURCE_MEM,
617 },
618 [1] = {
619 .start = CH_SPI0,
620 .end = CH_SPI0,
621 .flags = IORESOURCE_IRQ,
622 }
623};
624
625/* SPI (1) */
626static struct resource bfin_spi1_resource[] = {
627 [0] = {
628 .start = SPI1_REGBASE,
629 .end = SPI1_REGBASE + 0xFF,
630 .flags = IORESOURCE_MEM,
631 },
632 [1] = {
633 .start = CH_SPI1,
634 .end = CH_SPI1,
635 .flags = IORESOURCE_IRQ,
636 }
637};
638
639/* SPI controller data */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800640static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800641 .num_chipselect = 8,
642 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800643 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800644};
645
646static struct platform_device bf54x_spi_master0 = {
647 .name = "bfin-spi",
648 .id = 0, /* Bus number */
649 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
650 .resource = bfin_spi0_resource,
651 .dev = {
Bryan Wu5d448dd2007-11-12 23:24:42 +0800652 .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800653 },
654};
655
Bryan Wu5d448dd2007-11-12 23:24:42 +0800656static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
657 .num_chipselect = 8,
658 .enable_dma = 1, /* master has the ability to do dma transfer */
659 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
660};
661
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800662static struct platform_device bf54x_spi_master1 = {
663 .name = "bfin-spi",
664 .id = 1, /* Bus number */
665 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
666 .resource = bfin_spi1_resource,
667 .dev = {
Bryan Wu5d448dd2007-11-12 23:24:42 +0800668 .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800669 },
670};
671#endif /* spi master and devices */
672
673#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
674static struct resource bfin_twi0_resource[] = {
675 [0] = {
676 .start = TWI0_REGBASE,
677 .end = TWI0_REGBASE + 0xFF,
678 .flags = IORESOURCE_MEM,
679 },
680 [1] = {
681 .start = IRQ_TWI0,
682 .end = IRQ_TWI0,
683 .flags = IORESOURCE_IRQ,
684 },
685};
686
687static struct platform_device i2c_bfin_twi0_device = {
688 .name = "i2c-bfin-twi",
689 .id = 0,
690 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
691 .resource = bfin_twi0_resource,
692};
693
Mike Frysinger7160e952007-11-21 16:03:07 +0800694#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800695static struct resource bfin_twi1_resource[] = {
696 [0] = {
697 .start = TWI1_REGBASE,
698 .end = TWI1_REGBASE + 0xFF,
699 .flags = IORESOURCE_MEM,
700 },
701 [1] = {
702 .start = IRQ_TWI1,
703 .end = IRQ_TWI1,
704 .flags = IORESOURCE_IRQ,
705 },
706};
707
708static struct platform_device i2c_bfin_twi1_device = {
709 .name = "i2c-bfin-twi",
710 .id = 1,
711 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
712 .resource = bfin_twi1_resource,
713};
714#endif
Mike Frysinger7160e952007-11-21 16:03:07 +0800715#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800716
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800717#ifdef CONFIG_I2C_BOARDINFO
718static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
719};
720
721#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
722static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
723#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
724 {
725 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800726 },
727#endif
728#if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
729 {
730 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800731 .irq = 212,
732 },
733#endif
734};
735#endif
736#endif
737
Michael Hennerich2463ef22008-01-27 16:49:48 +0800738#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
739#include <linux/gpio_keys.h>
740
741static struct gpio_keys_button bfin_gpio_keys_table[] = {
742 {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
743 {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
744 {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
745 {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
746};
747
748static struct gpio_keys_platform_data bfin_gpio_keys_data = {
749 .buttons = bfin_gpio_keys_table,
750 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
751};
752
753static struct platform_device bfin_device_gpiokeys = {
754 .name = "gpio-keys",
755 .dev = {
756 .platform_data = &bfin_gpio_keys_data,
757 },
758};
759#endif
760
Mike Frysingercad2ab62008-02-22 17:01:31 +0800761static struct resource bfin_gpios_resources = {
762 .start = 0,
763 .end = MAX_BLACKFIN_GPIOS - 1,
764 .flags = IORESOURCE_IRQ,
765};
766
767static struct platform_device bfin_gpios_device = {
768 .name = "simple-gpio",
769 .id = -1,
770 .num_resources = 1,
771 .resource = &bfin_gpios_resources,
772};
773
Michael Hennerich14b03202008-05-07 11:41:26 +0800774static const unsigned int cclk_vlev_datasheet[] =
775{
776/*
777 * Internal VLEV BF54XSBBC1533
778 ****temporarily using these values until data sheet is updated
779 */
780 VRPAIR(VLEV_085, 150000000),
781 VRPAIR(VLEV_090, 250000000),
782 VRPAIR(VLEV_110, 276000000),
783 VRPAIR(VLEV_115, 301000000),
784 VRPAIR(VLEV_120, 525000000),
785 VRPAIR(VLEV_125, 550000000),
786 VRPAIR(VLEV_130, 600000000),
787};
788
789static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
790 .tuple_tab = cclk_vlev_datasheet,
791 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
792 .vr_settling_time = 25 /* us */,
793};
794
795static struct platform_device bfin_dpmc = {
796 .name = "bfin dpmc",
797 .dev = {
798 .platform_data = &bfin_dmpc_vreg_data,
799 },
800};
801
Roy Huang24a07a12007-07-12 22:41:45 +0800802static struct platform_device *ezkit_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +0800803
804 &bfin_dpmc,
805
Roy Huang24a07a12007-07-12 22:41:45 +0800806#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
807 &rtc_device,
808#endif
809
810#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
811 &bfin_uart_device,
812#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800813
Graf Yang5be36d22008-04-25 03:09:15 +0800814#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
815 &bfin_sir_device,
816#endif
817
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800818#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
819 &bf54x_lq043_device,
820#endif
821
822#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
823 &smsc911x_device,
824#endif
825
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800826#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
827 &musb_device,
828#endif
829
830#if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
831 &bfin_atapi_device,
832#endif
833
834#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
835 &bf5xx_nand_device,
836#endif
837
Michael Hennerich3d7e6cf2008-03-03 17:40:28 -0700838#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800839 &bf54x_sdh_device,
840#endif
841
842#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
843 &bf54x_spi_master0,
Bryan Wud4b1d272007-10-21 17:03:55 +0800844 &bf54x_spi_master1,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800845#endif
846
847#if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
848 &bf54x_kpad_device,
849#endif
850
Michael Hennerichaca5e4a2008-10-08 14:27:59 +0800851#if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE)
852 &bfin_rotary_device,
853#endif
854
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800855#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
856 &i2c_bfin_twi0_device,
Mike Frysinger7160e952007-11-21 16:03:07 +0800857#if !defined(CONFIG_BF542)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800858 &i2c_bfin_twi1_device,
859#endif
Mike Frysinger7160e952007-11-21 16:03:07 +0800860#endif
Michael Hennerich2463ef22008-01-27 16:49:48 +0800861
862#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
863 &bfin_device_gpiokeys,
864#endif
Mike Frysingercad2ab62008-02-22 17:01:31 +0800865
866 &bfin_gpios_device,
Mike Frysinger793dc272008-03-26 08:09:12 +0800867
868#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800869 &ezkit_flash_device,
Mike Frysinger793dc272008-03-26 08:09:12 +0800870#endif
Roy Huang24a07a12007-07-12 22:41:45 +0800871};
872
Mike Frysingera01d7a72008-02-02 15:34:56 +0800873static int __init ezkit_init(void)
Roy Huang24a07a12007-07-12 22:41:45 +0800874{
Harvey Harrisonb85d8582008-04-23 09:39:01 +0800875 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800876
877#ifdef CONFIG_I2C_BOARDINFO
878 i2c_register_board_info(0, bfin_i2c_board_info0,
879 ARRAY_SIZE(bfin_i2c_board_info0));
880#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
881 i2c_register_board_info(1, bfin_i2c_board_info1,
882 ARRAY_SIZE(bfin_i2c_board_info1));
883#endif
884#endif
885
Roy Huang24a07a12007-07-12 22:41:45 +0800886 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800887
Mike Frysinger5bda2722008-06-07 15:03:01 +0800888 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800889
Roy Huang24a07a12007-07-12 22:41:45 +0800890 return 0;
891}
892
Mike Frysingera01d7a72008-02-02 15:34:56 +0800893arch_initcall(ezkit_init);