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>
45 #include <asm/portmux.h>
48 * Name the Board for the /proc/cpuinfo
50 const char bfin_board_name[] = "ADDS-BF533-STAMP";
52 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
53 static struct platform_device rtc_device = {
60 * Driver needs to know address, irq and flag pin.
62 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
63 static struct resource smc91x_resources[] = {
65 .name = "smc91x-regs",
67 .end = 0x20300300 + 16,
68 .flags = IORESOURCE_MEM,
72 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
76 static struct platform_device smc91x_device = {
79 .num_resources = ARRAY_SIZE(smc91x_resources),
80 .resource = smc91x_resources,
84 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
85 static struct platform_device bfin_fb_adv7393_device = {
86 .name = "bfin-adv7393",
90 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
91 static struct resource net2272_bfin_resources[] = {
94 .end = 0x20300000 + 0x100,
95 .flags = IORESOURCE_MEM,
99 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
103 static struct platform_device net2272_bfin_device = {
106 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
107 .resource = net2272_bfin_resources,
111 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
112 /* all SPI peripherals info goes here */
114 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
115 static struct mtd_partition bfin_spi_flash_partitions[] = {
117 .name = "bootloader",
120 .mask_flags = MTD_CAP_ROM
126 .name = "file system",
128 .offset = 0x00100000,
132 static struct flash_platform_data bfin_spi_flash_data = {
134 .parts = bfin_spi_flash_partitions,
135 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
139 /* SPI flash chip (m25p64) */
140 static struct bfin5xx_spi_chip spi_flash_chip_info = {
141 .enable_dma = 0, /* use dma transfer with this chip*/
146 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
148 static struct bfin5xx_spi_chip spi_adc_chip_info = {
149 .enable_dma = 1, /* use dma transfer with this chip*/
154 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
155 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
161 #if defined(CONFIG_PBX)
162 static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
163 .ctl_reg = 0x4, /* send zero */
166 .cs_change_per_word = 1,
170 #if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
171 static struct bfin5xx_spi_chip ad5304_chip_info = {
177 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
178 static struct bfin5xx_spi_chip spi_mmc_chip_info = {
184 static struct spi_board_info bfin_spi_board_info[] __initdata = {
185 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
187 /* the modalias must be the same as spi device driver name */
188 .modalias = "m25p80", /* Name of spi_driver for this device */
189 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
190 .bus_num = 0, /* Framework bus number */
191 .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
192 .platform_data = &bfin_spi_flash_data,
193 .controller_data = &spi_flash_chip_info,
198 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
200 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
201 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
202 .bus_num = 0, /* Framework bus number */
203 .chip_select = 1, /* Framework chip select. */
204 .platform_data = NULL, /* No spi_driver specific config */
205 .controller_data = &spi_adc_chip_info,
209 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
211 .modalias = "ad1836-spi",
212 .max_speed_hz = 31250000, /* max spi clock (SCK) speed in HZ */
214 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
215 .controller_data = &ad1836_spi_chip_info,
219 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
221 .modalias = "spi_mmc_dummy",
222 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
225 .platform_data = NULL,
226 .controller_data = &spi_mmc_chip_info,
230 .modalias = "spi_mmc",
231 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
233 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
234 .platform_data = NULL,
235 .controller_data = &spi_mmc_chip_info,
240 #if defined(CONFIG_PBX)
242 .modalias = "fxs-spi",
243 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
245 .chip_select = 8 - CONFIG_J11_JUMPER,
246 .controller_data = &spi_si3xxx_chip_info,
250 .modalias = "fxo-spi",
251 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
253 .chip_select = 8 - CONFIG_J19_JUMPER,
254 .controller_data = &spi_si3xxx_chip_info,
259 #if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE)
261 .modalias = "ad5304_spi",
262 .max_speed_hz = 1000000, /* max spi clock (SCK) speed in HZ */
265 .platform_data = NULL,
266 .controller_data = &ad5304_chip_info,
273 static struct resource bfin_spi0_resource[] = {
275 .start = SPI0_REGBASE,
276 .end = SPI0_REGBASE + 0xFF,
277 .flags = IORESOURCE_MEM,
282 .flags = IORESOURCE_IRQ,
286 /* SPI controller data */
287 static struct bfin5xx_spi_master bfin_spi0_info = {
289 .enable_dma = 1, /* master has the ability to do dma transfer */
290 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
293 static struct platform_device bfin_spi0_device = {
295 .id = 0, /* Bus number */
296 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
297 .resource = bfin_spi0_resource,
299 .platform_data = &bfin_spi0_info, /* Passed to driver */
302 #endif /* spi master and devices */
304 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
305 static struct platform_device bfin_fb_device = {
310 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
311 static struct resource bfin_uart_resources[] = {
315 .flags = IORESOURCE_MEM,
319 static struct platform_device bfin_uart_device = {
322 .num_resources = ARRAY_SIZE(bfin_uart_resources),
323 .resource = bfin_uart_resources,
327 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
328 static struct platform_device bfin_sport0_uart_device = {
329 .name = "bfin-sport-uart",
333 static struct platform_device bfin_sport1_uart_device = {
334 .name = "bfin-sport-uart",
339 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
342 static struct pata_platform_info bfin_pata_platform_data = {
344 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
347 static struct resource bfin_pata_resources[] = {
351 .flags = IORESOURCE_MEM,
356 .flags = IORESOURCE_MEM,
361 .flags = IORESOURCE_IRQ,
365 static struct platform_device bfin_pata_device = {
366 .name = "pata_platform",
368 .num_resources = ARRAY_SIZE(bfin_pata_resources),
369 .resource = bfin_pata_resources,
371 .platform_data = &bfin_pata_platform_data,
376 static struct platform_device *stamp_devices[] __initdata = {
377 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
381 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
385 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
386 &bfin_fb_adv7393_device,
389 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
390 &net2272_bfin_device,
393 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
397 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
401 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
402 &bfin_sport0_uart_device,
403 &bfin_sport1_uart_device,
406 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
411 static int __init stamp_init(void)
415 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
416 ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
420 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
421 # if defined(CONFIG_BFIN_SHARED_FLASH_ENET)
422 /* setup BF533_STAMP CPLD to route AMS3 to Ethernet MAC */
423 bfin_write_FIO_DIR(bfin_read_FIO_DIR() | (1 << CONFIG_ENET_FLASH_PIN));
424 bfin_write_FIO_FLAG_S(1 << CONFIG_ENET_FLASH_PIN);
429 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
430 spi_register_board_info(bfin_spi_board_info,
431 ARRAY_SIZE(bfin_spi_board_info));
433 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
434 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
439 arch_initcall(stamp_init);
441 void native_machine_restart(char *cmd)
443 #if defined(CONFIG_BFIN_SHARED_FLASH_ENET)
444 # define BIT_TO_SET (1 << CONFIG_ENET_FLASH_PIN)
445 bfin_write_FIO_INEN(~BIT_TO_SET);
446 bfin_write_FIO_DIR(BIT_TO_SET);
447 bfin_write_FIO_FLAG_C(BIT_TO_SET);