2 * Copyright 2004-2009 Analog Devices Inc.
3 * 2005 National ICT Australia (NICTA)
4 * Aidan Williams <aidan@nicta.com.au>
6 * Licensed under the GPL-2 or later.
9 #include <linux/device.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/plat-ram.h>
14 #include <linux/spi/spi.h>
15 #include <linux/spi/flash.h>
16 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
17 #include <linux/usb/isp1362.h>
19 #include <linux/irq.h>
21 #include <asm/bfin5xx_spi.h>
22 #include <asm/portmux.h>
26 * Name the Board for the /proc/cpuinfo
28 const char bfin_board_name[] = "ADI BF533-EZKIT";
30 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
31 static struct platform_device rtc_device = {
37 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
38 static struct platform_device bfin_fb_adv7393_device = {
39 .name = "bfin-adv7393",
44 * USB-LAN EzExtender board
45 * Driver needs to know address, irq and flag pin.
47 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
48 #include <linux/smc91x.h>
50 static struct smc91x_platdata smc91x_info = {
51 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
52 .leda = RPC_LED_100_10,
53 .ledb = RPC_LED_TX_RX,
56 static struct resource smc91x_resources[] = {
58 .name = "smc91x-regs",
60 .end = 0x20310300 + 16,
61 .flags = IORESOURCE_MEM,
65 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
68 static struct platform_device smc91x_device = {
71 .num_resources = ARRAY_SIZE(smc91x_resources),
72 .resource = smc91x_resources,
74 .platform_data = &smc91x_info,
79 #if defined(CONFIG_MTD_PSD4256G) || defined(CONFIG_MTD_PSD4256G_MODULE)
80 static const char *map_probes[] = {
85 static struct platdata_mtd_ram stm_pri_data_a = {
86 .mapname = "Flash A Primary",
87 .map_probes = map_probes,
91 static struct resource stm_pri_resource_a = {
94 .flags = IORESOURCE_MEM,
97 static struct platform_device stm_pri_device_a = {
101 .platform_data = &stm_pri_data_a,
104 .resource = &stm_pri_resource_a,
107 static struct platdata_mtd_ram stm_pri_data_b = {
108 .mapname = "Flash B Primary",
109 .map_probes = map_probes,
113 static struct resource stm_pri_resource_b = {
116 .flags = IORESOURCE_MEM,
119 static struct platform_device stm_pri_device_b = {
123 .platform_data = &stm_pri_data_b,
126 .resource = &stm_pri_resource_b,
130 #if defined(CONFIG_MTD_PLATRAM) || defined(CONFIG_MTD_PLATRAM_MODULE)
131 static struct platdata_mtd_ram sram_data_a = {
132 .mapname = "Flash A SRAM",
136 static struct resource sram_resource_a = {
139 .flags = IORESOURCE_MEM,
142 static struct platform_device sram_device_a = {
146 .platform_data = &sram_data_a,
149 .resource = &sram_resource_a,
152 static struct platdata_mtd_ram sram_data_b = {
153 .mapname = "Flash B SRAM",
157 static struct resource sram_resource_b = {
160 .flags = IORESOURCE_MEM,
163 static struct platform_device sram_device_b = {
167 .platform_data = &sram_data_b,
170 .resource = &sram_resource_b,
174 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
175 static struct mtd_partition bfin_spi_flash_partitions[] = {
177 .name = "bootloader(spi)",
180 .mask_flags = MTD_CAP_ROM
182 .name = "linux kernel(spi)",
184 .offset = MTDPART_OFS_APPEND,
186 .name = "file system(spi)",
187 .size = MTDPART_SIZ_FULL,
188 .offset = MTDPART_OFS_APPEND,
192 static struct flash_platform_data bfin_spi_flash_data = {
194 .parts = bfin_spi_flash_partitions,
195 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
199 /* SPI flash chip (m25p64) */
200 static struct bfin5xx_spi_chip spi_flash_chip_info = {
201 .enable_dma = 0, /* use dma transfer with this chip*/
206 #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
208 static struct bfin5xx_spi_chip spi_adc_chip_info = {
209 .enable_dma = 1, /* use dma transfer with this chip*/
214 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
215 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
221 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
222 static struct bfin5xx_spi_chip spidev_chip_info = {
228 static struct spi_board_info bfin_spi_board_info[] __initdata = {
229 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
231 /* the modalias must be the same as spi device driver name */
232 .modalias = "m25p80", /* Name of spi_driver for this device */
233 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
234 .bus_num = 0, /* Framework bus number */
235 .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
236 .platform_data = &bfin_spi_flash_data,
237 .controller_data = &spi_flash_chip_info,
242 #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
244 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
245 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
246 .bus_num = 0, /* Framework bus number */
247 .chip_select = 1, /* Framework chip select. */
248 .platform_data = NULL, /* No spi_driver specific config */
249 .controller_data = &spi_adc_chip_info,
253 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
255 .modalias = "ad1836",
256 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
258 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
259 .controller_data = &ad1836_spi_chip_info,
262 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
264 .modalias = "spidev",
265 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
268 .controller_data = &spidev_chip_info,
273 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
275 static struct resource bfin_spi0_resource[] = {
277 .start = SPI0_REGBASE,
278 .end = SPI0_REGBASE + 0xFF,
279 .flags = IORESOURCE_MEM,
284 .flags = IORESOURCE_DMA,
289 .flags = IORESOURCE_IRQ,
293 /* SPI controller data */
294 static struct bfin5xx_spi_master bfin_spi0_info = {
296 .enable_dma = 1, /* master has the ability to do dma transfer */
297 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
300 static struct platform_device bfin_spi0_device = {
302 .id = 0, /* Bus number */
303 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
304 .resource = bfin_spi0_resource,
306 .platform_data = &bfin_spi0_info, /* Passed to driver */
309 #endif /* spi master and devices */
311 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
312 static struct resource bfin_uart_resources[] = {
316 .flags = IORESOURCE_MEM,
320 static struct platform_device bfin_uart_device = {
323 .num_resources = ARRAY_SIZE(bfin_uart_resources),
324 .resource = bfin_uart_resources,
328 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
329 #ifdef CONFIG_BFIN_SIR0
330 static struct resource bfin_sir0_resources[] = {
334 .flags = IORESOURCE_MEM,
337 .start = IRQ_UART0_RX,
338 .end = IRQ_UART0_RX+1,
339 .flags = IORESOURCE_IRQ,
342 .start = CH_UART0_RX,
343 .end = CH_UART0_RX+1,
344 .flags = IORESOURCE_DMA,
348 static struct platform_device bfin_sir0_device = {
351 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
352 .resource = bfin_sir0_resources,
357 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
358 #include <linux/input.h>
359 #include <linux/gpio_keys.h>
361 static struct gpio_keys_button bfin_gpio_keys_table[] = {
362 {BTN_0, GPIO_PF7, 1, "gpio-keys: BTN0"},
363 {BTN_1, GPIO_PF8, 1, "gpio-keys: BTN1"},
364 {BTN_2, GPIO_PF9, 1, "gpio-keys: BTN2"},
365 {BTN_3, GPIO_PF10, 1, "gpio-keys: BTN3"},
368 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
369 .buttons = bfin_gpio_keys_table,
370 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
373 static struct platform_device bfin_device_gpiokeys = {
376 .platform_data = &bfin_gpio_keys_data,
381 static struct resource bfin_gpios_resources = {
383 .end = MAX_BLACKFIN_GPIOS - 1,
384 .flags = IORESOURCE_IRQ,
387 static struct platform_device bfin_gpios_device = {
388 .name = "simple-gpio",
391 .resource = &bfin_gpios_resources,
394 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
395 #include <linux/i2c-gpio.h>
397 static struct i2c_gpio_platform_data i2c_gpio_data = {
400 .sda_is_open_drain = 0,
401 .scl_is_open_drain = 0,
405 static struct platform_device i2c_gpio_device = {
409 .platform_data = &i2c_gpio_data,
414 static const unsigned int cclk_vlev_datasheet[] =
416 VRPAIR(VLEV_085, 250000000),
417 VRPAIR(VLEV_090, 376000000),
418 VRPAIR(VLEV_095, 426000000),
419 VRPAIR(VLEV_100, 426000000),
420 VRPAIR(VLEV_105, 476000000),
421 VRPAIR(VLEV_110, 476000000),
422 VRPAIR(VLEV_115, 476000000),
423 VRPAIR(VLEV_120, 600000000),
424 VRPAIR(VLEV_125, 600000000),
425 VRPAIR(VLEV_130, 600000000),
428 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
429 .tuple_tab = cclk_vlev_datasheet,
430 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
431 .vr_settling_time = 25 /* us */,
434 static struct platform_device bfin_dpmc = {
437 .platform_data = &bfin_dmpc_vreg_data,
441 static struct platform_device *ezkit_devices[] __initdata = {
445 #if defined(CONFIG_MTD_PSD4256G) || defined(CONFIG_MTD_PSD4256G_MODULE)
450 #if defined(CONFIG_MTD_PLATRAM) || defined(CONFIG_MTD_PLATRAM_MODULE)
455 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
459 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
463 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
464 &bfin_fb_adv7393_device,
467 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
471 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
475 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
476 #ifdef CONFIG_BFIN_SIR0
481 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
482 &bfin_device_gpiokeys,
485 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
492 static int __init ezkit_init(void)
494 printk(KERN_INFO "%s(): registering device resources\n", __func__);
495 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
496 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
500 arch_initcall(ezkit_init);