blob: c198f9085ad503ab81da8b942ef153f6d038e454 [file] [log] [blame]
Bryan Wu1394f032007-05-06 14:50:22 -07001/*
2 * File: arch/blackfin/mach-bf537/boards/stamp.c
3 * Based on: arch/blackfin/mach-bf533/boards/ezkit.c
4 * Author: Aidan Williams <aidan@nicta.com.au>
5 *
6 * Created:
7 * Description:
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>
Mike Frysingerfc689112008-06-25 11:41:42 +080032#include <linux/kernel.h>
Bryan Wu1394f032007-05-06 14:50:22 -070033#include <linux/platform_device.h>
34#include <linux/mtd/mtd.h>
Mike Frysingerfc689112008-06-25 11:41:42 +080035#include <linux/mtd/nand.h>
Bryan Wu1394f032007-05-06 14:50:22 -070036#include <linux/mtd/partitions.h>
Mike Frysingerfc689112008-06-25 11:41:42 +080037#include <linux/mtd/plat-ram.h>
Mike Frysingerde8c43f2008-01-24 17:14:04 +080038#include <linux/mtd/physmap.h>
Bryan Wu1394f032007-05-06 14:50:22 -070039#include <linux/spi/spi.h>
40#include <linux/spi/flash.h>
41#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
Mike Frysingerf02bcec2007-11-15 21:29:15 +080042#include <linux/usb/isp1362.h>
Bryan Wu1394f032007-05-06 14:50:22 -070043#endif
Jeff Garzik0a87e3e2008-02-01 18:02:30 -050044#include <linux/ata_platform.h>
Bryan Wu1394f032007-05-06 14:50:22 -070045#include <linux/irq.h>
46#include <linux/interrupt.h>
Bryan Wu81d9c7f2008-03-26 10:02:13 +080047#include <linux/i2c.h>
David Brownell27f5d752007-10-04 18:06:16 -070048#include <linux/usb/sl811.h>
Yi Lif79ea4c2009-01-07 23:14:38 +080049#include <linux/spi/mmc_spi.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080050#include <asm/dma.h>
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080051#include <asm/bfin5xx_spi.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080052#include <asm/reboot.h>
Bryan Wu5d448dd2007-11-12 23:24:42 +080053#include <asm/portmux.h>
Michael Hennerich14b03202008-05-07 11:41:26 +080054#include <asm/dpmc.h>
Bryan Wu1394f032007-05-06 14:50:22 -070055
56/*
57 * Name the Board for the /proc/cpuinfo
58 */
Mike Frysingerfe85cad2008-11-18 17:48:22 +080059const char bfin_board_name[] = "ADI BF537-STAMP";
Bryan Wu1394f032007-05-06 14:50:22 -070060
61/*
62 * Driver needs to know address, irq and flag pin.
63 */
64
Bryan Wu1394f032007-05-06 14:50:22 -070065#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
Michael Hennerich3f375692008-11-18 17:48:22 +080066#include <linux/usb/isp1760.h>
67static struct resource bfin_isp1760_resources[] = {
Bryan Wu1394f032007-05-06 14:50:22 -070068 [0] = {
Michael Hennerich3f375692008-11-18 17:48:22 +080069 .start = 0x203C0000,
70 .end = 0x203C0000 + 0x000fffff,
Bryan Wu1394f032007-05-06 14:50:22 -070071 .flags = IORESOURCE_MEM,
72 },
73 [1] = {
Michael Hennerich3f375692008-11-18 17:48:22 +080074 .start = IRQ_PF7,
75 .end = IRQ_PF7,
Bryan Wu1394f032007-05-06 14:50:22 -070076 .flags = IORESOURCE_IRQ,
77 },
78};
79
Michael Hennerich3f375692008-11-18 17:48:22 +080080static struct isp1760_platform_data isp1760_priv = {
81 .is_isp1761 = 0,
82 .port1_disable = 0,
83 .bus_width_16 = 1,
84 .port1_otg = 0,
85 .analog_oc = 0,
86 .dack_polarity_high = 0,
87 .dreq_polarity_high = 0,
88};
89
90static struct platform_device bfin_isp1760_device = {
91 .name = "isp1760-hcd",
Bryan Wu1394f032007-05-06 14:50:22 -070092 .id = 0,
Michael Hennerich3f375692008-11-18 17:48:22 +080093 .dev = {
94 .platform_data = &isp1760_priv,
95 },
96 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
97 .resource = bfin_isp1760_resources,
Bryan Wu1394f032007-05-06 14:50:22 -070098};
Bryan Wu1394f032007-05-06 14:50:22 -070099#endif
100
Michael Hennerich2463ef22008-01-27 16:49:48 +0800101#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
102#include <linux/input.h>
103#include <linux/gpio_keys.h>
104
105static struct gpio_keys_button bfin_gpio_keys_table[] = {
106 {BTN_0, GPIO_PF2, 1, "gpio-keys: BTN0"},
107 {BTN_1, GPIO_PF3, 1, "gpio-keys: BTN1"},
108 {BTN_2, GPIO_PF4, 1, "gpio-keys: BTN2"},
109 {BTN_3, GPIO_PF5, 1, "gpio-keys: BTN3"},
110};
111
112static struct gpio_keys_platform_data bfin_gpio_keys_data = {
113 .buttons = bfin_gpio_keys_table,
114 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
115};
116
117static struct platform_device bfin_device_gpiokeys = {
118 .name = "gpio-keys",
119 .dev = {
120 .platform_data = &bfin_gpio_keys_data,
121 },
122};
123#endif
124
Mike Frysingercad2ab62008-02-22 17:01:31 +0800125static struct resource bfin_gpios_resources = {
126 .start = 0,
127 .end = MAX_BLACKFIN_GPIOS - 1,
128 .flags = IORESOURCE_IRQ,
129};
130
131static struct platform_device bfin_gpios_device = {
132 .name = "simple-gpio",
133 .id = -1,
134 .num_resources = 1,
135 .resource = &bfin_gpios_resources,
136};
137
Bryan Wu1394f032007-05-06 14:50:22 -0700138#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
139static struct resource bfin_pcmcia_cf_resources[] = {
140 {
141 .start = 0x20310000, /* IO PORT */
142 .end = 0x20312000,
143 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800144 }, {
Simon Arlottd2d50aa2007-06-11 15:31:30 +0800145 .start = 0x20311000, /* Attribute Memory */
Bryan Wu1394f032007-05-06 14:50:22 -0700146 .end = 0x20311FFF,
147 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800148 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700149 .start = IRQ_PF4,
150 .end = IRQ_PF4,
151 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800152 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700153 .start = 6, /* Card Detect PF6 */
154 .end = 6,
155 .flags = IORESOURCE_IRQ,
156 },
157};
158
159static struct platform_device bfin_pcmcia_cf_device = {
160 .name = "bfin_cf_pcmcia",
161 .id = -1,
162 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
163 .resource = bfin_pcmcia_cf_resources,
164};
165#endif
166
167#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
168static struct platform_device rtc_device = {
169 .name = "rtc-bfin",
170 .id = -1,
171};
172#endif
173
174#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
175static struct resource smc91x_resources[] = {
176 {
177 .name = "smc91x-regs",
178 .start = 0x20300300,
179 .end = 0x20300300 + 16,
180 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800181 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700182
183 .start = IRQ_PF7,
184 .end = IRQ_PF7,
185 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
186 },
187};
188static struct platform_device smc91x_device = {
189 .name = "smc91x",
190 .id = 0,
191 .num_resources = ARRAY_SIZE(smc91x_resources),
192 .resource = smc91x_resources,
193};
194#endif
195
Alex Landauf40d24d2007-07-12 12:11:48 +0800196#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
197static struct resource dm9000_resources[] = {
198 [0] = {
199 .start = 0x203FB800,
200 .end = 0x203FB800 + 8,
201 .flags = IORESOURCE_MEM,
202 },
203 [1] = {
204 .start = IRQ_PF9,
205 .end = IRQ_PF9,
206 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
207 },
208};
209
210static struct platform_device dm9000_device = {
211 .name = "dm9000",
212 .id = -1,
213 .num_resources = ARRAY_SIZE(dm9000_resources),
214 .resource = dm9000_resources,
215};
216#endif
217
Michael Hennerich561cc182007-11-17 23:56:08 +0800218#if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
219static struct resource ax88180_resources[] = {
220 [0] = {
221 .start = 0x20300000,
222 .end = 0x20300000 + 0x8000,
223 .flags = IORESOURCE_MEM,
224 },
225 [1] = {
226 .start = IRQ_PF7,
227 .end = IRQ_PF7,
228 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL),
229 },
230};
231
232static struct platform_device ax88180_device = {
233 .name = "ax88180",
234 .id = -1,
235 .num_resources = ARRAY_SIZE(ax88180_resources),
236 .resource = ax88180_resources,
237};
238#endif
239
Bryan Wu1394f032007-05-06 14:50:22 -0700240#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
241static struct resource sl811_hcd_resources[] = {
242 {
243 .start = 0x20340000,
244 .end = 0x20340000,
245 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800246 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700247 .start = 0x20340004,
248 .end = 0x20340004,
249 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800250 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700251 .start = CONFIG_USB_SL811_BFIN_IRQ,
252 .end = CONFIG_USB_SL811_BFIN_IRQ,
253 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
254 },
255};
256
257#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
258void sl811_port_power(struct device *dev, int is_on)
259{
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800260 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
Michael Hennerichacbcd262008-01-22 18:36:20 +0800261 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
Bryan Wu1394f032007-05-06 14:50:22 -0700262}
263#endif
264
265static struct sl811_platform_data sl811_priv = {
266 .potpg = 10,
267 .power = 250, /* == 500mA */
268#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
269 .port_power = &sl811_port_power,
270#endif
271};
272
273static struct platform_device sl811_hcd_device = {
274 .name = "sl811-hcd",
275 .id = 0,
276 .dev = {
277 .platform_data = &sl811_priv,
278 },
279 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
280 .resource = sl811_hcd_resources,
281};
282#endif
283
284#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
285static struct resource isp1362_hcd_resources[] = {
286 {
287 .start = 0x20360000,
288 .end = 0x20360000,
289 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800290 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700291 .start = 0x20360004,
292 .end = 0x20360004,
293 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800294 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700295 .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
296 .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
297 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
298 },
299};
300
301static struct isp1362_platform_data isp1362_priv = {
302 .sel15Kres = 1,
303 .clknotstop = 0,
304 .oc_enable = 0,
305 .int_act_high = 0,
306 .int_edge_triggered = 0,
307 .remote_wakeup_connected = 0,
308 .no_power_switching = 1,
309 .power_switching_mode = 0,
310};
311
312static struct platform_device isp1362_hcd_device = {
313 .name = "isp1362-hcd",
314 .id = 0,
315 .dev = {
316 .platform_data = &isp1362_priv,
317 },
318 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
319 .resource = isp1362_hcd_resources,
320};
321#endif
322
323#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
324static struct platform_device bfin_mac_device = {
325 .name = "bfin_mac",
326};
327#endif
328
329#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
330static struct resource net2272_bfin_resources[] = {
331 {
332 .start = 0x20300000,
333 .end = 0x20300000 + 0x100,
334 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800335 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700336 .start = IRQ_PF7,
337 .end = IRQ_PF7,
338 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
339 },
340};
341
342static struct platform_device net2272_bfin_device = {
343 .name = "net2272",
344 .id = -1,
345 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
346 .resource = net2272_bfin_resources,
347};
348#endif
349
Mike Frysingerfc689112008-06-25 11:41:42 +0800350#if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
351#ifdef CONFIG_MTD_PARTITIONS
352const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };
353
354static struct mtd_partition bfin_plat_nand_partitions[] = {
355 {
Robin Getzaa582972008-08-05 17:47:29 +0800356 .name = "linux kernel(nand)",
Mike Frysingerfc689112008-06-25 11:41:42 +0800357 .size = 0x400000,
358 .offset = 0,
359 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800360 .name = "file system(nand)",
Mike Frysingerfc689112008-06-25 11:41:42 +0800361 .size = MTDPART_SIZ_FULL,
362 .offset = MTDPART_OFS_APPEND,
363 },
364};
365#endif
366
367#define BFIN_NAND_PLAT_CLE 2
368#define BFIN_NAND_PLAT_ALE 1
369static void bfin_plat_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
370{
371 struct nand_chip *this = mtd->priv;
372
373 if (cmd == NAND_CMD_NONE)
374 return;
375
376 if (ctrl & NAND_CLE)
377 writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_CLE));
378 else
379 writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_ALE));
380}
381
382#define BFIN_NAND_PLAT_READY GPIO_PF3
383static int bfin_plat_nand_dev_ready(struct mtd_info *mtd)
384{
385 return gpio_get_value(BFIN_NAND_PLAT_READY);
386}
387
388static struct platform_nand_data bfin_plat_nand_data = {
389 .chip = {
390 .chip_delay = 30,
391#ifdef CONFIG_MTD_PARTITIONS
392 .part_probe_types = part_probes,
393 .partitions = bfin_plat_nand_partitions,
394 .nr_partitions = ARRAY_SIZE(bfin_plat_nand_partitions),
395#endif
396 },
397 .ctrl = {
398 .cmd_ctrl = bfin_plat_nand_cmd_ctrl,
399 .dev_ready = bfin_plat_nand_dev_ready,
400 },
401};
402
403#define MAX(x, y) (x > y ? x : y)
404static struct resource bfin_plat_nand_resources = {
405 .start = 0x20212000,
406 .end = 0x20212000 + (1 << MAX(BFIN_NAND_PLAT_CLE, BFIN_NAND_PLAT_ALE)),
407 .flags = IORESOURCE_IO,
408};
409
410static struct platform_device bfin_async_nand_device = {
411 .name = "gen_nand",
412 .id = -1,
413 .num_resources = 1,
414 .resource = &bfin_plat_nand_resources,
415 .dev = {
416 .platform_data = &bfin_plat_nand_data,
417 },
418};
419
420static void bfin_plat_nand_init(void)
421{
422 gpio_request(BFIN_NAND_PLAT_READY, "bfin_nand_plat");
423}
424#else
425static void bfin_plat_nand_init(void) {}
426#endif
427
Mike Frysinger793dc272008-03-26 08:09:12 +0800428#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800429static struct mtd_partition stamp_partitions[] = {
430 {
Robin Getzaa582972008-08-05 17:47:29 +0800431 .name = "bootloader(nor)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800432 .size = 0x40000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800433 .offset = 0,
434 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800435 .name = "linux kernel(nor)",
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800436 .size = 0xE0000,
437 .offset = MTDPART_OFS_APPEND,
438 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800439 .name = "file system(nor)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800440 .size = 0x400000 - 0x40000 - 0xE0000 - 0x10000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800441 .offset = MTDPART_OFS_APPEND,
442 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800443 .name = "MAC Address(nor)",
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800444 .size = MTDPART_SIZ_FULL,
445 .offset = 0x3F0000,
446 .mask_flags = MTD_WRITEABLE,
447 }
448};
449
450static struct physmap_flash_data stamp_flash_data = {
451 .width = 2,
452 .parts = stamp_partitions,
453 .nr_parts = ARRAY_SIZE(stamp_partitions),
454};
455
456static struct resource stamp_flash_resource = {
457 .start = 0x20000000,
458 .end = 0x203fffff,
459 .flags = IORESOURCE_MEM,
460};
461
462static struct platform_device stamp_flash_device = {
463 .name = "physmap-flash",
464 .id = 0,
465 .dev = {
466 .platform_data = &stamp_flash_data,
467 },
468 .num_resources = 1,
469 .resource = &stamp_flash_resource,
470};
Mike Frysinger793dc272008-03-26 08:09:12 +0800471#endif
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800472
Bryan Wu1394f032007-05-06 14:50:22 -0700473#if defined(CONFIG_MTD_M25P80) \
474 || defined(CONFIG_MTD_M25P80_MODULE)
475static struct mtd_partition bfin_spi_flash_partitions[] = {
476 {
Robin Getzaa582972008-08-05 17:47:29 +0800477 .name = "bootloader(spi)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800478 .size = 0x00040000,
Bryan Wu1394f032007-05-06 14:50:22 -0700479 .offset = 0,
480 .mask_flags = MTD_CAP_ROM
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800481 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800482 .name = "linux kernel(spi)",
Bryan Wu1394f032007-05-06 14:50:22 -0700483 .size = 0xe0000,
Mike Frysingeredf05642008-02-25 11:38:11 +0800484 .offset = MTDPART_OFS_APPEND,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800485 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800486 .name = "file system(spi)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800487 .size = MTDPART_SIZ_FULL,
488 .offset = MTDPART_OFS_APPEND,
Bryan Wu1394f032007-05-06 14:50:22 -0700489 }
490};
491
492static struct flash_platform_data bfin_spi_flash_data = {
493 .name = "m25p80",
494 .parts = bfin_spi_flash_partitions,
495 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
Michael Hennerich88a80782008-11-18 17:48:22 +0800496 /* .type = "m25p64", */
Bryan Wu1394f032007-05-06 14:50:22 -0700497};
498
499/* SPI flash chip (m25p64) */
500static struct bfin5xx_spi_chip spi_flash_chip_info = {
501 .enable_dma = 0, /* use dma transfer with this chip*/
502 .bits_per_word = 8,
503};
504#endif
505
506#if defined(CONFIG_SPI_ADC_BF533) \
507 || defined(CONFIG_SPI_ADC_BF533_MODULE)
508/* SPI ADC chip */
509static struct bfin5xx_spi_chip spi_adc_chip_info = {
510 .enable_dma = 1, /* use dma transfer with this chip*/
511 .bits_per_word = 16,
512};
513#endif
514
515#if defined(CONFIG_SND_BLACKFIN_AD1836) \
516 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
517static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
518 .enable_dma = 0,
519 .bits_per_word = 16,
520};
521#endif
522
523#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
524static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
525 .enable_dma = 0,
526 .bits_per_word = 16,
527};
528#endif
529
Yi Lif79ea4c2009-01-07 23:14:38 +0800530#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
531#define MMC_SPI_CARD_DETECT_INT IRQ_PF5
532
533static int bfin_mmc_spi_init(struct device *dev,
534 irqreturn_t (*detect_int)(int, void *), void *data)
535{
536 return request_irq(MMC_SPI_CARD_DETECT_INT, detect_int,
537 IRQF_TRIGGER_FALLING, "mmc-spi-detect", data);
538}
539
540static void bfin_mmc_spi_exit(struct device *dev, void *data)
541{
542 free_irq(MMC_SPI_CARD_DETECT_INT, data);
543}
544
545static struct mmc_spi_platform_data bfin_mmc_spi_pdata = {
546 .init = bfin_mmc_spi_init,
547 .exit = bfin_mmc_spi_exit,
548 .detect_delay = 100, /* msecs */
549};
550
551static struct bfin5xx_spi_chip mmc_spi_chip_info = {
552 .enable_dma = 0,
553 .bits_per_word = 8,
554};
555#endif
556
Bryan Wu1394f032007-05-06 14:50:22 -0700557#if defined(CONFIG_PBX)
558static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
559 .ctl_reg = 0x4, /* send zero */
560 .enable_dma = 0,
561 .bits_per_word = 8,
562 .cs_change_per_word = 1,
563};
564#endif
565
Bryan Wu1394f032007-05-06 14:50:22 -0700566#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
Michael Hennerich46aa04f2008-10-13 11:30:17 +0800567#include <linux/spi/ad7877.h>
Bryan Wu1394f032007-05-06 14:50:22 -0700568static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700569 .enable_dma = 0,
570 .bits_per_word = 16,
571};
572
573static const struct ad7877_platform_data bfin_ad7877_ts_info = {
574 .model = 7877,
575 .vref_delay_usecs = 50, /* internal, no capacitor */
576 .x_plate_ohms = 419,
577 .y_plate_ohms = 486,
578 .pressure_max = 1000,
579 .pressure_min = 0,
580 .stopacq_polarity = 1,
581 .first_conversion_delay = 3,
582 .acquisition_time = 1,
583 .averaging = 1,
584 .pen_down_acc_interval = 1,
585};
586#endif
587
Michael Hennerich46aa04f2008-10-13 11:30:17 +0800588#if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
589#include <linux/spi/ad7879.h>
Michael Hennerich46aa04f2008-10-13 11:30:17 +0800590static const struct ad7879_platform_data bfin_ad7879_ts_info = {
591 .model = 7879, /* Model = AD7879 */
592 .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
593 .pressure_max = 10000,
594 .pressure_min = 0,
595 .first_conversion_delay = 3, /* wait 512us before do a first conversion */
596 .acquisition_time = 1, /* 4us acquisition time per sample */
597 .median = 2, /* do 8 measurements */
598 .averaging = 1, /* take the average of 4 middle samples */
599 .pen_down_acc_interval = 255, /* 9.4 ms */
600 .gpio_output = 1, /* configure AUX/VBAT/GPIO as GPIO output */
601 .gpio_default = 1, /* During initialization set GPIO = HIGH */
602};
603#endif
604
Michael Hennerichf5150152008-10-16 23:23:18 +0800605#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
606static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
607 .enable_dma = 0,
608 .bits_per_word = 16,
609};
610#endif
611
Michael Hennerich6e668932008-02-09 01:54:09 +0800612#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
613static struct bfin5xx_spi_chip spidev_chip_info = {
614 .enable_dma = 0,
615 .bits_per_word = 8,
616};
617#endif
618
Michael Hennerich2043f3f2008-10-13 14:46:30 +0800619#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
620static struct bfin5xx_spi_chip lq035q1_spi_chip_info = {
621 .enable_dma = 0,
622 .bits_per_word = 8,
623};
624#endif
625
Michael Hennerich85a192e2009-01-07 23:14:38 +0800626#if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
627static struct bfin5xx_spi_chip enc28j60_spi_chip_info = {
628 .enable_dma = 1,
629 .bits_per_word = 8,
630 .cs_gpio = GPIO_PF10,
631};
632#endif
633
Michael Hennerich8e9d5c72008-04-24 08:46:19 +0800634#if defined(CONFIG_MTD_DATAFLASH) \
635 || defined(CONFIG_MTD_DATAFLASH_MODULE)
Michael Hennerichceac2652008-08-25 17:39:11 +0800636
637static struct mtd_partition bfin_spi_dataflash_partitions[] = {
638 {
639 .name = "bootloader(spi)",
640 .size = 0x00040000,
641 .offset = 0,
642 .mask_flags = MTD_CAP_ROM
643 }, {
644 .name = "linux kernel(spi)",
645 .size = 0xe0000,
646 .offset = MTDPART_OFS_APPEND,
647 }, {
648 .name = "file system(spi)",
649 .size = MTDPART_SIZ_FULL,
650 .offset = MTDPART_OFS_APPEND,
651 }
652};
653
654static struct flash_platform_data bfin_spi_dataflash_data = {
655 .name = "SPI Dataflash",
656 .parts = bfin_spi_dataflash_partitions,
657 .nr_parts = ARRAY_SIZE(bfin_spi_dataflash_partitions),
658};
659
Michael Hennerich8e9d5c72008-04-24 08:46:19 +0800660/* DataFlash chip */
661static struct bfin5xx_spi_chip data_flash_chip_info = {
662 .enable_dma = 0, /* use dma transfer with this chip*/
663 .bits_per_word = 8,
664};
665#endif
666
Bryan Wu1394f032007-05-06 14:50:22 -0700667static struct spi_board_info bfin_spi_board_info[] __initdata = {
668#if defined(CONFIG_MTD_M25P80) \
669 || defined(CONFIG_MTD_M25P80_MODULE)
670 {
671 /* the modalias must be the same as spi device driver name */
672 .modalias = "m25p80", /* Name of spi_driver for this device */
673 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800674 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700675 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
676 .platform_data = &bfin_spi_flash_data,
677 .controller_data = &spi_flash_chip_info,
678 .mode = SPI_MODE_3,
679 },
680#endif
Michael Hennerich8e9d5c72008-04-24 08:46:19 +0800681#if defined(CONFIG_MTD_DATAFLASH) \
682 || defined(CONFIG_MTD_DATAFLASH_MODULE)
683 { /* DataFlash chip */
684 .modalias = "mtd_dataflash",
Michael Hennerichceac2652008-08-25 17:39:11 +0800685 .max_speed_hz = 33250000, /* max spi clock (SCK) speed in HZ */
Michael Hennerich8e9d5c72008-04-24 08:46:19 +0800686 .bus_num = 0, /* Framework bus number */
687 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
Michael Hennerichceac2652008-08-25 17:39:11 +0800688 .platform_data = &bfin_spi_dataflash_data,
Michael Hennerich8e9d5c72008-04-24 08:46:19 +0800689 .controller_data = &data_flash_chip_info,
690 .mode = SPI_MODE_3,
691 },
692#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700693#if defined(CONFIG_SPI_ADC_BF533) \
694 || defined(CONFIG_SPI_ADC_BF533_MODULE)
695 {
696 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
697 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800698 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700699 .chip_select = 1, /* Framework chip select. */
700 .platform_data = NULL, /* No spi_driver specific config */
701 .controller_data = &spi_adc_chip_info,
702 },
703#endif
704
705#if defined(CONFIG_SND_BLACKFIN_AD1836) \
706 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
707 {
708 .modalias = "ad1836-spi",
709 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800710 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700711 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
712 .controller_data = &ad1836_spi_chip_info,
713 },
714#endif
715#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
716 {
717 .modalias = "ad9960-spi",
718 .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800719 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700720 .chip_select = 1,
721 .controller_data = &ad9960_spi_chip_info,
722 },
723#endif
Yi Lif79ea4c2009-01-07 23:14:38 +0800724#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
725 {
726 .modalias = "mmc_spi",
727 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
728 .bus_num = 0,
729 .chip_select = 4,
730 .platform_data = &bfin_mmc_spi_pdata,
731 .controller_data = &mmc_spi_chip_info,
732 .mode = SPI_MODE_3,
733 },
734#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700735#if defined(CONFIG_PBX)
736 {
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800737 .modalias = "fxs-spi",
738 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800739 .bus_num = 0,
740 .chip_select = 8 - CONFIG_J11_JUMPER,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800741 .controller_data = &spi_si3xxx_chip_info,
Bryan Wu1394f032007-05-06 14:50:22 -0700742 .mode = SPI_MODE_3,
743 },
744 {
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800745 .modalias = "fxo-spi",
746 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800747 .bus_num = 0,
748 .chip_select = 8 - CONFIG_J19_JUMPER,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800749 .controller_data = &spi_si3xxx_chip_info,
Bryan Wu1394f032007-05-06 14:50:22 -0700750 .mode = SPI_MODE_3,
751 },
752#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700753#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
754 {
755 .modalias = "ad7877",
756 .platform_data = &bfin_ad7877_ts_info,
757 .irq = IRQ_PF6,
758 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Michael Hennerichc7d48962007-11-15 21:33:31 +0800759 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700760 .chip_select = 1,
761 .controller_data = &spi_ad7877_chip_info,
762 },
763#endif
Michael Hennerichf5150152008-10-16 23:23:18 +0800764#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
Michael Hennerich46aa04f2008-10-13 11:30:17 +0800765 {
766 .modalias = "ad7879",
767 .platform_data = &bfin_ad7879_ts_info,
768 .irq = IRQ_PF7,
769 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
770 .bus_num = 0,
771 .chip_select = 1,
772 .controller_data = &spi_ad7879_chip_info,
773 .mode = SPI_CPHA | SPI_CPOL,
774 },
775#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800776#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
777 {
778 .modalias = "spidev",
779 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
780 .bus_num = 0,
781 .chip_select = 1,
782 .controller_data = &spidev_chip_info,
783 },
784#endif
Michael Hennerich2043f3f2008-10-13 14:46:30 +0800785#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
786 {
787 .modalias = "bfin-lq035q1-spi",
788 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
789 .bus_num = 0,
Michael Hennerich46aa04f2008-10-13 11:30:17 +0800790 .chip_select = 2,
Michael Hennerich2043f3f2008-10-13 14:46:30 +0800791 .controller_data = &lq035q1_spi_chip_info,
792 .mode = SPI_CPHA | SPI_CPOL,
793 },
794#endif
Michael Hennerich85a192e2009-01-07 23:14:38 +0800795#if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
796 {
797 .modalias = "enc28j60",
798 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
799 .irq = IRQ_PF6,
800 .bus_num = 0,
801 .chip_select = 0, /* GPIO controlled SSEL */
802 .controller_data = &enc28j60_spi_chip_info,
803 .mode = SPI_MODE_0,
804 },
805#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700806};
807
Mike Frysinger5bda2722008-06-07 15:03:01 +0800808#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wu1394f032007-05-06 14:50:22 -0700809/* SPI controller data */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800810static struct bfin5xx_spi_master bfin_spi0_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700811 .num_chipselect = 8,
812 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800813 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Bryan Wu1394f032007-05-06 14:50:22 -0700814};
815
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800816/* SPI (0) */
817static struct resource bfin_spi0_resource[] = {
818 [0] = {
819 .start = SPI0_REGBASE,
820 .end = SPI0_REGBASE + 0xFF,
821 .flags = IORESOURCE_MEM,
822 },
823 [1] = {
824 .start = CH_SPI,
825 .end = CH_SPI,
826 .flags = IORESOURCE_IRQ,
827 },
828};
829
830static struct platform_device bfin_spi0_device = {
831 .name = "bfin-spi",
832 .id = 0, /* Bus number */
833 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
834 .resource = bfin_spi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -0700835 .dev = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800836 .platform_data = &bfin_spi0_info, /* Passed to driver */
Bryan Wu1394f032007-05-06 14:50:22 -0700837 },
838};
839#endif /* spi master and devices */
840
841#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
842static struct platform_device bfin_fb_device = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800843 .name = "bf537-lq035",
844};
845#endif
846
847#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
848static struct platform_device bfin_fb_adv7393_device = {
849 .name = "bfin-adv7393",
Bryan Wu1394f032007-05-06 14:50:22 -0700850};
851#endif
852
Michael Hennerich2043f3f2008-10-13 14:46:30 +0800853#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
854#include <asm/bfin-lq035q1.h>
855
856static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
857 .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
Michael Hennerich46aa04f2008-10-13 11:30:17 +0800858 .use_bl = 0, /* let something else control the LCD Blacklight */
Michael Hennerich2043f3f2008-10-13 14:46:30 +0800859 .gpio_bl = GPIO_PF7,
860};
861
862static struct resource bfin_lq035q1_resources[] = {
863 {
864 .start = IRQ_PPI_ERROR,
865 .end = IRQ_PPI_ERROR,
866 .flags = IORESOURCE_IRQ,
867 },
868};
869
870static struct platform_device bfin_lq035q1_device = {
871 .name = "bfin-lq035q1",
872 .id = -1,
873 .num_resources = ARRAY_SIZE(bfin_lq035q1_resources),
874 .resource = bfin_lq035q1_resources,
875 .dev = {
876 .platform_data = &bfin_lq035q1_data,
877 },
878};
879#endif
880
Bryan Wu1394f032007-05-06 14:50:22 -0700881#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
882static struct resource bfin_uart_resources[] = {
Sonic Zhang233b28a2007-11-21 17:04:41 +0800883#ifdef CONFIG_SERIAL_BFIN_UART0
Bryan Wu1394f032007-05-06 14:50:22 -0700884 {
885 .start = 0xFFC00400,
886 .end = 0xFFC004FF,
887 .flags = IORESOURCE_MEM,
Sonic Zhang233b28a2007-11-21 17:04:41 +0800888 },
889#endif
890#ifdef CONFIG_SERIAL_BFIN_UART1
891 {
Bryan Wu1394f032007-05-06 14:50:22 -0700892 .start = 0xFFC02000,
893 .end = 0xFFC020FF,
894 .flags = IORESOURCE_MEM,
895 },
Sonic Zhang233b28a2007-11-21 17:04:41 +0800896#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700897};
898
899static struct platform_device bfin_uart_device = {
900 .name = "bfin-uart",
901 .id = 1,
902 .num_resources = ARRAY_SIZE(bfin_uart_resources),
903 .resource = bfin_uart_resources,
904};
905#endif
906
Graf Yang5be36d22008-04-25 03:09:15 +0800907#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
908static struct resource bfin_sir_resources[] = {
909#ifdef CONFIG_BFIN_SIR0
910 {
911 .start = 0xFFC00400,
912 .end = 0xFFC004FF,
913 .flags = IORESOURCE_MEM,
914 },
915#endif
916#ifdef CONFIG_BFIN_SIR1
917 {
918 .start = 0xFFC02000,
919 .end = 0xFFC020FF,
920 .flags = IORESOURCE_MEM,
921 },
922#endif
923};
924
925static struct platform_device bfin_sir_device = {
926 .name = "bfin_sir",
927 .id = 0,
928 .num_resources = ARRAY_SIZE(bfin_sir_resources),
929 .resource = bfin_sir_resources,
930};
931#endif
932
Bryan Wu1394f032007-05-06 14:50:22 -0700933#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800934static struct resource bfin_twi0_resource[] = {
935 [0] = {
936 .start = TWI0_REGBASE,
937 .end = TWI0_REGBASE,
938 .flags = IORESOURCE_MEM,
939 },
940 [1] = {
941 .start = IRQ_TWI,
942 .end = IRQ_TWI,
943 .flags = IORESOURCE_IRQ,
944 },
945};
946
Bryan Wu1394f032007-05-06 14:50:22 -0700947static struct platform_device i2c_bfin_twi_device = {
948 .name = "i2c-bfin-twi",
949 .id = 0,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800950 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
951 .resource = bfin_twi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -0700952};
953#endif
954
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800955#ifdef CONFIG_I2C_BOARDINFO
956static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
957#if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
958 {
959 I2C_BOARD_INFO("ad7142_joystick", 0x2C),
Michael Hennerichf5150152008-10-16 23:23:18 +0800960 .irq = IRQ_PF5,
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800961 },
962#endif
963#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
964 {
965 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800966 },
967#endif
968#if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
969 {
970 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
Michael Hennerichf5150152008-10-16 23:23:18 +0800971 .irq = IRQ_PG6,
972 },
973#endif
974#if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) || defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)
975 {
976 I2C_BOARD_INFO("ad7879", 0x2F),
977 .irq = IRQ_PG5,
978 .platform_data = (void *)&bfin_ad7879_ts_info,
Bryan Wu81d9c7f2008-03-26 10:02:13 +0800979 },
980#endif
981};
982#endif
983
Bryan Wu1394f032007-05-06 14:50:22 -0700984#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
985static struct platform_device bfin_sport0_uart_device = {
986 .name = "bfin-sport-uart",
987 .id = 0,
988};
989
990static struct platform_device bfin_sport1_uart_device = {
991 .name = "bfin-sport-uart",
992 .id = 1,
993};
994#endif
995
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800996#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
Mike Frysinger96b86e92008-07-14 16:39:43 +0800997#define PATA_INT IRQ_PF5
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800998
999static struct pata_platform_info bfin_pata_platform_data = {
1000 .ioport_shift = 1,
Mike Frysinger64e5c512007-10-30 11:56:13 +08001001 .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001002};
1003
1004static struct resource bfin_pata_resources[] = {
1005 {
1006 .start = 0x20314020,
1007 .end = 0x2031403F,
1008 .flags = IORESOURCE_MEM,
1009 },
1010 {
1011 .start = 0x2031401C,
1012 .end = 0x2031401F,
1013 .flags = IORESOURCE_MEM,
1014 },
1015 {
1016 .start = PATA_INT,
1017 .end = PATA_INT,
1018 .flags = IORESOURCE_IRQ,
1019 },
1020};
1021
1022static struct platform_device bfin_pata_device = {
1023 .name = "pata_platform",
1024 .id = -1,
1025 .num_resources = ARRAY_SIZE(bfin_pata_resources),
1026 .resource = bfin_pata_resources,
1027 .dev = {
1028 .platform_data = &bfin_pata_platform_data,
1029 }
1030};
1031#endif
1032
Michael Hennerich14b03202008-05-07 11:41:26 +08001033static const unsigned int cclk_vlev_datasheet[] =
1034{
1035 VRPAIR(VLEV_085, 250000000),
1036 VRPAIR(VLEV_090, 376000000),
1037 VRPAIR(VLEV_095, 426000000),
1038 VRPAIR(VLEV_100, 426000000),
1039 VRPAIR(VLEV_105, 476000000),
1040 VRPAIR(VLEV_110, 476000000),
1041 VRPAIR(VLEV_115, 476000000),
1042 VRPAIR(VLEV_120, 500000000),
1043 VRPAIR(VLEV_125, 533000000),
1044 VRPAIR(VLEV_130, 600000000),
1045};
1046
1047static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
1048 .tuple_tab = cclk_vlev_datasheet,
1049 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
1050 .vr_settling_time = 25 /* us */,
1051};
1052
1053static struct platform_device bfin_dpmc = {
1054 .name = "bfin dpmc",
1055 .dev = {
1056 .platform_data = &bfin_dmpc_vreg_data,
1057 },
1058};
1059
Bryan Wu1394f032007-05-06 14:50:22 -07001060static struct platform_device *stamp_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +08001061
1062 &bfin_dpmc,
1063
Bryan Wu1394f032007-05-06 14:50:22 -07001064#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
1065 &bfin_pcmcia_cf_device,
1066#endif
1067
1068#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
1069 &rtc_device,
1070#endif
1071
1072#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
1073 &sl811_hcd_device,
1074#endif
1075
1076#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
1077 &isp1362_hcd_device,
1078#endif
1079
Michael Hennerich3f375692008-11-18 17:48:22 +08001080#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
1081 &bfin_isp1760_device,
1082#endif
1083
Bryan Wu1394f032007-05-06 14:50:22 -07001084#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
1085 &smc91x_device,
1086#endif
1087
Alex Landauf40d24d2007-07-12 12:11:48 +08001088#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
1089 &dm9000_device,
1090#endif
1091
Michael Hennerich561cc182007-11-17 23:56:08 +08001092#if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
1093 &ax88180_device,
1094#endif
1095
Bryan Wu1394f032007-05-06 14:50:22 -07001096#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
1097 &bfin_mac_device,
1098#endif
1099
1100#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
1101 &net2272_bfin_device,
1102#endif
1103
1104#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001105 &bfin_spi0_device,
Bryan Wu1394f032007-05-06 14:50:22 -07001106#endif
1107
1108#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
1109 &bfin_fb_device,
1110#endif
1111
Michael Hennerich2043f3f2008-10-13 14:46:30 +08001112#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
1113 &bfin_lq035q1_device,
1114#endif
1115
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001116#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
1117 &bfin_fb_adv7393_device,
1118#endif
1119
Bryan Wu1394f032007-05-06 14:50:22 -07001120#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1121 &bfin_uart_device,
1122#endif
1123
Graf Yang5be36d22008-04-25 03:09:15 +08001124#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
1125 &bfin_sir_device,
1126#endif
1127
Bryan Wu1394f032007-05-06 14:50:22 -07001128#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1129 &i2c_bfin_twi_device,
1130#endif
1131
1132#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1133 &bfin_sport0_uart_device,
1134 &bfin_sport1_uart_device,
1135#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001136
1137#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
1138 &bfin_pata_device,
1139#endif
Michael Hennerich2463ef22008-01-27 16:49:48 +08001140
1141#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1142 &bfin_device_gpiokeys,
1143#endif
Mike Frysingercad2ab62008-02-22 17:01:31 +08001144
1145 &bfin_gpios_device,
Mike Frysinger793dc272008-03-26 08:09:12 +08001146
Mike Frysingerfc689112008-06-25 11:41:42 +08001147#if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
1148 &bfin_async_nand_device,
1149#endif
1150
Mike Frysinger793dc272008-03-26 08:09:12 +08001151#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +08001152 &stamp_flash_device,
Mike Frysinger793dc272008-03-26 08:09:12 +08001153#endif
Bryan Wu1394f032007-05-06 14:50:22 -07001154};
1155
1156static int __init stamp_init(void)
1157{
Harvey Harrisonb85d8582008-04-23 09:39:01 +08001158 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Bryan Wu81d9c7f2008-03-26 10:02:13 +08001159
1160#ifdef CONFIG_I2C_BOARDINFO
1161 i2c_register_board_info(0, bfin_i2c_board_info,
1162 ARRAY_SIZE(bfin_i2c_board_info));
1163#endif
1164
Mike Frysingerfc689112008-06-25 11:41:42 +08001165 bfin_plat_nand_init();
Bryan Wu1394f032007-05-06 14:50:22 -07001166 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
Mike Frysinger5bda2722008-06-07 15:03:01 +08001167 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001168
1169#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
1170 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
1171#endif
Bryan Wu81d9c7f2008-03-26 10:02:13 +08001172
Bryan Wu1394f032007-05-06 14:50:22 -07001173 return 0;
1174}
1175
1176arch_initcall(stamp_init);
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001177
1178void native_machine_restart(char *cmd)
1179{
1180 /* workaround reboot hang when booting from SPI */
1181 if ((bfin_read_SYSCR() & 0x7) == 0x3)
1182 bfin_gpio_reset_spi0_ssel1();
1183}
Mike Frysinger137b1522007-11-22 16:07:03 +08001184
1185/*
1186 * Currently the MAC address is saved in Flash by U-Boot
1187 */
1188#define FLASH_MAC 0x203f0000
Mike Frysinger9862cc52007-11-15 21:21:20 +08001189void bfin_get_ether_addr(char *addr)
Mike Frysinger137b1522007-11-22 16:07:03 +08001190{
1191 *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
1192 *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
1193}
Mike Frysinger9862cc52007-11-15 21:21:20 +08001194EXPORT_SYMBOL(bfin_get_ether_addr);