blob: f09665f74ba03053d79b53901a9b7249ad4142f3 [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>
16#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
Mike Frysingerf02bcec2007-11-15 21:29:15 +080017#include <linux/usb/isp1362.h>
Michael Hennerich59003142007-10-21 16:54:27 +080018#endif
Bryan Wu72268682008-05-07 11:41:26 +080019#include <linux/i2c.h>
Michael Hennerich59003142007-10-21 16:54:27 +080020#include <linux/irq.h>
21#include <linux/interrupt.h>
Mike Frysinger632f6582007-11-15 21:25:47 +080022#include <linux/usb/sl811.h>
Michael Hennerich1089e222007-12-24 11:49:29 +080023#include <linux/usb/musb.h>
Michael Hennerich59003142007-10-21 16:54:27 +080024#include <asm/dma.h>
25#include <asm/bfin5xx_spi.h>
26#include <asm/reboot.h>
Michael Hennerich64307f72007-10-29 16:55:18 +080027#include <asm/nand.h>
Bryan Wu5d448dd2007-11-12 23:24:42 +080028#include <asm/portmux.h>
Michael Hennerich14b03202008-05-07 11:41:26 +080029#include <asm/dpmc.h>
Michael Hennerich59003142007-10-21 16:54:27 +080030#include <linux/spi/ad7877.h>
31
32/*
33 * Name the Board for the /proc/cpuinfo
34 */
Mike Frysingerfe85cad2008-11-18 17:48:22 +080035const char bfin_board_name[] = "ADI BF527-EZKIT";
Michael Hennerich59003142007-10-21 16:54:27 +080036
37/*
38 * Driver needs to know address, irq and flag pin.
39 */
40
Michael Hennerich59003142007-10-21 16:54:27 +080041#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
Michael Hennerich3f375692008-11-18 17:48:22 +080042#include <linux/usb/isp1760.h>
43static struct resource bfin_isp1760_resources[] = {
Michael Hennerich59003142007-10-21 16:54:27 +080044 [0] = {
Michael Hennerich3f375692008-11-18 17:48:22 +080045 .start = 0x203C0000,
46 .end = 0x203C0000 + 0x000fffff,
Michael Hennerich59003142007-10-21 16:54:27 +080047 .flags = IORESOURCE_MEM,
48 },
49 [1] = {
Michael Hennerich3f375692008-11-18 17:48:22 +080050 .start = IRQ_PF7,
51 .end = IRQ_PF7,
Michael Hennerich59003142007-10-21 16:54:27 +080052 .flags = IORESOURCE_IRQ,
53 },
54};
55
Michael Hennerich3f375692008-11-18 17:48:22 +080056static struct isp1760_platform_data isp1760_priv = {
57 .is_isp1761 = 0,
Michael Hennerich3f375692008-11-18 17:48:22 +080058 .bus_width_16 = 1,
59 .port1_otg = 0,
60 .analog_oc = 0,
61 .dack_polarity_high = 0,
62 .dreq_polarity_high = 0,
63};
64
65static struct platform_device bfin_isp1760_device = {
66 .name = "isp1760-hcd",
Michael Hennerich59003142007-10-21 16:54:27 +080067 .id = 0,
Michael Hennerich3f375692008-11-18 17:48:22 +080068 .dev = {
69 .platform_data = &isp1760_priv,
70 },
71 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
72 .resource = bfin_isp1760_resources,
Michael Hennerich59003142007-10-21 16:54:27 +080073};
Michael Hennerich59003142007-10-21 16:54:27 +080074#endif
75
Michael Hennerich1089e222007-12-24 11:49:29 +080076#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
77static struct resource musb_resources[] = {
78 [0] = {
79 .start = 0xffc03800,
80 .end = 0xffc03cff,
81 .flags = IORESOURCE_MEM,
82 },
83 [1] = { /* general IRQ */
84 .start = IRQ_USB_INT0,
85 .end = IRQ_USB_INT0,
86 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
87 },
88 [2] = { /* DMA IRQ */
89 .start = IRQ_USB_DMA,
90 .end = IRQ_USB_DMA,
91 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
92 },
93};
94
Bryan Wu50041ac2008-10-08 13:39:40 +080095static struct musb_hdrc_config musb_config = {
96 .multipoint = 0,
97 .dyn_fifo = 0,
98 .soft_con = 1,
99 .dma = 1,
Bryan Wufea05da2009-01-07 23:14:39 +0800100 .num_eps = 8,
101 .dma_channels = 8,
Bryan Wu50041ac2008-10-08 13:39:40 +0800102 .gpio_vrsel = GPIO_PG13,
103};
104
Michael Hennerich1089e222007-12-24 11:49:29 +0800105static struct musb_hdrc_platform_data musb_plat = {
106#if defined(CONFIG_USB_MUSB_OTG)
107 .mode = MUSB_OTG,
108#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
109 .mode = MUSB_HOST,
110#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
111 .mode = MUSB_PERIPHERAL,
112#endif
Bryan Wu50041ac2008-10-08 13:39:40 +0800113 .config = &musb_config,
Michael Hennerich1089e222007-12-24 11:49:29 +0800114};
115
116static u64 musb_dmamask = ~(u32)0;
117
118static struct platform_device musb_device = {
119 .name = "musb_hdrc",
120 .id = 0,
121 .dev = {
122 .dma_mask = &musb_dmamask,
123 .coherent_dma_mask = 0xffffffff,
124 .platform_data = &musb_plat,
125 },
126 .num_resources = ARRAY_SIZE(musb_resources),
127 .resource = musb_resources,
128};
129#endif
130
131#if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
132
133static struct resource bf52x_t350mcqb_resources[] = {
134 {
135 .start = IRQ_PPI_ERROR,
136 .end = IRQ_PPI_ERROR,
137 .flags = IORESOURCE_IRQ,
138 },
139};
140
141static struct platform_device bf52x_t350mcqb_device = {
142 .name = "bfin-t350mcqb",
143 .id = -1,
144 .num_resources = ARRAY_SIZE(bf52x_t350mcqb_resources),
145 .resource = bf52x_t350mcqb_resources,
146};
147#endif
148
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800149#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
150static struct mtd_partition ezkit_partitions[] = {
151 {
Robin Getzaa582972008-08-05 17:47:29 +0800152 .name = "bootloader(nor)",
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800153 .size = 0x40000,
154 .offset = 0,
155 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800156 .name = "linux kernel(nor)",
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800157 .size = 0x1C0000,
158 .offset = MTDPART_OFS_APPEND,
159 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800160 .name = "file system(nor)",
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800161 .size = MTDPART_SIZ_FULL,
162 .offset = MTDPART_OFS_APPEND,
163 }
164};
165
166static struct physmap_flash_data ezkit_flash_data = {
167 .width = 2,
168 .parts = ezkit_partitions,
169 .nr_parts = ARRAY_SIZE(ezkit_partitions),
170};
171
172static struct resource ezkit_flash_resource = {
173 .start = 0x20000000,
174 .end = 0x203fffff,
175 .flags = IORESOURCE_MEM,
176};
177
178static struct platform_device ezkit_flash_device = {
179 .name = "physmap-flash",
180 .id = 0,
181 .dev = {
182 .platform_data = &ezkit_flash_data,
183 },
184 .num_resources = 1,
185 .resource = &ezkit_flash_resource,
186};
187#endif
188
Michael Hennerich64307f72007-10-29 16:55:18 +0800189#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
190static struct mtd_partition partition_info[] = {
191 {
Robin Getzaa582972008-08-05 17:47:29 +0800192 .name = "linux kernel(nand)",
Michael Hennerich64307f72007-10-29 16:55:18 +0800193 .offset = 0,
Mike Frysingerf4585a02008-10-13 14:45:21 +0800194 .size = 4 * 1024 * 1024,
Michael Hennerich64307f72007-10-29 16:55:18 +0800195 },
196 {
Robin Getzaa582972008-08-05 17:47:29 +0800197 .name = "file system(nand)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800198 .offset = MTDPART_OFS_APPEND,
199 .size = MTDPART_SIZ_FULL,
Michael Hennerich64307f72007-10-29 16:55:18 +0800200 },
201};
202
203static struct bf5xx_nand_platform bf5xx_nand_platform = {
204 .page_size = NFC_PG_SIZE_256,
205 .data_width = NFC_NWIDTH_8,
206 .partitions = partition_info,
207 .nr_partitions = ARRAY_SIZE(partition_info),
208 .rd_dly = 3,
209 .wr_dly = 3,
210};
211
212static struct resource bf5xx_nand_resources[] = {
213 {
214 .start = NFC_CTL,
215 .end = NFC_DATA_RD + 2,
216 .flags = IORESOURCE_MEM,
217 },
218 {
219 .start = CH_NFC,
220 .end = CH_NFC,
221 .flags = IORESOURCE_IRQ,
222 },
223};
224
225static struct platform_device bf5xx_nand_device = {
226 .name = "bf5xx-nand",
227 .id = 0,
228 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
229 .resource = bf5xx_nand_resources,
230 .dev = {
231 .platform_data = &bf5xx_nand_platform,
232 },
233};
234#endif
235
Michael Hennerich59003142007-10-21 16:54:27 +0800236#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
237static struct resource bfin_pcmcia_cf_resources[] = {
238 {
239 .start = 0x20310000, /* IO PORT */
240 .end = 0x20312000,
241 .flags = IORESOURCE_MEM,
242 }, {
243 .start = 0x20311000, /* Attribute Memory */
244 .end = 0x20311FFF,
245 .flags = IORESOURCE_MEM,
246 }, {
247 .start = IRQ_PF4,
248 .end = IRQ_PF4,
249 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
250 }, {
251 .start = 6, /* Card Detect PF6 */
252 .end = 6,
253 .flags = IORESOURCE_IRQ,
254 },
255};
256
257static struct platform_device bfin_pcmcia_cf_device = {
258 .name = "bfin_cf_pcmcia",
259 .id = -1,
260 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
261 .resource = bfin_pcmcia_cf_resources,
262};
263#endif
264
265#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
266static struct platform_device rtc_device = {
267 .name = "rtc-bfin",
268 .id = -1,
269};
270#endif
271
272#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
Michael Hennerich61f09b52009-07-24 08:48:31 +0000273#include <linux/smc91x.h>
274
275static struct smc91x_platdata smc91x_info = {
276 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
277 .leda = RPC_LED_100_10,
278 .ledb = RPC_LED_TX_RX,
279};
280
Michael Hennerich59003142007-10-21 16:54:27 +0800281static struct resource smc91x_resources[] = {
282 {
283 .name = "smc91x-regs",
284 .start = 0x20300300,
285 .end = 0x20300300 + 16,
286 .flags = IORESOURCE_MEM,
287 }, {
288
289 .start = IRQ_PF7,
290 .end = IRQ_PF7,
291 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
292 },
293};
294static struct platform_device smc91x_device = {
295 .name = "smc91x",
296 .id = 0,
297 .num_resources = ARRAY_SIZE(smc91x_resources),
298 .resource = smc91x_resources,
Michael Hennerich61f09b52009-07-24 08:48:31 +0000299 .dev = {
300 .platform_data = &smc91x_info,
301 },
Michael Hennerich59003142007-10-21 16:54:27 +0800302};
303#endif
304
305#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
306static struct resource dm9000_resources[] = {
307 [0] = {
308 .start = 0x203FB800,
Laurent Pinchartda3854f2008-06-24 22:15:58 +0100309 .end = 0x203FB800 + 1,
Michael Hennerich59003142007-10-21 16:54:27 +0800310 .flags = IORESOURCE_MEM,
311 },
312 [1] = {
Laurent Pinchartda3854f2008-06-24 22:15:58 +0100313 .start = 0x203FB800 + 4,
314 .end = 0x203FB800 + 5,
315 .flags = IORESOURCE_MEM,
316 },
317 [2] = {
Michael Hennerich59003142007-10-21 16:54:27 +0800318 .start = IRQ_PF9,
319 .end = IRQ_PF9,
320 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
321 },
322};
323
324static struct platform_device dm9000_device = {
325 .name = "dm9000",
326 .id = -1,
327 .num_resources = ARRAY_SIZE(dm9000_resources),
328 .resource = dm9000_resources,
329};
330#endif
331
332#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
333static struct resource sl811_hcd_resources[] = {
334 {
335 .start = 0x20340000,
336 .end = 0x20340000,
337 .flags = IORESOURCE_MEM,
338 }, {
339 .start = 0x20340004,
340 .end = 0x20340004,
341 .flags = IORESOURCE_MEM,
342 }, {
343 .start = CONFIG_USB_SL811_BFIN_IRQ,
344 .end = CONFIG_USB_SL811_BFIN_IRQ,
345 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
346 },
347};
348
349#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
350void sl811_port_power(struct device *dev, int is_on)
351{
352 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
Michael Hennerichacbcd262008-01-22 18:36:20 +0800353 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
Michael Hennerich59003142007-10-21 16:54:27 +0800354}
355#endif
356
357static struct sl811_platform_data sl811_priv = {
358 .potpg = 10,
359 .power = 250, /* == 500mA */
360#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
361 .port_power = &sl811_port_power,
362#endif
363};
364
365static struct platform_device sl811_hcd_device = {
366 .name = "sl811-hcd",
367 .id = 0,
368 .dev = {
369 .platform_data = &sl811_priv,
370 },
371 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
372 .resource = sl811_hcd_resources,
373};
374#endif
375
376#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
377static struct resource isp1362_hcd_resources[] = {
378 {
379 .start = 0x20360000,
380 .end = 0x20360000,
381 .flags = IORESOURCE_MEM,
382 }, {
383 .start = 0x20360004,
384 .end = 0x20360004,
385 .flags = IORESOURCE_MEM,
386 }, {
387 .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
388 .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
389 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
390 },
391};
392
393static struct isp1362_platform_data isp1362_priv = {
394 .sel15Kres = 1,
395 .clknotstop = 0,
396 .oc_enable = 0,
397 .int_act_high = 0,
398 .int_edge_triggered = 0,
399 .remote_wakeup_connected = 0,
400 .no_power_switching = 1,
401 .power_switching_mode = 0,
402};
403
404static struct platform_device isp1362_hcd_device = {
405 .name = "isp1362-hcd",
406 .id = 0,
407 .dev = {
408 .platform_data = &isp1362_priv,
409 },
410 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
411 .resource = isp1362_hcd_resources,
412};
413#endif
414
415#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
Graf Yang65319622009-02-04 16:49:45 +0800416static struct platform_device bfin_mii_bus = {
417 .name = "bfin_mii_bus",
418};
419
Michael Hennerich59003142007-10-21 16:54:27 +0800420static struct platform_device bfin_mac_device = {
421 .name = "bfin_mac",
Graf Yang65319622009-02-04 16:49:45 +0800422 .dev.platform_data = &bfin_mii_bus,
Michael Hennerich59003142007-10-21 16:54:27 +0800423};
424#endif
425
426#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
427static struct resource net2272_bfin_resources[] = {
428 {
429 .start = 0x20300000,
430 .end = 0x20300000 + 0x100,
431 .flags = IORESOURCE_MEM,
432 }, {
433 .start = IRQ_PF7,
434 .end = IRQ_PF7,
435 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
436 },
437};
438
439static struct platform_device net2272_bfin_device = {
440 .name = "net2272",
441 .id = -1,
442 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
443 .resource = net2272_bfin_resources,
444};
445#endif
446
Michael Hennerich59003142007-10-21 16:54:27 +0800447#if defined(CONFIG_MTD_M25P80) \
448 || defined(CONFIG_MTD_M25P80_MODULE)
449static struct mtd_partition bfin_spi_flash_partitions[] = {
450 {
Robin Getzaa582972008-08-05 17:47:29 +0800451 .name = "bootloader(spi)",
Grace Panac76d882008-04-24 06:33:56 +0800452 .size = 0x00040000,
Michael Hennerich59003142007-10-21 16:54:27 +0800453 .offset = 0,
454 .mask_flags = MTD_CAP_ROM
455 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800456 .name = "linux kernel(spi)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800457 .size = MTDPART_SIZ_FULL,
458 .offset = MTDPART_OFS_APPEND,
Michael Hennerich59003142007-10-21 16:54:27 +0800459 }
460};
461
462static struct flash_platform_data bfin_spi_flash_data = {
463 .name = "m25p80",
464 .parts = bfin_spi_flash_partitions,
465 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
Michael Hennerichb9c9e782008-05-07 11:41:26 +0800466 .type = "m25p16",
Michael Hennerich59003142007-10-21 16:54:27 +0800467};
468
469/* SPI flash chip (m25p64) */
470static struct bfin5xx_spi_chip spi_flash_chip_info = {
471 .enable_dma = 0, /* use dma transfer with this chip*/
472 .bits_per_word = 8,
473};
474#endif
475
Mike Frysingera261eec2009-05-20 14:05:36 +0000476#if defined(CONFIG_BFIN_SPI_ADC) \
477 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800478/* SPI ADC chip */
479static struct bfin5xx_spi_chip spi_adc_chip_info = {
480 .enable_dma = 1, /* use dma transfer with this chip*/
481 .bits_per_word = 16,
482};
483#endif
484
485#if defined(CONFIG_SND_BLACKFIN_AD1836) \
486 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
487static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
488 .enable_dma = 0,
489 .bits_per_word = 16,
490};
491#endif
492
Yi Liffdf3ec2009-03-31 10:36:51 +0000493#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
494static struct bfin5xx_spi_chip mmc_spi_chip_info = {
495 .enable_dma = 0,
496 .bits_per_word = 8,
497};
498#endif
499
Michael Hennerich59003142007-10-21 16:54:27 +0800500#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
501static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
502 .enable_dma = 0,
503 .bits_per_word = 16,
504};
505
506static const struct ad7877_platform_data bfin_ad7877_ts_info = {
507 .model = 7877,
508 .vref_delay_usecs = 50, /* internal, no capacitor */
509 .x_plate_ohms = 419,
510 .y_plate_ohms = 486,
511 .pressure_max = 1000,
512 .pressure_min = 0,
513 .stopacq_polarity = 1,
514 .first_conversion_delay = 3,
515 .acquisition_time = 1,
516 .averaging = 1,
517 .pen_down_acc_interval = 1,
518};
519#endif
520
Michael Hennerich51054322009-01-07 23:14:38 +0800521#if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
522#include <linux/spi/ad7879.h>
523static const struct ad7879_platform_data bfin_ad7879_ts_info = {
524 .model = 7879, /* Model = AD7879 */
525 .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
526 .pressure_max = 10000,
527 .pressure_min = 0,
528 .first_conversion_delay = 3, /* wait 512us before do a first conversion */
529 .acquisition_time = 1, /* 4us acquisition time per sample */
530 .median = 2, /* do 8 measurements */
531 .averaging = 1, /* take the average of 4 middle samples */
532 .pen_down_acc_interval = 255, /* 9.4 ms */
533 .gpio_output = 1, /* configure AUX/VBAT/GPIO as GPIO output */
534 .gpio_default = 1, /* During initialization set GPIO = HIGH */
535};
536#endif
537
538#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
539static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
540 .enable_dma = 0,
541 .bits_per_word = 16,
542};
543#endif
544
Michael Hennerichc7d48962007-11-15 21:33:31 +0800545#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
Michael Hennerich0954f702007-11-13 00:16:19 +0800546 && defined(CONFIG_SND_SOC_WM8731_SPI)
547static struct bfin5xx_spi_chip spi_wm8731_chip_info = {
548 .enable_dma = 0,
549 .bits_per_word = 16,
550};
551#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800552
553#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
554static struct bfin5xx_spi_chip spidev_chip_info = {
555 .enable_dma = 0,
556 .bits_per_word = 8,
557};
558#endif
559
Michael Hennerich59003142007-10-21 16:54:27 +0800560static struct spi_board_info bfin_spi_board_info[] __initdata = {
561#if defined(CONFIG_MTD_M25P80) \
562 || defined(CONFIG_MTD_M25P80_MODULE)
563 {
564 /* the modalias must be the same as spi device driver name */
565 .modalias = "m25p80", /* Name of spi_driver for this device */
566 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
567 .bus_num = 0, /* Framework bus number */
568 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
569 .platform_data = &bfin_spi_flash_data,
570 .controller_data = &spi_flash_chip_info,
571 .mode = SPI_MODE_3,
572 },
573#endif
574
Mike Frysingera261eec2009-05-20 14:05:36 +0000575#if defined(CONFIG_BFIN_SPI_ADC) \
576 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800577 {
578 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
579 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
580 .bus_num = 0, /* Framework bus number */
581 .chip_select = 1, /* Framework chip select. */
582 .platform_data = NULL, /* No spi_driver specific config */
583 .controller_data = &spi_adc_chip_info,
584 },
585#endif
586
587#if defined(CONFIG_SND_BLACKFIN_AD1836) \
588 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
589 {
Barry Songdac98172009-08-13 21:07:37 +0000590 .modalias = "ad1836",
Michael Hennerich59003142007-10-21 16:54:27 +0800591 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
592 .bus_num = 0,
593 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
594 .controller_data = &ad1836_spi_chip_info,
595 },
596#endif
Yi Liffdf3ec2009-03-31 10:36:51 +0000597#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
598 {
599 .modalias = "mmc_spi",
600 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
601 .bus_num = 0,
602 .chip_select = 3,
603 .controller_data = &mmc_spi_chip_info,
604 .mode = SPI_MODE_0,
605 },
606#endif
607
Michael Hennerich59003142007-10-21 16:54:27 +0800608#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
609 {
610 .modalias = "ad7877",
611 .platform_data = &bfin_ad7877_ts_info,
Bryan Wu2eb74ae2008-05-31 15:17:25 +0800612 .irq = IRQ_PF8,
Michael Hennerich59003142007-10-21 16:54:27 +0800613 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Michael Hennerich0954f702007-11-13 00:16:19 +0800614 .bus_num = 0,
Bryan Wu2eb74ae2008-05-31 15:17:25 +0800615 .chip_select = 2,
Michael Hennerich59003142007-10-21 16:54:27 +0800616 .controller_data = &spi_ad7877_chip_info,
617 },
618#endif
Michael Hennerich51054322009-01-07 23:14:38 +0800619#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
620 {
621 .modalias = "ad7879",
622 .platform_data = &bfin_ad7879_ts_info,
623 .irq = IRQ_PF8,
624 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
625 .bus_num = 0,
626 .chip_select = 3,
627 .controller_data = &spi_ad7879_chip_info,
628 .mode = SPI_CPHA | SPI_CPOL,
629 },
630#endif
Michael Hennerichc7d48962007-11-15 21:33:31 +0800631#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
Michael Hennerich0954f702007-11-13 00:16:19 +0800632 && defined(CONFIG_SND_SOC_WM8731_SPI)
633 {
634 .modalias = "wm8731",
635 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
636 .bus_num = 0,
637 .chip_select = 5,
638 .controller_data = &spi_wm8731_chip_info,
639 .mode = SPI_MODE_0,
640 },
641#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800642#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
643 {
644 .modalias = "spidev",
645 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
646 .bus_num = 0,
647 .chip_select = 1,
648 .controller_data = &spidev_chip_info,
649 },
650#endif
Michael Hennerich59003142007-10-21 16:54:27 +0800651};
652
Mike Frysinger5bda2722008-06-07 15:03:01 +0800653#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800654/* SPI controller data */
655static struct bfin5xx_spi_master bfin_spi0_info = {
656 .num_chipselect = 8,
657 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800658 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Michael Hennerich59003142007-10-21 16:54:27 +0800659};
660
661/* SPI (0) */
662static struct resource bfin_spi0_resource[] = {
663 [0] = {
664 .start = SPI0_REGBASE,
665 .end = SPI0_REGBASE + 0xFF,
666 .flags = IORESOURCE_MEM,
667 },
668 [1] = {
669 .start = CH_SPI,
670 .end = CH_SPI,
Yi Li53122692009-06-05 12:11:11 +0000671 .flags = IORESOURCE_DMA,
672 },
673 [2] = {
674 .start = IRQ_SPI,
675 .end = IRQ_SPI,
Michael Hennerich59003142007-10-21 16:54:27 +0800676 .flags = IORESOURCE_IRQ,
677 },
678};
679
680static struct platform_device bfin_spi0_device = {
681 .name = "bfin-spi",
682 .id = 0, /* Bus number */
683 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
684 .resource = bfin_spi0_resource,
685 .dev = {
686 .platform_data = &bfin_spi0_info, /* Passed to driver */
687 },
688};
689#endif /* spi master and devices */
690
691#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
692static struct platform_device bfin_fb_device = {
693 .name = "bf537-lq035",
694};
695#endif
696
Michael Hennerich59003142007-10-21 16:54:27 +0800697#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
698static struct resource bfin_uart_resources[] = {
699#ifdef CONFIG_SERIAL_BFIN_UART0
700 {
701 .start = 0xFFC00400,
702 .end = 0xFFC004FF,
703 .flags = IORESOURCE_MEM,
704 },
705#endif
706#ifdef CONFIG_SERIAL_BFIN_UART1
707 {
708 .start = 0xFFC02000,
709 .end = 0xFFC020FF,
710 .flags = IORESOURCE_MEM,
711 },
712#endif
713};
714
715static struct platform_device bfin_uart_device = {
716 .name = "bfin-uart",
717 .id = 1,
718 .num_resources = ARRAY_SIZE(bfin_uart_resources),
719 .resource = bfin_uart_resources,
720};
721#endif
722
Graf Yang5be36d22008-04-25 03:09:15 +0800723#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang5be36d22008-04-25 03:09:15 +0800724#ifdef CONFIG_BFIN_SIR0
Graf Yang42bd8bc2009-01-07 23:14:39 +0800725static struct resource bfin_sir0_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800726 {
727 .start = 0xFFC00400,
728 .end = 0xFFC004FF,
729 .flags = IORESOURCE_MEM,
730 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800731 {
732 .start = IRQ_UART0_RX,
733 .end = IRQ_UART0_RX+1,
734 .flags = IORESOURCE_IRQ,
735 },
736 {
737 .start = CH_UART0_RX,
738 .end = CH_UART0_RX+1,
739 .flags = IORESOURCE_DMA,
740 },
741};
742
743static struct platform_device bfin_sir0_device = {
744 .name = "bfin_sir",
745 .id = 0,
746 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
747 .resource = bfin_sir0_resources,
748};
Graf Yang5be36d22008-04-25 03:09:15 +0800749#endif
750#ifdef CONFIG_BFIN_SIR1
Graf Yang42bd8bc2009-01-07 23:14:39 +0800751static struct resource bfin_sir1_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800752 {
753 .start = 0xFFC02000,
754 .end = 0xFFC020FF,
755 .flags = IORESOURCE_MEM,
756 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800757 {
758 .start = IRQ_UART1_RX,
759 .end = IRQ_UART1_RX+1,
760 .flags = IORESOURCE_IRQ,
761 },
762 {
763 .start = CH_UART1_RX,
764 .end = CH_UART1_RX+1,
765 .flags = IORESOURCE_DMA,
766 },
Graf Yang5be36d22008-04-25 03:09:15 +0800767};
768
Graf Yang42bd8bc2009-01-07 23:14:39 +0800769static struct platform_device bfin_sir1_device = {
Graf Yang5be36d22008-04-25 03:09:15 +0800770 .name = "bfin_sir",
Graf Yang42bd8bc2009-01-07 23:14:39 +0800771 .id = 1,
772 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
773 .resource = bfin_sir1_resources,
Graf Yang5be36d22008-04-25 03:09:15 +0800774};
775#endif
Graf Yang42bd8bc2009-01-07 23:14:39 +0800776#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800777
Michael Hennerich59003142007-10-21 16:54:27 +0800778#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
779static struct resource bfin_twi0_resource[] = {
780 [0] = {
781 .start = TWI0_REGBASE,
782 .end = TWI0_REGBASE,
783 .flags = IORESOURCE_MEM,
784 },
785 [1] = {
786 .start = IRQ_TWI,
787 .end = IRQ_TWI,
788 .flags = IORESOURCE_IRQ,
789 },
790};
791
792static struct platform_device i2c_bfin_twi_device = {
793 .name = "i2c-bfin-twi",
794 .id = 0,
795 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
796 .resource = bfin_twi0_resource,
797};
798#endif
799
Bryan Wu72268682008-05-07 11:41:26 +0800800static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
Michael Hennerichebd58332009-07-02 11:00:38 +0000801#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
Bryan Wu72268682008-05-07 11:41:26 +0800802 {
803 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
Bryan Wu72268682008-05-07 11:41:26 +0800804 },
805#endif
Michael Hennerich204844e2009-06-30 14:57:22 +0000806#if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
Bryan Wu72268682008-05-07 11:41:26 +0800807 {
808 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
Bryan Wu72268682008-05-07 11:41:26 +0800809 .irq = IRQ_PF8,
810 },
811#endif
Michael Hennerich50c4c082009-09-22 13:10:09 +0000812#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
813 {
814 I2C_BOARD_INFO("bfin-adv7393", 0x2B),
815 },
816#endif
Bryan Wu72268682008-05-07 11:41:26 +0800817};
Bryan Wu72268682008-05-07 11:41:26 +0800818
Michael Hennerich59003142007-10-21 16:54:27 +0800819#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
820static struct platform_device bfin_sport0_uart_device = {
821 .name = "bfin-sport-uart",
822 .id = 0,
823};
824
825static struct platform_device bfin_sport1_uart_device = {
826 .name = "bfin-sport-uart",
827 .id = 1,
828};
829#endif
830
Michael Hennerich1089e222007-12-24 11:49:29 +0800831#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
832#include <linux/input.h>
833#include <linux/gpio_keys.h>
834
835static struct gpio_keys_button bfin_gpio_keys_table[] = {
836 {BTN_0, GPIO_PG0, 1, "gpio-keys: BTN0"},
837 {BTN_1, GPIO_PG13, 1, "gpio-keys: BTN1"},
838};
839
840static struct gpio_keys_platform_data bfin_gpio_keys_data = {
841 .buttons = bfin_gpio_keys_table,
842 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
843};
844
845static struct platform_device bfin_device_gpiokeys = {
846 .name = "gpio-keys",
847 .dev = {
848 .platform_data = &bfin_gpio_keys_data,
849 },
850};
851#endif
852
Michael Hennerichaca5e4a2008-10-08 14:27:59 +0800853#if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE)
854#include <linux/input.h>
855#include <asm/bfin_rotary.h>
856
857static struct bfin_rotary_platform_data bfin_rotary_data = {
858 /*.rotary_up_key = KEY_UP,*/
859 /*.rotary_down_key = KEY_DOWN,*/
860 .rotary_rel_code = REL_WHEEL,
861 .rotary_button_key = KEY_ENTER,
862 .debounce = 10, /* 0..17 */
863 .mode = ROT_QUAD_ENC | ROT_DEBE,
864};
865
866static struct resource bfin_rotary_resources[] = {
867 {
868 .start = IRQ_CNT,
869 .end = IRQ_CNT,
870 .flags = IORESOURCE_IRQ,
871 },
872};
873
874static struct platform_device bfin_rotary_device = {
875 .name = "bfin-rotary",
876 .id = -1,
877 .num_resources = ARRAY_SIZE(bfin_rotary_resources),
878 .resource = bfin_rotary_resources,
879 .dev = {
880 .platform_data = &bfin_rotary_data,
881 },
882};
883#endif
884
Michael Hennerich14b03202008-05-07 11:41:26 +0800885static const unsigned int cclk_vlev_datasheet[] =
886{
887 VRPAIR(VLEV_100, 400000000),
888 VRPAIR(VLEV_105, 426000000),
889 VRPAIR(VLEV_110, 500000000),
890 VRPAIR(VLEV_115, 533000000),
891 VRPAIR(VLEV_120, 600000000),
892};
893
894static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
895 .tuple_tab = cclk_vlev_datasheet,
896 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
897 .vr_settling_time = 25 /* us */,
898};
899
900static struct platform_device bfin_dpmc = {
901 .name = "bfin dpmc",
902 .dev = {
903 .platform_data = &bfin_dmpc_vreg_data,
904 },
905};
906
Michael Hennerich59003142007-10-21 16:54:27 +0800907static struct platform_device *stamp_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +0800908
909 &bfin_dpmc,
910
Michael Hennerich64307f72007-10-29 16:55:18 +0800911#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
912 &bf5xx_nand_device,
913#endif
914
Michael Hennerich59003142007-10-21 16:54:27 +0800915#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
916 &bfin_pcmcia_cf_device,
917#endif
918
919#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
920 &rtc_device,
921#endif
922
923#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
924 &sl811_hcd_device,
925#endif
926
927#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
928 &isp1362_hcd_device,
929#endif
930
Michael Hennerich3f375692008-11-18 17:48:22 +0800931#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
932 &bfin_isp1760_device,
933#endif
934
Michael Hennerich1089e222007-12-24 11:49:29 +0800935#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
936 &musb_device,
937#endif
938
Michael Hennerich59003142007-10-21 16:54:27 +0800939#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
940 &smc91x_device,
941#endif
942
943#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
944 &dm9000_device,
945#endif
946
947#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
Graf Yang65319622009-02-04 16:49:45 +0800948 &bfin_mii_bus,
Michael Hennerich59003142007-10-21 16:54:27 +0800949 &bfin_mac_device,
950#endif
951
952#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
953 &net2272_bfin_device,
954#endif
955
956#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
957 &bfin_spi0_device,
958#endif
959
960#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
961 &bfin_fb_device,
962#endif
963
Michael Hennerich1089e222007-12-24 11:49:29 +0800964#if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
965 &bf52x_t350mcqb_device,
966#endif
967
Michael Hennerich59003142007-10-21 16:54:27 +0800968#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
969 &bfin_uart_device,
970#endif
971
Graf Yang5be36d22008-04-25 03:09:15 +0800972#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang42bd8bc2009-01-07 23:14:39 +0800973#ifdef CONFIG_BFIN_SIR0
974 &bfin_sir0_device,
975#endif
976#ifdef CONFIG_BFIN_SIR1
977 &bfin_sir1_device,
978#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800979#endif
980
Michael Hennerich59003142007-10-21 16:54:27 +0800981#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
982 &i2c_bfin_twi_device,
983#endif
984
985#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
986 &bfin_sport0_uart_device,
987 &bfin_sport1_uart_device,
988#endif
989
Michael Hennerich1089e222007-12-24 11:49:29 +0800990#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
991 &bfin_device_gpiokeys,
992#endif
Mike Frysingercad2ab62008-02-22 17:01:31 +0800993
Michael Hennerichaca5e4a2008-10-08 14:27:59 +0800994#if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE)
995 &bfin_rotary_device,
996#endif
997
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800998#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
999 &ezkit_flash_device,
1000#endif
Michael Hennerich59003142007-10-21 16:54:27 +08001001};
1002
Mike Frysinger7f6678c2009-02-04 16:49:45 +08001003static int __init ezkit_init(void)
Michael Hennerich59003142007-10-21 16:54:27 +08001004{
Harvey Harrisonb85d8582008-04-23 09:39:01 +08001005 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Bryan Wu72268682008-05-07 11:41:26 +08001006 i2c_register_board_info(0, bfin_i2c_board_info,
1007 ARRAY_SIZE(bfin_i2c_board_info));
Michael Hennerich59003142007-10-21 16:54:27 +08001008 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
Mike Frysinger5bda2722008-06-07 15:03:01 +08001009 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
Michael Hennerich59003142007-10-21 16:54:27 +08001010 return 0;
1011}
1012
Mike Frysinger7f6678c2009-02-04 16:49:45 +08001013arch_initcall(ezkit_init);
Michael Hennerich59003142007-10-21 16:54:27 +08001014
1015void native_machine_restart(char *cmd)
1016{
1017 /* workaround reboot hang when booting from SPI */
1018 if ((bfin_read_SYSCR() & 0x7) == 0x3)
Sonic Zhangb52dae32009-02-04 16:49:45 +08001019 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
Michael Hennerich59003142007-10-21 16:54:27 +08001020}
Mike Frysinger137b1522007-11-22 16:07:03 +08001021
Mike Frysinger9862cc52007-11-15 21:21:20 +08001022void bfin_get_ether_addr(char *addr)
Mike Frysinger137b1522007-11-22 16:07:03 +08001023{
Mike Frysinger181afa942008-02-25 11:42:17 +08001024 /* the MAC is stored in OTP memory page 0xDF */
1025 u32 ret;
1026 u64 otp_mac;
1027 u32 (*otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)0xEF00001A;
1028
1029 ret = otp_read(0xDF, 0x00, &otp_mac);
1030 if (!(ret & 0x1)) {
1031 char *otp_mac_p = (char *)&otp_mac;
1032 for (ret = 0; ret < 6; ++ret)
1033 addr[ret] = otp_mac_p[5 - ret];
1034 }
Mike Frysinger137b1522007-11-22 16:07:03 +08001035}
Mike Frysinger9862cc52007-11-15 21:21:20 +08001036EXPORT_SYMBOL(bfin_get_ether_addr);