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>
47 * Name the Board for the /proc/cpuinfo
49 const char bfin_board_name[] = "Bluetechnix CM BF537";
51 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
52 /* all SPI peripherals info goes here */
54 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
55 static struct mtd_partition bfin_spi_flash_partitions[] = {
60 .mask_flags = MTD_CAP_ROM
66 .name = "file system",
72 static struct flash_platform_data bfin_spi_flash_data = {
74 .parts = bfin_spi_flash_partitions,
75 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
79 /* SPI flash chip (m25p64) */
80 static struct bfin5xx_spi_chip spi_flash_chip_info = {
81 .enable_dma = 0, /* use dma transfer with this chip*/
86 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
88 static struct bfin5xx_spi_chip spi_adc_chip_info = {
89 .enable_dma = 1, /* use dma transfer with this chip*/
94 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
95 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
101 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
102 static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
108 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
109 static struct bfin5xx_spi_chip spi_mmc_chip_info = {
115 static struct spi_board_info bfin_spi_board_info[] __initdata = {
116 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
118 /* the modalias must be the same as spi device driver name */
119 .modalias = "m25p80", /* Name of spi_driver for this device */
120 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
121 .bus_num = 0, /* Framework bus number */
122 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
123 .platform_data = &bfin_spi_flash_data,
124 .controller_data = &spi_flash_chip_info,
129 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
131 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
132 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
133 .bus_num = 0, /* Framework bus number */
134 .chip_select = 1, /* Framework chip select. */
135 .platform_data = NULL, /* No spi_driver specific config */
136 .controller_data = &spi_adc_chip_info,
140 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
142 .modalias = "ad1836-spi",
143 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
145 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
146 .controller_data = &ad1836_spi_chip_info,
150 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
152 .modalias = "ad9960-spi",
153 .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
156 .controller_data = &ad9960_spi_chip_info,
160 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
162 .modalias = "spi_mmc_dummy",
163 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
166 .platform_data = NULL,
167 .controller_data = &spi_mmc_chip_info,
171 .modalias = "spi_mmc",
172 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
174 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
175 .platform_data = NULL,
176 .controller_data = &spi_mmc_chip_info,
183 static struct resource bfin_spi0_resource[] = {
185 .start = SPI0_REGBASE,
186 .end = SPI0_REGBASE + 0xFF,
187 .flags = IORESOURCE_MEM,
192 .flags = IORESOURCE_IRQ,
196 /* SPI controller data */
197 static struct bfin5xx_spi_master bfin_spi0_info = {
199 .enable_dma = 1, /* master has the ability to do dma transfer */
200 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
203 static struct platform_device bfin_spi0_device = {
205 .id = 0, /* Bus number */
206 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
207 .resource = bfin_spi0_resource,
209 .platform_data = &bfin_spi0_info, /* Passed to driver */
212 #endif /* spi master and devices */
214 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
215 static struct platform_device rtc_device = {
221 #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
222 static struct platform_device hitachi_fb_device = {
223 .name = "hitachi-tx09",
227 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
228 static struct resource smc91x_resources[] = {
231 .end = 0x20200300 + 16,
232 .flags = IORESOURCE_MEM,
236 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
240 static struct platform_device smc91x_device = {
243 .num_resources = ARRAY_SIZE(smc91x_resources),
244 .resource = smc91x_resources,
248 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
249 static struct resource isp1362_hcd_resources[] = {
253 .flags = IORESOURCE_MEM,
257 .flags = IORESOURCE_MEM,
261 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
265 static struct isp1362_platform_data isp1362_priv = {
270 .int_edge_triggered = 0,
271 .remote_wakeup_connected = 0,
272 .no_power_switching = 1,
273 .power_switching_mode = 0,
276 static struct platform_device isp1362_hcd_device = {
277 .name = "isp1362-hcd",
280 .platform_data = &isp1362_priv,
282 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
283 .resource = isp1362_hcd_resources,
287 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
288 static struct resource net2272_bfin_resources[] = {
291 .end = 0x20200000 + 0x100,
292 .flags = IORESOURCE_MEM,
296 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
300 static struct platform_device net2272_bfin_device = {
303 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
304 .resource = net2272_bfin_resources,
308 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
309 static struct resource bfin_uart_resources[] = {
313 .flags = IORESOURCE_MEM,
317 .flags = IORESOURCE_MEM,
321 static struct platform_device bfin_uart_device = {
324 .num_resources = ARRAY_SIZE(bfin_uart_resources),
325 .resource = bfin_uart_resources,
329 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
330 static struct resource bfin_sir_resources[] = {
331 #ifdef CONFIG_BFIN_SIR0
335 .flags = IORESOURCE_MEM,
338 #ifdef CONFIG_BFIN_SIR1
342 .flags = IORESOURCE_MEM,
347 static struct platform_device bfin_sir_device = {
350 .num_resources = ARRAY_SIZE(bfin_sir_resources),
351 .resource = bfin_sir_resources,
355 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
356 static struct resource bfin_twi0_resource[] = {
358 .start = TWI0_REGBASE,
360 .flags = IORESOURCE_MEM,
365 .flags = IORESOURCE_IRQ,
369 static struct platform_device i2c_bfin_twi_device = {
370 .name = "i2c-bfin-twi",
372 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
373 .resource = bfin_twi0_resource,
377 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
378 static struct platform_device bfin_sport0_uart_device = {
379 .name = "bfin-sport-uart",
383 static struct platform_device bfin_sport1_uart_device = {
384 .name = "bfin-sport-uart",
389 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
390 static struct platform_device bfin_mac_device = {
395 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
398 static struct pata_platform_info bfin_pata_platform_data = {
400 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
403 static struct resource bfin_pata_resources[] = {
407 .flags = IORESOURCE_MEM,
412 .flags = IORESOURCE_MEM,
417 .flags = IORESOURCE_IRQ,
421 static struct platform_device bfin_pata_device = {
422 .name = "pata_platform",
424 .num_resources = ARRAY_SIZE(bfin_pata_resources),
425 .resource = bfin_pata_resources,
427 .platform_data = &bfin_pata_platform_data,
432 static const unsigned int cclk_vlev_datasheet[] =
434 VRPAIR(VLEV_085, 250000000),
435 VRPAIR(VLEV_090, 376000000),
436 VRPAIR(VLEV_095, 426000000),
437 VRPAIR(VLEV_100, 426000000),
438 VRPAIR(VLEV_105, 476000000),
439 VRPAIR(VLEV_110, 476000000),
440 VRPAIR(VLEV_115, 476000000),
441 VRPAIR(VLEV_120, 500000000),
442 VRPAIR(VLEV_125, 533000000),
443 VRPAIR(VLEV_130, 600000000),
446 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
447 .tuple_tab = cclk_vlev_datasheet,
448 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
449 .vr_settling_time = 25 /* us */,
452 static struct platform_device bfin_dpmc = {
455 .platform_data = &bfin_dmpc_vreg_data,
459 static struct platform_device *cm_bf537_devices[] __initdata = {
463 #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
467 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
471 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
475 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
479 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
480 &i2c_bfin_twi_device,
483 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
484 &bfin_sport0_uart_device,
485 &bfin_sport1_uart_device,
488 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
492 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
496 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
500 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
501 &net2272_bfin_device,
504 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
508 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
513 static int __init cm_bf537_init(void)
515 printk(KERN_INFO "%s(): registering device resources\n", __func__);
516 platform_add_devices(cm_bf537_devices, ARRAY_SIZE(cm_bf537_devices));
517 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
518 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
521 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
522 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
527 arch_initcall(cm_bf537_init);
529 void bfin_get_ether_addr(char *addr)
531 random_ether_addr(addr);
532 printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
534 EXPORT_SYMBOL(bfin_get_ether_addr);