]> bbs.cooldavid.org Git - net-next-2.6.git/blame - arch/blackfin/mach-bf548/boards/ezkit.c
[Blackfin] arch: Fix bug - kernel build with Debug option enabled fails to boot up
[net-next-2.6.git] / arch / blackfin / mach-bf548 / boards / ezkit.c
CommitLineData
24a07a12
RH
1/*
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>
35#include <linux/spi/spi.h>
36#include <linux/spi/flash.h>
1f83b8f1 37#include <linux/irq.h>
24a07a12 38#include <linux/interrupt.h>
c6c4d7bb 39#include <linux/usb/musb.h>
24a07a12 40#include <asm/bfin5xx_spi.h>
c6c4d7bb
BW
41#include <asm/cplb.h>
42#include <asm/dma.h>
43#include <asm/gpio.h>
44#include <asm/nand.h>
5d448dd5 45#include <asm/portmux.h>
c6c4d7bb
BW
46#include <asm/mach/bf54x_keys.h>
47#include <linux/input.h>
48#include <linux/spi/ad7877.h>
24a07a12
RH
49
50/*
51 * Name the Board for the /proc/cpuinfo
52 */
066954a3 53const char bfin_board_name[] = "ADSP-BF548-EZKIT";
24a07a12
RH
54
55/*
56 * Driver needs to know address, irq and flag pin.
57 */
58
c6c4d7bb
BW
59#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
60
61#include <asm/mach/bf54x-lq043.h>
62
63static struct bfin_bf54xfb_mach_info bf54x_lq043_data = {
64 .width = 480,
65 .height = 272,
66 .xres = {480, 480, 480},
67 .yres = {272, 272, 272},
68 .bpp = {24, 24, 24},
69 .disp = GPIO_PE3,
70};
71
72static struct resource bf54x_lq043_resources[] = {
73 {
74 .start = IRQ_EPPI0_ERR,
75 .end = IRQ_EPPI0_ERR,
76 .flags = IORESOURCE_IRQ,
77 },
78};
79
80static struct platform_device bf54x_lq043_device = {
81 .name = "bf54x-lq043",
82 .id = -1,
83 .num_resources = ARRAY_SIZE(bf54x_lq043_resources),
84 .resource = bf54x_lq043_resources,
85 .dev = {
86 .platform_data = &bf54x_lq043_data,
87 },
88};
89#endif
90
91#if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
8f740ef3 92static const unsigned int bf548_keymap[] = {
c6c4d7bb
BW
93 KEYVAL(0, 0, KEY_ENTER),
94 KEYVAL(0, 1, KEY_HELP),
95 KEYVAL(0, 2, KEY_0),
96 KEYVAL(0, 3, KEY_BACKSPACE),
97 KEYVAL(1, 0, KEY_TAB),
98 KEYVAL(1, 1, KEY_9),
99 KEYVAL(1, 2, KEY_8),
100 KEYVAL(1, 3, KEY_7),
101 KEYVAL(2, 0, KEY_DOWN),
102 KEYVAL(2, 1, KEY_6),
103 KEYVAL(2, 2, KEY_5),
104 KEYVAL(2, 3, KEY_4),
105 KEYVAL(3, 0, KEY_UP),
106 KEYVAL(3, 1, KEY_3),
107 KEYVAL(3, 2, KEY_2),
108 KEYVAL(3, 3, KEY_1),
109};
110
111static struct bfin_kpad_platform_data bf54x_kpad_data = {
112 .rows = 4,
113 .cols = 4,
8f740ef3
MH
114 .keymap = bf548_keymap,
115 .keymapsize = ARRAY_SIZE(bf548_keymap),
c6c4d7bb
BW
116 .repeat = 0,
117 .debounce_time = 5000, /* ns (5ms) */
118 .coldrive_time = 1000, /* ns (1ms) */
119 .keyup_test_interval = 50, /* ms (50ms) */
120};
121
122static struct resource bf54x_kpad_resources[] = {
123 {
124 .start = IRQ_KEY,
125 .end = IRQ_KEY,
126 .flags = IORESOURCE_IRQ,
127 },
128};
129
130static struct platform_device bf54x_kpad_device = {
131 .name = "bf54x-keys",
132 .id = -1,
133 .num_resources = ARRAY_SIZE(bf54x_kpad_resources),
134 .resource = bf54x_kpad_resources,
135 .dev = {
136 .platform_data = &bf54x_kpad_data,
137 },
138};
139#endif
140
24a07a12
RH
141#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
142static struct platform_device rtc_device = {
143 .name = "rtc-bfin",
144 .id = -1,
145};
146#endif
147
148#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
149static struct resource bfin_uart_resources[] = {
150#ifdef CONFIG_SERIAL_BFIN_UART0
151 {
152 .start = 0xFFC00400,
153 .end = 0xFFC004FF,
154 .flags = IORESOURCE_MEM,
155 },
156#endif
157#ifdef CONFIG_SERIAL_BFIN_UART1
158 {
159 .start = 0xFFC02000,
160 .end = 0xFFC020FF,
161 .flags = IORESOURCE_MEM,
162 },
163#endif
164#ifdef CONFIG_SERIAL_BFIN_UART2
165 {
166 .start = 0xFFC02100,
167 .end = 0xFFC021FF,
168 .flags = IORESOURCE_MEM,
169 },
170#endif
171#ifdef CONFIG_SERIAL_BFIN_UART3
172 {
173 .start = 0xFFC03100,
174 .end = 0xFFC031FF,
175 },
176#endif
177};
178
179static struct platform_device bfin_uart_device = {
180 .name = "bfin-uart",
181 .id = 1,
182 .num_resources = ARRAY_SIZE(bfin_uart_resources),
183 .resource = bfin_uart_resources,
184};
185#endif
186
c6c4d7bb
BW
187#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
188static struct resource smsc911x_resources[] = {
189 {
190 .name = "smsc911x-memory",
191 .start = 0x24000000,
192 .end = 0x24000000 + 0xFF,
193 .flags = IORESOURCE_MEM,
194 },
195 {
196 .start = IRQ_PE8,
197 .end = IRQ_PE8,
198 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
199 },
200};
201static struct platform_device smsc911x_device = {
202 .name = "smsc911x",
203 .id = 0,
204 .num_resources = ARRAY_SIZE(smsc911x_resources),
205 .resource = smsc911x_resources,
206};
207#endif
208
c6c4d7bb
BW
209#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
210static struct resource musb_resources[] = {
211 [0] = {
212 .start = 0xFFC03C00,
213 .end = 0xFFC040FF,
214 .flags = IORESOURCE_MEM,
215 },
216 [1] = { /* general IRQ */
217 .start = IRQ_USB_INT0,
218 .end = IRQ_USB_INT0,
219 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
220 },
221 [2] = { /* DMA IRQ */
222 .start = IRQ_USB_DMA,
223 .end = IRQ_USB_DMA,
224 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
225 },
226};
227
228static struct musb_hdrc_platform_data musb_plat = {
2935077e 229#if defined(CONFIG_USB_MUSB_OTG)
c6c4d7bb 230 .mode = MUSB_OTG,
2935077e 231#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
c6c4d7bb 232 .mode = MUSB_HOST,
2935077e 233#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
c6c4d7bb
BW
234 .mode = MUSB_PERIPHERAL,
235#endif
2935077e 236 .multipoint = 0,
c6c4d7bb
BW
237};
238
239static u64 musb_dmamask = ~(u32)0;
240
241static struct platform_device musb_device = {
242 .name = "musb_hdrc",
243 .id = 0,
244 .dev = {
245 .dma_mask = &musb_dmamask,
246 .coherent_dma_mask = 0xffffffff,
247 .platform_data = &musb_plat,
248 },
249 .num_resources = ARRAY_SIZE(musb_resources),
250 .resource = musb_resources,
251};
252#endif
253
254#if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
255static struct resource bfin_atapi_resources[] = {
256 {
257 .start = 0xFFC03800,
258 .end = 0xFFC0386F,
259 .flags = IORESOURCE_MEM,
260 },
261 {
262 .start = IRQ_ATAPI_ERR,
263 .end = IRQ_ATAPI_ERR,
264 .flags = IORESOURCE_IRQ,
265 },
266};
267
268static struct platform_device bfin_atapi_device = {
269 .name = "pata-bf54x",
270 .id = -1,
271 .num_resources = ARRAY_SIZE(bfin_atapi_resources),
272 .resource = bfin_atapi_resources,
273};
274#endif
275
276#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
277static struct mtd_partition partition_info[] = {
278 {
279 .name = "Linux Kernel",
280 .offset = 0,
281 .size = 4 * SIZE_1M,
282 },
283 {
284 .name = "File System",
285 .offset = 4 * SIZE_1M,
286 .size = (256 - 4) * SIZE_1M,
287 },
288};
289
290static struct bf5xx_nand_platform bf5xx_nand_platform = {
291 .page_size = NFC_PG_SIZE_256,
292 .data_width = NFC_NWIDTH_8,
293 .partitions = partition_info,
294 .nr_partitions = ARRAY_SIZE(partition_info),
295 .rd_dly = 3,
296 .wr_dly = 3,
297};
298
299static struct resource bf5xx_nand_resources[] = {
300 {
301 .start = 0xFFC03B00,
302 .end = 0xFFC03B4F,
303 .flags = IORESOURCE_MEM,
304 },
305 {
306 .start = CH_NFC,
307 .end = CH_NFC,
308 .flags = IORESOURCE_IRQ,
309 },
310};
311
312static struct platform_device bf5xx_nand_device = {
313 .name = "bf5xx-nand",
314 .id = 0,
315 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
316 .resource = bf5xx_nand_resources,
317 .dev = {
318 .platform_data = &bf5xx_nand_platform,
319 },
320};
321#endif
322
323#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN)
324static struct platform_device bf54x_sdh_device = {
325 .name = "bfin-sdh",
326 .id = 0,
327};
328#endif
329
330#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
331/* all SPI peripherals info goes here */
332#if defined(CONFIG_MTD_M25P80) \
333 || defined(CONFIG_MTD_M25P80_MODULE)
334/* SPI flash chip (m25p16) */
335static struct mtd_partition bfin_spi_flash_partitions[] = {
336 {
337 .name = "bootloader",
338 .size = 0x00040000,
339 .offset = 0,
340 .mask_flags = MTD_CAP_ROM
341 }, {
342 .name = "linux kernel",
343 .size = 0x1c0000,
344 .offset = 0x40000
345 }
346};
347
348static struct flash_platform_data bfin_spi_flash_data = {
349 .name = "m25p80",
350 .parts = bfin_spi_flash_partitions,
351 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
352 .type = "m25p16",
353};
354
355static struct bfin5xx_spi_chip spi_flash_chip_info = {
356 .enable_dma = 0, /* use dma transfer with this chip*/
357 .bits_per_word = 8,
358 .cs_change_per_word = 0,
359};
360#endif
361
362#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
363static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
c7d48966 364 .cs_change_per_word = 0,
c6c4d7bb
BW
365 .enable_dma = 0,
366 .bits_per_word = 16,
367};
368
369static const struct ad7877_platform_data bfin_ad7877_ts_info = {
370 .model = 7877,
371 .vref_delay_usecs = 50, /* internal, no capacitor */
372 .x_plate_ohms = 419,
373 .y_plate_ohms = 486,
374 .pressure_max = 1000,
375 .pressure_min = 0,
376 .stopacq_polarity = 1,
377 .first_conversion_delay = 3,
378 .acquisition_time = 1,
379 .averaging = 1,
380 .pen_down_acc_interval = 1,
381};
382#endif
383
384static struct spi_board_info bf54x_spi_board_info[] __initdata = {
385#if defined(CONFIG_MTD_M25P80) \
386 || defined(CONFIG_MTD_M25P80_MODULE)
387 {
388 /* the modalias must be the same as spi device driver name */
389 .modalias = "m25p80", /* Name of spi_driver for this device */
390 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
391 .bus_num = 0, /* Framework bus number */
392 .chip_select = 1, /* SPI_SSEL1*/
393 .platform_data = &bfin_spi_flash_data,
394 .controller_data = &spi_flash_chip_info,
395 .mode = SPI_MODE_3,
396 },
397#endif
398#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
399{
400 .modalias = "ad7877",
401 .platform_data = &bfin_ad7877_ts_info,
402 .irq = IRQ_PJ11,
403 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
404 .bus_num = 0,
405 .chip_select = 2,
406 .controller_data = &spi_ad7877_chip_info,
407},
408#endif
409};
410
411/* SPI (0) */
412static struct resource bfin_spi0_resource[] = {
413 [0] = {
414 .start = SPI0_REGBASE,
415 .end = SPI0_REGBASE + 0xFF,
416 .flags = IORESOURCE_MEM,
417 },
418 [1] = {
419 .start = CH_SPI0,
420 .end = CH_SPI0,
421 .flags = IORESOURCE_IRQ,
422 }
423};
424
425/* SPI (1) */
426static struct resource bfin_spi1_resource[] = {
427 [0] = {
428 .start = SPI1_REGBASE,
429 .end = SPI1_REGBASE + 0xFF,
430 .flags = IORESOURCE_MEM,
431 },
432 [1] = {
433 .start = CH_SPI1,
434 .end = CH_SPI1,
435 .flags = IORESOURCE_IRQ,
436 }
437};
438
439/* SPI controller data */
5d448dd5 440static struct bfin5xx_spi_master bf54x_spi_master_info0 = {
c6c4d7bb
BW
441 .num_chipselect = 8,
442 .enable_dma = 1, /* master has the ability to do dma transfer */
5d448dd5 443 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
c6c4d7bb
BW
444};
445
446static struct platform_device bf54x_spi_master0 = {
447 .name = "bfin-spi",
448 .id = 0, /* Bus number */
449 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
450 .resource = bfin_spi0_resource,
451 .dev = {
5d448dd5 452 .platform_data = &bf54x_spi_master_info0, /* Passed to driver */
c6c4d7bb
BW
453 },
454};
455
5d448dd5
BW
456static struct bfin5xx_spi_master bf54x_spi_master_info1 = {
457 .num_chipselect = 8,
458 .enable_dma = 1, /* master has the ability to do dma transfer */
459 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
460};
461
c6c4d7bb
BW
462static struct platform_device bf54x_spi_master1 = {
463 .name = "bfin-spi",
464 .id = 1, /* Bus number */
465 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
466 .resource = bfin_spi1_resource,
467 .dev = {
5d448dd5 468 .platform_data = &bf54x_spi_master_info1, /* Passed to driver */
c6c4d7bb
BW
469 },
470};
471#endif /* spi master and devices */
472
473#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
474static struct resource bfin_twi0_resource[] = {
475 [0] = {
476 .start = TWI0_REGBASE,
477 .end = TWI0_REGBASE + 0xFF,
478 .flags = IORESOURCE_MEM,
479 },
480 [1] = {
481 .start = IRQ_TWI0,
482 .end = IRQ_TWI0,
483 .flags = IORESOURCE_IRQ,
484 },
485};
486
487static struct platform_device i2c_bfin_twi0_device = {
488 .name = "i2c-bfin-twi",
489 .id = 0,
490 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
491 .resource = bfin_twi0_resource,
492};
493
7160e950 494#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
c6c4d7bb
BW
495static struct resource bfin_twi1_resource[] = {
496 [0] = {
497 .start = TWI1_REGBASE,
498 .end = TWI1_REGBASE + 0xFF,
499 .flags = IORESOURCE_MEM,
500 },
501 [1] = {
502 .start = IRQ_TWI1,
503 .end = IRQ_TWI1,
504 .flags = IORESOURCE_IRQ,
505 },
506};
507
508static struct platform_device i2c_bfin_twi1_device = {
509 .name = "i2c-bfin-twi",
510 .id = 1,
511 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
512 .resource = bfin_twi1_resource,
513};
514#endif
7160e950 515#endif
c6c4d7bb 516
2463ef22
MH
517#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
518#include <linux/gpio_keys.h>
519
520static struct gpio_keys_button bfin_gpio_keys_table[] = {
521 {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
522 {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
523 {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
524 {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
525};
526
527static struct gpio_keys_platform_data bfin_gpio_keys_data = {
528 .buttons = bfin_gpio_keys_table,
529 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
530};
531
532static struct platform_device bfin_device_gpiokeys = {
533 .name = "gpio-keys",
534 .dev = {
535 .platform_data = &bfin_gpio_keys_data,
536 },
537};
538#endif
539
24a07a12
RH
540static struct platform_device *ezkit_devices[] __initdata = {
541#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
542 &rtc_device,
543#endif
544
545#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
546 &bfin_uart_device,
547#endif
c6c4d7bb
BW
548
549#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
550 &bf54x_lq043_device,
551#endif
552
553#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
554 &smsc911x_device,
555#endif
556
c6c4d7bb
BW
557#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
558 &musb_device,
559#endif
560
561#if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE)
562 &bfin_atapi_device,
563#endif
564
565#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
566 &bf5xx_nand_device,
567#endif
568
569#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN)
570 &bf54x_sdh_device,
571#endif
572
573#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
574 &bf54x_spi_master0,
d4b1d273 575 &bf54x_spi_master1,
c6c4d7bb
BW
576#endif
577
578#if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE)
579 &bf54x_kpad_device,
580#endif
581
582#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
583 &i2c_bfin_twi0_device,
7160e950 584#if !defined(CONFIG_BF542)
c6c4d7bb
BW
585 &i2c_bfin_twi1_device,
586#endif
7160e950 587#endif
2463ef22
MH
588
589#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
590 &bfin_device_gpiokeys,
591#endif
24a07a12
RH
592};
593
594static int __init stamp_init(void)
595{
596 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
597 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
c6c4d7bb
BW
598
599#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
600 spi_register_board_info(bf54x_spi_board_info,
601 ARRAY_SIZE(bf54x_spi_board_info));
602#endif
603
24a07a12
RH
604 return 0;
605}
606
607arch_initcall(stamp_init);