blob: dae7c1165f161abe730c5aa8bed31f2cadc739aa [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 Frysingerfe85cad2008-11-18 17:48:22 +080055const char bfin_board_name[] = "ADI 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)
Michael Hennerich3f375692008-11-18 17:48:22 +080062#include <linux/usb/isp1760.h>
63static struct resource bfin_isp1760_resources[] = {
Michael Hennerich0a6304a2008-07-26 16:14:57 +080064 [0] = {
Michael Hennerich0a6304a2008-07-26 16:14:57 +080065 .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
Michael Hennerich3f375692008-11-18 17:48:22 +080076static struct isp1760_platform_data isp1760_priv = {
77 .is_isp1761 = 0,
78 .port1_disable = 0,
79 .bus_width_16 = 1,
80 .port1_otg = 0,
81 .analog_oc = 0,
82 .dack_polarity_high = 0,
83 .dreq_polarity_high = 0,
84};
85
86static struct platform_device bfin_isp1760_device = {
87 .name = "isp1760-hcd",
Michael Hennerich0a6304a2008-07-26 16:14:57 +080088 .id = 0,
Michael Hennerich3f375692008-11-18 17:48:22 +080089 .dev = {
90 .platform_data = &isp1760_priv,
91 },
92 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
93 .resource = bfin_isp1760_resources,
Michael Hennerich0a6304a2008-07-26 16:14:57 +080094};
Michael Hennerich0a6304a2008-07-26 16:14:57 +080095#endif
96
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080097#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
98
Bryan Wu639f6572008-08-27 10:51:02 +080099#include <mach/bf54x-lq043.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800100
101static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
102 .width = 480,
103 .height = 272,
104 .xres = {480, 480, 480},
105 .yres = {272, 272, 272},
106 .bpp = {24, 24, 24},
107 .disp = GPIO_PE3,
108};
109
110static struct resource bf54x_lq043_resources[] = {
111 {
112 .start = IRQ_EPPI0_ERR,
113 .end = IRQ_EPPI0_ERR,
114 .flags = IORESOURCE_IRQ,
115 },
116};
117
118static struct platform_device bf54x_lq043_device = {
119 .name = "bf54x-lq043",
120 .id = -1,
121 .num_resources = ARRAY_SIZE(bf54x_lq043_resources),
122 .resource = bf54x_lq043_resources,
123 .dev = {
124 .platform_data = &bf54x_lq043_data,
125 },
126};
127#endif
128
129#if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
Michael Hennerich8f740ef2007-10-13 00:36:46 -0400130static const unsigned int bf548_keymap[] = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800131 KEYVAL(0, 0, KEY_ENTER),
132 KEYVAL(0, 1, KEY_HELP),
133 KEYVAL(0, 2, KEY_0),
134 KEYVAL(0, 3, KEY_BACKSPACE),
135 KEYVAL(1, 0, KEY_TAB),
136 KEYVAL(1, 1, KEY_9),
137 KEYVAL(1, 2, KEY_8),
138 KEYVAL(1, 3, KEY_7),
139 KEYVAL(2, 0, KEY_DOWN),
140 KEYVAL(2, 1, KEY_6),
141 KEYVAL(2, 2, KEY_5),
142 KEYVAL(2, 3, KEY_4),
143 KEYVAL(3, 0, KEY_UP),
144 KEYVAL(3, 1, KEY_3),
145 KEYVAL(3, 2, KEY_2),
146 KEYVAL(3, 3, KEY_1),
147};
148
149static struct bfin_kpad_platform_data bf54x_kpad_data = {
150 .rows = 4,
151 .cols = 4,
Michael Hennerich8f740ef2007-10-13 00:36:46 -0400152 .keymap = bf548_keymap,
153 .keymapsize = ARRAY_SIZE(bf548_keymap),
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800154 .repeat = 0,
155 .debounce_time = 5000, /* ns (5ms) */
156 .coldrive_time = 1000, /* ns (1ms) */
157 .keyup_test_interval = 50, /* ms (50ms) */
158};
159
160static struct resource bf54x_kpad_resources[] = {
161 {
162 .start = IRQ_KEY,
163 .end = IRQ_KEY,
164 .flags = IORESOURCE_IRQ,
165 },
166};
167
168static struct platform_device bf54x_kpad_device = {
169 .name = "bf54x-keys",
170 .id = -1,
171 .num_resources = ARRAY_SIZE(bf54x_kpad_resources),
172 .resource = bf54x_kpad_resources,
173 .dev = {
174 .platform_data = &bf54x_kpad_data,
175 },
176};
177#endif
178
Michael Hennerichaca5e4a2008-10-08 14:27:59 +0800179#if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE)
180#include <asm/bfin_rotary.h>
181
182static struct bfin_rotary_platform_data bfin_rotary_data = {
183 /*.rotary_up_key = KEY_UP,*/
184 /*.rotary_down_key = KEY_DOWN,*/
185 .rotary_rel_code = REL_WHEEL,
186 .rotary_button_key = KEY_ENTER,
187 .debounce = 10, /* 0..17 */
188 .mode = ROT_QUAD_ENC | ROT_DEBE,
189};
190
191static struct resource bfin_rotary_resources[] = {
192 {
193 .start = IRQ_CNT,
194 .end = IRQ_CNT,
195 .flags = IORESOURCE_IRQ,
196 },
197};
198
199static struct platform_device bfin_rotary_device = {
200 .name = "bfin-rotary",
201 .id = -1,
202 .num_resources = ARRAY_SIZE(bfin_rotary_resources),
203 .resource = bfin_rotary_resources,
204 .dev = {
205 .platform_data = &bfin_rotary_data,
206 },
207};
208#endif
209
Roy Huang24a07a12007-07-12 22:41:45 +0800210#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
211static struct platform_device rtc_device = {
212 .name = "rtc-bfin",
213 .id = -1,
214};
215#endif
216
217#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
218static struct resource bfin_uart_resources[] = {
219#ifdef CONFIG_SERIAL_BFIN_UART0
220 {
221 .start = 0xFFC00400,
222 .end = 0xFFC004FF,
223 .flags = IORESOURCE_MEM,
224 },
225#endif
226#ifdef CONFIG_SERIAL_BFIN_UART1
227 {
228 .start = 0xFFC02000,
229 .end = 0xFFC020FF,
230 .flags = IORESOURCE_MEM,
231 },
232#endif
233#ifdef CONFIG_SERIAL_BFIN_UART2
234 {
235 .start = 0xFFC02100,
236 .end = 0xFFC021FF,
237 .flags = IORESOURCE_MEM,
238 },
239#endif
240#ifdef CONFIG_SERIAL_BFIN_UART3
241 {
242 .start = 0xFFC03100,
243 .end = 0xFFC031FF,
Mike Frysingercc2e16b2008-07-19 16:43:51 +0800244 .flags = IORESOURCE_MEM,
Roy Huang24a07a12007-07-12 22:41:45 +0800245 },
246#endif
247};
248
249static struct platform_device bfin_uart_device = {
250 .name = "bfin-uart",
251 .id = 1,
252 .num_resources = ARRAY_SIZE(bfin_uart_resources),
253 .resource = bfin_uart_resources,
254};
255#endif
256
Graf Yang5be36d22008-04-25 03:09:15 +0800257#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang5be36d22008-04-25 03:09:15 +0800258#ifdef CONFIG_BFIN_SIR0
Graf Yang42bd8bc2009-01-07 23:14:39 +0800259static struct resource bfin_sir0_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800260 {
261 .start = 0xFFC00400,
262 .end = 0xFFC004FF,
263 .flags = IORESOURCE_MEM,
264 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800265 {
266 .start = IRQ_UART0_RX,
267 .end = IRQ_UART0_RX+1,
268 .flags = IORESOURCE_IRQ,
269 },
270 {
271 .start = CH_UART0_RX,
272 .end = CH_UART0_RX+1,
273 .flags = IORESOURCE_DMA,
274 },
275};
276static struct platform_device bfin_sir0_device = {
277 .name = "bfin_sir",
278 .id = 0,
279 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
280 .resource = bfin_sir0_resources,
281};
Graf Yang5be36d22008-04-25 03:09:15 +0800282#endif
283#ifdef CONFIG_BFIN_SIR1
Graf Yang42bd8bc2009-01-07 23:14:39 +0800284static struct resource bfin_sir1_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800285 {
286 .start = 0xFFC02000,
287 .end = 0xFFC020FF,
288 .flags = IORESOURCE_MEM,
289 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800290 {
291 .start = IRQ_UART1_RX,
292 .end = IRQ_UART1_RX+1,
293 .flags = IORESOURCE_IRQ,
294 },
295 {
296 .start = CH_UART1_RX,
297 .end = CH_UART1_RX+1,
298 .flags = IORESOURCE_DMA,
299 },
300};
301static struct platform_device bfin_sir1_device = {
302 .name = "bfin_sir",
303 .id = 1,
304 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
305 .resource = bfin_sir1_resources,
306};
Graf Yang5be36d22008-04-25 03:09:15 +0800307#endif
308#ifdef CONFIG_BFIN_SIR2
Graf Yang42bd8bc2009-01-07 23:14:39 +0800309static struct resource bfin_sir2_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800310 {
311 .start = 0xFFC02100,
312 .end = 0xFFC021FF,
313 .flags = IORESOURCE_MEM,
314 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800315 {
316 .start = IRQ_UART2_RX,
317 .end = IRQ_UART2_RX+1,
318 .flags = IORESOURCE_IRQ,
319 },
320 {
321 .start = CH_UART2_RX,
322 .end = CH_UART2_RX+1,
323 .flags = IORESOURCE_DMA,
324 },
325};
326static struct platform_device bfin_sir2_device = {
327 .name = "bfin_sir",
328 .id = 2,
329 .num_resources = ARRAY_SIZE(bfin_sir2_resources),
330 .resource = bfin_sir2_resources,
331};
Graf Yang5be36d22008-04-25 03:09:15 +0800332#endif
333#ifdef CONFIG_BFIN_SIR3
Graf Yang42bd8bc2009-01-07 23:14:39 +0800334static struct resource bfin_sir3_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800335 {
336 .start = 0xFFC03100,
337 .end = 0xFFC031FF,
338 .flags = IORESOURCE_MEM,
339 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800340 {
341 .start = IRQ_UART3_RX,
342 .end = IRQ_UART3_RX+1,
343 .flags = IORESOURCE_IRQ,
344 },
345 {
346 .start = CH_UART3_RX,
347 .end = CH_UART3_RX+1,
348 .flags = IORESOURCE_DMA,
349 },
Graf Yang5be36d22008-04-25 03:09:15 +0800350};
Graf Yang42bd8bc2009-01-07 23:14:39 +0800351static struct platform_device bfin_sir3_device = {
Graf Yang5be36d22008-04-25 03:09:15 +0800352 .name = "bfin_sir",
Graf Yang42bd8bc2009-01-07 23:14:39 +0800353 .id = 3,
354 .num_resources = ARRAY_SIZE(bfin_sir3_resources),
355 .resource = bfin_sir3_resources,
Graf Yang5be36d22008-04-25 03:09:15 +0800356};
357#endif
Graf Yang42bd8bc2009-01-07 23:14:39 +0800358#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800359
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800360#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
361static struct resource smsc911x_resources[] = {
362 {
363 .name = "smsc911x-memory",
364 .start = 0x24000000,
365 .end = 0x24000000 + 0xFF,
366 .flags = IORESOURCE_MEM,
367 },
368 {
369 .start = IRQ_PE8,
370 .end = IRQ_PE8,
371 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
372 },
373};
374static struct platform_device smsc911x_device = {
375 .name = "smsc911x",
376 .id = 0,
377 .num_resources = ARRAY_SIZE(smsc911x_resources),
378 .resource = smsc911x_resources,
379};
380#endif
381
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800382#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
383static struct resource musb_resources[] = {
384 [0] = {
385 .start = 0xFFC03C00,
386 .end = 0xFFC040FF,
387 .flags = IORESOURCE_MEM,
388 },
389 [1] = { /* general IRQ */
390 .start = IRQ_USB_INT0,
391 .end = IRQ_USB_INT0,
392 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
393 },
394 [2] = { /* DMA IRQ */
395 .start = IRQ_USB_DMA,
396 .end = IRQ_USB_DMA,
397 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
398 },
399};
400
Bryan Wu50041ac2008-10-08 13:39:40 +0800401static struct musb_hdrc_config musb_config = {
402 .multipoint = 0,
403 .dyn_fifo = 0,
404 .soft_con = 1,
405 .dma = 1,
406 .num_eps = 7,
407 .dma_channels = 7,
408 .gpio_vrsel = GPIO_PE7,
409};
410
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800411static struct musb_hdrc_platform_data musb_plat = {
Bryan Wu29350772007-12-24 12:20:19 +0800412#if defined(CONFIG_USB_MUSB_OTG)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800413 .mode = MUSB_OTG,
Bryan Wu29350772007-12-24 12:20:19 +0800414#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800415 .mode = MUSB_HOST,
Bryan Wu29350772007-12-24 12:20:19 +0800416#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800417 .mode = MUSB_PERIPHERAL,
418#endif
Bryan Wu50041ac2008-10-08 13:39:40 +0800419 .config = &musb_config,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800420};
421
422static u64 musb_dmamask = ~(u32)0;
423
424static struct platform_device musb_device = {
425 .name = "musb_hdrc",
426 .id = 0,
427 .dev = {
428 .dma_mask = &musb_dmamask,
429 .coherent_dma_mask = 0xffffffff,
430 .platform_data = &musb_plat,
431 },
432 .num_resources = ARRAY_SIZE(musb_resources),
433 .resource = musb_resources,
434};
435#endif
436
437#if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
438static struct resource bfin_atapi_resources[] = {
439 {
440 .start = 0xFFC03800,
441 .end = 0xFFC0386F,
442 .flags = IORESOURCE_MEM,
443 },
444 {
445 .start = IRQ_ATAPI_ERR,
446 .end = IRQ_ATAPI_ERR,
447 .flags = IORESOURCE_IRQ,
448 },
449};
450
451static struct platform_device bfin_atapi_device = {
452 .name = "pata-bf54x",
453 .id = -1,
454 .num_resources = ARRAY_SIZE(bfin_atapi_resources),
455 .resource = bfin_atapi_resources,
456};
457#endif
458
459#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
460static struct mtd_partition partition_info[] = {
461 {
Robin Getzaa582972008-08-05 17:47:29 +0800462 .name = "linux kernel(nand)",
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800463 .offset = 0,
Mike Frysingerf4585a02008-10-13 14:45:21 +0800464 .size = 4 * 1024 * 1024,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800465 },
466 {
Robin Getzaa582972008-08-05 17:47:29 +0800467 .name = "file system(nand)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800468 .offset = MTDPART_OFS_APPEND,
469 .size = MTDPART_SIZ_FULL,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800470 },
471};
472
473static struct bf5xx_nand_platform bf5xx_nand_platform = {
474 .page_size = NFC_PG_SIZE_256,
475 .data_width = NFC_NWIDTH_8,
476 .partitions = partition_info,
477 .nr_partitions = ARRAY_SIZE(partition_info),
478 .rd_dly = 3,
479 .wr_dly = 3,
480};
481
482static struct resource bf5xx_nand_resources[] = {
483 {
484 .start = 0xFFC03B00,
485 .end = 0xFFC03B4F,
486 .flags = IORESOURCE_MEM,
487 },
488 {
489 .start = CH_NFC,
490 .end = CH_NFC,
491 .flags = IORESOURCE_IRQ,
492 },
493};
494
495static struct platform_device bf5xx_nand_device = {
496 .name = "bf5xx-nand",
497 .id = 0,
498 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
499 .resource = bf5xx_nand_resources,
500 .dev = {
501 .platform_data = &bf5xx_nand_platform,
502 },
503};
504#endif
505
Michael Hennerich3d7e6cf2008-03-03 17:40:28 -0700506#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800507static struct platform_device bf54x_sdh_device = {
508 .name = "bfin-sdh",
509 .id = 0,
510};
511#endif
512
Mike Frysinger793dc272008-03-26 08:09:12 +0800513#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800514static struct mtd_partition ezkit_partitions[] = {
515 {
Robin Getzaa582972008-08-05 17:47:29 +0800516 .name = "bootloader(nor)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800517 .size = 0x40000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800518 .offset = 0,
519 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800520 .name = "linux kernel(nor)",
Mike Frysinger664d0402008-10-09 17:28:36 +0800521 .size = 0x400000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800522 .offset = MTDPART_OFS_APPEND,
523 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800524 .name = "file system(nor)",
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800525 .size = MTDPART_SIZ_FULL,
526 .offset = MTDPART_OFS_APPEND,
527 }
528};
529
530static struct physmap_flash_data ezkit_flash_data = {
531 .width = 2,
532 .parts = ezkit_partitions,
533 .nr_parts = ARRAY_SIZE(ezkit_partitions),
534};
535
536static struct resource ezkit_flash_resource = {
537 .start = 0x20000000,
Mike Frysinger664d0402008-10-09 17:28:36 +0800538 .end = 0x21ffffff,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800539 .flags = IORESOURCE_MEM,
540};
541
542static struct platform_device ezkit_flash_device = {
543 .name = "physmap-flash",
544 .id = 0,
545 .dev = {
546 .platform_data = &ezkit_flash_data,
547 },
548 .num_resources = 1,
549 .resource = &ezkit_flash_resource,
550};
Mike Frysinger793dc272008-03-26 08:09:12 +0800551#endif
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800552
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800553#if defined(CONFIG_MTD_M25P80) \
554 || defined(CONFIG_MTD_M25P80_MODULE)
555/* SPI flash chip (m25p16) */
556static struct mtd_partition bfin_spi_flash_partitions[] = {
557 {
Robin Getzaa582972008-08-05 17:47:29 +0800558 .name = "bootloader(spi)",
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800559 .size = 0x00040000,
560 .offset = 0,
561 .mask_flags = MTD_CAP_ROM
562 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800563 .name = "linux kernel(spi)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800564 .size = MTDPART_SIZ_FULL,
565 .offset = MTDPART_OFS_APPEND,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800566 }
567};
568
569static struct flash_platform_data bfin_spi_flash_data = {
570 .name = "m25p80",
571 .parts = bfin_spi_flash_partitions,
572 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
573 .type = "m25p16",
574};
575
576static struct bfin5xx_spi_chip spi_flash_chip_info = {
577 .enable_dma = 0, /* use dma transfer with this chip*/
578 .bits_per_word = 8,
579 .cs_change_per_word = 0,
580};
581#endif
582
Bernd Schmidt37fa2422008-04-24 05:19:02 +0800583#if defined(CONFIG_SND_BLACKFIN_AD1836) \
584 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
585static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
586 .enable_dma = 0,
587 .bits_per_word = 16,
588};
589#endif
590
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800591#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
592static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
Michael Hennerichc7d48962007-11-15 21:33:31 +0800593 .cs_change_per_word = 0,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800594 .enable_dma = 0,
595 .bits_per_word = 16,
596};
597
598static const struct ad7877_platform_data bfin_ad7877_ts_info = {
599 .model = 7877,
600 .vref_delay_usecs = 50, /* internal, no capacitor */
601 .x_plate_ohms = 419,
602 .y_plate_ohms = 486,
603 .pressure_max = 1000,
604 .pressure_min = 0,
605 .stopacq_polarity = 1,
606 .first_conversion_delay = 3,
607 .acquisition_time = 1,
608 .averaging = 1,
609 .pen_down_acc_interval = 1,
610};
611#endif
612
Michael Hennerich6e668932008-02-09 01:54:09 +0800613#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
614static struct bfin5xx_spi_chip spidev_chip_info = {
615 .enable_dma = 0,
616 .bits_per_word = 8,
617};
618#endif
619
Mike Frysinger5bda2722008-06-07 15:03:01 +0800620static struct spi_board_info bfin_spi_board_info[] __initdata = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800621#if defined(CONFIG_MTD_M25P80) \
622 || defined(CONFIG_MTD_M25P80_MODULE)
623 {
624 /* the modalias must be the same as spi device driver name */
625 .modalias = "m25p80", /* Name of spi_driver for this device */
626 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
627 .bus_num = 0, /* Framework bus number */
628 .chip_select = 1, /* SPI_SSEL1*/
629 .platform_data = &bfin_spi_flash_data,
630 .controller_data = &spi_flash_chip_info,
631 .mode = SPI_MODE_3,
632 },
633#endif
Bernd Schmidt37fa2422008-04-24 05:19:02 +0800634#if defined(CONFIG_SND_BLACKFIN_AD1836) \
635 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
636 {
637 .modalias = "ad1836-spi",
638 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
639 .bus_num = 1,
640 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
641 .controller_data = &ad1836_spi_chip_info,
642 },
643#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800644#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
645{
646 .modalias = "ad7877",
647 .platform_data = &bfin_ad7877_ts_info,
Mike Frysinger1ffb9be2008-10-07 16:06:27 +0800648 .irq = IRQ_PJ11, /* newer boards (Rev 1.4+) use IRQ_PB4 */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800649 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
650 .bus_num = 0,
651 .chip_select = 2,
652 .controller_data = &spi_ad7877_chip_info,
653},
654#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800655#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
656 {
657 .modalias = "spidev",
658 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
659 .bus_num = 0,
660 .chip_select = 1,
661 .controller_data = &spidev_chip_info,
662 },
663#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800664};
665
Mike Frysinger5bda2722008-06-07 15:03:01 +0800666#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800667/* SPI (0) */
668static struct resource bfin_spi0_resource[] = {
669 [0] = {
670 .start = SPI0_REGBASE,
671 .end = SPI0_REGBASE + 0xFF,
672 .flags = IORESOURCE_MEM,
673 },
674 [1] = {
675 .start = CH_SPI0,
676 .end = CH_SPI0,
677 .flags = IORESOURCE_IRQ,
678 }
679};
680
681/* SPI (1) */
682static struct resource bfin_spi1_resource[] = {
683 [0] = {
684 .start = SPI1_REGBASE,
685 .end = SPI1_REGBASE + 0xFF,
686 .flags = IORESOURCE_MEM,
687 },
688 [1] = {
689 .start = CH_SPI1,
690 .end = CH_SPI1,
691 .flags = IORESOURCE_IRQ,
692 }
693};
694
695/* SPI controller data */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800696static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800697 .num_chipselect = 8,
698 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800699 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800700};
701
702static struct platform_device bf54x_spi_master0 = {
703 .name = "bfin-spi",
704 .id = 0, /* Bus number */
705 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
706 .resource = bfin_spi0_resource,
707 .dev = {
Bryan Wu5d448dd2007-11-12 23:24:42 +0800708 .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800709 },
710};
711
Bryan Wu5d448dd2007-11-12 23:24:42 +0800712static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
713 .num_chipselect = 8,
714 .enable_dma = 1, /* master has the ability to do dma transfer */
715 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
716};
717
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800718static struct platform_device bf54x_spi_master1 = {
719 .name = "bfin-spi",
720 .id = 1, /* Bus number */
721 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
722 .resource = bfin_spi1_resource,
723 .dev = {
Bryan Wu5d448dd2007-11-12 23:24:42 +0800724 .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800725 },
726};
727#endif /* spi master and devices */
728
729#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
730static struct resource bfin_twi0_resource[] = {
731 [0] = {
732 .start = TWI0_REGBASE,
733 .end = TWI0_REGBASE + 0xFF,
734 .flags = IORESOURCE_MEM,
735 },
736 [1] = {
737 .start = IRQ_TWI0,
738 .end = IRQ_TWI0,
739 .flags = IORESOURCE_IRQ,
740 },
741};
742
743static struct platform_device i2c_bfin_twi0_device = {
744 .name = "i2c-bfin-twi",
745 .id = 0,
746 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
747 .resource = bfin_twi0_resource,
748};
749
Mike Frysinger7160e9502007-11-21 16:03:07 +0800750#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800751static struct resource bfin_twi1_resource[] = {
752 [0] = {
753 .start = TWI1_REGBASE,
754 .end = TWI1_REGBASE + 0xFF,
755 .flags = IORESOURCE_MEM,
756 },
757 [1] = {
758 .start = IRQ_TWI1,
759 .end = IRQ_TWI1,
760 .flags = IORESOURCE_IRQ,
761 },
762};
763
764static struct platform_device i2c_bfin_twi1_device = {
765 .name = "i2c-bfin-twi",
766 .id = 1,
767 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
768 .resource = bfin_twi1_resource,
769};
770#endif
Mike Frysinger7160e9502007-11-21 16:03:07 +0800771#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800772
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800773#ifdef CONFIG_I2C_BOARDINFO
774static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
775};
776
777#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
778static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
779#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
780 {
781 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800782 },
783#endif
784#if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
785 {
786 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800787 .irq = 212,
788 },
789#endif
790};
791#endif
792#endif
793
Michael Hennerich2463ef22008-01-27 16:49:48 +0800794#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
795#include <linux/gpio_keys.h>
796
797static struct gpio_keys_button bfin_gpio_keys_table[] = {
798 {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
799 {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
800 {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
801 {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
802};
803
804static struct gpio_keys_platform_data bfin_gpio_keys_data = {
805 .buttons = bfin_gpio_keys_table,
806 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
807};
808
809static struct platform_device bfin_device_gpiokeys = {
810 .name = "gpio-keys",
811 .dev = {
812 .platform_data = &bfin_gpio_keys_data,
813 },
814};
815#endif
816
Mike Frysingercad2ab62008-02-22 17:01:31 +0800817static struct resource bfin_gpios_resources = {
818 .start = 0,
819 .end = MAX_BLACKFIN_GPIOS - 1,
820 .flags = IORESOURCE_IRQ,
821};
822
823static struct platform_device bfin_gpios_device = {
824 .name = "simple-gpio",
825 .id = -1,
826 .num_resources = 1,
827 .resource = &bfin_gpios_resources,
828};
829
Michael Hennerich14b03202008-05-07 11:41:26 +0800830static const unsigned int cclk_vlev_datasheet[] =
831{
832/*
833 * Internal VLEV BF54XSBBC1533
834 ****temporarily using these values until data sheet is updated
835 */
836 VRPAIR(VLEV_085, 150000000),
837 VRPAIR(VLEV_090, 250000000),
838 VRPAIR(VLEV_110, 276000000),
839 VRPAIR(VLEV_115, 301000000),
840 VRPAIR(VLEV_120, 525000000),
841 VRPAIR(VLEV_125, 550000000),
842 VRPAIR(VLEV_130, 600000000),
843};
844
845static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
846 .tuple_tab = cclk_vlev_datasheet,
847 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
848 .vr_settling_time = 25 /* us */,
849};
850
851static struct platform_device bfin_dpmc = {
852 .name = "bfin dpmc",
853 .dev = {
854 .platform_data = &bfin_dmpc_vreg_data,
855 },
856};
857
Roy Huang24a07a12007-07-12 22:41:45 +0800858static struct platform_device *ezkit_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +0800859
860 &bfin_dpmc,
861
Roy Huang24a07a12007-07-12 22:41:45 +0800862#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
863 &rtc_device,
864#endif
865
866#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
867 &bfin_uart_device,
868#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800869
Graf Yang5be36d22008-04-25 03:09:15 +0800870#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang42bd8bc2009-01-07 23:14:39 +0800871#ifdef CONFIG_BFIN_SIR0
872 &bfin_sir0_device,
873#endif
874#ifdef CONFIG_BFIN_SIR1
875 &bfin_sir1_device,
876#endif
877#ifdef CONFIG_BFIN_SIR2
878 &bfin_sir2_device,
879#endif
880#ifdef CONFIG_BFIN_SIR3
881 &bfin_sir3_device,
882#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800883#endif
884
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800885#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
886 &bf54x_lq043_device,
887#endif
888
889#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
890 &smsc911x_device,
891#endif
892
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800893#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
894 &musb_device,
895#endif
896
Michael Hennerich3f375692008-11-18 17:48:22 +0800897#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
898 &bfin_isp1760_device,
899#endif
900
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800901#if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
902 &bfin_atapi_device,
903#endif
904
905#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
906 &bf5xx_nand_device,
907#endif
908
Michael Hennerich3d7e6cf2008-03-03 17:40:28 -0700909#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800910 &bf54x_sdh_device,
911#endif
912
913#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
914 &bf54x_spi_master0,
Bryan Wud4b1d272007-10-21 17:03:55 +0800915 &bf54x_spi_master1,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800916#endif
917
918#if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
919 &bf54x_kpad_device,
920#endif
921
Michael Hennerichaca5e4a2008-10-08 14:27:59 +0800922#if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE)
923 &bfin_rotary_device,
924#endif
925
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800926#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
927 &i2c_bfin_twi0_device,
Mike Frysinger7160e9502007-11-21 16:03:07 +0800928#if !defined(CONFIG_BF542)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800929 &i2c_bfin_twi1_device,
930#endif
Mike Frysinger7160e9502007-11-21 16:03:07 +0800931#endif
Michael Hennerich2463ef22008-01-27 16:49:48 +0800932
933#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
934 &bfin_device_gpiokeys,
935#endif
Mike Frysingercad2ab62008-02-22 17:01:31 +0800936
937 &bfin_gpios_device,
Mike Frysinger793dc272008-03-26 08:09:12 +0800938
939#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800940 &ezkit_flash_device,
Mike Frysinger793dc272008-03-26 08:09:12 +0800941#endif
Roy Huang24a07a12007-07-12 22:41:45 +0800942};
943
Mike Frysingera01d7a72008-02-02 15:34:56 +0800944static int __init ezkit_init(void)
Roy Huang24a07a12007-07-12 22:41:45 +0800945{
Harvey Harrisonb85d8582008-04-23 09:39:01 +0800946 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800947
948#ifdef CONFIG_I2C_BOARDINFO
949 i2c_register_board_info(0, bfin_i2c_board_info0,
950 ARRAY_SIZE(bfin_i2c_board_info0));
951#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
952 i2c_register_board_info(1, bfin_i2c_board_info1,
953 ARRAY_SIZE(bfin_i2c_board_info1));
954#endif
955#endif
956
Roy Huang24a07a12007-07-12 22:41:45 +0800957 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800958
Mike Frysinger5bda2722008-06-07 15:03:01 +0800959 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800960
Roy Huang24a07a12007-07-12 22:41:45 +0800961 return 0;
962}
963
Mike Frysingera01d7a72008-02-02 15:34:56 +0800964arch_initcall(ezkit_init);