blob: a2e7e4c13bba49bfaf88092f62bb212e4deeccb4 [file] [log] [blame]
Michael Hennerich59003142007-10-21 16:54:27 +08001/*
2 * File: arch/blackfin/mach-bf527/boards/ezkit.c
3 * Based on: arch/blackfin/mach-bf537/boards/stamp.c
4 * Author: Aidan Williams <aidan@nicta.com.au>
5 *
6 * Created:
7 * Description:
8 *
9 * Modified:
10 * Copyright 2005 National ICT Australia (NICTA)
Michael Hennericha628a8b2008-01-22 17:29:16 +080011 * Copyright 2004-2008 Analog Devices Inc.
Michael Hennerich59003142007-10-21 16:54:27 +080012 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, see the file COPYING, or write
27 * to the Free Software Foundation, Inc.,
28 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 */
30
31#include <linux/device.h>
32#include <linux/platform_device.h>
33#include <linux/mtd/mtd.h>
34#include <linux/mtd/partitions.h>
Michael Hennerichd7e5dd42008-05-07 11:41:26 +080035#include <linux/mtd/physmap.h>
Michael Hennerich59003142007-10-21 16:54:27 +080036#include <linux/spi/spi.h>
37#include <linux/spi/flash.h>
38#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
Mike Frysingerf02bcec2007-11-15 21:29:15 +080039#include <linux/usb/isp1362.h>
Michael Hennerich59003142007-10-21 16:54:27 +080040#endif
Bryan Wu72268682008-05-07 11:41:26 +080041#include <linux/i2c.h>
Michael Hennerich59003142007-10-21 16:54:27 +080042#include <linux/irq.h>
43#include <linux/interrupt.h>
Mike Frysinger632f6582007-11-15 21:25:47 +080044#include <linux/usb/sl811.h>
Michael Hennerich1089e222007-12-24 11:49:29 +080045#include <linux/usb/musb.h>
Michael Hennerich59003142007-10-21 16:54:27 +080046#include <asm/dma.h>
47#include <asm/bfin5xx_spi.h>
48#include <asm/reboot.h>
Michael Hennerich64307f72007-10-29 16:55:18 +080049#include <asm/nand.h>
Bryan Wu5d448dd2007-11-12 23:24:42 +080050#include <asm/portmux.h>
Michael Hennerich14b03202008-05-07 11:41:26 +080051#include <asm/dpmc.h>
Michael Hennerich59003142007-10-21 16:54:27 +080052#include <linux/spi/ad7877.h>
53
54/*
55 * Name the Board for the /proc/cpuinfo
56 */
Mike Frysinger066954a2007-10-21 22:36:06 +080057const char bfin_board_name[] = "ADDS-BF527-EZKIT";
Michael Hennerich59003142007-10-21 16:54:27 +080058
59/*
60 * Driver needs to know address, irq and flag pin.
61 */
62
Michael Hennerich59003142007-10-21 16:54:27 +080063#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
Michael Hennerich3f375692008-11-18 17:48:22 +080064#include <linux/usb/isp1760.h>
65static struct resource bfin_isp1760_resources[] = {
Michael Hennerich59003142007-10-21 16:54:27 +080066 [0] = {
Michael Hennerich3f375692008-11-18 17:48:22 +080067 .start = 0x203C0000,
68 .end = 0x203C0000 + 0x000fffff,
Michael Hennerich59003142007-10-21 16:54:27 +080069 .flags = IORESOURCE_MEM,
70 },
71 [1] = {
Michael Hennerich3f375692008-11-18 17:48:22 +080072 .start = IRQ_PF7,
73 .end = IRQ_PF7,
Michael Hennerich59003142007-10-21 16:54:27 +080074 .flags = IORESOURCE_IRQ,
75 },
76};
77
Michael Hennerich3f375692008-11-18 17:48:22 +080078static struct isp1760_platform_data isp1760_priv = {
79 .is_isp1761 = 0,
80 .port1_disable = 0,
81 .bus_width_16 = 1,
82 .port1_otg = 0,
83 .analog_oc = 0,
84 .dack_polarity_high = 0,
85 .dreq_polarity_high = 0,
86};
87
88static struct platform_device bfin_isp1760_device = {
89 .name = "isp1760-hcd",
Michael Hennerich59003142007-10-21 16:54:27 +080090 .id = 0,
Michael Hennerich3f375692008-11-18 17:48:22 +080091 .dev = {
92 .platform_data = &isp1760_priv,
93 },
94 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
95 .resource = bfin_isp1760_resources,
Michael Hennerich59003142007-10-21 16:54:27 +080096};
Michael Hennerich59003142007-10-21 16:54:27 +080097#endif
98
Michael Hennerich1089e222007-12-24 11:49:29 +080099#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
100static struct resource musb_resources[] = {
101 [0] = {
102 .start = 0xffc03800,
103 .end = 0xffc03cff,
104 .flags = IORESOURCE_MEM,
105 },
106 [1] = { /* general IRQ */
107 .start = IRQ_USB_INT0,
108 .end = IRQ_USB_INT0,
109 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
110 },
111 [2] = { /* DMA IRQ */
112 .start = IRQ_USB_DMA,
113 .end = IRQ_USB_DMA,
114 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
115 },
116};
117
Bryan Wu50041ac2008-10-08 13:39:40 +0800118static struct musb_hdrc_config musb_config = {
119 .multipoint = 0,
120 .dyn_fifo = 0,
121 .soft_con = 1,
122 .dma = 1,
123 .num_eps = 7,
124 .dma_channels = 7,
125 .gpio_vrsel = GPIO_PG13,
126};
127
Michael Hennerich1089e222007-12-24 11:49:29 +0800128static struct musb_hdrc_platform_data musb_plat = {
129#if defined(CONFIG_USB_MUSB_OTG)
130 .mode = MUSB_OTG,
131#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
132 .mode = MUSB_HOST,
133#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
134 .mode = MUSB_PERIPHERAL,
135#endif
Bryan Wu50041ac2008-10-08 13:39:40 +0800136 .config = &musb_config,
Michael Hennerich1089e222007-12-24 11:49:29 +0800137};
138
139static u64 musb_dmamask = ~(u32)0;
140
141static struct platform_device musb_device = {
142 .name = "musb_hdrc",
143 .id = 0,
144 .dev = {
145 .dma_mask = &musb_dmamask,
146 .coherent_dma_mask = 0xffffffff,
147 .platform_data = &musb_plat,
148 },
149 .num_resources = ARRAY_SIZE(musb_resources),
150 .resource = musb_resources,
151};
152#endif
153
154#if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
155
156static struct resource bf52x_t350mcqb_resources[] = {
157 {
158 .start = IRQ_PPI_ERROR,
159 .end = IRQ_PPI_ERROR,
160 .flags = IORESOURCE_IRQ,
161 },
162};
163
164static struct platform_device bf52x_t350mcqb_device = {
165 .name = "bfin-t350mcqb",
166 .id = -1,
167 .num_resources = ARRAY_SIZE(bf52x_t350mcqb_resources),
168 .resource = bf52x_t350mcqb_resources,
169};
170#endif
171
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800172#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
173static struct mtd_partition ezkit_partitions[] = {
174 {
Robin Getzaa582972008-08-05 17:47:29 +0800175 .name = "bootloader(nor)",
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800176 .size = 0x40000,
177 .offset = 0,
178 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800179 .name = "linux kernel(nor)",
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800180 .size = 0x1C0000,
181 .offset = MTDPART_OFS_APPEND,
182 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800183 .name = "file system(nor)",
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800184 .size = MTDPART_SIZ_FULL,
185 .offset = MTDPART_OFS_APPEND,
186 }
187};
188
189static struct physmap_flash_data ezkit_flash_data = {
190 .width = 2,
191 .parts = ezkit_partitions,
192 .nr_parts = ARRAY_SIZE(ezkit_partitions),
193};
194
195static struct resource ezkit_flash_resource = {
196 .start = 0x20000000,
197 .end = 0x203fffff,
198 .flags = IORESOURCE_MEM,
199};
200
201static struct platform_device ezkit_flash_device = {
202 .name = "physmap-flash",
203 .id = 0,
204 .dev = {
205 .platform_data = &ezkit_flash_data,
206 },
207 .num_resources = 1,
208 .resource = &ezkit_flash_resource,
209};
210#endif
211
Michael Hennerich64307f72007-10-29 16:55:18 +0800212#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
213static struct mtd_partition partition_info[] = {
214 {
Robin Getzaa582972008-08-05 17:47:29 +0800215 .name = "linux kernel(nand)",
Michael Hennerich64307f72007-10-29 16:55:18 +0800216 .offset = 0,
Mike Frysingerf4585a02008-10-13 14:45:21 +0800217 .size = 4 * 1024 * 1024,
Michael Hennerich64307f72007-10-29 16:55:18 +0800218 },
219 {
Robin Getzaa582972008-08-05 17:47:29 +0800220 .name = "file system(nand)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800221 .offset = MTDPART_OFS_APPEND,
222 .size = MTDPART_SIZ_FULL,
Michael Hennerich64307f72007-10-29 16:55:18 +0800223 },
224};
225
226static struct bf5xx_nand_platform bf5xx_nand_platform = {
227 .page_size = NFC_PG_SIZE_256,
228 .data_width = NFC_NWIDTH_8,
229 .partitions = partition_info,
230 .nr_partitions = ARRAY_SIZE(partition_info),
231 .rd_dly = 3,
232 .wr_dly = 3,
233};
234
235static struct resource bf5xx_nand_resources[] = {
236 {
237 .start = NFC_CTL,
238 .end = NFC_DATA_RD + 2,
239 .flags = IORESOURCE_MEM,
240 },
241 {
242 .start = CH_NFC,
243 .end = CH_NFC,
244 .flags = IORESOURCE_IRQ,
245 },
246};
247
248static struct platform_device bf5xx_nand_device = {
249 .name = "bf5xx-nand",
250 .id = 0,
251 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
252 .resource = bf5xx_nand_resources,
253 .dev = {
254 .platform_data = &bf5xx_nand_platform,
255 },
256};
257#endif
258
Michael Hennerich59003142007-10-21 16:54:27 +0800259#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
260static struct resource bfin_pcmcia_cf_resources[] = {
261 {
262 .start = 0x20310000, /* IO PORT */
263 .end = 0x20312000,
264 .flags = IORESOURCE_MEM,
265 }, {
266 .start = 0x20311000, /* Attribute Memory */
267 .end = 0x20311FFF,
268 .flags = IORESOURCE_MEM,
269 }, {
270 .start = IRQ_PF4,
271 .end = IRQ_PF4,
272 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
273 }, {
274 .start = 6, /* Card Detect PF6 */
275 .end = 6,
276 .flags = IORESOURCE_IRQ,
277 },
278};
279
280static struct platform_device bfin_pcmcia_cf_device = {
281 .name = "bfin_cf_pcmcia",
282 .id = -1,
283 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
284 .resource = bfin_pcmcia_cf_resources,
285};
286#endif
287
288#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
289static struct platform_device rtc_device = {
290 .name = "rtc-bfin",
291 .id = -1,
292};
293#endif
294
295#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
296static struct resource smc91x_resources[] = {
297 {
298 .name = "smc91x-regs",
299 .start = 0x20300300,
300 .end = 0x20300300 + 16,
301 .flags = IORESOURCE_MEM,
302 }, {
303
304 .start = IRQ_PF7,
305 .end = IRQ_PF7,
306 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
307 },
308};
309static struct platform_device smc91x_device = {
310 .name = "smc91x",
311 .id = 0,
312 .num_resources = ARRAY_SIZE(smc91x_resources),
313 .resource = smc91x_resources,
314};
315#endif
316
317#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
318static struct resource dm9000_resources[] = {
319 [0] = {
320 .start = 0x203FB800,
Laurent Pinchartda3854f2008-06-24 22:15:58 +0100321 .end = 0x203FB800 + 1,
Michael Hennerich59003142007-10-21 16:54:27 +0800322 .flags = IORESOURCE_MEM,
323 },
324 [1] = {
Laurent Pinchartda3854f2008-06-24 22:15:58 +0100325 .start = 0x203FB800 + 4,
326 .end = 0x203FB800 + 5,
327 .flags = IORESOURCE_MEM,
328 },
329 [2] = {
Michael Hennerich59003142007-10-21 16:54:27 +0800330 .start = IRQ_PF9,
331 .end = IRQ_PF9,
332 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
333 },
334};
335
336static struct platform_device dm9000_device = {
337 .name = "dm9000",
338 .id = -1,
339 .num_resources = ARRAY_SIZE(dm9000_resources),
340 .resource = dm9000_resources,
341};
342#endif
343
344#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
345static struct resource sl811_hcd_resources[] = {
346 {
347 .start = 0x20340000,
348 .end = 0x20340000,
349 .flags = IORESOURCE_MEM,
350 }, {
351 .start = 0x20340004,
352 .end = 0x20340004,
353 .flags = IORESOURCE_MEM,
354 }, {
355 .start = CONFIG_USB_SL811_BFIN_IRQ,
356 .end = CONFIG_USB_SL811_BFIN_IRQ,
357 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
358 },
359};
360
361#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
362void sl811_port_power(struct device *dev, int is_on)
363{
364 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
Michael Hennerichacbcd262008-01-22 18:36:20 +0800365 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
Michael Hennerich59003142007-10-21 16:54:27 +0800366}
367#endif
368
369static struct sl811_platform_data sl811_priv = {
370 .potpg = 10,
371 .power = 250, /* == 500mA */
372#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
373 .port_power = &sl811_port_power,
374#endif
375};
376
377static struct platform_device sl811_hcd_device = {
378 .name = "sl811-hcd",
379 .id = 0,
380 .dev = {
381 .platform_data = &sl811_priv,
382 },
383 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
384 .resource = sl811_hcd_resources,
385};
386#endif
387
388#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
389static struct resource isp1362_hcd_resources[] = {
390 {
391 .start = 0x20360000,
392 .end = 0x20360000,
393 .flags = IORESOURCE_MEM,
394 }, {
395 .start = 0x20360004,
396 .end = 0x20360004,
397 .flags = IORESOURCE_MEM,
398 }, {
399 .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
400 .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
401 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
402 },
403};
404
405static struct isp1362_platform_data isp1362_priv = {
406 .sel15Kres = 1,
407 .clknotstop = 0,
408 .oc_enable = 0,
409 .int_act_high = 0,
410 .int_edge_triggered = 0,
411 .remote_wakeup_connected = 0,
412 .no_power_switching = 1,
413 .power_switching_mode = 0,
414};
415
416static struct platform_device isp1362_hcd_device = {
417 .name = "isp1362-hcd",
418 .id = 0,
419 .dev = {
420 .platform_data = &isp1362_priv,
421 },
422 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
423 .resource = isp1362_hcd_resources,
424};
425#endif
426
427#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
428static struct platform_device bfin_mac_device = {
429 .name = "bfin_mac",
430};
431#endif
432
433#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
434static struct resource net2272_bfin_resources[] = {
435 {
436 .start = 0x20300000,
437 .end = 0x20300000 + 0x100,
438 .flags = IORESOURCE_MEM,
439 }, {
440 .start = IRQ_PF7,
441 .end = IRQ_PF7,
442 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
443 },
444};
445
446static struct platform_device net2272_bfin_device = {
447 .name = "net2272",
448 .id = -1,
449 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
450 .resource = net2272_bfin_resources,
451};
452#endif
453
Michael Hennerich59003142007-10-21 16:54:27 +0800454#if defined(CONFIG_MTD_M25P80) \
455 || defined(CONFIG_MTD_M25P80_MODULE)
456static struct mtd_partition bfin_spi_flash_partitions[] = {
457 {
Robin Getzaa582972008-08-05 17:47:29 +0800458 .name = "bootloader(spi)",
Grace Panac76d882008-04-24 06:33:56 +0800459 .size = 0x00040000,
Michael Hennerich59003142007-10-21 16:54:27 +0800460 .offset = 0,
461 .mask_flags = MTD_CAP_ROM
462 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800463 .name = "linux kernel(spi)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800464 .size = MTDPART_SIZ_FULL,
465 .offset = MTDPART_OFS_APPEND,
Michael Hennerich59003142007-10-21 16:54:27 +0800466 }
467};
468
469static struct flash_platform_data bfin_spi_flash_data = {
470 .name = "m25p80",
471 .parts = bfin_spi_flash_partitions,
472 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
Michael Hennerichb9c9e782008-05-07 11:41:26 +0800473 .type = "m25p16",
Michael Hennerich59003142007-10-21 16:54:27 +0800474};
475
476/* SPI flash chip (m25p64) */
477static struct bfin5xx_spi_chip spi_flash_chip_info = {
478 .enable_dma = 0, /* use dma transfer with this chip*/
479 .bits_per_word = 8,
480};
481#endif
482
483#if defined(CONFIG_SPI_ADC_BF533) \
484 || defined(CONFIG_SPI_ADC_BF533_MODULE)
485/* SPI ADC chip */
486static struct bfin5xx_spi_chip spi_adc_chip_info = {
487 .enable_dma = 1, /* use dma transfer with this chip*/
488 .bits_per_word = 16,
489};
490#endif
491
492#if defined(CONFIG_SND_BLACKFIN_AD1836) \
493 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
494static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
495 .enable_dma = 0,
496 .bits_per_word = 16,
497};
498#endif
499
500#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
501static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
502 .enable_dma = 0,
503 .bits_per_word = 16,
504};
505#endif
506
507#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
508static struct bfin5xx_spi_chip spi_mmc_chip_info = {
509 .enable_dma = 1,
510 .bits_per_word = 8,
511};
512#endif
513
514#if defined(CONFIG_PBX)
515static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
516 .ctl_reg = 0x4, /* send zero */
517 .enable_dma = 0,
518 .bits_per_word = 8,
519 .cs_change_per_word = 1,
520};
521#endif
522
Michael Hennerich59003142007-10-21 16:54:27 +0800523#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
524static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
525 .enable_dma = 0,
526 .bits_per_word = 16,
527};
528
529static const struct ad7877_platform_data bfin_ad7877_ts_info = {
530 .model = 7877,
531 .vref_delay_usecs = 50, /* internal, no capacitor */
532 .x_plate_ohms = 419,
533 .y_plate_ohms = 486,
534 .pressure_max = 1000,
535 .pressure_min = 0,
536 .stopacq_polarity = 1,
537 .first_conversion_delay = 3,
538 .acquisition_time = 1,
539 .averaging = 1,
540 .pen_down_acc_interval = 1,
541};
542#endif
543
Michael Hennerichc7d48962007-11-15 21:33:31 +0800544#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
Michael Hennerich0954f702007-11-13 00:16:19 +0800545 && defined(CONFIG_SND_SOC_WM8731_SPI)
546static struct bfin5xx_spi_chip spi_wm8731_chip_info = {
547 .enable_dma = 0,
548 .bits_per_word = 16,
549};
550#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800551
552#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
553static struct bfin5xx_spi_chip spidev_chip_info = {
554 .enable_dma = 0,
555 .bits_per_word = 8,
556};
557#endif
558
Michael Hennerich59003142007-10-21 16:54:27 +0800559static struct spi_board_info bfin_spi_board_info[] __initdata = {
560#if defined(CONFIG_MTD_M25P80) \
561 || defined(CONFIG_MTD_M25P80_MODULE)
562 {
563 /* the modalias must be the same as spi device driver name */
564 .modalias = "m25p80", /* Name of spi_driver for this device */
565 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
566 .bus_num = 0, /* Framework bus number */
567 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
568 .platform_data = &bfin_spi_flash_data,
569 .controller_data = &spi_flash_chip_info,
570 .mode = SPI_MODE_3,
571 },
572#endif
573
574#if defined(CONFIG_SPI_ADC_BF533) \
575 || defined(CONFIG_SPI_ADC_BF533_MODULE)
576 {
577 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
578 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
579 .bus_num = 0, /* Framework bus number */
580 .chip_select = 1, /* Framework chip select. */
581 .platform_data = NULL, /* No spi_driver specific config */
582 .controller_data = &spi_adc_chip_info,
583 },
584#endif
585
586#if defined(CONFIG_SND_BLACKFIN_AD1836) \
587 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
588 {
589 .modalias = "ad1836-spi",
590 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
591 .bus_num = 0,
592 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
593 .controller_data = &ad1836_spi_chip_info,
594 },
595#endif
596#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
597 {
598 .modalias = "ad9960-spi",
599 .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
600 .bus_num = 0,
601 .chip_select = 1,
602 .controller_data = &ad9960_spi_chip_info,
603 },
604#endif
605#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
606 {
607 .modalias = "spi_mmc_dummy",
608 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
609 .bus_num = 0,
610 .chip_select = 0,
611 .platform_data = NULL,
612 .controller_data = &spi_mmc_chip_info,
613 .mode = SPI_MODE_3,
614 },
615 {
616 .modalias = "spi_mmc",
617 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
618 .bus_num = 0,
619 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
620 .platform_data = NULL,
621 .controller_data = &spi_mmc_chip_info,
622 .mode = SPI_MODE_3,
623 },
624#endif
625#if defined(CONFIG_PBX)
626 {
627 .modalias = "fxs-spi",
628 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
629 .bus_num = 0,
630 .chip_select = 8 - CONFIG_J11_JUMPER,
631 .controller_data = &spi_si3xxx_chip_info,
632 .mode = SPI_MODE_3,
633 },
634 {
635 .modalias = "fxo-spi",
636 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
637 .bus_num = 0,
638 .chip_select = 8 - CONFIG_J19_JUMPER,
639 .controller_data = &spi_si3xxx_chip_info,
640 .mode = SPI_MODE_3,
641 },
642#endif
Michael Hennerich59003142007-10-21 16:54:27 +0800643#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
644 {
645 .modalias = "ad7877",
646 .platform_data = &bfin_ad7877_ts_info,
Bryan Wu2eb74ae2008-05-31 15:17:25 +0800647 .irq = IRQ_PF8,
Michael Hennerich59003142007-10-21 16:54:27 +0800648 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Michael Hennerich0954f702007-11-13 00:16:19 +0800649 .bus_num = 0,
Bryan Wu2eb74ae2008-05-31 15:17:25 +0800650 .chip_select = 2,
Michael Hennerich59003142007-10-21 16:54:27 +0800651 .controller_data = &spi_ad7877_chip_info,
652 },
653#endif
Michael Hennerichc7d48962007-11-15 21:33:31 +0800654#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
Michael Hennerich0954f702007-11-13 00:16:19 +0800655 && defined(CONFIG_SND_SOC_WM8731_SPI)
656 {
657 .modalias = "wm8731",
658 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
659 .bus_num = 0,
660 .chip_select = 5,
661 .controller_data = &spi_wm8731_chip_info,
662 .mode = SPI_MODE_0,
663 },
664#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800665#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
666 {
667 .modalias = "spidev",
668 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
669 .bus_num = 0,
670 .chip_select = 1,
671 .controller_data = &spidev_chip_info,
672 },
673#endif
Michael Hennerich59003142007-10-21 16:54:27 +0800674};
675
Mike Frysinger5bda2722008-06-07 15:03:01 +0800676#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800677/* SPI controller data */
678static struct bfin5xx_spi_master bfin_spi0_info = {
679 .num_chipselect = 8,
680 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800681 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Michael Hennerich59003142007-10-21 16:54:27 +0800682};
683
684/* SPI (0) */
685static struct resource bfin_spi0_resource[] = {
686 [0] = {
687 .start = SPI0_REGBASE,
688 .end = SPI0_REGBASE + 0xFF,
689 .flags = IORESOURCE_MEM,
690 },
691 [1] = {
692 .start = CH_SPI,
693 .end = CH_SPI,
694 .flags = IORESOURCE_IRQ,
695 },
696};
697
698static struct platform_device bfin_spi0_device = {
699 .name = "bfin-spi",
700 .id = 0, /* Bus number */
701 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
702 .resource = bfin_spi0_resource,
703 .dev = {
704 .platform_data = &bfin_spi0_info, /* Passed to driver */
705 },
706};
707#endif /* spi master and devices */
708
709#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
710static struct platform_device bfin_fb_device = {
711 .name = "bf537-lq035",
712};
713#endif
714
715#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
716static struct platform_device bfin_fb_adv7393_device = {
717 .name = "bfin-adv7393",
718};
719#endif
720
721#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
722static struct resource bfin_uart_resources[] = {
723#ifdef CONFIG_SERIAL_BFIN_UART0
724 {
725 .start = 0xFFC00400,
726 .end = 0xFFC004FF,
727 .flags = IORESOURCE_MEM,
728 },
729#endif
730#ifdef CONFIG_SERIAL_BFIN_UART1
731 {
732 .start = 0xFFC02000,
733 .end = 0xFFC020FF,
734 .flags = IORESOURCE_MEM,
735 },
736#endif
737};
738
739static struct platform_device bfin_uart_device = {
740 .name = "bfin-uart",
741 .id = 1,
742 .num_resources = ARRAY_SIZE(bfin_uart_resources),
743 .resource = bfin_uart_resources,
744};
745#endif
746
Graf Yang5be36d22008-04-25 03:09:15 +0800747#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
748static struct resource bfin_sir_resources[] = {
749#ifdef CONFIG_BFIN_SIR0
750 {
751 .start = 0xFFC00400,
752 .end = 0xFFC004FF,
753 .flags = IORESOURCE_MEM,
754 },
755#endif
756#ifdef CONFIG_BFIN_SIR1
757 {
758 .start = 0xFFC02000,
759 .end = 0xFFC020FF,
760 .flags = IORESOURCE_MEM,
761 },
762#endif
763};
764
765static struct platform_device bfin_sir_device = {
766 .name = "bfin_sir",
767 .id = 0,
768 .num_resources = ARRAY_SIZE(bfin_sir_resources),
769 .resource = bfin_sir_resources,
770};
771#endif
772
Michael Hennerich59003142007-10-21 16:54:27 +0800773#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
774static struct resource bfin_twi0_resource[] = {
775 [0] = {
776 .start = TWI0_REGBASE,
777 .end = TWI0_REGBASE,
778 .flags = IORESOURCE_MEM,
779 },
780 [1] = {
781 .start = IRQ_TWI,
782 .end = IRQ_TWI,
783 .flags = IORESOURCE_IRQ,
784 },
785};
786
787static struct platform_device i2c_bfin_twi_device = {
788 .name = "i2c-bfin-twi",
789 .id = 0,
790 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
791 .resource = bfin_twi0_resource,
792};
793#endif
794
Bryan Wu72268682008-05-07 11:41:26 +0800795#ifdef CONFIG_I2C_BOARDINFO
796static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
797#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
798 {
799 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
Bryan Wu72268682008-05-07 11:41:26 +0800800 },
801#endif
802#if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
803 {
804 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
Bryan Wu72268682008-05-07 11:41:26 +0800805 .irq = IRQ_PF8,
806 },
807#endif
808};
809#endif
810
Michael Hennerich59003142007-10-21 16:54:27 +0800811#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
812static struct platform_device bfin_sport0_uart_device = {
813 .name = "bfin-sport-uart",
814 .id = 0,
815};
816
817static struct platform_device bfin_sport1_uart_device = {
818 .name = "bfin-sport-uart",
819 .id = 1,
820};
821#endif
822
Michael Hennerich1089e222007-12-24 11:49:29 +0800823#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
824#include <linux/input.h>
825#include <linux/gpio_keys.h>
826
827static struct gpio_keys_button bfin_gpio_keys_table[] = {
828 {BTN_0, GPIO_PG0, 1, "gpio-keys: BTN0"},
829 {BTN_1, GPIO_PG13, 1, "gpio-keys: BTN1"},
830};
831
832static struct gpio_keys_platform_data bfin_gpio_keys_data = {
833 .buttons = bfin_gpio_keys_table,
834 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
835};
836
837static struct platform_device bfin_device_gpiokeys = {
838 .name = "gpio-keys",
839 .dev = {
840 .platform_data = &bfin_gpio_keys_data,
841 },
842};
843#endif
844
Michael Hennerichaca5e4a2008-10-08 14:27:59 +0800845#if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE)
846#include <linux/input.h>
847#include <asm/bfin_rotary.h>
848
849static struct bfin_rotary_platform_data bfin_rotary_data = {
850 /*.rotary_up_key = KEY_UP,*/
851 /*.rotary_down_key = KEY_DOWN,*/
852 .rotary_rel_code = REL_WHEEL,
853 .rotary_button_key = KEY_ENTER,
854 .debounce = 10, /* 0..17 */
855 .mode = ROT_QUAD_ENC | ROT_DEBE,
856};
857
858static struct resource bfin_rotary_resources[] = {
859 {
860 .start = IRQ_CNT,
861 .end = IRQ_CNT,
862 .flags = IORESOURCE_IRQ,
863 },
864};
865
866static struct platform_device bfin_rotary_device = {
867 .name = "bfin-rotary",
868 .id = -1,
869 .num_resources = ARRAY_SIZE(bfin_rotary_resources),
870 .resource = bfin_rotary_resources,
871 .dev = {
872 .platform_data = &bfin_rotary_data,
873 },
874};
875#endif
876
Mike Frysingercad2ab62008-02-22 17:01:31 +0800877static struct resource bfin_gpios_resources = {
878 .start = 0,
879 .end = MAX_BLACKFIN_GPIOS - 1,
880 .flags = IORESOURCE_IRQ,
881};
882
883static struct platform_device bfin_gpios_device = {
884 .name = "simple-gpio",
885 .id = -1,
886 .num_resources = 1,
887 .resource = &bfin_gpios_resources,
888};
889
Michael Hennerich14b03202008-05-07 11:41:26 +0800890static const unsigned int cclk_vlev_datasheet[] =
891{
892 VRPAIR(VLEV_100, 400000000),
893 VRPAIR(VLEV_105, 426000000),
894 VRPAIR(VLEV_110, 500000000),
895 VRPAIR(VLEV_115, 533000000),
896 VRPAIR(VLEV_120, 600000000),
897};
898
899static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
900 .tuple_tab = cclk_vlev_datasheet,
901 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
902 .vr_settling_time = 25 /* us */,
903};
904
905static struct platform_device bfin_dpmc = {
906 .name = "bfin dpmc",
907 .dev = {
908 .platform_data = &bfin_dmpc_vreg_data,
909 },
910};
911
Michael Hennerich59003142007-10-21 16:54:27 +0800912static struct platform_device *stamp_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +0800913
914 &bfin_dpmc,
915
Michael Hennerich64307f72007-10-29 16:55:18 +0800916#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
917 &bf5xx_nand_device,
918#endif
919
Michael Hennerich59003142007-10-21 16:54:27 +0800920#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
921 &bfin_pcmcia_cf_device,
922#endif
923
924#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
925 &rtc_device,
926#endif
927
928#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
929 &sl811_hcd_device,
930#endif
931
932#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
933 &isp1362_hcd_device,
934#endif
935
Michael Hennerich3f375692008-11-18 17:48:22 +0800936#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
937 &bfin_isp1760_device,
938#endif
939
Michael Hennerich1089e222007-12-24 11:49:29 +0800940#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
941 &musb_device,
942#endif
943
Michael Hennerich59003142007-10-21 16:54:27 +0800944#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
945 &smc91x_device,
946#endif
947
948#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
949 &dm9000_device,
950#endif
951
952#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
953 &bfin_mac_device,
954#endif
955
956#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
957 &net2272_bfin_device,
958#endif
959
960#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
961 &bfin_spi0_device,
962#endif
963
964#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
965 &bfin_fb_device,
966#endif
967
Michael Hennerich1089e222007-12-24 11:49:29 +0800968#if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
969 &bf52x_t350mcqb_device,
970#endif
971
Michael Hennerich59003142007-10-21 16:54:27 +0800972#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
973 &bfin_fb_adv7393_device,
974#endif
975
976#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
977 &bfin_uart_device,
978#endif
979
Graf Yang5be36d22008-04-25 03:09:15 +0800980#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
981 &bfin_sir_device,
982#endif
983
Michael Hennerich59003142007-10-21 16:54:27 +0800984#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
985 &i2c_bfin_twi_device,
986#endif
987
988#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
989 &bfin_sport0_uart_device,
990 &bfin_sport1_uart_device,
991#endif
992
Michael Hennerich1089e222007-12-24 11:49:29 +0800993#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
994 &bfin_device_gpiokeys,
995#endif
Mike Frysingercad2ab62008-02-22 17:01:31 +0800996
Michael Hennerichaca5e4a2008-10-08 14:27:59 +0800997#if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE)
998 &bfin_rotary_device,
999#endif
1000
Michael Hennerichd7e5dd42008-05-07 11:41:26 +08001001#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
1002 &ezkit_flash_device,
1003#endif
1004
Mike Frysingercad2ab62008-02-22 17:01:31 +08001005 &bfin_gpios_device,
Michael Hennerich59003142007-10-21 16:54:27 +08001006};
1007
1008static int __init stamp_init(void)
1009{
Harvey Harrisonb85d8582008-04-23 09:39:01 +08001010 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Bryan Wu72268682008-05-07 11:41:26 +08001011
1012#ifdef CONFIG_I2C_BOARDINFO
1013 i2c_register_board_info(0, bfin_i2c_board_info,
1014 ARRAY_SIZE(bfin_i2c_board_info));
1015#endif
1016
Michael Hennerich59003142007-10-21 16:54:27 +08001017 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
Mike Frysinger5bda2722008-06-07 15:03:01 +08001018 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
Michael Hennerich59003142007-10-21 16:54:27 +08001019 return 0;
1020}
1021
1022arch_initcall(stamp_init);
1023
1024void native_machine_restart(char *cmd)
1025{
1026 /* workaround reboot hang when booting from SPI */
1027 if ((bfin_read_SYSCR() & 0x7) == 0x3)
1028 bfin_gpio_reset_spi0_ssel1();
1029}
Mike Frysinger137b1522007-11-22 16:07:03 +08001030
Mike Frysinger9862cc52007-11-15 21:21:20 +08001031void bfin_get_ether_addr(char *addr)
Mike Frysinger137b1522007-11-22 16:07:03 +08001032{
Mike Frysinger181afa942008-02-25 11:42:17 +08001033 /* the MAC is stored in OTP memory page 0xDF */
1034 u32 ret;
1035 u64 otp_mac;
1036 u32 (*otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)0xEF00001A;
1037
1038 ret = otp_read(0xDF, 0x00, &otp_mac);
1039 if (!(ret & 0x1)) {
1040 char *otp_mac_p = (char *)&otp_mac;
1041 for (ret = 0; ret < 6; ++ret)
1042 addr[ret] = otp_mac_p[5 - ret];
1043 }
Mike Frysinger137b1522007-11-22 16:07:03 +08001044}
Mike Frysinger9862cc52007-11-15 21:21:20 +08001045EXPORT_SYMBOL(bfin_get_ether_addr);