blob: 841803038d6fd3ff7ca1854df135be28a20fb365 [file] [log] [blame]
Mike Frysingerb9da3b92008-08-13 15:49:35 +08001/*
Robin Getz96f10502009-09-24 14:11:24 +00002 * Copyright 2004-2009 Analog Devices Inc.
3 * 2008-2009 Bluetechnix
4 * 2005 National ICT Australia (NICTA)
5 * Aidan Williams <aidan@nicta.com.au>
Mike Frysingerb9da3b92008-08-13 15:49:35 +08006 *
Robin Getz96f10502009-09-24 14:11:24 +00007 * Licensed under the GPL-2 or later.
Mike Frysingerb9da3b92008-08-13 15:49:35 +08008 */
9
10#include <linux/device.h>
11#include <linux/etherdevice.h>
12#include <linux/platform_device.h>
13#include <linux/mtd/mtd.h>
14#include <linux/mtd/partitions.h>
15#include <linux/mtd/physmap.h>
16#include <linux/spi/spi.h>
17#include <linux/spi/flash.h>
18#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
19#include <linux/usb/isp1362.h>
20#endif
21#include <linux/ata_platform.h>
22#include <linux/irq.h>
23#include <asm/dma.h>
24#include <asm/bfin5xx_spi.h>
25#include <asm/portmux.h>
26#include <asm/dpmc.h>
Harald Krapfenbauer9c214532009-09-10 15:30:03 +000027#include <linux/spi/mmc_spi.h>
Mike Frysingerb9da3b92008-08-13 15:49:35 +080028
29/*
30 * Name the Board for the /proc/cpuinfo
31 */
32const char bfin_board_name[] = "Bluetechnix TCM BF537";
33
34#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
35/* all SPI peripherals info goes here */
36
37#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
38static struct mtd_partition bfin_spi_flash_partitions[] = {
39 {
40 .name = "bootloader(spi)",
41 .size = 0x00020000,
42 .offset = 0,
43 .mask_flags = MTD_CAP_ROM
44 }, {
45 .name = "linux kernel(spi)",
46 .size = 0xe0000,
47 .offset = 0x20000
48 }, {
49 .name = "file system(spi)",
50 .size = 0x700000,
51 .offset = 0x00100000,
52 }
53};
54
55static struct flash_platform_data bfin_spi_flash_data = {
56 .name = "m25p80",
57 .parts = bfin_spi_flash_partitions,
58 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
59 .type = "m25p64",
60};
61
62/* SPI flash chip (m25p64) */
63static struct bfin5xx_spi_chip spi_flash_chip_info = {
64 .enable_dma = 0, /* use dma transfer with this chip*/
Mike Frysingerb9da3b92008-08-13 15:49:35 +080065};
66#endif
67
Michael Hennerichf3f704d2009-03-06 00:27:57 +080068#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
69static struct bfin5xx_spi_chip mmc_spi_chip_info = {
70 .enable_dma = 0,
Mike Frysingerb9da3b92008-08-13 15:49:35 +080071};
72#endif
73
74static struct spi_board_info bfin_spi_board_info[] __initdata = {
75#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
76 {
77 /* the modalias must be the same as spi device driver name */
78 .modalias = "m25p80", /* Name of spi_driver for this device */
79 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
80 .bus_num = 0, /* Framework bus number */
81 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
82 .platform_data = &bfin_spi_flash_data,
83 .controller_data = &spi_flash_chip_info,
84 .mode = SPI_MODE_3,
85 },
86#endif
87
Barry Song7ba80062010-01-28 09:37:21 +000088#if defined(CONFIG_SND_BF5XX_SOC_AD183X) || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
Mike Frysingerb9da3b92008-08-13 15:49:35 +080089 {
Barry Song7ba80062010-01-28 09:37:21 +000090 .modalias = "ad183x",
Mike Frysingerb9da3b92008-08-13 15:49:35 +080091 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
92 .bus_num = 0,
Barry Song7ba80062010-01-28 09:37:21 +000093 .chip_select = 4,
Mike Frysingerb9da3b92008-08-13 15:49:35 +080094 },
95#endif
96
Michael Hennerichf3f704d2009-03-06 00:27:57 +080097#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
Mike Frysingerb9da3b92008-08-13 15:49:35 +080098 {
Michael Hennerichf3f704d2009-03-06 00:27:57 +080099 .modalias = "mmc_spi",
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800100 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
101 .bus_num = 0,
Harald Krapfenbauer9c214532009-09-10 15:30:03 +0000102 .chip_select = 1,
Michael Hennerichf3f704d2009-03-06 00:27:57 +0800103 .controller_data = &mmc_spi_chip_info,
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800104 .mode = SPI_MODE_3,
105 },
106#endif
107};
108
109/* SPI (0) */
110static struct resource bfin_spi0_resource[] = {
111 [0] = {
112 .start = SPI0_REGBASE,
113 .end = SPI0_REGBASE + 0xFF,
114 .flags = IORESOURCE_MEM,
115 },
116 [1] = {
117 .start = CH_SPI,
118 .end = CH_SPI,
Yi Li53122692009-06-05 12:11:11 +0000119 .flags = IORESOURCE_DMA,
120 },
121 [2] = {
122 .start = IRQ_SPI,
123 .end = IRQ_SPI,
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800124 .flags = IORESOURCE_IRQ,
125 }
126};
127
128/* SPI controller data */
129static struct bfin5xx_spi_master bfin_spi0_info = {
130 .num_chipselect = 8,
131 .enable_dma = 1, /* master has the ability to do dma transfer */
132 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
133};
134
135static struct platform_device bfin_spi0_device = {
136 .name = "bfin-spi",
137 .id = 0, /* Bus number */
138 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
139 .resource = bfin_spi0_resource,
140 .dev = {
141 .platform_data = &bfin_spi0_info, /* Passed to driver */
142 },
143};
144#endif /* spi master and devices */
145
146#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
147static struct platform_device rtc_device = {
148 .name = "rtc-bfin",
149 .id = -1,
150};
151#endif
152
153#if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
154static struct platform_device hitachi_fb_device = {
155 .name = "hitachi-tx09",
156};
157#endif
158
159#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
Michael Hennerich61f09b52009-07-24 08:48:31 +0000160#include <linux/smc91x.h>
161
162static struct smc91x_platdata smc91x_info = {
163 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
164 .leda = RPC_LED_100_10,
165 .ledb = RPC_LED_TX_RX,
166};
167
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800168static struct resource smc91x_resources[] = {
169 {
170 .start = 0x20200300,
171 .end = 0x20200300 + 16,
172 .flags = IORESOURCE_MEM,
173 }, {
174 .start = IRQ_PF14,
175 .end = IRQ_PF14,
176 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
177 },
178};
179
180static struct platform_device smc91x_device = {
181 .name = "smc91x",
182 .id = 0,
183 .num_resources = ARRAY_SIZE(smc91x_resources),
184 .resource = smc91x_resources,
Michael Hennerich61f09b52009-07-24 08:48:31 +0000185 .dev = {
186 .platform_data = &smc91x_info,
187 },
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800188};
189#endif
190
191#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
192static struct resource isp1362_hcd_resources[] = {
193 {
194 .start = 0x20308000,
195 .end = 0x20308000,
196 .flags = IORESOURCE_MEM,
197 }, {
198 .start = 0x20308004,
199 .end = 0x20308004,
200 .flags = IORESOURCE_MEM,
201 }, {
202 .start = IRQ_PG15,
203 .end = IRQ_PG15,
Michael Hennerich9e758942010-03-18 12:51:49 +0000204 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800205 },
206};
207
208static struct isp1362_platform_data isp1362_priv = {
209 .sel15Kres = 1,
210 .clknotstop = 0,
211 .oc_enable = 0,
212 .int_act_high = 0,
213 .int_edge_triggered = 0,
214 .remote_wakeup_connected = 0,
215 .no_power_switching = 1,
216 .power_switching_mode = 0,
217};
218
219static struct platform_device isp1362_hcd_device = {
220 .name = "isp1362-hcd",
221 .id = 0,
222 .dev = {
223 .platform_data = &isp1362_priv,
224 },
225 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
226 .resource = isp1362_hcd_resources,
227};
228#endif
229
230#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
231static struct resource net2272_bfin_resources[] = {
232 {
Harald Krapfenbauer9c214532009-09-10 15:30:03 +0000233 .start = 0x20300000,
234 .end = 0x20300000 + 0x100,
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800235 .flags = IORESOURCE_MEM,
236 }, {
Harald Krapfenbauer9c214532009-09-10 15:30:03 +0000237 .start = IRQ_PG13,
238 .end = IRQ_PG13,
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800239 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
240 },
241};
242
243static struct platform_device net2272_bfin_device = {
244 .name = "net2272",
245 .id = -1,
246 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
247 .resource = net2272_bfin_resources,
248};
249#endif
250
251#if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
252static struct mtd_partition cm_partitions[] = {
253 {
254 .name = "bootloader(nor)",
255 .size = 0x40000,
256 .offset = 0,
257 }, {
258 .name = "linux kernel(nor)",
Harald Krapfenbauer9c214532009-09-10 15:30:03 +0000259 .size = 0x100000,
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800260 .offset = MTDPART_OFS_APPEND,
261 }, {
262 .name = "file system(nor)",
263 .size = MTDPART_SIZ_FULL,
264 .offset = MTDPART_OFS_APPEND,
265 }
266};
267
268static struct physmap_flash_data cm_flash_data = {
269 .width = 2,
270 .parts = cm_partitions,
271 .nr_parts = ARRAY_SIZE(cm_partitions),
272};
273
274static unsigned cm_flash_gpios[] = { GPIO_PF4, GPIO_PF5 };
275
276static struct resource cm_flash_resource[] = {
277 {
278 .name = "cfi_probe",
279 .start = 0x20000000,
280 .end = 0x201fffff,
281 .flags = IORESOURCE_MEM,
282 }, {
283 .start = (unsigned long)cm_flash_gpios,
284 .end = ARRAY_SIZE(cm_flash_gpios),
285 .flags = IORESOURCE_IRQ,
286 }
287};
288
289static struct platform_device cm_flash_device = {
290 .name = "gpio-addr-flash",
291 .id = 0,
292 .dev = {
293 .platform_data = &cm_flash_data,
294 },
295 .num_resources = ARRAY_SIZE(cm_flash_resource),
296 .resource = cm_flash_resource,
297};
298#endif
299
300#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000301#ifdef CONFIG_SERIAL_BFIN_UART0
302static struct resource bfin_uart0_resources[] = {
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800303 {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000304 .start = UART0_THR,
305 .end = UART0_GCTL+2,
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800306 .flags = IORESOURCE_MEM,
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000307 },
308 {
309 .start = IRQ_UART0_RX,
310 .end = IRQ_UART0_RX+1,
311 .flags = IORESOURCE_IRQ,
312 },
313 {
314 .start = IRQ_UART0_ERROR,
315 .end = IRQ_UART0_ERROR,
316 .flags = IORESOURCE_IRQ,
317 },
318 {
319 .start = CH_UART0_TX,
320 .end = CH_UART0_TX,
321 .flags = IORESOURCE_DMA,
322 },
323 {
324 .start = CH_UART0_RX,
325 .end = CH_UART0_RX,
326 .flags = IORESOURCE_DMA,
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800327 },
328};
329
Mike Frysingera8b19882010-11-24 09:23:04 +0000330static unsigned short bfin_uart0_peripherals[] = {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000331 P_UART0_TX, P_UART0_RX, 0
332};
333
334static struct platform_device bfin_uart0_device = {
335 .name = "bfin-uart",
336 .id = 0,
337 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
338 .resource = bfin_uart0_resources,
339 .dev = {
340 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
341 },
342};
343#endif
344#ifdef CONFIG_SERIAL_BFIN_UART1
345static struct resource bfin_uart1_resources[] = {
346 {
347 .start = UART1_THR,
348 .end = UART1_GCTL+2,
349 .flags = IORESOURCE_MEM,
350 },
351 {
352 .start = IRQ_UART1_RX,
353 .end = IRQ_UART1_RX+1,
354 .flags = IORESOURCE_IRQ,
355 },
356 {
357 .start = IRQ_UART1_ERROR,
358 .end = IRQ_UART1_ERROR,
359 .flags = IORESOURCE_IRQ,
360 },
361 {
362 .start = CH_UART1_TX,
363 .end = CH_UART1_TX,
364 .flags = IORESOURCE_DMA,
365 },
366 {
367 .start = CH_UART1_RX,
368 .end = CH_UART1_RX,
369 .flags = IORESOURCE_DMA,
370 },
371};
372
Mike Frysingera8b19882010-11-24 09:23:04 +0000373static unsigned short bfin_uart1_peripherals[] = {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000374 P_UART1_TX, P_UART1_RX, 0
375};
376
377static struct platform_device bfin_uart1_device = {
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800378 .name = "bfin-uart",
379 .id = 1,
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000380 .num_resources = ARRAY_SIZE(bfin_uart1_resources),
381 .resource = bfin_uart1_resources,
382 .dev = {
383 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
384 },
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800385};
386#endif
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000387#endif
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800388
389#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800390#ifdef CONFIG_BFIN_SIR0
Graf Yang42bd8bc2009-01-07 23:14:39 +0800391static struct resource bfin_sir0_resources[] = {
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800392 {
393 .start = 0xFFC00400,
394 .end = 0xFFC004FF,
395 .flags = IORESOURCE_MEM,
396 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800397 {
398 .start = IRQ_UART0_RX,
399 .end = IRQ_UART0_RX+1,
400 .flags = IORESOURCE_IRQ,
401 },
402 {
403 .start = CH_UART0_RX,
404 .end = CH_UART0_RX+1,
405 .flags = IORESOURCE_DMA,
406 },
407};
408
409static struct platform_device bfin_sir0_device = {
410 .name = "bfin_sir",
411 .id = 0,
412 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
413 .resource = bfin_sir0_resources,
414};
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800415#endif
416#ifdef CONFIG_BFIN_SIR1
Graf Yang42bd8bc2009-01-07 23:14:39 +0800417static struct resource bfin_sir1_resources[] = {
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800418 {
419 .start = 0xFFC02000,
420 .end = 0xFFC020FF,
421 .flags = IORESOURCE_MEM,
422 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800423 {
424 .start = IRQ_UART1_RX,
425 .end = IRQ_UART1_RX+1,
426 .flags = IORESOURCE_IRQ,
427 },
428 {
429 .start = CH_UART1_RX,
430 .end = CH_UART1_RX+1,
431 .flags = IORESOURCE_DMA,
432 },
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800433};
434
Graf Yang42bd8bc2009-01-07 23:14:39 +0800435static struct platform_device bfin_sir1_device = {
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800436 .name = "bfin_sir",
Graf Yang42bd8bc2009-01-07 23:14:39 +0800437 .id = 1,
438 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
439 .resource = bfin_sir1_resources,
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800440};
441#endif
Graf Yang42bd8bc2009-01-07 23:14:39 +0800442#endif
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800443
444#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
445static struct resource bfin_twi0_resource[] = {
446 [0] = {
447 .start = TWI0_REGBASE,
448 .end = TWI0_REGBASE,
449 .flags = IORESOURCE_MEM,
450 },
451 [1] = {
452 .start = IRQ_TWI,
453 .end = IRQ_TWI,
454 .flags = IORESOURCE_IRQ,
455 },
456};
457
458static struct platform_device i2c_bfin_twi_device = {
459 .name = "i2c-bfin-twi",
460 .id = 0,
461 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
462 .resource = bfin_twi0_resource,
463};
464#endif
465
466#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
Sonic Zhangdf5de262009-09-23 05:01:56 +0000467#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
468static struct resource bfin_sport0_uart_resources[] = {
469 {
470 .start = SPORT0_TCR1,
471 .end = SPORT0_MRCS3+4,
472 .flags = IORESOURCE_MEM,
473 },
474 {
475 .start = IRQ_SPORT0_RX,
476 .end = IRQ_SPORT0_RX+1,
477 .flags = IORESOURCE_IRQ,
478 },
479 {
480 .start = IRQ_SPORT0_ERROR,
481 .end = IRQ_SPORT0_ERROR,
482 .flags = IORESOURCE_IRQ,
483 },
484};
485
Mike Frysingera8b19882010-11-24 09:23:04 +0000486static unsigned short bfin_sport0_peripherals[] = {
Sonic Zhangdf5de262009-09-23 05:01:56 +0000487 P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
Sonic Zhange54b6732010-11-12 02:45:38 +0000488 P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0
Sonic Zhangdf5de262009-09-23 05:01:56 +0000489};
490
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800491static struct platform_device bfin_sport0_uart_device = {
492 .name = "bfin-sport-uart",
493 .id = 0,
Sonic Zhangdf5de262009-09-23 05:01:56 +0000494 .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
495 .resource = bfin_sport0_uart_resources,
496 .dev = {
497 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
498 },
499};
500#endif
501#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
502static struct resource bfin_sport1_uart_resources[] = {
503 {
504 .start = SPORT1_TCR1,
505 .end = SPORT1_MRCS3+4,
506 .flags = IORESOURCE_MEM,
507 },
508 {
509 .start = IRQ_SPORT1_RX,
510 .end = IRQ_SPORT1_RX+1,
511 .flags = IORESOURCE_IRQ,
512 },
513 {
514 .start = IRQ_SPORT1_ERROR,
515 .end = IRQ_SPORT1_ERROR,
516 .flags = IORESOURCE_IRQ,
517 },
518};
519
Mike Frysingera8b19882010-11-24 09:23:04 +0000520static unsigned short bfin_sport1_peripherals[] = {
Sonic Zhangdf5de262009-09-23 05:01:56 +0000521 P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
Sonic Zhange54b6732010-11-12 02:45:38 +0000522 P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800523};
524
525static struct platform_device bfin_sport1_uart_device = {
526 .name = "bfin-sport-uart",
527 .id = 1,
Sonic Zhangdf5de262009-09-23 05:01:56 +0000528 .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
529 .resource = bfin_sport1_uart_resources,
530 .dev = {
531 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
532 },
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800533};
534#endif
Sonic Zhangdf5de262009-09-23 05:01:56 +0000535#endif
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800536
537#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
Sonic Zhang02460d02010-06-11 10:44:22 +0000538#include <linux/bfin_mac.h>
Paul Gortmaker8dc7a9c2011-08-09 11:05:22 -0400539#include <linux/export.h>
Sonic Zhang02460d02010-06-11 10:44:22 +0000540static const unsigned short bfin_mac_peripherals[] = P_MII0;
541
542static struct bfin_phydev_platform_data bfin_phydev_data[] = {
543 {
544 .addr = 1,
545 .irq = IRQ_MAC_PHYINT,
546 },
547};
548
549static struct bfin_mii_bus_platform_data bfin_mii_bus_data = {
550 .phydev_number = 1,
551 .phydev_data = bfin_phydev_data,
552 .phy_mode = PHY_INTERFACE_MODE_MII,
553 .mac_peripherals = bfin_mac_peripherals,
554};
555
Graf Yang65319622009-02-04 16:49:45 +0800556static struct platform_device bfin_mii_bus = {
557 .name = "bfin_mii_bus",
Sonic Zhang02460d02010-06-11 10:44:22 +0000558 .dev = {
559 .platform_data = &bfin_mii_bus_data,
560 }
Graf Yang65319622009-02-04 16:49:45 +0800561};
562
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800563static struct platform_device bfin_mac_device = {
564 .name = "bfin_mac",
Sonic Zhang02460d02010-06-11 10:44:22 +0000565 .dev = {
566 .platform_data = &bfin_mii_bus,
567 }
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800568};
569#endif
570
571#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
Mike Frysingerfe5aeb92008-08-05 18:29:56 +0800572#define PATA_INT IRQ_PF14
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800573
574static struct pata_platform_info bfin_pata_platform_data = {
575 .ioport_shift = 2,
Yong Zhang7832bb52011-09-07 16:10:03 +0800576 .irq_type = IRQF_TRIGGER_HIGH,
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800577};
578
579static struct resource bfin_pata_resources[] = {
580 {
581 .start = 0x2030C000,
582 .end = 0x2030C01F,
583 .flags = IORESOURCE_MEM,
584 },
585 {
586 .start = 0x2030D018,
587 .end = 0x2030D01B,
588 .flags = IORESOURCE_MEM,
589 },
590 {
591 .start = PATA_INT,
592 .end = PATA_INT,
593 .flags = IORESOURCE_IRQ,
594 },
595};
596
597static struct platform_device bfin_pata_device = {
598 .name = "pata_platform",
599 .id = -1,
600 .num_resources = ARRAY_SIZE(bfin_pata_resources),
601 .resource = bfin_pata_resources,
602 .dev = {
603 .platform_data = &bfin_pata_platform_data,
604 }
605};
606#endif
607
608static const unsigned int cclk_vlev_datasheet[] =
609{
610 VRPAIR(VLEV_085, 250000000),
611 VRPAIR(VLEV_090, 376000000),
612 VRPAIR(VLEV_095, 426000000),
613 VRPAIR(VLEV_100, 426000000),
614 VRPAIR(VLEV_105, 476000000),
615 VRPAIR(VLEV_110, 476000000),
616 VRPAIR(VLEV_115, 476000000),
617 VRPAIR(VLEV_120, 500000000),
618 VRPAIR(VLEV_125, 533000000),
619 VRPAIR(VLEV_130, 600000000),
620};
621
622static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
623 .tuple_tab = cclk_vlev_datasheet,
624 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
625 .vr_settling_time = 25 /* us */,
626};
627
628static struct platform_device bfin_dpmc = {
629 .name = "bfin dpmc",
630 .dev = {
631 .platform_data = &bfin_dmpc_vreg_data,
632 },
633};
634
635static struct platform_device *cm_bf537_devices[] __initdata = {
636
637 &bfin_dpmc,
638
639#if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
640 &hitachi_fb_device,
641#endif
642
643#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
644 &rtc_device,
645#endif
646
647#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000648#ifdef CONFIG_SERIAL_BFIN_UART0
649 &bfin_uart0_device,
650#endif
651#ifdef CONFIG_SERIAL_BFIN_UART1
652 &bfin_uart1_device,
653#endif
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800654#endif
655
656#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang42bd8bc2009-01-07 23:14:39 +0800657#ifdef CONFIG_BFIN_SIR0
658 &bfin_sir0_device,
659#endif
660#ifdef CONFIG_BFIN_SIR1
661 &bfin_sir1_device,
662#endif
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800663#endif
664
665#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
666 &i2c_bfin_twi_device,
667#endif
668
669#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
Sonic Zhangdf5de262009-09-23 05:01:56 +0000670#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800671 &bfin_sport0_uart_device,
Sonic Zhangdf5de262009-09-23 05:01:56 +0000672#endif
673#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800674 &bfin_sport1_uart_device,
675#endif
Sonic Zhangdf5de262009-09-23 05:01:56 +0000676#endif
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800677
678#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
679 &isp1362_hcd_device,
680#endif
681
682#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
683 &smc91x_device,
684#endif
685
686#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
Graf Yang65319622009-02-04 16:49:45 +0800687 &bfin_mii_bus,
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800688 &bfin_mac_device,
689#endif
690
691#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
692 &net2272_bfin_device,
693#endif
694
695#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
696 &bfin_spi0_device,
697#endif
698
699#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
700 &bfin_pata_device,
701#endif
702
703#if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
704 &cm_flash_device,
705#endif
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800706};
707
Mike Frysinger9be86312011-05-04 11:20:15 -0400708static int __init net2272_init(void)
709{
710#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
711 int ret;
712
713 ret = gpio_request(GPIO_PG14, "net2272");
714 if (ret)
715 return ret;
716
717 /* Reset USB Chip, PG14 */
718 gpio_direction_output(GPIO_PG14, 0);
719 mdelay(2);
720 gpio_set_value(GPIO_PG14, 1);
721#endif
722
723 return 0;
724}
725
Mike Frysinger7f6678c2009-02-04 16:49:45 +0800726static int __init tcm_bf537_init(void)
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800727{
728 printk(KERN_INFO "%s(): registering device resources\n", __func__);
729 platform_add_devices(cm_bf537_devices, ARRAY_SIZE(cm_bf537_devices));
730#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
731 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
732#endif
733
734#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
Thomas Gleixnerbc2f6bd2011-02-06 18:23:38 +0000735 irq_set_status_flags(PATA_INT, IRQ_NOAUTOEN);
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800736#endif
Mike Frysinger9be86312011-05-04 11:20:15 -0400737
738 if (net2272_init())
739 pr_warning("unable to configure net2272; it probably won't work\n");
740
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800741 return 0;
742}
743
Mike Frysinger7f6678c2009-02-04 16:49:45 +0800744arch_initcall(tcm_bf537_init);
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800745
Sonic Zhangc13ce9f2009-09-23 09:37:46 +0000746static struct platform_device *cm_bf537_early_devices[] __initdata = {
747#if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
748#ifdef CONFIG_SERIAL_BFIN_UART0
749 &bfin_uart0_device,
750#endif
751#ifdef CONFIG_SERIAL_BFIN_UART1
752 &bfin_uart1_device,
753#endif
754#endif
755
756#if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
757#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
758 &bfin_sport0_uart_device,
759#endif
760#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
761 &bfin_sport1_uart_device,
762#endif
763#endif
764};
765
766void __init native_machine_early_platform_add_devices(void)
767{
768 printk(KERN_INFO "register early platform devices\n");
769 early_platform_add_devices(cm_bf537_early_devices,
770 ARRAY_SIZE(cm_bf537_early_devices));
771}
772
Mike Frysingerb9da3b92008-08-13 15:49:35 +0800773void bfin_get_ether_addr(char *addr)
774{
775 random_ether_addr(addr);
776 printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
777}
778EXPORT_SYMBOL(bfin_get_ether_addr);