2 * Copyright 2004-2009 Analog Devices Inc.
3 * 2008-2009 Bluetechnix
4 * 2005 National ICT Australia (NICTA)
5 * Aidan Williams <aidan@nicta.com.au>
7 * Licensed under the GPL-2 or later.
10 #include <linux/device.h>
11 #include <linux/etherdevice.h>
12 #include <linux/platform_device.h>
13 #include <linux/mtd/mtd.h>
14 #include <linux/mtd/partitions.h>
15 #include <linux/mtd/physmap.h>
16 #include <linux/spi/spi.h>
17 #include <linux/spi/flash.h>
18 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
19 #include <linux/usb/isp1362.h>
21 #include <linux/ata_platform.h>
22 #include <linux/irq.h>
24 #include <asm/bfin5xx_spi.h>
25 #include <asm/portmux.h>
29 * Name the Board for the /proc/cpuinfo
31 const char bfin_board_name[] = "Bluetechnix CM BF537E";
33 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
34 /* all SPI peripherals info goes here */
36 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
37 static struct mtd_partition bfin_spi_flash_partitions[] = {
39 .name = "bootloader(spi)",
42 .mask_flags = MTD_CAP_ROM
44 .name = "linux kernel(spi)",
48 .name = "file system(spi)",
54 static struct flash_platform_data bfin_spi_flash_data = {
56 .parts = bfin_spi_flash_partitions,
57 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
61 /* SPI flash chip (m25p64) */
62 static struct bfin5xx_spi_chip spi_flash_chip_info = {
63 .enable_dma = 0, /* use dma transfer with this chip*/
68 #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
70 static struct bfin5xx_spi_chip spi_adc_chip_info = {
71 .enable_dma = 1, /* use dma transfer with this chip*/
76 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
77 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
83 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
84 static struct bfin5xx_spi_chip mmc_spi_chip_info = {
90 static struct spi_board_info bfin_spi_board_info[] __initdata = {
91 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
93 /* the modalias must be the same as spi device driver name */
94 .modalias = "m25p80", /* Name of spi_driver for this device */
95 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
96 .bus_num = 0, /* Framework bus number */
97 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
98 .platform_data = &bfin_spi_flash_data,
99 .controller_data = &spi_flash_chip_info,
104 #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
106 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
107 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
108 .bus_num = 0, /* Framework bus number */
109 .chip_select = 1, /* Framework chip select. */
110 .platform_data = NULL, /* No spi_driver specific config */
111 .controller_data = &spi_adc_chip_info,
115 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
117 .modalias = "ad1836",
118 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
120 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
121 .controller_data = &ad1836_spi_chip_info,
125 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
127 .modalias = "mmc_spi",
128 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
131 .controller_data = &mmc_spi_chip_info,
138 static struct resource bfin_spi0_resource[] = {
140 .start = SPI0_REGBASE,
141 .end = SPI0_REGBASE + 0xFF,
142 .flags = IORESOURCE_MEM,
147 .flags = IORESOURCE_DMA,
152 .flags = IORESOURCE_IRQ,
156 /* SPI controller data */
157 static struct bfin5xx_spi_master bfin_spi0_info = {
159 .enable_dma = 1, /* master has the ability to do dma transfer */
160 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
163 static struct platform_device bfin_spi0_device = {
165 .id = 0, /* Bus number */
166 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
167 .resource = bfin_spi0_resource,
169 .platform_data = &bfin_spi0_info, /* Passed to driver */
172 #endif /* spi master and devices */
174 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
175 static struct platform_device rtc_device = {
181 #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
182 static struct platform_device hitachi_fb_device = {
183 .name = "hitachi-tx09",
187 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
188 #include <linux/smc91x.h>
190 static struct smc91x_platdata smc91x_info = {
191 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
192 .leda = RPC_LED_100_10,
193 .ledb = RPC_LED_TX_RX,
196 static struct resource smc91x_resources[] = {
199 .end = 0x20200300 + 16,
200 .flags = IORESOURCE_MEM,
204 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
208 static struct platform_device smc91x_device = {
211 .num_resources = ARRAY_SIZE(smc91x_resources),
212 .resource = smc91x_resources,
214 .platform_data = &smc91x_info,
219 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
220 static struct resource isp1362_hcd_resources[] = {
224 .flags = IORESOURCE_MEM,
228 .flags = IORESOURCE_MEM,
232 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
236 static struct isp1362_platform_data isp1362_priv = {
241 .int_edge_triggered = 0,
242 .remote_wakeup_connected = 0,
243 .no_power_switching = 1,
244 .power_switching_mode = 0,
247 static struct platform_device isp1362_hcd_device = {
248 .name = "isp1362-hcd",
251 .platform_data = &isp1362_priv,
253 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
254 .resource = isp1362_hcd_resources,
258 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
259 static struct resource net2272_bfin_resources[] = {
262 .end = 0x20300000 + 0x100,
263 .flags = IORESOURCE_MEM,
267 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
271 static struct platform_device net2272_bfin_device = {
274 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
275 .resource = net2272_bfin_resources,
279 #if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
280 static struct mtd_partition cm_partitions[] = {
282 .name = "bootloader(nor)",
286 .name = "linux kernel(nor)",
288 .offset = MTDPART_OFS_APPEND,
290 .name = "file system(nor)",
291 .size = MTDPART_SIZ_FULL,
292 .offset = MTDPART_OFS_APPEND,
296 static struct physmap_flash_data cm_flash_data = {
298 .parts = cm_partitions,
299 .nr_parts = ARRAY_SIZE(cm_partitions),
302 static unsigned cm_flash_gpios[] = { GPIO_PF4 };
304 static struct resource cm_flash_resource[] = {
309 .flags = IORESOURCE_MEM,
311 .start = (unsigned long)cm_flash_gpios,
312 .end = ARRAY_SIZE(cm_flash_gpios),
313 .flags = IORESOURCE_IRQ,
317 static struct platform_device cm_flash_device = {
318 .name = "gpio-addr-flash",
321 .platform_data = &cm_flash_data,
323 .num_resources = ARRAY_SIZE(cm_flash_resource),
324 .resource = cm_flash_resource,
328 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
329 #ifdef CONFIG_SERIAL_BFIN_UART0
330 static struct resource bfin_uart0_resources[] = {
334 .flags = IORESOURCE_MEM,
337 .start = IRQ_UART0_RX,
338 .end = IRQ_UART0_RX+1,
339 .flags = IORESOURCE_IRQ,
342 .start = IRQ_UART0_ERROR,
343 .end = IRQ_UART0_ERROR,
344 .flags = IORESOURCE_IRQ,
347 .start = CH_UART0_TX,
349 .flags = IORESOURCE_DMA,
352 .start = CH_UART0_RX,
354 .flags = IORESOURCE_DMA,
356 #ifdef CONFIG_BFIN_UART0_CTSRTS
359 * Refer to arch/blackfin/mach-xxx/include/mach/gpio.h for the GPIO map.
363 .flags = IORESOURCE_IO,
367 * Refer to arch/blackfin/mach-xxx/include/mach/gpio.h for the GPIO map.
371 .flags = IORESOURCE_IO,
376 static struct platform_device bfin_uart0_device = {
379 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
380 .resource = bfin_uart0_resources,
383 #ifdef CONFIG_SERIAL_BFIN_UART1
384 static struct resource bfin_uart1_resources[] = {
388 .flags = IORESOURCE_MEM,
391 .start = IRQ_UART1_RX,
392 .end = IRQ_UART1_RX+1,
393 .flags = IORESOURCE_IRQ,
396 .start = IRQ_UART1_ERROR,
397 .end = IRQ_UART1_ERROR,
398 .flags = IORESOURCE_IRQ,
401 .start = CH_UART1_TX,
403 .flags = IORESOURCE_DMA,
406 .start = CH_UART1_RX,
408 .flags = IORESOURCE_DMA,
410 #ifdef CONFIG_BFIN_UART1_CTSRTS
413 * Refer to arch/blackfin/mach-xxx/include/mach/gpio.h for the GPIO map.
417 .flags = IORESOURCE_IO,
421 * Refer to arch/blackfin/mach-xxx/include/mach/gpio.h for the GPIO map.
425 .flags = IORESOURCE_IO,
430 static struct platform_device bfin_uart1_device = {
433 .num_resources = ARRAY_SIZE(bfin_uart1_resources),
434 .resource = bfin_uart1_resources,
439 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
440 #ifdef CONFIG_BFIN_SIR0
441 static struct resource bfin_sir0_resources[] = {
445 .flags = IORESOURCE_MEM,
448 .start = IRQ_UART0_RX,
449 .end = IRQ_UART0_RX+1,
450 .flags = IORESOURCE_IRQ,
453 .start = CH_UART0_RX,
454 .end = CH_UART0_RX+1,
455 .flags = IORESOURCE_DMA,
458 static struct platform_device bfin_sir0_device = {
461 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
462 .resource = bfin_sir0_resources,
465 #ifdef CONFIG_BFIN_SIR1
466 static struct resource bfin_sir1_resources[] = {
470 .flags = IORESOURCE_MEM,
473 .start = IRQ_UART1_RX,
474 .end = IRQ_UART1_RX+1,
475 .flags = IORESOURCE_IRQ,
478 .start = CH_UART1_RX,
479 .end = CH_UART1_RX+1,
480 .flags = IORESOURCE_DMA,
483 static struct platform_device bfin_sir1_device = {
486 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
487 .resource = bfin_sir1_resources,
492 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
493 static struct resource bfin_twi0_resource[] = {
495 .start = TWI0_REGBASE,
497 .flags = IORESOURCE_MEM,
502 .flags = IORESOURCE_IRQ,
506 static struct platform_device i2c_bfin_twi_device = {
507 .name = "i2c-bfin-twi",
509 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
510 .resource = bfin_twi0_resource,
514 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
515 static struct platform_device bfin_sport0_uart_device = {
516 .name = "bfin-sport-uart",
520 static struct platform_device bfin_sport1_uart_device = {
521 .name = "bfin-sport-uart",
526 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
527 static struct platform_device bfin_mii_bus = {
528 .name = "bfin_mii_bus",
531 static struct platform_device bfin_mac_device = {
533 .dev.platform_data = &bfin_mii_bus,
537 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
538 #define PATA_INT IRQ_PF14
540 static struct pata_platform_info bfin_pata_platform_data = {
542 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
545 static struct resource bfin_pata_resources[] = {
549 .flags = IORESOURCE_MEM,
554 .flags = IORESOURCE_MEM,
559 .flags = IORESOURCE_IRQ,
563 static struct platform_device bfin_pata_device = {
564 .name = "pata_platform",
566 .num_resources = ARRAY_SIZE(bfin_pata_resources),
567 .resource = bfin_pata_resources,
569 .platform_data = &bfin_pata_platform_data,
574 static const unsigned int cclk_vlev_datasheet[] =
576 VRPAIR(VLEV_085, 250000000),
577 VRPAIR(VLEV_090, 376000000),
578 VRPAIR(VLEV_095, 426000000),
579 VRPAIR(VLEV_100, 426000000),
580 VRPAIR(VLEV_105, 476000000),
581 VRPAIR(VLEV_110, 476000000),
582 VRPAIR(VLEV_115, 476000000),
583 VRPAIR(VLEV_120, 500000000),
584 VRPAIR(VLEV_125, 533000000),
585 VRPAIR(VLEV_130, 600000000),
588 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
589 .tuple_tab = cclk_vlev_datasheet,
590 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
591 .vr_settling_time = 25 /* us */,
594 static struct platform_device bfin_dpmc = {
597 .platform_data = &bfin_dmpc_vreg_data,
601 static struct platform_device *cm_bf537e_devices[] __initdata = {
605 #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
609 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
613 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
614 #ifdef CONFIG_SERIAL_BFIN_UART0
617 #ifdef CONFIG_SERIAL_BFIN_UART1
622 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
623 #ifdef CONFIG_BFIN_SIR0
626 #ifdef CONFIG_BFIN_SIR1
631 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
632 &i2c_bfin_twi_device,
635 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
636 &bfin_sport0_uart_device,
637 &bfin_sport1_uart_device,
640 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
644 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
648 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
653 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
654 &net2272_bfin_device,
657 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
661 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
665 #if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
670 static int __init cm_bf537e_init(void)
672 printk(KERN_INFO "%s(): registering device resources\n", __func__);
673 platform_add_devices(cm_bf537e_devices, ARRAY_SIZE(cm_bf537e_devices));
674 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
675 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
678 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
679 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
684 arch_initcall(cm_bf537e_init);
686 void bfin_get_ether_addr(char *addr)
688 random_ether_addr(addr);
689 printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
691 EXPORT_SYMBOL(bfin_get_ether_addr);