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