blob: d0816817f7c14a47e64dc5103059c53e3aa87238 [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>
Cliff Cai501674a2009-01-07 23:14:38 +080048#include <asm/bfin_sdh.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 Frysingerfe85cad2008-11-18 17:48:22 +080056const char bfin_board_name[] = "ADI 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)
Michael Hennerich3f375692008-11-18 17:48:22 +080063#include <linux/usb/isp1760.h>
64static struct resource bfin_isp1760_resources[] = {
Michael Hennerich0a6304a2008-07-26 16:14:57 +080065 [0] = {
Michael Hennerich0a6304a2008-07-26 16:14:57 +080066 .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
Michael Hennerich3f375692008-11-18 17:48:22 +080077static struct isp1760_platform_data isp1760_priv = {
78 .is_isp1761 = 0,
79 .port1_disable = 0,
80 .bus_width_16 = 1,
81 .port1_otg = 0,
82 .analog_oc = 0,
83 .dack_polarity_high = 0,
84 .dreq_polarity_high = 0,
85};
86
87static struct platform_device bfin_isp1760_device = {
88 .name = "isp1760-hcd",
Michael Hennerich0a6304a2008-07-26 16:14:57 +080089 .id = 0,
Michael Hennerich3f375692008-11-18 17:48:22 +080090 .dev = {
91 .platform_data = &isp1760_priv,
92 },
93 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
94 .resource = bfin_isp1760_resources,
Michael Hennerich0a6304a2008-07-26 16:14:57 +080095};
Michael Hennerich0a6304a2008-07-26 16:14:57 +080096#endif
97
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080098#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
99
Bryan Wu639f6572008-08-27 10:51:02 +0800100#include <mach/bf54x-lq043.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800101
102static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
103 .width = 480,
104 .height = 272,
105 .xres = {480, 480, 480},
106 .yres = {272, 272, 272},
107 .bpp = {24, 24, 24},
108 .disp = GPIO_PE3,
109};
110
111static struct resource bf54x_lq043_resources[] = {
112 {
113 .start = IRQ_EPPI0_ERR,
114 .end = IRQ_EPPI0_ERR,
115 .flags = IORESOURCE_IRQ,
116 },
117};
118
119static struct platform_device bf54x_lq043_device = {
120 .name = "bf54x-lq043",
121 .id = -1,
122 .num_resources = ARRAY_SIZE(bf54x_lq043_resources),
123 .resource = bf54x_lq043_resources,
124 .dev = {
125 .platform_data = &bf54x_lq043_data,
126 },
127};
128#endif
129
130#if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
Michael Hennerich8f740ef2007-10-13 00:36:46 -0400131static const unsigned int bf548_keymap[] = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800132 KEYVAL(0, 0, KEY_ENTER),
133 KEYVAL(0, 1, KEY_HELP),
134 KEYVAL(0, 2, KEY_0),
135 KEYVAL(0, 3, KEY_BACKSPACE),
136 KEYVAL(1, 0, KEY_TAB),
137 KEYVAL(1, 1, KEY_9),
138 KEYVAL(1, 2, KEY_8),
139 KEYVAL(1, 3, KEY_7),
140 KEYVAL(2, 0, KEY_DOWN),
141 KEYVAL(2, 1, KEY_6),
142 KEYVAL(2, 2, KEY_5),
143 KEYVAL(2, 3, KEY_4),
144 KEYVAL(3, 0, KEY_UP),
145 KEYVAL(3, 1, KEY_3),
146 KEYVAL(3, 2, KEY_2),
147 KEYVAL(3, 3, KEY_1),
148};
149
150static struct bfin_kpad_platform_data bf54x_kpad_data = {
151 .rows = 4,
152 .cols = 4,
Michael Hennerich8f740ef2007-10-13 00:36:46 -0400153 .keymap = bf548_keymap,
154 .keymapsize = ARRAY_SIZE(bf548_keymap),
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800155 .repeat = 0,
156 .debounce_time = 5000, /* ns (5ms) */
157 .coldrive_time = 1000, /* ns (1ms) */
158 .keyup_test_interval = 50, /* ms (50ms) */
159};
160
161static struct resource bf54x_kpad_resources[] = {
162 {
163 .start = IRQ_KEY,
164 .end = IRQ_KEY,
165 .flags = IORESOURCE_IRQ,
166 },
167};
168
169static struct platform_device bf54x_kpad_device = {
170 .name = "bf54x-keys",
171 .id = -1,
172 .num_resources = ARRAY_SIZE(bf54x_kpad_resources),
173 .resource = bf54x_kpad_resources,
174 .dev = {
175 .platform_data = &bf54x_kpad_data,
176 },
177};
178#endif
179
Michael Hennerichaca5e4a2008-10-08 14:27:59 +0800180#if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE)
181#include <asm/bfin_rotary.h>
182
183static struct bfin_rotary_platform_data bfin_rotary_data = {
184 /*.rotary_up_key = KEY_UP,*/
185 /*.rotary_down_key = KEY_DOWN,*/
186 .rotary_rel_code = REL_WHEEL,
187 .rotary_button_key = KEY_ENTER,
188 .debounce = 10, /* 0..17 */
189 .mode = ROT_QUAD_ENC | ROT_DEBE,
190};
191
192static struct resource bfin_rotary_resources[] = {
193 {
194 .start = IRQ_CNT,
195 .end = IRQ_CNT,
196 .flags = IORESOURCE_IRQ,
197 },
198};
199
200static struct platform_device bfin_rotary_device = {
201 .name = "bfin-rotary",
202 .id = -1,
203 .num_resources = ARRAY_SIZE(bfin_rotary_resources),
204 .resource = bfin_rotary_resources,
205 .dev = {
206 .platform_data = &bfin_rotary_data,
207 },
208};
209#endif
210
Roy Huang24a07a12007-07-12 22:41:45 +0800211#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
212static struct platform_device rtc_device = {
213 .name = "rtc-bfin",
214 .id = -1,
215};
216#endif
217
218#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
219static struct resource bfin_uart_resources[] = {
220#ifdef CONFIG_SERIAL_BFIN_UART0
221 {
222 .start = 0xFFC00400,
223 .end = 0xFFC004FF,
224 .flags = IORESOURCE_MEM,
225 },
226#endif
227#ifdef CONFIG_SERIAL_BFIN_UART1
228 {
229 .start = 0xFFC02000,
230 .end = 0xFFC020FF,
231 .flags = IORESOURCE_MEM,
232 },
233#endif
234#ifdef CONFIG_SERIAL_BFIN_UART2
235 {
236 .start = 0xFFC02100,
237 .end = 0xFFC021FF,
238 .flags = IORESOURCE_MEM,
239 },
240#endif
241#ifdef CONFIG_SERIAL_BFIN_UART3
242 {
243 .start = 0xFFC03100,
244 .end = 0xFFC031FF,
Mike Frysingercc2e16b2008-07-19 16:43:51 +0800245 .flags = IORESOURCE_MEM,
Roy Huang24a07a12007-07-12 22:41:45 +0800246 },
247#endif
248};
249
250static struct platform_device bfin_uart_device = {
251 .name = "bfin-uart",
252 .id = 1,
253 .num_resources = ARRAY_SIZE(bfin_uart_resources),
254 .resource = bfin_uart_resources,
255};
256#endif
257
Graf Yang5be36d22008-04-25 03:09:15 +0800258#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang5be36d22008-04-25 03:09:15 +0800259#ifdef CONFIG_BFIN_SIR0
Graf Yang42bd8bc2009-01-07 23:14:39 +0800260static struct resource bfin_sir0_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800261 {
262 .start = 0xFFC00400,
263 .end = 0xFFC004FF,
264 .flags = IORESOURCE_MEM,
265 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800266 {
267 .start = IRQ_UART0_RX,
268 .end = IRQ_UART0_RX+1,
269 .flags = IORESOURCE_IRQ,
270 },
271 {
272 .start = CH_UART0_RX,
273 .end = CH_UART0_RX+1,
274 .flags = IORESOURCE_DMA,
275 },
276};
277static struct platform_device bfin_sir0_device = {
278 .name = "bfin_sir",
279 .id = 0,
280 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
281 .resource = bfin_sir0_resources,
282};
Graf Yang5be36d22008-04-25 03:09:15 +0800283#endif
284#ifdef CONFIG_BFIN_SIR1
Graf Yang42bd8bc2009-01-07 23:14:39 +0800285static struct resource bfin_sir1_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800286 {
287 .start = 0xFFC02000,
288 .end = 0xFFC020FF,
289 .flags = IORESOURCE_MEM,
290 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800291 {
292 .start = IRQ_UART1_RX,
293 .end = IRQ_UART1_RX+1,
294 .flags = IORESOURCE_IRQ,
295 },
296 {
297 .start = CH_UART1_RX,
298 .end = CH_UART1_RX+1,
299 .flags = IORESOURCE_DMA,
300 },
301};
302static struct platform_device bfin_sir1_device = {
303 .name = "bfin_sir",
304 .id = 1,
305 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
306 .resource = bfin_sir1_resources,
307};
Graf Yang5be36d22008-04-25 03:09:15 +0800308#endif
309#ifdef CONFIG_BFIN_SIR2
Graf Yang42bd8bc2009-01-07 23:14:39 +0800310static struct resource bfin_sir2_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800311 {
312 .start = 0xFFC02100,
313 .end = 0xFFC021FF,
314 .flags = IORESOURCE_MEM,
315 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800316 {
317 .start = IRQ_UART2_RX,
318 .end = IRQ_UART2_RX+1,
319 .flags = IORESOURCE_IRQ,
320 },
321 {
322 .start = CH_UART2_RX,
323 .end = CH_UART2_RX+1,
324 .flags = IORESOURCE_DMA,
325 },
326};
327static struct platform_device bfin_sir2_device = {
328 .name = "bfin_sir",
329 .id = 2,
330 .num_resources = ARRAY_SIZE(bfin_sir2_resources),
331 .resource = bfin_sir2_resources,
332};
Graf Yang5be36d22008-04-25 03:09:15 +0800333#endif
334#ifdef CONFIG_BFIN_SIR3
Graf Yang42bd8bc2009-01-07 23:14:39 +0800335static struct resource bfin_sir3_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800336 {
337 .start = 0xFFC03100,
338 .end = 0xFFC031FF,
339 .flags = IORESOURCE_MEM,
340 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800341 {
342 .start = IRQ_UART3_RX,
343 .end = IRQ_UART3_RX+1,
344 .flags = IORESOURCE_IRQ,
345 },
346 {
347 .start = CH_UART3_RX,
348 .end = CH_UART3_RX+1,
349 .flags = IORESOURCE_DMA,
350 },
Graf Yang5be36d22008-04-25 03:09:15 +0800351};
Graf Yang42bd8bc2009-01-07 23:14:39 +0800352static struct platform_device bfin_sir3_device = {
Graf Yang5be36d22008-04-25 03:09:15 +0800353 .name = "bfin_sir",
Graf Yang42bd8bc2009-01-07 23:14:39 +0800354 .id = 3,
355 .num_resources = ARRAY_SIZE(bfin_sir3_resources),
356 .resource = bfin_sir3_resources,
Graf Yang5be36d22008-04-25 03:09:15 +0800357};
358#endif
Graf Yang42bd8bc2009-01-07 23:14:39 +0800359#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800360
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800361#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
362static struct resource smsc911x_resources[] = {
363 {
364 .name = "smsc911x-memory",
365 .start = 0x24000000,
366 .end = 0x24000000 + 0xFF,
367 .flags = IORESOURCE_MEM,
368 },
369 {
370 .start = IRQ_PE8,
371 .end = IRQ_PE8,
372 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
373 },
374};
375static struct platform_device smsc911x_device = {
376 .name = "smsc911x",
377 .id = 0,
378 .num_resources = ARRAY_SIZE(smsc911x_resources),
379 .resource = smsc911x_resources,
380};
381#endif
382
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800383#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
384static struct resource musb_resources[] = {
385 [0] = {
386 .start = 0xFFC03C00,
387 .end = 0xFFC040FF,
388 .flags = IORESOURCE_MEM,
389 },
390 [1] = { /* general IRQ */
391 .start = IRQ_USB_INT0,
392 .end = IRQ_USB_INT0,
393 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
394 },
395 [2] = { /* DMA IRQ */
396 .start = IRQ_USB_DMA,
397 .end = IRQ_USB_DMA,
398 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
399 },
400};
401
Bryan Wu50041ac2008-10-08 13:39:40 +0800402static struct musb_hdrc_config musb_config = {
403 .multipoint = 0,
404 .dyn_fifo = 0,
405 .soft_con = 1,
406 .dma = 1,
Bryan Wufea05da2009-01-07 23:14:39 +0800407 .num_eps = 8,
408 .dma_channels = 8,
Bryan Wu50041ac2008-10-08 13:39:40 +0800409 .gpio_vrsel = GPIO_PE7,
410};
411
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800412static struct musb_hdrc_platform_data musb_plat = {
Bryan Wu29350772007-12-24 12:20:19 +0800413#if defined(CONFIG_USB_MUSB_OTG)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800414 .mode = MUSB_OTG,
Bryan Wu29350772007-12-24 12:20:19 +0800415#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800416 .mode = MUSB_HOST,
Bryan Wu29350772007-12-24 12:20:19 +0800417#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800418 .mode = MUSB_PERIPHERAL,
419#endif
Bryan Wu50041ac2008-10-08 13:39:40 +0800420 .config = &musb_config,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800421};
422
423static u64 musb_dmamask = ~(u32)0;
424
425static struct platform_device musb_device = {
426 .name = "musb_hdrc",
427 .id = 0,
428 .dev = {
429 .dma_mask = &musb_dmamask,
430 .coherent_dma_mask = 0xffffffff,
431 .platform_data = &musb_plat,
432 },
433 .num_resources = ARRAY_SIZE(musb_resources),
434 .resource = musb_resources,
435};
436#endif
437
438#if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
439static struct resource bfin_atapi_resources[] = {
440 {
441 .start = 0xFFC03800,
442 .end = 0xFFC0386F,
443 .flags = IORESOURCE_MEM,
444 },
445 {
446 .start = IRQ_ATAPI_ERR,
447 .end = IRQ_ATAPI_ERR,
448 .flags = IORESOURCE_IRQ,
449 },
450};
451
452static struct platform_device bfin_atapi_device = {
453 .name = "pata-bf54x",
454 .id = -1,
455 .num_resources = ARRAY_SIZE(bfin_atapi_resources),
456 .resource = bfin_atapi_resources,
457};
458#endif
459
460#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
461static struct mtd_partition partition_info[] = {
462 {
Robin Getzaa582972008-08-05 17:47:29 +0800463 .name = "linux kernel(nand)",
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800464 .offset = 0,
Mike Frysingerf4585a02008-10-13 14:45:21 +0800465 .size = 4 * 1024 * 1024,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800466 },
467 {
Robin Getzaa582972008-08-05 17:47:29 +0800468 .name = "file system(nand)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800469 .offset = MTDPART_OFS_APPEND,
470 .size = MTDPART_SIZ_FULL,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800471 },
472};
473
474static struct bf5xx_nand_platform bf5xx_nand_platform = {
475 .page_size = NFC_PG_SIZE_256,
476 .data_width = NFC_NWIDTH_8,
477 .partitions = partition_info,
478 .nr_partitions = ARRAY_SIZE(partition_info),
479 .rd_dly = 3,
480 .wr_dly = 3,
481};
482
483static struct resource bf5xx_nand_resources[] = {
484 {
485 .start = 0xFFC03B00,
486 .end = 0xFFC03B4F,
487 .flags = IORESOURCE_MEM,
488 },
489 {
490 .start = CH_NFC,
491 .end = CH_NFC,
492 .flags = IORESOURCE_IRQ,
493 },
494};
495
496static struct platform_device bf5xx_nand_device = {
497 .name = "bf5xx-nand",
498 .id = 0,
499 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
500 .resource = bf5xx_nand_resources,
501 .dev = {
502 .platform_data = &bf5xx_nand_platform,
503 },
504};
505#endif
506
Michael Hennerich3d7e6cf2008-03-03 17:40:28 -0700507#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
Cliff Cai501674a2009-01-07 23:14:38 +0800508
509static struct bfin_sd_host bfin_sdh_data = {
510 .dma_chan = CH_SDH,
511 .irq_int0 = IRQ_SDH_MASK0,
512 .pin_req = {P_SD_D0, P_SD_D1, P_SD_D2, P_SD_D3, P_SD_CLK, P_SD_CMD, 0},
513};
514
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800515static struct platform_device bf54x_sdh_device = {
516 .name = "bfin-sdh",
517 .id = 0,
Cliff Cai501674a2009-01-07 23:14:38 +0800518 .dev = {
519 .platform_data = &bfin_sdh_data,
520 },
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800521};
522#endif
523
Mike Frysinger793dc272008-03-26 08:09:12 +0800524#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800525static struct mtd_partition ezkit_partitions[] = {
526 {
Robin Getzaa582972008-08-05 17:47:29 +0800527 .name = "bootloader(nor)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800528 .size = 0x40000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800529 .offset = 0,
530 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800531 .name = "linux kernel(nor)",
Mike Frysinger664d0402008-10-09 17:28:36 +0800532 .size = 0x400000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800533 .offset = MTDPART_OFS_APPEND,
534 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800535 .name = "file system(nor)",
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800536 .size = MTDPART_SIZ_FULL,
537 .offset = MTDPART_OFS_APPEND,
538 }
539};
540
541static struct physmap_flash_data ezkit_flash_data = {
542 .width = 2,
543 .parts = ezkit_partitions,
544 .nr_parts = ARRAY_SIZE(ezkit_partitions),
545};
546
547static struct resource ezkit_flash_resource = {
548 .start = 0x20000000,
Mike Frysinger664d0402008-10-09 17:28:36 +0800549 .end = 0x21ffffff,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800550 .flags = IORESOURCE_MEM,
551};
552
553static struct platform_device ezkit_flash_device = {
554 .name = "physmap-flash",
555 .id = 0,
556 .dev = {
557 .platform_data = &ezkit_flash_data,
558 },
559 .num_resources = 1,
560 .resource = &ezkit_flash_resource,
561};
Mike Frysinger793dc272008-03-26 08:09:12 +0800562#endif
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800563
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800564#if defined(CONFIG_MTD_M25P80) \
565 || defined(CONFIG_MTD_M25P80_MODULE)
566/* SPI flash chip (m25p16) */
567static struct mtd_partition bfin_spi_flash_partitions[] = {
568 {
Robin Getzaa582972008-08-05 17:47:29 +0800569 .name = "bootloader(spi)",
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800570 .size = 0x00040000,
571 .offset = 0,
572 .mask_flags = MTD_CAP_ROM
573 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800574 .name = "linux kernel(spi)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800575 .size = MTDPART_SIZ_FULL,
576 .offset = MTDPART_OFS_APPEND,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800577 }
578};
579
580static struct flash_platform_data bfin_spi_flash_data = {
581 .name = "m25p80",
582 .parts = bfin_spi_flash_partitions,
583 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
584 .type = "m25p16",
585};
586
587static struct bfin5xx_spi_chip spi_flash_chip_info = {
588 .enable_dma = 0, /* use dma transfer with this chip*/
589 .bits_per_word = 8,
590 .cs_change_per_word = 0,
591};
592#endif
593
Bernd Schmidt37fa2422008-04-24 05:19:02 +0800594#if defined(CONFIG_SND_BLACKFIN_AD1836) \
595 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
596static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
597 .enable_dma = 0,
598 .bits_per_word = 16,
599};
600#endif
601
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800602#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
603static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
Michael Hennerichc7d48962007-11-15 21:33:31 +0800604 .cs_change_per_word = 0,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800605 .enable_dma = 0,
606 .bits_per_word = 16,
607};
608
609static const struct ad7877_platform_data bfin_ad7877_ts_info = {
610 .model = 7877,
611 .vref_delay_usecs = 50, /* internal, no capacitor */
612 .x_plate_ohms = 419,
613 .y_plate_ohms = 486,
614 .pressure_max = 1000,
615 .pressure_min = 0,
616 .stopacq_polarity = 1,
617 .first_conversion_delay = 3,
618 .acquisition_time = 1,
619 .averaging = 1,
620 .pen_down_acc_interval = 1,
621};
622#endif
623
Michael Hennerich6e668932008-02-09 01:54:09 +0800624#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
625static struct bfin5xx_spi_chip spidev_chip_info = {
626 .enable_dma = 0,
627 .bits_per_word = 8,
628};
629#endif
630
Mike Frysinger5bda2722008-06-07 15:03:01 +0800631static struct spi_board_info bfin_spi_board_info[] __initdata = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800632#if defined(CONFIG_MTD_M25P80) \
633 || defined(CONFIG_MTD_M25P80_MODULE)
634 {
635 /* the modalias must be the same as spi device driver name */
636 .modalias = "m25p80", /* Name of spi_driver for this device */
637 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
638 .bus_num = 0, /* Framework bus number */
639 .chip_select = 1, /* SPI_SSEL1*/
640 .platform_data = &bfin_spi_flash_data,
641 .controller_data = &spi_flash_chip_info,
642 .mode = SPI_MODE_3,
643 },
644#endif
Bernd Schmidt37fa2422008-04-24 05:19:02 +0800645#if defined(CONFIG_SND_BLACKFIN_AD1836) \
646 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
647 {
648 .modalias = "ad1836-spi",
649 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
650 .bus_num = 1,
651 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
652 .controller_data = &ad1836_spi_chip_info,
653 },
654#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800655#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
656{
657 .modalias = "ad7877",
658 .platform_data = &bfin_ad7877_ts_info,
Mike Frysinger1ffb9be2008-10-07 16:06:27 +0800659 .irq = IRQ_PJ11, /* newer boards (Rev 1.4+) use IRQ_PB4 */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800660 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
661 .bus_num = 0,
662 .chip_select = 2,
663 .controller_data = &spi_ad7877_chip_info,
664},
665#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800666#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
667 {
668 .modalias = "spidev",
669 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
670 .bus_num = 0,
671 .chip_select = 1,
672 .controller_data = &spidev_chip_info,
673 },
674#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800675};
676
Mike Frysinger5bda2722008-06-07 15:03:01 +0800677#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800678/* SPI (0) */
679static struct resource bfin_spi0_resource[] = {
680 [0] = {
681 .start = SPI0_REGBASE,
682 .end = SPI0_REGBASE + 0xFF,
683 .flags = IORESOURCE_MEM,
684 },
685 [1] = {
686 .start = CH_SPI0,
687 .end = CH_SPI0,
688 .flags = IORESOURCE_IRQ,
689 }
690};
691
692/* SPI (1) */
693static struct resource bfin_spi1_resource[] = {
694 [0] = {
695 .start = SPI1_REGBASE,
696 .end = SPI1_REGBASE + 0xFF,
697 .flags = IORESOURCE_MEM,
698 },
699 [1] = {
700 .start = CH_SPI1,
701 .end = CH_SPI1,
702 .flags = IORESOURCE_IRQ,
703 }
704};
705
706/* SPI controller data */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800707static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800708 .num_chipselect = 8,
709 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800710 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800711};
712
713static struct platform_device bf54x_spi_master0 = {
714 .name = "bfin-spi",
715 .id = 0, /* Bus number */
716 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
717 .resource = bfin_spi0_resource,
718 .dev = {
Bryan Wu5d448dd2007-11-12 23:24:42 +0800719 .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800720 },
721};
722
Bryan Wu5d448dd2007-11-12 23:24:42 +0800723static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
724 .num_chipselect = 8,
725 .enable_dma = 1, /* master has the ability to do dma transfer */
726 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
727};
728
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800729static struct platform_device bf54x_spi_master1 = {
730 .name = "bfin-spi",
731 .id = 1, /* Bus number */
732 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
733 .resource = bfin_spi1_resource,
734 .dev = {
Bryan Wu5d448dd2007-11-12 23:24:42 +0800735 .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800736 },
737};
738#endif /* spi master and devices */
739
740#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
741static struct resource bfin_twi0_resource[] = {
742 [0] = {
743 .start = TWI0_REGBASE,
744 .end = TWI0_REGBASE + 0xFF,
745 .flags = IORESOURCE_MEM,
746 },
747 [1] = {
748 .start = IRQ_TWI0,
749 .end = IRQ_TWI0,
750 .flags = IORESOURCE_IRQ,
751 },
752};
753
754static struct platform_device i2c_bfin_twi0_device = {
755 .name = "i2c-bfin-twi",
756 .id = 0,
757 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
758 .resource = bfin_twi0_resource,
759};
760
Mike Frysinger7160e9502007-11-21 16:03:07 +0800761#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800762static struct resource bfin_twi1_resource[] = {
763 [0] = {
764 .start = TWI1_REGBASE,
765 .end = TWI1_REGBASE + 0xFF,
766 .flags = IORESOURCE_MEM,
767 },
768 [1] = {
769 .start = IRQ_TWI1,
770 .end = IRQ_TWI1,
771 .flags = IORESOURCE_IRQ,
772 },
773};
774
775static struct platform_device i2c_bfin_twi1_device = {
776 .name = "i2c-bfin-twi",
777 .id = 1,
778 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
779 .resource = bfin_twi1_resource,
780};
781#endif
Mike Frysinger7160e9502007-11-21 16:03:07 +0800782#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800783
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800784#ifdef CONFIG_I2C_BOARDINFO
785static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
786};
787
788#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
789static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
790#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
791 {
792 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800793 },
794#endif
795#if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
796 {
797 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800798 .irq = 212,
799 },
800#endif
801};
802#endif
803#endif
804
Michael Hennerich2463ef22008-01-27 16:49:48 +0800805#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
806#include <linux/gpio_keys.h>
807
808static struct gpio_keys_button bfin_gpio_keys_table[] = {
809 {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
810 {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
811 {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
812 {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
813};
814
815static struct gpio_keys_platform_data bfin_gpio_keys_data = {
816 .buttons = bfin_gpio_keys_table,
817 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
818};
819
820static struct platform_device bfin_device_gpiokeys = {
821 .name = "gpio-keys",
822 .dev = {
823 .platform_data = &bfin_gpio_keys_data,
824 },
825};
826#endif
827
Mike Frysingercad2ab62008-02-22 17:01:31 +0800828static struct resource bfin_gpios_resources = {
829 .start = 0,
830 .end = MAX_BLACKFIN_GPIOS - 1,
831 .flags = IORESOURCE_IRQ,
832};
833
834static struct platform_device bfin_gpios_device = {
835 .name = "simple-gpio",
836 .id = -1,
837 .num_resources = 1,
838 .resource = &bfin_gpios_resources,
839};
840
Michael Hennerich14b03202008-05-07 11:41:26 +0800841static const unsigned int cclk_vlev_datasheet[] =
842{
843/*
844 * Internal VLEV BF54XSBBC1533
845 ****temporarily using these values until data sheet is updated
846 */
847 VRPAIR(VLEV_085, 150000000),
848 VRPAIR(VLEV_090, 250000000),
849 VRPAIR(VLEV_110, 276000000),
850 VRPAIR(VLEV_115, 301000000),
851 VRPAIR(VLEV_120, 525000000),
852 VRPAIR(VLEV_125, 550000000),
853 VRPAIR(VLEV_130, 600000000),
854};
855
856static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
857 .tuple_tab = cclk_vlev_datasheet,
858 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
859 .vr_settling_time = 25 /* us */,
860};
861
862static struct platform_device bfin_dpmc = {
863 .name = "bfin dpmc",
864 .dev = {
865 .platform_data = &bfin_dmpc_vreg_data,
866 },
867};
868
Roy Huang24a07a12007-07-12 22:41:45 +0800869static struct platform_device *ezkit_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +0800870
871 &bfin_dpmc,
872
Roy Huang24a07a12007-07-12 22:41:45 +0800873#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
874 &rtc_device,
875#endif
876
877#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
878 &bfin_uart_device,
879#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800880
Graf Yang5be36d22008-04-25 03:09:15 +0800881#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang42bd8bc2009-01-07 23:14:39 +0800882#ifdef CONFIG_BFIN_SIR0
883 &bfin_sir0_device,
884#endif
885#ifdef CONFIG_BFIN_SIR1
886 &bfin_sir1_device,
887#endif
888#ifdef CONFIG_BFIN_SIR2
889 &bfin_sir2_device,
890#endif
891#ifdef CONFIG_BFIN_SIR3
892 &bfin_sir3_device,
893#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800894#endif
895
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800896#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
897 &bf54x_lq043_device,
898#endif
899
900#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
901 &smsc911x_device,
902#endif
903
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800904#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
905 &musb_device,
906#endif
907
Michael Hennerich3f375692008-11-18 17:48:22 +0800908#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
909 &bfin_isp1760_device,
910#endif
911
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800912#if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
913 &bfin_atapi_device,
914#endif
915
916#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
917 &bf5xx_nand_device,
918#endif
919
Michael Hennerich3d7e6cf2008-03-03 17:40:28 -0700920#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800921 &bf54x_sdh_device,
922#endif
923
924#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
925 &bf54x_spi_master0,
Bryan Wud4b1d272007-10-21 17:03:55 +0800926 &bf54x_spi_master1,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800927#endif
928
929#if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
930 &bf54x_kpad_device,
931#endif
932
Michael Hennerichaca5e4a2008-10-08 14:27:59 +0800933#if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE)
934 &bfin_rotary_device,
935#endif
936
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800937#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
938 &i2c_bfin_twi0_device,
Mike Frysinger7160e9502007-11-21 16:03:07 +0800939#if !defined(CONFIG_BF542)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800940 &i2c_bfin_twi1_device,
941#endif
Mike Frysinger7160e9502007-11-21 16:03:07 +0800942#endif
Michael Hennerich2463ef22008-01-27 16:49:48 +0800943
944#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
945 &bfin_device_gpiokeys,
946#endif
Mike Frysingercad2ab62008-02-22 17:01:31 +0800947
948 &bfin_gpios_device,
Mike Frysinger793dc272008-03-26 08:09:12 +0800949
950#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800951 &ezkit_flash_device,
Mike Frysinger793dc272008-03-26 08:09:12 +0800952#endif
Roy Huang24a07a12007-07-12 22:41:45 +0800953};
954
Mike Frysingera01d7a72008-02-02 15:34:56 +0800955static int __init ezkit_init(void)
Roy Huang24a07a12007-07-12 22:41:45 +0800956{
Harvey Harrisonb85d8582008-04-23 09:39:01 +0800957 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800958
959#ifdef CONFIG_I2C_BOARDINFO
960 i2c_register_board_info(0, bfin_i2c_board_info0,
961 ARRAY_SIZE(bfin_i2c_board_info0));
962#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
963 i2c_register_board_info(1, bfin_i2c_board_info1,
964 ARRAY_SIZE(bfin_i2c_board_info1));
965#endif
966#endif
967
Roy Huang24a07a12007-07-12 22:41:45 +0800968 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800969
Mike Frysinger5bda2722008-06-07 15:03:01 +0800970 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800971
Roy Huang24a07a12007-07-12 22:41:45 +0800972 return 0;
973}
974
Mike Frysingera01d7a72008-02-02 15:34:56 +0800975arch_initcall(ezkit_init);