blob: fdfe8cae49bc49850b8e531bedab202fec884c05 [file] [log] [blame]
Michael Hennerich59003142007-10-21 16:54:27 +08001/*
Robin Getz96f10502009-09-24 14:11:24 +00002 * Copyright 2004-2009 Analog Devices Inc.
3 * 2005 National ICT Australia (NICTA)
4 * Aidan Williams <aidan@nicta.com.au>
Michael Hennerich59003142007-10-21 16:54:27 +08005 *
Robin Getz96f10502009-09-24 14:11:24 +00006 * Licensed under the GPL-2 or later.
Michael Hennerich59003142007-10-21 16:54:27 +08007 */
8
9#include <linux/device.h>
10#include <linux/platform_device.h>
11#include <linux/mtd/mtd.h>
12#include <linux/mtd/partitions.h>
Michael Hennerichd7e5dd42008-05-07 11:41:26 +080013#include <linux/mtd/physmap.h>
Michael Hennerich59003142007-10-21 16:54:27 +080014#include <linux/spi/spi.h>
15#include <linux/spi/flash.h>
Bryan Wu72268682008-05-07 11:41:26 +080016#include <linux/i2c.h>
Michael Hennerich59003142007-10-21 16:54:27 +080017#include <linux/irq.h>
18#include <linux/interrupt.h>
Mike Frysinger632f6582007-11-15 21:25:47 +080019#include <linux/usb/sl811.h>
Michael Hennerich1089e222007-12-24 11:49:29 +080020#include <linux/usb/musb.h>
Michael Hennerich6924dfb2009-12-07 13:41:28 +000021#include <linux/leds.h>
22#include <linux/input.h>
Michael Hennerich59003142007-10-21 16:54:27 +080023#include <asm/dma.h>
24#include <asm/bfin5xx_spi.h>
25#include <asm/reboot.h>
Michael Hennerich64307f72007-10-29 16:55:18 +080026#include <asm/nand.h>
Bryan Wu5d448dd2007-11-12 23:24:42 +080027#include <asm/portmux.h>
Michael Hennerich14b03202008-05-07 11:41:26 +080028#include <asm/dpmc.h>
Michael Hennerich59003142007-10-21 16:54:27 +080029#include <linux/spi/ad7877.h>
30
31/*
32 * Name the Board for the /proc/cpuinfo
33 */
Michael Hennerich6924dfb2009-12-07 13:41:28 +000034#ifdef CONFIG_BFIN527_EZKIT_V2
35const char bfin_board_name[] = "ADI BF527-EZKIT V2";
36#else
Mike Frysingerfe85cad2008-11-18 17:48:22 +080037const char bfin_board_name[] = "ADI BF527-EZKIT";
Michael Hennerich6924dfb2009-12-07 13:41:28 +000038#endif
Michael Hennerich59003142007-10-21 16:54:27 +080039
40/*
41 * Driver needs to know address, irq and flag pin.
42 */
43
Michael Hennerich59003142007-10-21 16:54:27 +080044#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
Michael Hennerich3f375692008-11-18 17:48:22 +080045#include <linux/usb/isp1760.h>
46static struct resource bfin_isp1760_resources[] = {
Michael Hennerich59003142007-10-21 16:54:27 +080047 [0] = {
Michael Hennerich3f375692008-11-18 17:48:22 +080048 .start = 0x203C0000,
49 .end = 0x203C0000 + 0x000fffff,
Michael Hennerich59003142007-10-21 16:54:27 +080050 .flags = IORESOURCE_MEM,
51 },
52 [1] = {
Michael Hennerich3f375692008-11-18 17:48:22 +080053 .start = IRQ_PF7,
54 .end = IRQ_PF7,
Michael Hennerich59003142007-10-21 16:54:27 +080055 .flags = IORESOURCE_IRQ,
56 },
57};
58
Michael Hennerich3f375692008-11-18 17:48:22 +080059static struct isp1760_platform_data isp1760_priv = {
60 .is_isp1761 = 0,
Michael Hennerich3f375692008-11-18 17:48:22 +080061 .bus_width_16 = 1,
62 .port1_otg = 0,
63 .analog_oc = 0,
64 .dack_polarity_high = 0,
65 .dreq_polarity_high = 0,
66};
67
68static struct platform_device bfin_isp1760_device = {
Michael Hennerichc6feb7682009-10-15 10:37:33 +000069 .name = "isp1760",
Michael Hennerich59003142007-10-21 16:54:27 +080070 .id = 0,
Michael Hennerich3f375692008-11-18 17:48:22 +080071 .dev = {
72 .platform_data = &isp1760_priv,
73 },
74 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
75 .resource = bfin_isp1760_resources,
Michael Hennerich59003142007-10-21 16:54:27 +080076};
Michael Hennerich59003142007-10-21 16:54:27 +080077#endif
78
Michael Hennerich1089e222007-12-24 11:49:29 +080079#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
80static struct resource musb_resources[] = {
81 [0] = {
82 .start = 0xffc03800,
83 .end = 0xffc03cff,
84 .flags = IORESOURCE_MEM,
85 },
86 [1] = { /* general IRQ */
87 .start = IRQ_USB_INT0,
88 .end = IRQ_USB_INT0,
89 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
90 },
91 [2] = { /* DMA IRQ */
92 .start = IRQ_USB_DMA,
93 .end = IRQ_USB_DMA,
94 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
95 },
96};
97
Bryan Wu50041ac2008-10-08 13:39:40 +080098static struct musb_hdrc_config musb_config = {
99 .multipoint = 0,
100 .dyn_fifo = 0,
101 .soft_con = 1,
102 .dma = 1,
Bryan Wufea05da2009-01-07 23:14:39 +0800103 .num_eps = 8,
104 .dma_channels = 8,
Bryan Wu50041ac2008-10-08 13:39:40 +0800105 .gpio_vrsel = GPIO_PG13,
106};
107
Michael Hennerich1089e222007-12-24 11:49:29 +0800108static struct musb_hdrc_platform_data musb_plat = {
109#if defined(CONFIG_USB_MUSB_OTG)
110 .mode = MUSB_OTG,
111#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
112 .mode = MUSB_HOST,
113#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
114 .mode = MUSB_PERIPHERAL,
115#endif
Bryan Wu50041ac2008-10-08 13:39:40 +0800116 .config = &musb_config,
Michael Hennerich1089e222007-12-24 11:49:29 +0800117};
118
119static u64 musb_dmamask = ~(u32)0;
120
121static struct platform_device musb_device = {
122 .name = "musb_hdrc",
123 .id = 0,
124 .dev = {
125 .dma_mask = &musb_dmamask,
126 .coherent_dma_mask = 0xffffffff,
127 .platform_data = &musb_plat,
128 },
129 .num_resources = ARRAY_SIZE(musb_resources),
130 .resource = musb_resources,
131};
132#endif
133
134#if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
135
136static struct resource bf52x_t350mcqb_resources[] = {
137 {
138 .start = IRQ_PPI_ERROR,
139 .end = IRQ_PPI_ERROR,
140 .flags = IORESOURCE_IRQ,
141 },
142};
143
144static struct platform_device bf52x_t350mcqb_device = {
145 .name = "bfin-t350mcqb",
146 .id = -1,
147 .num_resources = ARRAY_SIZE(bf52x_t350mcqb_resources),
148 .resource = bf52x_t350mcqb_resources,
149};
150#endif
151
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000152#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
153#include <asm/bfin-lq035q1.h>
154
155static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
156 .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
Michael Hennerichd94a1aa2009-12-08 11:45:55 +0000157 .ppi_mode = USE_RGB565_8_BIT_PPI,
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000158};
159
160static struct resource bfin_lq035q1_resources[] = {
161 {
162 .start = IRQ_PPI_ERROR,
163 .end = IRQ_PPI_ERROR,
164 .flags = IORESOURCE_IRQ,
165 },
166};
167
168static struct platform_device bfin_lq035q1_device = {
169 .name = "bfin-lq035q1",
170 .id = -1,
171 .num_resources = ARRAY_SIZE(bfin_lq035q1_resources),
172 .resource = bfin_lq035q1_resources,
173 .dev = {
174 .platform_data = &bfin_lq035q1_data,
175 },
176};
177#endif
178
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800179#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
180static struct mtd_partition ezkit_partitions[] = {
181 {
Robin Getzaa582972008-08-05 17:47:29 +0800182 .name = "bootloader(nor)",
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800183 .size = 0x40000,
184 .offset = 0,
185 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800186 .name = "linux kernel(nor)",
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800187 .size = 0x1C0000,
188 .offset = MTDPART_OFS_APPEND,
189 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800190 .name = "file system(nor)",
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800191 .size = MTDPART_SIZ_FULL,
192 .offset = MTDPART_OFS_APPEND,
193 }
194};
195
196static struct physmap_flash_data ezkit_flash_data = {
197 .width = 2,
198 .parts = ezkit_partitions,
199 .nr_parts = ARRAY_SIZE(ezkit_partitions),
200};
201
202static struct resource ezkit_flash_resource = {
203 .start = 0x20000000,
204 .end = 0x203fffff,
205 .flags = IORESOURCE_MEM,
206};
207
208static struct platform_device ezkit_flash_device = {
209 .name = "physmap-flash",
210 .id = 0,
211 .dev = {
212 .platform_data = &ezkit_flash_data,
213 },
214 .num_resources = 1,
215 .resource = &ezkit_flash_resource,
216};
217#endif
218
Michael Hennerich64307f72007-10-29 16:55:18 +0800219#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
220static struct mtd_partition partition_info[] = {
221 {
Robin Getzaa582972008-08-05 17:47:29 +0800222 .name = "linux kernel(nand)",
Michael Hennerich64307f72007-10-29 16:55:18 +0800223 .offset = 0,
Mike Frysingerf4585a02008-10-13 14:45:21 +0800224 .size = 4 * 1024 * 1024,
Michael Hennerich64307f72007-10-29 16:55:18 +0800225 },
226 {
Robin Getzaa582972008-08-05 17:47:29 +0800227 .name = "file system(nand)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800228 .offset = MTDPART_OFS_APPEND,
229 .size = MTDPART_SIZ_FULL,
Michael Hennerich64307f72007-10-29 16:55:18 +0800230 },
231};
232
233static struct bf5xx_nand_platform bf5xx_nand_platform = {
234 .page_size = NFC_PG_SIZE_256,
235 .data_width = NFC_NWIDTH_8,
236 .partitions = partition_info,
237 .nr_partitions = ARRAY_SIZE(partition_info),
238 .rd_dly = 3,
239 .wr_dly = 3,
240};
241
242static struct resource bf5xx_nand_resources[] = {
243 {
244 .start = NFC_CTL,
245 .end = NFC_DATA_RD + 2,
246 .flags = IORESOURCE_MEM,
247 },
248 {
249 .start = CH_NFC,
250 .end = CH_NFC,
251 .flags = IORESOURCE_IRQ,
252 },
253};
254
255static struct platform_device bf5xx_nand_device = {
256 .name = "bf5xx-nand",
257 .id = 0,
258 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
259 .resource = bf5xx_nand_resources,
260 .dev = {
261 .platform_data = &bf5xx_nand_platform,
262 },
263};
264#endif
265
Michael Hennerich59003142007-10-21 16:54:27 +0800266#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
267static struct resource bfin_pcmcia_cf_resources[] = {
268 {
269 .start = 0x20310000, /* IO PORT */
270 .end = 0x20312000,
271 .flags = IORESOURCE_MEM,
272 }, {
273 .start = 0x20311000, /* Attribute Memory */
274 .end = 0x20311FFF,
275 .flags = IORESOURCE_MEM,
276 }, {
277 .start = IRQ_PF4,
278 .end = IRQ_PF4,
279 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
280 }, {
281 .start = 6, /* Card Detect PF6 */
282 .end = 6,
283 .flags = IORESOURCE_IRQ,
284 },
285};
286
287static struct platform_device bfin_pcmcia_cf_device = {
288 .name = "bfin_cf_pcmcia",
289 .id = -1,
290 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
291 .resource = bfin_pcmcia_cf_resources,
292};
293#endif
294
295#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
296static struct platform_device rtc_device = {
297 .name = "rtc-bfin",
298 .id = -1,
299};
300#endif
301
302#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
Michael Hennerich61f09b52009-07-24 08:48:31 +0000303#include <linux/smc91x.h>
304
305static struct smc91x_platdata smc91x_info = {
306 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
307 .leda = RPC_LED_100_10,
308 .ledb = RPC_LED_TX_RX,
309};
310
Michael Hennerich59003142007-10-21 16:54:27 +0800311static struct resource smc91x_resources[] = {
312 {
313 .name = "smc91x-regs",
314 .start = 0x20300300,
315 .end = 0x20300300 + 16,
316 .flags = IORESOURCE_MEM,
317 }, {
318
319 .start = IRQ_PF7,
320 .end = IRQ_PF7,
321 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
322 },
323};
324static struct platform_device smc91x_device = {
325 .name = "smc91x",
326 .id = 0,
327 .num_resources = ARRAY_SIZE(smc91x_resources),
328 .resource = smc91x_resources,
Michael Hennerich61f09b52009-07-24 08:48:31 +0000329 .dev = {
330 .platform_data = &smc91x_info,
331 },
Michael Hennerich59003142007-10-21 16:54:27 +0800332};
333#endif
334
335#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
336static struct resource dm9000_resources[] = {
337 [0] = {
338 .start = 0x203FB800,
Laurent Pinchartda3854f2008-06-24 22:15:58 +0100339 .end = 0x203FB800 + 1,
Michael Hennerich59003142007-10-21 16:54:27 +0800340 .flags = IORESOURCE_MEM,
341 },
342 [1] = {
Laurent Pinchartda3854f2008-06-24 22:15:58 +0100343 .start = 0x203FB800 + 4,
344 .end = 0x203FB800 + 5,
345 .flags = IORESOURCE_MEM,
346 },
347 [2] = {
Michael Hennerich59003142007-10-21 16:54:27 +0800348 .start = IRQ_PF9,
349 .end = IRQ_PF9,
350 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
351 },
352};
353
354static struct platform_device dm9000_device = {
355 .name = "dm9000",
356 .id = -1,
357 .num_resources = ARRAY_SIZE(dm9000_resources),
358 .resource = dm9000_resources,
359};
360#endif
361
362#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
363static struct resource sl811_hcd_resources[] = {
364 {
365 .start = 0x20340000,
366 .end = 0x20340000,
367 .flags = IORESOURCE_MEM,
368 }, {
369 .start = 0x20340004,
370 .end = 0x20340004,
371 .flags = IORESOURCE_MEM,
372 }, {
373 .start = CONFIG_USB_SL811_BFIN_IRQ,
374 .end = CONFIG_USB_SL811_BFIN_IRQ,
375 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
376 },
377};
378
379#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
380void sl811_port_power(struct device *dev, int is_on)
381{
382 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
Michael Hennerichacbcd262008-01-22 18:36:20 +0800383 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
Michael Hennerich59003142007-10-21 16:54:27 +0800384}
385#endif
386
387static struct sl811_platform_data sl811_priv = {
388 .potpg = 10,
389 .power = 250, /* == 500mA */
390#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
391 .port_power = &sl811_port_power,
392#endif
393};
394
395static struct platform_device sl811_hcd_device = {
396 .name = "sl811-hcd",
397 .id = 0,
398 .dev = {
399 .platform_data = &sl811_priv,
400 },
401 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
402 .resource = sl811_hcd_resources,
403};
404#endif
405
Michael Hennerich59003142007-10-21 16:54:27 +0800406#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
Graf Yang65319622009-02-04 16:49:45 +0800407static struct platform_device bfin_mii_bus = {
408 .name = "bfin_mii_bus",
409};
410
Michael Hennerich59003142007-10-21 16:54:27 +0800411static struct platform_device bfin_mac_device = {
412 .name = "bfin_mac",
Graf Yang65319622009-02-04 16:49:45 +0800413 .dev.platform_data = &bfin_mii_bus,
Michael Hennerich59003142007-10-21 16:54:27 +0800414};
415#endif
416
417#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
418static struct resource net2272_bfin_resources[] = {
419 {
420 .start = 0x20300000,
421 .end = 0x20300000 + 0x100,
422 .flags = IORESOURCE_MEM,
423 }, {
424 .start = IRQ_PF7,
425 .end = IRQ_PF7,
426 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
427 },
428};
429
430static struct platform_device net2272_bfin_device = {
431 .name = "net2272",
432 .id = -1,
433 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
434 .resource = net2272_bfin_resources,
435};
436#endif
437
Michael Hennerich59003142007-10-21 16:54:27 +0800438#if defined(CONFIG_MTD_M25P80) \
439 || defined(CONFIG_MTD_M25P80_MODULE)
440static struct mtd_partition bfin_spi_flash_partitions[] = {
441 {
Robin Getzaa582972008-08-05 17:47:29 +0800442 .name = "bootloader(spi)",
Grace Panac76d882008-04-24 06:33:56 +0800443 .size = 0x00040000,
Michael Hennerich59003142007-10-21 16:54:27 +0800444 .offset = 0,
445 .mask_flags = MTD_CAP_ROM
446 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800447 .name = "linux kernel(spi)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800448 .size = MTDPART_SIZ_FULL,
449 .offset = MTDPART_OFS_APPEND,
Michael Hennerich59003142007-10-21 16:54:27 +0800450 }
451};
452
453static struct flash_platform_data bfin_spi_flash_data = {
454 .name = "m25p80",
455 .parts = bfin_spi_flash_partitions,
456 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
Michael Hennerichb9c9e782008-05-07 11:41:26 +0800457 .type = "m25p16",
Michael Hennerich59003142007-10-21 16:54:27 +0800458};
459
460/* SPI flash chip (m25p64) */
461static struct bfin5xx_spi_chip spi_flash_chip_info = {
462 .enable_dma = 0, /* use dma transfer with this chip*/
463 .bits_per_word = 8,
464};
465#endif
466
Mike Frysingera261eec2009-05-20 14:05:36 +0000467#if defined(CONFIG_BFIN_SPI_ADC) \
468 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800469/* SPI ADC chip */
470static struct bfin5xx_spi_chip spi_adc_chip_info = {
471 .enable_dma = 1, /* use dma transfer with this chip*/
472 .bits_per_word = 16,
473};
474#endif
475
476#if defined(CONFIG_SND_BLACKFIN_AD1836) \
477 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
478static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
479 .enable_dma = 0,
480 .bits_per_word = 16,
481};
482#endif
483
Yi Liffdf3ec2009-03-31 10:36:51 +0000484#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
485static struct bfin5xx_spi_chip mmc_spi_chip_info = {
486 .enable_dma = 0,
487 .bits_per_word = 8,
488};
489#endif
490
Michael Hennerich59003142007-10-21 16:54:27 +0800491#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
492static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
493 .enable_dma = 0,
494 .bits_per_word = 16,
495};
496
497static const struct ad7877_platform_data bfin_ad7877_ts_info = {
498 .model = 7877,
499 .vref_delay_usecs = 50, /* internal, no capacitor */
500 .x_plate_ohms = 419,
501 .y_plate_ohms = 486,
502 .pressure_max = 1000,
503 .pressure_min = 0,
504 .stopacq_polarity = 1,
505 .first_conversion_delay = 3,
506 .acquisition_time = 1,
507 .averaging = 1,
508 .pen_down_acc_interval = 1,
509};
510#endif
511
Michael Hennerich51054322009-01-07 23:14:38 +0800512#if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
513#include <linux/spi/ad7879.h>
514static const struct ad7879_platform_data bfin_ad7879_ts_info = {
515 .model = 7879, /* Model = AD7879 */
516 .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
517 .pressure_max = 10000,
518 .pressure_min = 0,
519 .first_conversion_delay = 3, /* wait 512us before do a first conversion */
520 .acquisition_time = 1, /* 4us acquisition time per sample */
521 .median = 2, /* do 8 measurements */
522 .averaging = 1, /* take the average of 4 middle samples */
523 .pen_down_acc_interval = 255, /* 9.4 ms */
524 .gpio_output = 1, /* configure AUX/VBAT/GPIO as GPIO output */
525 .gpio_default = 1, /* During initialization set GPIO = HIGH */
526};
527#endif
528
529#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
530static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
531 .enable_dma = 0,
532 .bits_per_word = 16,
533};
534#endif
535
Michael Hennerich6e668932008-02-09 01:54:09 +0800536#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
537static struct bfin5xx_spi_chip spidev_chip_info = {
538 .enable_dma = 0,
539 .bits_per_word = 8,
540};
541#endif
542
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000543#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
544static struct bfin5xx_spi_chip lq035q1_spi_chip_info = {
545 .enable_dma = 0,
546 .bits_per_word = 8,
547};
548#endif
549
Michael Hennerich59003142007-10-21 16:54:27 +0800550static struct spi_board_info bfin_spi_board_info[] __initdata = {
551#if defined(CONFIG_MTD_M25P80) \
552 || defined(CONFIG_MTD_M25P80_MODULE)
553 {
554 /* the modalias must be the same as spi device driver name */
555 .modalias = "m25p80", /* Name of spi_driver for this device */
556 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
557 .bus_num = 0, /* Framework bus number */
558 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
559 .platform_data = &bfin_spi_flash_data,
560 .controller_data = &spi_flash_chip_info,
561 .mode = SPI_MODE_3,
562 },
563#endif
564
Mike Frysingera261eec2009-05-20 14:05:36 +0000565#if defined(CONFIG_BFIN_SPI_ADC) \
566 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800567 {
568 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
569 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
570 .bus_num = 0, /* Framework bus number */
571 .chip_select = 1, /* Framework chip select. */
572 .platform_data = NULL, /* No spi_driver specific config */
573 .controller_data = &spi_adc_chip_info,
574 },
575#endif
576
577#if defined(CONFIG_SND_BLACKFIN_AD1836) \
578 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
579 {
Barry Songdac98172009-08-13 21:07:37 +0000580 .modalias = "ad1836",
Michael Hennerich59003142007-10-21 16:54:27 +0800581 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
582 .bus_num = 0,
583 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
584 .controller_data = &ad1836_spi_chip_info,
585 },
586#endif
Yi Liffdf3ec2009-03-31 10:36:51 +0000587#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
588 {
589 .modalias = "mmc_spi",
590 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
591 .bus_num = 0,
592 .chip_select = 3,
593 .controller_data = &mmc_spi_chip_info,
594 .mode = SPI_MODE_0,
595 },
596#endif
597
Michael Hennerich59003142007-10-21 16:54:27 +0800598#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
599 {
600 .modalias = "ad7877",
601 .platform_data = &bfin_ad7877_ts_info,
Bryan Wu2eb74ae2008-05-31 15:17:25 +0800602 .irq = IRQ_PF8,
Michael Hennerich59003142007-10-21 16:54:27 +0800603 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Michael Hennerich0954f702007-11-13 00:16:19 +0800604 .bus_num = 0,
Bryan Wu2eb74ae2008-05-31 15:17:25 +0800605 .chip_select = 2,
Michael Hennerich59003142007-10-21 16:54:27 +0800606 .controller_data = &spi_ad7877_chip_info,
607 },
608#endif
Michael Hennerich51054322009-01-07 23:14:38 +0800609#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
610 {
611 .modalias = "ad7879",
612 .platform_data = &bfin_ad7879_ts_info,
613 .irq = IRQ_PF8,
614 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
615 .bus_num = 0,
616 .chip_select = 3,
617 .controller_data = &spi_ad7879_chip_info,
618 .mode = SPI_CPHA | SPI_CPOL,
619 },
620#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800621#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
622 {
623 .modalias = "spidev",
624 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
625 .bus_num = 0,
626 .chip_select = 1,
627 .controller_data = &spidev_chip_info,
628 },
629#endif
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000630#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
631 {
632 .modalias = "bfin-lq035q1-spi",
633 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
634 .bus_num = 0,
635 .chip_select = 7,
636 .controller_data = &lq035q1_spi_chip_info,
637 .mode = SPI_CPHA | SPI_CPOL,
638 },
639#endif
Michael Hennerich59003142007-10-21 16:54:27 +0800640};
641
Mike Frysinger5bda2722008-06-07 15:03:01 +0800642#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800643/* SPI controller data */
644static struct bfin5xx_spi_master bfin_spi0_info = {
645 .num_chipselect = 8,
646 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800647 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Michael Hennerich59003142007-10-21 16:54:27 +0800648};
649
650/* SPI (0) */
651static struct resource bfin_spi0_resource[] = {
652 [0] = {
653 .start = SPI0_REGBASE,
654 .end = SPI0_REGBASE + 0xFF,
655 .flags = IORESOURCE_MEM,
656 },
657 [1] = {
658 .start = CH_SPI,
659 .end = CH_SPI,
Yi Li53122692009-06-05 12:11:11 +0000660 .flags = IORESOURCE_DMA,
661 },
662 [2] = {
663 .start = IRQ_SPI,
664 .end = IRQ_SPI,
Michael Hennerich59003142007-10-21 16:54:27 +0800665 .flags = IORESOURCE_IRQ,
666 },
667};
668
669static struct platform_device bfin_spi0_device = {
670 .name = "bfin-spi",
671 .id = 0, /* Bus number */
672 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
673 .resource = bfin_spi0_resource,
674 .dev = {
675 .platform_data = &bfin_spi0_info, /* Passed to driver */
676 },
677};
678#endif /* spi master and devices */
679
Michael Hennerich59003142007-10-21 16:54:27 +0800680#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800681#ifdef CONFIG_SERIAL_BFIN_UART0
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000682static struct resource bfin_uart0_resources[] = {
Michael Hennerich59003142007-10-21 16:54:27 +0800683 {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000684 .start = UART0_THR,
685 .end = UART0_GCTL+2,
Michael Hennerich59003142007-10-21 16:54:27 +0800686 .flags = IORESOURCE_MEM,
687 },
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000688 {
689 .start = IRQ_UART0_RX,
690 .end = IRQ_UART0_RX+1,
691 .flags = IORESOURCE_IRQ,
692 },
693 {
694 .start = IRQ_UART0_ERROR,
695 .end = IRQ_UART0_ERROR,
696 .flags = IORESOURCE_IRQ,
697 },
698 {
699 .start = CH_UART0_TX,
700 .end = CH_UART0_TX,
701 .flags = IORESOURCE_DMA,
702 },
703 {
704 .start = CH_UART0_RX,
705 .end = CH_UART0_RX,
706 .flags = IORESOURCE_DMA,
707 },
708};
709
710unsigned short bfin_uart0_peripherals[] = {
711 P_UART0_TX, P_UART0_RX, 0
712};
713
714static struct platform_device bfin_uart0_device = {
715 .name = "bfin-uart",
716 .id = 0,
717 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
718 .resource = bfin_uart0_resources,
719 .dev = {
720 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
721 },
722};
Michael Hennerich59003142007-10-21 16:54:27 +0800723#endif
724#ifdef CONFIG_SERIAL_BFIN_UART1
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000725static struct resource bfin_uart1_resources[] = {
Michael Hennerich59003142007-10-21 16:54:27 +0800726 {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000727 .start = UART1_THR,
728 .end = UART1_GCTL+2,
Michael Hennerich59003142007-10-21 16:54:27 +0800729 .flags = IORESOURCE_MEM,
730 },
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000731 {
732 .start = IRQ_UART1_RX,
733 .end = IRQ_UART1_RX+1,
734 .flags = IORESOURCE_IRQ,
735 },
736 {
737 .start = IRQ_UART1_ERROR,
738 .end = IRQ_UART1_ERROR,
739 .flags = IORESOURCE_IRQ,
740 },
741 {
742 .start = CH_UART1_TX,
743 .end = CH_UART1_TX,
744 .flags = IORESOURCE_DMA,
745 },
746 {
747 .start = CH_UART1_RX,
748 .end = CH_UART1_RX,
749 .flags = IORESOURCE_DMA,
750 },
751#ifdef CONFIG_BFIN_UART1_CTSRTS
752 { /* CTS pin */
753 .start = GPIO_PF9,
754 .end = GPIO_PF9,
755 .flags = IORESOURCE_IO,
756 },
757 { /* RTS pin */
758 .start = GPIO_PF10,
759 .end = GPIO_PF10,
760 .flags = IORESOURCE_IO,
761 },
Michael Hennerich59003142007-10-21 16:54:27 +0800762#endif
763};
764
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000765unsigned short bfin_uart1_peripherals[] = {
766 P_UART1_TX, P_UART1_RX, 0
767};
768
769static struct platform_device bfin_uart1_device = {
Michael Hennerich59003142007-10-21 16:54:27 +0800770 .name = "bfin-uart",
771 .id = 1,
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000772 .num_resources = ARRAY_SIZE(bfin_uart1_resources),
773 .resource = bfin_uart1_resources,
774 .dev = {
775 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
776 },
Michael Hennerich59003142007-10-21 16:54:27 +0800777};
778#endif
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000779#endif
Michael Hennerich59003142007-10-21 16:54:27 +0800780
Graf Yang5be36d22008-04-25 03:09:15 +0800781#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang5be36d22008-04-25 03:09:15 +0800782#ifdef CONFIG_BFIN_SIR0
Graf Yang42bd8bc2009-01-07 23:14:39 +0800783static struct resource bfin_sir0_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800784 {
785 .start = 0xFFC00400,
786 .end = 0xFFC004FF,
787 .flags = IORESOURCE_MEM,
788 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800789 {
790 .start = IRQ_UART0_RX,
791 .end = IRQ_UART0_RX+1,
792 .flags = IORESOURCE_IRQ,
793 },
794 {
795 .start = CH_UART0_RX,
796 .end = CH_UART0_RX+1,
797 .flags = IORESOURCE_DMA,
798 },
799};
800
801static struct platform_device bfin_sir0_device = {
802 .name = "bfin_sir",
803 .id = 0,
804 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
805 .resource = bfin_sir0_resources,
806};
Graf Yang5be36d22008-04-25 03:09:15 +0800807#endif
808#ifdef CONFIG_BFIN_SIR1
Graf Yang42bd8bc2009-01-07 23:14:39 +0800809static struct resource bfin_sir1_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800810 {
811 .start = 0xFFC02000,
812 .end = 0xFFC020FF,
813 .flags = IORESOURCE_MEM,
814 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800815 {
816 .start = IRQ_UART1_RX,
817 .end = IRQ_UART1_RX+1,
818 .flags = IORESOURCE_IRQ,
819 },
820 {
821 .start = CH_UART1_RX,
822 .end = CH_UART1_RX+1,
823 .flags = IORESOURCE_DMA,
824 },
Graf Yang5be36d22008-04-25 03:09:15 +0800825};
826
Graf Yang42bd8bc2009-01-07 23:14:39 +0800827static struct platform_device bfin_sir1_device = {
Graf Yang5be36d22008-04-25 03:09:15 +0800828 .name = "bfin_sir",
Graf Yang42bd8bc2009-01-07 23:14:39 +0800829 .id = 1,
830 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
831 .resource = bfin_sir1_resources,
Graf Yang5be36d22008-04-25 03:09:15 +0800832};
833#endif
Graf Yang42bd8bc2009-01-07 23:14:39 +0800834#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800835
Michael Hennerich59003142007-10-21 16:54:27 +0800836#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
837static struct resource bfin_twi0_resource[] = {
838 [0] = {
839 .start = TWI0_REGBASE,
840 .end = TWI0_REGBASE,
841 .flags = IORESOURCE_MEM,
842 },
843 [1] = {
844 .start = IRQ_TWI,
845 .end = IRQ_TWI,
846 .flags = IORESOURCE_IRQ,
847 },
848};
849
850static struct platform_device i2c_bfin_twi_device = {
851 .name = "i2c-bfin-twi",
852 .id = 0,
853 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
854 .resource = bfin_twi0_resource,
855};
856#endif
857
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000858#if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
859#include <linux/mfd/adp5520.h>
860
861 /*
862 * ADP5520/5501 LEDs Data
863 */
864
865static struct led_info adp5520_leds[] = {
866 {
867 .name = "adp5520-led1",
868 .default_trigger = "none",
869 .flags = FLAG_ID_ADP5520_LED1_ADP5501_LED0 | ADP5520_LED_OFFT_600ms,
870 },
871};
872
873static struct adp5520_leds_platform_data adp5520_leds_data = {
874 .num_leds = ARRAY_SIZE(adp5520_leds),
875 .leds = adp5520_leds,
876 .fade_in = ADP5520_FADE_T_600ms,
877 .fade_out = ADP5520_FADE_T_600ms,
878 .led_on_time = ADP5520_LED_ONT_600ms,
879};
880
881 /*
882 * ADP5520 Keypad Data
883 */
884
885static const unsigned short adp5520_keymap[ADP5520_KEYMAPSIZE] = {
886 [ADP5520_KEY(3, 3)] = KEY_1,
887 [ADP5520_KEY(2, 3)] = KEY_2,
888 [ADP5520_KEY(1, 3)] = KEY_3,
889 [ADP5520_KEY(0, 3)] = KEY_UP,
890 [ADP5520_KEY(3, 2)] = KEY_4,
891 [ADP5520_KEY(2, 2)] = KEY_5,
892 [ADP5520_KEY(1, 2)] = KEY_6,
893 [ADP5520_KEY(0, 2)] = KEY_DOWN,
894 [ADP5520_KEY(3, 1)] = KEY_7,
895 [ADP5520_KEY(2, 1)] = KEY_8,
896 [ADP5520_KEY(1, 1)] = KEY_9,
897 [ADP5520_KEY(0, 1)] = KEY_DOT,
898 [ADP5520_KEY(3, 0)] = KEY_BACKSPACE,
899 [ADP5520_KEY(2, 0)] = KEY_0,
900 [ADP5520_KEY(1, 0)] = KEY_HELP,
901 [ADP5520_KEY(0, 0)] = KEY_ENTER,
902};
903
904static struct adp5520_keys_platform_data adp5520_keys_data = {
905 .rows_en_mask = ADP5520_ROW_R3 | ADP5520_ROW_R2 | ADP5520_ROW_R1 | ADP5520_ROW_R0,
906 .cols_en_mask = ADP5520_COL_C3 | ADP5520_COL_C2 | ADP5520_COL_C1 | ADP5520_COL_C0,
907 .keymap = adp5520_keymap,
908 .keymapsize = ARRAY_SIZE(adp5520_keymap),
909 .repeat = 0,
910};
911
912 /*
913 * ADP5520/5501 Multifuction Device Init Data
914 */
915
916static struct adp5520_platform_data adp5520_pdev_data = {
917 .leds = &adp5520_leds_data,
918 .keys = &adp5520_keys_data,
919};
920
921#endif
922
Bryan Wu72268682008-05-07 11:41:26 +0800923static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
Michael Hennerichebd58332009-07-02 11:00:38 +0000924#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
Bryan Wu72268682008-05-07 11:41:26 +0800925 {
926 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
Bryan Wu72268682008-05-07 11:41:26 +0800927 },
928#endif
Michael Hennerich204844e2009-06-30 14:57:22 +0000929#if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
Bryan Wu72268682008-05-07 11:41:26 +0800930 {
931 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
Bryan Wu72268682008-05-07 11:41:26 +0800932 .irq = IRQ_PF8,
933 },
934#endif
Michael Hennerich50c4c082009-09-22 13:10:09 +0000935#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
936 {
937 I2C_BOARD_INFO("bfin-adv7393", 0x2B),
938 },
939#endif
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000940#if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) || defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)
941 {
942 I2C_BOARD_INFO("ad7879", 0x2C),
943 .irq = IRQ_PF8,
944 .platform_data = (void *)&bfin_ad7879_ts_info,
945 },
946#endif
947#if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
948 {
949 I2C_BOARD_INFO("pmic-adp5520", 0x32),
950 .irq = IRQ_PF9,
951 .platform_data = (void *)&adp5520_pdev_data,
952 },
953#endif
Bryan Wu72268682008-05-07 11:41:26 +0800954};
Bryan Wu72268682008-05-07 11:41:26 +0800955
Michael Hennerich59003142007-10-21 16:54:27 +0800956#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
Sonic Zhangdf5de262009-09-23 05:01:56 +0000957#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
958static struct resource bfin_sport0_uart_resources[] = {
959 {
960 .start = SPORT0_TCR1,
961 .end = SPORT0_MRCS3+4,
962 .flags = IORESOURCE_MEM,
963 },
964 {
965 .start = IRQ_SPORT0_RX,
966 .end = IRQ_SPORT0_RX+1,
967 .flags = IORESOURCE_IRQ,
968 },
969 {
970 .start = IRQ_SPORT0_ERROR,
971 .end = IRQ_SPORT0_ERROR,
972 .flags = IORESOURCE_IRQ,
973 },
974};
975
976unsigned short bfin_sport0_peripherals[] = {
977 P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
978 P_SPORT0_DRPRI, P_SPORT0_RSCLK, P_SPORT0_DRSEC, P_SPORT0_DTSEC, 0
979};
980
Michael Hennerich59003142007-10-21 16:54:27 +0800981static struct platform_device bfin_sport0_uart_device = {
982 .name = "bfin-sport-uart",
983 .id = 0,
Sonic Zhangdf5de262009-09-23 05:01:56 +0000984 .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
985 .resource = bfin_sport0_uart_resources,
986 .dev = {
987 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
988 },
989};
990#endif
991#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
992static struct resource bfin_sport1_uart_resources[] = {
993 {
994 .start = SPORT1_TCR1,
995 .end = SPORT1_MRCS3+4,
996 .flags = IORESOURCE_MEM,
997 },
998 {
999 .start = IRQ_SPORT1_RX,
1000 .end = IRQ_SPORT1_RX+1,
1001 .flags = IORESOURCE_IRQ,
1002 },
1003 {
1004 .start = IRQ_SPORT1_ERROR,
1005 .end = IRQ_SPORT1_ERROR,
1006 .flags = IORESOURCE_IRQ,
1007 },
1008};
1009
1010unsigned short bfin_sport1_peripherals[] = {
1011 P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
1012 P_SPORT1_DRPRI, P_SPORT1_RSCLK, P_SPORT1_DRSEC, P_SPORT1_DTSEC, 0
Michael Hennerich59003142007-10-21 16:54:27 +08001013};
1014
1015static struct platform_device bfin_sport1_uart_device = {
1016 .name = "bfin-sport-uart",
1017 .id = 1,
Sonic Zhangdf5de262009-09-23 05:01:56 +00001018 .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
1019 .resource = bfin_sport1_uart_resources,
1020 .dev = {
1021 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
1022 },
Michael Hennerich59003142007-10-21 16:54:27 +08001023};
1024#endif
Sonic Zhangdf5de262009-09-23 05:01:56 +00001025#endif
Michael Hennerich59003142007-10-21 16:54:27 +08001026
Michael Hennerich1089e222007-12-24 11:49:29 +08001027#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
Michael Hennerich1089e222007-12-24 11:49:29 +08001028#include <linux/gpio_keys.h>
1029
1030static struct gpio_keys_button bfin_gpio_keys_table[] = {
1031 {BTN_0, GPIO_PG0, 1, "gpio-keys: BTN0"},
1032 {BTN_1, GPIO_PG13, 1, "gpio-keys: BTN1"},
1033};
1034
1035static struct gpio_keys_platform_data bfin_gpio_keys_data = {
1036 .buttons = bfin_gpio_keys_table,
1037 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
1038};
1039
1040static struct platform_device bfin_device_gpiokeys = {
1041 .name = "gpio-keys",
1042 .dev = {
1043 .platform_data = &bfin_gpio_keys_data,
1044 },
1045};
1046#endif
1047
Michael Hennerichadfc0462009-10-09 07:37:03 +00001048#if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
Michael Hennerichaca5e4a2008-10-08 14:27:59 +08001049#include <asm/bfin_rotary.h>
1050
1051static struct bfin_rotary_platform_data bfin_rotary_data = {
1052 /*.rotary_up_key = KEY_UP,*/
1053 /*.rotary_down_key = KEY_DOWN,*/
1054 .rotary_rel_code = REL_WHEEL,
1055 .rotary_button_key = KEY_ENTER,
1056 .debounce = 10, /* 0..17 */
1057 .mode = ROT_QUAD_ENC | ROT_DEBE,
1058};
1059
1060static struct resource bfin_rotary_resources[] = {
1061 {
1062 .start = IRQ_CNT,
1063 .end = IRQ_CNT,
1064 .flags = IORESOURCE_IRQ,
1065 },
1066};
1067
1068static struct platform_device bfin_rotary_device = {
1069 .name = "bfin-rotary",
1070 .id = -1,
1071 .num_resources = ARRAY_SIZE(bfin_rotary_resources),
1072 .resource = bfin_rotary_resources,
1073 .dev = {
1074 .platform_data = &bfin_rotary_data,
1075 },
1076};
1077#endif
1078
Michael Hennerich14b03202008-05-07 11:41:26 +08001079static const unsigned int cclk_vlev_datasheet[] =
1080{
1081 VRPAIR(VLEV_100, 400000000),
1082 VRPAIR(VLEV_105, 426000000),
1083 VRPAIR(VLEV_110, 500000000),
1084 VRPAIR(VLEV_115, 533000000),
1085 VRPAIR(VLEV_120, 600000000),
1086};
1087
1088static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
1089 .tuple_tab = cclk_vlev_datasheet,
1090 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
1091 .vr_settling_time = 25 /* us */,
1092};
1093
1094static struct platform_device bfin_dpmc = {
1095 .name = "bfin dpmc",
1096 .dev = {
1097 .platform_data = &bfin_dmpc_vreg_data,
1098 },
1099};
1100
Michael Hennerich59003142007-10-21 16:54:27 +08001101static struct platform_device *stamp_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +08001102
1103 &bfin_dpmc,
1104
Michael Hennerich64307f72007-10-29 16:55:18 +08001105#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
1106 &bf5xx_nand_device,
1107#endif
1108
Michael Hennerich59003142007-10-21 16:54:27 +08001109#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
1110 &bfin_pcmcia_cf_device,
1111#endif
1112
1113#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
1114 &rtc_device,
1115#endif
1116
1117#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
1118 &sl811_hcd_device,
1119#endif
1120
Michael Hennerich3f375692008-11-18 17:48:22 +08001121#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
1122 &bfin_isp1760_device,
1123#endif
1124
Michael Hennerich1089e222007-12-24 11:49:29 +08001125#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
1126 &musb_device,
1127#endif
1128
Michael Hennerich59003142007-10-21 16:54:27 +08001129#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
1130 &smc91x_device,
1131#endif
1132
1133#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
1134 &dm9000_device,
1135#endif
1136
1137#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
Graf Yang65319622009-02-04 16:49:45 +08001138 &bfin_mii_bus,
Michael Hennerich59003142007-10-21 16:54:27 +08001139 &bfin_mac_device,
1140#endif
1141
1142#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
1143 &net2272_bfin_device,
1144#endif
1145
1146#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1147 &bfin_spi0_device,
1148#endif
1149
Michael Hennerich1089e222007-12-24 11:49:29 +08001150#if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
1151 &bf52x_t350mcqb_device,
1152#endif
1153
Michael Hennerich6924dfb2009-12-07 13:41:28 +00001154#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
1155 &bfin_lq035q1_device,
1156#endif
1157
Michael Hennerich59003142007-10-21 16:54:27 +08001158#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +00001159#ifdef CONFIG_SERIAL_BFIN_UART0
1160 &bfin_uart0_device,
1161#endif
1162#ifdef CONFIG_SERIAL_BFIN_UART1
1163 &bfin_uart1_device,
1164#endif
Michael Hennerich59003142007-10-21 16:54:27 +08001165#endif
1166
Graf Yang5be36d22008-04-25 03:09:15 +08001167#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang42bd8bc2009-01-07 23:14:39 +08001168#ifdef CONFIG_BFIN_SIR0
1169 &bfin_sir0_device,
1170#endif
1171#ifdef CONFIG_BFIN_SIR1
1172 &bfin_sir1_device,
1173#endif
Graf Yang5be36d22008-04-25 03:09:15 +08001174#endif
1175
Michael Hennerich59003142007-10-21 16:54:27 +08001176#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1177 &i2c_bfin_twi_device,
1178#endif
1179
1180#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
Sonic Zhangdf5de262009-09-23 05:01:56 +00001181#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
Michael Hennerich59003142007-10-21 16:54:27 +08001182 &bfin_sport0_uart_device,
Sonic Zhangdf5de262009-09-23 05:01:56 +00001183#endif
1184#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
Michael Hennerich59003142007-10-21 16:54:27 +08001185 &bfin_sport1_uart_device,
1186#endif
Sonic Zhangdf5de262009-09-23 05:01:56 +00001187#endif
Michael Hennerich59003142007-10-21 16:54:27 +08001188
Michael Hennerich1089e222007-12-24 11:49:29 +08001189#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1190 &bfin_device_gpiokeys,
1191#endif
Mike Frysingercad2ab62008-02-22 17:01:31 +08001192
Michael Hennerichadfc0462009-10-09 07:37:03 +00001193#if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
Michael Hennerichaca5e4a2008-10-08 14:27:59 +08001194 &bfin_rotary_device,
1195#endif
1196
Michael Hennerichd7e5dd42008-05-07 11:41:26 +08001197#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
1198 &ezkit_flash_device,
1199#endif
Michael Hennerich59003142007-10-21 16:54:27 +08001200};
1201
Mike Frysinger7f6678c2009-02-04 16:49:45 +08001202static int __init ezkit_init(void)
Michael Hennerich59003142007-10-21 16:54:27 +08001203{
Harvey Harrisonb85d8582008-04-23 09:39:01 +08001204 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Bryan Wu72268682008-05-07 11:41:26 +08001205 i2c_register_board_info(0, bfin_i2c_board_info,
1206 ARRAY_SIZE(bfin_i2c_board_info));
Michael Hennerich59003142007-10-21 16:54:27 +08001207 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
Mike Frysinger5bda2722008-06-07 15:03:01 +08001208 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
Michael Hennerich59003142007-10-21 16:54:27 +08001209 return 0;
1210}
1211
Mike Frysinger7f6678c2009-02-04 16:49:45 +08001212arch_initcall(ezkit_init);
Michael Hennerich59003142007-10-21 16:54:27 +08001213
Sonic Zhangc13ce9f2009-09-23 09:37:46 +00001214static struct platform_device *ezkit_early_devices[] __initdata = {
1215#if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
1216#ifdef CONFIG_SERIAL_BFIN_UART0
1217 &bfin_uart0_device,
1218#endif
1219#ifdef CONFIG_SERIAL_BFIN_UART1
1220 &bfin_uart1_device,
1221#endif
1222#endif
1223
1224#if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
1225#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1226 &bfin_sport0_uart_device,
1227#endif
1228#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1229 &bfin_sport1_uart_device,
1230#endif
1231#endif
1232};
1233
1234void __init native_machine_early_platform_add_devices(void)
1235{
1236 printk(KERN_INFO "register early platform devices\n");
1237 early_platform_add_devices(ezkit_early_devices,
1238 ARRAY_SIZE(ezkit_early_devices));
1239}
1240
Michael Hennerich59003142007-10-21 16:54:27 +08001241void native_machine_restart(char *cmd)
1242{
1243 /* workaround reboot hang when booting from SPI */
1244 if ((bfin_read_SYSCR() & 0x7) == 0x3)
Sonic Zhangb52dae32009-02-04 16:49:45 +08001245 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
Michael Hennerich59003142007-10-21 16:54:27 +08001246}
Mike Frysinger137b1522007-11-22 16:07:03 +08001247
Mike Frysinger9862cc52007-11-15 21:21:20 +08001248void bfin_get_ether_addr(char *addr)
Mike Frysinger137b1522007-11-22 16:07:03 +08001249{
Mike Frysinger181afa92008-02-25 11:42:17 +08001250 /* the MAC is stored in OTP memory page 0xDF */
1251 u32 ret;
1252 u64 otp_mac;
1253 u32 (*otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)0xEF00001A;
1254
1255 ret = otp_read(0xDF, 0x00, &otp_mac);
1256 if (!(ret & 0x1)) {
1257 char *otp_mac_p = (char *)&otp_mac;
1258 for (ret = 0; ret < 6; ++ret)
1259 addr[ret] = otp_mac_p[5 - ret];
1260 }
Mike Frysinger137b1522007-11-22 16:07:03 +08001261}
Mike Frysinger9862cc52007-11-15 21:21:20 +08001262EXPORT_SYMBOL(bfin_get_ether_addr);