blob: 08a3f01c98865f15e43bf97bc97bd6d2bc55ffd5 [file] [log] [blame]
Michael Hennerich9db144f2008-07-19 17:16:07 +08001/*
2 * File: arch/blackfin/mach-bf527/boards/cm-bf527.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)
11 * Copyright 2004-2008 Analog Devices Inc.
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>
35#include <linux/mtd/physmap.h>
36#include <linux/spi/spi.h>
37#include <linux/spi/flash.h>
38#include <linux/etherdevice.h>
39#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
40#include <linux/usb/isp1362.h>
41#endif
Michael Hennerich9db144f2008-07-19 17:16:07 +080042#include <linux/i2c.h>
43#include <linux/irq.h>
44#include <linux/interrupt.h>
45#include <linux/usb/sl811.h>
Michael Hennerich9db144f2008-07-19 17:16:07 +080046#include <linux/usb/musb.h>
Michael Hennerich9db144f2008-07-19 17:16:07 +080047#include <asm/dma.h>
48#include <asm/bfin5xx_spi.h>
49#include <asm/reboot.h>
50#include <asm/nand.h>
51#include <asm/portmux.h>
52#include <asm/dpmc.h>
53#include <linux/spi/ad7877.h>
54
55/*
56 * Name the Board for the /proc/cpuinfo
57 */
58const char bfin_board_name[] = "Bluetechnix CM-BF527";
59
60/*
61 * Driver needs to know address, irq and flag pin.
62 */
63
Michael Hennerich9db144f2008-07-19 17:16:07 +080064#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
Michael Hennerich3f375692008-11-18 17:48:22 +080065#include <linux/usb/isp1760.h>
66static struct resource bfin_isp1760_resources[] = {
Michael Hennerich9db144f2008-07-19 17:16:07 +080067 [0] = {
Michael Hennerich3f375692008-11-18 17:48:22 +080068 .start = 0x203C0000,
69 .end = 0x203C0000 + 0x000fffff,
Michael Hennerich9db144f2008-07-19 17:16:07 +080070 .flags = IORESOURCE_MEM,
71 },
72 [1] = {
Michael Hennerich3f375692008-11-18 17:48:22 +080073 .start = IRQ_PF7,
74 .end = IRQ_PF7,
Michael Hennerich9db144f2008-07-19 17:16:07 +080075 .flags = IORESOURCE_IRQ,
76 },
77};
78
Michael Hennerich3f375692008-11-18 17:48:22 +080079static struct isp1760_platform_data isp1760_priv = {
80 .is_isp1761 = 0,
Michael Hennerich3f375692008-11-18 17:48:22 +080081 .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 Hennerich9db144f2008-07-19 17:16:07 +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 Hennerich9db144f2008-07-19 17:16:07 +080096};
Michael Hennerich9db144f2008-07-19 17:16:07 +080097#endif
98
99#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_PF11,
126};
127
Michael Hennerich9db144f2008-07-19 17:16:07 +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 Hennerich9db144f2008-07-19 17:16:07 +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
Michael Hennerich9db144f2008-07-19 17:16:07 +0800154#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
155static struct mtd_partition partition_info[] = {
156 {
Robin Getzaa582972008-08-05 17:47:29 +0800157 .name = "linux kernel(nand)",
Michael Hennerich9db144f2008-07-19 17:16:07 +0800158 .offset = 0,
Mike Frysingerf4585a02008-10-13 14:45:21 +0800159 .size = 4 * 1024 * 1024,
Michael Hennerich9db144f2008-07-19 17:16:07 +0800160 },
161 {
Robin Getzaa582972008-08-05 17:47:29 +0800162 .name = "file system(nand)",
Michael Hennerich9db144f2008-07-19 17:16:07 +0800163 .offset = MTDPART_OFS_APPEND,
164 .size = MTDPART_SIZ_FULL,
165 },
166};
167
168static struct bf5xx_nand_platform bf5xx_nand_platform = {
169 .page_size = NFC_PG_SIZE_256,
170 .data_width = NFC_NWIDTH_8,
171 .partitions = partition_info,
172 .nr_partitions = ARRAY_SIZE(partition_info),
173 .rd_dly = 3,
174 .wr_dly = 3,
175};
176
177static struct resource bf5xx_nand_resources[] = {
178 {
179 .start = NFC_CTL,
180 .end = NFC_DATA_RD + 2,
181 .flags = IORESOURCE_MEM,
182 },
183 {
184 .start = CH_NFC,
185 .end = CH_NFC,
186 .flags = IORESOURCE_IRQ,
187 },
188};
189
190static struct platform_device bf5xx_nand_device = {
191 .name = "bf5xx-nand",
192 .id = 0,
193 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
194 .resource = bf5xx_nand_resources,
195 .dev = {
196 .platform_data = &bf5xx_nand_platform,
197 },
198};
199#endif
200
201#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
202static struct resource bfin_pcmcia_cf_resources[] = {
203 {
204 .start = 0x20310000, /* IO PORT */
205 .end = 0x20312000,
206 .flags = IORESOURCE_MEM,
207 }, {
208 .start = 0x20311000, /* Attribute Memory */
209 .end = 0x20311FFF,
210 .flags = IORESOURCE_MEM,
211 }, {
212 .start = IRQ_PF4,
213 .end = IRQ_PF4,
214 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
215 }, {
216 .start = 6, /* Card Detect PF6 */
217 .end = 6,
218 .flags = IORESOURCE_IRQ,
219 },
220};
221
222static struct platform_device bfin_pcmcia_cf_device = {
223 .name = "bfin_cf_pcmcia",
224 .id = -1,
225 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
226 .resource = bfin_pcmcia_cf_resources,
227};
228#endif
229
230#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
231static struct platform_device rtc_device = {
232 .name = "rtc-bfin",
233 .id = -1,
234};
235#endif
236
237#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
Michael Hennerich61f09b52009-07-24 08:48:31 +0000238#include <linux/smc91x.h>
239
240static struct smc91x_platdata smc91x_info = {
241 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
242 .leda = RPC_LED_100_10,
243 .ledb = RPC_LED_TX_RX,
244};
245
Michael Hennerich9db144f2008-07-19 17:16:07 +0800246static struct resource smc91x_resources[] = {
247 {
248 .name = "smc91x-regs",
249 .start = 0x20300300,
250 .end = 0x20300300 + 16,
251 .flags = IORESOURCE_MEM,
252 }, {
253
254 .start = IRQ_PF7,
255 .end = IRQ_PF7,
256 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
257 },
258};
259static struct platform_device smc91x_device = {
260 .name = "smc91x",
261 .id = 0,
262 .num_resources = ARRAY_SIZE(smc91x_resources),
263 .resource = smc91x_resources,
Michael Hennerich61f09b52009-07-24 08:48:31 +0000264 .dev = {
265 .platform_data = &smc91x_info,
266 },
Michael Hennerich9db144f2008-07-19 17:16:07 +0800267};
268#endif
269
270#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
271static struct resource dm9000_resources[] = {
272 [0] = {
273 .start = 0x203FB800,
Barry Songb3dec4a2009-07-27 06:42:50 +0000274 .end = 0x203FB800 + 1,
Michael Hennerich9db144f2008-07-19 17:16:07 +0800275 .flags = IORESOURCE_MEM,
276 },
277 [1] = {
Barry Songb3dec4a2009-07-27 06:42:50 +0000278 .start = 0x203FB804,
279 .end = 0x203FB804 + 1,
280 .flags = IORESOURCE_MEM,
281 },
282 [2] = {
Michael Hennerich9db144f2008-07-19 17:16:07 +0800283 .start = IRQ_PF9,
284 .end = IRQ_PF9,
285 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
286 },
287};
288
289static struct platform_device dm9000_device = {
290 .name = "dm9000",
291 .id = -1,
292 .num_resources = ARRAY_SIZE(dm9000_resources),
293 .resource = dm9000_resources,
294};
295#endif
296
297#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
298static struct resource sl811_hcd_resources[] = {
299 {
300 .start = 0x20340000,
301 .end = 0x20340000,
302 .flags = IORESOURCE_MEM,
303 }, {
304 .start = 0x20340004,
305 .end = 0x20340004,
306 .flags = IORESOURCE_MEM,
307 }, {
308 .start = CONFIG_USB_SL811_BFIN_IRQ,
309 .end = CONFIG_USB_SL811_BFIN_IRQ,
310 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
311 },
312};
313
314#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
315void sl811_port_power(struct device *dev, int is_on)
316{
317 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
318 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
319}
320#endif
321
322static struct sl811_platform_data sl811_priv = {
323 .potpg = 10,
324 .power = 250, /* == 500mA */
325#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
326 .port_power = &sl811_port_power,
327#endif
328};
329
330static struct platform_device sl811_hcd_device = {
331 .name = "sl811-hcd",
332 .id = 0,
333 .dev = {
334 .platform_data = &sl811_priv,
335 },
336 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
337 .resource = sl811_hcd_resources,
338};
339#endif
340
341#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
342static struct resource isp1362_hcd_resources[] = {
343 {
344 .start = 0x20360000,
345 .end = 0x20360000,
346 .flags = IORESOURCE_MEM,
347 }, {
348 .start = 0x20360004,
349 .end = 0x20360004,
350 .flags = IORESOURCE_MEM,
351 }, {
352 .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
353 .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
354 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
355 },
356};
357
358static struct isp1362_platform_data isp1362_priv = {
359 .sel15Kres = 1,
360 .clknotstop = 0,
361 .oc_enable = 0,
362 .int_act_high = 0,
363 .int_edge_triggered = 0,
364 .remote_wakeup_connected = 0,
365 .no_power_switching = 1,
366 .power_switching_mode = 0,
367};
368
369static struct platform_device isp1362_hcd_device = {
370 .name = "isp1362-hcd",
371 .id = 0,
372 .dev = {
373 .platform_data = &isp1362_priv,
374 },
375 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
376 .resource = isp1362_hcd_resources,
377};
378#endif
379
380#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
Graf Yang65319622009-02-04 16:49:45 +0800381static struct platform_device bfin_mii_bus = {
382 .name = "bfin_mii_bus",
383};
384
Michael Hennerich9db144f2008-07-19 17:16:07 +0800385static struct platform_device bfin_mac_device = {
386 .name = "bfin_mac",
Graf Yang65319622009-02-04 16:49:45 +0800387 .dev.platform_data = &bfin_mii_bus,
Michael Hennerich9db144f2008-07-19 17:16:07 +0800388};
389#endif
390
391#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
392static struct resource net2272_bfin_resources[] = {
393 {
394 .start = 0x20300000,
395 .end = 0x20300000 + 0x100,
396 .flags = IORESOURCE_MEM,
397 }, {
398 .start = IRQ_PF7,
399 .end = IRQ_PF7,
400 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
401 },
402};
403
404static struct platform_device net2272_bfin_device = {
405 .name = "net2272",
406 .id = -1,
407 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
408 .resource = net2272_bfin_resources,
409};
410#endif
411
412#if defined(CONFIG_MTD_M25P80) \
413 || defined(CONFIG_MTD_M25P80_MODULE)
414static struct mtd_partition bfin_spi_flash_partitions[] = {
415 {
Robin Getzaa582972008-08-05 17:47:29 +0800416 .name = "bootloader(spi)",
Michael Hennerich9db144f2008-07-19 17:16:07 +0800417 .size = 0x00040000,
418 .offset = 0,
419 .mask_flags = MTD_CAP_ROM
420 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800421 .name = "linux kernel(spi)",
Michael Hennerich9db144f2008-07-19 17:16:07 +0800422 .size = MTDPART_SIZ_FULL,
423 .offset = MTDPART_OFS_APPEND,
424 }
425};
426
427static struct flash_platform_data bfin_spi_flash_data = {
428 .name = "m25p80",
429 .parts = bfin_spi_flash_partitions,
430 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
431 .type = "m25p16",
432};
433
434/* SPI flash chip (m25p64) */
435static struct bfin5xx_spi_chip spi_flash_chip_info = {
436 .enable_dma = 0, /* use dma transfer with this chip*/
437 .bits_per_word = 8,
438};
439#endif
440
Mike Frysingera261eec2009-05-20 14:05:36 +0000441#if defined(CONFIG_BFIN_SPI_ADC) \
442 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
Michael Hennerich9db144f2008-07-19 17:16:07 +0800443/* SPI ADC chip */
444static struct bfin5xx_spi_chip spi_adc_chip_info = {
445 .enable_dma = 1, /* use dma transfer with this chip*/
446 .bits_per_word = 16,
447};
448#endif
449
450#if defined(CONFIG_SND_BLACKFIN_AD1836) \
451 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
452static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
453 .enable_dma = 0,
454 .bits_per_word = 16,
455};
456#endif
457
Michael Hennerichf3f704d2009-03-06 00:27:57 +0800458#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
459static struct bfin5xx_spi_chip mmc_spi_chip_info = {
460 .enable_dma = 0,
Michael Hennerich9db144f2008-07-19 17:16:07 +0800461 .bits_per_word = 8,
462};
463#endif
464
Michael Hennerich9db144f2008-07-19 17:16:07 +0800465#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
466static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
467 .enable_dma = 0,
468 .bits_per_word = 16,
469};
470
471static const struct ad7877_platform_data bfin_ad7877_ts_info = {
472 .model = 7877,
473 .vref_delay_usecs = 50, /* internal, no capacitor */
474 .x_plate_ohms = 419,
475 .y_plate_ohms = 486,
476 .pressure_max = 1000,
477 .pressure_min = 0,
478 .stopacq_polarity = 1,
479 .first_conversion_delay = 3,
480 .acquisition_time = 1,
481 .averaging = 1,
482 .pen_down_acc_interval = 1,
483};
484#endif
485
486#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
487 && defined(CONFIG_SND_SOC_WM8731_SPI)
488static struct bfin5xx_spi_chip spi_wm8731_chip_info = {
489 .enable_dma = 0,
490 .bits_per_word = 16,
491};
492#endif
493
494#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
495static struct bfin5xx_spi_chip spidev_chip_info = {
496 .enable_dma = 0,
497 .bits_per_word = 8,
498};
499#endif
500
501static struct spi_board_info bfin_spi_board_info[] __initdata = {
502#if defined(CONFIG_MTD_M25P80) \
503 || defined(CONFIG_MTD_M25P80_MODULE)
504 {
505 /* the modalias must be the same as spi device driver name */
506 .modalias = "m25p80", /* Name of spi_driver for this device */
507 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
508 .bus_num = 0, /* Framework bus number */
509 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
510 .platform_data = &bfin_spi_flash_data,
511 .controller_data = &spi_flash_chip_info,
512 .mode = SPI_MODE_3,
513 },
514#endif
515
Mike Frysingera261eec2009-05-20 14:05:36 +0000516#if defined(CONFIG_BFIN_SPI_ADC) \
517 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
Michael Hennerich9db144f2008-07-19 17:16:07 +0800518 {
519 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
520 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
521 .bus_num = 0, /* Framework bus number */
522 .chip_select = 1, /* Framework chip select. */
523 .platform_data = NULL, /* No spi_driver specific config */
524 .controller_data = &spi_adc_chip_info,
525 },
526#endif
527
528#if defined(CONFIG_SND_BLACKFIN_AD1836) \
529 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
530 {
Barry Songdac98172009-08-13 21:07:37 +0000531 .modalias = "ad1836",
Michael Hennerich9db144f2008-07-19 17:16:07 +0800532 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
533 .bus_num = 0,
534 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
535 .controller_data = &ad1836_spi_chip_info,
536 },
537#endif
Michael Hennerichf3f704d2009-03-06 00:27:57 +0800538#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
Michael Hennerich9db144f2008-07-19 17:16:07 +0800539 {
Michael Hennerichf3f704d2009-03-06 00:27:57 +0800540 .modalias = "mmc_spi",
541 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
Michael Hennerich9db144f2008-07-19 17:16:07 +0800542 .bus_num = 0,
Michael Hennerichf3f704d2009-03-06 00:27:57 +0800543 .chip_select = 5,
544 .controller_data = &mmc_spi_chip_info,
Michael Hennerich9db144f2008-07-19 17:16:07 +0800545 .mode = SPI_MODE_3,
546 },
547#endif
Michael Hennerich9db144f2008-07-19 17:16:07 +0800548#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
549 {
550 .modalias = "ad7877",
551 .platform_data = &bfin_ad7877_ts_info,
552 .irq = IRQ_PF8,
553 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
554 .bus_num = 0,
555 .chip_select = 2,
556 .controller_data = &spi_ad7877_chip_info,
557 },
558#endif
559#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
560 && defined(CONFIG_SND_SOC_WM8731_SPI)
561 {
562 .modalias = "wm8731",
563 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
564 .bus_num = 0,
565 .chip_select = 5,
566 .controller_data = &spi_wm8731_chip_info,
567 .mode = SPI_MODE_0,
568 },
569#endif
570#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
571 {
572 .modalias = "spidev",
573 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
574 .bus_num = 0,
575 .chip_select = 1,
576 .controller_data = &spidev_chip_info,
577 },
578#endif
579};
580
581#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
582/* SPI controller data */
583static struct bfin5xx_spi_master bfin_spi0_info = {
584 .num_chipselect = 8,
585 .enable_dma = 1, /* master has the ability to do dma transfer */
586 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
587};
588
589/* SPI (0) */
590static struct resource bfin_spi0_resource[] = {
591 [0] = {
592 .start = SPI0_REGBASE,
593 .end = SPI0_REGBASE + 0xFF,
594 .flags = IORESOURCE_MEM,
595 },
596 [1] = {
597 .start = CH_SPI,
598 .end = CH_SPI,
Yi Li53122692009-06-05 12:11:11 +0000599 .flags = IORESOURCE_DMA,
600 },
601 [2] = {
602 .start = IRQ_SPI,
603 .end = IRQ_SPI,
Michael Hennerich9db144f2008-07-19 17:16:07 +0800604 .flags = IORESOURCE_IRQ,
605 },
606};
607
608static struct platform_device bfin_spi0_device = {
609 .name = "bfin-spi",
610 .id = 0, /* Bus number */
611 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
612 .resource = bfin_spi0_resource,
613 .dev = {
614 .platform_data = &bfin_spi0_info, /* Passed to driver */
615 },
616};
617#endif /* spi master and devices */
618
619#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
620static struct platform_device bfin_fb_adv7393_device = {
621 .name = "bfin-adv7393",
622};
623#endif
624
Harald Krapfenbauer9c214532009-09-10 15:30:03 +0000625#if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
626static struct mtd_partition cm_partitions[] = {
627 {
628 .name = "bootloader(nor)",
629 .size = 0x40000,
630 .offset = 0,
631 }, {
632 .name = "linux kernel(nor)",
633 .size = 0x100000,
634 .offset = MTDPART_OFS_APPEND,
635 }, {
636 .name = "file system(nor)",
637 .size = MTDPART_SIZ_FULL,
638 .offset = MTDPART_OFS_APPEND,
639 }
640};
641
642static struct physmap_flash_data cm_flash_data = {
643 .width = 2,
644 .parts = cm_partitions,
645 .nr_parts = ARRAY_SIZE(cm_partitions),
646};
647
648static unsigned cm_flash_gpios[] = { GPIO_PH9, GPIO_PG11 };
649
650static struct resource cm_flash_resource[] = {
651 {
652 .name = "cfi_probe",
653 .start = 0x20000000,
654 .end = 0x201fffff,
655 .flags = IORESOURCE_MEM,
656 }, {
657 .start = (unsigned long)cm_flash_gpios,
658 .end = ARRAY_SIZE(cm_flash_gpios),
659 .flags = IORESOURCE_IRQ,
660 }
661};
662
663static struct platform_device cm_flash_device = {
664 .name = "gpio-addr-flash",
665 .id = 0,
666 .dev = {
667 .platform_data = &cm_flash_data,
668 },
669 .num_resources = ARRAY_SIZE(cm_flash_resource),
670 .resource = cm_flash_resource,
671};
672#endif
673
Michael Hennerich9db144f2008-07-19 17:16:07 +0800674#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
675static struct resource bfin_uart_resources[] = {
676#ifdef CONFIG_SERIAL_BFIN_UART0
677 {
678 .start = 0xFFC00400,
679 .end = 0xFFC004FF,
680 .flags = IORESOURCE_MEM,
681 },
682#endif
683#ifdef CONFIG_SERIAL_BFIN_UART1
684 {
685 .start = 0xFFC02000,
686 .end = 0xFFC020FF,
687 .flags = IORESOURCE_MEM,
688 },
689#endif
690};
691
692static struct platform_device bfin_uart_device = {
693 .name = "bfin-uart",
694 .id = 1,
695 .num_resources = ARRAY_SIZE(bfin_uart_resources),
696 .resource = bfin_uart_resources,
697};
698#endif
699
700#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Michael Hennerich9db144f2008-07-19 17:16:07 +0800701#ifdef CONFIG_BFIN_SIR0
Graf Yang42bd8bc2009-01-07 23:14:39 +0800702static struct resource bfin_sir0_resources[] = {
Michael Hennerich9db144f2008-07-19 17:16:07 +0800703 {
704 .start = 0xFFC00400,
705 .end = 0xFFC004FF,
706 .flags = IORESOURCE_MEM,
707 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800708 {
709 .start = IRQ_UART0_RX,
710 .end = IRQ_UART0_RX+1,
711 .flags = IORESOURCE_IRQ,
712 },
713 {
714 .start = CH_UART0_RX,
715 .end = CH_UART0_RX+1,
716 .flags = IORESOURCE_DMA,
717 },
718};
719
720static struct platform_device bfin_sir0_device = {
721 .name = "bfin_sir",
722 .id = 0,
723 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
724 .resource = bfin_sir0_resources,
725};
Michael Hennerich9db144f2008-07-19 17:16:07 +0800726#endif
727#ifdef CONFIG_BFIN_SIR1
Graf Yang42bd8bc2009-01-07 23:14:39 +0800728static struct resource bfin_sir1_resources[] = {
Michael Hennerich9db144f2008-07-19 17:16:07 +0800729 {
730 .start = 0xFFC02000,
731 .end = 0xFFC020FF,
732 .flags = IORESOURCE_MEM,
733 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800734 {
735 .start = IRQ_UART1_RX,
736 .end = IRQ_UART1_RX+1,
737 .flags = IORESOURCE_IRQ,
738 },
739 {
740 .start = CH_UART1_RX,
741 .end = CH_UART1_RX+1,
742 .flags = IORESOURCE_DMA,
743 },
Michael Hennerich9db144f2008-07-19 17:16:07 +0800744};
745
Graf Yang42bd8bc2009-01-07 23:14:39 +0800746static struct platform_device bfin_sir1_device = {
Michael Hennerich9db144f2008-07-19 17:16:07 +0800747 .name = "bfin_sir",
Graf Yang42bd8bc2009-01-07 23:14:39 +0800748 .id = 1,
749 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
750 .resource = bfin_sir1_resources,
Michael Hennerich9db144f2008-07-19 17:16:07 +0800751};
752#endif
Graf Yang42bd8bc2009-01-07 23:14:39 +0800753#endif
Michael Hennerich9db144f2008-07-19 17:16:07 +0800754
755#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
756static struct resource bfin_twi0_resource[] = {
757 [0] = {
758 .start = TWI0_REGBASE,
759 .end = TWI0_REGBASE,
760 .flags = IORESOURCE_MEM,
761 },
762 [1] = {
763 .start = IRQ_TWI,
764 .end = IRQ_TWI,
765 .flags = IORESOURCE_IRQ,
766 },
767};
768
769static struct platform_device i2c_bfin_twi_device = {
770 .name = "i2c-bfin-twi",
771 .id = 0,
772 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
773 .resource = bfin_twi0_resource,
774};
775#endif
776
Michael Hennerich9db144f2008-07-19 17:16:07 +0800777static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
Michael Hennerichebd58332009-07-02 11:00:38 +0000778#if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
Michael Hennerich9db144f2008-07-19 17:16:07 +0800779 {
780 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
Michael Hennerich9db144f2008-07-19 17:16:07 +0800781 },
782#endif
Michael Hennerich204844e2009-06-30 14:57:22 +0000783#if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
Michael Hennerich9db144f2008-07-19 17:16:07 +0800784 {
785 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
Michael Hennerich9db144f2008-07-19 17:16:07 +0800786 .irq = IRQ_PF8,
787 },
788#endif
789};
Michael Hennerich9db144f2008-07-19 17:16:07 +0800790
791#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
792static struct platform_device bfin_sport0_uart_device = {
793 .name = "bfin-sport-uart",
794 .id = 0,
795};
796
797static struct platform_device bfin_sport1_uart_device = {
798 .name = "bfin-sport-uart",
799 .id = 1,
800};
801#endif
802
Michael Hennerich9db144f2008-07-19 17:16:07 +0800803#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
804#include <linux/input.h>
805#include <linux/gpio_keys.h>
806
807static struct gpio_keys_button bfin_gpio_keys_table[] = {
808 {BTN_0, GPIO_PF14, 1, "gpio-keys: BTN0"},
809};
810
811static struct gpio_keys_platform_data bfin_gpio_keys_data = {
812 .buttons = bfin_gpio_keys_table,
813 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
814};
815
816static struct platform_device bfin_device_gpiokeys = {
817 .name = "gpio-keys",
818 .dev = {
819 .platform_data = &bfin_gpio_keys_data,
820 },
821};
822#endif
823
824static struct resource bfin_gpios_resources = {
825 .start = 0,
826 .end = MAX_BLACKFIN_GPIOS - 1,
827 .flags = IORESOURCE_IRQ,
828};
829
830static struct platform_device bfin_gpios_device = {
831 .name = "simple-gpio",
832 .id = -1,
833 .num_resources = 1,
834 .resource = &bfin_gpios_resources,
835};
836
837static const unsigned int cclk_vlev_datasheet[] =
838{
839 VRPAIR(VLEV_100, 400000000),
840 VRPAIR(VLEV_105, 426000000),
841 VRPAIR(VLEV_110, 500000000),
842 VRPAIR(VLEV_115, 533000000),
843 VRPAIR(VLEV_120, 600000000),
844};
845
846static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
847 .tuple_tab = cclk_vlev_datasheet,
848 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
849 .vr_settling_time = 25 /* us */,
850};
851
852static struct platform_device bfin_dpmc = {
853 .name = "bfin dpmc",
854 .dev = {
855 .platform_data = &bfin_dmpc_vreg_data,
856 },
857};
858
Harald Krapfenbauer9c214532009-09-10 15:30:03 +0000859static struct platform_device *cmbf527_devices[] __initdata = {
Michael Hennerich9db144f2008-07-19 17:16:07 +0800860
861 &bfin_dpmc,
862
863#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
864 &bf5xx_nand_device,
865#endif
866
867#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
868 &bfin_pcmcia_cf_device,
869#endif
870
871#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
872 &rtc_device,
873#endif
874
875#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
876 &sl811_hcd_device,
877#endif
878
879#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
880 &isp1362_hcd_device,
881#endif
882
Michael Hennerich3f375692008-11-18 17:48:22 +0800883#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
884 &bfin_isp1760_device,
885#endif
886
Michael Hennerich9db144f2008-07-19 17:16:07 +0800887#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
888 &musb_device,
889#endif
890
891#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
892 &smc91x_device,
893#endif
894
895#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
896 &dm9000_device,
897#endif
898
899#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
Graf Yang65319622009-02-04 16:49:45 +0800900 &bfin_mii_bus,
Michael Hennerich9db144f2008-07-19 17:16:07 +0800901 &bfin_mac_device,
902#endif
903
904#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
905 &net2272_bfin_device,
906#endif
907
908#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
909 &bfin_spi0_device,
910#endif
911
912#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
913 &bfin_fb_adv7393_device,
914#endif
915
916#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
917 &bfin_uart_device,
918#endif
919
920#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang42bd8bc2009-01-07 23:14:39 +0800921#ifdef CONFIG_BFIN_SIR0
922 &bfin_sir0_device,
923#endif
924#ifdef CONFIG_BFIN_SIR1
925 &bfin_sir1_device,
926#endif
Michael Hennerich9db144f2008-07-19 17:16:07 +0800927#endif
928
929#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
930 &i2c_bfin_twi_device,
931#endif
932
933#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
934 &bfin_sport0_uart_device,
935 &bfin_sport1_uart_device,
936#endif
937
Michael Hennerich9db144f2008-07-19 17:16:07 +0800938#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
939 &bfin_device_gpiokeys,
940#endif
941
Harald Krapfenbauer9c214532009-09-10 15:30:03 +0000942#if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
943 &cm_flash_device,
Michael Hennerich9db144f2008-07-19 17:16:07 +0800944#endif
945
946 &bfin_gpios_device,
947};
948
Mike Frysinger7f6678c2009-02-04 16:49:45 +0800949static int __init cm_init(void)
Michael Hennerich9db144f2008-07-19 17:16:07 +0800950{
951 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Michael Hennerich9db144f2008-07-19 17:16:07 +0800952 i2c_register_board_info(0, bfin_i2c_board_info,
953 ARRAY_SIZE(bfin_i2c_board_info));
Harald Krapfenbauer9c214532009-09-10 15:30:03 +0000954 platform_add_devices(cmbf527_devices, ARRAY_SIZE(cmbf527_devices));
Michael Hennerich9db144f2008-07-19 17:16:07 +0800955 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
Michael Hennerich9db144f2008-07-19 17:16:07 +0800956 return 0;
957}
958
Mike Frysinger7f6678c2009-02-04 16:49:45 +0800959arch_initcall(cm_init);
Michael Hennerich9db144f2008-07-19 17:16:07 +0800960
961void native_machine_restart(char *cmd)
962{
963 /* workaround reboot hang when booting from SPI */
964 if ((bfin_read_SYSCR() & 0x7) == 0x3)
Sonic Zhangb52dae32009-02-04 16:49:45 +0800965 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
Michael Hennerich9db144f2008-07-19 17:16:07 +0800966}
967
968void bfin_get_ether_addr(char *addr)
969{
970 random_ether_addr(addr);
971 printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
972}
973EXPORT_SYMBOL(bfin_get_ether_addr);