blob: 7a7b656216c3ad27c16eeb0f144ad7ee92209cda [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)
66static struct resource smc91x_resources[] = {
67 {
68 .name = "smc91x-regs",
69 .start = 0x20300300,
70 .end = 0x20300300 + 16,
71 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080072 }, {
Bryan Wu1394f032007-05-06 14:50:22 -070073 .start = IRQ_PF7,
74 .end = IRQ_PF7,
75 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
76 },
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
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080087#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
88static struct platform_device bfin_fb_adv7393_device = {
89 .name = "bfin-adv7393",
90};
91#endif
92
Bryan Wu1394f032007-05-06 14:50:22 -070093#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
94static struct resource net2272_bfin_resources[] = {
95 {
96 .start = 0x20300000,
97 .end = 0x20300000 + 0x100,
98 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080099 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700100 .start = IRQ_PF10,
101 .end = IRQ_PF10,
102 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
103 },
104};
105
106static struct platform_device net2272_bfin_device = {
107 .name = "net2272",
108 .id = -1,
109 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
110 .resource = net2272_bfin_resources,
111};
112#endif
113
Mike Frysinger9cd9c612008-05-13 12:31:32 +0800114#if defined(CONFIG_MTD_BFIN_ASYNC) || defined(CONFIG_MTD_BFIN_ASYNC_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800115static struct mtd_partition stamp_partitions[] = {
116 {
Robin Getzaa582972008-08-05 17:47:29 +0800117 .name = "bootloader(nor)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800118 .size = 0x40000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800119 .offset = 0,
120 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800121 .name = "linux kernel(nor)",
Grace Pan6ecb5b62009-01-07 23:14:38 +0800122 .size = 0x180000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800123 .offset = MTDPART_OFS_APPEND,
124 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800125 .name = "file system(nor)",
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800126 .size = MTDPART_SIZ_FULL,
127 .offset = MTDPART_OFS_APPEND,
128 }
129};
130
131static struct physmap_flash_data stamp_flash_data = {
132 .width = 2,
133 .parts = stamp_partitions,
134 .nr_parts = ARRAY_SIZE(stamp_partitions),
135};
136
137static struct resource stamp_flash_resource[] = {
138 {
139 .name = "cfi_probe",
140 .start = 0x20000000,
141 .end = 0x203fffff,
142 .flags = IORESOURCE_MEM,
143 }, {
Mike Frysinger9cd9c612008-05-13 12:31:32 +0800144 .start = 0x7BB07BB0, /* AMBCTL0 setting when accessing flash */
145 .end = 0x7BB07BB0, /* AMBCTL1 setting when accessing flash */
146 .flags = IORESOURCE_MEM,
147 }, {
148 .start = GPIO_PF0,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800149 .flags = IORESOURCE_IRQ,
150 }
151};
152
153static struct platform_device stamp_flash_device = {
Mike Frysinger9cd9c612008-05-13 12:31:32 +0800154 .name = "bfin-async-flash",
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800155 .id = 0,
156 .dev = {
157 .platform_data = &stamp_flash_data,
158 },
159 .num_resources = ARRAY_SIZE(stamp_flash_resource),
160 .resource = stamp_flash_resource,
161};
Mike Frysinger793dc272008-03-26 08:09:12 +0800162#endif
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800163
Bryan Wu1394f032007-05-06 14:50:22 -0700164#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
165static struct mtd_partition bfin_spi_flash_partitions[] = {
166 {
Robin Getzaa582972008-08-05 17:47:29 +0800167 .name = "bootloader(spi)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800168 .size = 0x00040000,
Bryan Wu1394f032007-05-06 14:50:22 -0700169 .offset = 0,
170 .mask_flags = MTD_CAP_ROM
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800171 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800172 .name = "linux kernel(spi)",
Grace Pan6ecb5b62009-01-07 23:14:38 +0800173 .size = 0x180000,
Mike Frysingeredf05642008-02-25 11:38:11 +0800174 .offset = MTDPART_OFS_APPEND,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800175 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800176 .name = "file system(spi)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800177 .size = MTDPART_SIZ_FULL,
178 .offset = MTDPART_OFS_APPEND,
Bryan Wu1394f032007-05-06 14:50:22 -0700179 }
180};
181
182static struct flash_platform_data bfin_spi_flash_data = {
183 .name = "m25p80",
184 .parts = bfin_spi_flash_partitions,
185 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
186 .type = "m25p64",
187};
188
189/* SPI flash chip (m25p64) */
190static struct bfin5xx_spi_chip spi_flash_chip_info = {
191 .enable_dma = 0, /* use dma transfer with this chip*/
192 .bits_per_word = 8,
193};
194#endif
195
Mike Frysingera261eec2009-05-20 14:05:36 +0000196#if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
Bryan Wu1394f032007-05-06 14:50:22 -0700197/* SPI ADC chip */
198static struct bfin5xx_spi_chip spi_adc_chip_info = {
199 .enable_dma = 1, /* use dma transfer with this chip*/
200 .bits_per_word = 16,
201};
202#endif
203
204#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
205static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
206 .enable_dma = 0,
207 .bits_per_word = 16,
208};
209#endif
210
211#if defined(CONFIG_PBX)
212static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
213 .ctl_reg = 0x4, /* send zero */
214 .enable_dma = 0,
215 .bits_per_word = 8,
216 .cs_change_per_word = 1,
217};
218#endif
219
Michael Hennerich6e668932008-02-09 01:54:09 +0800220#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
221static struct bfin5xx_spi_chip spidev_chip_info = {
222 .enable_dma = 0,
223 .bits_per_word = 8,
224};
225#endif
226
Yi Li2120b682009-07-16 10:12:30 +0000227#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
228#define MMC_SPI_CARD_DETECT_INT IRQ_PF5
229static int bfin_mmc_spi_init(struct device *dev,
230 irqreturn_t (*detect_int)(int, void *), void *data)
231{
232 return request_irq(MMC_SPI_CARD_DETECT_INT, detect_int,
233 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
234 "mmc-spi-detect", data);
235}
236
237static void bfin_mmc_spi_exit(struct device *dev, void *data)
238{
239 free_irq(MMC_SPI_CARD_DETECT_INT, data);
240}
241
242static struct mmc_spi_platform_data bfin_mmc_spi_pdata = {
243 .init = bfin_mmc_spi_init,
244 .exit = bfin_mmc_spi_exit,
245 .detect_delay = 100, /* msecs */
246};
247
248static struct bfin5xx_spi_chip mmc_spi_chip_info = {
249 .enable_dma = 0,
250 .bits_per_word = 8,
251 .pio_interrupt = 0,
252};
253#endif
254
Bryan Wu1394f032007-05-06 14:50:22 -0700255static struct spi_board_info bfin_spi_board_info[] __initdata = {
256#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
257 {
258 /* the modalias must be the same as spi device driver name */
259 .modalias = "m25p80", /* Name of spi_driver for this device */
260 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800261 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700262 .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
263 .platform_data = &bfin_spi_flash_data,
264 .controller_data = &spi_flash_chip_info,
265 .mode = SPI_MODE_3,
266 },
267#endif
268
Mike Frysingera261eec2009-05-20 14:05:36 +0000269#if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
Bryan Wu1394f032007-05-06 14:50:22 -0700270 {
271 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
272 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800273 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700274 .chip_select = 1, /* Framework chip select. */
275 .platform_data = NULL, /* No spi_driver specific config */
276 .controller_data = &spi_adc_chip_info,
277 },
278#endif
279
280#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
281 {
282 .modalias = "ad1836-spi",
Cliff Cai858c5e92009-07-22 06:34:55 +0000283 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800284 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700285 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
286 .controller_data = &ad1836_spi_chip_info,
287 },
288#endif
289
Bryan Wu1394f032007-05-06 14:50:22 -0700290#if defined(CONFIG_PBX)
291 {
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800292 .modalias = "fxs-spi",
293 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800294 .bus_num = 0,
295 .chip_select = 8 - CONFIG_J11_JUMPER,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800296 .controller_data = &spi_si3xxx_chip_info,
Bryan Wu1394f032007-05-06 14:50:22 -0700297 .mode = SPI_MODE_3,
298 },
299 {
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800300 .modalias = "fxo-spi",
301 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800302 .bus_num = 0,
303 .chip_select = 8 - CONFIG_J19_JUMPER,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800304 .controller_data = &spi_si3xxx_chip_info,
Bryan Wu1394f032007-05-06 14:50:22 -0700305 .mode = SPI_MODE_3,
306 },
307#endif
308
Michael Hennerich6e668932008-02-09 01:54:09 +0800309#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
310 {
311 .modalias = "spidev",
312 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
313 .bus_num = 0,
314 .chip_select = 1,
315 .controller_data = &spidev_chip_info,
316 },
317#endif
Yi Li2120b682009-07-16 10:12:30 +0000318#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
319 {
320 .modalias = "mmc_spi",
321 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
322 .bus_num = 0,
323 .chip_select = 4,
324 .platform_data = &bfin_mmc_spi_pdata,
325 .controller_data = &mmc_spi_chip_info,
326 .mode = SPI_MODE_3,
327 },
328#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700329};
330
Mike Frysinger5bda2722008-06-07 15:03:01 +0800331#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800332/* SPI (0) */
333static struct resource bfin_spi0_resource[] = {
334 [0] = {
335 .start = SPI0_REGBASE,
336 .end = SPI0_REGBASE + 0xFF,
337 .flags = IORESOURCE_MEM,
338 },
339 [1] = {
340 .start = CH_SPI,
341 .end = CH_SPI,
Yi Li53122692009-06-05 12:11:11 +0000342 .flags = IORESOURCE_DMA,
343 },
344 [2] = {
345 .start = IRQ_SPI,
346 .end = IRQ_SPI,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800347 .flags = IORESOURCE_IRQ,
348 }
349};
350
Bryan Wu1394f032007-05-06 14:50:22 -0700351/* SPI controller data */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800352static struct bfin5xx_spi_master bfin_spi0_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700353 .num_chipselect = 8,
354 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800355 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Bryan Wu1394f032007-05-06 14:50:22 -0700356};
357
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800358static struct platform_device bfin_spi0_device = {
359 .name = "bfin-spi",
360 .id = 0, /* Bus number */
361 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
362 .resource = bfin_spi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -0700363 .dev = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800364 .platform_data = &bfin_spi0_info, /* Passed to driver */
Bryan Wu1394f032007-05-06 14:50:22 -0700365 },
366};
367#endif /* spi master and devices */
368
369#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
370static struct platform_device bfin_fb_device = {
371 .name = "bf537-fb",
372};
373#endif
374
375#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
376static struct resource bfin_uart_resources[] = {
377 {
378 .start = 0xFFC00400,
379 .end = 0xFFC004FF,
380 .flags = IORESOURCE_MEM,
381 },
382};
383
384static struct platform_device bfin_uart_device = {
385 .name = "bfin-uart",
386 .id = 1,
387 .num_resources = ARRAY_SIZE(bfin_uart_resources),
388 .resource = bfin_uart_resources,
389};
390#endif
391
Graf Yang5be36d22008-04-25 03:09:15 +0800392#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang5be36d22008-04-25 03:09:15 +0800393#ifdef CONFIG_BFIN_SIR0
Graf Yang42bd8bc2009-01-07 23:14:39 +0800394static struct resource bfin_sir0_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800395 {
396 .start = 0xFFC00400,
397 .end = 0xFFC004FF,
398 .flags = IORESOURCE_MEM,
399 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800400 {
401 .start = IRQ_UART0_RX,
402 .end = IRQ_UART0_RX+1,
403 .flags = IORESOURCE_IRQ,
404 },
405 {
406 .start = CH_UART0_RX,
407 .end = CH_UART0_RX+1,
408 .flags = IORESOURCE_DMA,
409 },
Graf Yang5be36d22008-04-25 03:09:15 +0800410};
411
Graf Yang42bd8bc2009-01-07 23:14:39 +0800412static struct platform_device bfin_sir0_device = {
Graf Yang5be36d22008-04-25 03:09:15 +0800413 .name = "bfin_sir",
414 .id = 0,
Graf Yang42bd8bc2009-01-07 23:14:39 +0800415 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
416 .resource = bfin_sir0_resources,
Graf Yang5be36d22008-04-25 03:09:15 +0800417};
418#endif
Graf Yang42bd8bc2009-01-07 23:14:39 +0800419#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800420
Bryan Wu1394f032007-05-06 14:50:22 -0700421#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
422static struct platform_device bfin_sport0_uart_device = {
423 .name = "bfin-sport-uart",
424 .id = 0,
425};
426
427static struct platform_device bfin_sport1_uart_device = {
428 .name = "bfin-sport-uart",
429 .id = 1,
430};
431#endif
432
Michael Hennerich2463ef22008-01-27 16:49:48 +0800433#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
434#include <linux/input.h>
435#include <linux/gpio_keys.h>
436
437static struct gpio_keys_button bfin_gpio_keys_table[] = {
Michael Hennerichf1bceb42008-02-02 16:17:52 +0800438 {BTN_0, GPIO_PF5, 0, "gpio-keys: BTN0"},
439 {BTN_1, GPIO_PF6, 0, "gpio-keys: BTN1"},
440 {BTN_2, GPIO_PF8, 0, "gpio-keys: BTN2"},
Michael Hennerich2463ef22008-01-27 16:49:48 +0800441};
442
443static struct gpio_keys_platform_data bfin_gpio_keys_data = {
444 .buttons = bfin_gpio_keys_table,
445 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
446};
447
448static struct platform_device bfin_device_gpiokeys = {
449 .name = "gpio-keys",
450 .dev = {
451 .platform_data = &bfin_gpio_keys_data,
452 },
453};
454#endif
455
Mike Frysingercad2ab62008-02-22 17:01:31 +0800456static struct resource bfin_gpios_resources = {
457 .start = 0,
458 .end = MAX_BLACKFIN_GPIOS - 1,
459 .flags = IORESOURCE_IRQ,
460};
461
462static struct platform_device bfin_gpios_device = {
463 .name = "simple-gpio",
464 .id = -1,
465 .num_resources = 1,
466 .resource = &bfin_gpios_resources,
467};
468
Bryan Wue3163952008-01-24 16:19:15 +0800469#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
470#include <linux/i2c-gpio.h>
471
472static struct i2c_gpio_platform_data i2c_gpio_data = {
473 .sda_pin = 2,
474 .scl_pin = 3,
475 .sda_is_open_drain = 0,
476 .scl_is_open_drain = 0,
477 .udelay = 40,
478};
479
480static struct platform_device i2c_gpio_device = {
481 .name = "i2c-gpio",
482 .id = 0,
483 .dev = {
484 .platform_data = &i2c_gpio_data,
485 },
486};
487#endif
488
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800489static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
490#if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
491 {
492 I2C_BOARD_INFO("ad7142_joystick", 0x2C),
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800493 .irq = 39,
494 },
495#endif
Michael Hennerichebd58332009-07-02 11:00:38 +0000496#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800497 {
498 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800499 },
500#endif
Michael Hennerich204844e2009-06-30 14:57:22 +0000501#if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800502 {
503 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800504 .irq = 39,
505 },
506#endif
507};
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800508
Michael Hennerich14b03202008-05-07 11:41:26 +0800509static const unsigned int cclk_vlev_datasheet[] =
510{
511 VRPAIR(VLEV_085, 250000000),
512 VRPAIR(VLEV_090, 376000000),
513 VRPAIR(VLEV_095, 426000000),
514 VRPAIR(VLEV_100, 426000000),
515 VRPAIR(VLEV_105, 476000000),
516 VRPAIR(VLEV_110, 476000000),
517 VRPAIR(VLEV_115, 476000000),
518 VRPAIR(VLEV_120, 600000000),
519 VRPAIR(VLEV_125, 600000000),
520 VRPAIR(VLEV_130, 600000000),
521};
522
523static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
524 .tuple_tab = cclk_vlev_datasheet,
525 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
526 .vr_settling_time = 25 /* us */,
527};
528
529static struct platform_device bfin_dpmc = {
530 .name = "bfin dpmc",
531 .dev = {
532 .platform_data = &bfin_dmpc_vreg_data,
533 },
534};
535
Bryan Wu1394f032007-05-06 14:50:22 -0700536static struct platform_device *stamp_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +0800537
538 &bfin_dpmc,
539
Bryan Wu1394f032007-05-06 14:50:22 -0700540#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
541 &rtc_device,
542#endif
543
544#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
545 &smc91x_device,
546#endif
547
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800548#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
549 &bfin_fb_adv7393_device,
550#endif
551
Bryan Wu1394f032007-05-06 14:50:22 -0700552#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
553 &net2272_bfin_device,
554#endif
555
556#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800557 &bfin_spi0_device,
Bryan Wu1394f032007-05-06 14:50:22 -0700558#endif
559
560#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
561 &bfin_uart_device,
562#endif
563
Graf Yang5be36d22008-04-25 03:09:15 +0800564#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang42bd8bc2009-01-07 23:14:39 +0800565#ifdef CONFIG_BFIN_SIR0
566 &bfin_sir0_device,
567#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800568#endif
569
Bryan Wu1394f032007-05-06 14:50:22 -0700570#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
571 &bfin_sport0_uart_device,
572 &bfin_sport1_uart_device,
573#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800574
Michael Hennerich2463ef22008-01-27 16:49:48 +0800575#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
576 &bfin_device_gpiokeys,
577#endif
Bryan Wue3163952008-01-24 16:19:15 +0800578
579#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
580 &i2c_gpio_device,
581#endif
Mike Frysingercad2ab62008-02-22 17:01:31 +0800582
583 &bfin_gpios_device,
Mike Frysinger793dc272008-03-26 08:09:12 +0800584
Mike Frysinger9cd9c612008-05-13 12:31:32 +0800585#if defined(CONFIG_MTD_BFIN_ASYNC) || defined(CONFIG_MTD_BFIN_ASYNC_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800586 &stamp_flash_device,
Mike Frysinger793dc272008-03-26 08:09:12 +0800587#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700588};
589
590static int __init stamp_init(void)
591{
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800592 int ret;
593
Harvey Harrisonb85d8582008-04-23 09:39:01 +0800594 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800595
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800596 i2c_register_board_info(0, bfin_i2c_board_info,
597 ARRAY_SIZE(bfin_i2c_board_info));
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800598
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800599 ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
600 if (ret < 0)
601 return ret;
602
603#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800604 /* setup BF533_STAMP CPLD to route AMS3 to Ethernet MAC */
Mike Frysinger9cd9c612008-05-13 12:31:32 +0800605 bfin_write_FIO_DIR(bfin_read_FIO_DIR() | PF0);
606 bfin_write_FIO_FLAG_S(PF0);
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800607 SSYNC();
Bryan Wu1394f032007-05-06 14:50:22 -0700608#endif
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800609
Mike Frysinger5bda2722008-06-07 15:03:01 +0800610 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800611 return 0;
Bryan Wu1394f032007-05-06 14:50:22 -0700612}
613
614arch_initcall(stamp_init);
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800615
616void native_machine_restart(char *cmd)
617{
Mike Frysinger9cd9c612008-05-13 12:31:32 +0800618 /* workaround pull up on cpld / flash pin not being strong enough */
619 bfin_write_FIO_INEN(~PF0);
620 bfin_write_FIO_DIR(PF0);
621 bfin_write_FIO_FLAG_C(PF0);
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800622}