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>
27 #include <linux/spi/mmc_spi.h>
30 * Name the Board for the /proc/cpuinfo
32 const char bfin_board_name
[] = "Bluetechnix CM BF537U";
34 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
35 /* all SPI peripherals info goes here */
37 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
38 static struct mtd_partition bfin_spi_flash_partitions
[] = {
40 .name
= "bootloader(spi)",
43 .mask_flags
= MTD_CAP_ROM
45 .name
= "linux kernel(spi)",
49 .name
= "file system(spi)",
55 static struct flash_platform_data bfin_spi_flash_data
= {
57 .parts
= bfin_spi_flash_partitions
,
58 .nr_parts
= ARRAY_SIZE(bfin_spi_flash_partitions
),
62 /* SPI flash chip (m25p64) */
63 static struct bfin5xx_spi_chip spi_flash_chip_info
= {
64 .enable_dma
= 0, /* use dma transfer with this chip*/
69 #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
71 static struct bfin5xx_spi_chip spi_adc_chip_info
= {
72 .enable_dma
= 1, /* use dma transfer with this chip*/
77 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
78 static struct bfin5xx_spi_chip ad1836_spi_chip_info
= {
84 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
85 static struct bfin5xx_spi_chip mmc_spi_chip_info
= {
91 static struct spi_board_info bfin_spi_board_info
[] __initdata
= {
92 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
94 /* the modalias must be the same as spi device driver name */
95 .modalias
= "m25p80", /* Name of spi_driver for this device */
96 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
97 .bus_num
= 0, /* Framework bus number */
98 .chip_select
= 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
99 .platform_data
= &bfin_spi_flash_data
,
100 .controller_data
= &spi_flash_chip_info
,
105 #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
107 .modalias
= "bfin_spi_adc", /* Name of spi_driver for this device */
108 .max_speed_hz
= 6250000, /* max spi clock (SCK) speed in HZ */
109 .bus_num
= 0, /* Framework bus number */
110 .chip_select
= 1, /* Framework chip select. */
111 .platform_data
= NULL
, /* No spi_driver specific config */
112 .controller_data
= &spi_adc_chip_info
,
116 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
118 .modalias
= "ad1836",
119 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
121 .chip_select
= CONFIG_SND_BLACKFIN_SPI_PFBIT
,
122 .controller_data
= &ad1836_spi_chip_info
,
126 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
128 .modalias
= "mmc_spi",
129 .max_speed_hz
= 20000000, /* max spi clock (SCK) speed in HZ */
132 .controller_data
= &mmc_spi_chip_info
,
139 static struct resource bfin_spi0_resource
[] = {
141 .start
= SPI0_REGBASE
,
142 .end
= SPI0_REGBASE
+ 0xFF,
143 .flags
= IORESOURCE_MEM
,
148 .flags
= IORESOURCE_DMA
,
153 .flags
= IORESOURCE_IRQ
,
157 /* SPI controller data */
158 static struct bfin5xx_spi_master bfin_spi0_info
= {
160 .enable_dma
= 1, /* master has the ability to do dma transfer */
161 .pin_req
= {P_SPI0_SCK
, P_SPI0_MISO
, P_SPI0_MOSI
, 0},
164 static struct platform_device bfin_spi0_device
= {
166 .id
= 0, /* Bus number */
167 .num_resources
= ARRAY_SIZE(bfin_spi0_resource
),
168 .resource
= bfin_spi0_resource
,
170 .platform_data
= &bfin_spi0_info
, /* Passed to driver */
173 #endif /* spi master and devices */
175 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
176 static struct platform_device rtc_device
= {
182 #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
183 static struct platform_device hitachi_fb_device
= {
184 .name
= "hitachi-tx09",
188 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
189 #include <linux/smc91x.h>
191 static struct smc91x_platdata smc91x_info
= {
192 .flags
= SMC91X_USE_16BIT
| SMC91X_NOWAIT
,
193 .leda
= RPC_LED_100_10
,
194 .ledb
= RPC_LED_TX_RX
,
197 static struct resource smc91x_resources
[] = {
200 .end
= 0x20200300 + 16,
201 .flags
= IORESOURCE_MEM
,
205 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
209 static struct platform_device smc91x_device
= {
212 .num_resources
= ARRAY_SIZE(smc91x_resources
),
213 .resource
= smc91x_resources
,
215 .platform_data
= &smc91x_info
,
220 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
221 static struct resource isp1362_hcd_resources
[] = {
225 .flags
= IORESOURCE_MEM
,
229 .flags
= IORESOURCE_MEM
,
233 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
237 static struct isp1362_platform_data isp1362_priv
= {
242 .int_edge_triggered
= 0,
243 .remote_wakeup_connected
= 0,
244 .no_power_switching
= 1,
245 .power_switching_mode
= 0,
248 static struct platform_device isp1362_hcd_device
= {
249 .name
= "isp1362-hcd",
252 .platform_data
= &isp1362_priv
,
254 .num_resources
= ARRAY_SIZE(isp1362_hcd_resources
),
255 .resource
= isp1362_hcd_resources
,
259 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
260 static struct resource net2272_bfin_resources
[] = {
263 .end
= 0x20200000 + 0x100,
264 .flags
= IORESOURCE_MEM
,
268 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
272 static struct platform_device net2272_bfin_device
= {
275 .num_resources
= ARRAY_SIZE(net2272_bfin_resources
),
276 .resource
= net2272_bfin_resources
,
280 static struct resource bfin_gpios_resources
= {
282 .end
= MAX_BLACKFIN_GPIOS
- 1,
283 .flags
= IORESOURCE_IRQ
,
286 static struct platform_device bfin_gpios_device
= {
287 .name
= "simple-gpio",
290 .resource
= &bfin_gpios_resources
,
293 #if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
294 static struct mtd_partition cm_partitions
[] = {
296 .name
= "bootloader(nor)",
300 .name
= "linux kernel(nor)",
302 .offset
= MTDPART_OFS_APPEND
,
304 .name
= "file system(nor)",
305 .size
= MTDPART_SIZ_FULL
,
306 .offset
= MTDPART_OFS_APPEND
,
310 static struct physmap_flash_data cm_flash_data
= {
312 .parts
= cm_partitions
,
313 .nr_parts
= ARRAY_SIZE(cm_partitions
),
316 static unsigned cm_flash_gpios
[] = { GPIO_PH0
};
318 static struct resource cm_flash_resource
[] = {
323 .flags
= IORESOURCE_MEM
,
325 .start
= (unsigned long)cm_flash_gpios
,
326 .end
= ARRAY_SIZE(cm_flash_gpios
),
327 .flags
= IORESOURCE_IRQ
,
331 static struct platform_device cm_flash_device
= {
332 .name
= "gpio-addr-flash",
335 .platform_data
= &cm_flash_data
,
337 .num_resources
= ARRAY_SIZE(cm_flash_resource
),
338 .resource
= cm_flash_resource
,
342 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
343 static struct resource bfin_uart_resources
[] = {
347 .flags
= IORESOURCE_MEM
,
351 .flags
= IORESOURCE_MEM
,
355 static struct platform_device bfin_uart_device
= {
358 .num_resources
= ARRAY_SIZE(bfin_uart_resources
),
359 .resource
= bfin_uart_resources
,
363 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
364 #ifdef CONFIG_BFIN_SIR0
365 static struct resource bfin_sir0_resources
[] = {
369 .flags
= IORESOURCE_MEM
,
372 .start
= IRQ_UART0_RX
,
373 .end
= IRQ_UART0_RX
+1,
374 .flags
= IORESOURCE_IRQ
,
377 .start
= CH_UART0_RX
,
378 .end
= CH_UART0_RX
+1,
379 .flags
= IORESOURCE_DMA
,
382 static struct platform_device bfin_sir0_device
= {
385 .num_resources
= ARRAY_SIZE(bfin_sir0_resources
),
386 .resource
= bfin_sir0_resources
,
389 #ifdef CONFIG_BFIN_SIR1
390 static struct resource bfin_sir1_resources
[] = {
394 .flags
= IORESOURCE_MEM
,
397 .start
= IRQ_UART1_RX
,
398 .end
= IRQ_UART1_RX
+1,
399 .flags
= IORESOURCE_IRQ
,
402 .start
= CH_UART1_RX
,
403 .end
= CH_UART1_RX
+1,
404 .flags
= IORESOURCE_DMA
,
407 static struct platform_device bfin_sir1_device
= {
410 .num_resources
= ARRAY_SIZE(bfin_sir1_resources
),
411 .resource
= bfin_sir1_resources
,
416 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
417 static struct resource bfin_twi0_resource
[] = {
419 .start
= TWI0_REGBASE
,
421 .flags
= IORESOURCE_MEM
,
426 .flags
= IORESOURCE_IRQ
,
430 static struct platform_device i2c_bfin_twi_device
= {
431 .name
= "i2c-bfin-twi",
433 .num_resources
= ARRAY_SIZE(bfin_twi0_resource
),
434 .resource
= bfin_twi0_resource
,
438 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
439 static struct platform_device bfin_sport0_uart_device
= {
440 .name
= "bfin-sport-uart",
444 static struct platform_device bfin_sport1_uart_device
= {
445 .name
= "bfin-sport-uart",
450 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
451 static struct platform_device bfin_mii_bus
= {
452 .name
= "bfin_mii_bus",
455 static struct platform_device bfin_mac_device
= {
457 .dev
.platform_data
= &bfin_mii_bus
,
461 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
462 #define PATA_INT IRQ_PF14
464 static struct pata_platform_info bfin_pata_platform_data
= {
466 .irq_type
= IRQF_TRIGGER_HIGH
| IRQF_DISABLED
,
469 static struct resource bfin_pata_resources
[] = {
473 .flags
= IORESOURCE_MEM
,
478 .flags
= IORESOURCE_MEM
,
483 .flags
= IORESOURCE_IRQ
,
487 static struct platform_device bfin_pata_device
= {
488 .name
= "pata_platform",
490 .num_resources
= ARRAY_SIZE(bfin_pata_resources
),
491 .resource
= bfin_pata_resources
,
493 .platform_data
= &bfin_pata_platform_data
,
498 static const unsigned int cclk_vlev_datasheet
[] =
500 VRPAIR(VLEV_085
, 250000000),
501 VRPAIR(VLEV_090
, 376000000),
502 VRPAIR(VLEV_095
, 426000000),
503 VRPAIR(VLEV_100
, 426000000),
504 VRPAIR(VLEV_105
, 476000000),
505 VRPAIR(VLEV_110
, 476000000),
506 VRPAIR(VLEV_115
, 476000000),
507 VRPAIR(VLEV_120
, 500000000),
508 VRPAIR(VLEV_125
, 533000000),
509 VRPAIR(VLEV_130
, 600000000),
512 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data
= {
513 .tuple_tab
= cclk_vlev_datasheet
,
514 .tabsize
= ARRAY_SIZE(cclk_vlev_datasheet
),
515 .vr_settling_time
= 25 /* us */,
518 static struct platform_device bfin_dpmc
= {
521 .platform_data
= &bfin_dmpc_vreg_data
,
525 static struct platform_device
*cm_bf537u_devices
[] __initdata
= {
529 #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
533 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
537 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
541 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
542 #ifdef CONFIG_BFIN_SIR0
545 #ifdef CONFIG_BFIN_SIR1
550 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
551 &i2c_bfin_twi_device
,
554 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
555 &bfin_sport0_uart_device
,
556 &bfin_sport1_uart_device
,
559 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
563 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
567 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
572 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
573 &net2272_bfin_device
,
576 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
580 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
584 #if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
591 static int __init
cm_bf537u_init(void)
593 printk(KERN_INFO
"%s(): registering device resources\n", __func__
);
594 platform_add_devices(cm_bf537u_devices
, ARRAY_SIZE(cm_bf537u_devices
));
595 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
596 spi_register_board_info(bfin_spi_board_info
, ARRAY_SIZE(bfin_spi_board_info
));
599 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
600 irq_desc
[PATA_INT
].status
|= IRQ_NOAUTOEN
;
605 arch_initcall(cm_bf537u_init
);
607 void bfin_get_ether_addr(char *addr
)
609 random_ether_addr(addr
);
610 printk(KERN_WARNING
"%s:%s: Setting Ethernet MAC to a random one\n", __FILE__
, __func__
);
612 EXPORT_SYMBOL(bfin_get_ether_addr
);