2 * File: arch/blackfin/mach-bf537/boards/tcm_bf537.c
3 * Based on: arch/blackfin/mach-bf533/boards/cm_bf537.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>
50 * Name the Board for the /proc/cpuinfo
52 const char bfin_board_name
[] = "Bluetechnix TCM BF537";
54 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
55 /* all SPI peripherals info goes here */
57 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
58 static struct mtd_partition bfin_spi_flash_partitions
[] = {
60 .name
= "bootloader(spi)",
63 .mask_flags
= MTD_CAP_ROM
65 .name
= "linux kernel(spi)",
69 .name
= "file system(spi)",
75 static struct flash_platform_data bfin_spi_flash_data
= {
77 .parts
= bfin_spi_flash_partitions
,
78 .nr_parts
= ARRAY_SIZE(bfin_spi_flash_partitions
),
82 /* SPI flash chip (m25p64) */
83 static struct bfin5xx_spi_chip spi_flash_chip_info
= {
84 .enable_dma
= 0, /* use dma transfer with this chip*/
89 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
91 static struct bfin5xx_spi_chip spi_adc_chip_info
= {
92 .enable_dma
= 1, /* use dma transfer with this chip*/
97 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
98 static struct bfin5xx_spi_chip ad1836_spi_chip_info
= {
104 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
105 static struct bfin5xx_spi_chip ad9960_spi_chip_info
= {
111 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
112 static struct bfin5xx_spi_chip spi_mmc_chip_info
= {
118 static struct spi_board_info bfin_spi_board_info
[] __initdata
= {
119 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
121 /* the modalias must be the same as spi device driver name */
122 .modalias
= "m25p80", /* Name of spi_driver for this device */
123 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
124 .bus_num
= 0, /* Framework bus number */
125 .chip_select
= 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
126 .platform_data
= &bfin_spi_flash_data
,
127 .controller_data
= &spi_flash_chip_info
,
132 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
134 .modalias
= "bfin_spi_adc", /* Name of spi_driver for this device */
135 .max_speed_hz
= 6250000, /* max spi clock (SCK) speed in HZ */
136 .bus_num
= 0, /* Framework bus number */
137 .chip_select
= 1, /* Framework chip select. */
138 .platform_data
= NULL
, /* No spi_driver specific config */
139 .controller_data
= &spi_adc_chip_info
,
143 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
145 .modalias
= "ad1836-spi",
146 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
148 .chip_select
= CONFIG_SND_BLACKFIN_SPI_PFBIT
,
149 .controller_data
= &ad1836_spi_chip_info
,
153 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
155 .modalias
= "ad9960-spi",
156 .max_speed_hz
= 10000000, /* max spi clock (SCK) speed in HZ */
159 .controller_data
= &ad9960_spi_chip_info
,
163 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
165 .modalias
= "spi_mmc_dummy",
166 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
169 .platform_data
= NULL
,
170 .controller_data
= &spi_mmc_chip_info
,
174 .modalias
= "spi_mmc",
175 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
177 .chip_select
= CONFIG_SPI_MMC_CS_CHAN
,
178 .platform_data
= NULL
,
179 .controller_data
= &spi_mmc_chip_info
,
186 static struct resource bfin_spi0_resource
[] = {
188 .start
= SPI0_REGBASE
,
189 .end
= SPI0_REGBASE
+ 0xFF,
190 .flags
= IORESOURCE_MEM
,
195 .flags
= IORESOURCE_IRQ
,
199 /* SPI controller data */
200 static struct bfin5xx_spi_master bfin_spi0_info
= {
202 .enable_dma
= 1, /* master has the ability to do dma transfer */
203 .pin_req
= {P_SPI0_SCK
, P_SPI0_MISO
, P_SPI0_MOSI
, 0},
206 static struct platform_device bfin_spi0_device
= {
208 .id
= 0, /* Bus number */
209 .num_resources
= ARRAY_SIZE(bfin_spi0_resource
),
210 .resource
= bfin_spi0_resource
,
212 .platform_data
= &bfin_spi0_info
, /* Passed to driver */
215 #endif /* spi master and devices */
217 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
218 static struct platform_device rtc_device
= {
224 #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
225 static struct platform_device hitachi_fb_device
= {
226 .name
= "hitachi-tx09",
230 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
231 static struct resource smc91x_resources
[] = {
234 .end
= 0x20200300 + 16,
235 .flags
= IORESOURCE_MEM
,
239 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
243 static struct platform_device smc91x_device
= {
246 .num_resources
= ARRAY_SIZE(smc91x_resources
),
247 .resource
= smc91x_resources
,
251 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
252 static struct resource isp1362_hcd_resources
[] = {
256 .flags
= IORESOURCE_MEM
,
260 .flags
= IORESOURCE_MEM
,
264 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
268 static struct isp1362_platform_data isp1362_priv
= {
273 .int_edge_triggered
= 0,
274 .remote_wakeup_connected
= 0,
275 .no_power_switching
= 1,
276 .power_switching_mode
= 0,
279 static struct platform_device isp1362_hcd_device
= {
280 .name
= "isp1362-hcd",
283 .platform_data
= &isp1362_priv
,
285 .num_resources
= ARRAY_SIZE(isp1362_hcd_resources
),
286 .resource
= isp1362_hcd_resources
,
290 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
291 static struct resource net2272_bfin_resources
[] = {
294 .end
= 0x20200000 + 0x100,
295 .flags
= IORESOURCE_MEM
,
299 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
303 static struct platform_device net2272_bfin_device
= {
306 .num_resources
= ARRAY_SIZE(net2272_bfin_resources
),
307 .resource
= net2272_bfin_resources
,
311 #if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
312 static struct mtd_partition cm_partitions
[] = {
314 .name
= "bootloader(nor)",
318 .name
= "linux kernel(nor)",
320 .offset
= MTDPART_OFS_APPEND
,
322 .name
= "file system(nor)",
323 .size
= MTDPART_SIZ_FULL
,
324 .offset
= MTDPART_OFS_APPEND
,
328 static struct physmap_flash_data cm_flash_data
= {
330 .parts
= cm_partitions
,
331 .nr_parts
= ARRAY_SIZE(cm_partitions
),
334 static unsigned cm_flash_gpios
[] = { GPIO_PF4
, GPIO_PF5
};
336 static struct resource cm_flash_resource
[] = {
341 .flags
= IORESOURCE_MEM
,
343 .start
= (unsigned long)cm_flash_gpios
,
344 .end
= ARRAY_SIZE(cm_flash_gpios
),
345 .flags
= IORESOURCE_IRQ
,
349 static struct platform_device cm_flash_device
= {
350 .name
= "gpio-addr-flash",
353 .platform_data
= &cm_flash_data
,
355 .num_resources
= ARRAY_SIZE(cm_flash_resource
),
356 .resource
= cm_flash_resource
,
360 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
361 static struct resource bfin_uart_resources
[] = {
365 .flags
= IORESOURCE_MEM
,
369 .flags
= IORESOURCE_MEM
,
373 static struct platform_device bfin_uart_device
= {
376 .num_resources
= ARRAY_SIZE(bfin_uart_resources
),
377 .resource
= bfin_uart_resources
,
381 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
382 static struct resource bfin_sir_resources
[] = {
383 #ifdef CONFIG_BFIN_SIR0
387 .flags
= IORESOURCE_MEM
,
390 #ifdef CONFIG_BFIN_SIR1
394 .flags
= IORESOURCE_MEM
,
399 static struct platform_device bfin_sir_device
= {
402 .num_resources
= ARRAY_SIZE(bfin_sir_resources
),
403 .resource
= bfin_sir_resources
,
407 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
408 static struct resource bfin_twi0_resource
[] = {
410 .start
= TWI0_REGBASE
,
412 .flags
= IORESOURCE_MEM
,
417 .flags
= IORESOURCE_IRQ
,
421 static struct platform_device i2c_bfin_twi_device
= {
422 .name
= "i2c-bfin-twi",
424 .num_resources
= ARRAY_SIZE(bfin_twi0_resource
),
425 .resource
= bfin_twi0_resource
,
429 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
430 static struct platform_device bfin_sport0_uart_device
= {
431 .name
= "bfin-sport-uart",
435 static struct platform_device bfin_sport1_uart_device
= {
436 .name
= "bfin-sport-uart",
441 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
442 static struct platform_device bfin_mac_device
= {
447 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
448 #define PATA_INT IRQ_PF14
450 static struct pata_platform_info bfin_pata_platform_data
= {
452 .irq_type
= IRQF_TRIGGER_HIGH
| IRQF_DISABLED
,
455 static struct resource bfin_pata_resources
[] = {
459 .flags
= IORESOURCE_MEM
,
464 .flags
= IORESOURCE_MEM
,
469 .flags
= IORESOURCE_IRQ
,
473 static struct platform_device bfin_pata_device
= {
474 .name
= "pata_platform",
476 .num_resources
= ARRAY_SIZE(bfin_pata_resources
),
477 .resource
= bfin_pata_resources
,
479 .platform_data
= &bfin_pata_platform_data
,
484 static const unsigned int cclk_vlev_datasheet
[] =
486 VRPAIR(VLEV_085
, 250000000),
487 VRPAIR(VLEV_090
, 376000000),
488 VRPAIR(VLEV_095
, 426000000),
489 VRPAIR(VLEV_100
, 426000000),
490 VRPAIR(VLEV_105
, 476000000),
491 VRPAIR(VLEV_110
, 476000000),
492 VRPAIR(VLEV_115
, 476000000),
493 VRPAIR(VLEV_120
, 500000000),
494 VRPAIR(VLEV_125
, 533000000),
495 VRPAIR(VLEV_130
, 600000000),
498 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data
= {
499 .tuple_tab
= cclk_vlev_datasheet
,
500 .tabsize
= ARRAY_SIZE(cclk_vlev_datasheet
),
501 .vr_settling_time
= 25 /* us */,
504 static struct platform_device bfin_dpmc
= {
507 .platform_data
= &bfin_dmpc_vreg_data
,
511 static struct platform_device
*cm_bf537_devices
[] __initdata
= {
515 #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
519 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
523 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
527 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
531 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
532 &i2c_bfin_twi_device
,
535 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
536 &bfin_sport0_uart_device
,
537 &bfin_sport1_uart_device
,
540 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
544 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
548 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
552 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
553 &net2272_bfin_device
,
556 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
560 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
564 #if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
569 static int __init
cm_bf537_init(void)
571 printk(KERN_INFO
"%s(): registering device resources\n", __func__
);
572 platform_add_devices(cm_bf537_devices
, ARRAY_SIZE(cm_bf537_devices
));
573 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
574 spi_register_board_info(bfin_spi_board_info
, ARRAY_SIZE(bfin_spi_board_info
));
577 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
578 irq_desc
[PATA_INT
].status
|= IRQ_NOAUTOEN
;
583 arch_initcall(cm_bf537_init
);
585 void bfin_get_ether_addr(char *addr
)
587 random_ether_addr(addr
);
588 printk(KERN_WARNING
"%s:%s: Setting Ethernet MAC to a random one\n", __FILE__
, __func__
);
590 EXPORT_SYMBOL(bfin_get_ether_addr
);