Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux...
[deliverable/linux.git] / arch / blackfin / mach-bf561 / boards / cm_bf561.c
1 /*
2 * File: arch/blackfin/mach-bf533/boards/cm_bf561.c
3 * Based on: arch/blackfin/mach-bf533/boards/ezkit.c
4 * Author: Aidan Williams <aidan@nicta.com.au> Copyright 2005
5 *
6 * Created: 2006
7 * Description: Board description file
8 *
9 * Modified:
10 * Copyright 2004-2006 Analog Devices Inc.
11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
29
30 #include <linux/device.h>
31 #include <linux/platform_device.h>
32 #include <linux/mtd/mtd.h>
33 #include <linux/mtd/partitions.h>
34 #include <linux/spi/spi.h>
35 #include <linux/spi/flash.h>
36 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
37 #include <linux/usb/isp1362.h>
38 #endif
39 #include <linux/ata_platform.h>
40 #include <linux/irq.h>
41 #include <asm/dma.h>
42 #include <asm/bfin5xx_spi.h>
43 #include <asm/portmux.h>
44 #include <asm/dpmc.h>
45 #include <linux/mtd/physmap.h>
46
47 /*
48 * Name the Board for the /proc/cpuinfo
49 */
50 const char bfin_board_name[] = "Bluetechnix CM BF561";
51
52 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
53 /* all SPI peripherals info goes here */
54
55 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
56 static struct mtd_partition bfin_spi_flash_partitions[] = {
57 {
58 .name = "bootloader(spi)",
59 .size = 0x00020000,
60 .offset = 0,
61 .mask_flags = MTD_CAP_ROM
62 }, {
63 .name = "linux kernel(spi)",
64 .size = 0xe0000,
65 .offset = 0x20000
66 }, {
67 .name = "file system(spi)",
68 .size = 0x700000,
69 .offset = 0x00100000,
70 }
71 };
72
73 static struct flash_platform_data bfin_spi_flash_data = {
74 .name = "m25p80",
75 .parts = bfin_spi_flash_partitions,
76 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
77 .type = "m25p64",
78 };
79
80 /* SPI flash chip (m25p64) */
81 static struct bfin5xx_spi_chip spi_flash_chip_info = {
82 .enable_dma = 0, /* use dma transfer with this chip*/
83 .bits_per_word = 8,
84 };
85 #endif
86
87 #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
88 /* SPI ADC chip */
89 static struct bfin5xx_spi_chip spi_adc_chip_info = {
90 .enable_dma = 1, /* use dma transfer with this chip*/
91 .bits_per_word = 16,
92 };
93 #endif
94
95 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
96 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
97 .enable_dma = 0,
98 .bits_per_word = 16,
99 };
100 #endif
101
102 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
103 static struct bfin5xx_spi_chip mmc_spi_chip_info = {
104 .enable_dma = 0,
105 .bits_per_word = 8,
106 };
107 #endif
108
109 static struct spi_board_info bfin_spi_board_info[] __initdata = {
110 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
111 {
112 /* the modalias must be the same as spi device driver name */
113 .modalias = "m25p80", /* Name of spi_driver for this device */
114 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
115 .bus_num = 0, /* Framework bus number */
116 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
117 .platform_data = &bfin_spi_flash_data,
118 .controller_data = &spi_flash_chip_info,
119 .mode = SPI_MODE_3,
120 },
121 #endif
122
123 #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
124 {
125 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
126 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
127 .bus_num = 0, /* Framework bus number */
128 .chip_select = 1, /* Framework chip select. */
129 .platform_data = NULL, /* No spi_driver specific config */
130 .controller_data = &spi_adc_chip_info,
131 },
132 #endif
133
134 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
135 {
136 .modalias = "ad1836",
137 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
138 .bus_num = 0,
139 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
140 .controller_data = &ad1836_spi_chip_info,
141 },
142 #endif
143 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
144 {
145 .modalias = "mmc_spi",
146 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
147 .bus_num = 0,
148 .chip_select = 1,
149 .controller_data = &mmc_spi_chip_info,
150 .mode = SPI_MODE_3,
151 },
152 #endif
153 };
154
155 /* SPI (0) */
156 static struct resource bfin_spi0_resource[] = {
157 [0] = {
158 .start = SPI0_REGBASE,
159 .end = SPI0_REGBASE + 0xFF,
160 .flags = IORESOURCE_MEM,
161 },
162 [1] = {
163 .start = CH_SPI,
164 .end = CH_SPI,
165 .flags = IORESOURCE_DMA,
166 },
167 [2] = {
168 .start = IRQ_SPI,
169 .end = IRQ_SPI,
170 .flags = IORESOURCE_IRQ,
171 },
172 };
173
174 /* SPI controller data */
175 static struct bfin5xx_spi_master bfin_spi0_info = {
176 .num_chipselect = 8,
177 .enable_dma = 1, /* master has the ability to do dma transfer */
178 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
179 };
180
181 static struct platform_device bfin_spi0_device = {
182 .name = "bfin-spi",
183 .id = 0, /* Bus number */
184 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
185 .resource = bfin_spi0_resource,
186 .dev = {
187 .platform_data = &bfin_spi0_info, /* Passed to driver */
188 },
189 };
190 #endif /* spi master and devices */
191
192
193 #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
194 static struct platform_device hitachi_fb_device = {
195 .name = "hitachi-tx09",
196 };
197 #endif
198
199
200 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
201 #include <linux/smc91x.h>
202
203 static struct smc91x_platdata smc91x_info = {
204 .flags = SMC91X_USE_32BIT | SMC91X_NOWAIT,
205 .leda = RPC_LED_100_10,
206 .ledb = RPC_LED_TX_RX,
207 };
208
209 static struct resource smc91x_resources[] = {
210 {
211 .name = "smc91x-regs",
212 .start = 0x28000300,
213 .end = 0x28000300 + 16,
214 .flags = IORESOURCE_MEM,
215 }, {
216 .start = IRQ_PF0,
217 .end = IRQ_PF0,
218 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
219 },
220 };
221 static struct platform_device smc91x_device = {
222 .name = "smc91x",
223 .id = 0,
224 .num_resources = ARRAY_SIZE(smc91x_resources),
225 .resource = smc91x_resources,
226 .dev = {
227 .platform_data = &smc91x_info,
228 },
229 };
230 #endif
231
232 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
233 #include <linux/smsc911x.h>
234
235 static struct resource smsc911x_resources[] = {
236 {
237 .name = "smsc911x-memory",
238 .start = 0x24008000,
239 .end = 0x24008000 + 0xFF,
240 .flags = IORESOURCE_MEM,
241 },
242 {
243 .start = IRQ_PF43,
244 .end = IRQ_PF43,
245 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
246 },
247 };
248
249 static struct smsc911x_platform_config smsc911x_config = {
250 .flags = SMSC911X_USE_16BIT,
251 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
252 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
253 .phy_interface = PHY_INTERFACE_MODE_MII,
254 };
255
256 static struct platform_device smsc911x_device = {
257 .name = "smsc911x",
258 .id = 0,
259 .num_resources = ARRAY_SIZE(smsc911x_resources),
260 .resource = smsc911x_resources,
261 .dev = {
262 .platform_data = &smsc911x_config,
263 },
264 };
265 #endif
266
267 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
268 static struct resource net2272_bfin_resources[] = {
269 {
270 .start = 0x24000000,
271 .end = 0x24000000 + 0x100,
272 .flags = IORESOURCE_MEM,
273 }, {
274 .start = IRQ_PF45,
275 .end = IRQ_PF45,
276 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
277 },
278 };
279
280 static struct platform_device net2272_bfin_device = {
281 .name = "net2272",
282 .id = -1,
283 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
284 .resource = net2272_bfin_resources,
285 };
286 #endif
287
288 static struct resource bfin_gpios_resources = {
289 .start = 0,
290 .end = MAX_BLACKFIN_GPIOS - 1,
291 .flags = IORESOURCE_IRQ,
292 };
293
294 static struct platform_device bfin_gpios_device = {
295 .name = "simple-gpio",
296 .id = -1,
297 .num_resources = 1,
298 .resource = &bfin_gpios_resources,
299 };
300
301 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
302 static struct resource isp1362_hcd_resources[] = {
303 {
304 .start = 0x24008000,
305 .end = 0x24008000,
306 .flags = IORESOURCE_MEM,
307 }, {
308 .start = 0x24008004,
309 .end = 0x24008004,
310 .flags = IORESOURCE_MEM,
311 }, {
312 .start = IRQ_PF47,
313 .end = IRQ_PF47,
314 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
315 },
316 };
317
318 static struct isp1362_platform_data isp1362_priv = {
319 .sel15Kres = 1,
320 .clknotstop = 0,
321 .oc_enable = 0,
322 .int_act_high = 0,
323 .int_edge_triggered = 0,
324 .remote_wakeup_connected = 0,
325 .no_power_switching = 1,
326 .power_switching_mode = 0,
327 };
328
329 static struct platform_device isp1362_hcd_device = {
330 .name = "isp1362-hcd",
331 .id = 0,
332 .dev = {
333 .platform_data = &isp1362_priv,
334 },
335 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
336 .resource = isp1362_hcd_resources,
337 };
338 #endif
339
340 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
341 static struct resource bfin_uart_resources[] = {
342 {
343 .start = 0xFFC00400,
344 .end = 0xFFC004FF,
345 .flags = IORESOURCE_MEM,
346 },
347 };
348
349 static struct platform_device bfin_uart_device = {
350 .name = "bfin-uart",
351 .id = 1,
352 .num_resources = ARRAY_SIZE(bfin_uart_resources),
353 .resource = bfin_uart_resources,
354 };
355 #endif
356
357 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
358 #ifdef CONFIG_BFIN_SIR0
359 static struct resource bfin_sir0_resources[] = {
360 {
361 .start = 0xFFC00400,
362 .end = 0xFFC004FF,
363 .flags = IORESOURCE_MEM,
364 },
365 {
366 .start = IRQ_UART0_RX,
367 .end = IRQ_UART0_RX+1,
368 .flags = IORESOURCE_IRQ,
369 },
370 {
371 .start = CH_UART0_RX,
372 .end = CH_UART0_RX+1,
373 .flags = IORESOURCE_DMA,
374 },
375 };
376
377 static struct platform_device bfin_sir0_device = {
378 .name = "bfin_sir",
379 .id = 0,
380 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
381 .resource = bfin_sir0_resources,
382 };
383 #endif
384 #endif
385
386 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
387 #define PATA_INT IRQ_PF46
388
389 static struct pata_platform_info bfin_pata_platform_data = {
390 .ioport_shift = 2,
391 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
392 };
393
394 static struct resource bfin_pata_resources[] = {
395 {
396 .start = 0x2400C000,
397 .end = 0x2400C001F,
398 .flags = IORESOURCE_MEM,
399 },
400 {
401 .start = 0x2400D018,
402 .end = 0x2400D01B,
403 .flags = IORESOURCE_MEM,
404 },
405 {
406 .start = PATA_INT,
407 .end = PATA_INT,
408 .flags = IORESOURCE_IRQ,
409 },
410 };
411
412 static struct platform_device bfin_pata_device = {
413 .name = "pata_platform",
414 .id = -1,
415 .num_resources = ARRAY_SIZE(bfin_pata_resources),
416 .resource = bfin_pata_resources,
417 .dev = {
418 .platform_data = &bfin_pata_platform_data,
419 }
420 };
421 #endif
422
423 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
424 static struct mtd_partition para_partitions[] = {
425 {
426 .name = "bootloader(nor)",
427 .size = 0x40000,
428 .offset = 0,
429 }, {
430 .name = "linux kernel(nor)",
431 .size = 0x100000,
432 .offset = MTDPART_OFS_APPEND,
433 }, {
434 .name = "file system(nor)",
435 .size = MTDPART_SIZ_FULL,
436 .offset = MTDPART_OFS_APPEND,
437 }
438 };
439
440 static struct physmap_flash_data para_flash_data = {
441 .width = 2,
442 .parts = para_partitions,
443 .nr_parts = ARRAY_SIZE(para_partitions),
444 };
445
446 static struct resource para_flash_resource = {
447 .start = 0x20000000,
448 .end = 0x207fffff,
449 .flags = IORESOURCE_MEM,
450 };
451
452 static struct platform_device para_flash_device = {
453 .name = "physmap-flash",
454 .id = 0,
455 .dev = {
456 .platform_data = &para_flash_data,
457 },
458 .num_resources = 1,
459 .resource = &para_flash_resource,
460 };
461 #endif
462
463 static const unsigned int cclk_vlev_datasheet[] =
464 {
465 VRPAIR(VLEV_085, 250000000),
466 VRPAIR(VLEV_090, 300000000),
467 VRPAIR(VLEV_095, 313000000),
468 VRPAIR(VLEV_100, 350000000),
469 VRPAIR(VLEV_105, 400000000),
470 VRPAIR(VLEV_110, 444000000),
471 VRPAIR(VLEV_115, 450000000),
472 VRPAIR(VLEV_120, 475000000),
473 VRPAIR(VLEV_125, 500000000),
474 VRPAIR(VLEV_130, 600000000),
475 };
476
477 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
478 .tuple_tab = cclk_vlev_datasheet,
479 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
480 .vr_settling_time = 25 /* us */,
481 };
482
483 static struct platform_device bfin_dpmc = {
484 .name = "bfin dpmc",
485 .dev = {
486 .platform_data = &bfin_dmpc_vreg_data,
487 },
488 };
489
490 static struct platform_device *cm_bf561_devices[] __initdata = {
491
492 &bfin_dpmc,
493
494 #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
495 &hitachi_fb_device,
496 #endif
497
498 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
499 &bfin_uart_device,
500 #endif
501
502 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
503 #ifdef CONFIG_BFIN_SIR0
504 &bfin_sir0_device,
505 #endif
506 #endif
507
508 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
509 &isp1362_hcd_device,
510 #endif
511
512 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
513 &smc91x_device,
514 #endif
515
516 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
517 &smsc911x_device,
518 #endif
519
520 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
521 &net2272_bfin_device,
522 #endif
523
524 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
525 &bfin_spi0_device,
526 #endif
527
528 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
529 &bfin_pata_device,
530 #endif
531
532 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
533 &para_flash_device,
534 #endif
535
536 &bfin_gpios_device,
537 };
538
539 static int __init cm_bf561_init(void)
540 {
541 printk(KERN_INFO "%s(): registering device resources\n", __func__);
542 platform_add_devices(cm_bf561_devices, ARRAY_SIZE(cm_bf561_devices));
543 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
544 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
545 #endif
546
547 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
548 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
549 #endif
550 return 0;
551 }
552
553 arch_initcall(cm_bf561_init);
This page took 0.042971 seconds and 5 git commands to generate.