Commit | Line | Data |
---|---|---|
59003145 MH |
1 | /* |
2 | * File: arch/blackfin/mach-bf527/boards/ezkit.c | |
3 | * Based on: arch/blackfin/mach-bf537/boards/stamp.c | |
4 | * Author: Aidan Williams <aidan@nicta.com.au> | |
5 | * | |
6 | * Created: | |
7 | * Description: | |
8 | * | |
9 | * Modified: | |
10 | * Copyright 2005 National ICT Australia (NICTA) | |
a628a8bc | 11 | * Copyright 2004-2008 Analog Devices Inc. |
59003145 MH |
12 | * |
13 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ | |
14 | * | |
15 | * This program is free software; you can redistribute it and/or modify | |
16 | * it under the terms of the GNU General Public License as published by | |
17 | * the Free Software Foundation; either version 2 of the License, or | |
18 | * (at your option) any later version. | |
19 | * | |
20 | * This program is distributed in the hope that it will be useful, | |
21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 | * GNU General Public License for more details. | |
24 | * | |
25 | * You should have received a copy of the GNU General Public License | |
26 | * along with this program; if not, see the file COPYING, or write | |
27 | * to the Free Software Foundation, Inc., | |
28 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
29 | */ | |
30 | ||
31 | #include <linux/device.h> | |
32 | #include <linux/platform_device.h> | |
33 | #include <linux/mtd/mtd.h> | |
34 | #include <linux/mtd/partitions.h> | |
d7e5dd41 | 35 | #include <linux/mtd/physmap.h> |
59003145 MH |
36 | #include <linux/spi/spi.h> |
37 | #include <linux/spi/flash.h> | |
38 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) | |
f02bcec5 | 39 | #include <linux/usb/isp1362.h> |
59003145 | 40 | #endif |
0a87e3e9 | 41 | #include <linux/ata_platform.h> |
72268689 | 42 | #include <linux/i2c.h> |
59003145 MH |
43 | #include <linux/irq.h> |
44 | #include <linux/interrupt.h> | |
632f658b | 45 | #include <linux/usb/sl811.h> |
67f2d33e | 46 | #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) |
1089e228 | 47 | #include <linux/usb/musb.h> |
67f2d33e | 48 | #endif |
64307f7d | 49 | #include <asm/cplb.h> |
59003145 MH |
50 | #include <asm/dma.h> |
51 | #include <asm/bfin5xx_spi.h> | |
52 | #include <asm/reboot.h> | |
64307f7d | 53 | #include <asm/nand.h> |
5d448dd5 | 54 | #include <asm/portmux.h> |
14b03204 | 55 | #include <asm/dpmc.h> |
59003145 MH |
56 | #include <linux/spi/ad7877.h> |
57 | ||
58 | /* | |
59 | * Name the Board for the /proc/cpuinfo | |
60 | */ | |
066954a3 | 61 | const char bfin_board_name[] = "ADDS-BF527-EZKIT"; |
59003145 MH |
62 | |
63 | /* | |
64 | * Driver needs to know address, irq and flag pin. | |
65 | */ | |
66 | ||
67 | #define ISP1761_BASE 0x203C0000 | |
68 | #define ISP1761_IRQ IRQ_PF7 | |
69 | ||
70 | #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE) | |
71 | static struct resource bfin_isp1761_resources[] = { | |
72 | [0] = { | |
73 | .name = "isp1761-regs", | |
74 | .start = ISP1761_BASE + 0x00000000, | |
75 | .end = ISP1761_BASE + 0x000fffff, | |
76 | .flags = IORESOURCE_MEM, | |
77 | }, | |
78 | [1] = { | |
79 | .start = ISP1761_IRQ, | |
80 | .end = ISP1761_IRQ, | |
81 | .flags = IORESOURCE_IRQ, | |
82 | }, | |
83 | }; | |
84 | ||
85 | static struct platform_device bfin_isp1761_device = { | |
86 | .name = "isp1761", | |
87 | .id = 0, | |
88 | .num_resources = ARRAY_SIZE(bfin_isp1761_resources), | |
89 | .resource = bfin_isp1761_resources, | |
90 | }; | |
91 | ||
92 | static struct platform_device *bfin_isp1761_devices[] = { | |
93 | &bfin_isp1761_device, | |
94 | }; | |
95 | ||
96 | int __init bfin_isp1761_init(void) | |
97 | { | |
98 | unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices); | |
99 | ||
b85d858b | 100 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
59003145 MH |
101 | set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING); |
102 | ||
103 | return platform_add_devices(bfin_isp1761_devices, num_devices); | |
104 | } | |
105 | ||
106 | void __exit bfin_isp1761_exit(void) | |
107 | { | |
108 | platform_device_unregister(&bfin_isp1761_device); | |
109 | } | |
110 | ||
111 | arch_initcall(bfin_isp1761_init); | |
112 | #endif | |
113 | ||
1089e228 MH |
114 | #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) |
115 | static struct resource musb_resources[] = { | |
116 | [0] = { | |
117 | .start = 0xffc03800, | |
118 | .end = 0xffc03cff, | |
119 | .flags = IORESOURCE_MEM, | |
120 | }, | |
121 | [1] = { /* general IRQ */ | |
122 | .start = IRQ_USB_INT0, | |
123 | .end = IRQ_USB_INT0, | |
124 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, | |
125 | }, | |
126 | [2] = { /* DMA IRQ */ | |
127 | .start = IRQ_USB_DMA, | |
128 | .end = IRQ_USB_DMA, | |
129 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, | |
130 | }, | |
131 | }; | |
132 | ||
133 | static struct musb_hdrc_platform_data musb_plat = { | |
134 | #if defined(CONFIG_USB_MUSB_OTG) | |
135 | .mode = MUSB_OTG, | |
136 | #elif defined(CONFIG_USB_MUSB_HDRC_HCD) | |
137 | .mode = MUSB_HOST, | |
138 | #elif defined(CONFIG_USB_GADGET_MUSB_HDRC) | |
139 | .mode = MUSB_PERIPHERAL, | |
140 | #endif | |
141 | .multipoint = 0, | |
142 | }; | |
143 | ||
144 | static u64 musb_dmamask = ~(u32)0; | |
145 | ||
146 | static struct platform_device musb_device = { | |
147 | .name = "musb_hdrc", | |
148 | .id = 0, | |
149 | .dev = { | |
150 | .dma_mask = &musb_dmamask, | |
151 | .coherent_dma_mask = 0xffffffff, | |
152 | .platform_data = &musb_plat, | |
153 | }, | |
154 | .num_resources = ARRAY_SIZE(musb_resources), | |
155 | .resource = musb_resources, | |
156 | }; | |
157 | #endif | |
158 | ||
159 | #if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE) | |
160 | ||
161 | static struct resource bf52x_t350mcqb_resources[] = { | |
162 | { | |
163 | .start = IRQ_PPI_ERROR, | |
164 | .end = IRQ_PPI_ERROR, | |
165 | .flags = IORESOURCE_IRQ, | |
166 | }, | |
167 | }; | |
168 | ||
169 | static struct platform_device bf52x_t350mcqb_device = { | |
170 | .name = "bfin-t350mcqb", | |
171 | .id = -1, | |
172 | .num_resources = ARRAY_SIZE(bf52x_t350mcqb_resources), | |
173 | .resource = bf52x_t350mcqb_resources, | |
174 | }; | |
175 | #endif | |
176 | ||
d7e5dd41 MH |
177 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
178 | static struct mtd_partition ezkit_partitions[] = { | |
179 | { | |
180 | .name = "Bootloader", | |
181 | .size = 0x40000, | |
182 | .offset = 0, | |
183 | }, { | |
184 | .name = "Kernel", | |
185 | .size = 0x1C0000, | |
186 | .offset = MTDPART_OFS_APPEND, | |
187 | }, { | |
188 | .name = "RootFS", | |
189 | .size = MTDPART_SIZ_FULL, | |
190 | .offset = MTDPART_OFS_APPEND, | |
191 | } | |
192 | }; | |
193 | ||
194 | static struct physmap_flash_data ezkit_flash_data = { | |
195 | .width = 2, | |
196 | .parts = ezkit_partitions, | |
197 | .nr_parts = ARRAY_SIZE(ezkit_partitions), | |
198 | }; | |
199 | ||
200 | static struct resource ezkit_flash_resource = { | |
201 | .start = 0x20000000, | |
202 | .end = 0x203fffff, | |
203 | .flags = IORESOURCE_MEM, | |
204 | }; | |
205 | ||
206 | static struct platform_device ezkit_flash_device = { | |
207 | .name = "physmap-flash", | |
208 | .id = 0, | |
209 | .dev = { | |
210 | .platform_data = &ezkit_flash_data, | |
211 | }, | |
212 | .num_resources = 1, | |
213 | .resource = &ezkit_flash_resource, | |
214 | }; | |
215 | #endif | |
216 | ||
64307f7d MH |
217 | #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE) |
218 | static struct mtd_partition partition_info[] = { | |
219 | { | |
220 | .name = "Linux Kernel", | |
221 | .offset = 0, | |
222 | .size = 4 * SIZE_1M, | |
223 | }, | |
224 | { | |
225 | .name = "File System", | |
edf05641 MF |
226 | .offset = MTDPART_OFS_APPEND, |
227 | .size = MTDPART_SIZ_FULL, | |
64307f7d MH |
228 | }, |
229 | }; | |
230 | ||
231 | static struct bf5xx_nand_platform bf5xx_nand_platform = { | |
232 | .page_size = NFC_PG_SIZE_256, | |
233 | .data_width = NFC_NWIDTH_8, | |
234 | .partitions = partition_info, | |
235 | .nr_partitions = ARRAY_SIZE(partition_info), | |
236 | .rd_dly = 3, | |
237 | .wr_dly = 3, | |
238 | }; | |
239 | ||
240 | static struct resource bf5xx_nand_resources[] = { | |
241 | { | |
242 | .start = NFC_CTL, | |
243 | .end = NFC_DATA_RD + 2, | |
244 | .flags = IORESOURCE_MEM, | |
245 | }, | |
246 | { | |
247 | .start = CH_NFC, | |
248 | .end = CH_NFC, | |
249 | .flags = IORESOURCE_IRQ, | |
250 | }, | |
251 | }; | |
252 | ||
253 | static struct platform_device bf5xx_nand_device = { | |
254 | .name = "bf5xx-nand", | |
255 | .id = 0, | |
256 | .num_resources = ARRAY_SIZE(bf5xx_nand_resources), | |
257 | .resource = bf5xx_nand_resources, | |
258 | .dev = { | |
259 | .platform_data = &bf5xx_nand_platform, | |
260 | }, | |
261 | }; | |
262 | #endif | |
263 | ||
59003145 MH |
264 | #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE) |
265 | static struct resource bfin_pcmcia_cf_resources[] = { | |
266 | { | |
267 | .start = 0x20310000, /* IO PORT */ | |
268 | .end = 0x20312000, | |
269 | .flags = IORESOURCE_MEM, | |
270 | }, { | |
271 | .start = 0x20311000, /* Attribute Memory */ | |
272 | .end = 0x20311FFF, | |
273 | .flags = IORESOURCE_MEM, | |
274 | }, { | |
275 | .start = IRQ_PF4, | |
276 | .end = IRQ_PF4, | |
277 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, | |
278 | }, { | |
279 | .start = 6, /* Card Detect PF6 */ | |
280 | .end = 6, | |
281 | .flags = IORESOURCE_IRQ, | |
282 | }, | |
283 | }; | |
284 | ||
285 | static struct platform_device bfin_pcmcia_cf_device = { | |
286 | .name = "bfin_cf_pcmcia", | |
287 | .id = -1, | |
288 | .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources), | |
289 | .resource = bfin_pcmcia_cf_resources, | |
290 | }; | |
291 | #endif | |
292 | ||
293 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) | |
294 | static struct platform_device rtc_device = { | |
295 | .name = "rtc-bfin", | |
296 | .id = -1, | |
297 | }; | |
298 | #endif | |
299 | ||
300 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) | |
301 | static struct resource smc91x_resources[] = { | |
302 | { | |
303 | .name = "smc91x-regs", | |
304 | .start = 0x20300300, | |
305 | .end = 0x20300300 + 16, | |
306 | .flags = IORESOURCE_MEM, | |
307 | }, { | |
308 | ||
309 | .start = IRQ_PF7, | |
310 | .end = IRQ_PF7, | |
311 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, | |
312 | }, | |
313 | }; | |
314 | static struct platform_device smc91x_device = { | |
315 | .name = "smc91x", | |
316 | .id = 0, | |
317 | .num_resources = ARRAY_SIZE(smc91x_resources), | |
318 | .resource = smc91x_resources, | |
319 | }; | |
320 | #endif | |
321 | ||
322 | #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) | |
323 | static struct resource dm9000_resources[] = { | |
324 | [0] = { | |
325 | .start = 0x203FB800, | |
326 | .end = 0x203FB800 + 8, | |
327 | .flags = IORESOURCE_MEM, | |
328 | }, | |
329 | [1] = { | |
330 | .start = IRQ_PF9, | |
331 | .end = IRQ_PF9, | |
332 | .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE), | |
333 | }, | |
334 | }; | |
335 | ||
336 | static struct platform_device dm9000_device = { | |
337 | .name = "dm9000", | |
338 | .id = -1, | |
339 | .num_resources = ARRAY_SIZE(dm9000_resources), | |
340 | .resource = dm9000_resources, | |
341 | }; | |
342 | #endif | |
343 | ||
344 | #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE) | |
345 | static struct resource sl811_hcd_resources[] = { | |
346 | { | |
347 | .start = 0x20340000, | |
348 | .end = 0x20340000, | |
349 | .flags = IORESOURCE_MEM, | |
350 | }, { | |
351 | .start = 0x20340004, | |
352 | .end = 0x20340004, | |
353 | .flags = IORESOURCE_MEM, | |
354 | }, { | |
355 | .start = CONFIG_USB_SL811_BFIN_IRQ, | |
356 | .end = CONFIG_USB_SL811_BFIN_IRQ, | |
357 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, | |
358 | }, | |
359 | }; | |
360 | ||
361 | #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS) | |
362 | void sl811_port_power(struct device *dev, int is_on) | |
363 | { | |
364 | gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS"); | |
acbcd263 | 365 | gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on); |
59003145 MH |
366 | } |
367 | #endif | |
368 | ||
369 | static struct sl811_platform_data sl811_priv = { | |
370 | .potpg = 10, | |
371 | .power = 250, /* == 500mA */ | |
372 | #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS) | |
373 | .port_power = &sl811_port_power, | |
374 | #endif | |
375 | }; | |
376 | ||
377 | static struct platform_device sl811_hcd_device = { | |
378 | .name = "sl811-hcd", | |
379 | .id = 0, | |
380 | .dev = { | |
381 | .platform_data = &sl811_priv, | |
382 | }, | |
383 | .num_resources = ARRAY_SIZE(sl811_hcd_resources), | |
384 | .resource = sl811_hcd_resources, | |
385 | }; | |
386 | #endif | |
387 | ||
388 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) | |
389 | static struct resource isp1362_hcd_resources[] = { | |
390 | { | |
391 | .start = 0x20360000, | |
392 | .end = 0x20360000, | |
393 | .flags = IORESOURCE_MEM, | |
394 | }, { | |
395 | .start = 0x20360004, | |
396 | .end = 0x20360004, | |
397 | .flags = IORESOURCE_MEM, | |
398 | }, { | |
399 | .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ, | |
400 | .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ, | |
401 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, | |
402 | }, | |
403 | }; | |
404 | ||
405 | static struct isp1362_platform_data isp1362_priv = { | |
406 | .sel15Kres = 1, | |
407 | .clknotstop = 0, | |
408 | .oc_enable = 0, | |
409 | .int_act_high = 0, | |
410 | .int_edge_triggered = 0, | |
411 | .remote_wakeup_connected = 0, | |
412 | .no_power_switching = 1, | |
413 | .power_switching_mode = 0, | |
414 | }; | |
415 | ||
416 | static struct platform_device isp1362_hcd_device = { | |
417 | .name = "isp1362-hcd", | |
418 | .id = 0, | |
419 | .dev = { | |
420 | .platform_data = &isp1362_priv, | |
421 | }, | |
422 | .num_resources = ARRAY_SIZE(isp1362_hcd_resources), | |
423 | .resource = isp1362_hcd_resources, | |
424 | }; | |
425 | #endif | |
426 | ||
427 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | |
428 | static struct platform_device bfin_mac_device = { | |
429 | .name = "bfin_mac", | |
430 | }; | |
431 | #endif | |
432 | ||
433 | #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE) | |
434 | static struct resource net2272_bfin_resources[] = { | |
435 | { | |
436 | .start = 0x20300000, | |
437 | .end = 0x20300000 + 0x100, | |
438 | .flags = IORESOURCE_MEM, | |
439 | }, { | |
440 | .start = IRQ_PF7, | |
441 | .end = IRQ_PF7, | |
442 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, | |
443 | }, | |
444 | }; | |
445 | ||
446 | static struct platform_device net2272_bfin_device = { | |
447 | .name = "net2272", | |
448 | .id = -1, | |
449 | .num_resources = ARRAY_SIZE(net2272_bfin_resources), | |
450 | .resource = net2272_bfin_resources, | |
451 | }; | |
452 | #endif | |
453 | ||
454 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) | |
455 | /* all SPI peripherals info goes here */ | |
456 | ||
457 | #if defined(CONFIG_MTD_M25P80) \ | |
458 | || defined(CONFIG_MTD_M25P80_MODULE) | |
459 | static struct mtd_partition bfin_spi_flash_partitions[] = { | |
460 | { | |
461 | .name = "bootloader", | |
ac76d889 | 462 | .size = 0x00040000, |
59003145 MH |
463 | .offset = 0, |
464 | .mask_flags = MTD_CAP_ROM | |
465 | }, { | |
d7323696 | 466 | .name = "linux kernel", |
edf05641 MF |
467 | .size = MTDPART_SIZ_FULL, |
468 | .offset = MTDPART_OFS_APPEND, | |
59003145 MH |
469 | } |
470 | }; | |
471 | ||
472 | static struct flash_platform_data bfin_spi_flash_data = { | |
473 | .name = "m25p80", | |
474 | .parts = bfin_spi_flash_partitions, | |
475 | .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions), | |
b9c9e788 | 476 | .type = "m25p16", |
59003145 MH |
477 | }; |
478 | ||
479 | /* SPI flash chip (m25p64) */ | |
480 | static struct bfin5xx_spi_chip spi_flash_chip_info = { | |
481 | .enable_dma = 0, /* use dma transfer with this chip*/ | |
482 | .bits_per_word = 8, | |
483 | }; | |
484 | #endif | |
485 | ||
486 | #if defined(CONFIG_SPI_ADC_BF533) \ | |
487 | || defined(CONFIG_SPI_ADC_BF533_MODULE) | |
488 | /* SPI ADC chip */ | |
489 | static struct bfin5xx_spi_chip spi_adc_chip_info = { | |
490 | .enable_dma = 1, /* use dma transfer with this chip*/ | |
491 | .bits_per_word = 16, | |
492 | }; | |
493 | #endif | |
494 | ||
495 | #if defined(CONFIG_SND_BLACKFIN_AD1836) \ | |
496 | || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) | |
497 | static struct bfin5xx_spi_chip ad1836_spi_chip_info = { | |
498 | .enable_dma = 0, | |
499 | .bits_per_word = 16, | |
500 | }; | |
501 | #endif | |
502 | ||
503 | #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE) | |
504 | static struct bfin5xx_spi_chip ad9960_spi_chip_info = { | |
505 | .enable_dma = 0, | |
506 | .bits_per_word = 16, | |
507 | }; | |
508 | #endif | |
509 | ||
510 | #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) | |
511 | static struct bfin5xx_spi_chip spi_mmc_chip_info = { | |
512 | .enable_dma = 1, | |
513 | .bits_per_word = 8, | |
514 | }; | |
515 | #endif | |
516 | ||
517 | #if defined(CONFIG_PBX) | |
518 | static struct bfin5xx_spi_chip spi_si3xxx_chip_info = { | |
519 | .ctl_reg = 0x4, /* send zero */ | |
520 | .enable_dma = 0, | |
521 | .bits_per_word = 8, | |
522 | .cs_change_per_word = 1, | |
523 | }; | |
524 | #endif | |
525 | ||
59003145 MH |
526 | #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) |
527 | static struct bfin5xx_spi_chip spi_ad7877_chip_info = { | |
528 | .enable_dma = 0, | |
529 | .bits_per_word = 16, | |
530 | }; | |
531 | ||
532 | static const struct ad7877_platform_data bfin_ad7877_ts_info = { | |
533 | .model = 7877, | |
534 | .vref_delay_usecs = 50, /* internal, no capacitor */ | |
535 | .x_plate_ohms = 419, | |
536 | .y_plate_ohms = 486, | |
537 | .pressure_max = 1000, | |
538 | .pressure_min = 0, | |
539 | .stopacq_polarity = 1, | |
540 | .first_conversion_delay = 3, | |
541 | .acquisition_time = 1, | |
542 | .averaging = 1, | |
543 | .pen_down_acc_interval = 1, | |
544 | }; | |
545 | #endif | |
546 | ||
c7d48966 | 547 | #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \ |
0954f70a MH |
548 | && defined(CONFIG_SND_SOC_WM8731_SPI) |
549 | static struct bfin5xx_spi_chip spi_wm8731_chip_info = { | |
550 | .enable_dma = 0, | |
551 | .bits_per_word = 16, | |
552 | }; | |
553 | #endif | |
6e668936 MH |
554 | |
555 | #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) | |
556 | static struct bfin5xx_spi_chip spidev_chip_info = { | |
557 | .enable_dma = 0, | |
558 | .bits_per_word = 8, | |
559 | }; | |
560 | #endif | |
561 | ||
59003145 MH |
562 | static struct spi_board_info bfin_spi_board_info[] __initdata = { |
563 | #if defined(CONFIG_MTD_M25P80) \ | |
564 | || defined(CONFIG_MTD_M25P80_MODULE) | |
565 | { | |
566 | /* the modalias must be the same as spi device driver name */ | |
567 | .modalias = "m25p80", /* Name of spi_driver for this device */ | |
568 | .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ | |
569 | .bus_num = 0, /* Framework bus number */ | |
570 | .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/ | |
571 | .platform_data = &bfin_spi_flash_data, | |
572 | .controller_data = &spi_flash_chip_info, | |
573 | .mode = SPI_MODE_3, | |
574 | }, | |
575 | #endif | |
576 | ||
577 | #if defined(CONFIG_SPI_ADC_BF533) \ | |
578 | || defined(CONFIG_SPI_ADC_BF533_MODULE) | |
579 | { | |
580 | .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */ | |
581 | .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */ | |
582 | .bus_num = 0, /* Framework bus number */ | |
583 | .chip_select = 1, /* Framework chip select. */ | |
584 | .platform_data = NULL, /* No spi_driver specific config */ | |
585 | .controller_data = &spi_adc_chip_info, | |
586 | }, | |
587 | #endif | |
588 | ||
589 | #if defined(CONFIG_SND_BLACKFIN_AD1836) \ | |
590 | || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) | |
591 | { | |
592 | .modalias = "ad1836-spi", | |
593 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ | |
594 | .bus_num = 0, | |
595 | .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT, | |
596 | .controller_data = &ad1836_spi_chip_info, | |
597 | }, | |
598 | #endif | |
599 | #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE) | |
600 | { | |
601 | .modalias = "ad9960-spi", | |
602 | .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */ | |
603 | .bus_num = 0, | |
604 | .chip_select = 1, | |
605 | .controller_data = &ad9960_spi_chip_info, | |
606 | }, | |
607 | #endif | |
608 | #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) | |
609 | { | |
610 | .modalias = "spi_mmc_dummy", | |
611 | .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ | |
612 | .bus_num = 0, | |
613 | .chip_select = 0, | |
614 | .platform_data = NULL, | |
615 | .controller_data = &spi_mmc_chip_info, | |
616 | .mode = SPI_MODE_3, | |
617 | }, | |
618 | { | |
619 | .modalias = "spi_mmc", | |
620 | .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ | |
621 | .bus_num = 0, | |
622 | .chip_select = CONFIG_SPI_MMC_CS_CHAN, | |
623 | .platform_data = NULL, | |
624 | .controller_data = &spi_mmc_chip_info, | |
625 | .mode = SPI_MODE_3, | |
626 | }, | |
627 | #endif | |
628 | #if defined(CONFIG_PBX) | |
629 | { | |
630 | .modalias = "fxs-spi", | |
631 | .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ | |
632 | .bus_num = 0, | |
633 | .chip_select = 8 - CONFIG_J11_JUMPER, | |
634 | .controller_data = &spi_si3xxx_chip_info, | |
635 | .mode = SPI_MODE_3, | |
636 | }, | |
637 | { | |
638 | .modalias = "fxo-spi", | |
639 | .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ | |
640 | .bus_num = 0, | |
641 | .chip_select = 8 - CONFIG_J19_JUMPER, | |
642 | .controller_data = &spi_si3xxx_chip_info, | |
643 | .mode = SPI_MODE_3, | |
644 | }, | |
645 | #endif | |
59003145 MH |
646 | #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) |
647 | { | |
648 | .modalias = "ad7877", | |
649 | .platform_data = &bfin_ad7877_ts_info, | |
2eb74ae2 | 650 | .irq = IRQ_PF8, |
59003145 | 651 | .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ |
0954f70a | 652 | .bus_num = 0, |
2eb74ae2 | 653 | .chip_select = 2, |
59003145 MH |
654 | .controller_data = &spi_ad7877_chip_info, |
655 | }, | |
656 | #endif | |
c7d48966 | 657 | #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \ |
0954f70a MH |
658 | && defined(CONFIG_SND_SOC_WM8731_SPI) |
659 | { | |
660 | .modalias = "wm8731", | |
661 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ | |
662 | .bus_num = 0, | |
663 | .chip_select = 5, | |
664 | .controller_data = &spi_wm8731_chip_info, | |
665 | .mode = SPI_MODE_0, | |
666 | }, | |
667 | #endif | |
6e668936 MH |
668 | #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) |
669 | { | |
670 | .modalias = "spidev", | |
671 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ | |
672 | .bus_num = 0, | |
673 | .chip_select = 1, | |
674 | .controller_data = &spidev_chip_info, | |
675 | }, | |
676 | #endif | |
59003145 MH |
677 | }; |
678 | ||
679 | /* SPI controller data */ | |
680 | static struct bfin5xx_spi_master bfin_spi0_info = { | |
681 | .num_chipselect = 8, | |
682 | .enable_dma = 1, /* master has the ability to do dma transfer */ | |
5d448dd5 | 683 | .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0}, |
59003145 MH |
684 | }; |
685 | ||
686 | /* SPI (0) */ | |
687 | static struct resource bfin_spi0_resource[] = { | |
688 | [0] = { | |
689 | .start = SPI0_REGBASE, | |
690 | .end = SPI0_REGBASE + 0xFF, | |
691 | .flags = IORESOURCE_MEM, | |
692 | }, | |
693 | [1] = { | |
694 | .start = CH_SPI, | |
695 | .end = CH_SPI, | |
696 | .flags = IORESOURCE_IRQ, | |
697 | }, | |
698 | }; | |
699 | ||
700 | static struct platform_device bfin_spi0_device = { | |
701 | .name = "bfin-spi", | |
702 | .id = 0, /* Bus number */ | |
703 | .num_resources = ARRAY_SIZE(bfin_spi0_resource), | |
704 | .resource = bfin_spi0_resource, | |
705 | .dev = { | |
706 | .platform_data = &bfin_spi0_info, /* Passed to driver */ | |
707 | }, | |
708 | }; | |
709 | #endif /* spi master and devices */ | |
710 | ||
711 | #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE) | |
712 | static struct platform_device bfin_fb_device = { | |
713 | .name = "bf537-lq035", | |
714 | }; | |
715 | #endif | |
716 | ||
717 | #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE) | |
718 | static struct platform_device bfin_fb_adv7393_device = { | |
719 | .name = "bfin-adv7393", | |
720 | }; | |
721 | #endif | |
722 | ||
723 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) | |
724 | static struct resource bfin_uart_resources[] = { | |
725 | #ifdef CONFIG_SERIAL_BFIN_UART0 | |
726 | { | |
727 | .start = 0xFFC00400, | |
728 | .end = 0xFFC004FF, | |
729 | .flags = IORESOURCE_MEM, | |
730 | }, | |
731 | #endif | |
732 | #ifdef CONFIG_SERIAL_BFIN_UART1 | |
733 | { | |
734 | .start = 0xFFC02000, | |
735 | .end = 0xFFC020FF, | |
736 | .flags = IORESOURCE_MEM, | |
737 | }, | |
738 | #endif | |
739 | }; | |
740 | ||
741 | static struct platform_device bfin_uart_device = { | |
742 | .name = "bfin-uart", | |
743 | .id = 1, | |
744 | .num_resources = ARRAY_SIZE(bfin_uart_resources), | |
745 | .resource = bfin_uart_resources, | |
746 | }; | |
747 | #endif | |
748 | ||
5be36d22 GY |
749 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) |
750 | static struct resource bfin_sir_resources[] = { | |
751 | #ifdef CONFIG_BFIN_SIR0 | |
752 | { | |
753 | .start = 0xFFC00400, | |
754 | .end = 0xFFC004FF, | |
755 | .flags = IORESOURCE_MEM, | |
756 | }, | |
757 | #endif | |
758 | #ifdef CONFIG_BFIN_SIR1 | |
759 | { | |
760 | .start = 0xFFC02000, | |
761 | .end = 0xFFC020FF, | |
762 | .flags = IORESOURCE_MEM, | |
763 | }, | |
764 | #endif | |
765 | }; | |
766 | ||
767 | static struct platform_device bfin_sir_device = { | |
768 | .name = "bfin_sir", | |
769 | .id = 0, | |
770 | .num_resources = ARRAY_SIZE(bfin_sir_resources), | |
771 | .resource = bfin_sir_resources, | |
772 | }; | |
773 | #endif | |
774 | ||
59003145 MH |
775 | #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) |
776 | static struct resource bfin_twi0_resource[] = { | |
777 | [0] = { | |
778 | .start = TWI0_REGBASE, | |
779 | .end = TWI0_REGBASE, | |
780 | .flags = IORESOURCE_MEM, | |
781 | }, | |
782 | [1] = { | |
783 | .start = IRQ_TWI, | |
784 | .end = IRQ_TWI, | |
785 | .flags = IORESOURCE_IRQ, | |
786 | }, | |
787 | }; | |
788 | ||
789 | static struct platform_device i2c_bfin_twi_device = { | |
790 | .name = "i2c-bfin-twi", | |
791 | .id = 0, | |
792 | .num_resources = ARRAY_SIZE(bfin_twi0_resource), | |
793 | .resource = bfin_twi0_resource, | |
794 | }; | |
795 | #endif | |
796 | ||
72268689 BW |
797 | #ifdef CONFIG_I2C_BOARDINFO |
798 | static struct i2c_board_info __initdata bfin_i2c_board_info[] = { | |
799 | #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) | |
800 | { | |
801 | I2C_BOARD_INFO("pcf8574_lcd", 0x22), | |
72268689 BW |
802 | }, |
803 | #endif | |
804 | #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE) | |
805 | { | |
806 | I2C_BOARD_INFO("pcf8574_keypad", 0x27), | |
72268689 BW |
807 | .irq = IRQ_PF8, |
808 | }, | |
809 | #endif | |
810 | }; | |
811 | #endif | |
812 | ||
59003145 MH |
813 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) |
814 | static struct platform_device bfin_sport0_uart_device = { | |
815 | .name = "bfin-sport-uart", | |
816 | .id = 0, | |
817 | }; | |
818 | ||
819 | static struct platform_device bfin_sport1_uart_device = { | |
820 | .name = "bfin-sport-uart", | |
821 | .id = 1, | |
822 | }; | |
823 | #endif | |
824 | ||
825 | #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) | |
826 | #define PATA_INT 55 | |
827 | ||
828 | static struct pata_platform_info bfin_pata_platform_data = { | |
829 | .ioport_shift = 1, | |
830 | .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED, | |
831 | }; | |
832 | ||
833 | static struct resource bfin_pata_resources[] = { | |
834 | { | |
835 | .start = 0x20314020, | |
836 | .end = 0x2031403F, | |
837 | .flags = IORESOURCE_MEM, | |
838 | }, | |
839 | { | |
840 | .start = 0x2031401C, | |
841 | .end = 0x2031401F, | |
842 | .flags = IORESOURCE_MEM, | |
843 | }, | |
844 | { | |
845 | .start = PATA_INT, | |
846 | .end = PATA_INT, | |
847 | .flags = IORESOURCE_IRQ, | |
848 | }, | |
849 | }; | |
850 | ||
851 | static struct platform_device bfin_pata_device = { | |
852 | .name = "pata_platform", | |
853 | .id = -1, | |
854 | .num_resources = ARRAY_SIZE(bfin_pata_resources), | |
855 | .resource = bfin_pata_resources, | |
856 | .dev = { | |
857 | .platform_data = &bfin_pata_platform_data, | |
858 | } | |
859 | }; | |
860 | #endif | |
861 | ||
1089e228 MH |
862 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
863 | #include <linux/input.h> | |
864 | #include <linux/gpio_keys.h> | |
865 | ||
866 | static struct gpio_keys_button bfin_gpio_keys_table[] = { | |
867 | {BTN_0, GPIO_PG0, 1, "gpio-keys: BTN0"}, | |
868 | {BTN_1, GPIO_PG13, 1, "gpio-keys: BTN1"}, | |
869 | }; | |
870 | ||
871 | static struct gpio_keys_platform_data bfin_gpio_keys_data = { | |
872 | .buttons = bfin_gpio_keys_table, | |
873 | .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table), | |
874 | }; | |
875 | ||
876 | static struct platform_device bfin_device_gpiokeys = { | |
877 | .name = "gpio-keys", | |
878 | .dev = { | |
879 | .platform_data = &bfin_gpio_keys_data, | |
880 | }, | |
881 | }; | |
882 | #endif | |
883 | ||
cad2ab65 MF |
884 | static struct resource bfin_gpios_resources = { |
885 | .start = 0, | |
886 | .end = MAX_BLACKFIN_GPIOS - 1, | |
887 | .flags = IORESOURCE_IRQ, | |
888 | }; | |
889 | ||
890 | static struct platform_device bfin_gpios_device = { | |
891 | .name = "simple-gpio", | |
892 | .id = -1, | |
893 | .num_resources = 1, | |
894 | .resource = &bfin_gpios_resources, | |
895 | }; | |
896 | ||
14b03204 MH |
897 | static const unsigned int cclk_vlev_datasheet[] = |
898 | { | |
899 | VRPAIR(VLEV_100, 400000000), | |
900 | VRPAIR(VLEV_105, 426000000), | |
901 | VRPAIR(VLEV_110, 500000000), | |
902 | VRPAIR(VLEV_115, 533000000), | |
903 | VRPAIR(VLEV_120, 600000000), | |
904 | }; | |
905 | ||
906 | static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = { | |
907 | .tuple_tab = cclk_vlev_datasheet, | |
908 | .tabsize = ARRAY_SIZE(cclk_vlev_datasheet), | |
909 | .vr_settling_time = 25 /* us */, | |
910 | }; | |
911 | ||
912 | static struct platform_device bfin_dpmc = { | |
913 | .name = "bfin dpmc", | |
914 | .dev = { | |
915 | .platform_data = &bfin_dmpc_vreg_data, | |
916 | }, | |
917 | }; | |
918 | ||
59003145 | 919 | static struct platform_device *stamp_devices[] __initdata = { |
14b03204 MH |
920 | |
921 | &bfin_dpmc, | |
922 | ||
64307f7d MH |
923 | #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE) |
924 | &bf5xx_nand_device, | |
925 | #endif | |
926 | ||
59003145 MH |
927 | #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE) |
928 | &bfin_pcmcia_cf_device, | |
929 | #endif | |
930 | ||
931 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) | |
932 | &rtc_device, | |
933 | #endif | |
934 | ||
935 | #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE) | |
936 | &sl811_hcd_device, | |
937 | #endif | |
938 | ||
939 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) | |
940 | &isp1362_hcd_device, | |
941 | #endif | |
942 | ||
1089e228 MH |
943 | #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) |
944 | &musb_device, | |
945 | #endif | |
946 | ||
59003145 MH |
947 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
948 | &smc91x_device, | |
949 | #endif | |
950 | ||
951 | #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) | |
952 | &dm9000_device, | |
953 | #endif | |
954 | ||
955 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | |
956 | &bfin_mac_device, | |
957 | #endif | |
958 | ||
959 | #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE) | |
960 | &net2272_bfin_device, | |
961 | #endif | |
962 | ||
963 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) | |
964 | &bfin_spi0_device, | |
965 | #endif | |
966 | ||
967 | #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE) | |
968 | &bfin_fb_device, | |
969 | #endif | |
970 | ||
1089e228 MH |
971 | #if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE) |
972 | &bf52x_t350mcqb_device, | |
973 | #endif | |
974 | ||
59003145 MH |
975 | #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE) |
976 | &bfin_fb_adv7393_device, | |
977 | #endif | |
978 | ||
979 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) | |
980 | &bfin_uart_device, | |
981 | #endif | |
982 | ||
5be36d22 GY |
983 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) |
984 | &bfin_sir_device, | |
985 | #endif | |
986 | ||
59003145 MH |
987 | #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) |
988 | &i2c_bfin_twi_device, | |
989 | #endif | |
990 | ||
991 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) | |
992 | &bfin_sport0_uart_device, | |
993 | &bfin_sport1_uart_device, | |
994 | #endif | |
995 | ||
996 | #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) | |
997 | &bfin_pata_device, | |
998 | #endif | |
1089e228 MH |
999 | |
1000 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | |
1001 | &bfin_device_gpiokeys, | |
1002 | #endif | |
cad2ab65 | 1003 | |
d7e5dd41 MH |
1004 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
1005 | &ezkit_flash_device, | |
1006 | #endif | |
1007 | ||
cad2ab65 | 1008 | &bfin_gpios_device, |
59003145 MH |
1009 | }; |
1010 | ||
1011 | static int __init stamp_init(void) | |
1012 | { | |
b85d858b | 1013 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
72268689 BW |
1014 | |
1015 | #ifdef CONFIG_I2C_BOARDINFO | |
1016 | i2c_register_board_info(0, bfin_i2c_board_info, | |
1017 | ARRAY_SIZE(bfin_i2c_board_info)); | |
1018 | #endif | |
1019 | ||
59003145 MH |
1020 | platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); |
1021 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) | |
1022 | spi_register_board_info(bfin_spi_board_info, | |
1023 | ARRAY_SIZE(bfin_spi_board_info)); | |
1024 | #endif | |
1025 | ||
1026 | #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) | |
1027 | irq_desc[PATA_INT].status |= IRQ_NOAUTOEN; | |
1028 | #endif | |
1029 | return 0; | |
1030 | } | |
1031 | ||
1032 | arch_initcall(stamp_init); | |
1033 | ||
1034 | void native_machine_restart(char *cmd) | |
1035 | { | |
1036 | /* workaround reboot hang when booting from SPI */ | |
1037 | if ((bfin_read_SYSCR() & 0x7) == 0x3) | |
1038 | bfin_gpio_reset_spi0_ssel1(); | |
1039 | } | |
137b1529 | 1040 | |
9862cc52 | 1041 | void bfin_get_ether_addr(char *addr) |
137b1529 | 1042 | { |
181afa94 MF |
1043 | /* the MAC is stored in OTP memory page 0xDF */ |
1044 | u32 ret; | |
1045 | u64 otp_mac; | |
1046 | u32 (*otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)0xEF00001A; | |
1047 | ||
1048 | ret = otp_read(0xDF, 0x00, &otp_mac); | |
1049 | if (!(ret & 0x1)) { | |
1050 | char *otp_mac_p = (char *)&otp_mac; | |
1051 | for (ret = 0; ret < 6; ++ret) | |
1052 | addr[ret] = otp_mac_p[5 - ret]; | |
1053 | } | |
137b1529 | 1054 | } |
9862cc52 | 1055 | EXPORT_SYMBOL(bfin_get_ether_addr); |