blob: 3d743ccaff6ab8d4b543b091f72833b8c8f73a21 [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>
38#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
Mike Frysingerf02bcec2007-11-15 21:29:15 +080039#include <linux/usb/isp1362.h>
Bryan Wu1394f032007-05-06 14:50:22 -070040#endif
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080041#include <linux/irq.h>
Bryan Wu81d9c7f2008-03-26 10:02:13 +080042#include <linux/i2c.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080043#include <asm/dma.h>
Bryan Wu1394f032007-05-06 14:50:22 -070044#include <asm/bfin5xx_spi.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080045#include <asm/reboot.h>
Bryan Wu5d448dd2007-11-12 23:24:42 +080046#include <asm/portmux.h>
Michael Hennerich14b03202008-05-07 11:41:26 +080047#include <asm/dpmc.h>
Bryan Wu1394f032007-05-06 14:50:22 -070048
49/*
50 * Name the Board for the /proc/cpuinfo
51 */
Mike Frysingerfe85cad2008-11-18 17:48:22 +080052const char bfin_board_name[] = "ADI BF533-STAMP";
Bryan Wu1394f032007-05-06 14:50:22 -070053
54#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
55static struct platform_device rtc_device = {
56 .name = "rtc-bfin",
57 .id = -1,
58};
59#endif
60
61/*
62 * Driver needs to know address, irq and flag pin.
63 */
64#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
65static struct resource smc91x_resources[] = {
66 {
67 .name = "smc91x-regs",
68 .start = 0x20300300,
69 .end = 0x20300300 + 16,
70 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080071 }, {
Bryan Wu1394f032007-05-06 14:50:22 -070072 .start = IRQ_PF7,
73 .end = IRQ_PF7,
74 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
75 },
76};
77
78static struct platform_device smc91x_device = {
79 .name = "smc91x",
80 .id = 0,
81 .num_resources = ARRAY_SIZE(smc91x_resources),
82 .resource = smc91x_resources,
83};
84#endif
85
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080086#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
87static struct platform_device bfin_fb_adv7393_device = {
88 .name = "bfin-adv7393",
89};
90#endif
91
Bryan Wu1394f032007-05-06 14:50:22 -070092#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
93static struct resource net2272_bfin_resources[] = {
94 {
95 .start = 0x20300000,
96 .end = 0x20300000 + 0x100,
97 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080098 }, {
Bryan Wu1394f032007-05-06 14:50:22 -070099 .start = IRQ_PF10,
100 .end = IRQ_PF10,
101 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
102 },
103};
104
105static struct platform_device net2272_bfin_device = {
106 .name = "net2272",
107 .id = -1,
108 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
109 .resource = net2272_bfin_resources,
110};
111#endif
112
Mike Frysinger9cd9c612008-05-13 12:31:32 +0800113#if defined(CONFIG_MTD_BFIN_ASYNC) || defined(CONFIG_MTD_BFIN_ASYNC_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800114static struct mtd_partition stamp_partitions[] = {
115 {
Robin Getzaa582972008-08-05 17:47:29 +0800116 .name = "bootloader(nor)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800117 .size = 0x40000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800118 .offset = 0,
119 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800120 .name = "linux kernel(nor)",
Grace Pan6ecb5b62009-01-07 23:14:38 +0800121 .size = 0x180000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800122 .offset = MTDPART_OFS_APPEND,
123 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800124 .name = "file system(nor)",
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800125 .size = MTDPART_SIZ_FULL,
126 .offset = MTDPART_OFS_APPEND,
127 }
128};
129
130static struct physmap_flash_data stamp_flash_data = {
131 .width = 2,
132 .parts = stamp_partitions,
133 .nr_parts = ARRAY_SIZE(stamp_partitions),
134};
135
136static struct resource stamp_flash_resource[] = {
137 {
138 .name = "cfi_probe",
139 .start = 0x20000000,
140 .end = 0x203fffff,
141 .flags = IORESOURCE_MEM,
142 }, {
Mike Frysinger9cd9c612008-05-13 12:31:32 +0800143 .start = 0x7BB07BB0, /* AMBCTL0 setting when accessing flash */
144 .end = 0x7BB07BB0, /* AMBCTL1 setting when accessing flash */
145 .flags = IORESOURCE_MEM,
146 }, {
147 .start = GPIO_PF0,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800148 .flags = IORESOURCE_IRQ,
149 }
150};
151
152static struct platform_device stamp_flash_device = {
Mike Frysinger9cd9c612008-05-13 12:31:32 +0800153 .name = "bfin-async-flash",
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800154 .id = 0,
155 .dev = {
156 .platform_data = &stamp_flash_data,
157 },
158 .num_resources = ARRAY_SIZE(stamp_flash_resource),
159 .resource = stamp_flash_resource,
160};
Mike Frysinger793dc272008-03-26 08:09:12 +0800161#endif
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800162
Bryan Wu1394f032007-05-06 14:50:22 -0700163#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
164static struct mtd_partition bfin_spi_flash_partitions[] = {
165 {
Robin Getzaa582972008-08-05 17:47:29 +0800166 .name = "bootloader(spi)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800167 .size = 0x00040000,
Bryan Wu1394f032007-05-06 14:50:22 -0700168 .offset = 0,
169 .mask_flags = MTD_CAP_ROM
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800170 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800171 .name = "linux kernel(spi)",
Grace Pan6ecb5b62009-01-07 23:14:38 +0800172 .size = 0x180000,
Mike Frysingeredf05642008-02-25 11:38:11 +0800173 .offset = MTDPART_OFS_APPEND,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800174 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800175 .name = "file system(spi)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800176 .size = MTDPART_SIZ_FULL,
177 .offset = MTDPART_OFS_APPEND,
Bryan Wu1394f032007-05-06 14:50:22 -0700178 }
179};
180
181static struct flash_platform_data bfin_spi_flash_data = {
182 .name = "m25p80",
183 .parts = bfin_spi_flash_partitions,
184 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
185 .type = "m25p64",
186};
187
188/* SPI flash chip (m25p64) */
189static struct bfin5xx_spi_chip spi_flash_chip_info = {
190 .enable_dma = 0, /* use dma transfer with this chip*/
191 .bits_per_word = 8,
192};
193#endif
194
Mike Frysingera261eec2009-05-20 14:05:36 +0000195#if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
Bryan Wu1394f032007-05-06 14:50:22 -0700196/* SPI ADC chip */
197static struct bfin5xx_spi_chip spi_adc_chip_info = {
198 .enable_dma = 1, /* use dma transfer with this chip*/
199 .bits_per_word = 16,
200};
201#endif
202
203#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
204static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
205 .enable_dma = 0,
206 .bits_per_word = 16,
207};
208#endif
209
210#if defined(CONFIG_PBX)
211static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
212 .ctl_reg = 0x4, /* send zero */
213 .enable_dma = 0,
214 .bits_per_word = 8,
215 .cs_change_per_word = 1,
216};
217#endif
218
Michael Hennerich6e668932008-02-09 01:54:09 +0800219#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
220static struct bfin5xx_spi_chip spidev_chip_info = {
221 .enable_dma = 0,
222 .bits_per_word = 8,
223};
224#endif
225
Bryan Wu1394f032007-05-06 14:50:22 -0700226static struct spi_board_info bfin_spi_board_info[] __initdata = {
227#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
228 {
229 /* the modalias must be the same as spi device driver name */
230 .modalias = "m25p80", /* Name of spi_driver for this device */
231 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800232 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700233 .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
234 .platform_data = &bfin_spi_flash_data,
235 .controller_data = &spi_flash_chip_info,
236 .mode = SPI_MODE_3,
237 },
238#endif
239
Mike Frysingera261eec2009-05-20 14:05:36 +0000240#if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
Bryan Wu1394f032007-05-06 14:50:22 -0700241 {
242 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
243 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800244 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700245 .chip_select = 1, /* Framework chip select. */
246 .platform_data = NULL, /* No spi_driver specific config */
247 .controller_data = &spi_adc_chip_info,
248 },
249#endif
250
251#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
252 {
253 .modalias = "ad1836-spi",
254 .max_speed_hz = 31250000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800255 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700256 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
257 .controller_data = &ad1836_spi_chip_info,
258 },
259#endif
260
Bryan Wu1394f032007-05-06 14:50:22 -0700261#if defined(CONFIG_PBX)
262 {
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800263 .modalias = "fxs-spi",
264 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800265 .bus_num = 0,
266 .chip_select = 8 - CONFIG_J11_JUMPER,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800267 .controller_data = &spi_si3xxx_chip_info,
Bryan Wu1394f032007-05-06 14:50:22 -0700268 .mode = SPI_MODE_3,
269 },
270 {
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800271 .modalias = "fxo-spi",
272 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800273 .bus_num = 0,
274 .chip_select = 8 - CONFIG_J19_JUMPER,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800275 .controller_data = &spi_si3xxx_chip_info,
Bryan Wu1394f032007-05-06 14:50:22 -0700276 .mode = SPI_MODE_3,
277 },
278#endif
279
Michael Hennerich6e668932008-02-09 01:54:09 +0800280#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
281 {
282 .modalias = "spidev",
283 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
284 .bus_num = 0,
285 .chip_select = 1,
286 .controller_data = &spidev_chip_info,
287 },
288#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700289};
290
Mike Frysinger5bda2722008-06-07 15:03:01 +0800291#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800292/* SPI (0) */
293static struct resource bfin_spi0_resource[] = {
294 [0] = {
295 .start = SPI0_REGBASE,
296 .end = SPI0_REGBASE + 0xFF,
297 .flags = IORESOURCE_MEM,
298 },
299 [1] = {
300 .start = CH_SPI,
301 .end = CH_SPI,
Yi Li53122692009-06-05 12:11:11 +0000302 .flags = IORESOURCE_DMA,
303 },
304 [2] = {
305 .start = IRQ_SPI,
306 .end = IRQ_SPI,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800307 .flags = IORESOURCE_IRQ,
308 }
309};
310
Bryan Wu1394f032007-05-06 14:50:22 -0700311/* SPI controller data */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800312static struct bfin5xx_spi_master bfin_spi0_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700313 .num_chipselect = 8,
314 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800315 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Bryan Wu1394f032007-05-06 14:50:22 -0700316};
317
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800318static struct platform_device bfin_spi0_device = {
319 .name = "bfin-spi",
320 .id = 0, /* Bus number */
321 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
322 .resource = bfin_spi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -0700323 .dev = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800324 .platform_data = &bfin_spi0_info, /* Passed to driver */
Bryan Wu1394f032007-05-06 14:50:22 -0700325 },
326};
327#endif /* spi master and devices */
328
329#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
330static struct platform_device bfin_fb_device = {
331 .name = "bf537-fb",
332};
333#endif
334
335#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
336static struct resource bfin_uart_resources[] = {
337 {
338 .start = 0xFFC00400,
339 .end = 0xFFC004FF,
340 .flags = IORESOURCE_MEM,
341 },
342};
343
344static struct platform_device bfin_uart_device = {
345 .name = "bfin-uart",
346 .id = 1,
347 .num_resources = ARRAY_SIZE(bfin_uart_resources),
348 .resource = bfin_uart_resources,
349};
350#endif
351
Graf Yang5be36d22008-04-25 03:09:15 +0800352#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang5be36d22008-04-25 03:09:15 +0800353#ifdef CONFIG_BFIN_SIR0
Graf Yang42bd8bc2009-01-07 23:14:39 +0800354static struct resource bfin_sir0_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800355 {
356 .start = 0xFFC00400,
357 .end = 0xFFC004FF,
358 .flags = IORESOURCE_MEM,
359 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800360 {
361 .start = IRQ_UART0_RX,
362 .end = IRQ_UART0_RX+1,
363 .flags = IORESOURCE_IRQ,
364 },
365 {
366 .start = CH_UART0_RX,
367 .end = CH_UART0_RX+1,
368 .flags = IORESOURCE_DMA,
369 },
Graf Yang5be36d22008-04-25 03:09:15 +0800370};
371
Graf Yang42bd8bc2009-01-07 23:14:39 +0800372static struct platform_device bfin_sir0_device = {
Graf Yang5be36d22008-04-25 03:09:15 +0800373 .name = "bfin_sir",
374 .id = 0,
Graf Yang42bd8bc2009-01-07 23:14:39 +0800375 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
376 .resource = bfin_sir0_resources,
Graf Yang5be36d22008-04-25 03:09:15 +0800377};
378#endif
Graf Yang42bd8bc2009-01-07 23:14:39 +0800379#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800380
Bryan Wu1394f032007-05-06 14:50:22 -0700381#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
382static struct platform_device bfin_sport0_uart_device = {
383 .name = "bfin-sport-uart",
384 .id = 0,
385};
386
387static struct platform_device bfin_sport1_uart_device = {
388 .name = "bfin-sport-uart",
389 .id = 1,
390};
391#endif
392
Michael Hennerich2463ef22008-01-27 16:49:48 +0800393#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
394#include <linux/input.h>
395#include <linux/gpio_keys.h>
396
397static struct gpio_keys_button bfin_gpio_keys_table[] = {
Michael Hennerichf1bceb42008-02-02 16:17:52 +0800398 {BTN_0, GPIO_PF5, 0, "gpio-keys: BTN0"},
399 {BTN_1, GPIO_PF6, 0, "gpio-keys: BTN1"},
400 {BTN_2, GPIO_PF8, 0, "gpio-keys: BTN2"},
Michael Hennerich2463ef22008-01-27 16:49:48 +0800401};
402
403static struct gpio_keys_platform_data bfin_gpio_keys_data = {
404 .buttons = bfin_gpio_keys_table,
405 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
406};
407
408static struct platform_device bfin_device_gpiokeys = {
409 .name = "gpio-keys",
410 .dev = {
411 .platform_data = &bfin_gpio_keys_data,
412 },
413};
414#endif
415
Mike Frysingercad2ab62008-02-22 17:01:31 +0800416static struct resource bfin_gpios_resources = {
417 .start = 0,
418 .end = MAX_BLACKFIN_GPIOS - 1,
419 .flags = IORESOURCE_IRQ,
420};
421
422static struct platform_device bfin_gpios_device = {
423 .name = "simple-gpio",
424 .id = -1,
425 .num_resources = 1,
426 .resource = &bfin_gpios_resources,
427};
428
Bryan Wue3163952008-01-24 16:19:15 +0800429#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
430#include <linux/i2c-gpio.h>
431
432static struct i2c_gpio_platform_data i2c_gpio_data = {
433 .sda_pin = 2,
434 .scl_pin = 3,
435 .sda_is_open_drain = 0,
436 .scl_is_open_drain = 0,
437 .udelay = 40,
438};
439
440static struct platform_device i2c_gpio_device = {
441 .name = "i2c-gpio",
442 .id = 0,
443 .dev = {
444 .platform_data = &i2c_gpio_data,
445 },
446};
447#endif
448
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800449static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
450#if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
451 {
452 I2C_BOARD_INFO("ad7142_joystick", 0x2C),
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800453 .irq = 39,
454 },
455#endif
Michael Hennerichebd58332009-07-02 11:00:38 +0000456#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800457 {
458 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800459 },
460#endif
461#if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
462 {
463 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800464 .irq = 39,
465 },
466#endif
467};
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800468
Michael Hennerich14b03202008-05-07 11:41:26 +0800469static const unsigned int cclk_vlev_datasheet[] =
470{
471 VRPAIR(VLEV_085, 250000000),
472 VRPAIR(VLEV_090, 376000000),
473 VRPAIR(VLEV_095, 426000000),
474 VRPAIR(VLEV_100, 426000000),
475 VRPAIR(VLEV_105, 476000000),
476 VRPAIR(VLEV_110, 476000000),
477 VRPAIR(VLEV_115, 476000000),
478 VRPAIR(VLEV_120, 600000000),
479 VRPAIR(VLEV_125, 600000000),
480 VRPAIR(VLEV_130, 600000000),
481};
482
483static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
484 .tuple_tab = cclk_vlev_datasheet,
485 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
486 .vr_settling_time = 25 /* us */,
487};
488
489static struct platform_device bfin_dpmc = {
490 .name = "bfin dpmc",
491 .dev = {
492 .platform_data = &bfin_dmpc_vreg_data,
493 },
494};
495
Bryan Wu1394f032007-05-06 14:50:22 -0700496static struct platform_device *stamp_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +0800497
498 &bfin_dpmc,
499
Bryan Wu1394f032007-05-06 14:50:22 -0700500#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
501 &rtc_device,
502#endif
503
504#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
505 &smc91x_device,
506#endif
507
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800508#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
509 &bfin_fb_adv7393_device,
510#endif
511
Bryan Wu1394f032007-05-06 14:50:22 -0700512#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
513 &net2272_bfin_device,
514#endif
515
516#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800517 &bfin_spi0_device,
Bryan Wu1394f032007-05-06 14:50:22 -0700518#endif
519
520#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
521 &bfin_uart_device,
522#endif
523
Graf Yang5be36d22008-04-25 03:09:15 +0800524#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang42bd8bc2009-01-07 23:14:39 +0800525#ifdef CONFIG_BFIN_SIR0
526 &bfin_sir0_device,
527#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800528#endif
529
Bryan Wu1394f032007-05-06 14:50:22 -0700530#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
531 &bfin_sport0_uart_device,
532 &bfin_sport1_uart_device,
533#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800534
Michael Hennerich2463ef22008-01-27 16:49:48 +0800535#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
536 &bfin_device_gpiokeys,
537#endif
Bryan Wue3163952008-01-24 16:19:15 +0800538
539#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
540 &i2c_gpio_device,
541#endif
Mike Frysingercad2ab62008-02-22 17:01:31 +0800542
543 &bfin_gpios_device,
Mike Frysinger793dc272008-03-26 08:09:12 +0800544
Mike Frysinger9cd9c612008-05-13 12:31:32 +0800545#if defined(CONFIG_MTD_BFIN_ASYNC) || defined(CONFIG_MTD_BFIN_ASYNC_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800546 &stamp_flash_device,
Mike Frysinger793dc272008-03-26 08:09:12 +0800547#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700548};
549
550static int __init stamp_init(void)
551{
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800552 int ret;
553
Harvey Harrisonb85d8582008-04-23 09:39:01 +0800554 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800555
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800556 i2c_register_board_info(0, bfin_i2c_board_info,
557 ARRAY_SIZE(bfin_i2c_board_info));
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800558
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800559 ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
560 if (ret < 0)
561 return ret;
562
563#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800564 /* setup BF533_STAMP CPLD to route AMS3 to Ethernet MAC */
Mike Frysinger9cd9c612008-05-13 12:31:32 +0800565 bfin_write_FIO_DIR(bfin_read_FIO_DIR() | PF0);
566 bfin_write_FIO_FLAG_S(PF0);
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800567 SSYNC();
Bryan Wu1394f032007-05-06 14:50:22 -0700568#endif
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800569
Mike Frysinger5bda2722008-06-07 15:03:01 +0800570 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800571 return 0;
Bryan Wu1394f032007-05-06 14:50:22 -0700572}
573
574arch_initcall(stamp_init);
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800575
576void native_machine_restart(char *cmd)
577{
Mike Frysinger9cd9c612008-05-13 12:31:32 +0800578 /* workaround pull up on cpld / flash pin not being strong enough */
579 bfin_write_FIO_INEN(~PF0);
580 bfin_write_FIO_DIR(PF0);
581 bfin_write_FIO_FLAG_C(PF0);
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800582}