blob: f3dc2830631cc6d01aece18fbec0fb73c476a59d [file] [log] [blame]
Bryan Wu1394f032007-05-06 14:50:22 -07001/*
2 * File: arch/blackfin/mach-bf533/stamp.c
3 * Based on: arch/blackfin/mach-bf533/ezkit.c
4 * Author: Aidan Williams <aidan@nicta.com.au>
5 *
6 * Created: 2005
7 * Description: Board Info File for the BF533-STAMP
8 *
9 * Modified:
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>
Mike Frysingerde8c43f2008-01-24 17:14:04 +080035#include <linux/mtd/physmap.h>
Bryan Wu1394f032007-05-06 14:50:22 -070036#include <linux/spi/spi.h>
37#include <linux/spi/flash.h>
Yi Li2120b682009-07-16 10:12:30 +000038#include <linux/spi/mmc_spi.h>
Bryan Wu1394f032007-05-06 14:50:22 -070039#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
Mike Frysingerf02bcec2007-11-15 21:29:15 +080040#include <linux/usb/isp1362.h>
Bryan Wu1394f032007-05-06 14:50:22 -070041#endif
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080042#include <linux/irq.h>
Bryan Wu81d9c7f2008-03-26 10:02:13 +080043#include <linux/i2c.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080044#include <asm/dma.h>
Bryan Wu1394f032007-05-06 14:50:22 -070045#include <asm/bfin5xx_spi.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080046#include <asm/reboot.h>
Bryan Wu5d448dd2007-11-12 23:24:42 +080047#include <asm/portmux.h>
Michael Hennerich14b03202008-05-07 11:41:26 +080048#include <asm/dpmc.h>
Bryan Wu1394f032007-05-06 14:50:22 -070049
50/*
51 * Name the Board for the /proc/cpuinfo
52 */
Mike Frysingerfe85cad2008-11-18 17:48:22 +080053const char bfin_board_name[] = "ADI BF533-STAMP";
Bryan Wu1394f032007-05-06 14:50:22 -070054
55#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
56static struct platform_device rtc_device = {
57 .name = "rtc-bfin",
58 .id = -1,
59};
60#endif
61
62/*
63 * Driver needs to know address, irq and flag pin.
64 */
65#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
Michael Hennerich61f09b52009-07-24 08:48:31 +000066#include <linux/smc91x.h>
67
68static struct smc91x_platdata smc91x_info = {
69 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
70 .leda = RPC_LED_100_10,
71 .ledb = RPC_LED_TX_RX,
72};
73
Bryan Wu1394f032007-05-06 14:50:22 -070074static struct resource smc91x_resources[] = {
75 {
76 .name = "smc91x-regs",
77 .start = 0x20300300,
78 .end = 0x20300300 + 16,
79 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080080 }, {
Bryan Wu1394f032007-05-06 14:50:22 -070081 .start = IRQ_PF7,
82 .end = IRQ_PF7,
83 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
84 },
85};
86
87static struct platform_device smc91x_device = {
88 .name = "smc91x",
89 .id = 0,
90 .num_resources = ARRAY_SIZE(smc91x_resources),
91 .resource = smc91x_resources,
Michael Hennerich61f09b52009-07-24 08:48:31 +000092 .dev = {
93 .platform_data = &smc91x_info,
94 },
Bryan Wu1394f032007-05-06 14:50:22 -070095};
96#endif
97
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080098#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
99static struct platform_device bfin_fb_adv7393_device = {
100 .name = "bfin-adv7393",
101};
102#endif
103
Bryan Wu1394f032007-05-06 14:50:22 -0700104#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
105static struct resource net2272_bfin_resources[] = {
106 {
107 .start = 0x20300000,
108 .end = 0x20300000 + 0x100,
109 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800110 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700111 .start = IRQ_PF10,
112 .end = IRQ_PF10,
113 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
114 },
115};
116
117static struct platform_device net2272_bfin_device = {
118 .name = "net2272",
119 .id = -1,
120 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
121 .resource = net2272_bfin_resources,
122};
123#endif
124
Mike Frysinger9cd9c612008-05-13 12:31:32 +0800125#if defined(CONFIG_MTD_BFIN_ASYNC) || defined(CONFIG_MTD_BFIN_ASYNC_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800126static struct mtd_partition stamp_partitions[] = {
127 {
Robin Getzaa582972008-08-05 17:47:29 +0800128 .name = "bootloader(nor)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800129 .size = 0x40000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800130 .offset = 0,
131 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800132 .name = "linux kernel(nor)",
Grace Pan6ecb5b62009-01-07 23:14:38 +0800133 .size = 0x180000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800134 .offset = MTDPART_OFS_APPEND,
135 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800136 .name = "file system(nor)",
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800137 .size = MTDPART_SIZ_FULL,
138 .offset = MTDPART_OFS_APPEND,
139 }
140};
141
142static struct physmap_flash_data stamp_flash_data = {
143 .width = 2,
144 .parts = stamp_partitions,
145 .nr_parts = ARRAY_SIZE(stamp_partitions),
146};
147
148static struct resource stamp_flash_resource[] = {
149 {
150 .name = "cfi_probe",
151 .start = 0x20000000,
152 .end = 0x203fffff,
153 .flags = IORESOURCE_MEM,
154 }, {
Mike Frysinger9cd9c612008-05-13 12:31:32 +0800155 .start = 0x7BB07BB0, /* AMBCTL0 setting when accessing flash */
156 .end = 0x7BB07BB0, /* AMBCTL1 setting when accessing flash */
157 .flags = IORESOURCE_MEM,
158 }, {
159 .start = GPIO_PF0,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800160 .flags = IORESOURCE_IRQ,
161 }
162};
163
164static struct platform_device stamp_flash_device = {
Mike Frysinger9cd9c612008-05-13 12:31:32 +0800165 .name = "bfin-async-flash",
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800166 .id = 0,
167 .dev = {
168 .platform_data = &stamp_flash_data,
169 },
170 .num_resources = ARRAY_SIZE(stamp_flash_resource),
171 .resource = stamp_flash_resource,
172};
Mike Frysinger793dc272008-03-26 08:09:12 +0800173#endif
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800174
Bryan Wu1394f032007-05-06 14:50:22 -0700175#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
176static struct mtd_partition bfin_spi_flash_partitions[] = {
177 {
Robin Getzaa582972008-08-05 17:47:29 +0800178 .name = "bootloader(spi)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800179 .size = 0x00040000,
Bryan Wu1394f032007-05-06 14:50:22 -0700180 .offset = 0,
181 .mask_flags = MTD_CAP_ROM
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800182 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800183 .name = "linux kernel(spi)",
Grace Pan6ecb5b62009-01-07 23:14:38 +0800184 .size = 0x180000,
Mike Frysingeredf05642008-02-25 11:38:11 +0800185 .offset = MTDPART_OFS_APPEND,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800186 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800187 .name = "file system(spi)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800188 .size = MTDPART_SIZ_FULL,
189 .offset = MTDPART_OFS_APPEND,
Bryan Wu1394f032007-05-06 14:50:22 -0700190 }
191};
192
193static struct flash_platform_data bfin_spi_flash_data = {
194 .name = "m25p80",
195 .parts = bfin_spi_flash_partitions,
196 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
197 .type = "m25p64",
198};
199
200/* SPI flash chip (m25p64) */
201static struct bfin5xx_spi_chip spi_flash_chip_info = {
202 .enable_dma = 0, /* use dma transfer with this chip*/
203 .bits_per_word = 8,
204};
205#endif
206
Mike Frysingera261eec2009-05-20 14:05:36 +0000207#if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
Bryan Wu1394f032007-05-06 14:50:22 -0700208/* SPI ADC chip */
209static struct bfin5xx_spi_chip spi_adc_chip_info = {
210 .enable_dma = 1, /* use dma transfer with this chip*/
211 .bits_per_word = 16,
212};
213#endif
214
215#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
216static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
217 .enable_dma = 0,
218 .bits_per_word = 16,
219};
220#endif
221
222#if defined(CONFIG_PBX)
223static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
224 .ctl_reg = 0x4, /* send zero */
225 .enable_dma = 0,
226 .bits_per_word = 8,
227 .cs_change_per_word = 1,
228};
229#endif
230
Michael Hennerich6e668932008-02-09 01:54:09 +0800231#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
232static struct bfin5xx_spi_chip spidev_chip_info = {
233 .enable_dma = 0,
234 .bits_per_word = 8,
235};
236#endif
237
Yi Li2120b682009-07-16 10:12:30 +0000238#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
239#define MMC_SPI_CARD_DETECT_INT IRQ_PF5
240static int bfin_mmc_spi_init(struct device *dev,
241 irqreturn_t (*detect_int)(int, void *), void *data)
242{
243 return request_irq(MMC_SPI_CARD_DETECT_INT, detect_int,
244 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
245 "mmc-spi-detect", data);
246}
247
248static void bfin_mmc_spi_exit(struct device *dev, void *data)
249{
250 free_irq(MMC_SPI_CARD_DETECT_INT, data);
251}
252
253static struct mmc_spi_platform_data bfin_mmc_spi_pdata = {
254 .init = bfin_mmc_spi_init,
255 .exit = bfin_mmc_spi_exit,
256 .detect_delay = 100, /* msecs */
257};
258
259static struct bfin5xx_spi_chip mmc_spi_chip_info = {
260 .enable_dma = 0,
261 .bits_per_word = 8,
262 .pio_interrupt = 0,
263};
264#endif
265
Bryan Wu1394f032007-05-06 14:50:22 -0700266static struct spi_board_info bfin_spi_board_info[] __initdata = {
267#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
268 {
269 /* the modalias must be the same as spi device driver name */
270 .modalias = "m25p80", /* Name of spi_driver for this device */
271 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800272 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700273 .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
274 .platform_data = &bfin_spi_flash_data,
275 .controller_data = &spi_flash_chip_info,
276 .mode = SPI_MODE_3,
277 },
278#endif
279
Mike Frysingera261eec2009-05-20 14:05:36 +0000280#if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
Bryan Wu1394f032007-05-06 14:50:22 -0700281 {
282 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
283 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800284 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700285 .chip_select = 1, /* Framework chip select. */
286 .platform_data = NULL, /* No spi_driver specific config */
287 .controller_data = &spi_adc_chip_info,
288 },
289#endif
290
291#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
292 {
293 .modalias = "ad1836-spi",
Cliff Cai858c5e92009-07-22 06:34:55 +0000294 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800295 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700296 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
297 .controller_data = &ad1836_spi_chip_info,
298 },
299#endif
300
Bryan Wu1394f032007-05-06 14:50:22 -0700301#if defined(CONFIG_PBX)
302 {
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800303 .modalias = "fxs-spi",
304 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800305 .bus_num = 0,
306 .chip_select = 8 - CONFIG_J11_JUMPER,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800307 .controller_data = &spi_si3xxx_chip_info,
Bryan Wu1394f032007-05-06 14:50:22 -0700308 .mode = SPI_MODE_3,
309 },
310 {
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800311 .modalias = "fxo-spi",
312 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800313 .bus_num = 0,
314 .chip_select = 8 - CONFIG_J19_JUMPER,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800315 .controller_data = &spi_si3xxx_chip_info,
Bryan Wu1394f032007-05-06 14:50:22 -0700316 .mode = SPI_MODE_3,
317 },
318#endif
319
Michael Hennerich6e668932008-02-09 01:54:09 +0800320#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
321 {
322 .modalias = "spidev",
323 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
324 .bus_num = 0,
325 .chip_select = 1,
326 .controller_data = &spidev_chip_info,
327 },
328#endif
Yi Li2120b682009-07-16 10:12:30 +0000329#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
330 {
331 .modalias = "mmc_spi",
332 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
333 .bus_num = 0,
334 .chip_select = 4,
335 .platform_data = &bfin_mmc_spi_pdata,
336 .controller_data = &mmc_spi_chip_info,
337 .mode = SPI_MODE_3,
338 },
339#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700340};
341
Mike Frysinger5bda2722008-06-07 15:03:01 +0800342#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800343/* SPI (0) */
344static struct resource bfin_spi0_resource[] = {
345 [0] = {
346 .start = SPI0_REGBASE,
347 .end = SPI0_REGBASE + 0xFF,
348 .flags = IORESOURCE_MEM,
349 },
350 [1] = {
351 .start = CH_SPI,
352 .end = CH_SPI,
Yi Li53122692009-06-05 12:11:11 +0000353 .flags = IORESOURCE_DMA,
354 },
355 [2] = {
356 .start = IRQ_SPI,
357 .end = IRQ_SPI,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800358 .flags = IORESOURCE_IRQ,
359 }
360};
361
Bryan Wu1394f032007-05-06 14:50:22 -0700362/* SPI controller data */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800363static struct bfin5xx_spi_master bfin_spi0_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700364 .num_chipselect = 8,
365 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800366 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Bryan Wu1394f032007-05-06 14:50:22 -0700367};
368
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800369static struct platform_device bfin_spi0_device = {
370 .name = "bfin-spi",
371 .id = 0, /* Bus number */
372 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
373 .resource = bfin_spi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -0700374 .dev = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800375 .platform_data = &bfin_spi0_info, /* Passed to driver */
Bryan Wu1394f032007-05-06 14:50:22 -0700376 },
377};
378#endif /* spi master and devices */
379
380#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
381static struct platform_device bfin_fb_device = {
382 .name = "bf537-fb",
383};
384#endif
385
386#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
387static struct resource bfin_uart_resources[] = {
388 {
389 .start = 0xFFC00400,
390 .end = 0xFFC004FF,
391 .flags = IORESOURCE_MEM,
392 },
393};
394
395static struct platform_device bfin_uart_device = {
396 .name = "bfin-uart",
397 .id = 1,
398 .num_resources = ARRAY_SIZE(bfin_uart_resources),
399 .resource = bfin_uart_resources,
400};
401#endif
402
Graf Yang5be36d22008-04-25 03:09:15 +0800403#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang5be36d22008-04-25 03:09:15 +0800404#ifdef CONFIG_BFIN_SIR0
Graf Yang42bd8bc2009-01-07 23:14:39 +0800405static struct resource bfin_sir0_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800406 {
407 .start = 0xFFC00400,
408 .end = 0xFFC004FF,
409 .flags = IORESOURCE_MEM,
410 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800411 {
412 .start = IRQ_UART0_RX,
413 .end = IRQ_UART0_RX+1,
414 .flags = IORESOURCE_IRQ,
415 },
416 {
417 .start = CH_UART0_RX,
418 .end = CH_UART0_RX+1,
419 .flags = IORESOURCE_DMA,
420 },
Graf Yang5be36d22008-04-25 03:09:15 +0800421};
422
Graf Yang42bd8bc2009-01-07 23:14:39 +0800423static struct platform_device bfin_sir0_device = {
Graf Yang5be36d22008-04-25 03:09:15 +0800424 .name = "bfin_sir",
425 .id = 0,
Graf Yang42bd8bc2009-01-07 23:14:39 +0800426 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
427 .resource = bfin_sir0_resources,
Graf Yang5be36d22008-04-25 03:09:15 +0800428};
429#endif
Graf Yang42bd8bc2009-01-07 23:14:39 +0800430#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800431
Bryan Wu1394f032007-05-06 14:50:22 -0700432#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
433static struct platform_device bfin_sport0_uart_device = {
434 .name = "bfin-sport-uart",
435 .id = 0,
436};
437
438static struct platform_device bfin_sport1_uart_device = {
439 .name = "bfin-sport-uart",
440 .id = 1,
441};
442#endif
443
Michael Hennerich2463ef22008-01-27 16:49:48 +0800444#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
445#include <linux/input.h>
446#include <linux/gpio_keys.h>
447
448static struct gpio_keys_button bfin_gpio_keys_table[] = {
Michael Hennerichf1bceb42008-02-02 16:17:52 +0800449 {BTN_0, GPIO_PF5, 0, "gpio-keys: BTN0"},
450 {BTN_1, GPIO_PF6, 0, "gpio-keys: BTN1"},
451 {BTN_2, GPIO_PF8, 0, "gpio-keys: BTN2"},
Michael Hennerich2463ef22008-01-27 16:49:48 +0800452};
453
454static struct gpio_keys_platform_data bfin_gpio_keys_data = {
455 .buttons = bfin_gpio_keys_table,
456 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
457};
458
459static struct platform_device bfin_device_gpiokeys = {
460 .name = "gpio-keys",
461 .dev = {
462 .platform_data = &bfin_gpio_keys_data,
463 },
464};
465#endif
466
Mike Frysingercad2ab62008-02-22 17:01:31 +0800467static struct resource bfin_gpios_resources = {
468 .start = 0,
469 .end = MAX_BLACKFIN_GPIOS - 1,
470 .flags = IORESOURCE_IRQ,
471};
472
473static struct platform_device bfin_gpios_device = {
474 .name = "simple-gpio",
475 .id = -1,
476 .num_resources = 1,
477 .resource = &bfin_gpios_resources,
478};
479
Bryan Wue3163952008-01-24 16:19:15 +0800480#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
481#include <linux/i2c-gpio.h>
482
483static struct i2c_gpio_platform_data i2c_gpio_data = {
484 .sda_pin = 2,
485 .scl_pin = 3,
486 .sda_is_open_drain = 0,
487 .scl_is_open_drain = 0,
488 .udelay = 40,
489};
490
491static struct platform_device i2c_gpio_device = {
492 .name = "i2c-gpio",
493 .id = 0,
494 .dev = {
495 .platform_data = &i2c_gpio_data,
496 },
497};
498#endif
499
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800500static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
501#if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
502 {
503 I2C_BOARD_INFO("ad7142_joystick", 0x2C),
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800504 .irq = 39,
505 },
506#endif
Michael Hennerichebd58332009-07-02 11:00:38 +0000507#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800508 {
509 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800510 },
511#endif
Michael Hennerich204844e2009-06-30 14:57:22 +0000512#if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800513 {
514 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800515 .irq = 39,
516 },
517#endif
518};
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800519
Michael Hennerich14b03202008-05-07 11:41:26 +0800520static const unsigned int cclk_vlev_datasheet[] =
521{
522 VRPAIR(VLEV_085, 250000000),
523 VRPAIR(VLEV_090, 376000000),
524 VRPAIR(VLEV_095, 426000000),
525 VRPAIR(VLEV_100, 426000000),
526 VRPAIR(VLEV_105, 476000000),
527 VRPAIR(VLEV_110, 476000000),
528 VRPAIR(VLEV_115, 476000000),
529 VRPAIR(VLEV_120, 600000000),
530 VRPAIR(VLEV_125, 600000000),
531 VRPAIR(VLEV_130, 600000000),
532};
533
534static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
535 .tuple_tab = cclk_vlev_datasheet,
536 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
537 .vr_settling_time = 25 /* us */,
538};
539
540static struct platform_device bfin_dpmc = {
541 .name = "bfin dpmc",
542 .dev = {
543 .platform_data = &bfin_dmpc_vreg_data,
544 },
545};
546
Bryan Wu1394f032007-05-06 14:50:22 -0700547static struct platform_device *stamp_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +0800548
549 &bfin_dpmc,
550
Bryan Wu1394f032007-05-06 14:50:22 -0700551#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
552 &rtc_device,
553#endif
554
555#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
556 &smc91x_device,
557#endif
558
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800559#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
560 &bfin_fb_adv7393_device,
561#endif
562
Bryan Wu1394f032007-05-06 14:50:22 -0700563#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
564 &net2272_bfin_device,
565#endif
566
567#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800568 &bfin_spi0_device,
Bryan Wu1394f032007-05-06 14:50:22 -0700569#endif
570
571#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
572 &bfin_uart_device,
573#endif
574
Graf Yang5be36d22008-04-25 03:09:15 +0800575#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang42bd8bc2009-01-07 23:14:39 +0800576#ifdef CONFIG_BFIN_SIR0
577 &bfin_sir0_device,
578#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800579#endif
580
Bryan Wu1394f032007-05-06 14:50:22 -0700581#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
582 &bfin_sport0_uart_device,
583 &bfin_sport1_uart_device,
584#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800585
Michael Hennerich2463ef22008-01-27 16:49:48 +0800586#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
587 &bfin_device_gpiokeys,
588#endif
Bryan Wue3163952008-01-24 16:19:15 +0800589
590#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
591 &i2c_gpio_device,
592#endif
Mike Frysingercad2ab62008-02-22 17:01:31 +0800593
594 &bfin_gpios_device,
Mike Frysinger793dc272008-03-26 08:09:12 +0800595
Mike Frysinger9cd9c612008-05-13 12:31:32 +0800596#if defined(CONFIG_MTD_BFIN_ASYNC) || defined(CONFIG_MTD_BFIN_ASYNC_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800597 &stamp_flash_device,
Mike Frysinger793dc272008-03-26 08:09:12 +0800598#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700599};
600
601static int __init stamp_init(void)
602{
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800603 int ret;
604
Harvey Harrisonb85d8582008-04-23 09:39:01 +0800605 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800606
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800607 i2c_register_board_info(0, bfin_i2c_board_info,
608 ARRAY_SIZE(bfin_i2c_board_info));
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800609
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800610 ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
611 if (ret < 0)
612 return ret;
613
614#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800615 /* setup BF533_STAMP CPLD to route AMS3 to Ethernet MAC */
Mike Frysinger9cd9c612008-05-13 12:31:32 +0800616 bfin_write_FIO_DIR(bfin_read_FIO_DIR() | PF0);
617 bfin_write_FIO_FLAG_S(PF0);
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800618 SSYNC();
Bryan Wu1394f032007-05-06 14:50:22 -0700619#endif
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800620
Mike Frysinger5bda2722008-06-07 15:03:01 +0800621 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800622 return 0;
Bryan Wu1394f032007-05-06 14:50:22 -0700623}
624
625arch_initcall(stamp_init);
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800626
627void native_machine_restart(char *cmd)
628{
Mike Frysinger9cd9c612008-05-13 12:31:32 +0800629 /* workaround pull up on cpld / flash pin not being strong enough */
630 bfin_write_FIO_INEN(~PF0);
631 bfin_write_FIO_DIR(PF0);
632 bfin_write_FIO_FLAG_C(PF0);
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800633}