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/spi/spi.h>
36 #include <linux/spi/flash.h>
37 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
38 #include <linux/usb/isp1362.h>
40 #include <linux/irq.h>
42 #include <asm/bfin5xx_spi.h>
43 #include <asm/portmux.h>
47 * Name the Board for the /proc/cpuinfo
49 const char bfin_board_name[] = "ADI BF533-EZKIT";
51 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
52 static struct platform_device rtc_device = {
58 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
59 static struct platform_device bfin_fb_adv7393_device = {
60 .name = "bfin-adv7393",
65 * USB-LAN EzExtender board
66 * Driver needs to know address, irq and flag pin.
68 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
69 static struct resource smc91x_resources[] = {
71 .name = "smc91x-regs",
73 .end = 0x20310300 + 16,
74 .flags = IORESOURCE_MEM,
78 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
81 static struct platform_device smc91x_device = {
84 .num_resources = ARRAY_SIZE(smc91x_resources),
85 .resource = smc91x_resources,
89 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
90 static struct mtd_partition bfin_spi_flash_partitions[] = {
92 .name = "bootloader(spi)",
95 .mask_flags = MTD_CAP_ROM
97 .name = "linux kernel(spi)",
99 .offset = MTDPART_OFS_APPEND,
101 .name = "file system(spi)",
102 .size = MTDPART_SIZ_FULL,
103 .offset = MTDPART_OFS_APPEND,
107 static struct flash_platform_data bfin_spi_flash_data = {
109 .parts = bfin_spi_flash_partitions,
110 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
114 /* SPI flash chip (m25p64) */
115 static struct bfin5xx_spi_chip spi_flash_chip_info = {
116 .enable_dma = 0, /* use dma transfer with this chip*/
121 #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
123 static struct bfin5xx_spi_chip spi_adc_chip_info = {
124 .enable_dma = 1, /* use dma transfer with this chip*/
129 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
130 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
136 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
137 static struct bfin5xx_spi_chip spidev_chip_info = {
143 static struct spi_board_info bfin_spi_board_info[] __initdata = {
144 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
146 /* the modalias must be the same as spi device driver name */
147 .modalias = "m25p80", /* Name of spi_driver for this device */
148 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
149 .bus_num = 0, /* Framework bus number */
150 .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
151 .platform_data = &bfin_spi_flash_data,
152 .controller_data = &spi_flash_chip_info,
157 #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
159 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
160 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
161 .bus_num = 0, /* Framework bus number */
162 .chip_select = 1, /* Framework chip select. */
163 .platform_data = NULL, /* No spi_driver specific config */
164 .controller_data = &spi_adc_chip_info,
168 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
170 .modalias = "ad1836-spi",
171 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
173 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
174 .controller_data = &ad1836_spi_chip_info,
177 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
179 .modalias = "spidev",
180 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
183 .controller_data = &spidev_chip_info,
188 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
190 static struct resource bfin_spi0_resource[] = {
192 .start = SPI0_REGBASE,
193 .end = SPI0_REGBASE + 0xFF,
194 .flags = IORESOURCE_MEM,
199 .flags = IORESOURCE_DMA,
204 .flags = IORESOURCE_IRQ,
208 /* SPI controller data */
209 static struct bfin5xx_spi_master bfin_spi0_info = {
211 .enable_dma = 1, /* master has the ability to do dma transfer */
212 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
215 static struct platform_device bfin_spi0_device = {
217 .id = 0, /* Bus number */
218 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
219 .resource = bfin_spi0_resource,
221 .platform_data = &bfin_spi0_info, /* Passed to driver */
224 #endif /* spi master and devices */
226 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
227 static struct resource bfin_uart_resources[] = {
231 .flags = IORESOURCE_MEM,
235 static struct platform_device bfin_uart_device = {
238 .num_resources = ARRAY_SIZE(bfin_uart_resources),
239 .resource = bfin_uart_resources,
243 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
244 #ifdef CONFIG_BFIN_SIR0
245 static struct resource bfin_sir0_resources[] = {
249 .flags = IORESOURCE_MEM,
252 .start = IRQ_UART0_RX,
253 .end = IRQ_UART0_RX+1,
254 .flags = IORESOURCE_IRQ,
257 .start = CH_UART0_RX,
258 .end = CH_UART0_RX+1,
259 .flags = IORESOURCE_DMA,
263 static struct platform_device bfin_sir0_device = {
266 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
267 .resource = bfin_sir0_resources,
272 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
273 #include <linux/input.h>
274 #include <linux/gpio_keys.h>
276 static struct gpio_keys_button bfin_gpio_keys_table[] = {
277 {BTN_0, GPIO_PF7, 1, "gpio-keys: BTN0"},
278 {BTN_1, GPIO_PF8, 1, "gpio-keys: BTN1"},
279 {BTN_2, GPIO_PF9, 1, "gpio-keys: BTN2"},
280 {BTN_3, GPIO_PF10, 1, "gpio-keys: BTN3"},
283 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
284 .buttons = bfin_gpio_keys_table,
285 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
288 static struct platform_device bfin_device_gpiokeys = {
291 .platform_data = &bfin_gpio_keys_data,
296 static struct resource bfin_gpios_resources = {
298 .end = MAX_BLACKFIN_GPIOS - 1,
299 .flags = IORESOURCE_IRQ,
302 static struct platform_device bfin_gpios_device = {
303 .name = "simple-gpio",
306 .resource = &bfin_gpios_resources,
309 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
310 #include <linux/i2c-gpio.h>
312 static struct i2c_gpio_platform_data i2c_gpio_data = {
315 .sda_is_open_drain = 0,
316 .scl_is_open_drain = 0,
320 static struct platform_device i2c_gpio_device = {
324 .platform_data = &i2c_gpio_data,
329 static const unsigned int cclk_vlev_datasheet[] =
331 VRPAIR(VLEV_085, 250000000),
332 VRPAIR(VLEV_090, 376000000),
333 VRPAIR(VLEV_095, 426000000),
334 VRPAIR(VLEV_100, 426000000),
335 VRPAIR(VLEV_105, 476000000),
336 VRPAIR(VLEV_110, 476000000),
337 VRPAIR(VLEV_115, 476000000),
338 VRPAIR(VLEV_120, 600000000),
339 VRPAIR(VLEV_125, 600000000),
340 VRPAIR(VLEV_130, 600000000),
343 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
344 .tuple_tab = cclk_vlev_datasheet,
345 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
346 .vr_settling_time = 25 /* us */,
349 static struct platform_device bfin_dpmc = {
352 .platform_data = &bfin_dmpc_vreg_data,
356 static struct platform_device *ezkit_devices[] __initdata = {
360 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
364 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
368 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
369 &bfin_fb_adv7393_device,
372 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
376 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
380 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
381 #ifdef CONFIG_BFIN_SIR0
386 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
387 &bfin_device_gpiokeys,
390 #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
397 static int __init ezkit_init(void)
399 printk(KERN_INFO "%s(): registering device resources\n", __func__);
400 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
401 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
405 arch_initcall(ezkit_init);