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*/
108 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
109 static struct bfin5xx_spi_chip mmc_spi_chip_info
= {
114 static struct spi_board_info bfin_spi_board_info
[] __initdata
= {
115 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
117 /* the modalias must be the same as spi device driver name */
118 .modalias
= "m25p80", /* Name of spi_driver for this device */
119 .max_speed_hz
= 20000000, /* max spi clock (SCK) speed in HZ */
120 .bus_num
= 0, /* Framework bus number */
121 .chip_select
= 2, /* Framework chip select. */
122 .platform_data
= &bfin_spi_flash_data
,
123 .controller_data
= &spi_flash_chip_info
,
128 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
130 .modalias
= "mmc_spi",
131 .max_speed_hz
= 20000000, /* max spi clock (SCK) speed in HZ */
134 .controller_data
= &mmc_spi_chip_info
,
139 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
141 .modalias
= "spidev",
142 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
149 #if defined(CONFIG_SPI_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_MODULE)
151 static struct resource bfin_spi0_resource
[] = {
153 .start
= SPI0_REGBASE
,
154 .end
= SPI0_REGBASE
+ 0xFF,
155 .flags
= IORESOURCE_MEM
,
160 .flags
= IORESOURCE_DMA
,
165 .flags
= IORESOURCE_IRQ
,
169 /* SPI controller data */
170 static struct bfin5xx_spi_master bfin_spi0_info
= {
172 .enable_dma
= 1, /* master has the ability to do dma transfer */
173 .pin_req
= {P_SPI0_SCK
, P_SPI0_MISO
, P_SPI0_MOSI
, 0},
176 static struct platform_device bfin_spi0_device
= {
178 .id
= 0, /* Bus number */
179 .num_resources
= ARRAY_SIZE(bfin_spi0_resource
),
180 .resource
= bfin_spi0_resource
,
182 .platform_data
= &bfin_spi0_info
, /* Passed to driver */
185 #endif /* spi master and devices */
187 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
188 #ifdef CONFIG_SERIAL_BFIN_UART0
189 static struct resource bfin_uart0_resources
[] = {
191 .start
= BFIN_UART_THR
,
192 .end
= BFIN_UART_GCTL
+2,
193 .flags
= IORESOURCE_MEM
,
196 .start
= IRQ_UART0_TX
,
198 .flags
= IORESOURCE_IRQ
,
201 .start
= IRQ_UART0_RX
,
203 .flags
= IORESOURCE_IRQ
,
206 .start
= IRQ_UART0_ERROR
,
207 .end
= IRQ_UART0_ERROR
,
208 .flags
= IORESOURCE_IRQ
,
211 .start
= CH_UART0_TX
,
213 .flags
= IORESOURCE_DMA
,
216 .start
= CH_UART0_RX
,
218 .flags
= IORESOURCE_DMA
,
222 static unsigned short bfin_uart0_peripherals
[] = {
223 P_UART0_TX
, P_UART0_RX
, 0
226 static struct platform_device bfin_uart0_device
= {
229 .num_resources
= ARRAY_SIZE(bfin_uart0_resources
),
230 .resource
= bfin_uart0_resources
,
232 .platform_data
= &bfin_uart0_peripherals
, /* Passed to driver */
238 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
239 #ifdef CONFIG_BFIN_SIR0
240 static struct resource bfin_sir0_resources
[] = {
244 .flags
= IORESOURCE_MEM
,
247 .start
= IRQ_UART0_RX
,
248 .end
= IRQ_UART0_RX
+1,
249 .flags
= IORESOURCE_IRQ
,
252 .start
= CH_UART0_RX
,
253 .end
= CH_UART0_RX
+1,
254 .flags
= IORESOURCE_DMA
,
258 static struct platform_device bfin_sir0_device
= {
261 .num_resources
= ARRAY_SIZE(bfin_sir0_resources
),
262 .resource
= bfin_sir0_resources
,
267 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
268 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
269 static struct resource bfin_sport0_uart_resources
[] = {
271 .start
= SPORT0_TCR1
,
272 .end
= SPORT0_MRCS3
+4,
273 .flags
= IORESOURCE_MEM
,
276 .start
= IRQ_SPORT0_RX
,
277 .end
= IRQ_SPORT0_RX
+1,
278 .flags
= IORESOURCE_IRQ
,
281 .start
= IRQ_SPORT0_ERROR
,
282 .end
= IRQ_SPORT0_ERROR
,
283 .flags
= IORESOURCE_IRQ
,
287 static unsigned short bfin_sport0_peripherals
[] = {
288 P_SPORT0_TFS
, P_SPORT0_DTPRI
, P_SPORT0_TSCLK
, P_SPORT0_RFS
,
289 P_SPORT0_DRPRI
, P_SPORT0_RSCLK
, 0
292 static struct platform_device bfin_sport0_uart_device
= {
293 .name
= "bfin-sport-uart",
295 .num_resources
= ARRAY_SIZE(bfin_sport0_uart_resources
),
296 .resource
= bfin_sport0_uart_resources
,
298 .platform_data
= &bfin_sport0_peripherals
, /* Passed to driver */
302 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
303 static struct resource bfin_sport1_uart_resources
[] = {
305 .start
= SPORT1_TCR1
,
306 .end
= SPORT1_MRCS3
+4,
307 .flags
= IORESOURCE_MEM
,
310 .start
= IRQ_SPORT1_RX
,
311 .end
= IRQ_SPORT1_RX
+1,
312 .flags
= IORESOURCE_IRQ
,
315 .start
= IRQ_SPORT1_ERROR
,
316 .end
= IRQ_SPORT1_ERROR
,
317 .flags
= IORESOURCE_IRQ
,
321 static unsigned short bfin_sport1_peripherals
[] = {
322 P_SPORT1_TFS
, P_SPORT1_DTPRI
, P_SPORT1_TSCLK
, P_SPORT1_RFS
,
323 P_SPORT1_DRPRI
, P_SPORT1_RSCLK
, 0
326 static struct platform_device bfin_sport1_uart_device
= {
327 .name
= "bfin-sport-uart",
329 .num_resources
= ARRAY_SIZE(bfin_sport1_uart_resources
),
330 .resource
= bfin_sport1_uart_resources
,
332 .platform_data
= &bfin_sport1_peripherals
, /* Passed to driver */
338 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
339 #include <linux/input.h>
340 #include <linux/gpio_keys.h>
342 static struct gpio_keys_button bfin_gpio_keys_table
[] = {
343 {BTN_0
, GPIO_PF4
, 0, "gpio-keys: BTN0"},
344 {BTN_1
, GPIO_PF5
, 0, "gpio-keys: BTN1"},
345 {BTN_2
, GPIO_PF6
, 0, "gpio-keys: BTN2"},
346 }; /* Mapped to the first three PF Test Points */
348 static struct gpio_keys_platform_data bfin_gpio_keys_data
= {
349 .buttons
= bfin_gpio_keys_table
,
350 .nbuttons
= ARRAY_SIZE(bfin_gpio_keys_table
),
353 static struct platform_device bfin_device_gpiokeys
= {
356 .platform_data
= &bfin_gpio_keys_data
,
361 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
362 #include <linux/i2c-gpio.h>
364 static struct i2c_gpio_platform_data i2c_gpio_data
= {
367 .sda_is_open_drain
= 0,
368 .scl_is_open_drain
= 0,
370 }; /* This hasn't actually been used these pins
371 * are (currently) free pins on the expansion connector */
373 static struct platform_device i2c_gpio_device
= {
377 .platform_data
= &i2c_gpio_data
,
382 static struct i2c_board_info __initdata bfin_i2c_board_info
[] = {
385 static const unsigned int cclk_vlev_datasheet
[] =
387 VRPAIR(VLEV_085
, 250000000),
388 VRPAIR(VLEV_090
, 376000000),
389 VRPAIR(VLEV_095
, 426000000),
390 VRPAIR(VLEV_100
, 426000000),
391 VRPAIR(VLEV_105
, 476000000),
392 VRPAIR(VLEV_110
, 476000000),
393 VRPAIR(VLEV_115
, 476000000),
394 VRPAIR(VLEV_120
, 600000000),
395 VRPAIR(VLEV_125
, 600000000),
396 VRPAIR(VLEV_130
, 600000000),
399 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data
= {
400 .tuple_tab
= cclk_vlev_datasheet
,
401 .tabsize
= ARRAY_SIZE(cclk_vlev_datasheet
),
402 .vr_settling_time
= 25 /* us */,
405 static struct platform_device bfin_dpmc
= {
408 .platform_data
= &bfin_dmpc_vreg_data
,
412 static struct platform_device
*stamp_devices
[] __initdata
= {
416 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
420 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
425 #if defined(CONFIG_SPI_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_MODULE)
429 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
430 #ifdef CONFIG_SERIAL_BFIN_UART0
435 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
436 #ifdef CONFIG_BFIN_SIR0
441 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
442 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
443 &bfin_sport0_uart_device
,
445 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
446 &bfin_sport1_uart_device
,
450 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
451 &bfin_device_gpiokeys
,
454 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
459 static int __init
blackstamp_init(void)
463 printk(KERN_INFO
"%s(): registering device resources\n", __func__
);
465 i2c_register_board_info(0, bfin_i2c_board_info
,
466 ARRAY_SIZE(bfin_i2c_board_info
));
468 ret
= platform_add_devices(stamp_devices
, ARRAY_SIZE(stamp_devices
));
472 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
474 * setup BF533_STAMP CPLD to route AMS3 to Ethernet MAC.
475 * the bfin-async-map driver takes care of flipping between
476 * flash and ethernet when necessary.
478 ret
= gpio_request(GPIO_PF0
, "enet_cpld");
480 gpio_direction_output(GPIO_PF0
, 1);
485 spi_register_board_info(bfin_spi_board_info
, ARRAY_SIZE(bfin_spi_board_info
));
489 arch_initcall(blackstamp_init
);
491 static struct platform_device
*stamp_early_devices
[] __initdata
= {
492 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
493 #ifdef CONFIG_SERIAL_BFIN_UART0
498 #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
499 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
500 &bfin_sport0_uart_device
,
502 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
503 &bfin_sport1_uart_device
,
508 void __init
native_machine_early_platform_add_devices(void)
510 printk(KERN_INFO
"register early platform devices\n");
511 early_platform_add_devices(stamp_early_devices
,
512 ARRAY_SIZE(stamp_early_devices
));