blob: cd04c5e448788ab811f77f8681d0cba87a461f45 [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,
Michael Hennerich6a6be3d2009-01-07 23:14:39 +080076 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
Bryan Wu1394f032007-05-06 14:50:22 -070077 },
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)
Graf Yang65319622009-02-04 16:49:45 +0800324static struct platform_device bfin_mii_bus = {
325 .name = "bfin_mii_bus",
326};
327
Bryan Wu1394f032007-05-06 14:50:22 -0700328static struct platform_device bfin_mac_device = {
329 .name = "bfin_mac",
Graf Yang65319622009-02-04 16:49:45 +0800330 .dev.platform_data = &bfin_mii_bus,
Bryan Wu1394f032007-05-06 14:50:22 -0700331};
332#endif
333
334#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
335static struct resource net2272_bfin_resources[] = {
336 {
337 .start = 0x20300000,
338 .end = 0x20300000 + 0x100,
339 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800340 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700341 .start = IRQ_PF7,
342 .end = IRQ_PF7,
343 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
344 },
345};
346
347static struct platform_device net2272_bfin_device = {
348 .name = "net2272",
349 .id = -1,
350 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
351 .resource = net2272_bfin_resources,
352};
353#endif
354
Mike Frysingerfc689112008-06-25 11:41:42 +0800355#if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
356#ifdef CONFIG_MTD_PARTITIONS
357const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };
358
359static struct mtd_partition bfin_plat_nand_partitions[] = {
360 {
Robin Getzaa582972008-08-05 17:47:29 +0800361 .name = "linux kernel(nand)",
Mike Frysingerfc689112008-06-25 11:41:42 +0800362 .size = 0x400000,
363 .offset = 0,
364 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800365 .name = "file system(nand)",
Mike Frysingerfc689112008-06-25 11:41:42 +0800366 .size = MTDPART_SIZ_FULL,
367 .offset = MTDPART_OFS_APPEND,
368 },
369};
370#endif
371
372#define BFIN_NAND_PLAT_CLE 2
373#define BFIN_NAND_PLAT_ALE 1
374static void bfin_plat_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
375{
376 struct nand_chip *this = mtd->priv;
377
378 if (cmd == NAND_CMD_NONE)
379 return;
380
381 if (ctrl & NAND_CLE)
382 writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_CLE));
383 else
384 writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_ALE));
385}
386
387#define BFIN_NAND_PLAT_READY GPIO_PF3
388static int bfin_plat_nand_dev_ready(struct mtd_info *mtd)
389{
390 return gpio_get_value(BFIN_NAND_PLAT_READY);
391}
392
393static struct platform_nand_data bfin_plat_nand_data = {
394 .chip = {
395 .chip_delay = 30,
396#ifdef CONFIG_MTD_PARTITIONS
397 .part_probe_types = part_probes,
398 .partitions = bfin_plat_nand_partitions,
399 .nr_partitions = ARRAY_SIZE(bfin_plat_nand_partitions),
400#endif
401 },
402 .ctrl = {
403 .cmd_ctrl = bfin_plat_nand_cmd_ctrl,
404 .dev_ready = bfin_plat_nand_dev_ready,
405 },
406};
407
408#define MAX(x, y) (x > y ? x : y)
409static struct resource bfin_plat_nand_resources = {
410 .start = 0x20212000,
411 .end = 0x20212000 + (1 << MAX(BFIN_NAND_PLAT_CLE, BFIN_NAND_PLAT_ALE)),
412 .flags = IORESOURCE_IO,
413};
414
415static struct platform_device bfin_async_nand_device = {
416 .name = "gen_nand",
417 .id = -1,
418 .num_resources = 1,
419 .resource = &bfin_plat_nand_resources,
420 .dev = {
421 .platform_data = &bfin_plat_nand_data,
422 },
423};
424
425static void bfin_plat_nand_init(void)
426{
427 gpio_request(BFIN_NAND_PLAT_READY, "bfin_nand_plat");
428}
429#else
430static void bfin_plat_nand_init(void) {}
431#endif
432
Mike Frysinger793dc272008-03-26 08:09:12 +0800433#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800434static struct mtd_partition stamp_partitions[] = {
435 {
Robin Getzaa582972008-08-05 17:47:29 +0800436 .name = "bootloader(nor)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800437 .size = 0x40000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800438 .offset = 0,
439 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800440 .name = "linux kernel(nor)",
Grace Pan6ecb5b62009-01-07 23:14:38 +0800441 .size = 0x180000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800442 .offset = MTDPART_OFS_APPEND,
443 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800444 .name = "file system(nor)",
Grace Pan6ecb5b62009-01-07 23:14:38 +0800445 .size = 0x400000 - 0x40000 - 0x180000 - 0x10000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800446 .offset = MTDPART_OFS_APPEND,
447 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800448 .name = "MAC Address(nor)",
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800449 .size = MTDPART_SIZ_FULL,
450 .offset = 0x3F0000,
451 .mask_flags = MTD_WRITEABLE,
452 }
453};
454
455static struct physmap_flash_data stamp_flash_data = {
456 .width = 2,
457 .parts = stamp_partitions,
458 .nr_parts = ARRAY_SIZE(stamp_partitions),
459};
460
461static struct resource stamp_flash_resource = {
462 .start = 0x20000000,
463 .end = 0x203fffff,
464 .flags = IORESOURCE_MEM,
465};
466
467static struct platform_device stamp_flash_device = {
468 .name = "physmap-flash",
469 .id = 0,
470 .dev = {
471 .platform_data = &stamp_flash_data,
472 },
473 .num_resources = 1,
474 .resource = &stamp_flash_resource,
475};
Mike Frysinger793dc272008-03-26 08:09:12 +0800476#endif
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800477
Bryan Wu1394f032007-05-06 14:50:22 -0700478#if defined(CONFIG_MTD_M25P80) \
479 || defined(CONFIG_MTD_M25P80_MODULE)
480static struct mtd_partition bfin_spi_flash_partitions[] = {
481 {
Robin Getzaa582972008-08-05 17:47:29 +0800482 .name = "bootloader(spi)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800483 .size = 0x00040000,
Bryan Wu1394f032007-05-06 14:50:22 -0700484 .offset = 0,
485 .mask_flags = MTD_CAP_ROM
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800486 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800487 .name = "linux kernel(spi)",
Grace Pan6ecb5b62009-01-07 23:14:38 +0800488 .size = 0x180000,
Mike Frysingeredf05642008-02-25 11:38:11 +0800489 .offset = MTDPART_OFS_APPEND,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800490 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800491 .name = "file system(spi)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800492 .size = MTDPART_SIZ_FULL,
493 .offset = MTDPART_OFS_APPEND,
Bryan Wu1394f032007-05-06 14:50:22 -0700494 }
495};
496
497static struct flash_platform_data bfin_spi_flash_data = {
498 .name = "m25p80",
499 .parts = bfin_spi_flash_partitions,
500 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
Michael Hennerich88a8078b32008-11-18 17:48:22 +0800501 /* .type = "m25p64", */
Bryan Wu1394f032007-05-06 14:50:22 -0700502};
503
504/* SPI flash chip (m25p64) */
505static struct bfin5xx_spi_chip spi_flash_chip_info = {
506 .enable_dma = 0, /* use dma transfer with this chip*/
507 .bits_per_word = 8,
508};
509#endif
510
511#if defined(CONFIG_SPI_ADC_BF533) \
512 || defined(CONFIG_SPI_ADC_BF533_MODULE)
513/* SPI ADC chip */
514static struct bfin5xx_spi_chip spi_adc_chip_info = {
515 .enable_dma = 1, /* use dma transfer with this chip*/
516 .bits_per_word = 16,
517};
518#endif
519
520#if defined(CONFIG_SND_BLACKFIN_AD1836) \
521 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
522static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
523 .enable_dma = 0,
524 .bits_per_word = 16,
525};
526#endif
527
528#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
529static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
530 .enable_dma = 0,
531 .bits_per_word = 16,
532};
533#endif
534
Yi Lif79ea4c2009-01-07 23:14:38 +0800535#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
536#define MMC_SPI_CARD_DETECT_INT IRQ_PF5
537
538static int bfin_mmc_spi_init(struct device *dev,
539 irqreturn_t (*detect_int)(int, void *), void *data)
540{
541 return request_irq(MMC_SPI_CARD_DETECT_INT, detect_int,
542 IRQF_TRIGGER_FALLING, "mmc-spi-detect", data);
543}
544
545static void bfin_mmc_spi_exit(struct device *dev, void *data)
546{
547 free_irq(MMC_SPI_CARD_DETECT_INT, data);
548}
549
550static struct mmc_spi_platform_data bfin_mmc_spi_pdata = {
551 .init = bfin_mmc_spi_init,
552 .exit = bfin_mmc_spi_exit,
553 .detect_delay = 100, /* msecs */
554};
555
556static struct bfin5xx_spi_chip mmc_spi_chip_info = {
557 .enable_dma = 0,
558 .bits_per_word = 8,
559};
560#endif
561
Bryan Wu1394f032007-05-06 14:50:22 -0700562#if defined(CONFIG_PBX)
563static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
564 .ctl_reg = 0x4, /* send zero */
565 .enable_dma = 0,
566 .bits_per_word = 8,
567 .cs_change_per_word = 1,
568};
569#endif
570
Bryan Wu1394f032007-05-06 14:50:22 -0700571#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
Michael Hennerich46aa04f2008-10-13 11:30:17 +0800572#include <linux/spi/ad7877.h>
Bryan Wu1394f032007-05-06 14:50:22 -0700573static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700574 .enable_dma = 0,
575 .bits_per_word = 16,
576};
577
578static const struct ad7877_platform_data bfin_ad7877_ts_info = {
579 .model = 7877,
580 .vref_delay_usecs = 50, /* internal, no capacitor */
581 .x_plate_ohms = 419,
582 .y_plate_ohms = 486,
583 .pressure_max = 1000,
584 .pressure_min = 0,
585 .stopacq_polarity = 1,
586 .first_conversion_delay = 3,
587 .acquisition_time = 1,
588 .averaging = 1,
589 .pen_down_acc_interval = 1,
590};
591#endif
592
Michael Hennerich46aa04f2008-10-13 11:30:17 +0800593#if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
594#include <linux/spi/ad7879.h>
Michael Hennerich46aa04f2008-10-13 11:30:17 +0800595static const struct ad7879_platform_data bfin_ad7879_ts_info = {
596 .model = 7879, /* Model = AD7879 */
597 .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
598 .pressure_max = 10000,
599 .pressure_min = 0,
600 .first_conversion_delay = 3, /* wait 512us before do a first conversion */
601 .acquisition_time = 1, /* 4us acquisition time per sample */
602 .median = 2, /* do 8 measurements */
603 .averaging = 1, /* take the average of 4 middle samples */
604 .pen_down_acc_interval = 255, /* 9.4 ms */
605 .gpio_output = 1, /* configure AUX/VBAT/GPIO as GPIO output */
606 .gpio_default = 1, /* During initialization set GPIO = HIGH */
607};
608#endif
609
Michael Hennerichf5150152008-10-16 23:23:18 +0800610#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
611static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
612 .enable_dma = 0,
613 .bits_per_word = 16,
614};
615#endif
616
Michael Hennerich6e668932008-02-09 01:54:09 +0800617#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
618static struct bfin5xx_spi_chip spidev_chip_info = {
619 .enable_dma = 0,
620 .bits_per_word = 8,
621};
622#endif
623
Michael Hennerich2043f3f2008-10-13 14:46:30 +0800624#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
625static struct bfin5xx_spi_chip lq035q1_spi_chip_info = {
626 .enable_dma = 0,
627 .bits_per_word = 8,
628};
629#endif
630
Michael Hennerich85a192e2009-01-07 23:14:38 +0800631#if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
632static struct bfin5xx_spi_chip enc28j60_spi_chip_info = {
633 .enable_dma = 1,
634 .bits_per_word = 8,
635 .cs_gpio = GPIO_PF10,
636};
637#endif
638
Michael Hennerich8e9d5c72008-04-24 08:46:19 +0800639#if defined(CONFIG_MTD_DATAFLASH) \
640 || defined(CONFIG_MTD_DATAFLASH_MODULE)
Michael Hennerichceac2652008-08-25 17:39:11 +0800641
642static struct mtd_partition bfin_spi_dataflash_partitions[] = {
643 {
644 .name = "bootloader(spi)",
645 .size = 0x00040000,
646 .offset = 0,
647 .mask_flags = MTD_CAP_ROM
648 }, {
649 .name = "linux kernel(spi)",
Grace Pan6ecb5b62009-01-07 23:14:38 +0800650 .size = 0x180000,
Michael Hennerichceac2652008-08-25 17:39:11 +0800651 .offset = MTDPART_OFS_APPEND,
652 }, {
653 .name = "file system(spi)",
654 .size = MTDPART_SIZ_FULL,
655 .offset = MTDPART_OFS_APPEND,
656 }
657};
658
659static struct flash_platform_data bfin_spi_dataflash_data = {
660 .name = "SPI Dataflash",
661 .parts = bfin_spi_dataflash_partitions,
662 .nr_parts = ARRAY_SIZE(bfin_spi_dataflash_partitions),
663};
664
Michael Hennerich8e9d5c72008-04-24 08:46:19 +0800665/* DataFlash chip */
666static struct bfin5xx_spi_chip data_flash_chip_info = {
667 .enable_dma = 0, /* use dma transfer with this chip*/
668 .bits_per_word = 8,
669};
670#endif
671
Bryan Wu1394f032007-05-06 14:50:22 -0700672static struct spi_board_info bfin_spi_board_info[] __initdata = {
673#if defined(CONFIG_MTD_M25P80) \
674 || defined(CONFIG_MTD_M25P80_MODULE)
675 {
676 /* the modalias must be the same as spi device driver name */
677 .modalias = "m25p80", /* Name of spi_driver for this device */
678 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800679 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700680 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
681 .platform_data = &bfin_spi_flash_data,
682 .controller_data = &spi_flash_chip_info,
683 .mode = SPI_MODE_3,
684 },
685#endif
Michael Hennerich8e9d5c72008-04-24 08:46:19 +0800686#if defined(CONFIG_MTD_DATAFLASH) \
687 || defined(CONFIG_MTD_DATAFLASH_MODULE)
688 { /* DataFlash chip */
689 .modalias = "mtd_dataflash",
Michael Hennerichceac2652008-08-25 17:39:11 +0800690 .max_speed_hz = 33250000, /* max spi clock (SCK) speed in HZ */
Michael Hennerich8e9d5c72008-04-24 08:46:19 +0800691 .bus_num = 0, /* Framework bus number */
692 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
Michael Hennerichceac2652008-08-25 17:39:11 +0800693 .platform_data = &bfin_spi_dataflash_data,
Michael Hennerich8e9d5c72008-04-24 08:46:19 +0800694 .controller_data = &data_flash_chip_info,
695 .mode = SPI_MODE_3,
696 },
697#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700698#if defined(CONFIG_SPI_ADC_BF533) \
699 || defined(CONFIG_SPI_ADC_BF533_MODULE)
700 {
701 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
702 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800703 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700704 .chip_select = 1, /* Framework chip select. */
705 .platform_data = NULL, /* No spi_driver specific config */
706 .controller_data = &spi_adc_chip_info,
707 },
708#endif
709
710#if defined(CONFIG_SND_BLACKFIN_AD1836) \
711 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
712 {
713 .modalias = "ad1836-spi",
714 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800715 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700716 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
717 .controller_data = &ad1836_spi_chip_info,
718 },
719#endif
720#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
721 {
722 .modalias = "ad9960-spi",
723 .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800724 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700725 .chip_select = 1,
726 .controller_data = &ad9960_spi_chip_info,
727 },
728#endif
Yi Lif79ea4c2009-01-07 23:14:38 +0800729#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
730 {
731 .modalias = "mmc_spi",
732 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
733 .bus_num = 0,
734 .chip_select = 4,
735 .platform_data = &bfin_mmc_spi_pdata,
736 .controller_data = &mmc_spi_chip_info,
737 .mode = SPI_MODE_3,
738 },
739#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700740#if defined(CONFIG_PBX)
741 {
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800742 .modalias = "fxs-spi",
743 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800744 .bus_num = 0,
745 .chip_select = 8 - CONFIG_J11_JUMPER,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800746 .controller_data = &spi_si3xxx_chip_info,
Bryan Wu1394f032007-05-06 14:50:22 -0700747 .mode = SPI_MODE_3,
748 },
749 {
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800750 .modalias = "fxo-spi",
751 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800752 .bus_num = 0,
753 .chip_select = 8 - CONFIG_J19_JUMPER,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800754 .controller_data = &spi_si3xxx_chip_info,
Bryan Wu1394f032007-05-06 14:50:22 -0700755 .mode = SPI_MODE_3,
756 },
757#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700758#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
759 {
760 .modalias = "ad7877",
761 .platform_data = &bfin_ad7877_ts_info,
762 .irq = IRQ_PF6,
763 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Michael Hennerichc7d48962007-11-15 21:33:31 +0800764 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700765 .chip_select = 1,
766 .controller_data = &spi_ad7877_chip_info,
767 },
768#endif
Michael Hennerichf5150152008-10-16 23:23:18 +0800769#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
Michael Hennerich46aa04f2008-10-13 11:30:17 +0800770 {
771 .modalias = "ad7879",
772 .platform_data = &bfin_ad7879_ts_info,
773 .irq = IRQ_PF7,
774 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
775 .bus_num = 0,
776 .chip_select = 1,
777 .controller_data = &spi_ad7879_chip_info,
778 .mode = SPI_CPHA | SPI_CPOL,
779 },
780#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800781#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
782 {
783 .modalias = "spidev",
784 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
785 .bus_num = 0,
786 .chip_select = 1,
787 .controller_data = &spidev_chip_info,
788 },
789#endif
Michael Hennerich2043f3f2008-10-13 14:46:30 +0800790#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
791 {
792 .modalias = "bfin-lq035q1-spi",
793 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
794 .bus_num = 0,
Michael Hennerich46aa04f2008-10-13 11:30:17 +0800795 .chip_select = 2,
Michael Hennerich2043f3f2008-10-13 14:46:30 +0800796 .controller_data = &lq035q1_spi_chip_info,
797 .mode = SPI_CPHA | SPI_CPOL,
798 },
799#endif
Michael Hennerich85a192e2009-01-07 23:14:38 +0800800#if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
801 {
802 .modalias = "enc28j60",
803 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
804 .irq = IRQ_PF6,
805 .bus_num = 0,
806 .chip_select = 0, /* GPIO controlled SSEL */
807 .controller_data = &enc28j60_spi_chip_info,
808 .mode = SPI_MODE_0,
809 },
810#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700811};
812
Mike Frysinger5bda2722008-06-07 15:03:01 +0800813#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wu1394f032007-05-06 14:50:22 -0700814/* SPI controller data */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800815static struct bfin5xx_spi_master bfin_spi0_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700816 .num_chipselect = 8,
817 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800818 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Bryan Wu1394f032007-05-06 14:50:22 -0700819};
820
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800821/* SPI (0) */
822static struct resource bfin_spi0_resource[] = {
823 [0] = {
824 .start = SPI0_REGBASE,
825 .end = SPI0_REGBASE + 0xFF,
826 .flags = IORESOURCE_MEM,
827 },
828 [1] = {
829 .start = CH_SPI,
830 .end = CH_SPI,
831 .flags = IORESOURCE_IRQ,
832 },
833};
834
835static struct platform_device bfin_spi0_device = {
836 .name = "bfin-spi",
837 .id = 0, /* Bus number */
838 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
839 .resource = bfin_spi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -0700840 .dev = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800841 .platform_data = &bfin_spi0_info, /* Passed to driver */
Bryan Wu1394f032007-05-06 14:50:22 -0700842 },
843};
844#endif /* spi master and devices */
845
846#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
847static struct platform_device bfin_fb_device = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800848 .name = "bf537-lq035",
849};
850#endif
851
852#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
853static struct platform_device bfin_fb_adv7393_device = {
854 .name = "bfin-adv7393",
Bryan Wu1394f032007-05-06 14:50:22 -0700855};
856#endif
857
Michael Hennerich2043f3f2008-10-13 14:46:30 +0800858#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
859#include <asm/bfin-lq035q1.h>
860
861static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
862 .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
Michael Hennerich46aa04f2008-10-13 11:30:17 +0800863 .use_bl = 0, /* let something else control the LCD Blacklight */
Michael Hennerich2043f3f2008-10-13 14:46:30 +0800864 .gpio_bl = GPIO_PF7,
865};
866
867static struct resource bfin_lq035q1_resources[] = {
868 {
869 .start = IRQ_PPI_ERROR,
870 .end = IRQ_PPI_ERROR,
871 .flags = IORESOURCE_IRQ,
872 },
873};
874
875static struct platform_device bfin_lq035q1_device = {
876 .name = "bfin-lq035q1",
877 .id = -1,
878 .num_resources = ARRAY_SIZE(bfin_lq035q1_resources),
879 .resource = bfin_lq035q1_resources,
880 .dev = {
881 .platform_data = &bfin_lq035q1_data,
882 },
883};
884#endif
885
Bryan Wu1394f032007-05-06 14:50:22 -0700886#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
887static struct resource bfin_uart_resources[] = {
Sonic Zhang233b28a2007-11-21 17:04:41 +0800888#ifdef CONFIG_SERIAL_BFIN_UART0
Bryan Wu1394f032007-05-06 14:50:22 -0700889 {
890 .start = 0xFFC00400,
891 .end = 0xFFC004FF,
892 .flags = IORESOURCE_MEM,
Sonic Zhang233b28a2007-11-21 17:04:41 +0800893 },
894#endif
895#ifdef CONFIG_SERIAL_BFIN_UART1
896 {
Bryan Wu1394f032007-05-06 14:50:22 -0700897 .start = 0xFFC02000,
898 .end = 0xFFC020FF,
899 .flags = IORESOURCE_MEM,
900 },
Sonic Zhang233b28a2007-11-21 17:04:41 +0800901#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700902};
903
904static struct platform_device bfin_uart_device = {
905 .name = "bfin-uart",
906 .id = 1,
907 .num_resources = ARRAY_SIZE(bfin_uart_resources),
908 .resource = bfin_uart_resources,
909};
910#endif
911
Graf Yang5be36d22008-04-25 03:09:15 +0800912#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang5be36d22008-04-25 03:09:15 +0800913#ifdef CONFIG_BFIN_SIR0
Graf Yang42bd8bc2009-01-07 23:14:39 +0800914static struct resource bfin_sir0_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800915 {
916 .start = 0xFFC00400,
917 .end = 0xFFC004FF,
918 .flags = IORESOURCE_MEM,
919 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800920 {
921 .start = IRQ_UART0_RX,
922 .end = IRQ_UART0_RX+1,
923 .flags = IORESOURCE_IRQ,
924 },
925 {
926 .start = CH_UART0_RX,
927 .end = CH_UART0_RX+1,
928 .flags = IORESOURCE_DMA,
929 },
930};
931
932static struct platform_device bfin_sir0_device = {
933 .name = "bfin_sir",
934 .id = 0,
935 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
936 .resource = bfin_sir0_resources,
937};
Graf Yang5be36d22008-04-25 03:09:15 +0800938#endif
939#ifdef CONFIG_BFIN_SIR1
Graf Yang42bd8bc2009-01-07 23:14:39 +0800940static struct resource bfin_sir1_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800941 {
942 .start = 0xFFC02000,
943 .end = 0xFFC020FF,
944 .flags = IORESOURCE_MEM,
945 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800946 {
947 .start = IRQ_UART1_RX,
948 .end = IRQ_UART1_RX+1,
949 .flags = IORESOURCE_IRQ,
950 },
951 {
952 .start = CH_UART1_RX,
953 .end = CH_UART1_RX+1,
954 .flags = IORESOURCE_DMA,
955 },
Graf Yang5be36d22008-04-25 03:09:15 +0800956};
957
Graf Yang42bd8bc2009-01-07 23:14:39 +0800958static struct platform_device bfin_sir1_device = {
Graf Yang5be36d22008-04-25 03:09:15 +0800959 .name = "bfin_sir",
Graf Yang42bd8bc2009-01-07 23:14:39 +0800960 .id = 1,
961 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
962 .resource = bfin_sir1_resources,
Graf Yang5be36d22008-04-25 03:09:15 +0800963};
964#endif
Graf Yang42bd8bc2009-01-07 23:14:39 +0800965#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800966
Bryan Wu1394f032007-05-06 14:50:22 -0700967#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800968static struct resource bfin_twi0_resource[] = {
969 [0] = {
970 .start = TWI0_REGBASE,
971 .end = TWI0_REGBASE,
972 .flags = IORESOURCE_MEM,
973 },
974 [1] = {
975 .start = IRQ_TWI,
976 .end = IRQ_TWI,
977 .flags = IORESOURCE_IRQ,
978 },
979};
980
Bryan Wu1394f032007-05-06 14:50:22 -0700981static struct platform_device i2c_bfin_twi_device = {
982 .name = "i2c-bfin-twi",
983 .id = 0,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800984 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
985 .resource = bfin_twi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -0700986};
987#endif
988
Michael Hennerich51ed9ad2009-01-07 23:14:38 +0800989#if defined(CONFIG_KEYBOARD_ADP5588) || defined(CONFIG_KEYBOARD_ADP5588_MODULE)
990#include <linux/input.h>
991#include <linux/i2c/adp5588_keys.h>
992static const unsigned short adp5588_keymap[ADP5588_KEYMAPSIZE] = {
993 [0] = KEY_GRAVE,
994 [1] = KEY_1,
995 [2] = KEY_2,
996 [3] = KEY_3,
997 [4] = KEY_4,
998 [5] = KEY_5,
999 [6] = KEY_6,
1000 [7] = KEY_7,
1001 [8] = KEY_8,
1002 [9] = KEY_9,
1003 [10] = KEY_0,
1004 [11] = KEY_MINUS,
1005 [12] = KEY_EQUAL,
1006 [13] = KEY_BACKSLASH,
1007 [15] = KEY_KP0,
1008 [16] = KEY_Q,
1009 [17] = KEY_W,
1010 [18] = KEY_E,
1011 [19] = KEY_R,
1012 [20] = KEY_T,
1013 [21] = KEY_Y,
1014 [22] = KEY_U,
1015 [23] = KEY_I,
1016 [24] = KEY_O,
1017 [25] = KEY_P,
1018 [26] = KEY_LEFTBRACE,
1019 [27] = KEY_RIGHTBRACE,
1020 [29] = KEY_KP1,
1021 [30] = KEY_KP2,
1022 [31] = KEY_KP3,
1023 [32] = KEY_A,
1024 [33] = KEY_S,
1025 [34] = KEY_D,
1026 [35] = KEY_F,
1027 [36] = KEY_G,
1028 [37] = KEY_H,
1029 [38] = KEY_J,
1030 [39] = KEY_K,
1031 [40] = KEY_L,
1032 [41] = KEY_SEMICOLON,
1033 [42] = KEY_APOSTROPHE,
1034 [43] = KEY_BACKSLASH,
1035 [45] = KEY_KP4,
1036 [46] = KEY_KP5,
1037 [47] = KEY_KP6,
1038 [48] = KEY_102ND,
1039 [49] = KEY_Z,
1040 [50] = KEY_X,
1041 [51] = KEY_C,
1042 [52] = KEY_V,
1043 [53] = KEY_B,
1044 [54] = KEY_N,
1045 [55] = KEY_M,
1046 [56] = KEY_COMMA,
1047 [57] = KEY_DOT,
1048 [58] = KEY_SLASH,
1049 [60] = KEY_KPDOT,
1050 [61] = KEY_KP7,
1051 [62] = KEY_KP8,
1052 [63] = KEY_KP9,
1053 [64] = KEY_SPACE,
1054 [65] = KEY_BACKSPACE,
1055 [66] = KEY_TAB,
1056 [67] = KEY_KPENTER,
1057 [68] = KEY_ENTER,
1058 [69] = KEY_ESC,
1059 [70] = KEY_DELETE,
1060 [74] = KEY_KPMINUS,
1061 [76] = KEY_UP,
1062 [77] = KEY_DOWN,
1063 [78] = KEY_RIGHT,
1064 [79] = KEY_LEFT,
1065};
1066
1067static struct adp5588_kpad_platform_data adp5588_kpad_data = {
1068 .rows = 8,
1069 .cols = 10,
1070 .keymap = adp5588_keymap,
1071 .keymapsize = ARRAY_SIZE(adp5588_keymap),
1072 .repeat = 0,
1073};
1074#endif
1075
Bryan Wu81d9c7f2008-03-26 10:02:13 +08001076static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
1077#if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
1078 {
1079 I2C_BOARD_INFO("ad7142_joystick", 0x2C),
Michael Hennerichf5150152008-10-16 23:23:18 +08001080 .irq = IRQ_PF5,
Bryan Wu81d9c7f2008-03-26 10:02:13 +08001081 },
1082#endif
1083#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
1084 {
1085 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
Bryan Wu81d9c7f2008-03-26 10:02:13 +08001086 },
1087#endif
1088#if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
1089 {
1090 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
Michael Hennerichf5150152008-10-16 23:23:18 +08001091 .irq = IRQ_PG6,
1092 },
1093#endif
1094#if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) || defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)
1095 {
1096 I2C_BOARD_INFO("ad7879", 0x2F),
1097 .irq = IRQ_PG5,
1098 .platform_data = (void *)&bfin_ad7879_ts_info,
Bryan Wu81d9c7f2008-03-26 10:02:13 +08001099 },
1100#endif
Michael Hennerich51ed9ad2009-01-07 23:14:38 +08001101#if defined(CONFIG_KEYBOARD_ADP5588) || defined(CONFIG_KEYBOARD_ADP5588_MODULE)
1102 {
1103 I2C_BOARD_INFO("adp5588-keys", 0x34),
1104 .irq = IRQ_PG0,
1105 .platform_data = (void *)&adp5588_kpad_data,
1106 },
1107#endif
Bryan Wu81d9c7f2008-03-26 10:02:13 +08001108};
Bryan Wu81d9c7f2008-03-26 10:02:13 +08001109
Bryan Wu1394f032007-05-06 14:50:22 -07001110#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1111static struct platform_device bfin_sport0_uart_device = {
1112 .name = "bfin-sport-uart",
1113 .id = 0,
1114};
1115
1116static struct platform_device bfin_sport1_uart_device = {
1117 .name = "bfin-sport-uart",
1118 .id = 1,
1119};
1120#endif
1121
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001122#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
Mike Frysinger96b86e92008-07-14 16:39:43 +08001123#define PATA_INT IRQ_PF5
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001124
1125static struct pata_platform_info bfin_pata_platform_data = {
1126 .ioport_shift = 1,
Mike Frysinger64e5c512007-10-30 11:56:13 +08001127 .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001128};
1129
1130static struct resource bfin_pata_resources[] = {
1131 {
1132 .start = 0x20314020,
1133 .end = 0x2031403F,
1134 .flags = IORESOURCE_MEM,
1135 },
1136 {
1137 .start = 0x2031401C,
1138 .end = 0x2031401F,
1139 .flags = IORESOURCE_MEM,
1140 },
1141 {
1142 .start = PATA_INT,
1143 .end = PATA_INT,
1144 .flags = IORESOURCE_IRQ,
1145 },
1146};
1147
1148static struct platform_device bfin_pata_device = {
1149 .name = "pata_platform",
1150 .id = -1,
1151 .num_resources = ARRAY_SIZE(bfin_pata_resources),
1152 .resource = bfin_pata_resources,
1153 .dev = {
1154 .platform_data = &bfin_pata_platform_data,
1155 }
1156};
1157#endif
1158
Michael Hennerich14b03202008-05-07 11:41:26 +08001159static const unsigned int cclk_vlev_datasheet[] =
1160{
1161 VRPAIR(VLEV_085, 250000000),
1162 VRPAIR(VLEV_090, 376000000),
1163 VRPAIR(VLEV_095, 426000000),
1164 VRPAIR(VLEV_100, 426000000),
1165 VRPAIR(VLEV_105, 476000000),
1166 VRPAIR(VLEV_110, 476000000),
1167 VRPAIR(VLEV_115, 476000000),
1168 VRPAIR(VLEV_120, 500000000),
1169 VRPAIR(VLEV_125, 533000000),
1170 VRPAIR(VLEV_130, 600000000),
1171};
1172
1173static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
1174 .tuple_tab = cclk_vlev_datasheet,
1175 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
1176 .vr_settling_time = 25 /* us */,
1177};
1178
1179static struct platform_device bfin_dpmc = {
1180 .name = "bfin dpmc",
1181 .dev = {
1182 .platform_data = &bfin_dmpc_vreg_data,
1183 },
1184};
1185
Bryan Wu1394f032007-05-06 14:50:22 -07001186static struct platform_device *stamp_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +08001187
1188 &bfin_dpmc,
1189
Bryan Wu1394f032007-05-06 14:50:22 -07001190#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
1191 &bfin_pcmcia_cf_device,
1192#endif
1193
1194#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
1195 &rtc_device,
1196#endif
1197
1198#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
1199 &sl811_hcd_device,
1200#endif
1201
1202#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
1203 &isp1362_hcd_device,
1204#endif
1205
Michael Hennerich3f375692008-11-18 17:48:22 +08001206#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
1207 &bfin_isp1760_device,
1208#endif
1209
Bryan Wu1394f032007-05-06 14:50:22 -07001210#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
1211 &smc91x_device,
1212#endif
1213
Alex Landauf40d24d2007-07-12 12:11:48 +08001214#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
1215 &dm9000_device,
1216#endif
1217
Michael Hennerich561cc182007-11-17 23:56:08 +08001218#if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
1219 &ax88180_device,
1220#endif
1221
Bryan Wu1394f032007-05-06 14:50:22 -07001222#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
Graf Yang65319622009-02-04 16:49:45 +08001223 &bfin_mii_bus,
Bryan Wu1394f032007-05-06 14:50:22 -07001224 &bfin_mac_device,
1225#endif
1226
1227#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
1228 &net2272_bfin_device,
1229#endif
1230
1231#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001232 &bfin_spi0_device,
Bryan Wu1394f032007-05-06 14:50:22 -07001233#endif
1234
1235#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
1236 &bfin_fb_device,
1237#endif
1238
Michael Hennerich2043f3f2008-10-13 14:46:30 +08001239#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
1240 &bfin_lq035q1_device,
1241#endif
1242
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001243#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
1244 &bfin_fb_adv7393_device,
1245#endif
1246
Bryan Wu1394f032007-05-06 14:50:22 -07001247#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1248 &bfin_uart_device,
1249#endif
1250
Graf Yang5be36d22008-04-25 03:09:15 +08001251#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang42bd8bc2009-01-07 23:14:39 +08001252#ifdef CONFIG_BFIN_SIR0
1253 &bfin_sir0_device,
1254#endif
1255#ifdef CONFIG_BFIN_SIR1
1256 &bfin_sir1_device,
1257#endif
Graf Yang5be36d22008-04-25 03:09:15 +08001258#endif
1259
Bryan Wu1394f032007-05-06 14:50:22 -07001260#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1261 &i2c_bfin_twi_device,
1262#endif
1263
1264#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1265 &bfin_sport0_uart_device,
1266 &bfin_sport1_uart_device,
1267#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001268
1269#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
1270 &bfin_pata_device,
1271#endif
Michael Hennerich2463ef22008-01-27 16:49:48 +08001272
1273#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1274 &bfin_device_gpiokeys,
1275#endif
Mike Frysingercad2ab62008-02-22 17:01:31 +08001276
1277 &bfin_gpios_device,
Mike Frysinger793dc272008-03-26 08:09:12 +08001278
Mike Frysingerfc689112008-06-25 11:41:42 +08001279#if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
1280 &bfin_async_nand_device,
1281#endif
1282
Mike Frysinger793dc272008-03-26 08:09:12 +08001283#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +08001284 &stamp_flash_device,
Mike Frysinger793dc272008-03-26 08:09:12 +08001285#endif
Bryan Wu1394f032007-05-06 14:50:22 -07001286};
1287
1288static int __init stamp_init(void)
1289{
Harvey Harrisonb85d8582008-04-23 09:39:01 +08001290 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Bryan Wu81d9c7f2008-03-26 10:02:13 +08001291 i2c_register_board_info(0, bfin_i2c_board_info,
1292 ARRAY_SIZE(bfin_i2c_board_info));
Mike Frysingerfc689112008-06-25 11:41:42 +08001293 bfin_plat_nand_init();
Bryan Wu1394f032007-05-06 14:50:22 -07001294 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
Mike Frysinger5bda2722008-06-07 15:03:01 +08001295 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001296
1297#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
1298 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
1299#endif
Bryan Wu81d9c7f2008-03-26 10:02:13 +08001300
Bryan Wu1394f032007-05-06 14:50:22 -07001301 return 0;
1302}
1303
1304arch_initcall(stamp_init);
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001305
1306void native_machine_restart(char *cmd)
1307{
1308 /* workaround reboot hang when booting from SPI */
1309 if ((bfin_read_SYSCR() & 0x7) == 0x3)
Sonic Zhangb52dae32009-02-04 16:49:45 +08001310 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001311}
Mike Frysinger137b1522007-11-22 16:07:03 +08001312
1313/*
1314 * Currently the MAC address is saved in Flash by U-Boot
1315 */
1316#define FLASH_MAC 0x203f0000
Mike Frysinger9862cc52007-11-15 21:21:20 +08001317void bfin_get_ether_addr(char *addr)
Mike Frysinger137b1522007-11-22 16:07:03 +08001318{
1319 *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
1320 *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
1321}
Mike Frysinger9862cc52007-11-15 21:21:20 +08001322EXPORT_SYMBOL(bfin_get_ether_addr);