blob: b7574b4e55e074c37916080602275a3c115d6fff [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
697#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
698static struct platform_device bfin_fb_adv7393_device = {
699 .name = "bfin-adv7393",
700};
701#endif
702
703#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
704static struct resource bfin_uart_resources[] = {
705#ifdef CONFIG_SERIAL_BFIN_UART0
706 {
707 .start = 0xFFC00400,
708 .end = 0xFFC004FF,
709 .flags = IORESOURCE_MEM,
710 },
711#endif
712#ifdef CONFIG_SERIAL_BFIN_UART1
713 {
714 .start = 0xFFC02000,
715 .end = 0xFFC020FF,
716 .flags = IORESOURCE_MEM,
717 },
718#endif
719};
720
721static struct platform_device bfin_uart_device = {
722 .name = "bfin-uart",
723 .id = 1,
724 .num_resources = ARRAY_SIZE(bfin_uart_resources),
725 .resource = bfin_uart_resources,
726};
727#endif
728
Graf Yang5be36d22008-04-25 03:09:15 +0800729#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang5be36d22008-04-25 03:09:15 +0800730#ifdef CONFIG_BFIN_SIR0
Graf Yang42bd8bc2009-01-07 23:14:39 +0800731static struct resource bfin_sir0_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800732 {
733 .start = 0xFFC00400,
734 .end = 0xFFC004FF,
735 .flags = IORESOURCE_MEM,
736 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800737 {
738 .start = IRQ_UART0_RX,
739 .end = IRQ_UART0_RX+1,
740 .flags = IORESOURCE_IRQ,
741 },
742 {
743 .start = CH_UART0_RX,
744 .end = CH_UART0_RX+1,
745 .flags = IORESOURCE_DMA,
746 },
747};
748
749static struct platform_device bfin_sir0_device = {
750 .name = "bfin_sir",
751 .id = 0,
752 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
753 .resource = bfin_sir0_resources,
754};
Graf Yang5be36d22008-04-25 03:09:15 +0800755#endif
756#ifdef CONFIG_BFIN_SIR1
Graf Yang42bd8bc2009-01-07 23:14:39 +0800757static struct resource bfin_sir1_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800758 {
759 .start = 0xFFC02000,
760 .end = 0xFFC020FF,
761 .flags = IORESOURCE_MEM,
762 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800763 {
764 .start = IRQ_UART1_RX,
765 .end = IRQ_UART1_RX+1,
766 .flags = IORESOURCE_IRQ,
767 },
768 {
769 .start = CH_UART1_RX,
770 .end = CH_UART1_RX+1,
771 .flags = IORESOURCE_DMA,
772 },
Graf Yang5be36d22008-04-25 03:09:15 +0800773};
774
Graf Yang42bd8bc2009-01-07 23:14:39 +0800775static struct platform_device bfin_sir1_device = {
Graf Yang5be36d22008-04-25 03:09:15 +0800776 .name = "bfin_sir",
Graf Yang42bd8bc2009-01-07 23:14:39 +0800777 .id = 1,
778 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
779 .resource = bfin_sir1_resources,
Graf Yang5be36d22008-04-25 03:09:15 +0800780};
781#endif
Graf Yang42bd8bc2009-01-07 23:14:39 +0800782#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800783
Michael Hennerich59003142007-10-21 16:54:27 +0800784#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
785static struct resource bfin_twi0_resource[] = {
786 [0] = {
787 .start = TWI0_REGBASE,
788 .end = TWI0_REGBASE,
789 .flags = IORESOURCE_MEM,
790 },
791 [1] = {
792 .start = IRQ_TWI,
793 .end = IRQ_TWI,
794 .flags = IORESOURCE_IRQ,
795 },
796};
797
798static struct platform_device i2c_bfin_twi_device = {
799 .name = "i2c-bfin-twi",
800 .id = 0,
801 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
802 .resource = bfin_twi0_resource,
803};
804#endif
805
Bryan Wu72268682008-05-07 11:41:26 +0800806static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
Michael Hennerichebd58332009-07-02 11:00:38 +0000807#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
Bryan Wu72268682008-05-07 11:41:26 +0800808 {
809 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
Bryan Wu72268682008-05-07 11:41:26 +0800810 },
811#endif
Michael Hennerich204844e2009-06-30 14:57:22 +0000812#if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
Bryan Wu72268682008-05-07 11:41:26 +0800813 {
814 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
Bryan Wu72268682008-05-07 11:41:26 +0800815 .irq = IRQ_PF8,
816 },
817#endif
818};
Bryan Wu72268682008-05-07 11:41:26 +0800819
Michael Hennerich59003142007-10-21 16:54:27 +0800820#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
821static struct platform_device bfin_sport0_uart_device = {
822 .name = "bfin-sport-uart",
823 .id = 0,
824};
825
826static struct platform_device bfin_sport1_uart_device = {
827 .name = "bfin-sport-uart",
828 .id = 1,
829};
830#endif
831
Michael Hennerich1089e222007-12-24 11:49:29 +0800832#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
833#include <linux/input.h>
834#include <linux/gpio_keys.h>
835
836static struct gpio_keys_button bfin_gpio_keys_table[] = {
837 {BTN_0, GPIO_PG0, 1, "gpio-keys: BTN0"},
838 {BTN_1, GPIO_PG13, 1, "gpio-keys: BTN1"},
839};
840
841static struct gpio_keys_platform_data bfin_gpio_keys_data = {
842 .buttons = bfin_gpio_keys_table,
843 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
844};
845
846static struct platform_device bfin_device_gpiokeys = {
847 .name = "gpio-keys",
848 .dev = {
849 .platform_data = &bfin_gpio_keys_data,
850 },
851};
852#endif
853
Michael Hennerichaca5e4a2008-10-08 14:27:59 +0800854#if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE)
855#include <linux/input.h>
856#include <asm/bfin_rotary.h>
857
858static struct bfin_rotary_platform_data bfin_rotary_data = {
859 /*.rotary_up_key = KEY_UP,*/
860 /*.rotary_down_key = KEY_DOWN,*/
861 .rotary_rel_code = REL_WHEEL,
862 .rotary_button_key = KEY_ENTER,
863 .debounce = 10, /* 0..17 */
864 .mode = ROT_QUAD_ENC | ROT_DEBE,
865};
866
867static struct resource bfin_rotary_resources[] = {
868 {
869 .start = IRQ_CNT,
870 .end = IRQ_CNT,
871 .flags = IORESOURCE_IRQ,
872 },
873};
874
875static struct platform_device bfin_rotary_device = {
876 .name = "bfin-rotary",
877 .id = -1,
878 .num_resources = ARRAY_SIZE(bfin_rotary_resources),
879 .resource = bfin_rotary_resources,
880 .dev = {
881 .platform_data = &bfin_rotary_data,
882 },
883};
884#endif
885
Mike Frysingercad2ab62008-02-22 17:01:31 +0800886static struct resource bfin_gpios_resources = {
887 .start = 0,
888 .end = MAX_BLACKFIN_GPIOS - 1,
889 .flags = IORESOURCE_IRQ,
890};
891
892static struct platform_device bfin_gpios_device = {
893 .name = "simple-gpio",
894 .id = -1,
895 .num_resources = 1,
896 .resource = &bfin_gpios_resources,
897};
898
Michael Hennerich14b03202008-05-07 11:41:26 +0800899static const unsigned int cclk_vlev_datasheet[] =
900{
901 VRPAIR(VLEV_100, 400000000),
902 VRPAIR(VLEV_105, 426000000),
903 VRPAIR(VLEV_110, 500000000),
904 VRPAIR(VLEV_115, 533000000),
905 VRPAIR(VLEV_120, 600000000),
906};
907
908static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
909 .tuple_tab = cclk_vlev_datasheet,
910 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
911 .vr_settling_time = 25 /* us */,
912};
913
914static struct platform_device bfin_dpmc = {
915 .name = "bfin dpmc",
916 .dev = {
917 .platform_data = &bfin_dmpc_vreg_data,
918 },
919};
920
Michael Hennerich59003142007-10-21 16:54:27 +0800921static struct platform_device *stamp_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +0800922
923 &bfin_dpmc,
924
Michael Hennerich64307f72007-10-29 16:55:18 +0800925#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
926 &bf5xx_nand_device,
927#endif
928
Michael Hennerich59003142007-10-21 16:54:27 +0800929#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
930 &bfin_pcmcia_cf_device,
931#endif
932
933#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
934 &rtc_device,
935#endif
936
937#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
938 &sl811_hcd_device,
939#endif
940
941#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
942 &isp1362_hcd_device,
943#endif
944
Michael Hennerich3f375692008-11-18 17:48:22 +0800945#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
946 &bfin_isp1760_device,
947#endif
948
Michael Hennerich1089e222007-12-24 11:49:29 +0800949#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
950 &musb_device,
951#endif
952
Michael Hennerich59003142007-10-21 16:54:27 +0800953#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
954 &smc91x_device,
955#endif
956
957#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
958 &dm9000_device,
959#endif
960
961#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
Graf Yang65319622009-02-04 16:49:45 +0800962 &bfin_mii_bus,
Michael Hennerich59003142007-10-21 16:54:27 +0800963 &bfin_mac_device,
964#endif
965
966#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
967 &net2272_bfin_device,
968#endif
969
970#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
971 &bfin_spi0_device,
972#endif
973
974#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
975 &bfin_fb_device,
976#endif
977
Michael Hennerich1089e222007-12-24 11:49:29 +0800978#if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
979 &bf52x_t350mcqb_device,
980#endif
981
Michael Hennerich59003142007-10-21 16:54:27 +0800982#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
983 &bfin_fb_adv7393_device,
984#endif
985
986#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
987 &bfin_uart_device,
988#endif
989
Graf Yang5be36d22008-04-25 03:09:15 +0800990#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang42bd8bc2009-01-07 23:14:39 +0800991#ifdef CONFIG_BFIN_SIR0
992 &bfin_sir0_device,
993#endif
994#ifdef CONFIG_BFIN_SIR1
995 &bfin_sir1_device,
996#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800997#endif
998
Michael Hennerich59003142007-10-21 16:54:27 +0800999#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1000 &i2c_bfin_twi_device,
1001#endif
1002
1003#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1004 &bfin_sport0_uart_device,
1005 &bfin_sport1_uart_device,
1006#endif
1007
Michael Hennerich1089e222007-12-24 11:49:29 +08001008#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1009 &bfin_device_gpiokeys,
1010#endif
Mike Frysingercad2ab62008-02-22 17:01:31 +08001011
Michael Hennerichaca5e4a2008-10-08 14:27:59 +08001012#if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE)
1013 &bfin_rotary_device,
1014#endif
1015
Michael Hennerichd7e5dd42008-05-07 11:41:26 +08001016#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
1017 &ezkit_flash_device,
1018#endif
1019
Mike Frysingercad2ab62008-02-22 17:01:31 +08001020 &bfin_gpios_device,
Michael Hennerich59003142007-10-21 16:54:27 +08001021};
1022
Mike Frysinger7f6678c2009-02-04 16:49:45 +08001023static int __init ezkit_init(void)
Michael Hennerich59003142007-10-21 16:54:27 +08001024{
Harvey Harrisonb85d8582008-04-23 09:39:01 +08001025 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Bryan Wu72268682008-05-07 11:41:26 +08001026 i2c_register_board_info(0, bfin_i2c_board_info,
1027 ARRAY_SIZE(bfin_i2c_board_info));
Michael Hennerich59003142007-10-21 16:54:27 +08001028 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
Mike Frysinger5bda2722008-06-07 15:03:01 +08001029 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
Michael Hennerich59003142007-10-21 16:54:27 +08001030 return 0;
1031}
1032
Mike Frysinger7f6678c2009-02-04 16:49:45 +08001033arch_initcall(ezkit_init);
Michael Hennerich59003142007-10-21 16:54:27 +08001034
1035void native_machine_restart(char *cmd)
1036{
1037 /* workaround reboot hang when booting from SPI */
1038 if ((bfin_read_SYSCR() & 0x7) == 0x3)
Sonic Zhangb52dae32009-02-04 16:49:45 +08001039 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
Michael Hennerich59003142007-10-21 16:54:27 +08001040}
Mike Frysinger137b1522007-11-22 16:07:03 +08001041
Mike Frysinger9862cc52007-11-15 21:21:20 +08001042void bfin_get_ether_addr(char *addr)
Mike Frysinger137b1522007-11-22 16:07:03 +08001043{
Mike Frysinger181afa942008-02-25 11:42:17 +08001044 /* the MAC is stored in OTP memory page 0xDF */
1045 u32 ret;
1046 u64 otp_mac;
1047 u32 (*otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)0xEF00001A;
1048
1049 ret = otp_read(0xDF, 0x00, &otp_mac);
1050 if (!(ret & 0x1)) {
1051 char *otp_mac_p = (char *)&otp_mac;
1052 for (ret = 0; ret < 6; ++ret)
1053 addr[ret] = otp_mac_p[5 - ret];
1054 }
Mike Frysinger137b1522007-11-22 16:07:03 +08001055}
Mike Frysinger9862cc52007-11-15 21:21:20 +08001056EXPORT_SYMBOL(bfin_get_ether_addr);