blob: 4a42d624e558b5611f0de9af3f2bf89d2ee85a63 [file] [log] [blame]
Bryan Wu1394f032007-05-06 14:50:22 -07001/*
2 * File: arch/blackfin/mach-bf533/ezkit.c
Simon Arlottd2d50aa2007-06-11 15:31:30 +08003 * Based on: Original Work
Bryan Wu1394f032007-05-06 14:50:22 -07004 * Author: Aidan Williams <aidan@nicta.com.au>
5 *
6 * Created: 2005
7 * Description:
8 *
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.
12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 *
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.
19 *
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.
24 *
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
29 */
30
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>
Mike Frysingerf02bcec2007-11-15 21:29:15 +080037#include <linux/usb/isp1362.h>
Jeff Garzik0a87e3e2008-02-01 18:02:30 -050038#include <linux/ata_platform.h>
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080039#include <linux/irq.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080040#include <asm/dma.h>
Bryan Wu1394f032007-05-06 14:50:22 -070041#include <asm/bfin5xx_spi.h>
Bryan Wu5d448dd2007-11-12 23:24:42 +080042#include <asm/portmux.h>
Bryan Wu1394f032007-05-06 14:50:22 -070043
44/*
45 * Name the Board for the /proc/cpuinfo
46 */
Mike Frysinger066954a2007-10-21 22:36:06 +080047const char bfin_board_name[] = "ADDS-BF533-EZKIT";
Bryan Wu1394f032007-05-06 14:50:22 -070048
49#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
50static struct platform_device rtc_device = {
51 .name = "rtc-bfin",
52 .id = -1,
53};
54#endif
55
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080056#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
57static struct platform_device bfin_fb_adv7393_device = {
58 .name = "bfin-adv7393",
59};
60#endif
61
Bryan Wu1394f032007-05-06 14:50:22 -070062/*
63 * USB-LAN EzExtender board
64 * Driver needs to know address, irq and flag pin.
65 */
66#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
67static struct resource smc91x_resources[] = {
68 {
69 .name = "smc91x-regs",
70 .start = 0x20310300,
71 .end = 0x20310300 + 16,
72 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080073 }, {
Bryan Wu1394f032007-05-06 14:50:22 -070074 .start = IRQ_PF9,
75 .end = IRQ_PF9,
76 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
77 },
78};
79static struct platform_device smc91x_device = {
80 .name = "smc91x",
81 .id = 0,
82 .num_resources = ARRAY_SIZE(smc91x_resources),
83 .resource = smc91x_resources,
84};
85#endif
86
87#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
88/* all SPI peripherals info goes here */
89
90#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
91static struct mtd_partition bfin_spi_flash_partitions[] = {
92 {
93 .name = "bootloader",
94 .size = 0x00020000,
95 .offset = 0,
96 .mask_flags = MTD_CAP_ROM
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080097 }, {
Bryan Wu1394f032007-05-06 14:50:22 -070098 .name = "kernel",
99 .size = 0xe0000,
100 .offset = 0x20000
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800101 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700102 .name = "file system",
103 .size = 0x700000,
104 .offset = 0x00100000,
105 }
106};
107
108static struct flash_platform_data bfin_spi_flash_data = {
109 .name = "m25p80",
110 .parts = bfin_spi_flash_partitions,
111 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
112 .type = "m25p64",
113};
114
115/* SPI flash chip (m25p64) */
116static struct bfin5xx_spi_chip spi_flash_chip_info = {
117 .enable_dma = 0, /* use dma transfer with this chip*/
118 .bits_per_word = 8,
119};
120#endif
121
122#if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
123/* SPI ADC chip */
124static struct bfin5xx_spi_chip spi_adc_chip_info = {
125 .enable_dma = 1, /* use dma transfer with this chip*/
126 .bits_per_word = 16,
127};
128#endif
129
130#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
131static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
132 .enable_dma = 0,
133 .bits_per_word = 16,
134};
135#endif
136
Michael Hennerich6e668932008-02-09 01:54:09 +0800137#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
138static struct bfin5xx_spi_chip spidev_chip_info = {
139 .enable_dma = 0,
140 .bits_per_word = 8,
141};
142#endif
143
Bryan Wu1394f032007-05-06 14:50:22 -0700144static struct spi_board_info bfin_spi_board_info[] __initdata = {
145#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
146 {
147 /* the modalias must be the same as spi device driver name */
148 .modalias = "m25p80", /* Name of spi_driver for this device */
149 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800150 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700151 .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
152 .platform_data = &bfin_spi_flash_data,
153 .controller_data = &spi_flash_chip_info,
154 .mode = SPI_MODE_3,
155 },
156#endif
157
158#if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
159 {
160 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
161 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800162 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700163 .chip_select = 1, /* Framework chip select. */
164 .platform_data = NULL, /* No spi_driver specific config */
165 .controller_data = &spi_adc_chip_info,
166 },
167#endif
168
169#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
170 {
171 .modalias = "ad1836-spi",
172 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800173 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700174 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
175 .controller_data = &ad1836_spi_chip_info,
176 },
177#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800178#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
179 {
180 .modalias = "spidev",
181 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
182 .bus_num = 0,
183 .chip_select = 1,
184 .controller_data = &spidev_chip_info,
185 },
186#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700187};
188
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800189/* SPI (0) */
190static struct resource bfin_spi0_resource[] = {
191 [0] = {
192 .start = SPI0_REGBASE,
193 .end = SPI0_REGBASE + 0xFF,
194 .flags = IORESOURCE_MEM,
195 },
196 [1] = {
197 .start = CH_SPI,
198 .end = CH_SPI,
199 .flags = IORESOURCE_IRQ,
200 }
201};
202
Bryan Wu1394f032007-05-06 14:50:22 -0700203/* SPI controller data */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800204static struct bfin5xx_spi_master bfin_spi0_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700205 .num_chipselect = 8,
206 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800207 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Bryan Wu1394f032007-05-06 14:50:22 -0700208};
209
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800210static struct platform_device bfin_spi0_device = {
211 .name = "bfin-spi",
212 .id = 0, /* Bus number */
213 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
214 .resource = bfin_spi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -0700215 .dev = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800216 .platform_data = &bfin_spi0_info, /* Passed to driver */
Bryan Wu1394f032007-05-06 14:50:22 -0700217 },
218};
219#endif /* spi master and devices */
220
221#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
222static struct resource bfin_uart_resources[] = {
223 {
224 .start = 0xFFC00400,
225 .end = 0xFFC004FF,
226 .flags = IORESOURCE_MEM,
227 },
228};
229
230static struct platform_device bfin_uart_device = {
231 .name = "bfin-uart",
232 .id = 1,
233 .num_resources = ARRAY_SIZE(bfin_uart_resources),
234 .resource = bfin_uart_resources,
235};
236#endif
237
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800238#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
239#define PATA_INT 55
240
241static struct pata_platform_info bfin_pata_platform_data = {
242 .ioport_shift = 1,
243 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
244};
245
246static struct resource bfin_pata_resources[] = {
247 {
248 .start = 0x20314020,
249 .end = 0x2031403F,
250 .flags = IORESOURCE_MEM,
251 },
252 {
253 .start = 0x2031401C,
254 .end = 0x2031401F,
255 .flags = IORESOURCE_MEM,
256 },
257 {
258 .start = PATA_INT,
259 .end = PATA_INT,
260 .flags = IORESOURCE_IRQ,
261 },
262};
263
264static struct platform_device bfin_pata_device = {
265 .name = "pata_platform",
266 .id = -1,
267 .num_resources = ARRAY_SIZE(bfin_pata_resources),
268 .resource = bfin_pata_resources,
269 .dev = {
270 .platform_data = &bfin_pata_platform_data,
271 }
272};
273#endif
274
Michael Hennerich2463ef22008-01-27 16:49:48 +0800275#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
276#include <linux/input.h>
277#include <linux/gpio_keys.h>
278
279static struct gpio_keys_button bfin_gpio_keys_table[] = {
280 {BTN_0, GPIO_PF7, 1, "gpio-keys: BTN0"},
281 {BTN_1, GPIO_PF8, 1, "gpio-keys: BTN1"},
282 {BTN_2, GPIO_PF9, 1, "gpio-keys: BTN2"},
283 {BTN_3, GPIO_PF10, 1, "gpio-keys: BTN3"},
284};
285
286static struct gpio_keys_platform_data bfin_gpio_keys_data = {
287 .buttons = bfin_gpio_keys_table,
288 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
289};
290
291static struct platform_device bfin_device_gpiokeys = {
292 .name = "gpio-keys",
293 .dev = {
294 .platform_data = &bfin_gpio_keys_data,
295 },
296};
297#endif
298
Bryan Wue3163952008-01-24 16:19:15 +0800299#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
300#include <linux/i2c-gpio.h>
301
302static struct i2c_gpio_platform_data i2c_gpio_data = {
303 .sda_pin = 1,
304 .scl_pin = 0,
305 .sda_is_open_drain = 0,
306 .scl_is_open_drain = 0,
307 .udelay = 40,
308};
309
310static struct platform_device i2c_gpio_device = {
311 .name = "i2c-gpio",
312 .id = 0,
313 .dev = {
314 .platform_data = &i2c_gpio_data,
315 },
316};
317#endif
318
Bryan Wu1394f032007-05-06 14:50:22 -0700319static struct platform_device *ezkit_devices[] __initdata = {
320#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
321 &smc91x_device,
322#endif
323
324#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800325 &bfin_spi0_device,
326#endif
327
328#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
329 &bfin_fb_adv7393_device,
Bryan Wu1394f032007-05-06 14:50:22 -0700330#endif
331
332#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
333 &rtc_device,
334#endif
335
336#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
337 &bfin_uart_device,
338#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800339
340#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
341 &bfin_pata_device,
342#endif
Michael Hennerich2463ef22008-01-27 16:49:48 +0800343
344#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
345 &bfin_device_gpiokeys,
346#endif
Bryan Wue3163952008-01-24 16:19:15 +0800347
348#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
349 &i2c_gpio_device,
350#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700351};
352
353static int __init ezkit_init(void)
354{
355 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
356 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
357#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
358 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
359#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800360
361#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
362 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
363#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700364 return 0;
365}
366
367arch_initcall(ezkit_init);