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>
28 #include <mach/fio_flag.h>
31 * Name the Board for the /proc/cpuinfo
33 const char bfin_board_name[] = "BlackStamp";
35 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
36 static struct platform_device rtc_device = {
43 * Driver needs to know address, irq and flag pin.
45 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
46 #include <linux/smc91x.h>
48 static struct smc91x_platdata smc91x_info = {
49 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
50 .leda = RPC_LED_100_10,
51 .ledb = RPC_LED_TX_RX,
54 static struct resource smc91x_resources[] = {
56 .name = "smc91x-regs",
58 .end = 0x20300300 + 16,
59 .flags = IORESOURCE_MEM,
63 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
67 static struct platform_device smc91x_device = {
70 .num_resources = ARRAY_SIZE(smc91x_resources),
71 .resource = smc91x_resources,
73 .platform_data = &smc91x_info,
78 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
79 static struct mtd_partition bfin_spi_flash_partitions[] = {
81 .name = "bootloader(spi)",
84 .mask_flags = MTD_CAP_ROM
86 .name = "linux kernel(spi)",
88 .offset = MTDPART_OFS_APPEND,
90 .name = "file system(spi)",
91 .size = MTDPART_SIZ_FULL,
92 .offset = MTDPART_OFS_APPEND,
96 static struct flash_platform_data bfin_spi_flash_data = {
98 .parts = bfin_spi_flash_partitions,
99 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
103 /* SPI flash chip (m25p64) */
104 static struct bfin5xx_spi_chip spi_flash_chip_info = {
105 .enable_dma = 0, /* use dma transfer with this chip*/
110 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
111 static struct bfin5xx_spi_chip mmc_spi_chip_info = {
117 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
118 static struct bfin5xx_spi_chip spidev_chip_info = {
124 static struct spi_board_info bfin_spi_board_info[] __initdata = {
125 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
127 /* the modalias must be the same as spi device driver name */
128 .modalias = "m25p80", /* Name of spi_driver for this device */
129 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
130 .bus_num = 0, /* Framework bus number */
131 .chip_select = 2, /* Framework chip select. */
132 .platform_data = &bfin_spi_flash_data,
133 .controller_data = &spi_flash_chip_info,
138 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
140 .modalias = "mmc_spi",
141 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
144 .controller_data = &mmc_spi_chip_info,
149 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
151 .modalias = "spidev",
152 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
155 .controller_data = &spidev_chip_info,
160 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
162 static struct resource bfin_spi0_resource[] = {
164 .start = SPI0_REGBASE,
165 .end = SPI0_REGBASE + 0xFF,
166 .flags = IORESOURCE_MEM,
171 .flags = IORESOURCE_DMA,
176 .flags = IORESOURCE_IRQ,
180 /* SPI controller data */
181 static struct bfin5xx_spi_master bfin_spi0_info = {
183 .enable_dma = 1, /* master has the ability to do dma transfer */
184 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
187 static struct platform_device bfin_spi0_device = {
189 .id = 0, /* Bus number */
190 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
191 .resource = bfin_spi0_resource,
193 .platform_data = &bfin_spi0_info, /* Passed to driver */
196 #endif /* spi master and devices */
198 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
199 #ifdef CONFIG_SERIAL_BFIN_UART0
200 static struct resource bfin_uart0_resources[] = {
202 .start = BFIN_UART_THR,
203 .end = BFIN_UART_GCTL+2,
204 .flags = IORESOURCE_MEM,
207 .start = IRQ_UART0_RX,
208 .end = IRQ_UART0_RX + 1,
209 .flags = IORESOURCE_IRQ,
212 .start = IRQ_UART0_ERROR,
213 .end = IRQ_UART0_ERROR,
214 .flags = IORESOURCE_IRQ,
217 .start = CH_UART0_TX,
219 .flags = IORESOURCE_DMA,
222 .start = CH_UART0_RX,
224 .flags = IORESOURCE_DMA,
228 unsigned short bfin_uart0_peripherals[] = {
229 P_UART0_TX, P_UART0_RX, 0
232 static struct platform_device bfin_uart0_device = {
235 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
236 .resource = bfin_uart0_resources,
238 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
244 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
245 #ifdef CONFIG_BFIN_SIR0
246 static struct resource bfin_sir0_resources[] = {
250 .flags = IORESOURCE_MEM,
253 .start = IRQ_UART0_RX,
254 .end = IRQ_UART0_RX+1,
255 .flags = IORESOURCE_IRQ,
258 .start = CH_UART0_RX,
259 .end = CH_UART0_RX+1,
260 .flags = IORESOURCE_DMA,
264 static struct platform_device bfin_sir0_device = {
267 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
268 .resource = bfin_sir0_resources,
273 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
274 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
275 static struct resource bfin_sport0_uart_resources[] = {
277 .start = SPORT0_TCR1,
278 .end = SPORT0_MRCS3+4,
279 .flags = IORESOURCE_MEM,
282 .start = IRQ_SPORT0_RX,
283 .end = IRQ_SPORT0_RX+1,
284 .flags = IORESOURCE_IRQ,
287 .start = IRQ_SPORT0_ERROR,
288 .end = IRQ_SPORT0_ERROR,
289 .flags = IORESOURCE_IRQ,
293 unsigned short bfin_sport0_peripherals[] = {
294 P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
295 P_SPORT0_DRPRI, P_SPORT0_RSCLK, P_SPORT0_DRSEC, P_SPORT0_DTSEC, 0
298 static struct platform_device bfin_sport0_uart_device = {
299 .name = "bfin-sport-uart",
301 .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
302 .resource = bfin_sport0_uart_resources,
304 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
308 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
309 static struct resource bfin_sport1_uart_resources[] = {
311 .start = SPORT1_TCR1,
312 .end = SPORT1_MRCS3+4,
313 .flags = IORESOURCE_MEM,
316 .start = IRQ_SPORT1_RX,
317 .end = IRQ_SPORT1_RX+1,
318 .flags = IORESOURCE_IRQ,
321 .start = IRQ_SPORT1_ERROR,
322 .end = IRQ_SPORT1_ERROR,
323 .flags = IORESOURCE_IRQ,
327 unsigned short bfin_sport1_peripherals[] = {
328 P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
329 P_SPORT1_DRPRI, P_SPORT1_RSCLK, P_SPORT1_DRSEC, P_SPORT1_DTSEC, 0
332 static struct platform_device bfin_sport1_uart_device = {
333 .name = "bfin-sport-uart",
335 .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
336 .resource = bfin_sport1_uart_resources,
338 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
344 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
345 #include <linux/input.h>
346 #include <linux/gpio_keys.h>
348 static struct gpio_keys_button bfin_gpio_keys_table[] = {
349 {BTN_0, GPIO_PF4, 0, "gpio-keys: BTN0"},
350 {BTN_1, GPIO_PF5, 0, "gpio-keys: BTN1"},
351 {BTN_2, GPIO_PF6, 0, "gpio-keys: BTN2"},
352 }; /* Mapped to the first three PF Test Points */
354 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
355 .buttons = bfin_gpio_keys_table,
356 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
359 static struct platform_device bfin_device_gpiokeys = {
362 .platform_data = &bfin_gpio_keys_data,
367 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
368 #include <linux/i2c-gpio.h>
370 static struct i2c_gpio_platform_data i2c_gpio_data = {
373 .sda_is_open_drain = 0,
374 .scl_is_open_drain = 0,
376 }; /* This hasn't actually been used these pins
377 * are (currently) free pins on the expansion connector */
379 static struct platform_device i2c_gpio_device = {
383 .platform_data = &i2c_gpio_data,
388 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
391 static const unsigned int cclk_vlev_datasheet[] =
393 VRPAIR(VLEV_085, 250000000),
394 VRPAIR(VLEV_090, 376000000),
395 VRPAIR(VLEV_095, 426000000),
396 VRPAIR(VLEV_100, 426000000),
397 VRPAIR(VLEV_105, 476000000),
398 VRPAIR(VLEV_110, 476000000),
399 VRPAIR(VLEV_115, 476000000),
400 VRPAIR(VLEV_120, 600000000),
401 VRPAIR(VLEV_125, 600000000),
402 VRPAIR(VLEV_130, 600000000),
405 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
406 .tuple_tab = cclk_vlev_datasheet,
407 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
408 .vr_settling_time = 25 /* us */,
411 static struct platform_device bfin_dpmc = {
414 .platform_data = &bfin_dmpc_vreg_data,
418 static struct platform_device *stamp_devices[] __initdata = {
422 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
426 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
431 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
435 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
436 #ifdef CONFIG_SERIAL_BFIN_UART0
441 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
442 #ifdef CONFIG_BFIN_SIR0
447 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
448 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
449 &bfin_sport0_uart_device,
451 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
452 &bfin_sport1_uart_device,
456 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
457 &bfin_device_gpiokeys,
460 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
465 static int __init blackstamp_init(void)
469 printk(KERN_INFO "%s(): registering device resources\n", __func__);
471 i2c_register_board_info(0, bfin_i2c_board_info,
472 ARRAY_SIZE(bfin_i2c_board_info));
474 ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
478 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
479 /* setup BF533_STAMP CPLD to route AMS3 to Ethernet MAC */
480 bfin_write_FIO_DIR(bfin_read_FIO_DIR() | PF0);
481 bfin_write_FIO_FLAG_S(PF0);
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));