blob: 2683e5f2294f2e1a7c44aa81f9a7fa2c8d73a372 [file] [log] [blame]
Bryan Wu1394f032007-05-06 14:50:22 -07001/*
Robin Getz96f10502009-09-24 14:11:24 +00002 * Copyright 2004-2009 Analog Devices Inc.
3 * 2005 National ICT Australia (NICTA)
4 * Aidan Williams <aidan@nicta.com.au>
Bryan Wu1394f032007-05-06 14:50:22 -07005 *
Robin Getz96f10502009-09-24 14:11:24 +00006 * Licensed under the GPL-2 or later.
Bryan Wu1394f032007-05-06 14:50:22 -07007 */
8
9#include <linux/device.h>
10#include <linux/platform_device.h>
11#include <linux/mtd/mtd.h>
12#include <linux/mtd/partitions.h>
Mike Frysingerde8c43f2008-01-24 17:14:04 +080013#include <linux/mtd/physmap.h>
Bryan Wu1394f032007-05-06 14:50:22 -070014#include <linux/spi/spi.h>
15#include <linux/spi/flash.h>
Yi Li2120b682009-07-16 10:12:30 +000016#include <linux/spi/mmc_spi.h>
Bryan Wu1394f032007-05-06 14:50:22 -070017#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
Mike Frysingerf02bcec2007-11-15 21:29:15 +080018#include <linux/usb/isp1362.h>
Bryan Wu1394f032007-05-06 14:50:22 -070019#endif
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080020#include <linux/irq.h>
Bryan Wu81d9c7f2008-03-26 10:02:13 +080021#include <linux/i2c.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080022#include <asm/dma.h>
Bryan Wu1394f032007-05-06 14:50:22 -070023#include <asm/bfin5xx_spi.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080024#include <asm/reboot.h>
Bryan Wu5d448dd2007-11-12 23:24:42 +080025#include <asm/portmux.h>
Michael Hennerich14b03202008-05-07 11:41:26 +080026#include <asm/dpmc.h>
Bryan Wu1394f032007-05-06 14:50:22 -070027
28/*
29 * Name the Board for the /proc/cpuinfo
30 */
Mike Frysingerfe85cad2008-11-18 17:48:22 +080031const char bfin_board_name[] = "ADI BF533-STAMP";
Bryan Wu1394f032007-05-06 14:50:22 -070032
33#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
34static struct platform_device rtc_device = {
35 .name = "rtc-bfin",
36 .id = -1,
37};
38#endif
39
40/*
41 * Driver needs to know address, irq and flag pin.
42 */
43#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
Michael Hennerich61f09b52009-07-24 08:48:31 +000044#include <linux/smc91x.h>
45
46static struct smc91x_platdata smc91x_info = {
47 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
48 .leda = RPC_LED_100_10,
49 .ledb = RPC_LED_TX_RX,
50};
51
Bryan Wu1394f032007-05-06 14:50:22 -070052static struct resource smc91x_resources[] = {
53 {
54 .name = "smc91x-regs",
55 .start = 0x20300300,
56 .end = 0x20300300 + 16,
57 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080058 }, {
Bryan Wu1394f032007-05-06 14:50:22 -070059 .start = IRQ_PF7,
60 .end = IRQ_PF7,
61 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
62 },
63};
64
65static struct platform_device smc91x_device = {
66 .name = "smc91x",
67 .id = 0,
68 .num_resources = ARRAY_SIZE(smc91x_resources),
69 .resource = smc91x_resources,
Michael Hennerich61f09b52009-07-24 08:48:31 +000070 .dev = {
71 .platform_data = &smc91x_info,
72 },
Bryan Wu1394f032007-05-06 14:50:22 -070073};
74#endif
75
76#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
77static struct resource net2272_bfin_resources[] = {
78 {
79 .start = 0x20300000,
80 .end = 0x20300000 + 0x100,
81 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080082 }, {
Bryan Wu1394f032007-05-06 14:50:22 -070083 .start = IRQ_PF10,
84 .end = IRQ_PF10,
85 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
86 },
87};
88
89static struct platform_device net2272_bfin_device = {
90 .name = "net2272",
91 .id = -1,
92 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
93 .resource = net2272_bfin_resources,
94};
95#endif
96
Mike Frysinger9cd9c612008-05-13 12:31:32 +080097#if defined(CONFIG_MTD_BFIN_ASYNC) || defined(CONFIG_MTD_BFIN_ASYNC_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +080098static struct mtd_partition stamp_partitions[] = {
99 {
Robin Getzaa582972008-08-05 17:47:29 +0800100 .name = "bootloader(nor)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800101 .size = 0x40000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800102 .offset = 0,
103 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800104 .name = "linux kernel(nor)",
Grace Pan6ecb5b62009-01-07 23:14:38 +0800105 .size = 0x180000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800106 .offset = MTDPART_OFS_APPEND,
107 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800108 .name = "file system(nor)",
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800109 .size = MTDPART_SIZ_FULL,
110 .offset = MTDPART_OFS_APPEND,
111 }
112};
113
114static struct physmap_flash_data stamp_flash_data = {
115 .width = 2,
116 .parts = stamp_partitions,
117 .nr_parts = ARRAY_SIZE(stamp_partitions),
118};
119
120static struct resource stamp_flash_resource[] = {
121 {
122 .name = "cfi_probe",
123 .start = 0x20000000,
124 .end = 0x203fffff,
125 .flags = IORESOURCE_MEM,
126 }, {
Mike Frysinger9cd9c612008-05-13 12:31:32 +0800127 .start = 0x7BB07BB0, /* AMBCTL0 setting when accessing flash */
128 .end = 0x7BB07BB0, /* AMBCTL1 setting when accessing flash */
129 .flags = IORESOURCE_MEM,
130 }, {
131 .start = GPIO_PF0,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800132 .flags = IORESOURCE_IRQ,
133 }
134};
135
136static struct platform_device stamp_flash_device = {
Mike Frysinger9cd9c612008-05-13 12:31:32 +0800137 .name = "bfin-async-flash",
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800138 .id = 0,
139 .dev = {
140 .platform_data = &stamp_flash_data,
141 },
142 .num_resources = ARRAY_SIZE(stamp_flash_resource),
143 .resource = stamp_flash_resource,
144};
Mike Frysinger793dc272008-03-26 08:09:12 +0800145#endif
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800146
Bryan Wu1394f032007-05-06 14:50:22 -0700147#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
148static struct mtd_partition bfin_spi_flash_partitions[] = {
149 {
Robin Getzaa582972008-08-05 17:47:29 +0800150 .name = "bootloader(spi)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800151 .size = 0x00040000,
Bryan Wu1394f032007-05-06 14:50:22 -0700152 .offset = 0,
153 .mask_flags = MTD_CAP_ROM
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800154 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800155 .name = "linux kernel(spi)",
Grace Pan6ecb5b62009-01-07 23:14:38 +0800156 .size = 0x180000,
Mike Frysingeredf05642008-02-25 11:38:11 +0800157 .offset = MTDPART_OFS_APPEND,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800158 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800159 .name = "file system(spi)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800160 .size = MTDPART_SIZ_FULL,
161 .offset = MTDPART_OFS_APPEND,
Bryan Wu1394f032007-05-06 14:50:22 -0700162 }
163};
164
165static struct flash_platform_data bfin_spi_flash_data = {
166 .name = "m25p80",
167 .parts = bfin_spi_flash_partitions,
168 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
169 .type = "m25p64",
170};
171
172/* SPI flash chip (m25p64) */
173static struct bfin5xx_spi_chip spi_flash_chip_info = {
174 .enable_dma = 0, /* use dma transfer with this chip*/
175 .bits_per_word = 8,
176};
177#endif
178
Mike Frysingera261eec2009-05-20 14:05:36 +0000179#if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
Bryan Wu1394f032007-05-06 14:50:22 -0700180/* SPI ADC chip */
181static struct bfin5xx_spi_chip spi_adc_chip_info = {
182 .enable_dma = 1, /* use dma transfer with this chip*/
183 .bits_per_word = 16,
184};
185#endif
186
187#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
188static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
189 .enable_dma = 0,
190 .bits_per_word = 16,
191};
192#endif
193
Michael Hennerich6e668932008-02-09 01:54:09 +0800194#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
195static struct bfin5xx_spi_chip spidev_chip_info = {
196 .enable_dma = 0,
197 .bits_per_word = 8,
198};
199#endif
200
Yi Li2120b682009-07-16 10:12:30 +0000201#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
202#define MMC_SPI_CARD_DETECT_INT IRQ_PF5
203static int bfin_mmc_spi_init(struct device *dev,
204 irqreturn_t (*detect_int)(int, void *), void *data)
205{
206 return request_irq(MMC_SPI_CARD_DETECT_INT, detect_int,
207 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
208 "mmc-spi-detect", data);
209}
210
211static void bfin_mmc_spi_exit(struct device *dev, void *data)
212{
213 free_irq(MMC_SPI_CARD_DETECT_INT, data);
214}
215
216static struct mmc_spi_platform_data bfin_mmc_spi_pdata = {
217 .init = bfin_mmc_spi_init,
218 .exit = bfin_mmc_spi_exit,
219 .detect_delay = 100, /* msecs */
220};
221
222static struct bfin5xx_spi_chip mmc_spi_chip_info = {
223 .enable_dma = 0,
224 .bits_per_word = 8,
225 .pio_interrupt = 0,
226};
227#endif
228
Bryan Wu1394f032007-05-06 14:50:22 -0700229static struct spi_board_info bfin_spi_board_info[] __initdata = {
230#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
231 {
232 /* the modalias must be the same as spi device driver name */
233 .modalias = "m25p80", /* Name of spi_driver for this device */
234 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800235 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700236 .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
237 .platform_data = &bfin_spi_flash_data,
238 .controller_data = &spi_flash_chip_info,
239 .mode = SPI_MODE_3,
240 },
241#endif
242
Mike Frysingera261eec2009-05-20 14:05:36 +0000243#if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
Bryan Wu1394f032007-05-06 14:50:22 -0700244 {
245 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
246 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800247 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700248 .chip_select = 1, /* Framework chip select. */
249 .platform_data = NULL, /* No spi_driver specific config */
250 .controller_data = &spi_adc_chip_info,
251 },
252#endif
253
254#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
255 {
Barry Songdac98172009-08-13 21:07:37 +0000256 .modalias = "ad1836",
Cliff Cai858c5e92009-07-22 06:34:55 +0000257 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800258 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700259 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
260 .controller_data = &ad1836_spi_chip_info,
261 },
262#endif
263
Michael Hennerich6e668932008-02-09 01:54:09 +0800264#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
265 {
266 .modalias = "spidev",
267 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
268 .bus_num = 0,
269 .chip_select = 1,
270 .controller_data = &spidev_chip_info,
271 },
272#endif
Yi Li2120b682009-07-16 10:12:30 +0000273#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
274 {
275 .modalias = "mmc_spi",
276 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
277 .bus_num = 0,
278 .chip_select = 4,
279 .platform_data = &bfin_mmc_spi_pdata,
280 .controller_data = &mmc_spi_chip_info,
281 .mode = SPI_MODE_3,
282 },
283#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700284};
285
Mike Frysinger5bda2722008-06-07 15:03:01 +0800286#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800287/* SPI (0) */
288static struct resource bfin_spi0_resource[] = {
289 [0] = {
290 .start = SPI0_REGBASE,
291 .end = SPI0_REGBASE + 0xFF,
292 .flags = IORESOURCE_MEM,
293 },
294 [1] = {
295 .start = CH_SPI,
296 .end = CH_SPI,
Yi Li53122692009-06-05 12:11:11 +0000297 .flags = IORESOURCE_DMA,
298 },
299 [2] = {
300 .start = IRQ_SPI,
301 .end = IRQ_SPI,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800302 .flags = IORESOURCE_IRQ,
303 }
304};
305
Bryan Wu1394f032007-05-06 14:50:22 -0700306/* SPI controller data */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800307static struct bfin5xx_spi_master bfin_spi0_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700308 .num_chipselect = 8,
309 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800310 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Bryan Wu1394f032007-05-06 14:50:22 -0700311};
312
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800313static struct platform_device bfin_spi0_device = {
314 .name = "bfin-spi",
315 .id = 0, /* Bus number */
316 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
317 .resource = bfin_spi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -0700318 .dev = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800319 .platform_data = &bfin_spi0_info, /* Passed to driver */
Bryan Wu1394f032007-05-06 14:50:22 -0700320 },
321};
322#endif /* spi master and devices */
323
Bryan Wu1394f032007-05-06 14:50:22 -0700324#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000325#ifdef CONFIG_SERIAL_BFIN_UART0
326static struct resource bfin_uart0_resources[] = {
Bryan Wu1394f032007-05-06 14:50:22 -0700327 {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000328 .start = BFIN_UART_THR,
329 .end = BFIN_UART_GCTL+2,
Bryan Wu1394f032007-05-06 14:50:22 -0700330 .flags = IORESOURCE_MEM,
331 },
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000332 {
333 .start = IRQ_UART0_RX,
334 .end = IRQ_UART0_RX + 1,
335 .flags = IORESOURCE_IRQ,
336 },
337 {
338 .start = IRQ_UART0_ERROR,
339 .end = IRQ_UART0_ERROR,
340 .flags = IORESOURCE_IRQ,
341 },
342 {
343 .start = CH_UART0_TX,
344 .end = CH_UART0_TX,
345 .flags = IORESOURCE_DMA,
346 },
347 {
348 .start = CH_UART0_RX,
349 .end = CH_UART0_RX,
350 .flags = IORESOURCE_DMA,
351 },
Bryan Wu1394f032007-05-06 14:50:22 -0700352};
353
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000354unsigned short bfin_uart0_peripherals[] = {
355 P_UART0_TX, P_UART0_RX, 0
Bryan Wu1394f032007-05-06 14:50:22 -0700356};
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000357
358static struct platform_device bfin_uart0_device = {
359 .name = "bfin-uart",
360 .id = 0,
361 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
362 .resource = bfin_uart0_resources,
363 .dev = {
364 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
365 },
366};
367#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700368#endif
369
Graf Yang5be36d22008-04-25 03:09:15 +0800370#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang5be36d22008-04-25 03:09:15 +0800371#ifdef CONFIG_BFIN_SIR0
Graf Yang42bd8bc2009-01-07 23:14:39 +0800372static struct resource bfin_sir0_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800373 {
374 .start = 0xFFC00400,
375 .end = 0xFFC004FF,
376 .flags = IORESOURCE_MEM,
377 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800378 {
379 .start = IRQ_UART0_RX,
380 .end = IRQ_UART0_RX+1,
381 .flags = IORESOURCE_IRQ,
382 },
383 {
384 .start = CH_UART0_RX,
385 .end = CH_UART0_RX+1,
386 .flags = IORESOURCE_DMA,
387 },
Graf Yang5be36d22008-04-25 03:09:15 +0800388};
389
Graf Yang42bd8bc2009-01-07 23:14:39 +0800390static struct platform_device bfin_sir0_device = {
Graf Yang5be36d22008-04-25 03:09:15 +0800391 .name = "bfin_sir",
392 .id = 0,
Graf Yang42bd8bc2009-01-07 23:14:39 +0800393 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
394 .resource = bfin_sir0_resources,
Graf Yang5be36d22008-04-25 03:09:15 +0800395};
396#endif
Graf Yang42bd8bc2009-01-07 23:14:39 +0800397#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800398
Bryan Wu1394f032007-05-06 14:50:22 -0700399#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
400static struct platform_device bfin_sport0_uart_device = {
401 .name = "bfin-sport-uart",
402 .id = 0,
403};
404
405static struct platform_device bfin_sport1_uart_device = {
406 .name = "bfin-sport-uart",
407 .id = 1,
408};
409#endif
410
Michael Hennerich2463ef22008-01-27 16:49:48 +0800411#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
412#include <linux/input.h>
413#include <linux/gpio_keys.h>
414
415static struct gpio_keys_button bfin_gpio_keys_table[] = {
Michael Hennerichf1bceb42008-02-02 16:17:52 +0800416 {BTN_0, GPIO_PF5, 0, "gpio-keys: BTN0"},
417 {BTN_1, GPIO_PF6, 0, "gpio-keys: BTN1"},
418 {BTN_2, GPIO_PF8, 0, "gpio-keys: BTN2"},
Michael Hennerich2463ef22008-01-27 16:49:48 +0800419};
420
421static struct gpio_keys_platform_data bfin_gpio_keys_data = {
422 .buttons = bfin_gpio_keys_table,
423 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
424};
425
426static struct platform_device bfin_device_gpiokeys = {
427 .name = "gpio-keys",
428 .dev = {
429 .platform_data = &bfin_gpio_keys_data,
430 },
431};
432#endif
433
Bryan Wue3163952008-01-24 16:19:15 +0800434#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
435#include <linux/i2c-gpio.h>
436
437static struct i2c_gpio_platform_data i2c_gpio_data = {
438 .sda_pin = 2,
439 .scl_pin = 3,
440 .sda_is_open_drain = 0,
441 .scl_is_open_drain = 0,
442 .udelay = 40,
443};
444
445static struct platform_device i2c_gpio_device = {
446 .name = "i2c-gpio",
447 .id = 0,
448 .dev = {
449 .platform_data = &i2c_gpio_data,
450 },
451};
452#endif
453
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800454static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
455#if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
456 {
457 I2C_BOARD_INFO("ad7142_joystick", 0x2C),
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800458 .irq = 39,
459 },
460#endif
Michael Hennerichebd58332009-07-02 11:00:38 +0000461#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800462 {
463 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800464 },
465#endif
Michael Hennerich204844e2009-06-30 14:57:22 +0000466#if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800467 {
468 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800469 .irq = 39,
470 },
471#endif
Michael Hennerich50c4c082009-09-22 13:10:09 +0000472#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
473 {
474 I2C_BOARD_INFO("bfin-adv7393", 0x2B),
475 },
476#endif
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800477};
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800478
Michael Hennerich14b03202008-05-07 11:41:26 +0800479static const unsigned int cclk_vlev_datasheet[] =
480{
481 VRPAIR(VLEV_085, 250000000),
482 VRPAIR(VLEV_090, 376000000),
483 VRPAIR(VLEV_095, 426000000),
484 VRPAIR(VLEV_100, 426000000),
485 VRPAIR(VLEV_105, 476000000),
486 VRPAIR(VLEV_110, 476000000),
487 VRPAIR(VLEV_115, 476000000),
488 VRPAIR(VLEV_120, 600000000),
489 VRPAIR(VLEV_125, 600000000),
490 VRPAIR(VLEV_130, 600000000),
491};
492
493static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
494 .tuple_tab = cclk_vlev_datasheet,
495 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
496 .vr_settling_time = 25 /* us */,
497};
498
499static struct platform_device bfin_dpmc = {
500 .name = "bfin dpmc",
501 .dev = {
502 .platform_data = &bfin_dmpc_vreg_data,
503 },
504};
505
Bryan Wu1394f032007-05-06 14:50:22 -0700506static struct platform_device *stamp_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +0800507
508 &bfin_dpmc,
509
Bryan Wu1394f032007-05-06 14:50:22 -0700510#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
511 &rtc_device,
512#endif
513
514#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
515 &smc91x_device,
516#endif
517
518#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
519 &net2272_bfin_device,
520#endif
521
522#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800523 &bfin_spi0_device,
Bryan Wu1394f032007-05-06 14:50:22 -0700524#endif
525
526#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000527#ifdef CONFIG_SERIAL_BFIN_UART0
528 &bfin_uart0_device,
529#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700530#endif
531
Graf Yang5be36d22008-04-25 03:09:15 +0800532#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang42bd8bc2009-01-07 23:14:39 +0800533#ifdef CONFIG_BFIN_SIR0
534 &bfin_sir0_device,
535#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800536#endif
537
Bryan Wu1394f032007-05-06 14:50:22 -0700538#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
539 &bfin_sport0_uart_device,
540 &bfin_sport1_uart_device,
541#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800542
Michael Hennerich2463ef22008-01-27 16:49:48 +0800543#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
544 &bfin_device_gpiokeys,
545#endif
Bryan Wue3163952008-01-24 16:19:15 +0800546
547#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
548 &i2c_gpio_device,
549#endif
Mike Frysingercad2ab62008-02-22 17:01:31 +0800550
Mike Frysinger9cd9c612008-05-13 12:31:32 +0800551#if defined(CONFIG_MTD_BFIN_ASYNC) || defined(CONFIG_MTD_BFIN_ASYNC_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800552 &stamp_flash_device,
Mike Frysinger793dc272008-03-26 08:09:12 +0800553#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700554};
555
556static int __init stamp_init(void)
557{
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800558 int ret;
559
Harvey Harrisonb85d8582008-04-23 09:39:01 +0800560 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800561
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800562 i2c_register_board_info(0, bfin_i2c_board_info,
563 ARRAY_SIZE(bfin_i2c_board_info));
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800564
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800565 ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
566 if (ret < 0)
567 return ret;
568
569#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800570 /* setup BF533_STAMP CPLD to route AMS3 to Ethernet MAC */
Mike Frysinger9cd9c612008-05-13 12:31:32 +0800571 bfin_write_FIO_DIR(bfin_read_FIO_DIR() | PF0);
572 bfin_write_FIO_FLAG_S(PF0);
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800573 SSYNC();
Bryan Wu1394f032007-05-06 14:50:22 -0700574#endif
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800575
Mike Frysinger5bda2722008-06-07 15:03:01 +0800576 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800577 return 0;
Bryan Wu1394f032007-05-06 14:50:22 -0700578}
579
580arch_initcall(stamp_init);
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800581
582void native_machine_restart(char *cmd)
583{
Mike Frysinger9cd9c612008-05-13 12:31:32 +0800584 /* workaround pull up on cpld / flash pin not being strong enough */
585 bfin_write_FIO_INEN(~PF0);
586 bfin_write_FIO_DIR(PF0);
587 bfin_write_FIO_FLAG_C(PF0);
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800588}