blob: 9d28415163ea67064a1085a0b5c9c63e005a4560 [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>
Michael Hennerich14b03202008-05-07 11:41:26 +080045#include <asm/dpmc.h>
Bryan Wu1394f032007-05-06 14:50:22 -070046
47/*
48 * Name the Board for the /proc/cpuinfo
49 */
Mike Frysinger066954a2007-10-21 22:36:06 +080050const char bfin_board_name[] = "ADDS-BF533-EZKIT";
Bryan Wu1394f032007-05-06 14:50:22 -070051
52#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
53static struct platform_device rtc_device = {
54 .name = "rtc-bfin",
55 .id = -1,
56};
57#endif
58
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080059#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
60static struct platform_device bfin_fb_adv7393_device = {
61 .name = "bfin-adv7393",
62};
63#endif
64
Bryan Wu1394f032007-05-06 14:50:22 -070065/*
66 * USB-LAN EzExtender board
67 * Driver needs to know address, irq and flag pin.
68 */
69#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
70static struct resource smc91x_resources[] = {
71 {
72 .name = "smc91x-regs",
73 .start = 0x20310300,
74 .end = 0x20310300 + 16,
75 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080076 }, {
Bryan Wu1394f032007-05-06 14:50:22 -070077 .start = IRQ_PF9,
78 .end = IRQ_PF9,
79 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
80 },
81};
82static struct platform_device smc91x_device = {
83 .name = "smc91x",
84 .id = 0,
85 .num_resources = ARRAY_SIZE(smc91x_resources),
86 .resource = smc91x_resources,
87};
88#endif
89
90#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
91/* all SPI peripherals info goes here */
92
93#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
94static struct mtd_partition bfin_spi_flash_partitions[] = {
95 {
96 .name = "bootloader",
97 .size = 0x00020000,
98 .offset = 0,
99 .mask_flags = MTD_CAP_ROM
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800100 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700101 .name = "kernel",
102 .size = 0xe0000,
Mike Frysingeredf05642008-02-25 11:38:11 +0800103 .offset = MTDPART_OFS_APPEND,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800104 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700105 .name = "file system",
Mike Frysingeredf05642008-02-25 11:38:11 +0800106 .size = MTDPART_SIZ_FULL,
107 .offset = MTDPART_OFS_APPEND,
Bryan Wu1394f032007-05-06 14:50:22 -0700108 }
109};
110
111static struct flash_platform_data bfin_spi_flash_data = {
112 .name = "m25p80",
113 .parts = bfin_spi_flash_partitions,
114 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
115 .type = "m25p64",
116};
117
118/* SPI flash chip (m25p64) */
119static struct bfin5xx_spi_chip spi_flash_chip_info = {
120 .enable_dma = 0, /* use dma transfer with this chip*/
121 .bits_per_word = 8,
122};
123#endif
124
125#if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
126/* SPI ADC chip */
127static struct bfin5xx_spi_chip spi_adc_chip_info = {
128 .enable_dma = 1, /* use dma transfer with this chip*/
129 .bits_per_word = 16,
130};
131#endif
132
133#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
134static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
135 .enable_dma = 0,
136 .bits_per_word = 16,
137};
138#endif
139
Michael Hennerich6e668932008-02-09 01:54:09 +0800140#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
141static struct bfin5xx_spi_chip spidev_chip_info = {
142 .enable_dma = 0,
143 .bits_per_word = 8,
144};
145#endif
146
Bryan Wu1394f032007-05-06 14:50:22 -0700147static struct spi_board_info bfin_spi_board_info[] __initdata = {
148#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
149 {
150 /* the modalias must be the same as spi device driver name */
151 .modalias = "m25p80", /* Name of spi_driver for this device */
152 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800153 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700154 .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
155 .platform_data = &bfin_spi_flash_data,
156 .controller_data = &spi_flash_chip_info,
157 .mode = SPI_MODE_3,
158 },
159#endif
160
161#if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
162 {
163 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
164 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800165 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700166 .chip_select = 1, /* Framework chip select. */
167 .platform_data = NULL, /* No spi_driver specific config */
168 .controller_data = &spi_adc_chip_info,
169 },
170#endif
171
172#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
173 {
174 .modalias = "ad1836-spi",
175 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800176 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700177 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
178 .controller_data = &ad1836_spi_chip_info,
179 },
180#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800181#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
182 {
183 .modalias = "spidev",
184 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
185 .bus_num = 0,
186 .chip_select = 1,
187 .controller_data = &spidev_chip_info,
188 },
189#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700190};
191
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800192/* SPI (0) */
193static struct resource bfin_spi0_resource[] = {
194 [0] = {
195 .start = SPI0_REGBASE,
196 .end = SPI0_REGBASE + 0xFF,
197 .flags = IORESOURCE_MEM,
198 },
199 [1] = {
200 .start = CH_SPI,
201 .end = CH_SPI,
202 .flags = IORESOURCE_IRQ,
203 }
204};
205
Bryan Wu1394f032007-05-06 14:50:22 -0700206/* SPI controller data */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800207static struct bfin5xx_spi_master bfin_spi0_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700208 .num_chipselect = 8,
209 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800210 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Bryan Wu1394f032007-05-06 14:50:22 -0700211};
212
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800213static struct platform_device bfin_spi0_device = {
214 .name = "bfin-spi",
215 .id = 0, /* Bus number */
216 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
217 .resource = bfin_spi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -0700218 .dev = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800219 .platform_data = &bfin_spi0_info, /* Passed to driver */
Bryan Wu1394f032007-05-06 14:50:22 -0700220 },
221};
222#endif /* spi master and devices */
223
224#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
225static struct resource bfin_uart_resources[] = {
226 {
227 .start = 0xFFC00400,
228 .end = 0xFFC004FF,
229 .flags = IORESOURCE_MEM,
230 },
231};
232
233static struct platform_device bfin_uart_device = {
234 .name = "bfin-uart",
235 .id = 1,
236 .num_resources = ARRAY_SIZE(bfin_uart_resources),
237 .resource = bfin_uart_resources,
238};
239#endif
240
Graf Yang5be36d22008-04-25 03:09:15 +0800241#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
242static struct resource bfin_sir_resources[] = {
243#ifdef CONFIG_BFIN_SIR0
244 {
245 .start = 0xFFC00400,
246 .end = 0xFFC004FF,
247 .flags = IORESOURCE_MEM,
248 },
249#endif
250};
251
252static struct platform_device bfin_sir_device = {
253 .name = "bfin_sir",
254 .id = 0,
255 .num_resources = ARRAY_SIZE(bfin_sir_resources),
256 .resource = bfin_sir_resources,
257};
258#endif
259
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800260#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
261#define PATA_INT 55
262
263static struct pata_platform_info bfin_pata_platform_data = {
264 .ioport_shift = 1,
265 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
266};
267
268static struct resource bfin_pata_resources[] = {
269 {
270 .start = 0x20314020,
271 .end = 0x2031403F,
272 .flags = IORESOURCE_MEM,
273 },
274 {
275 .start = 0x2031401C,
276 .end = 0x2031401F,
277 .flags = IORESOURCE_MEM,
278 },
279 {
280 .start = PATA_INT,
281 .end = PATA_INT,
282 .flags = IORESOURCE_IRQ,
283 },
284};
285
286static struct platform_device bfin_pata_device = {
287 .name = "pata_platform",
288 .id = -1,
289 .num_resources = ARRAY_SIZE(bfin_pata_resources),
290 .resource = bfin_pata_resources,
291 .dev = {
292 .platform_data = &bfin_pata_platform_data,
293 }
294};
295#endif
296
Michael Hennerich2463ef22008-01-27 16:49:48 +0800297#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
298#include <linux/input.h>
299#include <linux/gpio_keys.h>
300
301static struct gpio_keys_button bfin_gpio_keys_table[] = {
302 {BTN_0, GPIO_PF7, 1, "gpio-keys: BTN0"},
303 {BTN_1, GPIO_PF8, 1, "gpio-keys: BTN1"},
304 {BTN_2, GPIO_PF9, 1, "gpio-keys: BTN2"},
305 {BTN_3, GPIO_PF10, 1, "gpio-keys: BTN3"},
306};
307
308static struct gpio_keys_platform_data bfin_gpio_keys_data = {
309 .buttons = bfin_gpio_keys_table,
310 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
311};
312
313static struct platform_device bfin_device_gpiokeys = {
314 .name = "gpio-keys",
315 .dev = {
316 .platform_data = &bfin_gpio_keys_data,
317 },
318};
319#endif
320
Mike Frysingercad2ab62008-02-22 17:01:31 +0800321static struct resource bfin_gpios_resources = {
322 .start = 0,
323 .end = MAX_BLACKFIN_GPIOS - 1,
324 .flags = IORESOURCE_IRQ,
325};
326
327static struct platform_device bfin_gpios_device = {
328 .name = "simple-gpio",
329 .id = -1,
330 .num_resources = 1,
331 .resource = &bfin_gpios_resources,
332};
333
Bryan Wue3163952008-01-24 16:19:15 +0800334#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
335#include <linux/i2c-gpio.h>
336
337static struct i2c_gpio_platform_data i2c_gpio_data = {
338 .sda_pin = 1,
339 .scl_pin = 0,
340 .sda_is_open_drain = 0,
341 .scl_is_open_drain = 0,
342 .udelay = 40,
343};
344
345static struct platform_device i2c_gpio_device = {
346 .name = "i2c-gpio",
347 .id = 0,
348 .dev = {
349 .platform_data = &i2c_gpio_data,
350 },
351};
352#endif
353
Michael Hennerich14b03202008-05-07 11:41:26 +0800354static const unsigned int cclk_vlev_datasheet[] =
355{
356 VRPAIR(VLEV_085, 250000000),
357 VRPAIR(VLEV_090, 376000000),
358 VRPAIR(VLEV_095, 426000000),
359 VRPAIR(VLEV_100, 426000000),
360 VRPAIR(VLEV_105, 476000000),
361 VRPAIR(VLEV_110, 476000000),
362 VRPAIR(VLEV_115, 476000000),
363 VRPAIR(VLEV_120, 600000000),
364 VRPAIR(VLEV_125, 600000000),
365 VRPAIR(VLEV_130, 600000000),
366};
367
368static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
369 .tuple_tab = cclk_vlev_datasheet,
370 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
371 .vr_settling_time = 25 /* us */,
372};
373
374static struct platform_device bfin_dpmc = {
375 .name = "bfin dpmc",
376 .dev = {
377 .platform_data = &bfin_dmpc_vreg_data,
378 },
379};
380
Bryan Wu1394f032007-05-06 14:50:22 -0700381static struct platform_device *ezkit_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +0800382
383 &bfin_dpmc,
384
Bryan Wu1394f032007-05-06 14:50:22 -0700385#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
386 &smc91x_device,
387#endif
388
389#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800390 &bfin_spi0_device,
391#endif
392
393#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
394 &bfin_fb_adv7393_device,
Bryan Wu1394f032007-05-06 14:50:22 -0700395#endif
396
397#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
398 &rtc_device,
399#endif
400
401#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
402 &bfin_uart_device,
403#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800404
Graf Yang5be36d22008-04-25 03:09:15 +0800405#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
406 &bfin_sir_device,
407#endif
408
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800409#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
410 &bfin_pata_device,
411#endif
Michael Hennerich2463ef22008-01-27 16:49:48 +0800412
413#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
414 &bfin_device_gpiokeys,
415#endif
Bryan Wue3163952008-01-24 16:19:15 +0800416
417#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
418 &i2c_gpio_device,
419#endif
Mike Frysingercad2ab62008-02-22 17:01:31 +0800420
421 &bfin_gpios_device,
Bryan Wu1394f032007-05-06 14:50:22 -0700422};
423
424static int __init ezkit_init(void)
425{
Harvey Harrisonb85d8582008-04-23 09:39:01 +0800426 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Bryan Wu1394f032007-05-06 14:50:22 -0700427 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
428#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
429 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
430#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800431
432#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
433 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
434#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700435 return 0;
436}
437
438arch_initcall(ezkit_init);