Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
[pandora-kernel.git] / arch / blackfin / mach-bf527 / boards / ezkit.c
1 /*
2  * Copyright 2004-2009 Analog Devices Inc.
3  *                2005 National ICT Australia (NICTA)
4  *                      Aidan Williams <aidan@nicta.com.au>
5  *
6  * Licensed under the GPL-2 or later.
7  */
8
9 #include <linux/device.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/spi/spi.h>
15 #include <linux/spi/flash.h>
16 #include <linux/i2c.h>
17 #include <linux/irq.h>
18 #include <linux/interrupt.h>
19 #include <linux/usb/musb.h>
20 #include <linux/leds.h>
21 #include <linux/input.h>
22 #include <asm/dma.h>
23 #include <asm/bfin5xx_spi.h>
24 #include <asm/reboot.h>
25 #include <asm/nand.h>
26 #include <asm/portmux.h>
27 #include <asm/dpmc.h>
28 #include <linux/spi/ad7877.h>
29
30 /*
31  * Name the Board for the /proc/cpuinfo
32  */
33 #ifdef CONFIG_BFIN527_EZKIT_V2
34 const char bfin_board_name[] = "ADI BF527-EZKIT V2";
35 #else
36 const char bfin_board_name[] = "ADI BF527-EZKIT";
37 #endif
38
39 /*
40  *  Driver needs to know address, irq and flag pin.
41  */
42
43 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
44 #include <linux/usb/isp1760.h>
45 static struct resource bfin_isp1760_resources[] = {
46         [0] = {
47                 .start  = 0x203C0000,
48                 .end    = 0x203C0000 + 0x000fffff,
49                 .flags  = IORESOURCE_MEM,
50         },
51         [1] = {
52                 .start  = IRQ_PF7,
53                 .end    = IRQ_PF7,
54                 .flags  = IORESOURCE_IRQ,
55         },
56 };
57
58 static struct isp1760_platform_data isp1760_priv = {
59         .is_isp1761 = 0,
60         .bus_width_16 = 1,
61         .port1_otg = 0,
62         .analog_oc = 0,
63         .dack_polarity_high = 0,
64         .dreq_polarity_high = 0,
65 };
66
67 static struct platform_device bfin_isp1760_device = {
68         .name           = "isp1760",
69         .id             = 0,
70         .dev = {
71                 .platform_data = &isp1760_priv,
72         },
73         .num_resources  = ARRAY_SIZE(bfin_isp1760_resources),
74         .resource       = bfin_isp1760_resources,
75 };
76 #endif
77
78 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
79 static 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
97 static struct musb_hdrc_config musb_config = {
98         .multipoint     = 0,
99         .dyn_fifo       = 0,
100         .soft_con       = 1,
101         .dma            = 1,
102         .num_eps        = 8,
103         .dma_channels   = 8,
104         .gpio_vrsel     = GPIO_PG13,
105         /* 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,
109 };
110
111 static 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
119         .config         = &musb_config,
120 };
121
122 static u64 musb_dmamask = ~(u32)0;
123
124 static 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
139 static struct resource bf52x_t350mcqb_resources[] = {
140         {
141                 .start = IRQ_PPI_ERROR,
142                 .end = IRQ_PPI_ERROR,
143                 .flags = IORESOURCE_IRQ,
144         },
145 };
146
147 static 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
155 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
156 #include <asm/bfin-lq035q1.h>
157
158 static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
159         .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
160         .ppi_mode = USE_RGB565_8_BIT_PPI,
161 };
162
163 static struct resource bfin_lq035q1_resources[] = {
164         {
165                 .start = IRQ_PPI_ERROR,
166                 .end = IRQ_PPI_ERROR,
167                 .flags = IORESOURCE_IRQ,
168         },
169 };
170
171 static 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
182 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
183 static struct mtd_partition ezkit_partitions[] = {
184         {
185                 .name       = "bootloader(nor)",
186                 .size       = 0x40000,
187                 .offset     = 0,
188         }, {
189                 .name       = "linux kernel(nor)",
190                 .size       = 0x1C0000,
191                 .offset     = MTDPART_OFS_APPEND,
192         }, {
193                 .name       = "file system(nor)",
194                 .size       = MTDPART_SIZ_FULL,
195                 .offset     = MTDPART_OFS_APPEND,
196         }
197 };
198
199 static struct physmap_flash_data ezkit_flash_data = {
200         .width      = 2,
201         .parts      = ezkit_partitions,
202         .nr_parts   = ARRAY_SIZE(ezkit_partitions),
203 };
204
205 static struct resource ezkit_flash_resource = {
206         .start = 0x20000000,
207         .end   = 0x203fffff,
208         .flags = IORESOURCE_MEM,
209 };
210
211 static 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
222 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
223 static struct mtd_partition partition_info[] = {
224         {
225                 .name = "linux kernel(nand)",
226                 .offset = 0,
227                 .size = 4 * 1024 * 1024,
228         },
229         {
230                 .name = "file system(nand)",
231                 .offset = MTDPART_OFS_APPEND,
232                 .size = MTDPART_SIZ_FULL,
233         },
234 };
235
236 static struct bf5xx_nand_platform bf5xx_nand_platform = {
237         .page_size = NFC_PG_SIZE_256,
238         .data_width = NFC_NWIDTH_8,
239         .partitions = partition_info,
240         .nr_partitions = ARRAY_SIZE(partition_info),
241         .rd_dly = 3,
242         .wr_dly = 3,
243 };
244
245 static struct resource bf5xx_nand_resources[] = {
246         {
247                 .start = NFC_CTL,
248                 .end = NFC_DATA_RD + 2,
249                 .flags = IORESOURCE_MEM,
250         },
251         {
252                 .start = CH_NFC,
253                 .end = CH_NFC,
254                 .flags = IORESOURCE_IRQ,
255         },
256 };
257
258 static struct platform_device bf5xx_nand_device = {
259         .name = "bf5xx-nand",
260         .id = 0,
261         .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
262         .resource = bf5xx_nand_resources,
263         .dev = {
264                 .platform_data = &bf5xx_nand_platform,
265         },
266 };
267 #endif
268
269 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
270 static struct resource bfin_pcmcia_cf_resources[] = {
271         {
272                 .start = 0x20310000, /* IO PORT */
273                 .end = 0x20312000,
274                 .flags = IORESOURCE_MEM,
275         }, {
276                 .start = 0x20311000, /* Attribute Memory */
277                 .end = 0x20311FFF,
278                 .flags = IORESOURCE_MEM,
279         }, {
280                 .start = IRQ_PF4,
281                 .end = IRQ_PF4,
282                 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
283         }, {
284                 .start = 6, /* Card Detect PF6 */
285                 .end = 6,
286                 .flags = IORESOURCE_IRQ,
287         },
288 };
289
290 static struct platform_device bfin_pcmcia_cf_device = {
291         .name = "bfin_cf_pcmcia",
292         .id = -1,
293         .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
294         .resource = bfin_pcmcia_cf_resources,
295 };
296 #endif
297
298 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
299 static struct platform_device rtc_device = {
300         .name = "rtc-bfin",
301         .id   = -1,
302 };
303 #endif
304
305 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
306 #include <linux/smc91x.h>
307
308 static struct smc91x_platdata smc91x_info = {
309         .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
310         .leda = RPC_LED_100_10,
311         .ledb = RPC_LED_TX_RX,
312 };
313
314 static struct resource smc91x_resources[] = {
315         {
316                 .name = "smc91x-regs",
317                 .start = 0x20300300,
318                 .end = 0x20300300 + 16,
319                 .flags = IORESOURCE_MEM,
320         }, {
321
322                 .start = IRQ_PF7,
323                 .end = IRQ_PF7,
324                 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
325         },
326 };
327 static struct platform_device smc91x_device = {
328         .name = "smc91x",
329         .id = 0,
330         .num_resources = ARRAY_SIZE(smc91x_resources),
331         .resource = smc91x_resources,
332         .dev    = {
333                 .platform_data  = &smc91x_info,
334         },
335 };
336 #endif
337
338 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
339 static struct resource dm9000_resources[] = {
340         [0] = {
341                 .start  = 0x203FB800,
342                 .end    = 0x203FB800 + 1,
343                 .flags  = IORESOURCE_MEM,
344         },
345         [1] = {
346                 .start  = 0x203FB800 + 4,
347                 .end    = 0x203FB800 + 5,
348                 .flags  = IORESOURCE_MEM,
349         },
350         [2] = {
351                 .start  = IRQ_PF9,
352                 .end    = IRQ_PF9,
353                 .flags  = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
354         },
355 };
356
357 static struct platform_device dm9000_device = {
358         .name           = "dm9000",
359         .id             = -1,
360         .num_resources  = ARRAY_SIZE(dm9000_resources),
361         .resource       = dm9000_resources,
362 };
363 #endif
364
365 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
366 static struct platform_device bfin_mii_bus = {
367         .name = "bfin_mii_bus",
368 };
369
370 static struct platform_device bfin_mac_device = {
371         .name = "bfin_mac",
372         .dev.platform_data = &bfin_mii_bus,
373 };
374 #endif
375
376 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
377 static struct resource net2272_bfin_resources[] = {
378         {
379                 .start = 0x20300000,
380                 .end = 0x20300000 + 0x100,
381                 .flags = IORESOURCE_MEM,
382         }, {
383                 .start = IRQ_PF7,
384                 .end = IRQ_PF7,
385                 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
386         },
387 };
388
389 static struct platform_device net2272_bfin_device = {
390         .name = "net2272",
391         .id = -1,
392         .num_resources = ARRAY_SIZE(net2272_bfin_resources),
393         .resource = net2272_bfin_resources,
394 };
395 #endif
396
397 #if defined(CONFIG_MTD_M25P80) \
398         || defined(CONFIG_MTD_M25P80_MODULE)
399 static struct mtd_partition bfin_spi_flash_partitions[] = {
400         {
401                 .name = "bootloader(spi)",
402                 .size = 0x00040000,
403                 .offset = 0,
404                 .mask_flags = MTD_CAP_ROM
405         }, {
406                 .name = "linux kernel(spi)",
407                 .size = MTDPART_SIZ_FULL,
408                 .offset = MTDPART_OFS_APPEND,
409         }
410 };
411
412 static struct flash_platform_data bfin_spi_flash_data = {
413         .name = "m25p80",
414         .parts = bfin_spi_flash_partitions,
415         .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
416         .type = "m25p16",
417 };
418
419 /* SPI flash chip (m25p64) */
420 static struct bfin5xx_spi_chip spi_flash_chip_info = {
421         .enable_dma = 0,         /* use dma transfer with this chip*/
422         .bits_per_word = 8,
423 };
424 #endif
425
426 #if defined(CONFIG_BFIN_SPI_ADC) \
427         || defined(CONFIG_BFIN_SPI_ADC_MODULE)
428 /* SPI ADC chip */
429 static struct bfin5xx_spi_chip spi_adc_chip_info = {
430         .enable_dma = 1,         /* use dma transfer with this chip*/
431         .bits_per_word = 16,
432 };
433 #endif
434
435 #if defined(CONFIG_SND_BLACKFIN_AD183X) \
436         || defined(CONFIG_SND_BLACKFIN_AD183X_MODULE)
437 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
438         .enable_dma = 0,
439         .bits_per_word = 16,
440 };
441 #endif
442
443 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
444 static struct bfin5xx_spi_chip  mmc_spi_chip_info = {
445         .enable_dma = 0,
446         .bits_per_word = 8,
447 };
448 #endif
449
450 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
451 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
452         .enable_dma = 0,
453         .bits_per_word = 16,
454 };
455
456 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
457         .model                  = 7877,
458         .vref_delay_usecs       = 50,   /* internal, no capacitor */
459         .x_plate_ohms           = 419,
460         .y_plate_ohms           = 486,
461         .pressure_max           = 1000,
462         .pressure_min           = 0,
463         .stopacq_polarity       = 1,
464         .first_conversion_delay = 3,
465         .acquisition_time       = 1,
466         .averaging              = 1,
467         .pen_down_acc_interval  = 1,
468 };
469 #endif
470
471 #if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
472 #include <linux/spi/ad7879.h>
473 static const struct ad7879_platform_data bfin_ad7879_ts_info = {
474         .model                  = 7879, /* Model = AD7879 */
475         .x_plate_ohms           = 620,  /* 620 Ohm from the touch datasheet */
476         .pressure_max           = 10000,
477         .pressure_min           = 0,
478         .first_conversion_delay = 3,    /* wait 512us before do a first conversion */
479         .acquisition_time       = 1,    /* 4us acquisition time per sample */
480         .median                 = 2,    /* do 8 measurements */
481         .averaging              = 1,    /* take the average of 4 middle samples */
482         .pen_down_acc_interval  = 255,  /* 9.4 ms */
483         .gpio_export            = 0,    /* Export GPIO to gpiolib */
484 };
485 #endif
486
487 #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
488 static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
489         .enable_dma = 0,
490         .bits_per_word = 16,
491 };
492 #endif
493
494 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
495 static struct bfin5xx_spi_chip spidev_chip_info = {
496         .enable_dma = 0,
497         .bits_per_word = 8,
498 };
499 #endif
500
501 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
502 static struct platform_device bfin_i2s = {
503         .name = "bfin-i2s",
504         .id = CONFIG_SND_BF5XX_SPORT_NUM,
505         /* TODO: add platform data here */
506 };
507 #endif
508
509 #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
510 static struct platform_device bfin_tdm = {
511         .name = "bfin-tdm",
512         .id = CONFIG_SND_BF5XX_SPORT_NUM,
513         /* TODO: add platform data here */
514 };
515 #endif
516
517 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
518 static struct bfin5xx_spi_chip lq035q1_spi_chip_info = {
519         .enable_dma     = 0,
520         .bits_per_word  = 8,
521 };
522 #endif
523
524 static struct spi_board_info bfin_spi_board_info[] __initdata = {
525 #if defined(CONFIG_MTD_M25P80) \
526         || defined(CONFIG_MTD_M25P80_MODULE)
527         {
528                 /* the modalias must be the same as spi device driver name */
529                 .modalias = "m25p80", /* Name of spi_driver for this device */
530                 .max_speed_hz = 25000000,     /* max spi clock (SCK) speed in HZ */
531                 .bus_num = 0, /* Framework bus number */
532                 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
533                 .platform_data = &bfin_spi_flash_data,
534                 .controller_data = &spi_flash_chip_info,
535                 .mode = SPI_MODE_3,
536         },
537 #endif
538
539 #if defined(CONFIG_BFIN_SPI_ADC) \
540         || defined(CONFIG_BFIN_SPI_ADC_MODULE)
541         {
542                 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
543                 .max_speed_hz = 6250000,     /* max spi clock (SCK) speed in HZ */
544                 .bus_num = 0, /* Framework bus number */
545                 .chip_select = 1, /* Framework chip select. */
546                 .platform_data = NULL, /* No spi_driver specific config */
547                 .controller_data = &spi_adc_chip_info,
548         },
549 #endif
550
551 #if defined(CONFIG_SND_BLACKFIN_AD183X) \
552         || defined(CONFIG_SND_BLACKFIN_AD183X_MODULE)
553         {
554                 .modalias = "ad1836",
555                 .max_speed_hz = 3125000,     /* max spi clock (SCK) speed in HZ */
556                 .bus_num = 0,
557                 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
558                 .controller_data = &ad1836_spi_chip_info,
559         },
560 #endif
561 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
562         {
563                 .modalias = "mmc_spi",
564                 .max_speed_hz = 20000000,     /* max spi clock (SCK) speed in HZ */
565                 .bus_num = 0,
566                 .chip_select = 3,
567                 .controller_data = &mmc_spi_chip_info,
568                 .mode = SPI_MODE_0,
569         },
570 #endif
571
572 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
573         {
574                 .modalias               = "ad7877",
575                 .platform_data          = &bfin_ad7877_ts_info,
576                 .irq                    = IRQ_PF8,
577                 .max_speed_hz   = 12500000,     /* max spi clock (SCK) speed in HZ */
578                 .bus_num        = 0,
579                 .chip_select  = 2,
580                 .controller_data = &spi_ad7877_chip_info,
581         },
582 #endif
583 #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
584         {
585                 .modalias = "ad7879",
586                 .platform_data = &bfin_ad7879_ts_info,
587                 .irq = IRQ_PF8,
588                 .max_speed_hz = 5000000,     /* max spi clock (SCK) speed in HZ */
589                 .bus_num = 0,
590                 .chip_select = 3,
591                 .controller_data = &spi_ad7879_chip_info,
592                 .mode = SPI_CPHA | SPI_CPOL,
593         },
594 #endif
595 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
596         {
597                 .modalias = "spidev",
598                 .max_speed_hz = 3125000,     /* max spi clock (SCK) speed in HZ */
599                 .bus_num = 0,
600                 .chip_select = 1,
601                 .controller_data = &spidev_chip_info,
602         },
603 #endif
604 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
605         {
606                 .modalias = "bfin-lq035q1-spi",
607                 .max_speed_hz = 20000000,     /* max spi clock (SCK) speed in HZ */
608                 .bus_num = 0,
609                 .chip_select = 7,
610                 .controller_data = &lq035q1_spi_chip_info,
611                 .mode = SPI_CPHA | SPI_CPOL,
612         },
613 #endif
614 };
615
616 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
617 /* SPI controller data */
618 static struct bfin5xx_spi_master bfin_spi0_info = {
619         .num_chipselect = 8,
620         .enable_dma = 1,  /* master has the ability to do dma transfer */
621         .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
622 };
623
624 /* SPI (0) */
625 static struct resource bfin_spi0_resource[] = {
626         [0] = {
627                 .start = SPI0_REGBASE,
628                 .end   = SPI0_REGBASE + 0xFF,
629                 .flags = IORESOURCE_MEM,
630                 },
631         [1] = {
632                 .start = CH_SPI,
633                 .end   = CH_SPI,
634                 .flags = IORESOURCE_DMA,
635         },
636         [2] = {
637                 .start = IRQ_SPI,
638                 .end   = IRQ_SPI,
639                 .flags = IORESOURCE_IRQ,
640         },
641 };
642
643 static struct platform_device bfin_spi0_device = {
644         .name = "bfin-spi",
645         .id = 0, /* Bus number */
646         .num_resources = ARRAY_SIZE(bfin_spi0_resource),
647         .resource = bfin_spi0_resource,
648         .dev = {
649                 .platform_data = &bfin_spi0_info, /* Passed to driver */
650         },
651 };
652 #endif  /* spi master and devices */
653
654 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
655 #ifdef CONFIG_SERIAL_BFIN_UART0
656 static struct resource bfin_uart0_resources[] = {
657         {
658                 .start = UART0_THR,
659                 .end = UART0_GCTL+2,
660                 .flags = IORESOURCE_MEM,
661         },
662         {
663                 .start = IRQ_UART0_RX,
664                 .end = IRQ_UART0_RX+1,
665                 .flags = IORESOURCE_IRQ,
666         },
667         {
668                 .start = IRQ_UART0_ERROR,
669                 .end = IRQ_UART0_ERROR,
670                 .flags = IORESOURCE_IRQ,
671         },
672         {
673                 .start = CH_UART0_TX,
674                 .end = CH_UART0_TX,
675                 .flags = IORESOURCE_DMA,
676         },
677         {
678                 .start = CH_UART0_RX,
679                 .end = CH_UART0_RX,
680                 .flags = IORESOURCE_DMA,
681         },
682 };
683
684 unsigned short bfin_uart0_peripherals[] = {
685         P_UART0_TX, P_UART0_RX, 0
686 };
687
688 static struct platform_device bfin_uart0_device = {
689         .name = "bfin-uart",
690         .id = 0,
691         .num_resources = ARRAY_SIZE(bfin_uart0_resources),
692         .resource = bfin_uart0_resources,
693         .dev = {
694                 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
695         },
696 };
697 #endif
698 #ifdef CONFIG_SERIAL_BFIN_UART1
699 static struct resource bfin_uart1_resources[] = {
700         {
701                 .start = UART1_THR,
702                 .end = UART1_GCTL+2,
703                 .flags = IORESOURCE_MEM,
704         },
705         {
706                 .start = IRQ_UART1_RX,
707                 .end = IRQ_UART1_RX+1,
708                 .flags = IORESOURCE_IRQ,
709         },
710         {
711                 .start = IRQ_UART1_ERROR,
712                 .end = IRQ_UART1_ERROR,
713                 .flags = IORESOURCE_IRQ,
714         },
715         {
716                 .start = CH_UART1_TX,
717                 .end = CH_UART1_TX,
718                 .flags = IORESOURCE_DMA,
719         },
720         {
721                 .start = CH_UART1_RX,
722                 .end = CH_UART1_RX,
723                 .flags = IORESOURCE_DMA,
724         },
725 #ifdef CONFIG_BFIN_UART1_CTSRTS
726         {       /* CTS pin */
727                 .start = GPIO_PF9,
728                 .end = GPIO_PF9,
729                 .flags = IORESOURCE_IO,
730         },
731         {       /* RTS pin */
732                 .start = GPIO_PF10,
733                 .end = GPIO_PF10,
734                 .flags = IORESOURCE_IO,
735         },
736 #endif
737 };
738
739 unsigned short bfin_uart1_peripherals[] = {
740         P_UART1_TX, P_UART1_RX, 0
741 };
742
743 static struct platform_device bfin_uart1_device = {
744         .name = "bfin-uart",
745         .id = 1,
746         .num_resources = ARRAY_SIZE(bfin_uart1_resources),
747         .resource = bfin_uart1_resources,
748         .dev = {
749                 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
750         },
751 };
752 #endif
753 #endif
754
755 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
756 #ifdef CONFIG_BFIN_SIR0
757 static struct resource bfin_sir0_resources[] = {
758         {
759                 .start = 0xFFC00400,
760                 .end = 0xFFC004FF,
761                 .flags = IORESOURCE_MEM,
762         },
763         {
764                 .start = IRQ_UART0_RX,
765                 .end = IRQ_UART0_RX+1,
766                 .flags = IORESOURCE_IRQ,
767         },
768         {
769                 .start = CH_UART0_RX,
770                 .end = CH_UART0_RX+1,
771                 .flags = IORESOURCE_DMA,
772         },
773 };
774
775 static struct platform_device bfin_sir0_device = {
776         .name = "bfin_sir",
777         .id = 0,
778         .num_resources = ARRAY_SIZE(bfin_sir0_resources),
779         .resource = bfin_sir0_resources,
780 };
781 #endif
782 #ifdef CONFIG_BFIN_SIR1
783 static struct resource bfin_sir1_resources[] = {
784         {
785                 .start = 0xFFC02000,
786                 .end = 0xFFC020FF,
787                 .flags = IORESOURCE_MEM,
788         },
789         {
790                 .start = IRQ_UART1_RX,
791                 .end = IRQ_UART1_RX+1,
792                 .flags = IORESOURCE_IRQ,
793         },
794         {
795                 .start = CH_UART1_RX,
796                 .end = CH_UART1_RX+1,
797                 .flags = IORESOURCE_DMA,
798         },
799 };
800
801 static struct platform_device bfin_sir1_device = {
802         .name = "bfin_sir",
803         .id = 1,
804         .num_resources = ARRAY_SIZE(bfin_sir1_resources),
805         .resource = bfin_sir1_resources,
806 };
807 #endif
808 #endif
809
810 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
811 static struct resource bfin_twi0_resource[] = {
812         [0] = {
813                 .start = TWI0_REGBASE,
814                 .end   = TWI0_REGBASE,
815                 .flags = IORESOURCE_MEM,
816         },
817         [1] = {
818                 .start = IRQ_TWI,
819                 .end   = IRQ_TWI,
820                 .flags = IORESOURCE_IRQ,
821         },
822 };
823
824 static struct platform_device i2c_bfin_twi_device = {
825         .name = "i2c-bfin-twi",
826         .id = 0,
827         .num_resources = ARRAY_SIZE(bfin_twi0_resource),
828         .resource = bfin_twi0_resource,
829 };
830 #endif
831
832 #if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
833 #include <linux/mfd/adp5520.h>
834
835         /*
836          *  ADP5520/5501 LEDs Data
837          */
838
839 static struct led_info adp5520_leds[] = {
840         {
841                 .name = "adp5520-led1",
842                 .default_trigger = "none",
843                 .flags = FLAG_ID_ADP5520_LED1_ADP5501_LED0 | ADP5520_LED_OFFT_600ms,
844         },
845 };
846
847 static struct adp5520_leds_platform_data adp5520_leds_data = {
848         .num_leds = ARRAY_SIZE(adp5520_leds),
849         .leds = adp5520_leds,
850         .fade_in = ADP5520_FADE_T_600ms,
851         .fade_out = ADP5520_FADE_T_600ms,
852         .led_on_time = ADP5520_LED_ONT_600ms,
853 };
854
855         /*
856          *  ADP5520 Keypad Data
857          */
858
859 static const unsigned short adp5520_keymap[ADP5520_KEYMAPSIZE] = {
860         [ADP5520_KEY(3, 3)]     = KEY_1,
861         [ADP5520_KEY(2, 3)]     = KEY_2,
862         [ADP5520_KEY(1, 3)]     = KEY_3,
863         [ADP5520_KEY(0, 3)]     = KEY_UP,
864         [ADP5520_KEY(3, 2)]     = KEY_4,
865         [ADP5520_KEY(2, 2)]     = KEY_5,
866         [ADP5520_KEY(1, 2)]     = KEY_6,
867         [ADP5520_KEY(0, 2)]     = KEY_DOWN,
868         [ADP5520_KEY(3, 1)]     = KEY_7,
869         [ADP5520_KEY(2, 1)]     = KEY_8,
870         [ADP5520_KEY(1, 1)]     = KEY_9,
871         [ADP5520_KEY(0, 1)]     = KEY_DOT,
872         [ADP5520_KEY(3, 0)]     = KEY_BACKSPACE,
873         [ADP5520_KEY(2, 0)]     = KEY_0,
874         [ADP5520_KEY(1, 0)]     = KEY_HELP,
875         [ADP5520_KEY(0, 0)]     = KEY_ENTER,
876 };
877
878 static struct adp5520_keys_platform_data adp5520_keys_data = {
879         .rows_en_mask   = ADP5520_ROW_R3 | ADP5520_ROW_R2 | ADP5520_ROW_R1 | ADP5520_ROW_R0,
880         .cols_en_mask   = ADP5520_COL_C3 | ADP5520_COL_C2 | ADP5520_COL_C1 | ADP5520_COL_C0,
881         .keymap         = adp5520_keymap,
882         .keymapsize     = ARRAY_SIZE(adp5520_keymap),
883         .repeat         = 0,
884 };
885
886         /*
887          *  ADP5520/5501 Multifuction Device Init Data
888          */
889
890 static struct adp5520_platform_data adp5520_pdev_data = {
891         .leds = &adp5520_leds_data,
892         .keys = &adp5520_keys_data,
893 };
894
895 #endif
896
897 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
898 #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
899         {
900                 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
901         },
902 #endif
903 #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
904         {
905                 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
906                 .irq = IRQ_PF8,
907         },
908 #endif
909 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
910         {
911                 I2C_BOARD_INFO("bfin-adv7393", 0x2B),
912         },
913 #endif
914 #if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) || defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)
915         {
916                 I2C_BOARD_INFO("ad7879", 0x2C),
917                 .irq = IRQ_PF8,
918                 .platform_data = (void *)&bfin_ad7879_ts_info,
919         },
920 #endif
921 #if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
922         {
923                 I2C_BOARD_INFO("pmic-adp5520", 0x32),
924                 .irq = IRQ_PF9,
925                 .platform_data = (void *)&adp5520_pdev_data,
926         },
927 #endif
928 #if defined(CONFIG_SND_SOC_SSM2602) || defined(CONFIG_SND_SOC_SSM2602_MODULE)
929         {
930                 I2C_BOARD_INFO("ssm2602", 0x1b),
931         },
932 #endif
933 };
934
935 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
936 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
937 static struct resource bfin_sport0_uart_resources[] = {
938         {
939                 .start = SPORT0_TCR1,
940                 .end = SPORT0_MRCS3+4,
941                 .flags = IORESOURCE_MEM,
942         },
943         {
944                 .start = IRQ_SPORT0_RX,
945                 .end = IRQ_SPORT0_RX+1,
946                 .flags = IORESOURCE_IRQ,
947         },
948         {
949                 .start = IRQ_SPORT0_ERROR,
950                 .end = IRQ_SPORT0_ERROR,
951                 .flags = IORESOURCE_IRQ,
952         },
953 };
954
955 unsigned short bfin_sport0_peripherals[] = {
956         P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
957         P_SPORT0_DRPRI, P_SPORT0_RSCLK, P_SPORT0_DRSEC, P_SPORT0_DTSEC, 0
958 };
959
960 static struct platform_device bfin_sport0_uart_device = {
961         .name = "bfin-sport-uart",
962         .id = 0,
963         .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
964         .resource = bfin_sport0_uart_resources,
965         .dev = {
966                 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
967         },
968 };
969 #endif
970 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
971 static struct resource bfin_sport1_uart_resources[] = {
972         {
973                 .start = SPORT1_TCR1,
974                 .end = SPORT1_MRCS3+4,
975                 .flags = IORESOURCE_MEM,
976         },
977         {
978                 .start = IRQ_SPORT1_RX,
979                 .end = IRQ_SPORT1_RX+1,
980                 .flags = IORESOURCE_IRQ,
981         },
982         {
983                 .start = IRQ_SPORT1_ERROR,
984                 .end = IRQ_SPORT1_ERROR,
985                 .flags = IORESOURCE_IRQ,
986         },
987 };
988
989 unsigned short bfin_sport1_peripherals[] = {
990         P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
991         P_SPORT1_DRPRI, P_SPORT1_RSCLK, P_SPORT1_DRSEC, P_SPORT1_DTSEC, 0
992 };
993
994 static struct platform_device bfin_sport1_uart_device = {
995         .name = "bfin-sport-uart",
996         .id = 1,
997         .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
998         .resource = bfin_sport1_uart_resources,
999         .dev = {
1000                 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
1001         },
1002 };
1003 #endif
1004 #endif
1005
1006 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1007 #include <linux/gpio_keys.h>
1008
1009 static struct gpio_keys_button bfin_gpio_keys_table[] = {
1010         {BTN_0, GPIO_PG0, 1, "gpio-keys: BTN0"},
1011         {BTN_1, GPIO_PG13, 1, "gpio-keys: BTN1"},
1012 };
1013
1014 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
1015         .buttons        = bfin_gpio_keys_table,
1016         .nbuttons       = ARRAY_SIZE(bfin_gpio_keys_table),
1017 };
1018
1019 static struct platform_device bfin_device_gpiokeys = {
1020         .name      = "gpio-keys",
1021         .dev = {
1022                 .platform_data = &bfin_gpio_keys_data,
1023         },
1024 };
1025 #endif
1026
1027 #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
1028 #include <asm/bfin_rotary.h>
1029
1030 static struct bfin_rotary_platform_data bfin_rotary_data = {
1031         /*.rotary_up_key     = KEY_UP,*/
1032         /*.rotary_down_key   = KEY_DOWN,*/
1033         .rotary_rel_code   = REL_WHEEL,
1034         .rotary_button_key = KEY_ENTER,
1035         .debounce          = 10,        /* 0..17 */
1036         .mode              = ROT_QUAD_ENC | ROT_DEBE,
1037 };
1038
1039 static struct resource bfin_rotary_resources[] = {
1040         {
1041                 .start = IRQ_CNT,
1042                 .end = IRQ_CNT,
1043                 .flags = IORESOURCE_IRQ,
1044         },
1045 };
1046
1047 static struct platform_device bfin_rotary_device = {
1048         .name           = "bfin-rotary",
1049         .id             = -1,
1050         .num_resources  = ARRAY_SIZE(bfin_rotary_resources),
1051         .resource       = bfin_rotary_resources,
1052         .dev            = {
1053                 .platform_data = &bfin_rotary_data,
1054         },
1055 };
1056 #endif
1057
1058 static const unsigned int cclk_vlev_datasheet[] =
1059 {
1060         VRPAIR(VLEV_100, 400000000),
1061         VRPAIR(VLEV_105, 426000000),
1062         VRPAIR(VLEV_110, 500000000),
1063         VRPAIR(VLEV_115, 533000000),
1064         VRPAIR(VLEV_120, 600000000),
1065 };
1066
1067 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
1068         .tuple_tab = cclk_vlev_datasheet,
1069         .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
1070         .vr_settling_time = 25 /* us */,
1071 };
1072
1073 static struct platform_device bfin_dpmc = {
1074         .name = "bfin dpmc",
1075         .dev = {
1076                 .platform_data = &bfin_dmpc_vreg_data,
1077         },
1078 };
1079
1080 static struct platform_device *stamp_devices[] __initdata = {
1081
1082         &bfin_dpmc,
1083
1084 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
1085         &bf5xx_nand_device,
1086 #endif
1087
1088 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
1089         &bfin_pcmcia_cf_device,
1090 #endif
1091
1092 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
1093         &rtc_device,
1094 #endif
1095
1096 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
1097         &bfin_isp1760_device,
1098 #endif
1099
1100 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
1101         &musb_device,
1102 #endif
1103
1104 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
1105         &smc91x_device,
1106 #endif
1107
1108 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
1109         &dm9000_device,
1110 #endif
1111
1112 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
1113         &bfin_mii_bus,
1114         &bfin_mac_device,
1115 #endif
1116
1117 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
1118         &net2272_bfin_device,
1119 #endif
1120
1121 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1122         &bfin_spi0_device,
1123 #endif
1124
1125 #if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
1126         &bf52x_t350mcqb_device,
1127 #endif
1128
1129 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
1130         &bfin_lq035q1_device,
1131 #endif
1132
1133 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1134 #ifdef CONFIG_SERIAL_BFIN_UART0
1135         &bfin_uart0_device,
1136 #endif
1137 #ifdef CONFIG_SERIAL_BFIN_UART1
1138         &bfin_uart1_device,
1139 #endif
1140 #endif
1141
1142 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
1143 #ifdef CONFIG_BFIN_SIR0
1144         &bfin_sir0_device,
1145 #endif
1146 #ifdef CONFIG_BFIN_SIR1
1147         &bfin_sir1_device,
1148 #endif
1149 #endif
1150
1151 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1152         &i2c_bfin_twi_device,
1153 #endif
1154
1155 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1156 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1157         &bfin_sport0_uart_device,
1158 #endif
1159 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1160         &bfin_sport1_uart_device,
1161 #endif
1162 #endif
1163
1164 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1165         &bfin_device_gpiokeys,
1166 #endif
1167
1168 #if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
1169         &bfin_rotary_device,
1170 #endif
1171
1172 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
1173         &ezkit_flash_device,
1174 #endif
1175
1176 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
1177         &bfin_i2s,
1178 #endif
1179
1180 #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
1181         &bfin_tdm,
1182 #endif
1183 };
1184
1185 static int __init ezkit_init(void)
1186 {
1187         printk(KERN_INFO "%s(): registering device resources\n", __func__);
1188         i2c_register_board_info(0, bfin_i2c_board_info,
1189                                 ARRAY_SIZE(bfin_i2c_board_info));
1190         platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
1191         spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
1192         return 0;
1193 }
1194
1195 arch_initcall(ezkit_init);
1196
1197 static struct platform_device *ezkit_early_devices[] __initdata = {
1198 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
1199 #ifdef CONFIG_SERIAL_BFIN_UART0
1200         &bfin_uart0_device,
1201 #endif
1202 #ifdef CONFIG_SERIAL_BFIN_UART1
1203         &bfin_uart1_device,
1204 #endif
1205 #endif
1206
1207 #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
1208 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1209         &bfin_sport0_uart_device,
1210 #endif
1211 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1212         &bfin_sport1_uart_device,
1213 #endif
1214 #endif
1215 };
1216
1217 void __init native_machine_early_platform_add_devices(void)
1218 {
1219         printk(KERN_INFO "register early platform devices\n");
1220         early_platform_add_devices(ezkit_early_devices,
1221                 ARRAY_SIZE(ezkit_early_devices));
1222 }
1223
1224 void native_machine_restart(char *cmd)
1225 {
1226         /* workaround reboot hang when booting from SPI */
1227         if ((bfin_read_SYSCR() & 0x7) == 0x3)
1228                 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
1229 }
1230
1231 void bfin_get_ether_addr(char *addr)
1232 {
1233         /* the MAC is stored in OTP memory page 0xDF */
1234         u32 ret;
1235         u64 otp_mac;
1236         u32 (*otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)0xEF00001A;
1237
1238         ret = otp_read(0xDF, 0x00, &otp_mac);
1239         if (!(ret & 0x1)) {
1240                 char *otp_mac_p = (char *)&otp_mac;
1241                 for (ret = 0; ret < 6; ++ret)
1242                         addr[ret] = otp_mac_p[5 - ret];
1243         }
1244 }
1245 EXPORT_SYMBOL(bfin_get_ether_addr);