2 * File: arch/blackfin/mach-bf537/boards/cm_bf537.c
3 * Based on: arch/blackfin/mach-bf533/boards/ezkit.c
4 * Author: Aidan Williams <aidan@nicta.com.au>
7 * Description: Board description file
10 * Copyright 2005 National ICT Australia (NICTA)
11 * Copyright 2004-2006 Analog Devices Inc.
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
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.
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.
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
31 #include <linux/device.h>
32 #include <linux/etherdevice.h>
33 #include <linux/platform_device.h>
34 #include <linux/mtd/mtd.h>
35 #include <linux/mtd/partitions.h>
36 #include <linux/spi/spi.h>
37 #include <linux/spi/flash.h>
38 #include <linux/usb/isp1362.h>
39 #include <linux/ata_platform.h>
40 #include <linux/irq.h>
42 #include <asm/bfin5xx_spi.h>
43 #include <asm/portmux.h>
46 * Name the Board for the /proc/cpuinfo
48 const char bfin_board_name[] = "Bluetechnix CM BF537";
50 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
51 /* all SPI peripherals info goes here */
53 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
54 static struct mtd_partition bfin_spi_flash_partitions[] = {
59 .mask_flags = MTD_CAP_ROM
65 .name = "file system",
71 static struct flash_platform_data bfin_spi_flash_data = {
73 .parts = bfin_spi_flash_partitions,
74 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
78 /* SPI flash chip (m25p64) */
79 static struct bfin5xx_spi_chip spi_flash_chip_info = {
80 .enable_dma = 0, /* use dma transfer with this chip*/
85 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
87 static struct bfin5xx_spi_chip spi_adc_chip_info = {
88 .enable_dma = 1, /* use dma transfer with this chip*/
93 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
94 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
100 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
101 static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
107 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
108 static struct bfin5xx_spi_chip spi_mmc_chip_info = {
114 static struct spi_board_info bfin_spi_board_info[] __initdata = {
115 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
117 /* the modalias must be the same as spi device driver name */
118 .modalias = "m25p80", /* Name of spi_driver for this device */
119 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
120 .bus_num = 0, /* Framework bus number */
121 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
122 .platform_data = &bfin_spi_flash_data,
123 .controller_data = &spi_flash_chip_info,
128 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
130 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
131 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
132 .bus_num = 0, /* Framework bus number */
133 .chip_select = 1, /* Framework chip select. */
134 .platform_data = NULL, /* No spi_driver specific config */
135 .controller_data = &spi_adc_chip_info,
139 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
141 .modalias = "ad1836-spi",
142 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
144 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
145 .controller_data = &ad1836_spi_chip_info,
149 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
151 .modalias = "ad9960-spi",
152 .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
155 .controller_data = &ad9960_spi_chip_info,
159 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
161 .modalias = "spi_mmc_dummy",
162 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
165 .platform_data = NULL,
166 .controller_data = &spi_mmc_chip_info,
170 .modalias = "spi_mmc",
171 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
173 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
174 .platform_data = NULL,
175 .controller_data = &spi_mmc_chip_info,
182 static struct resource bfin_spi0_resource[] = {
184 .start = SPI0_REGBASE,
185 .end = SPI0_REGBASE + 0xFF,
186 .flags = IORESOURCE_MEM,
191 .flags = IORESOURCE_IRQ,
195 /* SPI controller data */
196 static struct bfin5xx_spi_master bfin_spi0_info = {
198 .enable_dma = 1, /* master has the ability to do dma transfer */
199 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
202 static struct platform_device bfin_spi0_device = {
204 .id = 0, /* Bus number */
205 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
206 .resource = bfin_spi0_resource,
208 .platform_data = &bfin_spi0_info, /* Passed to driver */
211 #endif /* spi master and devices */
213 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
214 static struct platform_device rtc_device = {
220 #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
221 static struct platform_device hitachi_fb_device = {
222 .name = "hitachi-tx09",
226 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
227 static struct resource smc91x_resources[] = {
230 .end = 0x20200300 + 16,
231 .flags = IORESOURCE_MEM,
235 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
239 static struct platform_device smc91x_device = {
242 .num_resources = ARRAY_SIZE(smc91x_resources),
243 .resource = smc91x_resources,
247 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
248 static struct resource isp1362_hcd_resources[] = {
252 .flags = IORESOURCE_MEM,
256 .flags = IORESOURCE_MEM,
260 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
264 static struct isp1362_platform_data isp1362_priv = {
269 .int_edge_triggered = 0,
270 .remote_wakeup_connected = 0,
271 .no_power_switching = 1,
272 .power_switching_mode = 0,
275 static struct platform_device isp1362_hcd_device = {
276 .name = "isp1362-hcd",
279 .platform_data = &isp1362_priv,
281 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
282 .resource = isp1362_hcd_resources,
286 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
287 static struct resource net2272_bfin_resources[] = {
290 .end = 0x20200000 + 0x100,
291 .flags = IORESOURCE_MEM,
295 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
299 static struct platform_device net2272_bfin_device = {
302 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
303 .resource = net2272_bfin_resources,
307 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
308 static struct resource bfin_uart_resources[] = {
312 .flags = IORESOURCE_MEM,
316 .flags = IORESOURCE_MEM,
320 static struct platform_device bfin_uart_device = {
323 .num_resources = ARRAY_SIZE(bfin_uart_resources),
324 .resource = bfin_uart_resources,
328 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
329 static struct resource bfin_sir_resources[] = {
330 #ifdef CONFIG_BFIN_SIR0
334 .flags = IORESOURCE_MEM,
337 #ifdef CONFIG_BFIN_SIR1
341 .flags = IORESOURCE_MEM,
346 static struct platform_device bfin_sir_device = {
349 .num_resources = ARRAY_SIZE(bfin_sir_resources),
350 .resource = bfin_sir_resources,
354 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
355 static struct resource bfin_twi0_resource[] = {
357 .start = TWI0_REGBASE,
359 .flags = IORESOURCE_MEM,
364 .flags = IORESOURCE_IRQ,
368 static struct platform_device i2c_bfin_twi_device = {
369 .name = "i2c-bfin-twi",
371 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
372 .resource = bfin_twi0_resource,
376 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
377 static struct platform_device bfin_sport0_uart_device = {
378 .name = "bfin-sport-uart",
382 static struct platform_device bfin_sport1_uart_device = {
383 .name = "bfin-sport-uart",
388 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
389 static struct platform_device bfin_mac_device = {
394 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
397 static struct pata_platform_info bfin_pata_platform_data = {
399 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
402 static struct resource bfin_pata_resources[] = {
406 .flags = IORESOURCE_MEM,
411 .flags = IORESOURCE_MEM,
416 .flags = IORESOURCE_IRQ,
420 static struct platform_device bfin_pata_device = {
421 .name = "pata_platform",
423 .num_resources = ARRAY_SIZE(bfin_pata_resources),
424 .resource = bfin_pata_resources,
426 .platform_data = &bfin_pata_platform_data,
431 static struct platform_device *cm_bf537_devices[] __initdata = {
432 #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
436 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
440 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
444 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
448 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
449 &i2c_bfin_twi_device,
452 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
453 &bfin_sport0_uart_device,
454 &bfin_sport1_uart_device,
457 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
461 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
465 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
469 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
470 &net2272_bfin_device,
473 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
477 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
482 static int __init cm_bf537_init(void)
484 printk(KERN_INFO "%s(): registering device resources\n", __func__);
485 platform_add_devices(cm_bf537_devices, ARRAY_SIZE(cm_bf537_devices));
486 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
487 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
490 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
491 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
496 arch_initcall(cm_bf537_init);
498 void bfin_get_ether_addr(char *addr)
500 random_ether_addr(addr);
501 printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
503 EXPORT_SYMBOL(bfin_get_ether_addr);