2 * File: arch/blackfin/mach-bf537/boards/cm_bf537u.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/mtd/physmap.h>
37 #include <linux/spi/spi.h>
38 #include <linux/spi/flash.h>
39 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
40 #include <linux/usb/isp1362.h>
42 #include <linux/ata_platform.h>
43 #include <linux/irq.h>
45 #include <asm/bfin5xx_spi.h>
46 #include <asm/portmux.h>
48 #include <linux/spi/mmc_spi.h>
51 * Name the Board for the /proc/cpuinfo
53 const char bfin_board_name[] = "Bluetechnix CM BF537U";
55 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
56 /* all SPI peripherals info goes here */
58 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
59 static struct mtd_partition bfin_spi_flash_partitions[] = {
61 .name = "bootloader(spi)",
64 .mask_flags = MTD_CAP_ROM
66 .name = "linux kernel(spi)",
70 .name = "file system(spi)",
76 static struct flash_platform_data bfin_spi_flash_data = {
78 .parts = bfin_spi_flash_partitions,
79 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
83 /* SPI flash chip (m25p64) */
84 static struct bfin5xx_spi_chip spi_flash_chip_info = {
85 .enable_dma = 0, /* use dma transfer with this chip*/
90 #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
92 static struct bfin5xx_spi_chip spi_adc_chip_info = {
93 .enable_dma = 1, /* use dma transfer with this chip*/
98 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
99 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
105 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
106 static struct bfin5xx_spi_chip mmc_spi_chip_info = {
112 static struct spi_board_info bfin_spi_board_info[] __initdata = {
113 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
115 /* the modalias must be the same as spi device driver name */
116 .modalias = "m25p80", /* Name of spi_driver for this device */
117 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
118 .bus_num = 0, /* Framework bus number */
119 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
120 .platform_data = &bfin_spi_flash_data,
121 .controller_data = &spi_flash_chip_info,
126 #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
128 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
129 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
130 .bus_num = 0, /* Framework bus number */
131 .chip_select = 1, /* Framework chip select. */
132 .platform_data = NULL, /* No spi_driver specific config */
133 .controller_data = &spi_adc_chip_info,
137 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
139 .modalias = "ad1836",
140 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
142 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
143 .controller_data = &ad1836_spi_chip_info,
147 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
149 .modalias = "mmc_spi",
150 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
153 .controller_data = &mmc_spi_chip_info,
160 static struct resource bfin_spi0_resource[] = {
162 .start = SPI0_REGBASE,
163 .end = SPI0_REGBASE + 0xFF,
164 .flags = IORESOURCE_MEM,
169 .flags = IORESOURCE_DMA,
174 .flags = IORESOURCE_IRQ,
178 /* SPI controller data */
179 static struct bfin5xx_spi_master bfin_spi0_info = {
181 .enable_dma = 1, /* master has the ability to do dma transfer */
182 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
185 static struct platform_device bfin_spi0_device = {
187 .id = 0, /* Bus number */
188 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
189 .resource = bfin_spi0_resource,
191 .platform_data = &bfin_spi0_info, /* Passed to driver */
194 #endif /* spi master and devices */
196 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
197 static struct platform_device rtc_device = {
203 #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
204 static struct platform_device hitachi_fb_device = {
205 .name = "hitachi-tx09",
209 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
210 #include <linux/smc91x.h>
212 static struct smc91x_platdata smc91x_info = {
213 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
214 .leda = RPC_LED_100_10,
215 .ledb = RPC_LED_TX_RX,
218 static struct resource smc91x_resources[] = {
221 .end = 0x20200300 + 16,
222 .flags = IORESOURCE_MEM,
226 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
230 static struct platform_device smc91x_device = {
233 .num_resources = ARRAY_SIZE(smc91x_resources),
234 .resource = smc91x_resources,
236 .platform_data = &smc91x_info,
241 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
242 static struct resource isp1362_hcd_resources[] = {
246 .flags = IORESOURCE_MEM,
250 .flags = IORESOURCE_MEM,
254 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
258 static struct isp1362_platform_data isp1362_priv = {
263 .int_edge_triggered = 0,
264 .remote_wakeup_connected = 0,
265 .no_power_switching = 1,
266 .power_switching_mode = 0,
269 static struct platform_device isp1362_hcd_device = {
270 .name = "isp1362-hcd",
273 .platform_data = &isp1362_priv,
275 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
276 .resource = isp1362_hcd_resources,
280 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
281 static struct resource net2272_bfin_resources[] = {
284 .end = 0x20200000 + 0x100,
285 .flags = IORESOURCE_MEM,
289 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
293 static struct platform_device net2272_bfin_device = {
296 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
297 .resource = net2272_bfin_resources,
301 static struct resource bfin_gpios_resources = {
303 .end = MAX_BLACKFIN_GPIOS - 1,
304 .flags = IORESOURCE_IRQ,
307 static struct platform_device bfin_gpios_device = {
308 .name = "simple-gpio",
311 .resource = &bfin_gpios_resources,
314 #if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
315 static struct mtd_partition cm_partitions[] = {
317 .name = "bootloader(nor)",
321 .name = "linux kernel(nor)",
323 .offset = MTDPART_OFS_APPEND,
325 .name = "file system(nor)",
326 .size = MTDPART_SIZ_FULL,
327 .offset = MTDPART_OFS_APPEND,
331 static struct physmap_flash_data cm_flash_data = {
333 .parts = cm_partitions,
334 .nr_parts = ARRAY_SIZE(cm_partitions),
337 static unsigned cm_flash_gpios[] = { GPIO_PH0 };
339 static struct resource cm_flash_resource[] = {
344 .flags = IORESOURCE_MEM,
346 .start = (unsigned long)cm_flash_gpios,
347 .end = ARRAY_SIZE(cm_flash_gpios),
348 .flags = IORESOURCE_IRQ,
352 static struct platform_device cm_flash_device = {
353 .name = "gpio-addr-flash",
356 .platform_data = &cm_flash_data,
358 .num_resources = ARRAY_SIZE(cm_flash_resource),
359 .resource = cm_flash_resource,
363 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
364 static struct resource bfin_uart_resources[] = {
368 .flags = IORESOURCE_MEM,
372 .flags = IORESOURCE_MEM,
376 static struct platform_device bfin_uart_device = {
379 .num_resources = ARRAY_SIZE(bfin_uart_resources),
380 .resource = bfin_uart_resources,
384 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
385 #ifdef CONFIG_BFIN_SIR0
386 static struct resource bfin_sir0_resources[] = {
390 .flags = IORESOURCE_MEM,
393 .start = IRQ_UART0_RX,
394 .end = IRQ_UART0_RX+1,
395 .flags = IORESOURCE_IRQ,
398 .start = CH_UART0_RX,
399 .end = CH_UART0_RX+1,
400 .flags = IORESOURCE_DMA,
403 static struct platform_device bfin_sir0_device = {
406 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
407 .resource = bfin_sir0_resources,
410 #ifdef CONFIG_BFIN_SIR1
411 static struct resource bfin_sir1_resources[] = {
415 .flags = IORESOURCE_MEM,
418 .start = IRQ_UART1_RX,
419 .end = IRQ_UART1_RX+1,
420 .flags = IORESOURCE_IRQ,
423 .start = CH_UART1_RX,
424 .end = CH_UART1_RX+1,
425 .flags = IORESOURCE_DMA,
428 static struct platform_device bfin_sir1_device = {
431 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
432 .resource = bfin_sir1_resources,
437 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
438 static struct resource bfin_twi0_resource[] = {
440 .start = TWI0_REGBASE,
442 .flags = IORESOURCE_MEM,
447 .flags = IORESOURCE_IRQ,
451 static struct platform_device i2c_bfin_twi_device = {
452 .name = "i2c-bfin-twi",
454 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
455 .resource = bfin_twi0_resource,
459 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
460 static struct platform_device bfin_sport0_uart_device = {
461 .name = "bfin-sport-uart",
465 static struct platform_device bfin_sport1_uart_device = {
466 .name = "bfin-sport-uart",
471 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
472 static struct platform_device bfin_mii_bus = {
473 .name = "bfin_mii_bus",
476 static struct platform_device bfin_mac_device = {
478 .dev.platform_data = &bfin_mii_bus,
482 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
483 #define PATA_INT IRQ_PF14
485 static struct pata_platform_info bfin_pata_platform_data = {
487 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
490 static struct resource bfin_pata_resources[] = {
494 .flags = IORESOURCE_MEM,
499 .flags = IORESOURCE_MEM,
504 .flags = IORESOURCE_IRQ,
508 static struct platform_device bfin_pata_device = {
509 .name = "pata_platform",
511 .num_resources = ARRAY_SIZE(bfin_pata_resources),
512 .resource = bfin_pata_resources,
514 .platform_data = &bfin_pata_platform_data,
519 static const unsigned int cclk_vlev_datasheet[] =
521 VRPAIR(VLEV_085, 250000000),
522 VRPAIR(VLEV_090, 376000000),
523 VRPAIR(VLEV_095, 426000000),
524 VRPAIR(VLEV_100, 426000000),
525 VRPAIR(VLEV_105, 476000000),
526 VRPAIR(VLEV_110, 476000000),
527 VRPAIR(VLEV_115, 476000000),
528 VRPAIR(VLEV_120, 500000000),
529 VRPAIR(VLEV_125, 533000000),
530 VRPAIR(VLEV_130, 600000000),
533 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
534 .tuple_tab = cclk_vlev_datasheet,
535 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
536 .vr_settling_time = 25 /* us */,
539 static struct platform_device bfin_dpmc = {
542 .platform_data = &bfin_dmpc_vreg_data,
546 static struct platform_device *cm_bf537u_devices[] __initdata = {
550 #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
554 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
558 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
562 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
563 #ifdef CONFIG_BFIN_SIR0
566 #ifdef CONFIG_BFIN_SIR1
571 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
572 &i2c_bfin_twi_device,
575 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
576 &bfin_sport0_uart_device,
577 &bfin_sport1_uart_device,
580 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
584 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
588 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
593 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
594 &net2272_bfin_device,
597 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
601 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
605 #if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
612 static int __init cm_bf537u_init(void)
614 printk(KERN_INFO "%s(): registering device resources\n", __func__);
615 platform_add_devices(cm_bf537u_devices, ARRAY_SIZE(cm_bf537u_devices));
616 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
617 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
620 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
621 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
626 arch_initcall(cm_bf537u_init);
628 void bfin_get_ether_addr(char *addr)
630 random_ether_addr(addr);
631 printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
633 EXPORT_SYMBOL(bfin_get_ether_addr);