2 * Board Info File for the BlackStamp
4 * Copyright 2004-2008 Analog Devices Inc.
5 * 2008 Benjamin Matthews <bmat@lle.rochester.edu>
6 * 2005 National ICT Australia (NICTA)
7 * Aidan Williams <aidan@nicta.com.au>
9 * More info about the BlackStamp at:
10 * http://blackfin.uclinux.org/gf/project/blackstamp/
12 * Licensed under the GPL-2 or later.
15 #include <linux/device.h>
16 #include <linux/platform_device.h>
17 #include <linux/mtd/mtd.h>
18 #include <linux/mtd/partitions.h>
19 #include <linux/mtd/physmap.h>
20 #include <linux/spi/spi.h>
21 #include <linux/spi/flash.h>
22 #include <linux/irq.h>
23 #include <linux/i2c.h>
25 #include <asm/bfin5xx_spi.h>
26 #include <asm/portmux.h>
30 * Name the Board for the /proc/cpuinfo
32 const char bfin_board_name
[] = "BlackStamp";
34 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
35 static struct platform_device rtc_device
= {
42 * Driver needs to know address, irq and flag pin.
44 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
45 #include <linux/smc91x.h>
47 static struct smc91x_platdata smc91x_info
= {
48 .flags
= SMC91X_USE_16BIT
| SMC91X_NOWAIT
,
49 .leda
= RPC_LED_100_10
,
50 .ledb
= RPC_LED_TX_RX
,
53 static struct resource smc91x_resources
[] = {
55 .name
= "smc91x-regs",
57 .end
= 0x20300300 + 16,
58 .flags
= IORESOURCE_MEM
,
62 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
66 static struct platform_device smc91x_device
= {
69 .num_resources
= ARRAY_SIZE(smc91x_resources
),
70 .resource
= smc91x_resources
,
72 .platform_data
= &smc91x_info
,
77 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
78 static struct mtd_partition bfin_spi_flash_partitions
[] = {
80 .name
= "bootloader(spi)",
83 .mask_flags
= MTD_CAP_ROM
85 .name
= "linux kernel(spi)",
87 .offset
= MTDPART_OFS_APPEND
,
89 .name
= "file system(spi)",
90 .size
= MTDPART_SIZ_FULL
,
91 .offset
= MTDPART_OFS_APPEND
,
95 static struct flash_platform_data bfin_spi_flash_data
= {
97 .parts
= bfin_spi_flash_partitions
,
98 .nr_parts
= ARRAY_SIZE(bfin_spi_flash_partitions
),
102 /* SPI flash chip (m25p64) */
103 static struct bfin5xx_spi_chip spi_flash_chip_info
= {
104 .enable_dma
= 0, /* use dma transfer with this chip*/
109 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
110 static struct bfin5xx_spi_chip mmc_spi_chip_info
= {
116 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
117 static struct bfin5xx_spi_chip spidev_chip_info
= {
123 static struct spi_board_info bfin_spi_board_info
[] __initdata
= {
124 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
126 /* the modalias must be the same as spi device driver name */
127 .modalias
= "m25p80", /* Name of spi_driver for this device */
128 .max_speed_hz
= 20000000, /* max spi clock (SCK) speed in HZ */
129 .bus_num
= 0, /* Framework bus number */
130 .chip_select
= 2, /* Framework chip select. */
131 .platform_data
= &bfin_spi_flash_data
,
132 .controller_data
= &spi_flash_chip_info
,
137 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
139 .modalias
= "mmc_spi",
140 .max_speed_hz
= 20000000, /* max spi clock (SCK) speed in HZ */
143 .controller_data
= &mmc_spi_chip_info
,
148 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
150 .modalias
= "spidev",
151 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
154 .controller_data
= &spidev_chip_info
,
159 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
161 static struct resource bfin_spi0_resource
[] = {
163 .start
= SPI0_REGBASE
,
164 .end
= SPI0_REGBASE
+ 0xFF,
165 .flags
= IORESOURCE_MEM
,
170 .flags
= IORESOURCE_DMA
,
175 .flags
= IORESOURCE_IRQ
,
179 /* SPI controller data */
180 static struct bfin5xx_spi_master bfin_spi0_info
= {
182 .enable_dma
= 1, /* master has the ability to do dma transfer */
183 .pin_req
= {P_SPI0_SCK
, P_SPI0_MISO
, P_SPI0_MOSI
, 0},
186 static struct platform_device bfin_spi0_device
= {
188 .id
= 0, /* Bus number */
189 .num_resources
= ARRAY_SIZE(bfin_spi0_resource
),
190 .resource
= bfin_spi0_resource
,
192 .platform_data
= &bfin_spi0_info
, /* Passed to driver */
195 #endif /* spi master and devices */
197 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
198 static struct resource bfin_uart_resources
[] = {
202 .flags
= IORESOURCE_MEM
,
206 static struct platform_device bfin_uart_device
= {
209 .num_resources
= ARRAY_SIZE(bfin_uart_resources
),
210 .resource
= bfin_uart_resources
,
214 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
215 #ifdef CONFIG_BFIN_SIR0
216 static struct resource bfin_sir0_resources
[] = {
220 .flags
= IORESOURCE_MEM
,
223 .start
= IRQ_UART0_RX
,
224 .end
= IRQ_UART0_RX
+1,
225 .flags
= IORESOURCE_IRQ
,
228 .start
= CH_UART0_RX
,
229 .end
= CH_UART0_RX
+1,
230 .flags
= IORESOURCE_DMA
,
234 static struct platform_device bfin_sir0_device
= {
237 .num_resources
= ARRAY_SIZE(bfin_sir0_resources
),
238 .resource
= bfin_sir0_resources
,
243 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
244 static struct platform_device bfin_sport0_uart_device
= {
245 .name
= "bfin-sport-uart",
249 static struct platform_device bfin_sport1_uart_device
= {
250 .name
= "bfin-sport-uart",
255 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
256 #include <linux/input.h>
257 #include <linux/gpio_keys.h>
259 static struct gpio_keys_button bfin_gpio_keys_table
[] = {
260 {BTN_0
, GPIO_PF4
, 0, "gpio-keys: BTN0"},
261 {BTN_1
, GPIO_PF5
, 0, "gpio-keys: BTN1"},
262 {BTN_2
, GPIO_PF6
, 0, "gpio-keys: BTN2"},
263 }; /* Mapped to the first three PF Test Points */
265 static struct gpio_keys_platform_data bfin_gpio_keys_data
= {
266 .buttons
= bfin_gpio_keys_table
,
267 .nbuttons
= ARRAY_SIZE(bfin_gpio_keys_table
),
270 static struct platform_device bfin_device_gpiokeys
= {
273 .platform_data
= &bfin_gpio_keys_data
,
278 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
279 #include <linux/i2c-gpio.h>
281 static struct i2c_gpio_platform_data i2c_gpio_data
= {
284 .sda_is_open_drain
= 0,
285 .scl_is_open_drain
= 0,
287 }; /* This hasn't actually been used these pins
288 * are (currently) free pins on the expansion connector */
290 static struct platform_device i2c_gpio_device
= {
294 .platform_data
= &i2c_gpio_data
,
299 static struct i2c_board_info __initdata bfin_i2c_board_info
[] = {
302 static const unsigned int cclk_vlev_datasheet
[] =
304 VRPAIR(VLEV_085
, 250000000),
305 VRPAIR(VLEV_090
, 376000000),
306 VRPAIR(VLEV_095
, 426000000),
307 VRPAIR(VLEV_100
, 426000000),
308 VRPAIR(VLEV_105
, 476000000),
309 VRPAIR(VLEV_110
, 476000000),
310 VRPAIR(VLEV_115
, 476000000),
311 VRPAIR(VLEV_120
, 600000000),
312 VRPAIR(VLEV_125
, 600000000),
313 VRPAIR(VLEV_130
, 600000000),
316 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data
= {
317 .tuple_tab
= cclk_vlev_datasheet
,
318 .tabsize
= ARRAY_SIZE(cclk_vlev_datasheet
),
319 .vr_settling_time
= 25 /* us */,
322 static struct platform_device bfin_dpmc
= {
325 .platform_data
= &bfin_dmpc_vreg_data
,
329 static struct platform_device
*stamp_devices
[] __initdata
= {
333 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
337 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
342 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
346 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
350 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
351 #ifdef CONFIG_BFIN_SIR0
356 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
357 &bfin_sport0_uart_device
,
358 &bfin_sport1_uart_device
,
361 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
362 &bfin_device_gpiokeys
,
365 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
370 static int __init
blackstamp_init(void)
374 printk(KERN_INFO
"%s(): registering device resources\n", __func__
);
376 i2c_register_board_info(0, bfin_i2c_board_info
,
377 ARRAY_SIZE(bfin_i2c_board_info
));
379 ret
= platform_add_devices(stamp_devices
, ARRAY_SIZE(stamp_devices
));
383 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
384 /* setup BF533_STAMP CPLD to route AMS3 to Ethernet MAC */
385 bfin_write_FIO_DIR(bfin_read_FIO_DIR() | PF0
);
386 bfin_write_FIO_FLAG_S(PF0
);
390 spi_register_board_info(bfin_spi_board_info
, ARRAY_SIZE(bfin_spi_board_info
));
394 arch_initcall(blackstamp_init
);