blob: 08a7943949aef477b5fb2820c6d70d059ded82b3 [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 Frysinger67f2d332008-02-09 01:49:23 +080037#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
Mike Frysingerf02bcec2007-11-15 21:29:15 +080038#include <linux/usb/isp1362.h>
Mike Frysinger67f2d332008-02-09 01:49:23 +080039#endif
Jeff Garzik0a87e3e2008-02-01 18:02:30 -050040#include <linux/ata_platform.h>
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080041#include <linux/irq.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080042#include <asm/dma.h>
Bryan Wu1394f032007-05-06 14:50:22 -070043#include <asm/bfin5xx_spi.h>
Bryan Wu5d448dd2007-11-12 23:24:42 +080044#include <asm/portmux.h>
Bryan Wu1394f032007-05-06 14:50:22 -070045
46/*
47 * Name the Board for the /proc/cpuinfo
48 */
Mike Frysinger066954a2007-10-21 22:36:06 +080049const char bfin_board_name[] = "ADDS-BF533-EZKIT";
Bryan Wu1394f032007-05-06 14:50:22 -070050
51#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
52static struct platform_device rtc_device = {
53 .name = "rtc-bfin",
54 .id = -1,
55};
56#endif
57
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080058#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
59static struct platform_device bfin_fb_adv7393_device = {
60 .name = "bfin-adv7393",
61};
62#endif
63
Bryan Wu1394f032007-05-06 14:50:22 -070064/*
65 * USB-LAN EzExtender board
66 * Driver needs to know address, irq and flag pin.
67 */
68#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
69static struct resource smc91x_resources[] = {
70 {
71 .name = "smc91x-regs",
72 .start = 0x20310300,
73 .end = 0x20310300 + 16,
74 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080075 }, {
Bryan Wu1394f032007-05-06 14:50:22 -070076 .start = IRQ_PF9,
77 .end = IRQ_PF9,
78 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
79 },
80};
81static struct platform_device smc91x_device = {
82 .name = "smc91x",
83 .id = 0,
84 .num_resources = ARRAY_SIZE(smc91x_resources),
85 .resource = smc91x_resources,
86};
87#endif
88
89#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
90/* all SPI peripherals info goes here */
91
92#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
93static struct mtd_partition bfin_spi_flash_partitions[] = {
94 {
95 .name = "bootloader",
96 .size = 0x00020000,
97 .offset = 0,
98 .mask_flags = MTD_CAP_ROM
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080099 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700100 .name = "kernel",
101 .size = 0xe0000,
Mike Frysingeredf05642008-02-25 11:38:11 +0800102 .offset = MTDPART_OFS_APPEND,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800103 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700104 .name = "file system",
Mike Frysingeredf05642008-02-25 11:38:11 +0800105 .size = MTDPART_SIZ_FULL,
106 .offset = MTDPART_OFS_APPEND,
Bryan Wu1394f032007-05-06 14:50:22 -0700107 }
108};
109
110static struct flash_platform_data bfin_spi_flash_data = {
111 .name = "m25p80",
112 .parts = bfin_spi_flash_partitions,
113 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
114 .type = "m25p64",
115};
116
117/* SPI flash chip (m25p64) */
118static struct bfin5xx_spi_chip spi_flash_chip_info = {
119 .enable_dma = 0, /* use dma transfer with this chip*/
120 .bits_per_word = 8,
121};
122#endif
123
124#if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
125/* SPI ADC chip */
126static struct bfin5xx_spi_chip spi_adc_chip_info = {
127 .enable_dma = 1, /* use dma transfer with this chip*/
128 .bits_per_word = 16,
129};
130#endif
131
132#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
133static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
134 .enable_dma = 0,
135 .bits_per_word = 16,
136};
137#endif
138
Michael Hennerich6e668932008-02-09 01:54:09 +0800139#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
140static struct bfin5xx_spi_chip spidev_chip_info = {
141 .enable_dma = 0,
142 .bits_per_word = 8,
143};
144#endif
145
Bryan Wu1394f032007-05-06 14:50:22 -0700146static struct spi_board_info bfin_spi_board_info[] __initdata = {
147#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
148 {
149 /* the modalias must be the same as spi device driver name */
150 .modalias = "m25p80", /* Name of spi_driver for this device */
151 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800152 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700153 .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
154 .platform_data = &bfin_spi_flash_data,
155 .controller_data = &spi_flash_chip_info,
156 .mode = SPI_MODE_3,
157 },
158#endif
159
160#if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
161 {
162 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
163 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800164 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700165 .chip_select = 1, /* Framework chip select. */
166 .platform_data = NULL, /* No spi_driver specific config */
167 .controller_data = &spi_adc_chip_info,
168 },
169#endif
170
171#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
172 {
173 .modalias = "ad1836-spi",
174 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800175 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700176 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
177 .controller_data = &ad1836_spi_chip_info,
178 },
179#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800180#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
181 {
182 .modalias = "spidev",
183 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
184 .bus_num = 0,
185 .chip_select = 1,
186 .controller_data = &spidev_chip_info,
187 },
188#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700189};
190
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800191/* SPI (0) */
192static struct resource bfin_spi0_resource[] = {
193 [0] = {
194 .start = SPI0_REGBASE,
195 .end = SPI0_REGBASE + 0xFF,
196 .flags = IORESOURCE_MEM,
197 },
198 [1] = {
199 .start = CH_SPI,
200 .end = CH_SPI,
201 .flags = IORESOURCE_IRQ,
202 }
203};
204
Bryan Wu1394f032007-05-06 14:50:22 -0700205/* SPI controller data */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800206static struct bfin5xx_spi_master bfin_spi0_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700207 .num_chipselect = 8,
208 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800209 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Bryan Wu1394f032007-05-06 14:50:22 -0700210};
211
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800212static struct platform_device bfin_spi0_device = {
213 .name = "bfin-spi",
214 .id = 0, /* Bus number */
215 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
216 .resource = bfin_spi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -0700217 .dev = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800218 .platform_data = &bfin_spi0_info, /* Passed to driver */
Bryan Wu1394f032007-05-06 14:50:22 -0700219 },
220};
221#endif /* spi master and devices */
222
223#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
224static struct resource bfin_uart_resources[] = {
225 {
226 .start = 0xFFC00400,
227 .end = 0xFFC004FF,
228 .flags = IORESOURCE_MEM,
229 },
230};
231
232static struct platform_device bfin_uart_device = {
233 .name = "bfin-uart",
234 .id = 1,
235 .num_resources = ARRAY_SIZE(bfin_uart_resources),
236 .resource = bfin_uart_resources,
237};
238#endif
239
Graf Yang5be36d22008-04-25 03:09:15 +0800240#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
241static struct resource bfin_sir_resources[] = {
242#ifdef CONFIG_BFIN_SIR0
243 {
244 .start = 0xFFC00400,
245 .end = 0xFFC004FF,
246 .flags = IORESOURCE_MEM,
247 },
248#endif
249};
250
251static struct platform_device bfin_sir_device = {
252 .name = "bfin_sir",
253 .id = 0,
254 .num_resources = ARRAY_SIZE(bfin_sir_resources),
255 .resource = bfin_sir_resources,
256};
257#endif
258
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800259#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
260#define PATA_INT 55
261
262static struct pata_platform_info bfin_pata_platform_data = {
263 .ioport_shift = 1,
264 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
265};
266
267static struct resource bfin_pata_resources[] = {
268 {
269 .start = 0x20314020,
270 .end = 0x2031403F,
271 .flags = IORESOURCE_MEM,
272 },
273 {
274 .start = 0x2031401C,
275 .end = 0x2031401F,
276 .flags = IORESOURCE_MEM,
277 },
278 {
279 .start = PATA_INT,
280 .end = PATA_INT,
281 .flags = IORESOURCE_IRQ,
282 },
283};
284
285static struct platform_device bfin_pata_device = {
286 .name = "pata_platform",
287 .id = -1,
288 .num_resources = ARRAY_SIZE(bfin_pata_resources),
289 .resource = bfin_pata_resources,
290 .dev = {
291 .platform_data = &bfin_pata_platform_data,
292 }
293};
294#endif
295
Michael Hennerich2463ef22008-01-27 16:49:48 +0800296#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
297#include <linux/input.h>
298#include <linux/gpio_keys.h>
299
300static struct gpio_keys_button bfin_gpio_keys_table[] = {
301 {BTN_0, GPIO_PF7, 1, "gpio-keys: BTN0"},
302 {BTN_1, GPIO_PF8, 1, "gpio-keys: BTN1"},
303 {BTN_2, GPIO_PF9, 1, "gpio-keys: BTN2"},
304 {BTN_3, GPIO_PF10, 1, "gpio-keys: BTN3"},
305};
306
307static struct gpio_keys_platform_data bfin_gpio_keys_data = {
308 .buttons = bfin_gpio_keys_table,
309 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
310};
311
312static struct platform_device bfin_device_gpiokeys = {
313 .name = "gpio-keys",
314 .dev = {
315 .platform_data = &bfin_gpio_keys_data,
316 },
317};
318#endif
319
Mike Frysingercad2ab62008-02-22 17:01:31 +0800320static struct resource bfin_gpios_resources = {
321 .start = 0,
322 .end = MAX_BLACKFIN_GPIOS - 1,
323 .flags = IORESOURCE_IRQ,
324};
325
326static struct platform_device bfin_gpios_device = {
327 .name = "simple-gpio",
328 .id = -1,
329 .num_resources = 1,
330 .resource = &bfin_gpios_resources,
331};
332
Bryan Wue3163952008-01-24 16:19:15 +0800333#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
334#include <linux/i2c-gpio.h>
335
336static struct i2c_gpio_platform_data i2c_gpio_data = {
337 .sda_pin = 1,
338 .scl_pin = 0,
339 .sda_is_open_drain = 0,
340 .scl_is_open_drain = 0,
341 .udelay = 40,
342};
343
344static struct platform_device i2c_gpio_device = {
345 .name = "i2c-gpio",
346 .id = 0,
347 .dev = {
348 .platform_data = &i2c_gpio_data,
349 },
350};
351#endif
352
Bryan Wu1394f032007-05-06 14:50:22 -0700353static struct platform_device *ezkit_devices[] __initdata = {
354#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
355 &smc91x_device,
356#endif
357
358#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800359 &bfin_spi0_device,
360#endif
361
362#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
363 &bfin_fb_adv7393_device,
Bryan Wu1394f032007-05-06 14:50:22 -0700364#endif
365
366#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
367 &rtc_device,
368#endif
369
370#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
371 &bfin_uart_device,
372#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800373
Graf Yang5be36d22008-04-25 03:09:15 +0800374#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
375 &bfin_sir_device,
376#endif
377
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800378#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
379 &bfin_pata_device,
380#endif
Michael Hennerich2463ef22008-01-27 16:49:48 +0800381
382#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
383 &bfin_device_gpiokeys,
384#endif
Bryan Wue3163952008-01-24 16:19:15 +0800385
386#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
387 &i2c_gpio_device,
388#endif
Mike Frysingercad2ab62008-02-22 17:01:31 +0800389
390 &bfin_gpios_device,
Bryan Wu1394f032007-05-06 14:50:22 -0700391};
392
393static int __init ezkit_init(void)
394{
Harvey Harrisonb85d8582008-04-23 09:39:01 +0800395 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Bryan Wu1394f032007-05-06 14:50:22 -0700396 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
397#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
398 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
399#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800400
401#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
402 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
403#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700404 return 0;
405}
406
407arch_initcall(ezkit_init);