2 * File: arch/blackfin/mach-bf533/blackstamp.c
3 * Based on: arch/blackfin/mach-bf533/stamp.c
4 * Author: Benjamin Matthews <bmat@lle.rochester.edu>
5 * Aidan Williams <aidan@nicta.com.au>
8 * Description: Board Info File for the BlackStamp
10 * Copyright 2005 National ICT Australia (NICTA)
11 * Copyright 2004-2008 Analog Devices Inc.
13 * Enter bugs at http://blackfin.uclinux.org/
15 * More info about the BlackStamp at:
16 * http://blackfin.uclinux.org/gf/project/blackstamp/
18 * Licensed under the GPL-2 or later.
21 #include <linux/device.h>
22 #include <linux/platform_device.h>
23 #include <linux/mtd/mtd.h>
24 #include <linux/mtd/partitions.h>
25 #include <linux/mtd/physmap.h>
26 #include <linux/spi/spi.h>
27 #include <linux/spi/flash.h>
28 #include <linux/irq.h>
29 #include <linux/i2c.h>
31 #include <asm/bfin5xx_spi.h>
32 #include <asm/portmux.h>
36 * Name the Board for the /proc/cpuinfo
38 const char bfin_board_name
[] = "BlackStamp";
40 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
41 static struct platform_device rtc_device
= {
48 * Driver needs to know address, irq and flag pin.
50 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
51 #include <linux/smc91x.h>
53 static struct smc91x_platdata smc91x_info
= {
54 .flags
= SMC91X_USE_16BIT
| SMC91X_NOWAIT
,
55 .leda
= RPC_LED_100_10
,
56 .ledb
= RPC_LED_TX_RX
,
59 static struct resource smc91x_resources
[] = {
61 .name
= "smc91x-regs",
63 .end
= 0x20300300 + 16,
64 .flags
= IORESOURCE_MEM
,
68 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
72 static struct platform_device smc91x_device
= {
75 .num_resources
= ARRAY_SIZE(smc91x_resources
),
76 .resource
= smc91x_resources
,
78 .platform_data
= &smc91x_info
,
83 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
84 static struct mtd_partition bfin_spi_flash_partitions
[] = {
86 .name
= "bootloader(spi)",
89 .mask_flags
= MTD_CAP_ROM
91 .name
= "linux kernel(spi)",
93 .offset
= MTDPART_OFS_APPEND
,
95 .name
= "file system(spi)",
96 .size
= MTDPART_SIZ_FULL
,
97 .offset
= MTDPART_OFS_APPEND
,
101 static struct flash_platform_data bfin_spi_flash_data
= {
103 .parts
= bfin_spi_flash_partitions
,
104 .nr_parts
= ARRAY_SIZE(bfin_spi_flash_partitions
),
108 /* SPI flash chip (m25p64) */
109 static struct bfin5xx_spi_chip spi_flash_chip_info
= {
110 .enable_dma
= 0, /* use dma transfer with this chip*/
115 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
116 static struct bfin5xx_spi_chip mmc_spi_chip_info
= {
122 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
123 static struct bfin5xx_spi_chip spidev_chip_info
= {
129 static struct spi_board_info bfin_spi_board_info
[] __initdata
= {
130 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
132 /* the modalias must be the same as spi device driver name */
133 .modalias
= "m25p80", /* Name of spi_driver for this device */
134 .max_speed_hz
= 20000000, /* max spi clock (SCK) speed in HZ */
135 .bus_num
= 0, /* Framework bus number */
136 .chip_select
= 2, /* Framework chip select. */
137 .platform_data
= &bfin_spi_flash_data
,
138 .controller_data
= &spi_flash_chip_info
,
143 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
145 .modalias
= "mmc_spi",
146 .max_speed_hz
= 20000000, /* max spi clock (SCK) speed in HZ */
149 .controller_data
= &mmc_spi_chip_info
,
154 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
156 .modalias
= "spidev",
157 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
160 .controller_data
= &spidev_chip_info
,
165 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
167 static struct resource bfin_spi0_resource
[] = {
169 .start
= SPI0_REGBASE
,
170 .end
= SPI0_REGBASE
+ 0xFF,
171 .flags
= IORESOURCE_MEM
,
176 .flags
= IORESOURCE_DMA
,
181 .flags
= IORESOURCE_IRQ
,
185 /* SPI controller data */
186 static struct bfin5xx_spi_master bfin_spi0_info
= {
188 .enable_dma
= 1, /* master has the ability to do dma transfer */
189 .pin_req
= {P_SPI0_SCK
, P_SPI0_MISO
, P_SPI0_MOSI
, 0},
192 static struct platform_device bfin_spi0_device
= {
194 .id
= 0, /* Bus number */
195 .num_resources
= ARRAY_SIZE(bfin_spi0_resource
),
196 .resource
= bfin_spi0_resource
,
198 .platform_data
= &bfin_spi0_info
, /* Passed to driver */
201 #endif /* spi master and devices */
203 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
204 static struct resource bfin_uart_resources
[] = {
208 .flags
= IORESOURCE_MEM
,
212 static struct platform_device bfin_uart_device
= {
215 .num_resources
= ARRAY_SIZE(bfin_uart_resources
),
216 .resource
= bfin_uart_resources
,
220 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
221 #ifdef CONFIG_BFIN_SIR0
222 static struct resource bfin_sir0_resources
[] = {
226 .flags
= IORESOURCE_MEM
,
229 .start
= IRQ_UART0_RX
,
230 .end
= IRQ_UART0_RX
+1,
231 .flags
= IORESOURCE_IRQ
,
234 .start
= CH_UART0_RX
,
235 .end
= CH_UART0_RX
+1,
236 .flags
= IORESOURCE_DMA
,
240 static struct platform_device bfin_sir0_device
= {
243 .num_resources
= ARRAY_SIZE(bfin_sir0_resources
),
244 .resource
= bfin_sir0_resources
,
249 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
250 static struct platform_device bfin_sport0_uart_device
= {
251 .name
= "bfin-sport-uart",
255 static struct platform_device bfin_sport1_uart_device
= {
256 .name
= "bfin-sport-uart",
261 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
262 #include <linux/input.h>
263 #include <linux/gpio_keys.h>
265 static struct gpio_keys_button bfin_gpio_keys_table
[] = {
266 {BTN_0
, GPIO_PF4
, 0, "gpio-keys: BTN0"},
267 {BTN_1
, GPIO_PF5
, 0, "gpio-keys: BTN1"},
268 {BTN_2
, GPIO_PF6
, 0, "gpio-keys: BTN2"},
269 }; /* Mapped to the first three PF Test Points */
271 static struct gpio_keys_platform_data bfin_gpio_keys_data
= {
272 .buttons
= bfin_gpio_keys_table
,
273 .nbuttons
= ARRAY_SIZE(bfin_gpio_keys_table
),
276 static struct platform_device bfin_device_gpiokeys
= {
279 .platform_data
= &bfin_gpio_keys_data
,
284 static struct resource bfin_gpios_resources
= {
286 .end
= MAX_BLACKFIN_GPIOS
- 1,
287 .flags
= IORESOURCE_IRQ
,
290 static struct platform_device bfin_gpios_device
= {
291 .name
= "simple-gpio",
294 .resource
= &bfin_gpios_resources
,
297 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
298 #include <linux/i2c-gpio.h>
300 static struct i2c_gpio_platform_data i2c_gpio_data
= {
303 .sda_is_open_drain
= 0,
304 .scl_is_open_drain
= 0,
306 }; /* This hasn't actually been used these pins
307 * are (currently) free pins on the expansion connector */
309 static struct platform_device i2c_gpio_device
= {
313 .platform_data
= &i2c_gpio_data
,
318 static struct i2c_board_info __initdata bfin_i2c_board_info
[] = {
321 static const unsigned int cclk_vlev_datasheet
[] =
323 VRPAIR(VLEV_085
, 250000000),
324 VRPAIR(VLEV_090
, 376000000),
325 VRPAIR(VLEV_095
, 426000000),
326 VRPAIR(VLEV_100
, 426000000),
327 VRPAIR(VLEV_105
, 476000000),
328 VRPAIR(VLEV_110
, 476000000),
329 VRPAIR(VLEV_115
, 476000000),
330 VRPAIR(VLEV_120
, 600000000),
331 VRPAIR(VLEV_125
, 600000000),
332 VRPAIR(VLEV_130
, 600000000),
335 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data
= {
336 .tuple_tab
= cclk_vlev_datasheet
,
337 .tabsize
= ARRAY_SIZE(cclk_vlev_datasheet
),
338 .vr_settling_time
= 25 /* us */,
341 static struct platform_device bfin_dpmc
= {
344 .platform_data
= &bfin_dmpc_vreg_data
,
348 static struct platform_device
*stamp_devices
[] __initdata
= {
352 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
356 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
361 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
365 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
369 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
370 #ifdef CONFIG_BFIN_SIR0
375 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
376 &bfin_sport0_uart_device
,
377 &bfin_sport1_uart_device
,
380 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
381 &bfin_device_gpiokeys
,
384 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
391 static int __init
blackstamp_init(void)
395 printk(KERN_INFO
"%s(): registering device resources\n", __func__
);
397 i2c_register_board_info(0, bfin_i2c_board_info
,
398 ARRAY_SIZE(bfin_i2c_board_info
));
400 ret
= platform_add_devices(stamp_devices
, ARRAY_SIZE(stamp_devices
));
404 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
405 /* setup BF533_STAMP CPLD to route AMS3 to Ethernet MAC */
406 bfin_write_FIO_DIR(bfin_read_FIO_DIR() | PF0
);
407 bfin_write_FIO_FLAG_S(PF0
);
411 spi_register_board_info(bfin_spi_board_info
, ARRAY_SIZE(bfin_spi_board_info
));
415 arch_initcall(blackstamp_init
);