Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux...
[deliverable/linux.git] / arch / blackfin / mach-bf533 / boards / cm_bf533.c
CommitLineData
1394f032
BW
1/*
2 * File: arch/blackfin/mach-bf533/boards/cm_bf533.c
3 * Based on: arch/blackfin/mach-bf533/boards/ezkit.c
d2d50aa9 4 * Author: Aidan Williams <aidan@nicta.com.au> Copyright 2005
1394f032
BW
5 *
6 * Created: 2005
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>
9c21453e 34#include <linux/mtd/physmap.h>
1394f032
BW
35#include <linux/spi/spi.h>
36#include <linux/spi/flash.h>
9c21453e 37#include <linux/spi/mmc_spi.h>
b964c592 38#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
f02bcec5 39#include <linux/usb/isp1362.h>
b964c592 40#endif
1f83b8f1 41#include <linux/irq.h>
c6c4d7bb 42#include <asm/dma.h>
1394f032 43#include <asm/bfin5xx_spi.h>
5d448dd5 44#include <asm/portmux.h>
14b03204 45#include <asm/dpmc.h>
1394f032
BW
46
47/*
48 * Name the Board for the /proc/cpuinfo
49 */
066954a3 50const char bfin_board_name[] = "Bluetechnix CM BF533";
1394f032
BW
51
52#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
53/* all SPI peripherals info goes here */
a15c2dcf 54#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
1394f032
BW
55static struct mtd_partition bfin_spi_flash_partitions[] = {
56 {
aa582977 57 .name = "bootloader(spi)",
1394f032
BW
58 .size = 0x00020000,
59 .offset = 0,
60 .mask_flags = MTD_CAP_ROM
1f83b8f1 61 }, {
aa582977 62 .name = "linux kernel(spi)",
1394f032
BW
63 .size = 0xe0000,
64 .offset = 0x20000
1f83b8f1 65 }, {
aa582977 66 .name = "file system(spi)",
1394f032
BW
67 .size = 0x700000,
68 .offset = 0x00100000,
69 }
70};
71
72static struct flash_platform_data bfin_spi_flash_data = {
73 .name = "m25p80",
74 .parts = bfin_spi_flash_partitions,
75 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
76 .type = "m25p64",
77};
78
79/* SPI flash chip (m25p64) */
80static struct bfin5xx_spi_chip spi_flash_chip_info = {
81 .enable_dma = 0, /* use dma transfer with this chip*/
82 .bits_per_word = 8,
83};
a15c2dcf 84#endif
1394f032
BW
85
86/* SPI ADC chip */
a261eec0 87#if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
1394f032
BW
88static struct bfin5xx_spi_chip spi_adc_chip_info = {
89 .enable_dma = 1, /* use dma transfer with this chip*/
90 .bits_per_word = 16,
91};
a15c2dcf 92#endif
1394f032
BW
93
94#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
95static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
96 .enable_dma = 0,
97 .bits_per_word = 16,
98};
99#endif
100
f3f704d3
MH
101#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
102static struct bfin5xx_spi_chip mmc_spi_chip_info = {
103 .enable_dma = 0,
a15c2dcf
MH
104 .bits_per_word = 8,
105};
106#endif
107
1394f032 108static struct spi_board_info bfin_spi_board_info[] __initdata = {
a15c2dcf 109#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
1394f032
BW
110 {
111 /* the modalias must be the same as spi device driver name */
112 .modalias = "m25p80", /* Name of spi_driver for this device */
113 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
c6c4d7bb 114 .bus_num = 0, /* Framework bus number */
1394f032
BW
115 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
116 .platform_data = &bfin_spi_flash_data,
117 .controller_data = &spi_flash_chip_info,
118 .mode = SPI_MODE_3,
a15c2dcf
MH
119 },
120#endif
121
a261eec0 122#if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
a15c2dcf 123 {
1394f032
BW
124 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
125 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
c6c4d7bb 126 .bus_num = 0, /* Framework bus number */
1394f032
BW
127 .chip_select = 2, /* Framework chip select. */
128 .platform_data = NULL, /* No spi_driver specific config */
129 .controller_data = &spi_adc_chip_info,
130 },
a15c2dcf
MH
131#endif
132
1394f032
BW
133#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
134 {
dac98174 135 .modalias = "ad1836",
1394f032 136 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
c6c4d7bb 137 .bus_num = 0,
1394f032
BW
138 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
139 .controller_data = &ad1836_spi_chip_info,
140 },
141#endif
a15c2dcf 142
f3f704d3 143#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
a15c2dcf 144 {
f3f704d3 145 .modalias = "mmc_spi",
9c21453e 146 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
a15c2dcf 147 .bus_num = 0,
9c21453e 148 .chip_select = 1,
f3f704d3 149 .controller_data = &mmc_spi_chip_info,
a15c2dcf
MH
150 .mode = SPI_MODE_3,
151 },
152#endif
1394f032
BW
153};
154
c6c4d7bb
BW
155/* SPI (0) */
156static 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,
53122693
YL
165 .flags = IORESOURCE_DMA,
166 },
167 [2] = {
168 .start = IRQ_SPI,
169 .end = IRQ_SPI,
c6c4d7bb
BW
170 .flags = IORESOURCE_IRQ,
171 }
172};
173
1394f032 174/* SPI controller data */
c6c4d7bb 175static struct bfin5xx_spi_master bfin_spi0_info = {
1394f032
BW
176 .num_chipselect = 8,
177 .enable_dma = 1, /* master has the ability to do dma transfer */
5d448dd5 178 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
1394f032
BW
179};
180
c6c4d7bb
BW
181static 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,
1394f032 186 .dev = {
c6c4d7bb 187 .platform_data = &bfin_spi0_info, /* Passed to driver */
1394f032
BW
188 },
189};
190#endif /* spi master and devices */
191
192#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
193static struct platform_device rtc_device = {
194 .name = "rtc-bfin",
195 .id = -1,
196};
197#endif
198
199#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
61f09b5a
MH
200#include <linux/smc91x.h>
201
202static struct smc91x_platdata smc91x_info = {
203 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
204 .leda = RPC_LED_100_10,
205 .ledb = RPC_LED_TX_RX,
206};
207
1394f032
BW
208static struct resource smc91x_resources[] = {
209 {
210 .start = 0x20200300,
211 .end = 0x20200300 + 16,
212 .flags = IORESOURCE_MEM,
1f83b8f1 213 }, {
1394f032
BW
214 .start = IRQ_PF0,
215 .end = IRQ_PF0,
216 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
217 },
218};
219static struct platform_device smc91x_device = {
220 .name = "smc91x",
221 .id = 0,
222 .num_resources = ARRAY_SIZE(smc91x_resources),
223 .resource = smc91x_resources,
61f09b5a
MH
224 .dev = {
225 .platform_data = &smc91x_info,
226 },
1394f032
BW
227};
228#endif
229
9c21453e
HK
230#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
231#include <linux/smsc911x.h>
232
233static struct resource smsc911x_resources[] = {
234 {
235 .name = "smsc911x-memory",
236 .start = 0x20308000,
237 .end = 0x20308000 + 0xFF,
238 .flags = IORESOURCE_MEM,
239 }, {
240 .start = IRQ_PF8,
241 .end = IRQ_PF8,
242 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
243 },
244};
245
246static struct smsc911x_platform_config smsc911x_config = {
247 .flags = SMSC911X_USE_16BIT,
248 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
249 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
250 .phy_interface = PHY_INTERFACE_MODE_MII,
251};
252
253static struct platform_device smsc911x_device = {
254 .name = "smsc911x",
255 .id = 0,
256 .num_resources = ARRAY_SIZE(smsc911x_resources),
257 .resource = smsc911x_resources,
258 .dev = {
259 .platform_data = &smsc911x_config,
260 },
261};
262#endif
263
c97618d3
MF
264static struct resource bfin_gpios_resources = {
265 .start = 0,
266 .end = MAX_BLACKFIN_GPIOS - 1,
267 .flags = IORESOURCE_IRQ,
268};
269
270static struct platform_device bfin_gpios_device = {
271 .name = "simple-gpio",
272 .id = -1,
273 .num_resources = 1,
274 .resource = &bfin_gpios_resources,
275};
276
1394f032
BW
277#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
278static struct resource bfin_uart_resources[] = {
279 {
280 .start = 0xFFC00400,
281 .end = 0xFFC004FF,
282 .flags = IORESOURCE_MEM,
283 },
284};
285
286static struct platform_device bfin_uart_device = {
287 .name = "bfin-uart",
288 .id = 1,
289 .num_resources = ARRAY_SIZE(bfin_uart_resources),
290 .resource = bfin_uart_resources,
291};
292#endif
293
5be36d22 294#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
5be36d22 295#ifdef CONFIG_BFIN_SIR0
42bd8bcb 296static struct resource bfin_sir0_resources[] = {
5be36d22
GY
297 {
298 .start = 0xFFC00400,
299 .end = 0xFFC004FF,
300 .flags = IORESOURCE_MEM,
301 },
42bd8bcb
GY
302 {
303 .start = IRQ_UART0_RX,
304 .end = IRQ_UART0_RX+1,
305 .flags = IORESOURCE_IRQ,
306 },
307 {
308 .start = CH_UART0_RX,
309 .end = CH_UART0_RX+1,
310 .flags = IORESOURCE_DMA,
311 },
5be36d22
GY
312};
313
42bd8bcb 314static struct platform_device bfin_sir0_device = {
5be36d22
GY
315 .name = "bfin_sir",
316 .id = 0,
42bd8bcb
GY
317 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
318 .resource = bfin_sir0_resources,
5be36d22
GY
319};
320#endif
42bd8bcb 321#endif
5be36d22 322
1394f032
BW
323#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
324static struct platform_device bfin_sport0_uart_device = {
325 .name = "bfin-sport-uart",
326 .id = 0,
327};
328
329static struct platform_device bfin_sport1_uart_device = {
330 .name = "bfin-sport-uart",
331 .id = 1,
332};
333#endif
334
335#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
336static struct resource isp1362_hcd_resources[] = {
337 {
338 .start = 0x20308000,
339 .end = 0x20308000,
340 .flags = IORESOURCE_MEM,
1f83b8f1 341 }, {
1394f032
BW
342 .start = 0x20308004,
343 .end = 0x20308004,
344 .flags = IORESOURCE_MEM,
1f83b8f1 345 }, {
1394f032
BW
346 .start = IRQ_PF4,
347 .end = IRQ_PF4,
348 .flags = IORESOURCE_IRQ,
349 },
350};
351
352static struct isp1362_platform_data isp1362_priv = {
353 .sel15Kres = 1,
354 .clknotstop = 0,
355 .oc_enable = 0,
356 .int_act_high = 0,
357 .int_edge_triggered = 0,
358 .remote_wakeup_connected = 0,
359 .no_power_switching = 1,
360 .power_switching_mode = 0,
361};
362
363static struct platform_device isp1362_hcd_device = {
364 .name = "isp1362-hcd",
365 .id = 0,
366 .dev = {
367 .platform_data = &isp1362_priv,
368 },
369 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
370 .resource = isp1362_hcd_resources,
371};
372#endif
373
9c21453e
HK
374
375#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
376static struct resource net2272_bfin_resources[] = {
377 {
378 .start = 0x20300000,
379 .end = 0x20300000 + 0x100,
380 .flags = IORESOURCE_MEM,
381 }, {
382 .start = IRQ_PF6,
383 .end = IRQ_PF6,
384 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
385 },
386};
387
388static struct platform_device net2272_bfin_device = {
389 .name = "net2272",
390 .id = -1,
391 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
392 .resource = net2272_bfin_resources,
393};
394#endif
395
396
397
398#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
399static struct mtd_partition para_partitions[] = {
400 {
401 .name = "bootloader(nor)",
402 .size = 0x40000,
403 .offset = 0,
404 }, {
405 .name = "linux+rootfs(nor)",
406 .size = MTDPART_SIZ_FULL,
407 .offset = MTDPART_OFS_APPEND,
408 },
409};
410
411static struct physmap_flash_data para_flash_data = {
412 .width = 2,
413 .parts = para_partitions,
414 .nr_parts = ARRAY_SIZE(para_partitions),
415};
416
417static struct resource para_flash_resource = {
418 .start = 0x20000000,
419 .end = 0x201fffff,
420 .flags = IORESOURCE_MEM,
421};
422
423static struct platform_device para_flash_device = {
424 .name = "physmap-flash",
425 .id = 0,
426 .dev = {
427 .platform_data = &para_flash_data,
428 },
429 .num_resources = 1,
430 .resource = &para_flash_resource,
431};
432#endif
433
434
435
14b03204
MH
436static const unsigned int cclk_vlev_datasheet[] =
437{
438 VRPAIR(VLEV_085, 250000000),
439 VRPAIR(VLEV_090, 376000000),
440 VRPAIR(VLEV_095, 426000000),
441 VRPAIR(VLEV_100, 426000000),
442 VRPAIR(VLEV_105, 476000000),
443 VRPAIR(VLEV_110, 476000000),
444 VRPAIR(VLEV_115, 476000000),
445 VRPAIR(VLEV_120, 600000000),
446 VRPAIR(VLEV_125, 600000000),
447 VRPAIR(VLEV_130, 600000000),
448};
449
450static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
451 .tuple_tab = cclk_vlev_datasheet,
452 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
453 .vr_settling_time = 25 /* us */,
454};
455
456static struct platform_device bfin_dpmc = {
457 .name = "bfin dpmc",
458 .dev = {
459 .platform_data = &bfin_dmpc_vreg_data,
460 },
461};
462
1394f032 463static struct platform_device *cm_bf533_devices[] __initdata = {
14b03204
MH
464
465 &bfin_dpmc,
466
1394f032
BW
467#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
468 &bfin_uart_device,
469#endif
470
5be36d22 471#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
42bd8bcb
GY
472#ifdef CONFIG_BFIN_SIR0
473 &bfin_sir0_device,
474#endif
5be36d22
GY
475#endif
476
1394f032
BW
477#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
478 &bfin_sport0_uart_device,
479 &bfin_sport1_uart_device,
480#endif
481
482#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
483 &rtc_device,
484#endif
485
486#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
487 &isp1362_hcd_device,
488#endif
489
490#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
491 &smc91x_device,
492#endif
493
9c21453e
HK
494#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
495 &smsc911x_device,
496#endif
497
498#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
499 &net2272_bfin_device,
500#endif
501
1394f032 502#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
c6c4d7bb
BW
503 &bfin_spi0_device,
504#endif
c97618d3 505
9c21453e
HK
506#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
507 &para_flash_device,
508#endif
509
c97618d3 510 &bfin_gpios_device,
1394f032
BW
511};
512
513static int __init cm_bf533_init(void)
514{
b85d858b 515 printk(KERN_INFO "%s(): registering device resources\n", __func__);
1394f032
BW
516 platform_add_devices(cm_bf533_devices, ARRAY_SIZE(cm_bf533_devices));
517#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
518 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
519#endif
520 return 0;
521}
522
523arch_initcall(cm_bf533_init);
This page took 0.411449 seconds and 5 git commands to generate.