blob: 7ce7d943b0cbad2fd80def8b7a378ad4b8e88041 [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,
Michael Hennerich3f375692008-11-18 17:48:22 +080082 .bus_width_16 = 1,
83 .port1_otg = 0,
84 .analog_oc = 0,
85 .dack_polarity_high = 0,
86 .dreq_polarity_high = 0,
87};
88
89static struct platform_device bfin_isp1760_device = {
90 .name = "isp1760-hcd",
Bryan Wu1394f032007-05-06 14:50:22 -070091 .id = 0,
Michael Hennerich3f375692008-11-18 17:48:22 +080092 .dev = {
93 .platform_data = &isp1760_priv,
94 },
95 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
96 .resource = bfin_isp1760_resources,
Bryan Wu1394f032007-05-06 14:50:22 -070097};
Bryan Wu1394f032007-05-06 14:50:22 -070098#endif
99
Michael Hennerich2463ef22008-01-27 16:49:48 +0800100#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
101#include <linux/input.h>
102#include <linux/gpio_keys.h>
103
104static struct gpio_keys_button bfin_gpio_keys_table[] = {
105 {BTN_0, GPIO_PF2, 1, "gpio-keys: BTN0"},
106 {BTN_1, GPIO_PF3, 1, "gpio-keys: BTN1"},
107 {BTN_2, GPIO_PF4, 1, "gpio-keys: BTN2"},
108 {BTN_3, GPIO_PF5, 1, "gpio-keys: BTN3"},
109};
110
111static struct gpio_keys_platform_data bfin_gpio_keys_data = {
112 .buttons = bfin_gpio_keys_table,
113 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
114};
115
116static struct platform_device bfin_device_gpiokeys = {
117 .name = "gpio-keys",
118 .dev = {
119 .platform_data = &bfin_gpio_keys_data,
120 },
121};
122#endif
123
Mike Frysingercad2ab62008-02-22 17:01:31 +0800124static struct resource bfin_gpios_resources = {
125 .start = 0,
126 .end = MAX_BLACKFIN_GPIOS - 1,
127 .flags = IORESOURCE_IRQ,
128};
129
130static struct platform_device bfin_gpios_device = {
131 .name = "simple-gpio",
132 .id = -1,
133 .num_resources = 1,
134 .resource = &bfin_gpios_resources,
135};
136
Bryan Wu1394f032007-05-06 14:50:22 -0700137#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
138static struct resource bfin_pcmcia_cf_resources[] = {
139 {
140 .start = 0x20310000, /* IO PORT */
141 .end = 0x20312000,
142 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800143 }, {
Simon Arlottd2d50aa2007-06-11 15:31:30 +0800144 .start = 0x20311000, /* Attribute Memory */
Bryan Wu1394f032007-05-06 14:50:22 -0700145 .end = 0x20311FFF,
146 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800147 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700148 .start = IRQ_PF4,
149 .end = IRQ_PF4,
150 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800151 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700152 .start = 6, /* Card Detect PF6 */
153 .end = 6,
154 .flags = IORESOURCE_IRQ,
155 },
156};
157
158static struct platform_device bfin_pcmcia_cf_device = {
159 .name = "bfin_cf_pcmcia",
160 .id = -1,
161 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
162 .resource = bfin_pcmcia_cf_resources,
163};
164#endif
165
166#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
167static struct platform_device rtc_device = {
168 .name = "rtc-bfin",
169 .id = -1,
170};
171#endif
172
173#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
Michael Hennerich61f09b52009-07-24 08:48:31 +0000174#include <linux/smc91x.h>
175
176static struct smc91x_platdata smc91x_info = {
177 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
178 .leda = RPC_LED_100_10,
179 .ledb = RPC_LED_TX_RX,
180};
181
Bryan Wu1394f032007-05-06 14:50:22 -0700182static struct resource smc91x_resources[] = {
183 {
184 .name = "smc91x-regs",
185 .start = 0x20300300,
186 .end = 0x20300300 + 16,
187 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800188 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700189
190 .start = IRQ_PF7,
191 .end = IRQ_PF7,
192 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
193 },
194};
195static struct platform_device smc91x_device = {
196 .name = "smc91x",
197 .id = 0,
198 .num_resources = ARRAY_SIZE(smc91x_resources),
199 .resource = smc91x_resources,
Michael Hennerich61f09b52009-07-24 08:48:31 +0000200 .dev = {
201 .platform_data = &smc91x_info,
202 },
Bryan Wu1394f032007-05-06 14:50:22 -0700203};
204#endif
205
Alex Landauf40d24d2007-07-12 12:11:48 +0800206#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
207static struct resource dm9000_resources[] = {
208 [0] = {
209 .start = 0x203FB800,
Barry Songb3dec4a2009-07-27 06:42:50 +0000210 .end = 0x203FB800 + 1,
Alex Landauf40d24d2007-07-12 12:11:48 +0800211 .flags = IORESOURCE_MEM,
212 },
213 [1] = {
Barry Songb3dec4a2009-07-27 06:42:50 +0000214 .start = 0x203FB804,
215 .end = 0x203FB804 + 1,
216 .flags = IORESOURCE_MEM,
217 },
218 [2] = {
Alex Landauf40d24d2007-07-12 12:11:48 +0800219 .start = IRQ_PF9,
220 .end = IRQ_PF9,
221 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
222 },
223};
224
225static struct platform_device dm9000_device = {
226 .name = "dm9000",
227 .id = -1,
228 .num_resources = ARRAY_SIZE(dm9000_resources),
229 .resource = dm9000_resources,
230};
231#endif
232
Michael Hennerich561cc182007-11-17 23:56:08 +0800233#if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
234static struct resource ax88180_resources[] = {
235 [0] = {
236 .start = 0x20300000,
237 .end = 0x20300000 + 0x8000,
238 .flags = IORESOURCE_MEM,
239 },
240 [1] = {
241 .start = IRQ_PF7,
242 .end = IRQ_PF7,
243 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL),
244 },
245};
246
247static struct platform_device ax88180_device = {
248 .name = "ax88180",
249 .id = -1,
250 .num_resources = ARRAY_SIZE(ax88180_resources),
251 .resource = ax88180_resources,
252};
253#endif
254
Bryan Wu1394f032007-05-06 14:50:22 -0700255#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
256static struct resource sl811_hcd_resources[] = {
257 {
258 .start = 0x20340000,
259 .end = 0x20340000,
260 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800261 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700262 .start = 0x20340004,
263 .end = 0x20340004,
264 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800265 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700266 .start = CONFIG_USB_SL811_BFIN_IRQ,
267 .end = CONFIG_USB_SL811_BFIN_IRQ,
268 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
269 },
270};
271
272#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
273void sl811_port_power(struct device *dev, int is_on)
274{
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800275 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
Michael Hennerichacbcd262008-01-22 18:36:20 +0800276 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
Bryan Wu1394f032007-05-06 14:50:22 -0700277}
278#endif
279
280static struct sl811_platform_data sl811_priv = {
281 .potpg = 10,
282 .power = 250, /* == 500mA */
283#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
284 .port_power = &sl811_port_power,
285#endif
286};
287
288static struct platform_device sl811_hcd_device = {
289 .name = "sl811-hcd",
290 .id = 0,
291 .dev = {
292 .platform_data = &sl811_priv,
293 },
294 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
295 .resource = sl811_hcd_resources,
296};
297#endif
298
299#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
300static struct resource isp1362_hcd_resources[] = {
301 {
302 .start = 0x20360000,
303 .end = 0x20360000,
304 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800305 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700306 .start = 0x20360004,
307 .end = 0x20360004,
308 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800309 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700310 .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
311 .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
312 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
313 },
314};
315
316static struct isp1362_platform_data isp1362_priv = {
317 .sel15Kres = 1,
318 .clknotstop = 0,
319 .oc_enable = 0,
320 .int_act_high = 0,
321 .int_edge_triggered = 0,
322 .remote_wakeup_connected = 0,
323 .no_power_switching = 1,
324 .power_switching_mode = 0,
325};
326
327static struct platform_device isp1362_hcd_device = {
328 .name = "isp1362-hcd",
329 .id = 0,
330 .dev = {
331 .platform_data = &isp1362_priv,
332 },
333 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
334 .resource = isp1362_hcd_resources,
335};
336#endif
337
338#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
Graf Yang65319622009-02-04 16:49:45 +0800339static struct platform_device bfin_mii_bus = {
340 .name = "bfin_mii_bus",
341};
342
Bryan Wu1394f032007-05-06 14:50:22 -0700343static struct platform_device bfin_mac_device = {
344 .name = "bfin_mac",
Graf Yang65319622009-02-04 16:49:45 +0800345 .dev.platform_data = &bfin_mii_bus,
Bryan Wu1394f032007-05-06 14:50:22 -0700346};
347#endif
348
349#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
350static struct resource net2272_bfin_resources[] = {
351 {
352 .start = 0x20300000,
353 .end = 0x20300000 + 0x100,
354 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800355 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700356 .start = IRQ_PF7,
357 .end = IRQ_PF7,
358 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
359 },
360};
361
362static struct platform_device net2272_bfin_device = {
363 .name = "net2272",
364 .id = -1,
365 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
366 .resource = net2272_bfin_resources,
367};
368#endif
369
Mike Frysingerfc689112008-06-25 11:41:42 +0800370#if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
371#ifdef CONFIG_MTD_PARTITIONS
372const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };
373
374static struct mtd_partition bfin_plat_nand_partitions[] = {
375 {
Robin Getzaa582972008-08-05 17:47:29 +0800376 .name = "linux kernel(nand)",
Mike Frysingerfc689112008-06-25 11:41:42 +0800377 .size = 0x400000,
378 .offset = 0,
379 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800380 .name = "file system(nand)",
Mike Frysingerfc689112008-06-25 11:41:42 +0800381 .size = MTDPART_SIZ_FULL,
382 .offset = MTDPART_OFS_APPEND,
383 },
384};
385#endif
386
387#define BFIN_NAND_PLAT_CLE 2
388#define BFIN_NAND_PLAT_ALE 1
389static void bfin_plat_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
390{
391 struct nand_chip *this = mtd->priv;
392
393 if (cmd == NAND_CMD_NONE)
394 return;
395
396 if (ctrl & NAND_CLE)
397 writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_CLE));
398 else
399 writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_ALE));
400}
401
402#define BFIN_NAND_PLAT_READY GPIO_PF3
403static int bfin_plat_nand_dev_ready(struct mtd_info *mtd)
404{
405 return gpio_get_value(BFIN_NAND_PLAT_READY);
406}
407
408static struct platform_nand_data bfin_plat_nand_data = {
409 .chip = {
410 .chip_delay = 30,
411#ifdef CONFIG_MTD_PARTITIONS
412 .part_probe_types = part_probes,
413 .partitions = bfin_plat_nand_partitions,
414 .nr_partitions = ARRAY_SIZE(bfin_plat_nand_partitions),
415#endif
416 },
417 .ctrl = {
418 .cmd_ctrl = bfin_plat_nand_cmd_ctrl,
419 .dev_ready = bfin_plat_nand_dev_ready,
420 },
421};
422
423#define MAX(x, y) (x > y ? x : y)
424static struct resource bfin_plat_nand_resources = {
425 .start = 0x20212000,
426 .end = 0x20212000 + (1 << MAX(BFIN_NAND_PLAT_CLE, BFIN_NAND_PLAT_ALE)),
427 .flags = IORESOURCE_IO,
428};
429
430static struct platform_device bfin_async_nand_device = {
431 .name = "gen_nand",
432 .id = -1,
433 .num_resources = 1,
434 .resource = &bfin_plat_nand_resources,
435 .dev = {
436 .platform_data = &bfin_plat_nand_data,
437 },
438};
439
440static void bfin_plat_nand_init(void)
441{
442 gpio_request(BFIN_NAND_PLAT_READY, "bfin_nand_plat");
443}
444#else
445static void bfin_plat_nand_init(void) {}
446#endif
447
Mike Frysinger793dc272008-03-26 08:09:12 +0800448#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800449static struct mtd_partition stamp_partitions[] = {
450 {
Robin Getzaa582972008-08-05 17:47:29 +0800451 .name = "bootloader(nor)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800452 .size = 0x40000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800453 .offset = 0,
454 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800455 .name = "linux kernel(nor)",
Grace Pan6ecb5b62009-01-07 23:14:38 +0800456 .size = 0x180000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800457 .offset = MTDPART_OFS_APPEND,
458 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800459 .name = "file system(nor)",
Grace Pan6ecb5b62009-01-07 23:14:38 +0800460 .size = 0x400000 - 0x40000 - 0x180000 - 0x10000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800461 .offset = MTDPART_OFS_APPEND,
462 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800463 .name = "MAC Address(nor)",
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800464 .size = MTDPART_SIZ_FULL,
465 .offset = 0x3F0000,
466 .mask_flags = MTD_WRITEABLE,
467 }
468};
469
470static struct physmap_flash_data stamp_flash_data = {
471 .width = 2,
472 .parts = stamp_partitions,
473 .nr_parts = ARRAY_SIZE(stamp_partitions),
474};
475
476static struct resource stamp_flash_resource = {
477 .start = 0x20000000,
478 .end = 0x203fffff,
479 .flags = IORESOURCE_MEM,
480};
481
482static struct platform_device stamp_flash_device = {
483 .name = "physmap-flash",
484 .id = 0,
485 .dev = {
486 .platform_data = &stamp_flash_data,
487 },
488 .num_resources = 1,
489 .resource = &stamp_flash_resource,
490};
Mike Frysinger793dc272008-03-26 08:09:12 +0800491#endif
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800492
Bryan Wu1394f032007-05-06 14:50:22 -0700493#if defined(CONFIG_MTD_M25P80) \
494 || defined(CONFIG_MTD_M25P80_MODULE)
495static struct mtd_partition bfin_spi_flash_partitions[] = {
496 {
Robin Getzaa582972008-08-05 17:47:29 +0800497 .name = "bootloader(spi)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800498 .size = 0x00040000,
Bryan Wu1394f032007-05-06 14:50:22 -0700499 .offset = 0,
500 .mask_flags = MTD_CAP_ROM
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800501 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800502 .name = "linux kernel(spi)",
Grace Pan6ecb5b62009-01-07 23:14:38 +0800503 .size = 0x180000,
Mike Frysingeredf05642008-02-25 11:38:11 +0800504 .offset = MTDPART_OFS_APPEND,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800505 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800506 .name = "file system(spi)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800507 .size = MTDPART_SIZ_FULL,
508 .offset = MTDPART_OFS_APPEND,
Bryan Wu1394f032007-05-06 14:50:22 -0700509 }
510};
511
512static struct flash_platform_data bfin_spi_flash_data = {
513 .name = "m25p80",
514 .parts = bfin_spi_flash_partitions,
515 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
Michael Hennerich88a8078b32008-11-18 17:48:22 +0800516 /* .type = "m25p64", */
Bryan Wu1394f032007-05-06 14:50:22 -0700517};
518
519/* SPI flash chip (m25p64) */
520static struct bfin5xx_spi_chip spi_flash_chip_info = {
521 .enable_dma = 0, /* use dma transfer with this chip*/
522 .bits_per_word = 8,
523};
524#endif
525
Mike Frysingera261eec2009-05-20 14:05:36 +0000526#if defined(CONFIG_BFIN_SPI_ADC) \
527 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
Bryan Wu1394f032007-05-06 14:50:22 -0700528/* SPI ADC chip */
529static struct bfin5xx_spi_chip spi_adc_chip_info = {
530 .enable_dma = 1, /* use dma transfer with this chip*/
531 .bits_per_word = 16,
532};
533#endif
534
Barry Song83124402009-08-06 21:03:02 +0000535#if defined(CONFIG_SND_BF5XX_SOC_AD1836) \
536 || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
Bryan Wu1394f032007-05-06 14:50:22 -0700537static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
538 .enable_dma = 0,
539 .bits_per_word = 16,
540};
541#endif
542
Barry Songd4b834c2009-06-04 10:14:17 +0000543#if defined(CONFIG_SND_BF5XX_SOC_AD1938) \
544 || defined(CONFIG_SND_BF5XX_SOC_AD1938_MODULE)
545static struct bfin5xx_spi_chip ad1938_spi_chip_info = {
546 .enable_dma = 0,
547 .bits_per_word = 8,
548 .cs_gpio = GPIO_PF5,
549};
550#endif
551
Barry Song427f2772009-07-17 07:04:55 +0000552#if defined(CONFIG_INPUT_EVAL_AD7147EBZ)
553#include <linux/input.h>
554#include <linux/input/ad714x.h>
555static struct bfin5xx_spi_chip ad7147_spi_chip_info = {
556 .enable_dma = 0,
557 .bits_per_word = 16,
558};
559
560static struct ad714x_slider_plat slider_plat[] = {
561 {
562 .start_stage = 0,
563 .end_stage = 7,
564 .max_coord = 128,
565 },
566};
567
568static struct ad714x_button_plat button_plat[] = {
569 {
570 .keycode = BTN_FORWARD,
571 .l_mask = 0,
572 .h_mask = 0x600,
573 },
574 {
575 .keycode = BTN_LEFT,
576 .l_mask = 0,
577 .h_mask = 0x500,
578 },
579 {
580 .keycode = BTN_MIDDLE,
581 .l_mask = 0,
582 .h_mask = 0x800,
583 },
584 {
585 .keycode = BTN_RIGHT,
586 .l_mask = 0x100,
587 .h_mask = 0x400,
588 },
589 {
590 .keycode = BTN_BACK,
591 .l_mask = 0x200,
592 .h_mask = 0x400,
593 },
594};
595static struct ad714x_platform_data ad7147_platfrom_data = {
596 .slider_num = 1,
597 .button_num = 5,
598 .slider = slider_plat,
599 .button = button_plat,
600 .stage_cfg_reg = {
601 {0xFBFF, 0x1FFF, 0, 0x2626, 1600, 1600, 1600, 1600},
602 {0xEFFF, 0x1FFF, 0, 0x2626, 1650, 1650, 1650, 1650},
603 {0xFFFF, 0x1FFE, 0, 0x2626, 1650, 1650, 1650, 1650},
604 {0xFFFF, 0x1FFB, 0, 0x2626, 1650, 1650, 1650, 1650},
605 {0xFFFF, 0x1FEF, 0, 0x2626, 1650, 1650, 1650, 1650},
606 {0xFFFF, 0x1FBF, 0, 0x2626, 1650, 1650, 1650, 1650},
607 {0xFFFF, 0x1EFF, 0, 0x2626, 1650, 1650, 1650, 1650},
608 {0xFFFF, 0x1BFF, 0, 0x2626, 1600, 1600, 1600, 1600},
609 {0xFF7B, 0x3FFF, 0x506, 0x2626, 1100, 1100, 1150, 1150},
610 {0xFDFE, 0x3FFF, 0x606, 0x2626, 1100, 1100, 1150, 1150},
611 {0xFEBA, 0x1FFF, 0x1400, 0x2626, 1200, 1200, 1300, 1300},
612 {0xFFEF, 0x1FFF, 0x0, 0x2626, 1100, 1100, 1150, 1150},
613 },
614 .sys_cfg_reg = {0x2B2, 0x0, 0x3233, 0x819, 0x832, 0xCFF, 0xCFF, 0x0},
615};
616#endif
617
618#if defined(CONFIG_INPUT_EVAL_AD7142EB)
619#include <linux/input.h>
620#include <linux/input/ad714x.h>
621static struct ad714x_button_plat button_plat[] = {
622 {
623 .keycode = BTN_1,
624 .l_mask = 0,
625 .h_mask = 0x1,
626 },
627 {
628 .keycode = BTN_2,
629 .l_mask = 0,
630 .h_mask = 0x2,
631 },
632 {
633 .keycode = BTN_3,
634 .l_mask = 0,
635 .h_mask = 0x4,
636 },
637 {
638 .keycode = BTN_4,
639 .l_mask = 0x0,
640 .h_mask = 0x8,
641 },
642};
643static struct ad714x_platform_data ad7142_platfrom_data = {
644 .button_num = 4,
645 .button = button_plat,
646 .stage_cfg_reg = {
647 /* fixme: figure out right setting for all comoponent according
648 * to hardware feature of EVAL-AD7142EB board */
649 {0xE7FF, 0x3FFF, 0x0005, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
650 {0xFDBF, 0x3FFF, 0x0001, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
651 {0xFFFF, 0x2DFF, 0x0001, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
652 {0xFFFF, 0x37BF, 0x0001, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
653 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
654 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
655 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
656 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
657 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
658 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
659 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
660 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
661 },
662 .sys_cfg_reg = {0x0B2, 0x0, 0x690, 0x664, 0x290F, 0xF, 0xF, 0x0},
663};
664#endif
665
Yi Lif79ea4c2009-01-07 23:14:38 +0800666#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
667#define MMC_SPI_CARD_DETECT_INT IRQ_PF5
668
669static int bfin_mmc_spi_init(struct device *dev,
670 irqreturn_t (*detect_int)(int, void *), void *data)
671{
672 return request_irq(MMC_SPI_CARD_DETECT_INT, detect_int,
673 IRQF_TRIGGER_FALLING, "mmc-spi-detect", data);
674}
675
676static void bfin_mmc_spi_exit(struct device *dev, void *data)
677{
678 free_irq(MMC_SPI_CARD_DETECT_INT, data);
679}
680
681static struct mmc_spi_platform_data bfin_mmc_spi_pdata = {
682 .init = bfin_mmc_spi_init,
683 .exit = bfin_mmc_spi_exit,
684 .detect_delay = 100, /* msecs */
685};
686
687static struct bfin5xx_spi_chip mmc_spi_chip_info = {
688 .enable_dma = 0,
689 .bits_per_word = 8,
Yi Lie68d1eb2009-06-03 09:46:22 +0000690 .pio_interrupt = 0,
Yi Lif79ea4c2009-01-07 23:14:38 +0800691};
692#endif
693
Bryan Wu1394f032007-05-06 14:50:22 -0700694#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
Michael Hennerich46aa04f2008-10-13 11:30:17 +0800695#include <linux/spi/ad7877.h>
Bryan Wu1394f032007-05-06 14:50:22 -0700696static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700697 .enable_dma = 0,
698 .bits_per_word = 16,
699};
700
701static const struct ad7877_platform_data bfin_ad7877_ts_info = {
702 .model = 7877,
703 .vref_delay_usecs = 50, /* internal, no capacitor */
704 .x_plate_ohms = 419,
705 .y_plate_ohms = 486,
706 .pressure_max = 1000,
707 .pressure_min = 0,
708 .stopacq_polarity = 1,
709 .first_conversion_delay = 3,
710 .acquisition_time = 1,
711 .averaging = 1,
712 .pen_down_acc_interval = 1,
713};
714#endif
715
Michael Hennerich46aa04f2008-10-13 11:30:17 +0800716#if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
717#include <linux/spi/ad7879.h>
Michael Hennerich46aa04f2008-10-13 11:30:17 +0800718static const struct ad7879_platform_data bfin_ad7879_ts_info = {
719 .model = 7879, /* Model = AD7879 */
720 .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
721 .pressure_max = 10000,
722 .pressure_min = 0,
723 .first_conversion_delay = 3, /* wait 512us before do a first conversion */
724 .acquisition_time = 1, /* 4us acquisition time per sample */
725 .median = 2, /* do 8 measurements */
726 .averaging = 1, /* take the average of 4 middle samples */
727 .pen_down_acc_interval = 255, /* 9.4 ms */
728 .gpio_output = 1, /* configure AUX/VBAT/GPIO as GPIO output */
729 .gpio_default = 1, /* During initialization set GPIO = HIGH */
730};
731#endif
732
Michael Hennerichffc4d8b2009-05-29 15:41:18 +0000733#if defined(CONFIG_INPUT_ADXL34X) || defined(CONFIG_INPUT_ADXL34X_MODULE)
734#include <linux/input.h>
735#include <linux/spi/adxl34x.h>
736static const struct adxl34x_platform_data adxl34x_info = {
737 .x_axis_offset = 0,
738 .y_axis_offset = 0,
739 .z_axis_offset = 0,
740 .tap_threshold = 0x31,
741 .tap_duration = 0x10,
742 .tap_latency = 0x60,
743 .tap_window = 0xF0,
744 .tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,
745 .act_axis_control = 0xFF,
746 .activity_threshold = 5,
747 .inactivity_threshold = 3,
748 .inactivity_time = 4,
749 .free_fall_threshold = 0x7,
750 .free_fall_time = 0x20,
751 .data_rate = 0x8,
752 .data_range = ADXL_FULL_RES,
753
754 .ev_type = EV_ABS,
755 .ev_code_x = ABS_X, /* EV_REL */
756 .ev_code_y = ABS_Y, /* EV_REL */
757 .ev_code_z = ABS_Z, /* EV_REL */
758
759 .ev_code_tap_x = BTN_TOUCH, /* EV_KEY */
760 .ev_code_tap_y = BTN_TOUCH, /* EV_KEY */
761 .ev_code_tap_z = BTN_TOUCH, /* EV_KEY */
762
763/* .ev_code_ff = KEY_F,*/ /* EV_KEY */
764/* .ev_code_act_inactivity = KEY_A,*/ /* EV_KEY */
765 .power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
766 .fifo_mode = ADXL_FIFO_STREAM,
767};
768#endif
769
Michael Hennerichf5150152008-10-16 23:23:18 +0800770#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
771static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
772 .enable_dma = 0,
773 .bits_per_word = 16,
774};
775#endif
776
Michael Hennerich6e668932008-02-09 01:54:09 +0800777#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
778static struct bfin5xx_spi_chip spidev_chip_info = {
779 .enable_dma = 0,
780 .bits_per_word = 8,
781};
782#endif
783
Michael Hennerich2043f3f2008-10-13 14:46:30 +0800784#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
785static struct bfin5xx_spi_chip lq035q1_spi_chip_info = {
786 .enable_dma = 0,
787 .bits_per_word = 8,
788};
789#endif
790
Michael Hennerich85a192e2009-01-07 23:14:38 +0800791#if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
792static struct bfin5xx_spi_chip enc28j60_spi_chip_info = {
793 .enable_dma = 1,
794 .bits_per_word = 8,
795 .cs_gpio = GPIO_PF10,
796};
797#endif
798
Michael Hennerich8e9d5c72008-04-24 08:46:19 +0800799#if defined(CONFIG_MTD_DATAFLASH) \
800 || defined(CONFIG_MTD_DATAFLASH_MODULE)
Michael Hennerichceac2652008-08-25 17:39:11 +0800801
802static struct mtd_partition bfin_spi_dataflash_partitions[] = {
803 {
804 .name = "bootloader(spi)",
805 .size = 0x00040000,
806 .offset = 0,
807 .mask_flags = MTD_CAP_ROM
808 }, {
809 .name = "linux kernel(spi)",
Grace Pan6ecb5b62009-01-07 23:14:38 +0800810 .size = 0x180000,
Michael Hennerichceac2652008-08-25 17:39:11 +0800811 .offset = MTDPART_OFS_APPEND,
812 }, {
813 .name = "file system(spi)",
814 .size = MTDPART_SIZ_FULL,
815 .offset = MTDPART_OFS_APPEND,
816 }
817};
818
819static struct flash_platform_data bfin_spi_dataflash_data = {
820 .name = "SPI Dataflash",
821 .parts = bfin_spi_dataflash_partitions,
822 .nr_parts = ARRAY_SIZE(bfin_spi_dataflash_partitions),
823};
824
Michael Hennerich8e9d5c72008-04-24 08:46:19 +0800825/* DataFlash chip */
826static struct bfin5xx_spi_chip data_flash_chip_info = {
827 .enable_dma = 0, /* use dma transfer with this chip*/
828 .bits_per_word = 8,
829};
830#endif
831
Bryan Wu1394f032007-05-06 14:50:22 -0700832static struct spi_board_info bfin_spi_board_info[] __initdata = {
833#if defined(CONFIG_MTD_M25P80) \
834 || defined(CONFIG_MTD_M25P80_MODULE)
835 {
836 /* the modalias must be the same as spi device driver name */
837 .modalias = "m25p80", /* Name of spi_driver for this device */
838 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800839 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700840 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
841 .platform_data = &bfin_spi_flash_data,
842 .controller_data = &spi_flash_chip_info,
843 .mode = SPI_MODE_3,
844 },
845#endif
Michael Hennerich8e9d5c72008-04-24 08:46:19 +0800846#if defined(CONFIG_MTD_DATAFLASH) \
847 || defined(CONFIG_MTD_DATAFLASH_MODULE)
848 { /* DataFlash chip */
849 .modalias = "mtd_dataflash",
Michael Hennerichceac2652008-08-25 17:39:11 +0800850 .max_speed_hz = 33250000, /* max spi clock (SCK) speed in HZ */
Michael Hennerich8e9d5c72008-04-24 08:46:19 +0800851 .bus_num = 0, /* Framework bus number */
852 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
Michael Hennerichceac2652008-08-25 17:39:11 +0800853 .platform_data = &bfin_spi_dataflash_data,
Michael Hennerich8e9d5c72008-04-24 08:46:19 +0800854 .controller_data = &data_flash_chip_info,
855 .mode = SPI_MODE_3,
856 },
857#endif
Mike Frysingera261eec2009-05-20 14:05:36 +0000858#if defined(CONFIG_BFIN_SPI_ADC) \
859 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
Bryan Wu1394f032007-05-06 14:50:22 -0700860 {
861 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
862 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800863 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700864 .chip_select = 1, /* Framework chip select. */
865 .platform_data = NULL, /* No spi_driver specific config */
866 .controller_data = &spi_adc_chip_info,
867 },
868#endif
869
Barry Song83124402009-08-06 21:03:02 +0000870#if defined(CONFIG_SND_BF5XX_SOC_AD1836) \
871 || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
Bryan Wu1394f032007-05-06 14:50:22 -0700872 {
Barry Songdac98172009-08-13 21:07:37 +0000873 .modalias = "ad1836",
Bryan Wu1394f032007-05-06 14:50:22 -0700874 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800875 .bus_num = 0,
Barry Song83124402009-08-06 21:03:02 +0000876 .chip_select = 4,/* CONFIG_SND_BLACKFIN_SPI_PFBIT */
Bryan Wu1394f032007-05-06 14:50:22 -0700877 .controller_data = &ad1836_spi_chip_info,
Barry Song83124402009-08-06 21:03:02 +0000878 .mode = SPI_MODE_3,
Bryan Wu1394f032007-05-06 14:50:22 -0700879 },
880#endif
Barry Songd4b834c2009-06-04 10:14:17 +0000881
882#if defined(CONFIG_SND_BF5XX_SOC_AD1938) || defined(CONFIG_SND_BF5XX_SOC_AD1938_MODULE)
883 {
Barry Songdac98172009-08-13 21:07:37 +0000884 .modalias = "ad1938",
Barry Songd4b834c2009-06-04 10:14:17 +0000885 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
886 .bus_num = 0,
887 .chip_select = 0,/* CONFIG_SND_BLACKFIN_SPI_PFBIT */
888 .controller_data = &ad1938_spi_chip_info,
889 .mode = SPI_MODE_3,
890 },
891#endif
892
Barry Song427f2772009-07-17 07:04:55 +0000893#if defined(CONFIG_INPUT_EVAL_AD7147EBZ)
894 {
895 .modalias = "ad714x_captouch",
896 .max_speed_hz = 1000000, /* max spi clock (SCK) speed in HZ */
897 .irq = IRQ_PF4,
898 .bus_num = 0,
899 .chip_select = 5,
900 .mode = SPI_MODE_3,
901 .platform_data = &ad7147_platfrom_data,
902 .controller_data = &ad7147_spi_chip_info,
903 },
904#endif
905
Yi Lif79ea4c2009-01-07 23:14:38 +0800906#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
907 {
908 .modalias = "mmc_spi",
909 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
910 .bus_num = 0,
911 .chip_select = 4,
912 .platform_data = &bfin_mmc_spi_pdata,
913 .controller_data = &mmc_spi_chip_info,
914 .mode = SPI_MODE_3,
915 },
916#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700917#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
918 {
919 .modalias = "ad7877",
920 .platform_data = &bfin_ad7877_ts_info,
921 .irq = IRQ_PF6,
922 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Michael Hennerichc7d48962007-11-15 21:33:31 +0800923 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700924 .chip_select = 1,
925 .controller_data = &spi_ad7877_chip_info,
926 },
927#endif
Michael Hennerichf5150152008-10-16 23:23:18 +0800928#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
Michael Hennerich46aa04f2008-10-13 11:30:17 +0800929 {
930 .modalias = "ad7879",
931 .platform_data = &bfin_ad7879_ts_info,
932 .irq = IRQ_PF7,
933 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
934 .bus_num = 0,
935 .chip_select = 1,
936 .controller_data = &spi_ad7879_chip_info,
937 .mode = SPI_CPHA | SPI_CPOL,
938 },
939#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800940#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
941 {
942 .modalias = "spidev",
943 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
944 .bus_num = 0,
945 .chip_select = 1,
946 .controller_data = &spidev_chip_info,
947 },
948#endif
Michael Hennerich2043f3f2008-10-13 14:46:30 +0800949#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
950 {
951 .modalias = "bfin-lq035q1-spi",
952 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
953 .bus_num = 0,
Michael Hennerich46aa04f2008-10-13 11:30:17 +0800954 .chip_select = 2,
Michael Hennerich2043f3f2008-10-13 14:46:30 +0800955 .controller_data = &lq035q1_spi_chip_info,
956 .mode = SPI_CPHA | SPI_CPOL,
957 },
958#endif
Michael Hennerich85a192e2009-01-07 23:14:38 +0800959#if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
960 {
961 .modalias = "enc28j60",
962 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
963 .irq = IRQ_PF6,
964 .bus_num = 0,
965 .chip_select = 0, /* GPIO controlled SSEL */
966 .controller_data = &enc28j60_spi_chip_info,
967 .mode = SPI_MODE_0,
968 },
969#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700970};
971
Mike Frysinger5bda2722008-06-07 15:03:01 +0800972#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wu1394f032007-05-06 14:50:22 -0700973/* SPI controller data */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800974static struct bfin5xx_spi_master bfin_spi0_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700975 .num_chipselect = 8,
976 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800977 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Bryan Wu1394f032007-05-06 14:50:22 -0700978};
979
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800980/* SPI (0) */
981static struct resource bfin_spi0_resource[] = {
982 [0] = {
983 .start = SPI0_REGBASE,
984 .end = SPI0_REGBASE + 0xFF,
985 .flags = IORESOURCE_MEM,
986 },
987 [1] = {
988 .start = CH_SPI,
989 .end = CH_SPI,
Yi Lie68d1eb2009-06-03 09:46:22 +0000990 .flags = IORESOURCE_DMA,
991 },
992 [2] = {
993 .start = IRQ_SPI,
994 .end = IRQ_SPI,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800995 .flags = IORESOURCE_IRQ,
996 },
997};
998
999static struct platform_device bfin_spi0_device = {
1000 .name = "bfin-spi",
1001 .id = 0, /* Bus number */
1002 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
1003 .resource = bfin_spi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -07001004 .dev = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001005 .platform_data = &bfin_spi0_info, /* Passed to driver */
Bryan Wu1394f032007-05-06 14:50:22 -07001006 },
1007};
1008#endif /* spi master and devices */
1009
Cliff Cai1e9aa952009-03-28 23:28:51 +08001010#if defined(CONFIG_SPI_BFIN_SPORT) || defined(CONFIG_SPI_BFIN_SPORT_MODULE)
1011
1012/* SPORT SPI controller data */
1013static struct bfin5xx_spi_master bfin_sport_spi0_info = {
1014 .num_chipselect = 1, /* master only supports one device */
1015 .enable_dma = 0, /* master don't support DMA */
1016 .pin_req = {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_DRPRI,
1017 P_SPORT0_RSCLK, P_SPORT0_TFS, P_SPORT0_RFS, 0},
1018};
1019
1020static struct resource bfin_sport_spi0_resource[] = {
1021 [0] = {
1022 .start = SPORT0_TCR1,
1023 .end = SPORT0_TCR1 + 0xFF,
1024 .flags = IORESOURCE_MEM,
1025 },
1026 [1] = {
1027 .start = IRQ_SPORT0_ERROR,
1028 .end = IRQ_SPORT0_ERROR,
1029 .flags = IORESOURCE_IRQ,
1030 },
1031};
1032
1033static struct platform_device bfin_sport_spi0_device = {
1034 .name = "bfin-sport-spi",
1035 .id = 1, /* Bus number */
1036 .num_resources = ARRAY_SIZE(bfin_sport_spi0_resource),
1037 .resource = bfin_sport_spi0_resource,
1038 .dev = {
1039 .platform_data = &bfin_sport_spi0_info, /* Passed to driver */
1040 },
1041};
1042
1043static struct bfin5xx_spi_master bfin_sport_spi1_info = {
1044 .num_chipselect = 1, /* master only supports one device */
1045 .enable_dma = 0, /* master don't support DMA */
1046 .pin_req = {P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_DRPRI,
1047 P_SPORT1_RSCLK, P_SPORT1_TFS, P_SPORT1_RFS, 0},
1048};
1049
1050static struct resource bfin_sport_spi1_resource[] = {
1051 [0] = {
1052 .start = SPORT1_TCR1,
1053 .end = SPORT1_TCR1 + 0xFF,
1054 .flags = IORESOURCE_MEM,
1055 },
1056 [1] = {
1057 .start = IRQ_SPORT1_ERROR,
1058 .end = IRQ_SPORT1_ERROR,
1059 .flags = IORESOURCE_IRQ,
1060 },
1061};
1062
1063static struct platform_device bfin_sport_spi1_device = {
1064 .name = "bfin-sport-spi",
1065 .id = 2, /* Bus number */
1066 .num_resources = ARRAY_SIZE(bfin_sport_spi1_resource),
1067 .resource = bfin_sport_spi1_resource,
1068 .dev = {
1069 .platform_data = &bfin_sport_spi1_info, /* Passed to driver */
1070 },
1071};
1072
1073#endif /* sport spi master and devices */
1074
Bryan Wu1394f032007-05-06 14:50:22 -07001075#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
1076static struct platform_device bfin_fb_device = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001077 .name = "bf537-lq035",
1078};
1079#endif
1080
1081#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
1082static struct platform_device bfin_fb_adv7393_device = {
1083 .name = "bfin-adv7393",
Bryan Wu1394f032007-05-06 14:50:22 -07001084};
1085#endif
1086
Michael Hennerich2043f3f2008-10-13 14:46:30 +08001087#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
1088#include <asm/bfin-lq035q1.h>
1089
1090static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
1091 .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
Michael Hennerich46aa04f2008-10-13 11:30:17 +08001092 .use_bl = 0, /* let something else control the LCD Blacklight */
Michael Hennerich2043f3f2008-10-13 14:46:30 +08001093 .gpio_bl = GPIO_PF7,
1094};
1095
1096static struct resource bfin_lq035q1_resources[] = {
1097 {
1098 .start = IRQ_PPI_ERROR,
1099 .end = IRQ_PPI_ERROR,
1100 .flags = IORESOURCE_IRQ,
1101 },
1102};
1103
1104static struct platform_device bfin_lq035q1_device = {
1105 .name = "bfin-lq035q1",
1106 .id = -1,
1107 .num_resources = ARRAY_SIZE(bfin_lq035q1_resources),
1108 .resource = bfin_lq035q1_resources,
1109 .dev = {
1110 .platform_data = &bfin_lq035q1_data,
1111 },
1112};
1113#endif
1114
Bryan Wu1394f032007-05-06 14:50:22 -07001115#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1116static struct resource bfin_uart_resources[] = {
Sonic Zhang233b28a2007-11-21 17:04:41 +08001117#ifdef CONFIG_SERIAL_BFIN_UART0
Bryan Wu1394f032007-05-06 14:50:22 -07001118 {
1119 .start = 0xFFC00400,
1120 .end = 0xFFC004FF,
1121 .flags = IORESOURCE_MEM,
Sonic Zhang233b28a2007-11-21 17:04:41 +08001122 },
1123#endif
1124#ifdef CONFIG_SERIAL_BFIN_UART1
1125 {
Bryan Wu1394f032007-05-06 14:50:22 -07001126 .start = 0xFFC02000,
1127 .end = 0xFFC020FF,
1128 .flags = IORESOURCE_MEM,
1129 },
Sonic Zhang233b28a2007-11-21 17:04:41 +08001130#endif
Bryan Wu1394f032007-05-06 14:50:22 -07001131};
1132
1133static struct platform_device bfin_uart_device = {
1134 .name = "bfin-uart",
1135 .id = 1,
1136 .num_resources = ARRAY_SIZE(bfin_uart_resources),
1137 .resource = bfin_uart_resources,
1138};
1139#endif
1140
Graf Yang5be36d22008-04-25 03:09:15 +08001141#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang5be36d22008-04-25 03:09:15 +08001142#ifdef CONFIG_BFIN_SIR0
Graf Yang42bd8bc2009-01-07 23:14:39 +08001143static struct resource bfin_sir0_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +08001144 {
1145 .start = 0xFFC00400,
1146 .end = 0xFFC004FF,
1147 .flags = IORESOURCE_MEM,
1148 },
Graf Yang42bd8bc2009-01-07 23:14:39 +08001149 {
1150 .start = IRQ_UART0_RX,
1151 .end = IRQ_UART0_RX+1,
1152 .flags = IORESOURCE_IRQ,
1153 },
1154 {
1155 .start = CH_UART0_RX,
1156 .end = CH_UART0_RX+1,
1157 .flags = IORESOURCE_DMA,
1158 },
1159};
1160
1161static struct platform_device bfin_sir0_device = {
1162 .name = "bfin_sir",
1163 .id = 0,
1164 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
1165 .resource = bfin_sir0_resources,
1166};
Graf Yang5be36d22008-04-25 03:09:15 +08001167#endif
1168#ifdef CONFIG_BFIN_SIR1
Graf Yang42bd8bc2009-01-07 23:14:39 +08001169static struct resource bfin_sir1_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +08001170 {
1171 .start = 0xFFC02000,
1172 .end = 0xFFC020FF,
1173 .flags = IORESOURCE_MEM,
1174 },
Graf Yang42bd8bc2009-01-07 23:14:39 +08001175 {
1176 .start = IRQ_UART1_RX,
1177 .end = IRQ_UART1_RX+1,
1178 .flags = IORESOURCE_IRQ,
1179 },
1180 {
1181 .start = CH_UART1_RX,
1182 .end = CH_UART1_RX+1,
1183 .flags = IORESOURCE_DMA,
1184 },
Graf Yang5be36d22008-04-25 03:09:15 +08001185};
1186
Graf Yang42bd8bc2009-01-07 23:14:39 +08001187static struct platform_device bfin_sir1_device = {
Graf Yang5be36d22008-04-25 03:09:15 +08001188 .name = "bfin_sir",
Graf Yang42bd8bc2009-01-07 23:14:39 +08001189 .id = 1,
1190 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
1191 .resource = bfin_sir1_resources,
Graf Yang5be36d22008-04-25 03:09:15 +08001192};
1193#endif
Graf Yang42bd8bc2009-01-07 23:14:39 +08001194#endif
Graf Yang5be36d22008-04-25 03:09:15 +08001195
Bryan Wu1394f032007-05-06 14:50:22 -07001196#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001197static struct resource bfin_twi0_resource[] = {
1198 [0] = {
1199 .start = TWI0_REGBASE,
1200 .end = TWI0_REGBASE,
1201 .flags = IORESOURCE_MEM,
1202 },
1203 [1] = {
1204 .start = IRQ_TWI,
1205 .end = IRQ_TWI,
1206 .flags = IORESOURCE_IRQ,
1207 },
1208};
1209
Bryan Wu1394f032007-05-06 14:50:22 -07001210static struct platform_device i2c_bfin_twi_device = {
1211 .name = "i2c-bfin-twi",
1212 .id = 0,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001213 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
1214 .resource = bfin_twi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -07001215};
1216#endif
1217
Michael Hennerich51ed9ad2009-01-07 23:14:38 +08001218#if defined(CONFIG_KEYBOARD_ADP5588) || defined(CONFIG_KEYBOARD_ADP5588_MODULE)
1219#include <linux/input.h>
Michael Hennerichf39d56e2008-12-02 14:08:58 +00001220#include <linux/i2c/adp5588.h>
Michael Hennerich51ed9ad2009-01-07 23:14:38 +08001221static const unsigned short adp5588_keymap[ADP5588_KEYMAPSIZE] = {
1222 [0] = KEY_GRAVE,
1223 [1] = KEY_1,
1224 [2] = KEY_2,
1225 [3] = KEY_3,
1226 [4] = KEY_4,
1227 [5] = KEY_5,
1228 [6] = KEY_6,
1229 [7] = KEY_7,
1230 [8] = KEY_8,
1231 [9] = KEY_9,
1232 [10] = KEY_0,
1233 [11] = KEY_MINUS,
1234 [12] = KEY_EQUAL,
1235 [13] = KEY_BACKSLASH,
1236 [15] = KEY_KP0,
1237 [16] = KEY_Q,
1238 [17] = KEY_W,
1239 [18] = KEY_E,
1240 [19] = KEY_R,
1241 [20] = KEY_T,
1242 [21] = KEY_Y,
1243 [22] = KEY_U,
1244 [23] = KEY_I,
1245 [24] = KEY_O,
1246 [25] = KEY_P,
1247 [26] = KEY_LEFTBRACE,
1248 [27] = KEY_RIGHTBRACE,
1249 [29] = KEY_KP1,
1250 [30] = KEY_KP2,
1251 [31] = KEY_KP3,
1252 [32] = KEY_A,
1253 [33] = KEY_S,
1254 [34] = KEY_D,
1255 [35] = KEY_F,
1256 [36] = KEY_G,
1257 [37] = KEY_H,
1258 [38] = KEY_J,
1259 [39] = KEY_K,
1260 [40] = KEY_L,
1261 [41] = KEY_SEMICOLON,
1262 [42] = KEY_APOSTROPHE,
1263 [43] = KEY_BACKSLASH,
1264 [45] = KEY_KP4,
1265 [46] = KEY_KP5,
1266 [47] = KEY_KP6,
1267 [48] = KEY_102ND,
1268 [49] = KEY_Z,
1269 [50] = KEY_X,
1270 [51] = KEY_C,
1271 [52] = KEY_V,
1272 [53] = KEY_B,
1273 [54] = KEY_N,
1274 [55] = KEY_M,
1275 [56] = KEY_COMMA,
1276 [57] = KEY_DOT,
1277 [58] = KEY_SLASH,
1278 [60] = KEY_KPDOT,
1279 [61] = KEY_KP7,
1280 [62] = KEY_KP8,
1281 [63] = KEY_KP9,
1282 [64] = KEY_SPACE,
1283 [65] = KEY_BACKSPACE,
1284 [66] = KEY_TAB,
1285 [67] = KEY_KPENTER,
1286 [68] = KEY_ENTER,
1287 [69] = KEY_ESC,
1288 [70] = KEY_DELETE,
1289 [74] = KEY_KPMINUS,
1290 [76] = KEY_UP,
1291 [77] = KEY_DOWN,
1292 [78] = KEY_RIGHT,
1293 [79] = KEY_LEFT,
1294};
1295
1296static struct adp5588_kpad_platform_data adp5588_kpad_data = {
1297 .rows = 8,
1298 .cols = 10,
1299 .keymap = adp5588_keymap,
1300 .keymapsize = ARRAY_SIZE(adp5588_keymap),
1301 .repeat = 0,
1302};
1303#endif
1304
Michael Hennerich3ea57212009-03-28 22:15:07 +08001305#if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
1306#include <linux/mfd/adp5520.h>
1307
1308 /*
1309 * ADP5520/5501 Backlight Data
1310 */
1311
1312static struct adp5520_backlight_platfrom_data adp5520_backlight_data = {
1313 .fade_in = FADE_T_1200ms,
1314 .fade_out = FADE_T_1200ms,
1315 .fade_led_law = BL_LAW_LINEAR,
1316 .en_ambl_sens = 1,
1317 .abml_filt = BL_AMBL_FILT_640ms,
1318 .l1_daylight_max = BL_CUR_mA(15),
1319 .l1_daylight_dim = BL_CUR_mA(0),
1320 .l2_office_max = BL_CUR_mA(7),
1321 .l2_office_dim = BL_CUR_mA(0),
1322 .l3_dark_max = BL_CUR_mA(3),
1323 .l3_dark_dim = BL_CUR_mA(0),
1324 .l2_trip = L2_COMP_CURR_uA(700),
1325 .l2_hyst = L2_COMP_CURR_uA(50),
1326 .l3_trip = L3_COMP_CURR_uA(80),
1327 .l3_hyst = L3_COMP_CURR_uA(20),
1328};
1329
1330 /*
1331 * ADP5520/5501 LEDs Data
1332 */
1333
1334#include <linux/leds.h>
1335
1336static struct led_info adp5520_leds[] = {
1337 {
1338 .name = "adp5520-led1",
1339 .default_trigger = "none",
1340 .flags = FLAG_ID_ADP5520_LED1_ADP5501_LED0 | LED_OFFT_600ms,
1341 },
1342#ifdef ADP5520_EN_ALL_LEDS
1343 {
1344 .name = "adp5520-led2",
1345 .default_trigger = "none",
1346 .flags = FLAG_ID_ADP5520_LED2_ADP5501_LED1,
1347 },
1348 {
1349 .name = "adp5520-led3",
1350 .default_trigger = "none",
1351 .flags = FLAG_ID_ADP5520_LED3_ADP5501_LED2,
1352 },
1353#endif
1354};
1355
1356static struct adp5520_leds_platfrom_data adp5520_leds_data = {
1357 .num_leds = ARRAY_SIZE(adp5520_leds),
1358 .leds = adp5520_leds,
1359 .fade_in = FADE_T_600ms,
1360 .fade_out = FADE_T_600ms,
1361 .led_on_time = LED_ONT_600ms,
1362};
1363
1364 /*
1365 * ADP5520 GPIO Data
1366 */
1367
1368static struct adp5520_gpio_platfrom_data adp5520_gpio_data = {
1369 .gpio_start = 50,
1370 .gpio_en_mask = GPIO_C1 | GPIO_C2 | GPIO_R2,
1371 .gpio_pullup_mask = GPIO_C1 | GPIO_C2 | GPIO_R2,
1372};
1373
1374 /*
1375 * ADP5520 Keypad Data
1376 */
1377
1378#include <linux/input.h>
1379static const unsigned short adp5520_keymap[ADP5520_KEYMAPSIZE] = {
1380 [KEY(0, 0)] = KEY_GRAVE,
1381 [KEY(0, 1)] = KEY_1,
1382 [KEY(0, 2)] = KEY_2,
1383 [KEY(0, 3)] = KEY_3,
1384 [KEY(1, 0)] = KEY_4,
1385 [KEY(1, 1)] = KEY_5,
1386 [KEY(1, 2)] = KEY_6,
1387 [KEY(1, 3)] = KEY_7,
1388 [KEY(2, 0)] = KEY_8,
1389 [KEY(2, 1)] = KEY_9,
1390 [KEY(2, 2)] = KEY_0,
1391 [KEY(2, 3)] = KEY_MINUS,
1392 [KEY(3, 0)] = KEY_EQUAL,
1393 [KEY(3, 1)] = KEY_BACKSLASH,
1394 [KEY(3, 2)] = KEY_BACKSPACE,
1395 [KEY(3, 3)] = KEY_ENTER,
1396};
1397
1398static struct adp5520_keys_platfrom_data adp5520_keys_data = {
1399 .rows_en_mask = ROW_R3 | ROW_R2 | ROW_R1 | ROW_R0,
1400 .cols_en_mask = COL_C3 | COL_C2 | COL_C1 | COL_C0,
1401 .keymap = adp5520_keymap,
1402 .keymapsize = ARRAY_SIZE(adp5520_keymap),
1403 .repeat = 0,
1404};
1405
1406 /*
1407 * ADP5520/5501 Multifuction Device Init Data
1408 */
1409
1410static struct adp5520_subdev_info adp5520_subdevs[] = {
1411 {
1412 .name = "adp5520-backlight",
1413 .id = ID_ADP5520,
1414 .platform_data = &adp5520_backlight_data,
1415 },
1416 {
1417 .name = "adp5520-led",
1418 .id = ID_ADP5520,
1419 .platform_data = &adp5520_leds_data,
1420 },
1421 {
1422 .name = "adp5520-gpio",
1423 .id = ID_ADP5520,
1424 .platform_data = &adp5520_gpio_data,
1425 },
1426 {
1427 .name = "adp5520-keys",
1428 .id = ID_ADP5520,
1429 .platform_data = &adp5520_keys_data,
1430 },
1431};
1432
1433static struct adp5520_platform_data adp5520_pdev_data = {
1434 .num_subdevs = ARRAY_SIZE(adp5520_subdevs),
1435 .subdevs = adp5520_subdevs,
1436};
1437
1438#endif
1439
Bryan Wu81d9c7f2008-03-26 10:02:13 +08001440static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
Barry Song427f2772009-07-17 07:04:55 +00001441#if defined(CONFIG_INPUT_EVAL_AD7142EB)
Bryan Wu81d9c7f2008-03-26 10:02:13 +08001442 {
Barry Song427f2772009-07-17 07:04:55 +00001443 I2C_BOARD_INFO("ad7142_captouch", 0x2C),
Barry Song4c94c3e2009-07-07 07:41:50 +00001444 .irq = IRQ_PG5,
Barry Song427f2772009-07-17 07:04:55 +00001445 .platform_data = (void *)&ad7142_platfrom_data,
Bryan Wu81d9c7f2008-03-26 10:02:13 +08001446 },
1447#endif
Michael Hennerichebd58332009-07-02 11:00:38 +00001448#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
Bryan Wu81d9c7f2008-03-26 10:02:13 +08001449 {
1450 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
Bryan Wu81d9c7f2008-03-26 10:02:13 +08001451 },
1452#endif
Michael Hennerich204844e2009-06-30 14:57:22 +00001453#if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
Bryan Wu81d9c7f2008-03-26 10:02:13 +08001454 {
1455 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
Michael Hennerichf5150152008-10-16 23:23:18 +08001456 .irq = IRQ_PG6,
1457 },
1458#endif
1459#if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) || defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)
1460 {
1461 I2C_BOARD_INFO("ad7879", 0x2F),
1462 .irq = IRQ_PG5,
1463 .platform_data = (void *)&bfin_ad7879_ts_info,
Bryan Wu81d9c7f2008-03-26 10:02:13 +08001464 },
1465#endif
Michael Hennerich51ed9ad2009-01-07 23:14:38 +08001466#if defined(CONFIG_KEYBOARD_ADP5588) || defined(CONFIG_KEYBOARD_ADP5588_MODULE)
1467 {
1468 I2C_BOARD_INFO("adp5588-keys", 0x34),
1469 .irq = IRQ_PG0,
1470 .platform_data = (void *)&adp5588_kpad_data,
1471 },
1472#endif
Michael Hennerich3ea57212009-03-28 22:15:07 +08001473#if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
1474 {
1475 I2C_BOARD_INFO("pmic-adp5520", 0x32),
Mike Frysinger4f84b6e2009-06-10 20:45:48 -04001476 .irq = IRQ_PG0,
Michael Hennerich3ea57212009-03-28 22:15:07 +08001477 .platform_data = (void *)&adp5520_pdev_data,
1478 },
1479#endif
Michael Hennerichffc4d8b2009-05-29 15:41:18 +00001480#if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
1481 {
1482 I2C_BOARD_INFO("adxl34x", 0x53),
1483 .irq = IRQ_PG3,
1484 .platform_data = (void *)&adxl34x_info,
1485 },
1486#endif
Bryan Wu81d9c7f2008-03-26 10:02:13 +08001487};
Bryan Wu81d9c7f2008-03-26 10:02:13 +08001488
Bryan Wu1394f032007-05-06 14:50:22 -07001489#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1490static struct platform_device bfin_sport0_uart_device = {
1491 .name = "bfin-sport-uart",
1492 .id = 0,
1493};
1494
1495static struct platform_device bfin_sport1_uart_device = {
1496 .name = "bfin-sport-uart",
1497 .id = 1,
1498};
1499#endif
1500
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001501#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
Michael Hennerich2c8beb22009-03-28 22:13:43 +08001502#define CF_IDE_NAND_CARD_USE_HDD_INTERFACE
1503/* #define CF_IDE_NAND_CARD_USE_CF_IN_COMMON_MEMORY_MODE */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001504
Michael Hennerich2c8beb22009-03-28 22:13:43 +08001505#ifdef CF_IDE_NAND_CARD_USE_HDD_INTERFACE
1506#define PATA_INT IRQ_PF5
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001507static struct pata_platform_info bfin_pata_platform_data = {
1508 .ioport_shift = 1,
Mike Frysinger64e5c512007-10-30 11:56:13 +08001509 .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001510};
1511
1512static struct resource bfin_pata_resources[] = {
1513 {
1514 .start = 0x20314020,
1515 .end = 0x2031403F,
1516 .flags = IORESOURCE_MEM,
1517 },
1518 {
1519 .start = 0x2031401C,
1520 .end = 0x2031401F,
1521 .flags = IORESOURCE_MEM,
1522 },
1523 {
1524 .start = PATA_INT,
1525 .end = PATA_INT,
1526 .flags = IORESOURCE_IRQ,
1527 },
1528};
Michael Hennerich2c8beb22009-03-28 22:13:43 +08001529#elif defined(CF_IDE_NAND_CARD_USE_CF_IN_COMMON_MEMORY_MODE)
1530static struct pata_platform_info bfin_pata_platform_data = {
1531 .ioport_shift = 0,
1532};
Michael Hennerich648882d2009-04-21 12:05:50 +00001533/* CompactFlash Storage Card Memory Mapped Adressing
1534 * /REG = A11 = 1
1535 */
Michael Hennerich2c8beb22009-03-28 22:13:43 +08001536static struct resource bfin_pata_resources[] = {
1537 {
Michael Hennerich648882d2009-04-21 12:05:50 +00001538 .start = 0x20211800,
1539 .end = 0x20211807,
Michael Hennerich2c8beb22009-03-28 22:13:43 +08001540 .flags = IORESOURCE_MEM,
1541 },
1542 {
Michael Hennerich648882d2009-04-21 12:05:50 +00001543 .start = 0x2021180E, /* Device Ctl */
1544 .end = 0x2021180E,
Michael Hennerich2c8beb22009-03-28 22:13:43 +08001545 .flags = IORESOURCE_MEM,
1546 },
1547};
1548#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001549
1550static struct platform_device bfin_pata_device = {
1551 .name = "pata_platform",
1552 .id = -1,
1553 .num_resources = ARRAY_SIZE(bfin_pata_resources),
1554 .resource = bfin_pata_resources,
1555 .dev = {
1556 .platform_data = &bfin_pata_platform_data,
1557 }
1558};
1559#endif
1560
Michael Hennerich14b03202008-05-07 11:41:26 +08001561static const unsigned int cclk_vlev_datasheet[] =
1562{
1563 VRPAIR(VLEV_085, 250000000),
1564 VRPAIR(VLEV_090, 376000000),
1565 VRPAIR(VLEV_095, 426000000),
1566 VRPAIR(VLEV_100, 426000000),
1567 VRPAIR(VLEV_105, 476000000),
1568 VRPAIR(VLEV_110, 476000000),
1569 VRPAIR(VLEV_115, 476000000),
1570 VRPAIR(VLEV_120, 500000000),
1571 VRPAIR(VLEV_125, 533000000),
1572 VRPAIR(VLEV_130, 600000000),
1573};
1574
1575static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
1576 .tuple_tab = cclk_vlev_datasheet,
1577 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
1578 .vr_settling_time = 25 /* us */,
1579};
1580
1581static struct platform_device bfin_dpmc = {
1582 .name = "bfin dpmc",
1583 .dev = {
1584 .platform_data = &bfin_dmpc_vreg_data,
1585 },
1586};
1587
Barry Song83124402009-08-06 21:03:02 +00001588#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
1589static struct platform_device bfin_tdm = {
1590 .name = "bfin-tdm",
1591 /* TODO: add platform data here */
1592};
1593#endif
1594
Bryan Wu1394f032007-05-06 14:50:22 -07001595static struct platform_device *stamp_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +08001596
1597 &bfin_dpmc,
1598
Bryan Wu1394f032007-05-06 14:50:22 -07001599#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
1600 &bfin_pcmcia_cf_device,
1601#endif
1602
1603#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
1604 &rtc_device,
1605#endif
1606
1607#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
1608 &sl811_hcd_device,
1609#endif
1610
1611#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
1612 &isp1362_hcd_device,
1613#endif
1614
Michael Hennerich3f375692008-11-18 17:48:22 +08001615#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
1616 &bfin_isp1760_device,
1617#endif
1618
Bryan Wu1394f032007-05-06 14:50:22 -07001619#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
1620 &smc91x_device,
1621#endif
1622
Alex Landauf40d24d2007-07-12 12:11:48 +08001623#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
1624 &dm9000_device,
1625#endif
1626
Michael Hennerich561cc182007-11-17 23:56:08 +08001627#if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE)
1628 &ax88180_device,
1629#endif
1630
Bryan Wu1394f032007-05-06 14:50:22 -07001631#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
Graf Yang65319622009-02-04 16:49:45 +08001632 &bfin_mii_bus,
Bryan Wu1394f032007-05-06 14:50:22 -07001633 &bfin_mac_device,
1634#endif
1635
1636#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
1637 &net2272_bfin_device,
1638#endif
1639
1640#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001641 &bfin_spi0_device,
Bryan Wu1394f032007-05-06 14:50:22 -07001642#endif
1643
Cliff Cai1e9aa952009-03-28 23:28:51 +08001644#if defined(CONFIG_SPI_BFIN_SPORT) || defined(CONFIG_SPI_BFIN_SPORT_MODULE)
1645 &bfin_sport_spi0_device,
1646 &bfin_sport_spi1_device,
1647#endif
1648
Bryan Wu1394f032007-05-06 14:50:22 -07001649#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
1650 &bfin_fb_device,
1651#endif
1652
Michael Hennerich2043f3f2008-10-13 14:46:30 +08001653#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
1654 &bfin_lq035q1_device,
1655#endif
1656
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001657#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
1658 &bfin_fb_adv7393_device,
1659#endif
1660
Bryan Wu1394f032007-05-06 14:50:22 -07001661#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1662 &bfin_uart_device,
1663#endif
1664
Graf Yang5be36d22008-04-25 03:09:15 +08001665#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang42bd8bc2009-01-07 23:14:39 +08001666#ifdef CONFIG_BFIN_SIR0
1667 &bfin_sir0_device,
1668#endif
1669#ifdef CONFIG_BFIN_SIR1
1670 &bfin_sir1_device,
1671#endif
Graf Yang5be36d22008-04-25 03:09:15 +08001672#endif
1673
Bryan Wu1394f032007-05-06 14:50:22 -07001674#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1675 &i2c_bfin_twi_device,
1676#endif
1677
1678#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1679 &bfin_sport0_uart_device,
1680 &bfin_sport1_uart_device,
1681#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001682
1683#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
1684 &bfin_pata_device,
1685#endif
Michael Hennerich2463ef22008-01-27 16:49:48 +08001686
1687#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1688 &bfin_device_gpiokeys,
1689#endif
Mike Frysingercad2ab62008-02-22 17:01:31 +08001690
1691 &bfin_gpios_device,
Mike Frysinger793dc272008-03-26 08:09:12 +08001692
Mike Frysingerfc689112008-06-25 11:41:42 +08001693#if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
1694 &bfin_async_nand_device,
1695#endif
1696
Mike Frysinger793dc272008-03-26 08:09:12 +08001697#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +08001698 &stamp_flash_device,
Mike Frysinger793dc272008-03-26 08:09:12 +08001699#endif
Barry Song83124402009-08-06 21:03:02 +00001700
1701#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
1702 &bfin_tdm,
1703#endif
Bryan Wu1394f032007-05-06 14:50:22 -07001704};
1705
1706static int __init stamp_init(void)
1707{
Harvey Harrisonb85d8582008-04-23 09:39:01 +08001708 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Bryan Wu81d9c7f2008-03-26 10:02:13 +08001709 i2c_register_board_info(0, bfin_i2c_board_info,
1710 ARRAY_SIZE(bfin_i2c_board_info));
Mike Frysingerfc689112008-06-25 11:41:42 +08001711 bfin_plat_nand_init();
Bryan Wu1394f032007-05-06 14:50:22 -07001712 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
Mike Frysinger5bda2722008-06-07 15:03:01 +08001713 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001714
Bryan Wu1394f032007-05-06 14:50:22 -07001715 return 0;
1716}
1717
1718arch_initcall(stamp_init);
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001719
1720void native_machine_restart(char *cmd)
1721{
1722 /* workaround reboot hang when booting from SPI */
1723 if ((bfin_read_SYSCR() & 0x7) == 0x3)
Sonic Zhangb52dae32009-02-04 16:49:45 +08001724 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
Bryan Wuc6c4d7b2007-10-11 01:20:06 +08001725}
Mike Frysinger137b1522007-11-22 16:07:03 +08001726
1727/*
1728 * Currently the MAC address is saved in Flash by U-Boot
1729 */
1730#define FLASH_MAC 0x203f0000
Mike Frysinger9862cc52007-11-15 21:21:20 +08001731void bfin_get_ether_addr(char *addr)
Mike Frysinger137b1522007-11-22 16:07:03 +08001732{
1733 *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
1734 *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
1735}
Mike Frysinger9862cc52007-11-15 21:21:20 +08001736EXPORT_SYMBOL(bfin_get_ether_addr);