blob: d0864111ef594f3b05ed613c31d18251c87961c3 [file] [log] [blame]
Michael Hennerich59003142007-10-21 16:54:27 +08001/*
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)
Michael Hennericha628a8b2008-01-22 17:29:16 +080011 * Copyright 2004-2008 Analog Devices Inc.
Michael Hennerich59003142007-10-21 16:54:27 +080012 *
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>
Michael Hennerichd7e5dd42008-05-07 11:41:26 +080035#include <linux/mtd/physmap.h>
Michael Hennerich59003142007-10-21 16:54:27 +080036#include <linux/spi/spi.h>
37#include <linux/spi/flash.h>
38#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
Mike Frysingerf02bcec2007-11-15 21:29:15 +080039#include <linux/usb/isp1362.h>
Michael Hennerich59003142007-10-21 16:54:27 +080040#endif
Bryan Wu72268682008-05-07 11:41:26 +080041#include <linux/i2c.h>
Michael Hennerich59003142007-10-21 16:54:27 +080042#include <linux/irq.h>
43#include <linux/interrupt.h>
Mike Frysinger632f6582007-11-15 21:25:47 +080044#include <linux/usb/sl811.h>
Michael Hennerich1089e222007-12-24 11:49:29 +080045#include <linux/usb/musb.h>
Michael Hennerich59003142007-10-21 16:54:27 +080046#include <asm/dma.h>
47#include <asm/bfin5xx_spi.h>
48#include <asm/reboot.h>
Michael Hennerich64307f72007-10-29 16:55:18 +080049#include <asm/nand.h>
Bryan Wu5d448dd2007-11-12 23:24:42 +080050#include <asm/portmux.h>
Michael Hennerich14b03202008-05-07 11:41:26 +080051#include <asm/dpmc.h>
Michael Hennerich59003142007-10-21 16:54:27 +080052#include <linux/spi/ad7877.h>
53
54/*
55 * Name the Board for the /proc/cpuinfo
56 */
Mike Frysingerfe85cad2008-11-18 17:48:22 +080057const char bfin_board_name[] = "ADI BF527-EZKIT";
Michael Hennerich59003142007-10-21 16:54:27 +080058
59/*
60 * Driver needs to know address, irq and flag pin.
61 */
62
Michael Hennerich59003142007-10-21 16:54:27 +080063#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
Michael Hennerich3f375692008-11-18 17:48:22 +080064#include <linux/usb/isp1760.h>
65static struct resource bfin_isp1760_resources[] = {
Michael Hennerich59003142007-10-21 16:54:27 +080066 [0] = {
Michael Hennerich3f375692008-11-18 17:48:22 +080067 .start = 0x203C0000,
68 .end = 0x203C0000 + 0x000fffff,
Michael Hennerich59003142007-10-21 16:54:27 +080069 .flags = IORESOURCE_MEM,
70 },
71 [1] = {
Michael Hennerich3f375692008-11-18 17:48:22 +080072 .start = IRQ_PF7,
73 .end = IRQ_PF7,
Michael Hennerich59003142007-10-21 16:54:27 +080074 .flags = IORESOURCE_IRQ,
75 },
76};
77
Michael Hennerich3f375692008-11-18 17:48:22 +080078static struct isp1760_platform_data isp1760_priv = {
79 .is_isp1761 = 0,
80 .port1_disable = 0,
81 .bus_width_16 = 1,
82 .port1_otg = 0,
83 .analog_oc = 0,
84 .dack_polarity_high = 0,
85 .dreq_polarity_high = 0,
86};
87
88static struct platform_device bfin_isp1760_device = {
89 .name = "isp1760-hcd",
Michael Hennerich59003142007-10-21 16:54:27 +080090 .id = 0,
Michael Hennerich3f375692008-11-18 17:48:22 +080091 .dev = {
92 .platform_data = &isp1760_priv,
93 },
94 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
95 .resource = bfin_isp1760_resources,
Michael Hennerich59003142007-10-21 16:54:27 +080096};
Michael Hennerich59003142007-10-21 16:54:27 +080097#endif
98
Michael Hennerich1089e222007-12-24 11:49:29 +080099#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
100static struct resource musb_resources[] = {
101 [0] = {
102 .start = 0xffc03800,
103 .end = 0xffc03cff,
104 .flags = IORESOURCE_MEM,
105 },
106 [1] = { /* general IRQ */
107 .start = IRQ_USB_INT0,
108 .end = IRQ_USB_INT0,
109 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
110 },
111 [2] = { /* DMA IRQ */
112 .start = IRQ_USB_DMA,
113 .end = IRQ_USB_DMA,
114 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
115 },
116};
117
Bryan Wu50041ac2008-10-08 13:39:40 +0800118static struct musb_hdrc_config musb_config = {
119 .multipoint = 0,
120 .dyn_fifo = 0,
121 .soft_con = 1,
122 .dma = 1,
Bryan Wufea05da2009-01-07 23:14:39 +0800123 .num_eps = 8,
124 .dma_channels = 8,
Bryan Wu50041ac2008-10-08 13:39:40 +0800125 .gpio_vrsel = GPIO_PG13,
126};
127
Michael Hennerich1089e222007-12-24 11:49:29 +0800128static struct musb_hdrc_platform_data musb_plat = {
129#if defined(CONFIG_USB_MUSB_OTG)
130 .mode = MUSB_OTG,
131#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
132 .mode = MUSB_HOST,
133#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
134 .mode = MUSB_PERIPHERAL,
135#endif
Bryan Wu50041ac2008-10-08 13:39:40 +0800136 .config = &musb_config,
Michael Hennerich1089e222007-12-24 11:49:29 +0800137};
138
139static u64 musb_dmamask = ~(u32)0;
140
141static struct platform_device musb_device = {
142 .name = "musb_hdrc",
143 .id = 0,
144 .dev = {
145 .dma_mask = &musb_dmamask,
146 .coherent_dma_mask = 0xffffffff,
147 .platform_data = &musb_plat,
148 },
149 .num_resources = ARRAY_SIZE(musb_resources),
150 .resource = musb_resources,
151};
152#endif
153
154#if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
155
156static struct resource bf52x_t350mcqb_resources[] = {
157 {
158 .start = IRQ_PPI_ERROR,
159 .end = IRQ_PPI_ERROR,
160 .flags = IORESOURCE_IRQ,
161 },
162};
163
164static struct platform_device bf52x_t350mcqb_device = {
165 .name = "bfin-t350mcqb",
166 .id = -1,
167 .num_resources = ARRAY_SIZE(bf52x_t350mcqb_resources),
168 .resource = bf52x_t350mcqb_resources,
169};
170#endif
171
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800172#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
173static struct mtd_partition ezkit_partitions[] = {
174 {
Robin Getzaa582972008-08-05 17:47:29 +0800175 .name = "bootloader(nor)",
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800176 .size = 0x40000,
177 .offset = 0,
178 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800179 .name = "linux kernel(nor)",
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800180 .size = 0x1C0000,
181 .offset = MTDPART_OFS_APPEND,
182 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800183 .name = "file system(nor)",
Michael Hennerichd7e5dd42008-05-07 11:41:26 +0800184 .size = MTDPART_SIZ_FULL,
185 .offset = MTDPART_OFS_APPEND,
186 }
187};
188
189static struct physmap_flash_data ezkit_flash_data = {
190 .width = 2,
191 .parts = ezkit_partitions,
192 .nr_parts = ARRAY_SIZE(ezkit_partitions),
193};
194
195static struct resource ezkit_flash_resource = {
196 .start = 0x20000000,
197 .end = 0x203fffff,
198 .flags = IORESOURCE_MEM,
199};
200
201static struct platform_device ezkit_flash_device = {
202 .name = "physmap-flash",
203 .id = 0,
204 .dev = {
205 .platform_data = &ezkit_flash_data,
206 },
207 .num_resources = 1,
208 .resource = &ezkit_flash_resource,
209};
210#endif
211
Michael Hennerich64307f72007-10-29 16:55:18 +0800212#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
213static struct mtd_partition partition_info[] = {
214 {
Robin Getzaa582972008-08-05 17:47:29 +0800215 .name = "linux kernel(nand)",
Michael Hennerich64307f72007-10-29 16:55:18 +0800216 .offset = 0,
Mike Frysingerf4585a02008-10-13 14:45:21 +0800217 .size = 4 * 1024 * 1024,
Michael Hennerich64307f72007-10-29 16:55:18 +0800218 },
219 {
Robin Getzaa582972008-08-05 17:47:29 +0800220 .name = "file system(nand)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800221 .offset = MTDPART_OFS_APPEND,
222 .size = MTDPART_SIZ_FULL,
Michael Hennerich64307f72007-10-29 16:55:18 +0800223 },
224};
225
226static struct bf5xx_nand_platform bf5xx_nand_platform = {
227 .page_size = NFC_PG_SIZE_256,
228 .data_width = NFC_NWIDTH_8,
229 .partitions = partition_info,
230 .nr_partitions = ARRAY_SIZE(partition_info),
231 .rd_dly = 3,
232 .wr_dly = 3,
233};
234
235static struct resource bf5xx_nand_resources[] = {
236 {
237 .start = NFC_CTL,
238 .end = NFC_DATA_RD + 2,
239 .flags = IORESOURCE_MEM,
240 },
241 {
242 .start = CH_NFC,
243 .end = CH_NFC,
244 .flags = IORESOURCE_IRQ,
245 },
246};
247
248static struct platform_device bf5xx_nand_device = {
249 .name = "bf5xx-nand",
250 .id = 0,
251 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
252 .resource = bf5xx_nand_resources,
253 .dev = {
254 .platform_data = &bf5xx_nand_platform,
255 },
256};
257#endif
258
Michael Hennerich59003142007-10-21 16:54:27 +0800259#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
260static struct resource bfin_pcmcia_cf_resources[] = {
261 {
262 .start = 0x20310000, /* IO PORT */
263 .end = 0x20312000,
264 .flags = IORESOURCE_MEM,
265 }, {
266 .start = 0x20311000, /* Attribute Memory */
267 .end = 0x20311FFF,
268 .flags = IORESOURCE_MEM,
269 }, {
270 .start = IRQ_PF4,
271 .end = IRQ_PF4,
272 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
273 }, {
274 .start = 6, /* Card Detect PF6 */
275 .end = 6,
276 .flags = IORESOURCE_IRQ,
277 },
278};
279
280static struct platform_device bfin_pcmcia_cf_device = {
281 .name = "bfin_cf_pcmcia",
282 .id = -1,
283 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
284 .resource = bfin_pcmcia_cf_resources,
285};
286#endif
287
288#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
289static struct platform_device rtc_device = {
290 .name = "rtc-bfin",
291 .id = -1,
292};
293#endif
294
295#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
296static struct resource smc91x_resources[] = {
297 {
298 .name = "smc91x-regs",
299 .start = 0x20300300,
300 .end = 0x20300300 + 16,
301 .flags = IORESOURCE_MEM,
302 }, {
303
304 .start = IRQ_PF7,
305 .end = IRQ_PF7,
306 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
307 },
308};
309static struct platform_device smc91x_device = {
310 .name = "smc91x",
311 .id = 0,
312 .num_resources = ARRAY_SIZE(smc91x_resources),
313 .resource = smc91x_resources,
314};
315#endif
316
317#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
318static struct resource dm9000_resources[] = {
319 [0] = {
320 .start = 0x203FB800,
Laurent Pinchartda3854f2008-06-24 22:15:58 +0100321 .end = 0x203FB800 + 1,
Michael Hennerich59003142007-10-21 16:54:27 +0800322 .flags = IORESOURCE_MEM,
323 },
324 [1] = {
Laurent Pinchartda3854f2008-06-24 22:15:58 +0100325 .start = 0x203FB800 + 4,
326 .end = 0x203FB800 + 5,
327 .flags = IORESOURCE_MEM,
328 },
329 [2] = {
Michael Hennerich59003142007-10-21 16:54:27 +0800330 .start = IRQ_PF9,
331 .end = IRQ_PF9,
332 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
333 },
334};
335
336static 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)
345static 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)
362void sl811_port_power(struct device *dev, int is_on)
363{
364 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
Michael Hennerichacbcd262008-01-22 18:36:20 +0800365 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
Michael Hennerich59003142007-10-21 16:54:27 +0800366}
367#endif
368
369static 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
377static 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)
389static 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
405static 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
416static 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)
Graf Yang65319622009-02-04 16:49:45 +0800428static struct platform_device bfin_mii_bus = {
429 .name = "bfin_mii_bus",
430};
431
Michael Hennerich59003142007-10-21 16:54:27 +0800432static struct platform_device bfin_mac_device = {
433 .name = "bfin_mac",
Graf Yang65319622009-02-04 16:49:45 +0800434 .dev.platform_data = &bfin_mii_bus,
Michael Hennerich59003142007-10-21 16:54:27 +0800435};
436#endif
437
438#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
439static struct resource net2272_bfin_resources[] = {
440 {
441 .start = 0x20300000,
442 .end = 0x20300000 + 0x100,
443 .flags = IORESOURCE_MEM,
444 }, {
445 .start = IRQ_PF7,
446 .end = IRQ_PF7,
447 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
448 },
449};
450
451static struct platform_device net2272_bfin_device = {
452 .name = "net2272",
453 .id = -1,
454 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
455 .resource = net2272_bfin_resources,
456};
457#endif
458
Michael Hennerich59003142007-10-21 16:54:27 +0800459#if defined(CONFIG_MTD_M25P80) \
460 || defined(CONFIG_MTD_M25P80_MODULE)
461static struct mtd_partition bfin_spi_flash_partitions[] = {
462 {
Robin Getzaa582972008-08-05 17:47:29 +0800463 .name = "bootloader(spi)",
Grace Panac76d882008-04-24 06:33:56 +0800464 .size = 0x00040000,
Michael Hennerich59003142007-10-21 16:54:27 +0800465 .offset = 0,
466 .mask_flags = MTD_CAP_ROM
467 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800468 .name = "linux kernel(spi)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800469 .size = MTDPART_SIZ_FULL,
470 .offset = MTDPART_OFS_APPEND,
Michael Hennerich59003142007-10-21 16:54:27 +0800471 }
472};
473
474static struct flash_platform_data bfin_spi_flash_data = {
475 .name = "m25p80",
476 .parts = bfin_spi_flash_partitions,
477 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
Michael Hennerichb9c9e782008-05-07 11:41:26 +0800478 .type = "m25p16",
Michael Hennerich59003142007-10-21 16:54:27 +0800479};
480
481/* SPI flash chip (m25p64) */
482static struct bfin5xx_spi_chip spi_flash_chip_info = {
483 .enable_dma = 0, /* use dma transfer with this chip*/
484 .bits_per_word = 8,
485};
486#endif
487
488#if defined(CONFIG_SPI_ADC_BF533) \
489 || defined(CONFIG_SPI_ADC_BF533_MODULE)
490/* SPI ADC chip */
491static struct bfin5xx_spi_chip spi_adc_chip_info = {
492 .enable_dma = 1, /* use dma transfer with this chip*/
493 .bits_per_word = 16,
494};
495#endif
496
497#if defined(CONFIG_SND_BLACKFIN_AD1836) \
498 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
499static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
500 .enable_dma = 0,
501 .bits_per_word = 16,
502};
503#endif
504
505#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
506static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
507 .enable_dma = 0,
508 .bits_per_word = 16,
509};
510#endif
511
Michael Hennerich59003142007-10-21 16:54:27 +0800512#if defined(CONFIG_PBX)
513static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
514 .ctl_reg = 0x4, /* send zero */
515 .enable_dma = 0,
516 .bits_per_word = 8,
517 .cs_change_per_word = 1,
518};
519#endif
520
Michael Hennerich59003142007-10-21 16:54:27 +0800521#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
522static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
523 .enable_dma = 0,
524 .bits_per_word = 16,
525};
526
527static const struct ad7877_platform_data bfin_ad7877_ts_info = {
528 .model = 7877,
529 .vref_delay_usecs = 50, /* internal, no capacitor */
530 .x_plate_ohms = 419,
531 .y_plate_ohms = 486,
532 .pressure_max = 1000,
533 .pressure_min = 0,
534 .stopacq_polarity = 1,
535 .first_conversion_delay = 3,
536 .acquisition_time = 1,
537 .averaging = 1,
538 .pen_down_acc_interval = 1,
539};
540#endif
541
Michael Hennerich51054322009-01-07 23:14:38 +0800542#if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
543#include <linux/spi/ad7879.h>
544static const struct ad7879_platform_data bfin_ad7879_ts_info = {
545 .model = 7879, /* Model = AD7879 */
546 .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
547 .pressure_max = 10000,
548 .pressure_min = 0,
549 .first_conversion_delay = 3, /* wait 512us before do a first conversion */
550 .acquisition_time = 1, /* 4us acquisition time per sample */
551 .median = 2, /* do 8 measurements */
552 .averaging = 1, /* take the average of 4 middle samples */
553 .pen_down_acc_interval = 255, /* 9.4 ms */
554 .gpio_output = 1, /* configure AUX/VBAT/GPIO as GPIO output */
555 .gpio_default = 1, /* During initialization set GPIO = HIGH */
556};
557#endif
558
559#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
560static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
561 .enable_dma = 0,
562 .bits_per_word = 16,
563};
564#endif
565
Michael Hennerichc7d48962007-11-15 21:33:31 +0800566#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
Michael Hennerich0954f702007-11-13 00:16:19 +0800567 && defined(CONFIG_SND_SOC_WM8731_SPI)
568static struct bfin5xx_spi_chip spi_wm8731_chip_info = {
569 .enable_dma = 0,
570 .bits_per_word = 16,
571};
572#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800573
574#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
575static struct bfin5xx_spi_chip spidev_chip_info = {
576 .enable_dma = 0,
577 .bits_per_word = 8,
578};
579#endif
580
Michael Hennerich59003142007-10-21 16:54:27 +0800581static struct spi_board_info bfin_spi_board_info[] __initdata = {
582#if defined(CONFIG_MTD_M25P80) \
583 || defined(CONFIG_MTD_M25P80_MODULE)
584 {
585 /* the modalias must be the same as spi device driver name */
586 .modalias = "m25p80", /* Name of spi_driver for this device */
587 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
588 .bus_num = 0, /* Framework bus number */
589 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
590 .platform_data = &bfin_spi_flash_data,
591 .controller_data = &spi_flash_chip_info,
592 .mode = SPI_MODE_3,
593 },
594#endif
595
596#if defined(CONFIG_SPI_ADC_BF533) \
597 || defined(CONFIG_SPI_ADC_BF533_MODULE)
598 {
599 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
600 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
601 .bus_num = 0, /* Framework bus number */
602 .chip_select = 1, /* Framework chip select. */
603 .platform_data = NULL, /* No spi_driver specific config */
604 .controller_data = &spi_adc_chip_info,
605 },
606#endif
607
608#if defined(CONFIG_SND_BLACKFIN_AD1836) \
609 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
610 {
611 .modalias = "ad1836-spi",
612 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
613 .bus_num = 0,
614 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
615 .controller_data = &ad1836_spi_chip_info,
616 },
617#endif
618#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
619 {
620 .modalias = "ad9960-spi",
621 .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
622 .bus_num = 0,
623 .chip_select = 1,
624 .controller_data = &ad9960_spi_chip_info,
625 },
626#endif
Michael Hennerich59003142007-10-21 16:54:27 +0800627#if defined(CONFIG_PBX)
628 {
629 .modalias = "fxs-spi",
630 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
631 .bus_num = 0,
632 .chip_select = 8 - CONFIG_J11_JUMPER,
633 .controller_data = &spi_si3xxx_chip_info,
634 .mode = SPI_MODE_3,
635 },
636 {
637 .modalias = "fxo-spi",
638 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
639 .bus_num = 0,
640 .chip_select = 8 - CONFIG_J19_JUMPER,
641 .controller_data = &spi_si3xxx_chip_info,
642 .mode = SPI_MODE_3,
643 },
644#endif
Michael Hennerich59003142007-10-21 16:54:27 +0800645#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
646 {
647 .modalias = "ad7877",
648 .platform_data = &bfin_ad7877_ts_info,
Bryan Wu2eb74ae2008-05-31 15:17:25 +0800649 .irq = IRQ_PF8,
Michael Hennerich59003142007-10-21 16:54:27 +0800650 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
Michael Hennerich0954f702007-11-13 00:16:19 +0800651 .bus_num = 0,
Bryan Wu2eb74ae2008-05-31 15:17:25 +0800652 .chip_select = 2,
Michael Hennerich59003142007-10-21 16:54:27 +0800653 .controller_data = &spi_ad7877_chip_info,
654 },
655#endif
Michael Hennerich51054322009-01-07 23:14:38 +0800656#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
657 {
658 .modalias = "ad7879",
659 .platform_data = &bfin_ad7879_ts_info,
660 .irq = IRQ_PF8,
661 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
662 .bus_num = 0,
663 .chip_select = 3,
664 .controller_data = &spi_ad7879_chip_info,
665 .mode = SPI_CPHA | SPI_CPOL,
666 },
667#endif
Michael Hennerichc7d48962007-11-15 21:33:31 +0800668#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
Michael Hennerich0954f702007-11-13 00:16:19 +0800669 && defined(CONFIG_SND_SOC_WM8731_SPI)
670 {
671 .modalias = "wm8731",
672 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
673 .bus_num = 0,
674 .chip_select = 5,
675 .controller_data = &spi_wm8731_chip_info,
676 .mode = SPI_MODE_0,
677 },
678#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800679#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
680 {
681 .modalias = "spidev",
682 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
683 .bus_num = 0,
684 .chip_select = 1,
685 .controller_data = &spidev_chip_info,
686 },
687#endif
Michael Hennerich59003142007-10-21 16:54:27 +0800688};
689
Mike Frysinger5bda2722008-06-07 15:03:01 +0800690#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Michael Hennerich59003142007-10-21 16:54:27 +0800691/* SPI controller data */
692static struct bfin5xx_spi_master bfin_spi0_info = {
693 .num_chipselect = 8,
694 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800695 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Michael Hennerich59003142007-10-21 16:54:27 +0800696};
697
698/* SPI (0) */
699static struct resource bfin_spi0_resource[] = {
700 [0] = {
701 .start = SPI0_REGBASE,
702 .end = SPI0_REGBASE + 0xFF,
703 .flags = IORESOURCE_MEM,
704 },
705 [1] = {
706 .start = CH_SPI,
707 .end = CH_SPI,
708 .flags = IORESOURCE_IRQ,
709 },
710};
711
712static struct platform_device bfin_spi0_device = {
713 .name = "bfin-spi",
714 .id = 0, /* Bus number */
715 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
716 .resource = bfin_spi0_resource,
717 .dev = {
718 .platform_data = &bfin_spi0_info, /* Passed to driver */
719 },
720};
721#endif /* spi master and devices */
722
723#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
724static struct platform_device bfin_fb_device = {
725 .name = "bf537-lq035",
726};
727#endif
728
729#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
730static struct platform_device bfin_fb_adv7393_device = {
731 .name = "bfin-adv7393",
732};
733#endif
734
735#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
736static struct resource bfin_uart_resources[] = {
737#ifdef CONFIG_SERIAL_BFIN_UART0
738 {
739 .start = 0xFFC00400,
740 .end = 0xFFC004FF,
741 .flags = IORESOURCE_MEM,
742 },
743#endif
744#ifdef CONFIG_SERIAL_BFIN_UART1
745 {
746 .start = 0xFFC02000,
747 .end = 0xFFC020FF,
748 .flags = IORESOURCE_MEM,
749 },
750#endif
751};
752
753static struct platform_device bfin_uart_device = {
754 .name = "bfin-uart",
755 .id = 1,
756 .num_resources = ARRAY_SIZE(bfin_uart_resources),
757 .resource = bfin_uart_resources,
758};
759#endif
760
Graf Yang5be36d22008-04-25 03:09:15 +0800761#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang5be36d22008-04-25 03:09:15 +0800762#ifdef CONFIG_BFIN_SIR0
Graf Yang42bd8bc2009-01-07 23:14:39 +0800763static struct resource bfin_sir0_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800764 {
765 .start = 0xFFC00400,
766 .end = 0xFFC004FF,
767 .flags = IORESOURCE_MEM,
768 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800769 {
770 .start = IRQ_UART0_RX,
771 .end = IRQ_UART0_RX+1,
772 .flags = IORESOURCE_IRQ,
773 },
774 {
775 .start = CH_UART0_RX,
776 .end = CH_UART0_RX+1,
777 .flags = IORESOURCE_DMA,
778 },
779};
780
781static struct platform_device bfin_sir0_device = {
782 .name = "bfin_sir",
783 .id = 0,
784 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
785 .resource = bfin_sir0_resources,
786};
Graf Yang5be36d22008-04-25 03:09:15 +0800787#endif
788#ifdef CONFIG_BFIN_SIR1
Graf Yang42bd8bc2009-01-07 23:14:39 +0800789static struct resource bfin_sir1_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800790 {
791 .start = 0xFFC02000,
792 .end = 0xFFC020FF,
793 .flags = IORESOURCE_MEM,
794 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800795 {
796 .start = IRQ_UART1_RX,
797 .end = IRQ_UART1_RX+1,
798 .flags = IORESOURCE_IRQ,
799 },
800 {
801 .start = CH_UART1_RX,
802 .end = CH_UART1_RX+1,
803 .flags = IORESOURCE_DMA,
804 },
Graf Yang5be36d22008-04-25 03:09:15 +0800805};
806
Graf Yang42bd8bc2009-01-07 23:14:39 +0800807static struct platform_device bfin_sir1_device = {
Graf Yang5be36d22008-04-25 03:09:15 +0800808 .name = "bfin_sir",
Graf Yang42bd8bc2009-01-07 23:14:39 +0800809 .id = 1,
810 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
811 .resource = bfin_sir1_resources,
Graf Yang5be36d22008-04-25 03:09:15 +0800812};
813#endif
Graf Yang42bd8bc2009-01-07 23:14:39 +0800814#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800815
Michael Hennerich59003142007-10-21 16:54:27 +0800816#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
817static struct resource bfin_twi0_resource[] = {
818 [0] = {
819 .start = TWI0_REGBASE,
820 .end = TWI0_REGBASE,
821 .flags = IORESOURCE_MEM,
822 },
823 [1] = {
824 .start = IRQ_TWI,
825 .end = IRQ_TWI,
826 .flags = IORESOURCE_IRQ,
827 },
828};
829
830static struct platform_device i2c_bfin_twi_device = {
831 .name = "i2c-bfin-twi",
832 .id = 0,
833 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
834 .resource = bfin_twi0_resource,
835};
836#endif
837
Bryan Wu72268682008-05-07 11:41:26 +0800838static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
839#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
840 {
841 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
Bryan Wu72268682008-05-07 11:41:26 +0800842 },
843#endif
844#if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
845 {
846 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
Bryan Wu72268682008-05-07 11:41:26 +0800847 .irq = IRQ_PF8,
848 },
849#endif
850};
Bryan Wu72268682008-05-07 11:41:26 +0800851
Michael Hennerich59003142007-10-21 16:54:27 +0800852#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
853static struct platform_device bfin_sport0_uart_device = {
854 .name = "bfin-sport-uart",
855 .id = 0,
856};
857
858static struct platform_device bfin_sport1_uart_device = {
859 .name = "bfin-sport-uart",
860 .id = 1,
861};
862#endif
863
Michael Hennerich1089e222007-12-24 11:49:29 +0800864#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
865#include <linux/input.h>
866#include <linux/gpio_keys.h>
867
868static struct gpio_keys_button bfin_gpio_keys_table[] = {
869 {BTN_0, GPIO_PG0, 1, "gpio-keys: BTN0"},
870 {BTN_1, GPIO_PG13, 1, "gpio-keys: BTN1"},
871};
872
873static struct gpio_keys_platform_data bfin_gpio_keys_data = {
874 .buttons = bfin_gpio_keys_table,
875 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
876};
877
878static struct platform_device bfin_device_gpiokeys = {
879 .name = "gpio-keys",
880 .dev = {
881 .platform_data = &bfin_gpio_keys_data,
882 },
883};
884#endif
885
Michael Hennerichaca5e4a2008-10-08 14:27:59 +0800886#if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE)
887#include <linux/input.h>
888#include <asm/bfin_rotary.h>
889
890static struct bfin_rotary_platform_data bfin_rotary_data = {
891 /*.rotary_up_key = KEY_UP,*/
892 /*.rotary_down_key = KEY_DOWN,*/
893 .rotary_rel_code = REL_WHEEL,
894 .rotary_button_key = KEY_ENTER,
895 .debounce = 10, /* 0..17 */
896 .mode = ROT_QUAD_ENC | ROT_DEBE,
897};
898
899static struct resource bfin_rotary_resources[] = {
900 {
901 .start = IRQ_CNT,
902 .end = IRQ_CNT,
903 .flags = IORESOURCE_IRQ,
904 },
905};
906
907static struct platform_device bfin_rotary_device = {
908 .name = "bfin-rotary",
909 .id = -1,
910 .num_resources = ARRAY_SIZE(bfin_rotary_resources),
911 .resource = bfin_rotary_resources,
912 .dev = {
913 .platform_data = &bfin_rotary_data,
914 },
915};
916#endif
917
Mike Frysingercad2ab62008-02-22 17:01:31 +0800918static struct resource bfin_gpios_resources = {
919 .start = 0,
920 .end = MAX_BLACKFIN_GPIOS - 1,
921 .flags = IORESOURCE_IRQ,
922};
923
924static struct platform_device bfin_gpios_device = {
925 .name = "simple-gpio",
926 .id = -1,
927 .num_resources = 1,
928 .resource = &bfin_gpios_resources,
929};
930
Michael Hennerich14b03202008-05-07 11:41:26 +0800931static const unsigned int cclk_vlev_datasheet[] =
932{
933 VRPAIR(VLEV_100, 400000000),
934 VRPAIR(VLEV_105, 426000000),
935 VRPAIR(VLEV_110, 500000000),
936 VRPAIR(VLEV_115, 533000000),
937 VRPAIR(VLEV_120, 600000000),
938};
939
940static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
941 .tuple_tab = cclk_vlev_datasheet,
942 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
943 .vr_settling_time = 25 /* us */,
944};
945
946static struct platform_device bfin_dpmc = {
947 .name = "bfin dpmc",
948 .dev = {
949 .platform_data = &bfin_dmpc_vreg_data,
950 },
951};
952
Michael Hennerich59003142007-10-21 16:54:27 +0800953static struct platform_device *stamp_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +0800954
955 &bfin_dpmc,
956
Michael Hennerich64307f72007-10-29 16:55:18 +0800957#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
958 &bf5xx_nand_device,
959#endif
960
Michael Hennerich59003142007-10-21 16:54:27 +0800961#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
962 &bfin_pcmcia_cf_device,
963#endif
964
965#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
966 &rtc_device,
967#endif
968
969#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
970 &sl811_hcd_device,
971#endif
972
973#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
974 &isp1362_hcd_device,
975#endif
976
Michael Hennerich3f375692008-11-18 17:48:22 +0800977#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
978 &bfin_isp1760_device,
979#endif
980
Michael Hennerich1089e222007-12-24 11:49:29 +0800981#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
982 &musb_device,
983#endif
984
Michael Hennerich59003142007-10-21 16:54:27 +0800985#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
986 &smc91x_device,
987#endif
988
989#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
990 &dm9000_device,
991#endif
992
993#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
Graf Yang65319622009-02-04 16:49:45 +0800994 &bfin_mii_bus,
Michael Hennerich59003142007-10-21 16:54:27 +0800995 &bfin_mac_device,
996#endif
997
998#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
999 &net2272_bfin_device,
1000#endif
1001
1002#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1003 &bfin_spi0_device,
1004#endif
1005
1006#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
1007 &bfin_fb_device,
1008#endif
1009
Michael Hennerich1089e222007-12-24 11:49:29 +08001010#if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
1011 &bf52x_t350mcqb_device,
1012#endif
1013
Michael Hennerich59003142007-10-21 16:54:27 +08001014#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
1015 &bfin_fb_adv7393_device,
1016#endif
1017
1018#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1019 &bfin_uart_device,
1020#endif
1021
Graf Yang5be36d22008-04-25 03:09:15 +08001022#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang42bd8bc2009-01-07 23:14:39 +08001023#ifdef CONFIG_BFIN_SIR0
1024 &bfin_sir0_device,
1025#endif
1026#ifdef CONFIG_BFIN_SIR1
1027 &bfin_sir1_device,
1028#endif
Graf Yang5be36d22008-04-25 03:09:15 +08001029#endif
1030
Michael Hennerich59003142007-10-21 16:54:27 +08001031#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1032 &i2c_bfin_twi_device,
1033#endif
1034
1035#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1036 &bfin_sport0_uart_device,
1037 &bfin_sport1_uart_device,
1038#endif
1039
Michael Hennerich1089e222007-12-24 11:49:29 +08001040#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1041 &bfin_device_gpiokeys,
1042#endif
Mike Frysingercad2ab62008-02-22 17:01:31 +08001043
Michael Hennerichaca5e4a2008-10-08 14:27:59 +08001044#if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE)
1045 &bfin_rotary_device,
1046#endif
1047
Michael Hennerichd7e5dd42008-05-07 11:41:26 +08001048#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
1049 &ezkit_flash_device,
1050#endif
1051
Mike Frysingercad2ab62008-02-22 17:01:31 +08001052 &bfin_gpios_device,
Michael Hennerich59003142007-10-21 16:54:27 +08001053};
1054
Mike Frysinger7f6678c2009-02-04 16:49:45 +08001055static int __init ezkit_init(void)
Michael Hennerich59003142007-10-21 16:54:27 +08001056{
Harvey Harrisonb85d8582008-04-23 09:39:01 +08001057 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Bryan Wu72268682008-05-07 11:41:26 +08001058 i2c_register_board_info(0, bfin_i2c_board_info,
1059 ARRAY_SIZE(bfin_i2c_board_info));
Michael Hennerich59003142007-10-21 16:54:27 +08001060 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
Mike Frysinger5bda2722008-06-07 15:03:01 +08001061 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
Michael Hennerich59003142007-10-21 16:54:27 +08001062 return 0;
1063}
1064
Mike Frysinger7f6678c2009-02-04 16:49:45 +08001065arch_initcall(ezkit_init);
Michael Hennerich59003142007-10-21 16:54:27 +08001066
1067void native_machine_restart(char *cmd)
1068{
1069 /* workaround reboot hang when booting from SPI */
1070 if ((bfin_read_SYSCR() & 0x7) == 0x3)
Sonic Zhangb52dae32009-02-04 16:49:45 +08001071 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
Michael Hennerich59003142007-10-21 16:54:27 +08001072}
Mike Frysinger137b1522007-11-22 16:07:03 +08001073
Mike Frysinger9862cc52007-11-15 21:21:20 +08001074void bfin_get_ether_addr(char *addr)
Mike Frysinger137b1522007-11-22 16:07:03 +08001075{
Mike Frysinger181afa92008-02-25 11:42:17 +08001076 /* the MAC is stored in OTP memory page 0xDF */
1077 u32 ret;
1078 u64 otp_mac;
1079 u32 (*otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)0xEF00001A;
1080
1081 ret = otp_read(0xDF, 0x00, &otp_mac);
1082 if (!(ret & 0x1)) {
1083 char *otp_mac_p = (char *)&otp_mac;
1084 for (ret = 0; ret < 6; ++ret)
1085 addr[ret] = otp_mac_p[5 - ret];
1086 }
Mike Frysinger137b1522007-11-22 16:07:03 +08001087}
Mike Frysinger9862cc52007-11-15 21:21:20 +08001088EXPORT_SYMBOL(bfin_get_ether_addr);