blob: 7ea87009fb8307d64f8a33c5c18dcbeeac220cc1 [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>
Michael Hennerich1089e222007-12-24 11:49:29 +080019#include <linux/usb/musb.h>
Michael Hennerich6924dfb2009-12-07 13:41:28 +000020#include <linux/leds.h>
21#include <linux/input.h>
Michael Hennerich59003142007-10-21 16:54:27 +080022#include <asm/dma.h>
23#include <asm/bfin5xx_spi.h>
24#include <asm/reboot.h>
Michael Hennerich64307f72007-10-29 16:55:18 +080025#include <asm/nand.h>
Bryan Wu5d448dd2007-11-12 23:24:42 +080026#include <asm/portmux.h>
Michael Hennerich14b03202008-05-07 11:41:26 +080027#include <asm/dpmc.h>
Michael Hennerich59003142007-10-21 16:54:27 +080028#include <linux/spi/ad7877.h>
29
30/*
31 * Name the Board for the /proc/cpuinfo
32 */
Michael Hennerich6924dfb2009-12-07 13:41:28 +000033#ifdef CONFIG_BFIN527_EZKIT_V2
34const char bfin_board_name[] = "ADI BF527-EZKIT V2";
35#else
Mike Frysingerfe85cad2008-11-18 17:48:22 +080036const char bfin_board_name[] = "ADI BF527-EZKIT";
Michael Hennerich6924dfb2009-12-07 13:41:28 +000037#endif
Michael Hennerich59003142007-10-21 16:54:27 +080038
39/*
40 * Driver needs to know address, irq and flag pin.
41 */
42
Michael Hennerich59003142007-10-21 16:54:27 +080043#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
Michael Hennerich3f375692008-11-18 17:48:22 +080044#include <linux/usb/isp1760.h>
45static struct resource bfin_isp1760_resources[] = {
Michael Hennerich59003142007-10-21 16:54:27 +080046 [0] = {
Michael Hennerich3f375692008-11-18 17:48:22 +080047 .start = 0x203C0000,
48 .end = 0x203C0000 + 0x000fffff,
Michael Hennerich59003142007-10-21 16:54:27 +080049 .flags = IORESOURCE_MEM,
50 },
51 [1] = {
Michael Hennerich3f375692008-11-18 17:48:22 +080052 .start = IRQ_PF7,
53 .end = IRQ_PF7,
Michael Hennerich59003142007-10-21 16:54:27 +080054 .flags = IORESOURCE_IRQ,
55 },
56};
57
Michael Hennerich3f375692008-11-18 17:48:22 +080058static struct isp1760_platform_data isp1760_priv = {
59 .is_isp1761 = 0,
Michael Hennerich3f375692008-11-18 17:48:22 +080060 .bus_width_16 = 1,
61 .port1_otg = 0,
62 .analog_oc = 0,
63 .dack_polarity_high = 0,
64 .dreq_polarity_high = 0,
65};
66
67static struct platform_device bfin_isp1760_device = {
Michael Hennerichc6feb7682009-10-15 10:37:33 +000068 .name = "isp1760",
Michael Hennerich59003142007-10-21 16:54:27 +080069 .id = 0,
Michael Hennerich3f375692008-11-18 17:48:22 +080070 .dev = {
71 .platform_data = &isp1760_priv,
72 },
73 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
74 .resource = bfin_isp1760_resources,
Michael Hennerich59003142007-10-21 16:54:27 +080075};
Michael Hennerich59003142007-10-21 16:54:27 +080076#endif
77
Michael Hennerich1089e222007-12-24 11:49:29 +080078#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
79static struct resource musb_resources[] = {
80 [0] = {
81 .start = 0xffc03800,
82 .end = 0xffc03cff,
83 .flags = IORESOURCE_MEM,
84 },
85 [1] = { /* general IRQ */
86 .start = IRQ_USB_INT0,
87 .end = IRQ_USB_INT0,
88 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
89 },
90 [2] = { /* DMA IRQ */
91 .start = IRQ_USB_DMA,
92 .end = IRQ_USB_DMA,
93 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
94 },
95};
96
Bryan Wu50041ac2008-10-08 13:39:40 +080097static struct musb_hdrc_config musb_config = {
98 .multipoint = 0,
99 .dyn_fifo = 0,
100 .soft_con = 1,
101 .dma = 1,
Bryan Wufea05da2009-01-07 23:14:39 +0800102 .num_eps = 8,
103 .dma_channels = 8,
Bryan Wu50041ac2008-10-08 13:39:40 +0800104 .gpio_vrsel = GPIO_PG13,
Cliff Cai85eb0e42010-01-22 04:02:46 +0000105 /* Some custom boards need to be active low, just set it to "0"
106 * if it is the case.
107 */
108 .gpio_vrsel_active = 1,
Bryan Wu50041ac2008-10-08 13:39:40 +0800109};
110
Michael Hennerich1089e222007-12-24 11:49:29 +0800111static struct musb_hdrc_platform_data musb_plat = {
112#if defined(CONFIG_USB_MUSB_OTG)
113 .mode = MUSB_OTG,
114#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
115 .mode = MUSB_HOST,
116#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
117 .mode = MUSB_PERIPHERAL,
118#endif
Bryan Wu50041ac2008-10-08 13:39:40 +0800119 .config = &musb_config,
Michael Hennerich1089e222007-12-24 11:49:29 +0800120};
121
122static u64 musb_dmamask = ~(u32)0;
123
124static struct platform_device musb_device = {
125 .name = "musb_hdrc",
126 .id = 0,
127 .dev = {
128 .dma_mask = &musb_dmamask,
129 .coherent_dma_mask = 0xffffffff,
130 .platform_data = &musb_plat,
131 },
132 .num_resources = ARRAY_SIZE(musb_resources),
133 .resource = musb_resources,
134};
135#endif
136
137#if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
138
139static struct resource bf52x_t350mcqb_resources[] = {
140 {
141 .start = IRQ_PPI_ERROR,
142 .end = IRQ_PPI_ERROR,
143 .flags = IORESOURCE_IRQ,
144 },
145};
146
147static struct platform_device bf52x_t350mcqb_device = {
148 .name = "bfin-t350mcqb",
149 .id = -1,
150 .num_resources = ARRAY_SIZE(bf52x_t350mcqb_resources),
151 .resource = bf52x_t350mcqb_resources,
152};
153#endif
154
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000155#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
156#include <asm/bfin-lq035q1.h>
157
158static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
159 .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
Michael Hennerichd94a1aa2009-12-08 11:45:55 +0000160 .ppi_mode = USE_RGB565_8_BIT_PPI,
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000161};
162
163static struct resource bfin_lq035q1_resources[] = {
164 {
165 .start = IRQ_PPI_ERROR,
166 .end = IRQ_PPI_ERROR,
167 .flags = IORESOURCE_IRQ,
168 },
169};
170
171static struct platform_device bfin_lq035q1_device = {
172 .name = "bfin-lq035q1",
173 .id = -1,
174 .num_resources = ARRAY_SIZE(bfin_lq035q1_resources),
175 .resource = bfin_lq035q1_resources,
176 .dev = {
177 .platform_data = &bfin_lq035q1_data,
178 },
179};
180#endif
181
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800182#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
183static struct mtd_partition ezkit_partitions[] = {
184 {
Robin Getzaa582972008-08-05 17:47:29 +0800185 .name = "bootloader(nor)",
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800186 .size = 0x40000,
187 .offset = 0,
188 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800189 .name = "linux kernel(nor)",
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800190 .size = 0x1C0000,
191 .offset = MTDPART_OFS_APPEND,
192 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800193 .name = "file system(nor)",
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800194 .size = MTDPART_SIZ_FULL,
195 .offset = MTDPART_OFS_APPEND,
196 }
197};
198
199static struct physmap_flash_data ezkit_flash_data = {
200 .width = 2,
201 .parts = ezkit_partitions,
202 .nr_parts = ARRAY_SIZE(ezkit_partitions),
203};
204
205static struct resource ezkit_flash_resource = {
206 .start = 0x20000000,
207 .end = 0x203fffff,
208 .flags = IORESOURCE_MEM,
209};
210
211static struct platform_device ezkit_flash_device = {
212 .name = "physmap-flash",
213 .id = 0,
214 .dev = {
215 .platform_data = &ezkit_flash_data,
216 },
217 .num_resources = 1,
218 .resource = &ezkit_flash_resource,
219};
220#endif
221
Michael Hennerich64307f72007-10-29 16:55:18 +0800222#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
223static struct mtd_partition partition_info[] = {
224 {
Robin Getzaa582972008-08-05 17:47:29 +0800225 .name = "linux kernel(nand)",
Michael Hennerich64307f72007-10-29 16:55:18 +0800226 .offset = 0,
Mike Frysingerf4585a02008-10-13 14:45:21 +0800227 .size = 4 * 1024 * 1024,
Michael Hennerich64307f72007-10-29 16:55:18 +0800228 },
229 {
Robin Getzaa582972008-08-05 17:47:29 +0800230 .name = "file system(nand)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800231 .offset = MTDPART_OFS_APPEND,
232 .size = MTDPART_SIZ_FULL,
Michael Hennerich64307f72007-10-29 16:55:18 +0800233 },
234};
235
236static struct bf5xx_nand_platform bf5xx_nand_platform = {
Michael Hennerich64307f72007-10-29 16:55:18 +0800237 .data_width = NFC_NWIDTH_8,
238 .partitions = partition_info,
239 .nr_partitions = ARRAY_SIZE(partition_info),
240 .rd_dly = 3,
241 .wr_dly = 3,
242};
243
244static struct resource bf5xx_nand_resources[] = {
245 {
246 .start = NFC_CTL,
247 .end = NFC_DATA_RD + 2,
248 .flags = IORESOURCE_MEM,
249 },
250 {
251 .start = CH_NFC,
252 .end = CH_NFC,
253 .flags = IORESOURCE_IRQ,
254 },
255};
256
257static struct platform_device bf5xx_nand_device = {
258 .name = "bf5xx-nand",
259 .id = 0,
260 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
261 .resource = bf5xx_nand_resources,
262 .dev = {
263 .platform_data = &bf5xx_nand_platform,
264 },
265};
266#endif
267
Michael Hennerich59003142007-10-21 16:54:27 +0800268#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
269static struct resource bfin_pcmcia_cf_resources[] = {
270 {
271 .start = 0x20310000, /* IO PORT */
272 .end = 0x20312000,
273 .flags = IORESOURCE_MEM,
274 }, {
275 .start = 0x20311000, /* Attribute Memory */
276 .end = 0x20311FFF,
277 .flags = IORESOURCE_MEM,
278 }, {
279 .start = IRQ_PF4,
280 .end = IRQ_PF4,
281 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
282 }, {
283 .start = 6, /* Card Detect PF6 */
284 .end = 6,
285 .flags = IORESOURCE_IRQ,
286 },
287};
288
289static struct platform_device bfin_pcmcia_cf_device = {
290 .name = "bfin_cf_pcmcia",
291 .id = -1,
292 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
293 .resource = bfin_pcmcia_cf_resources,
294};
295#endif
296
297#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
298static struct platform_device rtc_device = {
299 .name = "rtc-bfin",
300 .id = -1,
301};
302#endif
303
304#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
Michael Hennerich61f09b52009-07-24 08:48:31 +0000305#include <linux/smc91x.h>
306
307static struct smc91x_platdata smc91x_info = {
308 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
309 .leda = RPC_LED_100_10,
310 .ledb = RPC_LED_TX_RX,
311};
312
Michael Hennerich59003142007-10-21 16:54:27 +0800313static struct resource smc91x_resources[] = {
314 {
315 .name = "smc91x-regs",
316 .start = 0x20300300,
317 .end = 0x20300300 + 16,
318 .flags = IORESOURCE_MEM,
319 }, {
320
321 .start = IRQ_PF7,
322 .end = IRQ_PF7,
323 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
324 },
325};
326static struct platform_device smc91x_device = {
327 .name = "smc91x",
328 .id = 0,
329 .num_resources = ARRAY_SIZE(smc91x_resources),
330 .resource = smc91x_resources,
Michael Hennerich61f09b52009-07-24 08:48:31 +0000331 .dev = {
332 .platform_data = &smc91x_info,
333 },
Michael Hennerich59003142007-10-21 16:54:27 +0800334};
335#endif
336
337#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
338static struct resource dm9000_resources[] = {
339 [0] = {
340 .start = 0x203FB800,
Laurent Pinchartda3854f2008-06-24 22:15:58 +0100341 .end = 0x203FB800 + 1,
Michael Hennerich59003142007-10-21 16:54:27 +0800342 .flags = IORESOURCE_MEM,
343 },
344 [1] = {
Laurent Pinchartda3854f2008-06-24 22:15:58 +0100345 .start = 0x203FB800 + 4,
346 .end = 0x203FB800 + 5,
347 .flags = IORESOURCE_MEM,
348 },
349 [2] = {
Michael Hennerich59003142007-10-21 16:54:27 +0800350 .start = IRQ_PF9,
351 .end = IRQ_PF9,
352 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
353 },
354};
355
356static struct platform_device dm9000_device = {
357 .name = "dm9000",
358 .id = -1,
359 .num_resources = ARRAY_SIZE(dm9000_resources),
360 .resource = dm9000_resources,
361};
362#endif
363
Michael Hennerich59003142007-10-21 16:54:27 +0800364#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
Graf Yang65319622009-02-04 16:49:45 +0800365static struct platform_device bfin_mii_bus = {
366 .name = "bfin_mii_bus",
367};
368
Michael Hennerich59003142007-10-21 16:54:27 +0800369static struct platform_device bfin_mac_device = {
370 .name = "bfin_mac",
Graf Yang65319622009-02-04 16:49:45 +0800371 .dev.platform_data = &bfin_mii_bus,
Michael Hennerich59003142007-10-21 16:54:27 +0800372};
373#endif
374
375#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
376static struct resource net2272_bfin_resources[] = {
377 {
378 .start = 0x20300000,
379 .end = 0x20300000 + 0x100,
380 .flags = IORESOURCE_MEM,
381 }, {
382 .start = IRQ_PF7,
383 .end = IRQ_PF7,
384 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
385 },
386};
387
388static struct platform_device net2272_bfin_device = {
389 .name = "net2272",
390 .id = -1,
391 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
392 .resource = net2272_bfin_resources,
393};
394#endif
395
Michael Hennerich59003142007-10-21 16:54:27 +0800396#if defined(CONFIG_MTD_M25P80) \
397 || defined(CONFIG_MTD_M25P80_MODULE)
398static struct mtd_partition bfin_spi_flash_partitions[] = {
399 {
Robin Getzaa582972008-08-05 17:47:29 +0800400 .name = "bootloader(spi)",
Grace Panac76d882008-04-24 06:33:56 +0800401 .size = 0x00040000,
Michael Hennerich59003142007-10-21 16:54:27 +0800402 .offset = 0,
403 .mask_flags = MTD_CAP_ROM
404 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800405 .name = "linux kernel(spi)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800406 .size = MTDPART_SIZ_FULL,
407 .offset = MTDPART_OFS_APPEND,
Michael Hennerich59003142007-10-21 16:54:27 +0800408 }
409};
410
411static struct flash_platform_data bfin_spi_flash_data = {
412 .name = "m25p80",
413 .parts = bfin_spi_flash_partitions,
414 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
Michael Hennerichb9c9e782008-05-07 11:41:26 +0800415 .type = "m25p16",
Michael Hennerich59003142007-10-21 16:54:27 +0800416};
417
418/* SPI flash chip (m25p64) */
419static struct bfin5xx_spi_chip spi_flash_chip_info = {
420 .enable_dma = 0, /* use dma transfer with this chip*/
421 .bits_per_word = 8,
422};
423#endif
424
Mike Frysingera261eec2009-05-20 14:05:36 +0000425#if defined(CONFIG_BFIN_SPI_ADC) \
426 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800427/* SPI ADC chip */
428static struct bfin5xx_spi_chip spi_adc_chip_info = {
429 .enable_dma = 1, /* use dma transfer with this chip*/
430 .bits_per_word = 16,
431};
432#endif
433
Barry Song7ba80062010-01-28 09:37:21 +0000434#if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
435 || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800436static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
437 .enable_dma = 0,
438 .bits_per_word = 16,
439};
440#endif
441
Yi Liffdf3ec2009-03-31 10:36:51 +0000442#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
443static struct bfin5xx_spi_chip mmc_spi_chip_info = {
444 .enable_dma = 0,
445 .bits_per_word = 8,
446};
447#endif
448
Michael Hennerich59003142007-10-21 16:54:27 +0800449#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
450static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
451 .enable_dma = 0,
452 .bits_per_word = 16,
453};
454
455static const struct ad7877_platform_data bfin_ad7877_ts_info = {
456 .model = 7877,
457 .vref_delay_usecs = 50, /* internal, no capacitor */
458 .x_plate_ohms = 419,
459 .y_plate_ohms = 486,
460 .pressure_max = 1000,
461 .pressure_min = 0,
462 .stopacq_polarity = 1,
463 .first_conversion_delay = 3,
464 .acquisition_time = 1,
465 .averaging = 1,
466 .pen_down_acc_interval = 1,
467};
468#endif
469
Michael Hennerich51054322009-01-07 23:14:38 +0800470#if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
471#include <linux/spi/ad7879.h>
472static const struct ad7879_platform_data bfin_ad7879_ts_info = {
473 .model = 7879, /* Model = AD7879 */
474 .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
475 .pressure_max = 10000,
476 .pressure_min = 0,
477 .first_conversion_delay = 3, /* wait 512us before do a first conversion */
478 .acquisition_time = 1, /* 4us acquisition time per sample */
479 .median = 2, /* do 8 measurements */
480 .averaging = 1, /* take the average of 4 middle samples */
481 .pen_down_acc_interval = 255, /* 9.4 ms */
Michael Hennerich244d3422009-12-18 09:29:39 +0000482 .gpio_export = 0, /* Export GPIO to gpiolib */
Michael Hennerich51054322009-01-07 23:14:38 +0800483};
484#endif
485
486#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
487static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
488 .enable_dma = 0,
489 .bits_per_word = 16,
490};
491#endif
492
Michael Hennerich6e668932008-02-09 01:54:09 +0800493#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
494static struct bfin5xx_spi_chip spidev_chip_info = {
495 .enable_dma = 0,
496 .bits_per_word = 8,
497};
498#endif
499
Barry Song336746e2009-10-13 09:19:18 +0000500#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
501static struct platform_device bfin_i2s = {
502 .name = "bfin-i2s",
503 .id = CONFIG_SND_BF5XX_SPORT_NUM,
504 /* TODO: add platform data here */
505};
506#endif
507
508#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
509static struct platform_device bfin_tdm = {
510 .name = "bfin-tdm",
511 .id = CONFIG_SND_BF5XX_SPORT_NUM,
512 /* TODO: add platform data here */
513};
514#endif
515
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000516#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
517static struct bfin5xx_spi_chip lq035q1_spi_chip_info = {
518 .enable_dma = 0,
519 .bits_per_word = 8,
520};
521#endif
522
Michael Hennerich59003142007-10-21 16:54:27 +0800523static struct spi_board_info bfin_spi_board_info[] __initdata = {
524#if defined(CONFIG_MTD_M25P80) \
525 || defined(CONFIG_MTD_M25P80_MODULE)
526 {
527 /* the modalias must be the same as spi device driver name */
528 .modalias = "m25p80", /* Name of spi_driver for this device */
529 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
530 .bus_num = 0, /* Framework bus number */
531 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
532 .platform_data = &bfin_spi_flash_data,
533 .controller_data = &spi_flash_chip_info,
534 .mode = SPI_MODE_3,
535 },
536#endif
537
Mike Frysingera261eec2009-05-20 14:05:36 +0000538#if defined(CONFIG_BFIN_SPI_ADC) \
539 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800540 {
541 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
542 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
543 .bus_num = 0, /* Framework bus number */
544 .chip_select = 1, /* Framework chip select. */
545 .platform_data = NULL, /* No spi_driver specific config */
546 .controller_data = &spi_adc_chip_info,
547 },
548#endif
549
Barry Song7ba80062010-01-28 09:37:21 +0000550#if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
551 || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800552 {
Barry Song7ba80062010-01-28 09:37:21 +0000553 .modalias = "ad183x",
Michael Hennerich59003142007-10-21 16:54:27 +0800554 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
555 .bus_num = 0,
Barry Song7ba80062010-01-28 09:37:21 +0000556 .chip_select = 4,
Michael Hennerich59003142007-10-21 16:54:27 +0800557 .controller_data = &ad1836_spi_chip_info,
558 },
559#endif
Yi Liffdf3ec2009-03-31 10:36:51 +0000560#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
561 {
562 .modalias = "mmc_spi",
563 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
564 .bus_num = 0,
565 .chip_select = 3,
566 .controller_data = &mmc_spi_chip_info,
567 .mode = SPI_MODE_0,
568 },
569#endif
570
Michael Hennerich59003142007-10-21 16:54:27 +0800571#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
572 {
573 .modalias = "ad7877",
574 .platform_data = &bfin_ad7877_ts_info,
Bryan Wu2eb74ae2008-05-31 15:17:25 +0800575 .irq = IRQ_PF8,
Michael Hennerich59003142007-10-21 16:54:27 +0800576 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Michael Hennerich0954f702007-11-13 00:16:19 +0800577 .bus_num = 0,
Bryan Wu2eb74ae2008-05-31 15:17:25 +0800578 .chip_select = 2,
Michael Hennerich59003142007-10-21 16:54:27 +0800579 .controller_data = &spi_ad7877_chip_info,
580 },
581#endif
Michael Hennerich51054322009-01-07 23:14:38 +0800582#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
583 {
584 .modalias = "ad7879",
585 .platform_data = &bfin_ad7879_ts_info,
586 .irq = IRQ_PF8,
587 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
588 .bus_num = 0,
589 .chip_select = 3,
590 .controller_data = &spi_ad7879_chip_info,
591 .mode = SPI_CPHA | SPI_CPOL,
592 },
593#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800594#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
595 {
596 .modalias = "spidev",
597 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
598 .bus_num = 0,
599 .chip_select = 1,
600 .controller_data = &spidev_chip_info,
601 },
602#endif
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000603#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
604 {
605 .modalias = "bfin-lq035q1-spi",
606 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
607 .bus_num = 0,
608 .chip_select = 7,
609 .controller_data = &lq035q1_spi_chip_info,
610 .mode = SPI_CPHA | SPI_CPOL,
611 },
612#endif
Michael Hennerich59003142007-10-21 16:54:27 +0800613};
614
Mike Frysinger5bda2722008-06-07 15:03:01 +0800615#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800616/* SPI controller data */
617static struct bfin5xx_spi_master bfin_spi0_info = {
618 .num_chipselect = 8,
619 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800620 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Michael Hennerich59003142007-10-21 16:54:27 +0800621};
622
623/* SPI (0) */
624static struct resource bfin_spi0_resource[] = {
625 [0] = {
626 .start = SPI0_REGBASE,
627 .end = SPI0_REGBASE + 0xFF,
628 .flags = IORESOURCE_MEM,
629 },
630 [1] = {
631 .start = CH_SPI,
632 .end = CH_SPI,
Yi Li53122692009-06-05 12:11:11 +0000633 .flags = IORESOURCE_DMA,
634 },
635 [2] = {
636 .start = IRQ_SPI,
637 .end = IRQ_SPI,
Michael Hennerich59003142007-10-21 16:54:27 +0800638 .flags = IORESOURCE_IRQ,
639 },
640};
641
642static struct platform_device bfin_spi0_device = {
643 .name = "bfin-spi",
644 .id = 0, /* Bus number */
645 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
646 .resource = bfin_spi0_resource,
647 .dev = {
648 .platform_data = &bfin_spi0_info, /* Passed to driver */
649 },
650};
651#endif /* spi master and devices */
652
Michael Hennerich59003142007-10-21 16:54:27 +0800653#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800654#ifdef CONFIG_SERIAL_BFIN_UART0
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000655static struct resource bfin_uart0_resources[] = {
Michael Hennerich59003142007-10-21 16:54:27 +0800656 {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000657 .start = UART0_THR,
658 .end = UART0_GCTL+2,
Michael Hennerich59003142007-10-21 16:54:27 +0800659 .flags = IORESOURCE_MEM,
660 },
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000661 {
662 .start = IRQ_UART0_RX,
663 .end = IRQ_UART0_RX+1,
664 .flags = IORESOURCE_IRQ,
665 },
666 {
667 .start = IRQ_UART0_ERROR,
668 .end = IRQ_UART0_ERROR,
669 .flags = IORESOURCE_IRQ,
670 },
671 {
672 .start = CH_UART0_TX,
673 .end = CH_UART0_TX,
674 .flags = IORESOURCE_DMA,
675 },
676 {
677 .start = CH_UART0_RX,
678 .end = CH_UART0_RX,
679 .flags = IORESOURCE_DMA,
680 },
681};
682
683unsigned short bfin_uart0_peripherals[] = {
684 P_UART0_TX, P_UART0_RX, 0
685};
686
687static struct platform_device bfin_uart0_device = {
688 .name = "bfin-uart",
689 .id = 0,
690 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
691 .resource = bfin_uart0_resources,
692 .dev = {
693 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
694 },
695};
Michael Hennerich59003142007-10-21 16:54:27 +0800696#endif
697#ifdef CONFIG_SERIAL_BFIN_UART1
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000698static struct resource bfin_uart1_resources[] = {
Michael Hennerich59003142007-10-21 16:54:27 +0800699 {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000700 .start = UART1_THR,
701 .end = UART1_GCTL+2,
Michael Hennerich59003142007-10-21 16:54:27 +0800702 .flags = IORESOURCE_MEM,
703 },
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000704 {
705 .start = IRQ_UART1_RX,
706 .end = IRQ_UART1_RX+1,
707 .flags = IORESOURCE_IRQ,
708 },
709 {
710 .start = IRQ_UART1_ERROR,
711 .end = IRQ_UART1_ERROR,
712 .flags = IORESOURCE_IRQ,
713 },
714 {
715 .start = CH_UART1_TX,
716 .end = CH_UART1_TX,
717 .flags = IORESOURCE_DMA,
718 },
719 {
720 .start = CH_UART1_RX,
721 .end = CH_UART1_RX,
722 .flags = IORESOURCE_DMA,
723 },
724#ifdef CONFIG_BFIN_UART1_CTSRTS
725 { /* CTS pin */
726 .start = GPIO_PF9,
727 .end = GPIO_PF9,
728 .flags = IORESOURCE_IO,
729 },
730 { /* RTS pin */
731 .start = GPIO_PF10,
732 .end = GPIO_PF10,
733 .flags = IORESOURCE_IO,
734 },
Michael Hennerich59003142007-10-21 16:54:27 +0800735#endif
736};
737
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000738unsigned short bfin_uart1_peripherals[] = {
739 P_UART1_TX, P_UART1_RX, 0
740};
741
742static struct platform_device bfin_uart1_device = {
Michael Hennerich59003142007-10-21 16:54:27 +0800743 .name = "bfin-uart",
744 .id = 1,
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000745 .num_resources = ARRAY_SIZE(bfin_uart1_resources),
746 .resource = bfin_uart1_resources,
747 .dev = {
748 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
749 },
Michael Hennerich59003142007-10-21 16:54:27 +0800750};
751#endif
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000752#endif
Michael Hennerich59003142007-10-21 16:54:27 +0800753
Graf Yang5be36d22008-04-25 03:09:15 +0800754#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang5be36d22008-04-25 03:09:15 +0800755#ifdef CONFIG_BFIN_SIR0
Graf Yang42bd8bc2009-01-07 23:14:39 +0800756static struct resource bfin_sir0_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800757 {
758 .start = 0xFFC00400,
759 .end = 0xFFC004FF,
760 .flags = IORESOURCE_MEM,
761 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800762 {
763 .start = IRQ_UART0_RX,
764 .end = IRQ_UART0_RX+1,
765 .flags = IORESOURCE_IRQ,
766 },
767 {
768 .start = CH_UART0_RX,
769 .end = CH_UART0_RX+1,
770 .flags = IORESOURCE_DMA,
771 },
772};
773
774static struct platform_device bfin_sir0_device = {
775 .name = "bfin_sir",
776 .id = 0,
777 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
778 .resource = bfin_sir0_resources,
779};
Graf Yang5be36d22008-04-25 03:09:15 +0800780#endif
781#ifdef CONFIG_BFIN_SIR1
Graf Yang42bd8bc2009-01-07 23:14:39 +0800782static struct resource bfin_sir1_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800783 {
784 .start = 0xFFC02000,
785 .end = 0xFFC020FF,
786 .flags = IORESOURCE_MEM,
787 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800788 {
789 .start = IRQ_UART1_RX,
790 .end = IRQ_UART1_RX+1,
791 .flags = IORESOURCE_IRQ,
792 },
793 {
794 .start = CH_UART1_RX,
795 .end = CH_UART1_RX+1,
796 .flags = IORESOURCE_DMA,
797 },
Graf Yang5be36d22008-04-25 03:09:15 +0800798};
799
Graf Yang42bd8bc2009-01-07 23:14:39 +0800800static struct platform_device bfin_sir1_device = {
Graf Yang5be36d22008-04-25 03:09:15 +0800801 .name = "bfin_sir",
Graf Yang42bd8bc2009-01-07 23:14:39 +0800802 .id = 1,
803 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
804 .resource = bfin_sir1_resources,
Graf Yang5be36d22008-04-25 03:09:15 +0800805};
806#endif
Graf Yang42bd8bc2009-01-07 23:14:39 +0800807#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800808
Michael Hennerich59003142007-10-21 16:54:27 +0800809#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
810static struct resource bfin_twi0_resource[] = {
811 [0] = {
812 .start = TWI0_REGBASE,
813 .end = TWI0_REGBASE,
814 .flags = IORESOURCE_MEM,
815 },
816 [1] = {
817 .start = IRQ_TWI,
818 .end = IRQ_TWI,
819 .flags = IORESOURCE_IRQ,
820 },
821};
822
823static struct platform_device i2c_bfin_twi_device = {
824 .name = "i2c-bfin-twi",
825 .id = 0,
826 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
827 .resource = bfin_twi0_resource,
828};
829#endif
830
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000831#if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
832#include <linux/mfd/adp5520.h>
833
834 /*
835 * ADP5520/5501 LEDs Data
836 */
837
838static struct led_info adp5520_leds[] = {
839 {
840 .name = "adp5520-led1",
841 .default_trigger = "none",
842 .flags = FLAG_ID_ADP5520_LED1_ADP5501_LED0 | ADP5520_LED_OFFT_600ms,
843 },
844};
845
846static struct adp5520_leds_platform_data adp5520_leds_data = {
847 .num_leds = ARRAY_SIZE(adp5520_leds),
848 .leds = adp5520_leds,
849 .fade_in = ADP5520_FADE_T_600ms,
850 .fade_out = ADP5520_FADE_T_600ms,
851 .led_on_time = ADP5520_LED_ONT_600ms,
852};
853
854 /*
855 * ADP5520 Keypad Data
856 */
857
858static const unsigned short adp5520_keymap[ADP5520_KEYMAPSIZE] = {
859 [ADP5520_KEY(3, 3)] = KEY_1,
860 [ADP5520_KEY(2, 3)] = KEY_2,
861 [ADP5520_KEY(1, 3)] = KEY_3,
862 [ADP5520_KEY(0, 3)] = KEY_UP,
863 [ADP5520_KEY(3, 2)] = KEY_4,
864 [ADP5520_KEY(2, 2)] = KEY_5,
865 [ADP5520_KEY(1, 2)] = KEY_6,
866 [ADP5520_KEY(0, 2)] = KEY_DOWN,
867 [ADP5520_KEY(3, 1)] = KEY_7,
868 [ADP5520_KEY(2, 1)] = KEY_8,
869 [ADP5520_KEY(1, 1)] = KEY_9,
870 [ADP5520_KEY(0, 1)] = KEY_DOT,
871 [ADP5520_KEY(3, 0)] = KEY_BACKSPACE,
872 [ADP5520_KEY(2, 0)] = KEY_0,
873 [ADP5520_KEY(1, 0)] = KEY_HELP,
874 [ADP5520_KEY(0, 0)] = KEY_ENTER,
875};
876
877static struct adp5520_keys_platform_data adp5520_keys_data = {
878 .rows_en_mask = ADP5520_ROW_R3 | ADP5520_ROW_R2 | ADP5520_ROW_R1 | ADP5520_ROW_R0,
879 .cols_en_mask = ADP5520_COL_C3 | ADP5520_COL_C2 | ADP5520_COL_C1 | ADP5520_COL_C0,
880 .keymap = adp5520_keymap,
881 .keymapsize = ARRAY_SIZE(adp5520_keymap),
882 .repeat = 0,
883};
884
885 /*
886 * ADP5520/5501 Multifuction Device Init Data
887 */
888
889static struct adp5520_platform_data adp5520_pdev_data = {
890 .leds = &adp5520_leds_data,
891 .keys = &adp5520_keys_data,
892};
893
894#endif
895
Bryan Wu72268682008-05-07 11:41:26 +0800896static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
Michael Hennerichebd58332009-07-02 11:00:38 +0000897#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
Bryan Wu72268682008-05-07 11:41:26 +0800898 {
899 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
Bryan Wu72268682008-05-07 11:41:26 +0800900 },
901#endif
Michael Hennerich204844e2009-06-30 14:57:22 +0000902#if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
Bryan Wu72268682008-05-07 11:41:26 +0800903 {
904 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
Bryan Wu72268682008-05-07 11:41:26 +0800905 .irq = IRQ_PF8,
906 },
907#endif
Michael Hennerich50c4c082009-09-22 13:10:09 +0000908#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
909 {
910 I2C_BOARD_INFO("bfin-adv7393", 0x2B),
911 },
912#endif
Michael Hennerich6924dfb2009-12-07 13:41:28 +0000913#if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) || defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)
914 {
915 I2C_BOARD_INFO("ad7879", 0x2C),
916 .irq = IRQ_PF8,
917 .platform_data = (void *)&bfin_ad7879_ts_info,
918 },
919#endif
920#if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
921 {
922 I2C_BOARD_INFO("pmic-adp5520", 0x32),
923 .irq = IRQ_PF9,
924 .platform_data = (void *)&adp5520_pdev_data,
925 },
926#endif
Cliff Cai29bb3bc2010-01-14 08:28:38 +0000927#if defined(CONFIG_SND_SOC_SSM2602) || defined(CONFIG_SND_SOC_SSM2602_MODULE)
928 {
929 I2C_BOARD_INFO("ssm2602", 0x1b),
930 },
931#endif
Bryan Wu72268682008-05-07 11:41:26 +0800932};
Bryan Wu72268682008-05-07 11:41:26 +0800933
Michael Hennerich59003142007-10-21 16:54:27 +0800934#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
Sonic Zhangdf5de262009-09-23 05:01:56 +0000935#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
936static struct resource bfin_sport0_uart_resources[] = {
937 {
938 .start = SPORT0_TCR1,
939 .end = SPORT0_MRCS3+4,
940 .flags = IORESOURCE_MEM,
941 },
942 {
943 .start = IRQ_SPORT0_RX,
944 .end = IRQ_SPORT0_RX+1,
945 .flags = IORESOURCE_IRQ,
946 },
947 {
948 .start = IRQ_SPORT0_ERROR,
949 .end = IRQ_SPORT0_ERROR,
950 .flags = IORESOURCE_IRQ,
951 },
952};
953
954unsigned short bfin_sport0_peripherals[] = {
955 P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
956 P_SPORT0_DRPRI, P_SPORT0_RSCLK, P_SPORT0_DRSEC, P_SPORT0_DTSEC, 0
957};
958
Michael Hennerich59003142007-10-21 16:54:27 +0800959static struct platform_device bfin_sport0_uart_device = {
960 .name = "bfin-sport-uart",
961 .id = 0,
Sonic Zhangdf5de262009-09-23 05:01:56 +0000962 .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
963 .resource = bfin_sport0_uart_resources,
964 .dev = {
965 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
966 },
967};
968#endif
969#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
970static struct resource bfin_sport1_uart_resources[] = {
971 {
972 .start = SPORT1_TCR1,
973 .end = SPORT1_MRCS3+4,
974 .flags = IORESOURCE_MEM,
975 },
976 {
977 .start = IRQ_SPORT1_RX,
978 .end = IRQ_SPORT1_RX+1,
979 .flags = IORESOURCE_IRQ,
980 },
981 {
982 .start = IRQ_SPORT1_ERROR,
983 .end = IRQ_SPORT1_ERROR,
984 .flags = IORESOURCE_IRQ,
985 },
986};
987
988unsigned short bfin_sport1_peripherals[] = {
989 P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
990 P_SPORT1_DRPRI, P_SPORT1_RSCLK, P_SPORT1_DRSEC, P_SPORT1_DTSEC, 0
Michael Hennerich59003142007-10-21 16:54:27 +0800991};
992
993static struct platform_device bfin_sport1_uart_device = {
994 .name = "bfin-sport-uart",
995 .id = 1,
Sonic Zhangdf5de262009-09-23 05:01:56 +0000996 .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
997 .resource = bfin_sport1_uart_resources,
998 .dev = {
999 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
1000 },
Michael Hennerich59003142007-10-21 16:54:27 +08001001};
1002#endif
Sonic Zhangdf5de262009-09-23 05:01:56 +00001003#endif
Michael Hennerich59003142007-10-21 16:54:27 +08001004
Michael Hennerich1089e222007-12-24 11:49:29 +08001005#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
Michael Hennerich1089e222007-12-24 11:49:29 +08001006#include <linux/gpio_keys.h>
1007
1008static struct gpio_keys_button bfin_gpio_keys_table[] = {
1009 {BTN_0, GPIO_PG0, 1, "gpio-keys: BTN0"},
1010 {BTN_1, GPIO_PG13, 1, "gpio-keys: BTN1"},
1011};
1012
1013static struct gpio_keys_platform_data bfin_gpio_keys_data = {
1014 .buttons = bfin_gpio_keys_table,
1015 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
1016};
1017
1018static struct platform_device bfin_device_gpiokeys = {
1019 .name = "gpio-keys",
1020 .dev = {
1021 .platform_data = &bfin_gpio_keys_data,
1022 },
1023};
1024#endif
1025
Michael Hennerichadfc0462009-10-09 07:37:03 +00001026#if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
Michael Hennerichaca5e4a2008-10-08 14:27:59 +08001027#include <asm/bfin_rotary.h>
1028
1029static struct bfin_rotary_platform_data bfin_rotary_data = {
1030 /*.rotary_up_key = KEY_UP,*/
1031 /*.rotary_down_key = KEY_DOWN,*/
1032 .rotary_rel_code = REL_WHEEL,
1033 .rotary_button_key = KEY_ENTER,
1034 .debounce = 10, /* 0..17 */
1035 .mode = ROT_QUAD_ENC | ROT_DEBE,
1036};
1037
1038static struct resource bfin_rotary_resources[] = {
1039 {
1040 .start = IRQ_CNT,
1041 .end = IRQ_CNT,
1042 .flags = IORESOURCE_IRQ,
1043 },
1044};
1045
1046static struct platform_device bfin_rotary_device = {
1047 .name = "bfin-rotary",
1048 .id = -1,
1049 .num_resources = ARRAY_SIZE(bfin_rotary_resources),
1050 .resource = bfin_rotary_resources,
1051 .dev = {
1052 .platform_data = &bfin_rotary_data,
1053 },
1054};
1055#endif
1056
Michael Hennerich14b03202008-05-07 11:41:26 +08001057static const unsigned int cclk_vlev_datasheet[] =
1058{
1059 VRPAIR(VLEV_100, 400000000),
1060 VRPAIR(VLEV_105, 426000000),
1061 VRPAIR(VLEV_110, 500000000),
1062 VRPAIR(VLEV_115, 533000000),
1063 VRPAIR(VLEV_120, 600000000),
1064};
1065
1066static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
1067 .tuple_tab = cclk_vlev_datasheet,
1068 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
1069 .vr_settling_time = 25 /* us */,
1070};
1071
1072static struct platform_device bfin_dpmc = {
1073 .name = "bfin dpmc",
1074 .dev = {
1075 .platform_data = &bfin_dmpc_vreg_data,
1076 },
1077};
1078
Michael Hennerich59003142007-10-21 16:54:27 +08001079static struct platform_device *stamp_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +08001080
1081 &bfin_dpmc,
1082
Michael Hennerich64307f72007-10-29 16:55:18 +08001083#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
1084 &bf5xx_nand_device,
1085#endif
1086
Michael Hennerich59003142007-10-21 16:54:27 +08001087#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
1088 &bfin_pcmcia_cf_device,
1089#endif
1090
1091#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
1092 &rtc_device,
1093#endif
1094
Michael Hennerich3f375692008-11-18 17:48:22 +08001095#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
1096 &bfin_isp1760_device,
1097#endif
1098
Michael Hennerich1089e222007-12-24 11:49:29 +08001099#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
1100 &musb_device,
1101#endif
1102
Michael Hennerich59003142007-10-21 16:54:27 +08001103#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
1104 &smc91x_device,
1105#endif
1106
1107#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
1108 &dm9000_device,
1109#endif
1110
1111#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
Graf Yang65319622009-02-04 16:49:45 +08001112 &bfin_mii_bus,
Michael Hennerich59003142007-10-21 16:54:27 +08001113 &bfin_mac_device,
1114#endif
1115
1116#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
1117 &net2272_bfin_device,
1118#endif
1119
1120#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1121 &bfin_spi0_device,
1122#endif
1123
Michael Hennerich1089e222007-12-24 11:49:29 +08001124#if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
1125 &bf52x_t350mcqb_device,
1126#endif
1127
Michael Hennerich6924dfb2009-12-07 13:41:28 +00001128#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
1129 &bfin_lq035q1_device,
1130#endif
1131
Michael Hennerich59003142007-10-21 16:54:27 +08001132#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +00001133#ifdef CONFIG_SERIAL_BFIN_UART0
1134 &bfin_uart0_device,
1135#endif
1136#ifdef CONFIG_SERIAL_BFIN_UART1
1137 &bfin_uart1_device,
1138#endif
Michael Hennerich59003142007-10-21 16:54:27 +08001139#endif
1140
Graf Yang5be36d22008-04-25 03:09:15 +08001141#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang42bd8bc2009-01-07 23:14:39 +08001142#ifdef CONFIG_BFIN_SIR0
1143 &bfin_sir0_device,
1144#endif
1145#ifdef CONFIG_BFIN_SIR1
1146 &bfin_sir1_device,
1147#endif
Graf Yang5be36d22008-04-25 03:09:15 +08001148#endif
1149
Michael Hennerich59003142007-10-21 16:54:27 +08001150#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1151 &i2c_bfin_twi_device,
1152#endif
1153
1154#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
Sonic Zhangdf5de262009-09-23 05:01:56 +00001155#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
Michael Hennerich59003142007-10-21 16:54:27 +08001156 &bfin_sport0_uart_device,
Sonic Zhangdf5de262009-09-23 05:01:56 +00001157#endif
1158#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
Michael Hennerich59003142007-10-21 16:54:27 +08001159 &bfin_sport1_uart_device,
1160#endif
Sonic Zhangdf5de262009-09-23 05:01:56 +00001161#endif
Michael Hennerich59003142007-10-21 16:54:27 +08001162
Michael Hennerich1089e222007-12-24 11:49:29 +08001163#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1164 &bfin_device_gpiokeys,
1165#endif
Mike Frysingercad2ab62008-02-22 17:01:31 +08001166
Michael Hennerichadfc0462009-10-09 07:37:03 +00001167#if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
Michael Hennerichaca5e4a2008-10-08 14:27:59 +08001168 &bfin_rotary_device,
1169#endif
1170
Michael Hennerichd7e5dd42008-05-07 11:41:26 +08001171#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
1172 &ezkit_flash_device,
1173#endif
Barry Song336746e2009-10-13 09:19:18 +00001174
1175#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
1176 &bfin_i2s,
1177#endif
1178
1179#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
1180 &bfin_tdm,
1181#endif
Michael Hennerich59003142007-10-21 16:54:27 +08001182};
1183
Mike Frysinger7f6678c2009-02-04 16:49:45 +08001184static int __init ezkit_init(void)
Michael Hennerich59003142007-10-21 16:54:27 +08001185{
Harvey Harrisonb85d8582008-04-23 09:39:01 +08001186 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Bryan Wu72268682008-05-07 11:41:26 +08001187 i2c_register_board_info(0, bfin_i2c_board_info,
1188 ARRAY_SIZE(bfin_i2c_board_info));
Michael Hennerich59003142007-10-21 16:54:27 +08001189 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
Mike Frysinger5bda2722008-06-07 15:03:01 +08001190 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
Michael Hennerich59003142007-10-21 16:54:27 +08001191 return 0;
1192}
1193
Mike Frysinger7f6678c2009-02-04 16:49:45 +08001194arch_initcall(ezkit_init);
Michael Hennerich59003142007-10-21 16:54:27 +08001195
Sonic Zhangc13ce9f2009-09-23 09:37:46 +00001196static struct platform_device *ezkit_early_devices[] __initdata = {
1197#if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
1198#ifdef CONFIG_SERIAL_BFIN_UART0
1199 &bfin_uart0_device,
1200#endif
1201#ifdef CONFIG_SERIAL_BFIN_UART1
1202 &bfin_uart1_device,
1203#endif
1204#endif
1205
1206#if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
1207#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1208 &bfin_sport0_uart_device,
1209#endif
1210#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1211 &bfin_sport1_uart_device,
1212#endif
1213#endif
1214};
1215
1216void __init native_machine_early_platform_add_devices(void)
1217{
1218 printk(KERN_INFO "register early platform devices\n");
1219 early_platform_add_devices(ezkit_early_devices,
1220 ARRAY_SIZE(ezkit_early_devices));
1221}
1222
Michael Hennerich59003142007-10-21 16:54:27 +08001223void native_machine_restart(char *cmd)
1224{
1225 /* workaround reboot hang when booting from SPI */
1226 if ((bfin_read_SYSCR() & 0x7) == 0x3)
Sonic Zhangb52dae32009-02-04 16:49:45 +08001227 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
Michael Hennerich59003142007-10-21 16:54:27 +08001228}
Mike Frysinger137b1522007-11-22 16:07:03 +08001229
Mike Frysinger9862cc52007-11-15 21:21:20 +08001230void bfin_get_ether_addr(char *addr)
Mike Frysinger137b1522007-11-22 16:07:03 +08001231{
Mike Frysinger181afa92008-02-25 11:42:17 +08001232 /* the MAC is stored in OTP memory page 0xDF */
1233 u32 ret;
1234 u64 otp_mac;
1235 u32 (*otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)0xEF00001A;
1236
1237 ret = otp_read(0xDF, 0x00, &otp_mac);
1238 if (!(ret & 0x1)) {
1239 char *otp_mac_p = (char *)&otp_mac;
1240 for (ret = 0; ret < 6; ++ret)
1241 addr[ret] = otp_mac_p[5 - ret];
1242 }
Mike Frysinger137b1522007-11-22 16:07:03 +08001243}
Mike Frysinger9862cc52007-11-15 21:21:20 +08001244EXPORT_SYMBOL(bfin_get_ether_addr);