blob: 75acd4d37a11c97783cee7e8b3ad335aacf04cf2 [file] [log] [blame]
Michael Hennerich59003142007-10-21 16:54:27 +08001/*
2 * File: arch/blackfin/mach-bf527/boards/ezkit.c
3 * Based on: arch/blackfin/mach-bf537/boards/stamp.c
4 * Author: Aidan Williams <aidan@nicta.com.au>
5 *
6 * Created:
7 * Description:
8 *
9 * Modified:
10 * Copyright 2005 National ICT Australia (NICTA)
Michael Hennericha628a8b2008-01-22 17:29:16 +080011 * Copyright 2004-2008 Analog Devices Inc.
Michael Hennerich59003142007-10-21 16:54:27 +080012 *
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>
Michael Hennerichd7e5dd42008-05-07 11:41:26 +080035#include <linux/mtd/physmap.h>
Michael Hennerich59003142007-10-21 16:54:27 +080036#include <linux/spi/spi.h>
37#include <linux/spi/flash.h>
38#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
Mike Frysingerf02bcec2007-11-15 21:29:15 +080039#include <linux/usb/isp1362.h>
Michael Hennerich59003142007-10-21 16:54:27 +080040#endif
Jeff Garzik0a87e3e2008-02-01 18:02:30 -050041#include <linux/ata_platform.h>
Michael Hennerich59003142007-10-21 16:54:27 +080042#include <linux/irq.h>
43#include <linux/interrupt.h>
Mike Frysinger632f6582007-11-15 21:25:47 +080044#include <linux/usb/sl811.h>
Mike Frysinger67f2d332008-02-09 01:49:23 +080045#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
Michael Hennerich1089e222007-12-24 11:49:29 +080046#include <linux/usb/musb.h>
Mike Frysinger67f2d332008-02-09 01:49:23 +080047#endif
Michael Hennerich64307f72007-10-29 16:55:18 +080048#include <asm/cplb.h>
Michael Hennerich59003142007-10-21 16:54:27 +080049#include <asm/dma.h>
50#include <asm/bfin5xx_spi.h>
51#include <asm/reboot.h>
Michael Hennerich64307f72007-10-29 16:55:18 +080052#include <asm/nand.h>
Bryan Wu5d448dd2007-11-12 23:24:42 +080053#include <asm/portmux.h>
Michael Hennerich14b03202008-05-07 11:41:26 +080054#include <asm/dpmc.h>
Michael Hennerich59003142007-10-21 16:54:27 +080055#include <linux/spi/ad7877.h>
56
57/*
58 * Name the Board for the /proc/cpuinfo
59 */
Mike Frysinger066954a2007-10-21 22:36:06 +080060const char bfin_board_name[] = "ADDS-BF527-EZKIT";
Michael Hennerich59003142007-10-21 16:54:27 +080061
62/*
63 * Driver needs to know address, irq and flag pin.
64 */
65
66#define ISP1761_BASE 0x203C0000
67#define ISP1761_IRQ IRQ_PF7
68
69#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
70static struct resource bfin_isp1761_resources[] = {
71 [0] = {
72 .name = "isp1761-regs",
73 .start = ISP1761_BASE + 0x00000000,
74 .end = ISP1761_BASE + 0x000fffff,
75 .flags = IORESOURCE_MEM,
76 },
77 [1] = {
78 .start = ISP1761_IRQ,
79 .end = ISP1761_IRQ,
80 .flags = IORESOURCE_IRQ,
81 },
82};
83
84static struct platform_device bfin_isp1761_device = {
85 .name = "isp1761",
86 .id = 0,
87 .num_resources = ARRAY_SIZE(bfin_isp1761_resources),
88 .resource = bfin_isp1761_resources,
89};
90
91static struct platform_device *bfin_isp1761_devices[] = {
92 &bfin_isp1761_device,
93};
94
95int __init bfin_isp1761_init(void)
96{
97 unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
98
Harvey Harrisonb85d8582008-04-23 09:39:01 +080099 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Michael Hennerich59003142007-10-21 16:54:27 +0800100 set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING);
101
102 return platform_add_devices(bfin_isp1761_devices, num_devices);
103}
104
105void __exit bfin_isp1761_exit(void)
106{
107 platform_device_unregister(&bfin_isp1761_device);
108}
109
110arch_initcall(bfin_isp1761_init);
111#endif
112
Michael Hennerich1089e222007-12-24 11:49:29 +0800113#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
114static struct resource musb_resources[] = {
115 [0] = {
116 .start = 0xffc03800,
117 .end = 0xffc03cff,
118 .flags = IORESOURCE_MEM,
119 },
120 [1] = { /* general IRQ */
121 .start = IRQ_USB_INT0,
122 .end = IRQ_USB_INT0,
123 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
124 },
125 [2] = { /* DMA IRQ */
126 .start = IRQ_USB_DMA,
127 .end = IRQ_USB_DMA,
128 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
129 },
130};
131
132static struct musb_hdrc_platform_data musb_plat = {
133#if defined(CONFIG_USB_MUSB_OTG)
134 .mode = MUSB_OTG,
135#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
136 .mode = MUSB_HOST,
137#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
138 .mode = MUSB_PERIPHERAL,
139#endif
140 .multipoint = 0,
141};
142
143static u64 musb_dmamask = ~(u32)0;
144
145static struct platform_device musb_device = {
146 .name = "musb_hdrc",
147 .id = 0,
148 .dev = {
149 .dma_mask = &musb_dmamask,
150 .coherent_dma_mask = 0xffffffff,
151 .platform_data = &musb_plat,
152 },
153 .num_resources = ARRAY_SIZE(musb_resources),
154 .resource = musb_resources,
155};
156#endif
157
158#if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
159
160static struct resource bf52x_t350mcqb_resources[] = {
161 {
162 .start = IRQ_PPI_ERROR,
163 .end = IRQ_PPI_ERROR,
164 .flags = IORESOURCE_IRQ,
165 },
166};
167
168static struct platform_device bf52x_t350mcqb_device = {
169 .name = "bfin-t350mcqb",
170 .id = -1,
171 .num_resources = ARRAY_SIZE(bf52x_t350mcqb_resources),
172 .resource = bf52x_t350mcqb_resources,
173};
174#endif
175
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800176#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
177static struct mtd_partition ezkit_partitions[] = {
178 {
179 .name = "Bootloader",
180 .size = 0x40000,
181 .offset = 0,
182 }, {
183 .name = "Kernel",
184 .size = 0x1C0000,
185 .offset = MTDPART_OFS_APPEND,
186 }, {
187 .name = "RootFS",
188 .size = MTDPART_SIZ_FULL,
189 .offset = MTDPART_OFS_APPEND,
190 }
191};
192
193static struct physmap_flash_data ezkit_flash_data = {
194 .width = 2,
195 .parts = ezkit_partitions,
196 .nr_parts = ARRAY_SIZE(ezkit_partitions),
197};
198
199static struct resource ezkit_flash_resource = {
200 .start = 0x20000000,
201 .end = 0x203fffff,
202 .flags = IORESOURCE_MEM,
203};
204
205static struct platform_device ezkit_flash_device = {
206 .name = "physmap-flash",
207 .id = 0,
208 .dev = {
209 .platform_data = &ezkit_flash_data,
210 },
211 .num_resources = 1,
212 .resource = &ezkit_flash_resource,
213};
214#endif
215
Michael Hennerich64307f72007-10-29 16:55:18 +0800216#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
217static struct mtd_partition partition_info[] = {
218 {
219 .name = "Linux Kernel",
220 .offset = 0,
221 .size = 4 * SIZE_1M,
222 },
223 {
224 .name = "File System",
Mike Frysingeredf05642008-02-25 11:38:11 +0800225 .offset = MTDPART_OFS_APPEND,
226 .size = MTDPART_SIZ_FULL,
Michael Hennerich64307f72007-10-29 16:55:18 +0800227 },
228};
229
230static struct bf5xx_nand_platform bf5xx_nand_platform = {
231 .page_size = NFC_PG_SIZE_256,
232 .data_width = NFC_NWIDTH_8,
233 .partitions = partition_info,
234 .nr_partitions = ARRAY_SIZE(partition_info),
235 .rd_dly = 3,
236 .wr_dly = 3,
237};
238
239static struct resource bf5xx_nand_resources[] = {
240 {
241 .start = NFC_CTL,
242 .end = NFC_DATA_RD + 2,
243 .flags = IORESOURCE_MEM,
244 },
245 {
246 .start = CH_NFC,
247 .end = CH_NFC,
248 .flags = IORESOURCE_IRQ,
249 },
250};
251
252static struct platform_device bf5xx_nand_device = {
253 .name = "bf5xx-nand",
254 .id = 0,
255 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
256 .resource = bf5xx_nand_resources,
257 .dev = {
258 .platform_data = &bf5xx_nand_platform,
259 },
260};
261#endif
262
Michael Hennerich59003142007-10-21 16:54:27 +0800263#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
264static struct resource bfin_pcmcia_cf_resources[] = {
265 {
266 .start = 0x20310000, /* IO PORT */
267 .end = 0x20312000,
268 .flags = IORESOURCE_MEM,
269 }, {
270 .start = 0x20311000, /* Attribute Memory */
271 .end = 0x20311FFF,
272 .flags = IORESOURCE_MEM,
273 }, {
274 .start = IRQ_PF4,
275 .end = IRQ_PF4,
276 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
277 }, {
278 .start = 6, /* Card Detect PF6 */
279 .end = 6,
280 .flags = IORESOURCE_IRQ,
281 },
282};
283
284static struct platform_device bfin_pcmcia_cf_device = {
285 .name = "bfin_cf_pcmcia",
286 .id = -1,
287 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
288 .resource = bfin_pcmcia_cf_resources,
289};
290#endif
291
292#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
293static struct platform_device rtc_device = {
294 .name = "rtc-bfin",
295 .id = -1,
296};
297#endif
298
299#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
300static struct resource smc91x_resources[] = {
301 {
302 .name = "smc91x-regs",
303 .start = 0x20300300,
304 .end = 0x20300300 + 16,
305 .flags = IORESOURCE_MEM,
306 }, {
307
308 .start = IRQ_PF7,
309 .end = IRQ_PF7,
310 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
311 },
312};
313static struct platform_device smc91x_device = {
314 .name = "smc91x",
315 .id = 0,
316 .num_resources = ARRAY_SIZE(smc91x_resources),
317 .resource = smc91x_resources,
318};
319#endif
320
321#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
322static struct resource dm9000_resources[] = {
323 [0] = {
324 .start = 0x203FB800,
325 .end = 0x203FB800 + 8,
326 .flags = IORESOURCE_MEM,
327 },
328 [1] = {
329 .start = IRQ_PF9,
330 .end = IRQ_PF9,
331 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
332 },
333};
334
335static struct platform_device dm9000_device = {
336 .name = "dm9000",
337 .id = -1,
338 .num_resources = ARRAY_SIZE(dm9000_resources),
339 .resource = dm9000_resources,
340};
341#endif
342
343#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
344static struct resource sl811_hcd_resources[] = {
345 {
346 .start = 0x20340000,
347 .end = 0x20340000,
348 .flags = IORESOURCE_MEM,
349 }, {
350 .start = 0x20340004,
351 .end = 0x20340004,
352 .flags = IORESOURCE_MEM,
353 }, {
354 .start = CONFIG_USB_SL811_BFIN_IRQ,
355 .end = CONFIG_USB_SL811_BFIN_IRQ,
356 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
357 },
358};
359
360#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
361void sl811_port_power(struct device *dev, int is_on)
362{
363 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
Michael Hennerichacbcd262008-01-22 18:36:20 +0800364 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
Michael Hennerich59003142007-10-21 16:54:27 +0800365}
366#endif
367
368static struct sl811_platform_data sl811_priv = {
369 .potpg = 10,
370 .power = 250, /* == 500mA */
371#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
372 .port_power = &sl811_port_power,
373#endif
374};
375
376static struct platform_device sl811_hcd_device = {
377 .name = "sl811-hcd",
378 .id = 0,
379 .dev = {
380 .platform_data = &sl811_priv,
381 },
382 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
383 .resource = sl811_hcd_resources,
384};
385#endif
386
387#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
388static struct resource isp1362_hcd_resources[] = {
389 {
390 .start = 0x20360000,
391 .end = 0x20360000,
392 .flags = IORESOURCE_MEM,
393 }, {
394 .start = 0x20360004,
395 .end = 0x20360004,
396 .flags = IORESOURCE_MEM,
397 }, {
398 .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
399 .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
400 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
401 },
402};
403
404static struct isp1362_platform_data isp1362_priv = {
405 .sel15Kres = 1,
406 .clknotstop = 0,
407 .oc_enable = 0,
408 .int_act_high = 0,
409 .int_edge_triggered = 0,
410 .remote_wakeup_connected = 0,
411 .no_power_switching = 1,
412 .power_switching_mode = 0,
413};
414
415static struct platform_device isp1362_hcd_device = {
416 .name = "isp1362-hcd",
417 .id = 0,
418 .dev = {
419 .platform_data = &isp1362_priv,
420 },
421 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
422 .resource = isp1362_hcd_resources,
423};
424#endif
425
426#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
427static struct platform_device bfin_mac_device = {
428 .name = "bfin_mac",
429};
430#endif
431
432#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
433static struct resource net2272_bfin_resources[] = {
434 {
435 .start = 0x20300000,
436 .end = 0x20300000 + 0x100,
437 .flags = IORESOURCE_MEM,
438 }, {
439 .start = IRQ_PF7,
440 .end = IRQ_PF7,
441 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
442 },
443};
444
445static struct platform_device net2272_bfin_device = {
446 .name = "net2272",
447 .id = -1,
448 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
449 .resource = net2272_bfin_resources,
450};
451#endif
452
453#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
454/* all SPI peripherals info goes here */
455
456#if defined(CONFIG_MTD_M25P80) \
457 || defined(CONFIG_MTD_M25P80_MODULE)
458static struct mtd_partition bfin_spi_flash_partitions[] = {
459 {
460 .name = "bootloader",
Grace Panac76d882008-04-24 06:33:56 +0800461 .size = 0x00040000,
Michael Hennerich59003142007-10-21 16:54:27 +0800462 .offset = 0,
463 .mask_flags = MTD_CAP_ROM
464 }, {
465 .name = "kernel",
466 .size = 0xe0000,
Mike Frysingeredf05642008-02-25 11:38:11 +0800467 .offset = MTDPART_OFS_APPEND,
Michael Hennerich59003142007-10-21 16:54:27 +0800468 }, {
469 .name = "file system",
Mike Frysingeredf05642008-02-25 11:38:11 +0800470 .size = MTDPART_SIZ_FULL,
471 .offset = MTDPART_OFS_APPEND,
Michael Hennerich59003142007-10-21 16:54:27 +0800472 }
473};
474
475static struct flash_platform_data bfin_spi_flash_data = {
476 .name = "m25p80",
477 .parts = bfin_spi_flash_partitions,
478 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
479 .type = "m25p64",
480};
481
482/* SPI flash chip (m25p64) */
483static struct bfin5xx_spi_chip spi_flash_chip_info = {
484 .enable_dma = 0, /* use dma transfer with this chip*/
485 .bits_per_word = 8,
486};
487#endif
488
489#if defined(CONFIG_SPI_ADC_BF533) \
490 || defined(CONFIG_SPI_ADC_BF533_MODULE)
491/* SPI ADC chip */
492static struct bfin5xx_spi_chip spi_adc_chip_info = {
493 .enable_dma = 1, /* use dma transfer with this chip*/
494 .bits_per_word = 16,
495};
496#endif
497
498#if defined(CONFIG_SND_BLACKFIN_AD1836) \
499 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
500static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
501 .enable_dma = 0,
502 .bits_per_word = 16,
503};
504#endif
505
506#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
507static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
508 .enable_dma = 0,
509 .bits_per_word = 16,
510};
511#endif
512
513#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
514static struct bfin5xx_spi_chip spi_mmc_chip_info = {
515 .enable_dma = 1,
516 .bits_per_word = 8,
517};
518#endif
519
520#if defined(CONFIG_PBX)
521static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
522 .ctl_reg = 0x4, /* send zero */
523 .enable_dma = 0,
524 .bits_per_word = 8,
525 .cs_change_per_word = 1,
526};
527#endif
528
Michael Hennerich59003142007-10-21 16:54:27 +0800529#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
530static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
531 .enable_dma = 0,
532 .bits_per_word = 16,
533};
534
535static const struct ad7877_platform_data bfin_ad7877_ts_info = {
536 .model = 7877,
537 .vref_delay_usecs = 50, /* internal, no capacitor */
538 .x_plate_ohms = 419,
539 .y_plate_ohms = 486,
540 .pressure_max = 1000,
541 .pressure_min = 0,
542 .stopacq_polarity = 1,
543 .first_conversion_delay = 3,
544 .acquisition_time = 1,
545 .averaging = 1,
546 .pen_down_acc_interval = 1,
547};
548#endif
549
Michael Hennerichc7d48962007-11-15 21:33:31 +0800550#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
Michael Hennerich0954f702007-11-13 00:16:19 +0800551 && defined(CONFIG_SND_SOC_WM8731_SPI)
552static struct bfin5xx_spi_chip spi_wm8731_chip_info = {
553 .enable_dma = 0,
554 .bits_per_word = 16,
555};
556#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800557
558#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
559static struct bfin5xx_spi_chip spidev_chip_info = {
560 .enable_dma = 0,
561 .bits_per_word = 8,
562};
563#endif
564
Michael Hennerich59003142007-10-21 16:54:27 +0800565static struct spi_board_info bfin_spi_board_info[] __initdata = {
566#if defined(CONFIG_MTD_M25P80) \
567 || defined(CONFIG_MTD_M25P80_MODULE)
568 {
569 /* the modalias must be the same as spi device driver name */
570 .modalias = "m25p80", /* Name of spi_driver for this device */
571 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
572 .bus_num = 0, /* Framework bus number */
573 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
574 .platform_data = &bfin_spi_flash_data,
575 .controller_data = &spi_flash_chip_info,
576 .mode = SPI_MODE_3,
577 },
578#endif
579
580#if defined(CONFIG_SPI_ADC_BF533) \
581 || defined(CONFIG_SPI_ADC_BF533_MODULE)
582 {
583 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
584 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
585 .bus_num = 0, /* Framework bus number */
586 .chip_select = 1, /* Framework chip select. */
587 .platform_data = NULL, /* No spi_driver specific config */
588 .controller_data = &spi_adc_chip_info,
589 },
590#endif
591
592#if defined(CONFIG_SND_BLACKFIN_AD1836) \
593 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
594 {
595 .modalias = "ad1836-spi",
596 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
597 .bus_num = 0,
598 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
599 .controller_data = &ad1836_spi_chip_info,
600 },
601#endif
602#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
603 {
604 .modalias = "ad9960-spi",
605 .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
606 .bus_num = 0,
607 .chip_select = 1,
608 .controller_data = &ad9960_spi_chip_info,
609 },
610#endif
611#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
612 {
613 .modalias = "spi_mmc_dummy",
614 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
615 .bus_num = 0,
616 .chip_select = 0,
617 .platform_data = NULL,
618 .controller_data = &spi_mmc_chip_info,
619 .mode = SPI_MODE_3,
620 },
621 {
622 .modalias = "spi_mmc",
623 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
624 .bus_num = 0,
625 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
626 .platform_data = NULL,
627 .controller_data = &spi_mmc_chip_info,
628 .mode = SPI_MODE_3,
629 },
630#endif
631#if defined(CONFIG_PBX)
632 {
633 .modalias = "fxs-spi",
634 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
635 .bus_num = 0,
636 .chip_select = 8 - CONFIG_J11_JUMPER,
637 .controller_data = &spi_si3xxx_chip_info,
638 .mode = SPI_MODE_3,
639 },
640 {
641 .modalias = "fxo-spi",
642 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
643 .bus_num = 0,
644 .chip_select = 8 - CONFIG_J19_JUMPER,
645 .controller_data = &spi_si3xxx_chip_info,
646 .mode = SPI_MODE_3,
647 },
648#endif
Michael Hennerich59003142007-10-21 16:54:27 +0800649#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
650 {
651 .modalias = "ad7877",
652 .platform_data = &bfin_ad7877_ts_info,
653 .irq = IRQ_PF6,
654 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Michael Hennerich0954f702007-11-13 00:16:19 +0800655 .bus_num = 0,
Michael Hennerich59003142007-10-21 16:54:27 +0800656 .chip_select = 1,
657 .controller_data = &spi_ad7877_chip_info,
658 },
659#endif
Michael Hennerichc7d48962007-11-15 21:33:31 +0800660#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
Michael Hennerich0954f702007-11-13 00:16:19 +0800661 && defined(CONFIG_SND_SOC_WM8731_SPI)
662 {
663 .modalias = "wm8731",
664 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
665 .bus_num = 0,
666 .chip_select = 5,
667 .controller_data = &spi_wm8731_chip_info,
668 .mode = SPI_MODE_0,
669 },
670#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800671#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
672 {
673 .modalias = "spidev",
674 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
675 .bus_num = 0,
676 .chip_select = 1,
677 .controller_data = &spidev_chip_info,
678 },
679#endif
Michael Hennerich59003142007-10-21 16:54:27 +0800680};
681
682/* SPI controller data */
683static struct bfin5xx_spi_master bfin_spi0_info = {
684 .num_chipselect = 8,
685 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800686 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Michael Hennerich59003142007-10-21 16:54:27 +0800687};
688
689/* SPI (0) */
690static struct resource bfin_spi0_resource[] = {
691 [0] = {
692 .start = SPI0_REGBASE,
693 .end = SPI0_REGBASE + 0xFF,
694 .flags = IORESOURCE_MEM,
695 },
696 [1] = {
697 .start = CH_SPI,
698 .end = CH_SPI,
699 .flags = IORESOURCE_IRQ,
700 },
701};
702
703static struct platform_device bfin_spi0_device = {
704 .name = "bfin-spi",
705 .id = 0, /* Bus number */
706 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
707 .resource = bfin_spi0_resource,
708 .dev = {
709 .platform_data = &bfin_spi0_info, /* Passed to driver */
710 },
711};
712#endif /* spi master and devices */
713
714#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
715static struct platform_device bfin_fb_device = {
716 .name = "bf537-lq035",
717};
718#endif
719
720#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
721static struct platform_device bfin_fb_adv7393_device = {
722 .name = "bfin-adv7393",
723};
724#endif
725
726#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
727static struct resource bfin_uart_resources[] = {
728#ifdef CONFIG_SERIAL_BFIN_UART0
729 {
730 .start = 0xFFC00400,
731 .end = 0xFFC004FF,
732 .flags = IORESOURCE_MEM,
733 },
734#endif
735#ifdef CONFIG_SERIAL_BFIN_UART1
736 {
737 .start = 0xFFC02000,
738 .end = 0xFFC020FF,
739 .flags = IORESOURCE_MEM,
740 },
741#endif
742};
743
744static struct platform_device bfin_uart_device = {
745 .name = "bfin-uart",
746 .id = 1,
747 .num_resources = ARRAY_SIZE(bfin_uart_resources),
748 .resource = bfin_uart_resources,
749};
750#endif
751
Graf Yang5be36d22008-04-25 03:09:15 +0800752#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
753static struct resource bfin_sir_resources[] = {
754#ifdef CONFIG_BFIN_SIR0
755 {
756 .start = 0xFFC00400,
757 .end = 0xFFC004FF,
758 .flags = IORESOURCE_MEM,
759 },
760#endif
761#ifdef CONFIG_BFIN_SIR1
762 {
763 .start = 0xFFC02000,
764 .end = 0xFFC020FF,
765 .flags = IORESOURCE_MEM,
766 },
767#endif
768};
769
770static struct platform_device bfin_sir_device = {
771 .name = "bfin_sir",
772 .id = 0,
773 .num_resources = ARRAY_SIZE(bfin_sir_resources),
774 .resource = bfin_sir_resources,
775};
776#endif
777
Michael Hennerich59003142007-10-21 16:54:27 +0800778#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
779static struct resource bfin_twi0_resource[] = {
780 [0] = {
781 .start = TWI0_REGBASE,
782 .end = TWI0_REGBASE,
783 .flags = IORESOURCE_MEM,
784 },
785 [1] = {
786 .start = IRQ_TWI,
787 .end = IRQ_TWI,
788 .flags = IORESOURCE_IRQ,
789 },
790};
791
792static struct platform_device i2c_bfin_twi_device = {
793 .name = "i2c-bfin-twi",
794 .id = 0,
795 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
796 .resource = bfin_twi0_resource,
797};
798#endif
799
800#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
801static struct platform_device bfin_sport0_uart_device = {
802 .name = "bfin-sport-uart",
803 .id = 0,
804};
805
806static struct platform_device bfin_sport1_uart_device = {
807 .name = "bfin-sport-uart",
808 .id = 1,
809};
810#endif
811
812#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
813#define PATA_INT 55
814
815static struct pata_platform_info bfin_pata_platform_data = {
816 .ioport_shift = 1,
817 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
818};
819
820static struct resource bfin_pata_resources[] = {
821 {
822 .start = 0x20314020,
823 .end = 0x2031403F,
824 .flags = IORESOURCE_MEM,
825 },
826 {
827 .start = 0x2031401C,
828 .end = 0x2031401F,
829 .flags = IORESOURCE_MEM,
830 },
831 {
832 .start = PATA_INT,
833 .end = PATA_INT,
834 .flags = IORESOURCE_IRQ,
835 },
836};
837
838static struct platform_device bfin_pata_device = {
839 .name = "pata_platform",
840 .id = -1,
841 .num_resources = ARRAY_SIZE(bfin_pata_resources),
842 .resource = bfin_pata_resources,
843 .dev = {
844 .platform_data = &bfin_pata_platform_data,
845 }
846};
847#endif
848
Michael Hennerich1089e222007-12-24 11:49:29 +0800849#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
850#include <linux/input.h>
851#include <linux/gpio_keys.h>
852
853static struct gpio_keys_button bfin_gpio_keys_table[] = {
854 {BTN_0, GPIO_PG0, 1, "gpio-keys: BTN0"},
855 {BTN_1, GPIO_PG13, 1, "gpio-keys: BTN1"},
856};
857
858static struct gpio_keys_platform_data bfin_gpio_keys_data = {
859 .buttons = bfin_gpio_keys_table,
860 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
861};
862
863static struct platform_device bfin_device_gpiokeys = {
864 .name = "gpio-keys",
865 .dev = {
866 .platform_data = &bfin_gpio_keys_data,
867 },
868};
869#endif
870
Mike Frysingercad2ab62008-02-22 17:01:31 +0800871static struct resource bfin_gpios_resources = {
872 .start = 0,
873 .end = MAX_BLACKFIN_GPIOS - 1,
874 .flags = IORESOURCE_IRQ,
875};
876
877static struct platform_device bfin_gpios_device = {
878 .name = "simple-gpio",
879 .id = -1,
880 .num_resources = 1,
881 .resource = &bfin_gpios_resources,
882};
883
Michael Hennerich14b03202008-05-07 11:41:26 +0800884static const unsigned int cclk_vlev_datasheet[] =
885{
886 VRPAIR(VLEV_100, 400000000),
887 VRPAIR(VLEV_105, 426000000),
888 VRPAIR(VLEV_110, 500000000),
889 VRPAIR(VLEV_115, 533000000),
890 VRPAIR(VLEV_120, 600000000),
891};
892
893static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
894 .tuple_tab = cclk_vlev_datasheet,
895 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
896 .vr_settling_time = 25 /* us */,
897};
898
899static struct platform_device bfin_dpmc = {
900 .name = "bfin dpmc",
901 .dev = {
902 .platform_data = &bfin_dmpc_vreg_data,
903 },
904};
905
Michael Hennerich59003142007-10-21 16:54:27 +0800906static struct platform_device *stamp_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +0800907
908 &bfin_dpmc,
909
Michael Hennerich64307f72007-10-29 16:55:18 +0800910#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
911 &bf5xx_nand_device,
912#endif
913
Michael Hennerich59003142007-10-21 16:54:27 +0800914#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
915 &bfin_pcmcia_cf_device,
916#endif
917
918#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
919 &rtc_device,
920#endif
921
922#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
923 &sl811_hcd_device,
924#endif
925
926#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
927 &isp1362_hcd_device,
928#endif
929
Michael Hennerich1089e222007-12-24 11:49:29 +0800930#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
931 &musb_device,
932#endif
933
Michael Hennerich59003142007-10-21 16:54:27 +0800934#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
935 &smc91x_device,
936#endif
937
938#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
939 &dm9000_device,
940#endif
941
942#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
943 &bfin_mac_device,
944#endif
945
946#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
947 &net2272_bfin_device,
948#endif
949
950#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
951 &bfin_spi0_device,
952#endif
953
954#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
955 &bfin_fb_device,
956#endif
957
Michael Hennerich1089e222007-12-24 11:49:29 +0800958#if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
959 &bf52x_t350mcqb_device,
960#endif
961
Michael Hennerich59003142007-10-21 16:54:27 +0800962#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
963 &bfin_fb_adv7393_device,
964#endif
965
966#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
967 &bfin_uart_device,
968#endif
969
Graf Yang5be36d22008-04-25 03:09:15 +0800970#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
971 &bfin_sir_device,
972#endif
973
Michael Hennerich59003142007-10-21 16:54:27 +0800974#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
975 &i2c_bfin_twi_device,
976#endif
977
978#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
979 &bfin_sport0_uart_device,
980 &bfin_sport1_uart_device,
981#endif
982
983#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
984 &bfin_pata_device,
985#endif
Michael Hennerich1089e222007-12-24 11:49:29 +0800986
987#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
988 &bfin_device_gpiokeys,
989#endif
Mike Frysingercad2ab62008-02-22 17:01:31 +0800990
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800991#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
992 &ezkit_flash_device,
993#endif
994
Mike Frysingercad2ab62008-02-22 17:01:31 +0800995 &bfin_gpios_device,
Michael Hennerich59003142007-10-21 16:54:27 +0800996};
997
998static int __init stamp_init(void)
999{
Harvey Harrisonb85d8582008-04-23 09:39:01 +08001000 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Michael Hennerich59003142007-10-21 16:54:27 +08001001 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
1002#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1003 spi_register_board_info(bfin_spi_board_info,
1004 ARRAY_SIZE(bfin_spi_board_info));
1005#endif
1006
1007#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
1008 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
1009#endif
1010 return 0;
1011}
1012
1013arch_initcall(stamp_init);
1014
1015void native_machine_restart(char *cmd)
1016{
1017 /* workaround reboot hang when booting from SPI */
1018 if ((bfin_read_SYSCR() & 0x7) == 0x3)
1019 bfin_gpio_reset_spi0_ssel1();
1020}
Mike Frysinger137b1522007-11-22 16:07:03 +08001021
Mike Frysinger9862cc52007-11-15 21:21:20 +08001022void bfin_get_ether_addr(char *addr)
Mike Frysinger137b1522007-11-22 16:07:03 +08001023{
Mike Frysinger181afa92008-02-25 11:42:17 +08001024 /* the MAC is stored in OTP memory page 0xDF */
1025 u32 ret;
1026 u64 otp_mac;
1027 u32 (*otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)0xEF00001A;
1028
1029 ret = otp_read(0xDF, 0x00, &otp_mac);
1030 if (!(ret & 0x1)) {
1031 char *otp_mac_p = (char *)&otp_mac;
1032 for (ret = 0; ret < 6; ++ret)
1033 addr[ret] = otp_mac_p[5 - ret];
1034 }
Mike Frysinger137b1522007-11-22 16:07:03 +08001035}
Mike Frysinger9862cc52007-11-15 21:21:20 +08001036EXPORT_SYMBOL(bfin_get_ether_addr);