2 * File: arch/blackfin/mach-bf533/ezkit.c
3 * Based on: Original Work
4 * Author: Aidan Williams <aidan@nicta.com.au>
9 * Modified: Robin Getz <rgetz@blackfin.uclinux.org> - Named the boards
10 * Copyright 2005 National ICT Australia (NICTA)
11 * Copyright 2004-2006 Analog Devices Inc.
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, see the file COPYING, or write
27 * to the Free Software Foundation, Inc.,
28 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31 #include <linux/device.h>
32 #include <linux/platform_device.h>
33 #include <linux/mtd/mtd.h>
34 #include <linux/mtd/partitions.h>
35 #include <linux/mtd/plat-ram.h>
36 #include <linux/spi/spi.h>
37 #include <linux/spi/flash.h>
38 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
39 #include <linux/usb/isp1362.h>
41 #include <linux/irq.h>
43 #include <asm/bfin5xx_spi.h>
44 #include <asm/portmux.h>
48 * Name the Board for the /proc/cpuinfo
50 const char bfin_board_name[] = "ADI BF533-EZKIT";
52 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
53 static struct platform_device rtc_device = {
59 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
60 static struct platform_device bfin_fb_adv7393_device = {
61 .name = "bfin-adv7393",
66 * USB-LAN EzExtender board
67 * Driver needs to know address, irq and flag pin.
69 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
70 static struct resource smc91x_resources[] = {
72 .name = "smc91x-regs",
74 .end = 0x20310300 + 16,
75 .flags = IORESOURCE_MEM,
79 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
82 static struct platform_device smc91x_device = {
85 .num_resources = ARRAY_SIZE(smc91x_resources),
86 .resource = smc91x_resources,
90 #if defined(CONFIG_MTD_PSD4256G) || defined(CONFIG_MTD_PSD4256G_MODULE)
91 static const char *map_probes[] = {
96 static struct platdata_mtd_ram stm_pri_data_a = {
97 .mapname = "Flash A Primary",
98 .map_probes = map_probes,
102 static struct resource stm_pri_resource_a = {
105 .flags = IORESOURCE_MEM,
108 static struct platform_device stm_pri_device_a = {
112 .platform_data = &stm_pri_data_a,
115 .resource = &stm_pri_resource_a,
118 static struct platdata_mtd_ram stm_pri_data_b = {
119 .mapname = "Flash B Primary",
120 .map_probes = map_probes,
124 static struct resource stm_pri_resource_b = {
127 .flags = IORESOURCE_MEM,
130 static struct platform_device stm_pri_device_b = {
134 .platform_data = &stm_pri_data_b,
137 .resource = &stm_pri_resource_b,
141 #if defined(CONFIG_MTD_PLATRAM) || defined(CONFIG_MTD_PLATRAM_MODULE)
142 static struct platdata_mtd_ram sram_data_a = {
143 .mapname = "Flash A SRAM",
147 static struct resource sram_resource_a = {
150 .flags = IORESOURCE_MEM,
153 static struct platform_device sram_device_a = {
157 .platform_data = &sram_data_a,
160 .resource = &sram_resource_a,
163 static struct platdata_mtd_ram sram_data_b = {
164 .mapname = "Flash B SRAM",
168 static struct resource sram_resource_b = {
171 .flags = IORESOURCE_MEM,
174 static struct platform_device sram_device_b = {
178 .platform_data = &sram_data_b,
181 .resource = &sram_resource_b,
185 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
186 static struct mtd_partition bfin_spi_flash_partitions[] = {
188 .name = "bootloader(spi)",
191 .mask_flags = MTD_CAP_ROM
193 .name = "linux kernel(spi)",
195 .offset = MTDPART_OFS_APPEND,
197 .name = "file system(spi)",
198 .size = MTDPART_SIZ_FULL,
199 .offset = MTDPART_OFS_APPEND,
203 static struct flash_platform_data bfin_spi_flash_data = {
205 .parts = bfin_spi_flash_partitions,
206 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
210 /* SPI flash chip (m25p64) */
211 static struct bfin5xx_spi_chip spi_flash_chip_info = {
212 .enable_dma = 0, /* use dma transfer with this chip*/
217 #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
219 static struct bfin5xx_spi_chip spi_adc_chip_info = {
220 .enable_dma = 1, /* use dma transfer with this chip*/
225 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
226 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
232 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
233 static struct bfin5xx_spi_chip spidev_chip_info = {
239 static struct spi_board_info bfin_spi_board_info[] __initdata = {
240 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
242 /* the modalias must be the same as spi device driver name */
243 .modalias = "m25p80", /* Name of spi_driver for this device */
244 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
245 .bus_num = 0, /* Framework bus number */
246 .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
247 .platform_data = &bfin_spi_flash_data,
248 .controller_data = &spi_flash_chip_info,
253 #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
255 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
256 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
257 .bus_num = 0, /* Framework bus number */
258 .chip_select = 1, /* Framework chip select. */
259 .platform_data = NULL, /* No spi_driver specific config */
260 .controller_data = &spi_adc_chip_info,
264 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
266 .modalias = "ad1836-spi",
267 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
269 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
270 .controller_data = &ad1836_spi_chip_info,
273 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
275 .modalias = "spidev",
276 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
279 .controller_data = &spidev_chip_info,
284 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
286 static struct resource bfin_spi0_resource[] = {
288 .start = SPI0_REGBASE,
289 .end = SPI0_REGBASE + 0xFF,
290 .flags = IORESOURCE_MEM,
295 .flags = IORESOURCE_DMA,
300 .flags = IORESOURCE_IRQ,
304 /* SPI controller data */
305 static struct bfin5xx_spi_master bfin_spi0_info = {
307 .enable_dma = 1, /* master has the ability to do dma transfer */
308 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
311 static struct platform_device bfin_spi0_device = {
313 .id = 0, /* Bus number */
314 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
315 .resource = bfin_spi0_resource,
317 .platform_data = &bfin_spi0_info, /* Passed to driver */
320 #endif /* spi master and devices */
322 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
323 static struct resource bfin_uart_resources[] = {
327 .flags = IORESOURCE_MEM,
331 static struct platform_device bfin_uart_device = {
334 .num_resources = ARRAY_SIZE(bfin_uart_resources),
335 .resource = bfin_uart_resources,
339 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
340 #ifdef CONFIG_BFIN_SIR0
341 static struct resource bfin_sir0_resources[] = {
345 .flags = IORESOURCE_MEM,
348 .start = IRQ_UART0_RX,
349 .end = IRQ_UART0_RX+1,
350 .flags = IORESOURCE_IRQ,
353 .start = CH_UART0_RX,
354 .end = CH_UART0_RX+1,
355 .flags = IORESOURCE_DMA,
359 static struct platform_device bfin_sir0_device = {
362 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
363 .resource = bfin_sir0_resources,
368 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
369 #include <linux/input.h>
370 #include <linux/gpio_keys.h>
372 static struct gpio_keys_button bfin_gpio_keys_table[] = {
373 {BTN_0, GPIO_PF7, 1, "gpio-keys: BTN0"},
374 {BTN_1, GPIO_PF8, 1, "gpio-keys: BTN1"},
375 {BTN_2, GPIO_PF9, 1, "gpio-keys: BTN2"},
376 {BTN_3, GPIO_PF10, 1, "gpio-keys: BTN3"},
379 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
380 .buttons = bfin_gpio_keys_table,
381 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
384 static struct platform_device bfin_device_gpiokeys = {
387 .platform_data = &bfin_gpio_keys_data,
392 static struct resource bfin_gpios_resources = {
394 .end = MAX_BLACKFIN_GPIOS - 1,
395 .flags = IORESOURCE_IRQ,
398 static struct platform_device bfin_gpios_device = {
399 .name = "simple-gpio",
402 .resource = &bfin_gpios_resources,
405 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
406 #include <linux/i2c-gpio.h>
408 static struct i2c_gpio_platform_data i2c_gpio_data = {
411 .sda_is_open_drain = 0,
412 .scl_is_open_drain = 0,
416 static struct platform_device i2c_gpio_device = {
420 .platform_data = &i2c_gpio_data,
425 static const unsigned int cclk_vlev_datasheet[] =
427 VRPAIR(VLEV_085, 250000000),
428 VRPAIR(VLEV_090, 376000000),
429 VRPAIR(VLEV_095, 426000000),
430 VRPAIR(VLEV_100, 426000000),
431 VRPAIR(VLEV_105, 476000000),
432 VRPAIR(VLEV_110, 476000000),
433 VRPAIR(VLEV_115, 476000000),
434 VRPAIR(VLEV_120, 600000000),
435 VRPAIR(VLEV_125, 600000000),
436 VRPAIR(VLEV_130, 600000000),
439 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
440 .tuple_tab = cclk_vlev_datasheet,
441 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
442 .vr_settling_time = 25 /* us */,
445 static struct platform_device bfin_dpmc = {
448 .platform_data = &bfin_dmpc_vreg_data,
452 static struct platform_device *ezkit_devices[] __initdata = {
456 #if defined(CONFIG_MTD_PSD4256G) || defined(CONFIG_MTD_PSD4256G_MODULE)
461 #if defined(CONFIG_MTD_PLATRAM) || defined(CONFIG_MTD_PLATRAM_MODULE)
466 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
470 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
474 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
475 &bfin_fb_adv7393_device,
478 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
482 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
486 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
487 #ifdef CONFIG_BFIN_SIR0
492 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
493 &bfin_device_gpiokeys,
496 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
503 static int __init ezkit_init(void)
505 printk(KERN_INFO "%s(): registering device resources\n", __func__);
506 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
507 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
511 arch_initcall(ezkit_init);