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 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
39 #include <linux/usb/isp1362.h>
41 #include <linux/ata_platform.h>
42 #include <linux/irq.h>
44 #include <asm/bfin5xx_spi.h>
45 #include <asm/portmux.h>
49 * Name the Board for the /proc/cpuinfo
51 const char bfin_board_name[] = "Bluetechnix CM BF537";
53 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
54 /* all SPI peripherals info goes here */
56 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
57 static struct mtd_partition bfin_spi_flash_partitions[] = {
62 .mask_flags = MTD_CAP_ROM
68 .name = "file system",
74 static struct flash_platform_data bfin_spi_flash_data = {
76 .parts = bfin_spi_flash_partitions,
77 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
81 /* SPI flash chip (m25p64) */
82 static struct bfin5xx_spi_chip spi_flash_chip_info = {
83 .enable_dma = 0, /* use dma transfer with this chip*/
88 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
90 static struct bfin5xx_spi_chip spi_adc_chip_info = {
91 .enable_dma = 1, /* use dma transfer with this chip*/
96 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
97 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
103 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
104 static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
110 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
111 static struct bfin5xx_spi_chip spi_mmc_chip_info = {
117 static struct spi_board_info bfin_spi_board_info[] __initdata = {
118 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
120 /* the modalias must be the same as spi device driver name */
121 .modalias = "m25p80", /* Name of spi_driver for this device */
122 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
123 .bus_num = 0, /* Framework bus number */
124 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
125 .platform_data = &bfin_spi_flash_data,
126 .controller_data = &spi_flash_chip_info,
131 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
133 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
134 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
135 .bus_num = 0, /* Framework bus number */
136 .chip_select = 1, /* Framework chip select. */
137 .platform_data = NULL, /* No spi_driver specific config */
138 .controller_data = &spi_adc_chip_info,
142 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
144 .modalias = "ad1836-spi",
145 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
147 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
148 .controller_data = &ad1836_spi_chip_info,
152 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
154 .modalias = "ad9960-spi",
155 .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
158 .controller_data = &ad9960_spi_chip_info,
162 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
164 .modalias = "spi_mmc_dummy",
165 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
168 .platform_data = NULL,
169 .controller_data = &spi_mmc_chip_info,
173 .modalias = "spi_mmc",
174 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
176 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
177 .platform_data = NULL,
178 .controller_data = &spi_mmc_chip_info,
185 static struct resource bfin_spi0_resource[] = {
187 .start = SPI0_REGBASE,
188 .end = SPI0_REGBASE + 0xFF,
189 .flags = IORESOURCE_MEM,
194 .flags = IORESOURCE_IRQ,
198 /* SPI controller data */
199 static struct bfin5xx_spi_master bfin_spi0_info = {
201 .enable_dma = 1, /* master has the ability to do dma transfer */
202 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
205 static struct platform_device bfin_spi0_device = {
207 .id = 0, /* Bus number */
208 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
209 .resource = bfin_spi0_resource,
211 .platform_data = &bfin_spi0_info, /* Passed to driver */
214 #endif /* spi master and devices */
216 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
217 static struct platform_device rtc_device = {
223 #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
224 static struct platform_device hitachi_fb_device = {
225 .name = "hitachi-tx09",
229 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
230 static struct resource smc91x_resources[] = {
233 .end = 0x20200300 + 16,
234 .flags = IORESOURCE_MEM,
238 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
242 static struct platform_device smc91x_device = {
245 .num_resources = ARRAY_SIZE(smc91x_resources),
246 .resource = smc91x_resources,
250 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
251 static struct resource isp1362_hcd_resources[] = {
255 .flags = IORESOURCE_MEM,
259 .flags = IORESOURCE_MEM,
263 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
267 static struct isp1362_platform_data isp1362_priv = {
272 .int_edge_triggered = 0,
273 .remote_wakeup_connected = 0,
274 .no_power_switching = 1,
275 .power_switching_mode = 0,
278 static struct platform_device isp1362_hcd_device = {
279 .name = "isp1362-hcd",
282 .platform_data = &isp1362_priv,
284 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
285 .resource = isp1362_hcd_resources,
289 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
290 static struct resource net2272_bfin_resources[] = {
293 .end = 0x20200000 + 0x100,
294 .flags = IORESOURCE_MEM,
298 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
302 static struct platform_device net2272_bfin_device = {
305 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
306 .resource = net2272_bfin_resources,
310 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
311 static struct resource bfin_uart_resources[] = {
315 .flags = IORESOURCE_MEM,
319 .flags = IORESOURCE_MEM,
323 static struct platform_device bfin_uart_device = {
326 .num_resources = ARRAY_SIZE(bfin_uart_resources),
327 .resource = bfin_uart_resources,
331 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
332 static struct resource bfin_sir_resources[] = {
333 #ifdef CONFIG_BFIN_SIR0
337 .flags = IORESOURCE_MEM,
340 #ifdef CONFIG_BFIN_SIR1
344 .flags = IORESOURCE_MEM,
349 static struct platform_device bfin_sir_device = {
352 .num_resources = ARRAY_SIZE(bfin_sir_resources),
353 .resource = bfin_sir_resources,
357 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
358 static struct resource bfin_twi0_resource[] = {
360 .start = TWI0_REGBASE,
362 .flags = IORESOURCE_MEM,
367 .flags = IORESOURCE_IRQ,
371 static struct platform_device i2c_bfin_twi_device = {
372 .name = "i2c-bfin-twi",
374 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
375 .resource = bfin_twi0_resource,
379 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
380 static struct platform_device bfin_sport0_uart_device = {
381 .name = "bfin-sport-uart",
385 static struct platform_device bfin_sport1_uart_device = {
386 .name = "bfin-sport-uart",
391 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
392 static struct platform_device bfin_mac_device = {
397 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
400 static struct pata_platform_info bfin_pata_platform_data = {
402 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
405 static struct resource bfin_pata_resources[] = {
409 .flags = IORESOURCE_MEM,
414 .flags = IORESOURCE_MEM,
419 .flags = IORESOURCE_IRQ,
423 static struct platform_device bfin_pata_device = {
424 .name = "pata_platform",
426 .num_resources = ARRAY_SIZE(bfin_pata_resources),
427 .resource = bfin_pata_resources,
429 .platform_data = &bfin_pata_platform_data,
434 static const unsigned int cclk_vlev_datasheet[] =
436 VRPAIR(VLEV_085, 250000000),
437 VRPAIR(VLEV_090, 376000000),
438 VRPAIR(VLEV_095, 426000000),
439 VRPAIR(VLEV_100, 426000000),
440 VRPAIR(VLEV_105, 476000000),
441 VRPAIR(VLEV_110, 476000000),
442 VRPAIR(VLEV_115, 476000000),
443 VRPAIR(VLEV_120, 500000000),
444 VRPAIR(VLEV_125, 533000000),
445 VRPAIR(VLEV_130, 600000000),
448 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
449 .tuple_tab = cclk_vlev_datasheet,
450 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
451 .vr_settling_time = 25 /* us */,
454 static struct platform_device bfin_dpmc = {
457 .platform_data = &bfin_dmpc_vreg_data,
461 static struct platform_device *cm_bf537_devices[] __initdata = {
465 #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
469 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
473 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
477 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
481 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
482 &i2c_bfin_twi_device,
485 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
486 &bfin_sport0_uart_device,
487 &bfin_sport1_uart_device,
490 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
494 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
498 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
502 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
503 &net2272_bfin_device,
506 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
510 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
515 static int __init cm_bf537_init(void)
517 printk(KERN_INFO "%s(): registering device resources\n", __func__);
518 platform_add_devices(cm_bf537_devices, ARRAY_SIZE(cm_bf537_devices));
519 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
520 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
523 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
524 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
529 arch_initcall(cm_bf537_init);
531 void bfin_get_ether_addr(char *addr)
533 random_ether_addr(addr);
534 printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
536 EXPORT_SYMBOL(bfin_get_ether_addr);