2 * File: arch/blackfin/mach-bf533/stamp.c
3 * Based on: arch/blackfin/mach-bf533/ezkit.c
4 * Author: Aidan Williams <aidan@nicta.com.au>
7 * Description: Board Info File for the BF533-STAMP
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/platform_device.h>
33 #include <linux/mtd/mtd.h>
34 #include <linux/mtd/partitions.h>
35 #include <linux/spi/spi.h>
36 #include <linux/spi/flash.h>
37 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
38 #include <linux/usb_isp1362.h>
40 #include <linux/pata_platform.h>
41 #include <linux/irq.h>
43 #include <asm/bfin5xx_spi.h>
44 #include <asm/reboot.h>
47 * Name the Board for the /proc/cpuinfo
49 const char bfin_board_name[] = "ADDS-BF533-STAMP";
51 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
52 static struct platform_device rtc_device = {
59 * Driver needs to know address, irq and flag pin.
61 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
62 static struct resource smc91x_resources[] = {
64 .name = "smc91x-regs",
66 .end = 0x20300300 + 16,
67 .flags = IORESOURCE_MEM,
71 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
75 static struct platform_device smc91x_device = {
78 .num_resources = ARRAY_SIZE(smc91x_resources),
79 .resource = smc91x_resources,
83 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
84 static struct platform_device bfin_fb_adv7393_device = {
85 .name = "bfin-adv7393",
89 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
90 static struct resource net2272_bfin_resources[] = {
93 .end = 0x20300000 + 0x100,
94 .flags = IORESOURCE_MEM,
98 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
102 static struct platform_device net2272_bfin_device = {
105 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
106 .resource = net2272_bfin_resources,
110 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
111 /* all SPI peripherals info goes here */
113 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
114 static struct mtd_partition bfin_spi_flash_partitions[] = {
116 .name = "bootloader",
119 .mask_flags = MTD_CAP_ROM
125 .name = "file system",
127 .offset = 0x00100000,
131 static struct flash_platform_data bfin_spi_flash_data = {
133 .parts = bfin_spi_flash_partitions,
134 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
138 /* SPI flash chip (m25p64) */
139 static struct bfin5xx_spi_chip spi_flash_chip_info = {
140 .enable_dma = 0, /* use dma transfer with this chip*/
145 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
147 static struct bfin5xx_spi_chip spi_adc_chip_info = {
148 .enable_dma = 1, /* use dma transfer with this chip*/
153 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
154 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
160 #if defined(CONFIG_PBX)
161 static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
162 .ctl_reg = 0x4, /* send zero */
165 .cs_change_per_word = 1,
169 #if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
170 static struct bfin5xx_spi_chip ad5304_chip_info = {
176 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
177 static struct bfin5xx_spi_chip spi_mmc_chip_info = {
183 static struct spi_board_info bfin_spi_board_info[] __initdata = {
184 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
186 /* the modalias must be the same as spi device driver name */
187 .modalias = "m25p80", /* Name of spi_driver for this device */
188 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
189 .bus_num = 0, /* Framework bus number */
190 .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
191 .platform_data = &bfin_spi_flash_data,
192 .controller_data = &spi_flash_chip_info,
197 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
199 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
200 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
201 .bus_num = 0, /* Framework bus number */
202 .chip_select = 1, /* Framework chip select. */
203 .platform_data = NULL, /* No spi_driver specific config */
204 .controller_data = &spi_adc_chip_info,
208 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
210 .modalias = "ad1836-spi",
211 .max_speed_hz = 31250000, /* max spi clock (SCK) speed in HZ */
213 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
214 .controller_data = &ad1836_spi_chip_info,
218 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
220 .modalias = "spi_mmc_dummy",
221 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
224 .platform_data = NULL,
225 .controller_data = &spi_mmc_chip_info,
229 .modalias = "spi_mmc",
230 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
232 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
233 .platform_data = NULL,
234 .controller_data = &spi_mmc_chip_info,
239 #if defined(CONFIG_PBX)
241 .modalias = "fxs-spi",
242 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
244 .chip_select = 8 - CONFIG_J11_JUMPER,
245 .controller_data = &spi_si3xxx_chip_info,
249 .modalias = "fxo-spi",
250 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
252 .chip_select = 8 - CONFIG_J19_JUMPER,
253 .controller_data = &spi_si3xxx_chip_info,
258 #if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
260 .modalias = "ad5304_spi",
261 .max_speed_hz = 1000000, /* max spi clock (SCK) speed in HZ */
264 .platform_data = NULL,
265 .controller_data = &ad5304_chip_info,
272 static struct resource bfin_spi0_resource[] = {
274 .start = SPI0_REGBASE,
275 .end = SPI0_REGBASE + 0xFF,
276 .flags = IORESOURCE_MEM,
281 .flags = IORESOURCE_IRQ,
285 /* SPI controller data */
286 static struct bfin5xx_spi_master bfin_spi0_info = {
288 .enable_dma = 1, /* master has the ability to do dma transfer */
291 static struct platform_device bfin_spi0_device = {
293 .id = 0, /* Bus number */
294 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
295 .resource = bfin_spi0_resource,
297 .platform_data = &bfin_spi0_info, /* Passed to driver */
300 #endif /* spi master and devices */
302 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
303 static struct platform_device bfin_fb_device = {
308 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
309 static struct resource bfin_uart_resources[] = {
313 .flags = IORESOURCE_MEM,
317 static struct platform_device bfin_uart_device = {
320 .num_resources = ARRAY_SIZE(bfin_uart_resources),
321 .resource = bfin_uart_resources,
325 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
326 static struct platform_device bfin_sport0_uart_device = {
327 .name = "bfin-sport-uart",
331 static struct platform_device bfin_sport1_uart_device = {
332 .name = "bfin-sport-uart",
337 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
340 static struct pata_platform_info bfin_pata_platform_data = {
342 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
345 static struct resource bfin_pata_resources[] = {
349 .flags = IORESOURCE_MEM,
354 .flags = IORESOURCE_MEM,
359 .flags = IORESOURCE_IRQ,
363 static struct platform_device bfin_pata_device = {
364 .name = "pata_platform",
366 .num_resources = ARRAY_SIZE(bfin_pata_resources),
367 .resource = bfin_pata_resources,
369 .platform_data = &bfin_pata_platform_data,
374 static struct platform_device *stamp_devices[] __initdata = {
375 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
379 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
383 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
384 &bfin_fb_adv7393_device,
387 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
388 &net2272_bfin_device,
391 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
395 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
399 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
400 &bfin_sport0_uart_device,
401 &bfin_sport1_uart_device,
404 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
409 static int __init stamp_init(void)
413 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
414 ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
418 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
419 # if defined(CONFIG_BFIN_SHARED_FLASH_ENET)
420 /* setup BF533_STAMP CPLD to route AMS3 to Ethernet MAC */
421 bfin_write_FIO_DIR(bfin_read_FIO_DIR() | (1 << CONFIG_ENET_FLASH_PIN));
422 bfin_write_FIO_FLAG_S(1 << CONFIG_ENET_FLASH_PIN);
427 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
428 spi_register_board_info(bfin_spi_board_info,
429 ARRAY_SIZE(bfin_spi_board_info));
431 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
432 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
437 arch_initcall(stamp_init);
439 void native_machine_restart(char *cmd)
441 #if defined(CONFIG_BFIN_SHARED_FLASH_ENET)
442 # define BIT_TO_SET (1 << CONFIG_ENET_FLASH_PIN)
443 bfin_write_FIO_INEN(~BIT_TO_SET);
444 bfin_write_FIO_DIR(BIT_TO_SET);
445 bfin_write_FIO_FLAG_C(BIT_TO_SET);