4 #include <linux/device.h>
5 #include <linux/platform_device.h>
6 #include <linux/mtd/mtd.h>
7 #include <linux/mtd/partitions.h>
8 #include <linux/spi/spi.h>
9 #include <linux/spi/flash.h>
10 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
11 #include <linux/usb_isp1362.h>
13 #include <linux/ata_platform.h>
14 #include <linux/irq.h>
15 #include <linux/interrupt.h>
16 #include <linux/usb_sl811.h>
18 #include <asm/bfin5xx_spi.h>
19 #include <asm/reboot.h>
20 #include <linux/spi/ad7877.h>
23 * Name the Board for the /proc/cpuinfo
25 char *bfin_board_name
= "CamSig Minotaur BF537";
27 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
28 static struct resource bfin_pcmcia_cf_resources
[] = {
30 .start
= 0x20310000, /* IO PORT */
32 .flags
= IORESOURCE_MEM
,
34 .start
= 0x20311000, /* Attribute Memory */
36 .flags
= IORESOURCE_MEM
,
40 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_LOWLEVEL
,
42 .start
= IRQ_PF6
, /* Card Detect PF6 */
44 .flags
= IORESOURCE_IRQ
,
48 static struct platform_device bfin_pcmcia_cf_device
= {
49 .name
= "bfin_cf_pcmcia",
51 .num_resources
= ARRAY_SIZE(bfin_pcmcia_cf_resources
),
52 .resource
= bfin_pcmcia_cf_resources
,
56 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
57 static struct platform_device rtc_device
= {
63 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
64 static struct platform_device bfin_mac_device
= {
69 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
70 static struct resource net2272_bfin_resources
[] = {
73 .end
= 0x20300000 + 0x100,
74 .flags
= IORESOURCE_MEM
,
78 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
82 static struct platform_device net2272_bfin_device
= {
85 .num_resources
= ARRAY_SIZE(net2272_bfin_resources
),
86 .resource
= net2272_bfin_resources
,
90 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
91 /* all SPI peripherals info goes here */
93 #if defined(CONFIG_MTD_M25P80) \
94 || defined(CONFIG_MTD_M25P80_MODULE)
97 #define FLASH_SIZE 0x00400000
98 #define PSIZE_UBOOT 0x00030000
99 #define PSIZE_INITRAMFS 0x00240000
101 static struct mtd_partition bfin_spi_flash_partitions
[] = {
106 .mask_flags
= MTD_CAP_ROM
109 .size
= PSIZE_INITRAMFS
,
110 .offset
= PSIZE_UBOOT
113 .size
= FLASH_SIZE
- (PSIZE_UBOOT
+ PSIZE_INITRAMFS
),
114 .offset
= PSIZE_UBOOT
+ PSIZE_INITRAMFS
,
118 static struct flash_platform_data bfin_spi_flash_data
= {
120 .parts
= bfin_spi_flash_partitions
,
121 .nr_parts
= ARRAY_SIZE(bfin_spi_flash_partitions
),
125 /* SPI flash chip (m25p64) */
126 static struct bfin5xx_spi_chip spi_flash_chip_info
= {
127 .enable_dma
= 0, /* use dma transfer with this chip*/
132 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
133 static struct bfin5xx_spi_chip spi_mmc_chip_info
= {
139 static struct spi_board_info bfin_spi_board_info
[] __initdata
= {
140 #if defined(CONFIG_MTD_M25P80) \
141 || defined(CONFIG_MTD_M25P80_MODULE)
143 /* the modalias must be the same as spi device driver name */
144 .modalias
= "m25p80", /* Name of spi_driver for this device */
145 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
146 .bus_num
= 0, /* Framework bus number */
147 .chip_select
= 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
148 .platform_data
= &bfin_spi_flash_data
,
149 .controller_data
= &spi_flash_chip_info
,
154 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
156 .modalias
= "spi_mmc_dummy",
157 .max_speed_hz
= 5000000, /* max spi clock (SCK) speed in HZ */
160 .platform_data
= NULL
,
161 .controller_data
= &spi_mmc_chip_info
,
165 .modalias
= "spi_mmc",
166 .max_speed_hz
= 5000000, /* max spi clock (SCK) speed in HZ */
168 .chip_select
= CONFIG_SPI_MMC_CS_CHAN
,
169 .platform_data
= NULL
,
170 .controller_data
= &spi_mmc_chip_info
,
176 /* SPI controller data */
177 static struct bfin5xx_spi_master bfin_spi0_info
= {
179 .enable_dma
= 1, /* master has the ability to do dma transfer */
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 static struct platform_device bfin_spi0_device
= {
198 .id
= 0, /* Bus number */
199 .num_resources
= ARRAY_SIZE(bfin_spi0_resource
),
200 .resource
= bfin_spi0_resource
,
202 .platform_data
= &bfin_spi0_info
, /* Passed to driver */
205 #endif /* spi master and devices */
207 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
208 static struct resource bfin_uart_resources
[] = {
212 .flags
= IORESOURCE_MEM
,
216 .flags
= IORESOURCE_MEM
,
220 static struct platform_device bfin_uart_device
= {
223 .num_resources
= ARRAY_SIZE(bfin_uart_resources
),
224 .resource
= bfin_uart_resources
,
228 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
229 static struct resource bfin_twi0_resource
[] = {
231 .start
= TWI0_REGBASE
,
232 .end
= TWI0_REGBASE
+ 0xFF,
233 .flags
= IORESOURCE_MEM
,
238 .flags
= IORESOURCE_IRQ
,
242 static struct platform_device i2c_bfin_twi_device
= {
243 .name
= "i2c-bfin-twi",
245 .num_resources
= ARRAY_SIZE(bfin_twi0_resource
),
246 .resource
= bfin_twi0_resource
,
250 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
251 static struct platform_device bfin_sport0_uart_device
= {
252 .name
= "bfin-sport-uart",
256 static struct platform_device bfin_sport1_uart_device
= {
257 .name
= "bfin-sport-uart",
262 static struct platform_device
*minotaur_devices
[] __initdata
= {
263 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
264 &bfin_pcmcia_cf_device
,
267 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
271 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
275 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
276 &net2272_bfin_device
,
279 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
283 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
287 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
288 &i2c_bfin_twi_device
,
291 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
292 &bfin_sport0_uart_device
,
293 &bfin_sport1_uart_device
,
298 static int __init
minotaur_init(void)
300 printk(KERN_INFO
"%s(): registering device resources\n", __FUNCTION__
);
301 platform_add_devices(minotaur_devices
, ARRAY_SIZE(minotaur_devices
));
302 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
303 spi_register_board_info(bfin_spi_board_info
,
304 ARRAY_SIZE(bfin_spi_board_info
));
310 arch_initcall(minotaur_init
);
312 void native_machine_restart(char *cmd
)
314 /* workaround reboot hang when booting from SPI */
315 if ((bfin_read_SYSCR() & 0x7) == 0x3)
316 bfin_gpio_reset_spi0_ssel1();