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>
20 #include <linux/i2c.h>
22 #include <asm/bfin5xx_spi.h>
23 #include <asm/portmux.h>
27 * Name the Board for the /proc/cpuinfo
29 const char bfin_board_name[] = "ADI BF533-EZKIT";
31 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
32 static struct platform_device rtc_device = {
39 * USB-LAN EzExtender board
40 * Driver needs to know address, irq and flag pin.
42 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
43 #include <linux/smc91x.h>
45 static struct smc91x_platdata smc91x_info = {
46 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
47 .leda = RPC_LED_100_10,
48 .ledb = RPC_LED_TX_RX,
51 static struct resource smc91x_resources[] = {
53 .name = "smc91x-regs",
55 .end = 0x20310300 + 16,
56 .flags = IORESOURCE_MEM,
60 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
63 static struct platform_device smc91x_device = {
66 .num_resources = ARRAY_SIZE(smc91x_resources),
67 .resource = smc91x_resources,
69 .platform_data = &smc91x_info,
74 #if defined(CONFIG_MTD_PSD4256G) || defined(CONFIG_MTD_PSD4256G_MODULE)
75 static const char *map_probes[] = {
80 static struct platdata_mtd_ram stm_pri_data_a = {
81 .mapname = "Flash A Primary",
82 .map_probes = map_probes,
86 static struct resource stm_pri_resource_a = {
89 .flags = IORESOURCE_MEM,
92 static struct platform_device stm_pri_device_a = {
96 .platform_data = &stm_pri_data_a,
99 .resource = &stm_pri_resource_a,
102 static struct platdata_mtd_ram stm_pri_data_b = {
103 .mapname = "Flash B Primary",
104 .map_probes = map_probes,
108 static struct resource stm_pri_resource_b = {
111 .flags = IORESOURCE_MEM,
114 static struct platform_device stm_pri_device_b = {
118 .platform_data = &stm_pri_data_b,
121 .resource = &stm_pri_resource_b,
125 #if defined(CONFIG_MTD_PLATRAM) || defined(CONFIG_MTD_PLATRAM_MODULE)
126 static struct platdata_mtd_ram sram_data_a = {
127 .mapname = "Flash A SRAM",
131 static struct resource sram_resource_a = {
134 .flags = IORESOURCE_MEM,
137 static struct platform_device sram_device_a = {
141 .platform_data = &sram_data_a,
144 .resource = &sram_resource_a,
147 static struct platdata_mtd_ram sram_data_b = {
148 .mapname = "Flash B SRAM",
152 static struct resource sram_resource_b = {
155 .flags = IORESOURCE_MEM,
158 static struct platform_device sram_device_b = {
162 .platform_data = &sram_data_b,
165 .resource = &sram_resource_b,
169 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
170 static struct mtd_partition bfin_spi_flash_partitions[] = {
172 .name = "bootloader(spi)",
175 .mask_flags = MTD_CAP_ROM
177 .name = "linux kernel(spi)",
179 .offset = MTDPART_OFS_APPEND,
181 .name = "file system(spi)",
182 .size = MTDPART_SIZ_FULL,
183 .offset = MTDPART_OFS_APPEND,
187 static struct flash_platform_data bfin_spi_flash_data = {
189 .parts = bfin_spi_flash_partitions,
190 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
194 /* SPI flash chip (m25p64) */
195 static struct bfin5xx_spi_chip spi_flash_chip_info = {
196 .enable_dma = 0, /* use dma transfer with this chip*/
201 #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
203 static struct bfin5xx_spi_chip spi_adc_chip_info = {
204 .enable_dma = 1, /* use dma transfer with this chip*/
209 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
210 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
216 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
217 static struct bfin5xx_spi_chip spidev_chip_info = {
223 static struct spi_board_info bfin_spi_board_info[] __initdata = {
224 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
226 /* the modalias must be the same as spi device driver name */
227 .modalias = "m25p80", /* Name of spi_driver for this device */
228 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
229 .bus_num = 0, /* Framework bus number */
230 .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
231 .platform_data = &bfin_spi_flash_data,
232 .controller_data = &spi_flash_chip_info,
237 #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
239 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
240 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
241 .bus_num = 0, /* Framework bus number */
242 .chip_select = 1, /* Framework chip select. */
243 .platform_data = NULL, /* No spi_driver specific config */
244 .controller_data = &spi_adc_chip_info,
248 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
250 .modalias = "ad1836",
251 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
253 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
254 .controller_data = &ad1836_spi_chip_info,
257 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
259 .modalias = "spidev",
260 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
263 .controller_data = &spidev_chip_info,
268 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
270 static struct resource bfin_spi0_resource[] = {
272 .start = SPI0_REGBASE,
273 .end = SPI0_REGBASE + 0xFF,
274 .flags = IORESOURCE_MEM,
279 .flags = IORESOURCE_DMA,
284 .flags = IORESOURCE_IRQ,
288 /* SPI controller data */
289 static struct bfin5xx_spi_master bfin_spi0_info = {
291 .enable_dma = 1, /* master has the ability to do dma transfer */
292 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
295 static struct platform_device bfin_spi0_device = {
297 .id = 0, /* Bus number */
298 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
299 .resource = bfin_spi0_resource,
301 .platform_data = &bfin_spi0_info, /* Passed to driver */
304 #endif /* spi master and devices */
306 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
307 static struct resource bfin_uart_resources[] = {
311 .flags = IORESOURCE_MEM,
315 static struct platform_device bfin_uart_device = {
318 .num_resources = ARRAY_SIZE(bfin_uart_resources),
319 .resource = bfin_uart_resources,
323 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
324 #ifdef CONFIG_BFIN_SIR0
325 static struct resource bfin_sir0_resources[] = {
329 .flags = IORESOURCE_MEM,
332 .start = IRQ_UART0_RX,
333 .end = IRQ_UART0_RX+1,
334 .flags = IORESOURCE_IRQ,
337 .start = CH_UART0_RX,
338 .end = CH_UART0_RX+1,
339 .flags = IORESOURCE_DMA,
343 static struct platform_device bfin_sir0_device = {
346 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
347 .resource = bfin_sir0_resources,
352 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
353 #include <linux/input.h>
354 #include <linux/gpio_keys.h>
356 static struct gpio_keys_button bfin_gpio_keys_table[] = {
357 {BTN_0, GPIO_PF7, 1, "gpio-keys: BTN0"},
358 {BTN_1, GPIO_PF8, 1, "gpio-keys: BTN1"},
359 {BTN_2, GPIO_PF9, 1, "gpio-keys: BTN2"},
360 {BTN_3, GPIO_PF10, 1, "gpio-keys: BTN3"},
363 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
364 .buttons = bfin_gpio_keys_table,
365 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
368 static struct platform_device bfin_device_gpiokeys = {
371 .platform_data = &bfin_gpio_keys_data,
376 static struct resource bfin_gpios_resources = {
378 .end = MAX_BLACKFIN_GPIOS - 1,
379 .flags = IORESOURCE_IRQ,
382 static struct platform_device bfin_gpios_device = {
383 .name = "simple-gpio",
386 .resource = &bfin_gpios_resources,
389 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
390 #include <linux/i2c-gpio.h>
392 static struct i2c_gpio_platform_data i2c_gpio_data = {
395 .sda_is_open_drain = 0,
396 .scl_is_open_drain = 0,
400 static struct platform_device i2c_gpio_device = {
404 .platform_data = &i2c_gpio_data,
409 static const unsigned int cclk_vlev_datasheet[] =
411 VRPAIR(VLEV_085, 250000000),
412 VRPAIR(VLEV_090, 376000000),
413 VRPAIR(VLEV_095, 426000000),
414 VRPAIR(VLEV_100, 426000000),
415 VRPAIR(VLEV_105, 476000000),
416 VRPAIR(VLEV_110, 476000000),
417 VRPAIR(VLEV_115, 476000000),
418 VRPAIR(VLEV_120, 600000000),
419 VRPAIR(VLEV_125, 600000000),
420 VRPAIR(VLEV_130, 600000000),
423 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
424 .tuple_tab = cclk_vlev_datasheet,
425 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
426 .vr_settling_time = 25 /* us */,
429 static struct platform_device bfin_dpmc = {
432 .platform_data = &bfin_dmpc_vreg_data,
436 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
437 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
439 I2C_BOARD_INFO("bfin-adv7393", 0x2B),
444 static struct platform_device *ezkit_devices[] __initdata = {
448 #if defined(CONFIG_MTD_PSD4256G) || defined(CONFIG_MTD_PSD4256G_MODULE)
453 #if defined(CONFIG_MTD_PLATRAM) || defined(CONFIG_MTD_PLATRAM_MODULE)
458 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
462 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
466 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
470 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
474 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
475 #ifdef CONFIG_BFIN_SIR0
480 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
481 &bfin_device_gpiokeys,
484 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
491 static int __init ezkit_init(void)
493 printk(KERN_INFO "%s(): registering device resources\n", __func__);
494 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
495 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
496 i2c_register_board_info(0, bfin_i2c_board_info,
497 ARRAY_SIZE(bfin_i2c_board_info));
501 arch_initcall(ezkit_init);