blob: 44fd8409db10922b2ddfcb3e98bd69116424f489 [file] [log] [blame]
Bryan Wu1394f032007-05-06 14:50:22 -07001/*
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>
Bryan Wu1394f032007-05-06 14:50:22 -07006 *
Robin Getz96f10502009-09-24 14:11:24 +00007 * Licensed under the GPL-2 or later.
Bryan Wu1394f032007-05-06 14:50:22 -07008 */
9
10#include <linux/device.h>
Mike Frysinger43f73fe2007-12-24 19:35:35 +080011#include <linux/etherdevice.h>
Bryan Wu1394f032007-05-06 14:50:22 -070012#include <linux/platform_device.h>
13#include <linux/mtd/mtd.h>
14#include <linux/mtd/partitions.h>
Mike Frysinger8ea89492008-08-05 18:14:44 +080015#include <linux/mtd/physmap.h>
Bryan Wu1394f032007-05-06 14:50:22 -070016#include <linux/spi/spi.h>
17#include <linux/spi/flash.h>
Mike Frysingerb964c592008-05-10 00:06:10 +080018#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
Mike Frysingerf02bcec2007-11-15 21:29:15 +080019#include <linux/usb/isp1362.h>
Mike Frysingerb964c592008-05-10 00:06:10 +080020#endif
Jeff Garzik0a87e3e2008-02-01 18:02:30 -050021#include <linux/ata_platform.h>
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080022#include <linux/irq.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080023#include <asm/dma.h>
Bryan Wu1394f032007-05-06 14:50:22 -070024#include <asm/bfin5xx_spi.h>
Bryan Wu5d448dd2007-11-12 23:24:42 +080025#include <asm/portmux.h>
Michael Hennerich14b03202008-05-07 11:41:26 +080026#include <asm/dpmc.h>
Bryan Wu1394f032007-05-06 14:50:22 -070027
28/*
29 * Name the Board for the /proc/cpuinfo
30 */
Harald Krapfenbauer60584342009-09-10 15:12:08 +000031const char bfin_board_name[] = "Bluetechnix CM BF537E";
Bryan Wu1394f032007-05-06 14:50:22 -070032
33#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
34/* all SPI peripherals info goes here */
35
36#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
37static struct mtd_partition bfin_spi_flash_partitions[] = {
38 {
Robin Getzaa582972008-08-05 17:47:29 +080039 .name = "bootloader(spi)",
Bryan Wu1394f032007-05-06 14:50:22 -070040 .size = 0x00020000,
41 .offset = 0,
42 .mask_flags = MTD_CAP_ROM
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080043 }, {
Robin Getzaa582972008-08-05 17:47:29 +080044 .name = "linux kernel(spi)",
Bryan Wu1394f032007-05-06 14:50:22 -070045 .size = 0xe0000,
46 .offset = 0x20000
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080047 }, {
Robin Getzaa582972008-08-05 17:47:29 +080048 .name = "file system(spi)",
Bryan Wu1394f032007-05-06 14:50:22 -070049 .size = 0x700000,
50 .offset = 0x00100000,
51 }
52};
53
54static struct flash_platform_data bfin_spi_flash_data = {
55 .name = "m25p80",
56 .parts = bfin_spi_flash_partitions,
57 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
58 .type = "m25p64",
59};
60
61/* SPI flash chip (m25p64) */
62static struct bfin5xx_spi_chip spi_flash_chip_info = {
63 .enable_dma = 0, /* use dma transfer with this chip*/
Bryan Wu1394f032007-05-06 14:50:22 -070064};
65#endif
66
Michael Hennerichf3f704d2009-03-06 00:27:57 +080067#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
68static struct bfin5xx_spi_chip mmc_spi_chip_info = {
69 .enable_dma = 0,
Bryan Wu1394f032007-05-06 14:50:22 -070070};
71#endif
72
73static struct spi_board_info bfin_spi_board_info[] __initdata = {
74#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
75 {
76 /* the modalias must be the same as spi device driver name */
77 .modalias = "m25p80", /* Name of spi_driver for this device */
78 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080079 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -070080 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
81 .platform_data = &bfin_spi_flash_data,
82 .controller_data = &spi_flash_chip_info,
83 .mode = SPI_MODE_3,
84 },
85#endif
86
Barry Song7ba80062010-01-28 09:37:21 +000087#if defined(CONFIG_SND_BF5XX_SOC_AD183X) || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
Bryan Wu1394f032007-05-06 14:50:22 -070088 {
Barry Song7ba80062010-01-28 09:37:21 +000089 .modalias = "ad183x",
Bryan Wu1394f032007-05-06 14:50:22 -070090 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080091 .bus_num = 0,
Barry Song7ba80062010-01-28 09:37:21 +000092 .chip_select = 4,
Bryan Wu1394f032007-05-06 14:50:22 -070093 },
94#endif
95
Michael Hennerichf3f704d2009-03-06 00:27:57 +080096#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
Bryan Wu1394f032007-05-06 14:50:22 -070097 {
Michael Hennerichf3f704d2009-03-06 00:27:57 +080098 .modalias = "mmc_spi",
99 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800100 .bus_num = 0,
Michael Hennerichf3f704d2009-03-06 00:27:57 +0800101 .chip_select = 1,
102 .controller_data = &mmc_spi_chip_info,
Bryan Wu1394f032007-05-06 14:50:22 -0700103 .mode = SPI_MODE_3,
104 },
105#endif
106};
107
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800108/* SPI (0) */
109static struct resource bfin_spi0_resource[] = {
110 [0] = {
111 .start = SPI0_REGBASE,
112 .end = SPI0_REGBASE + 0xFF,
113 .flags = IORESOURCE_MEM,
114 },
115 [1] = {
116 .start = CH_SPI,
117 .end = CH_SPI,
Yi Li53122692009-06-05 12:11:11 +0000118 .flags = IORESOURCE_DMA,
119 },
120 [2] = {
121 .start = IRQ_SPI,
122 .end = IRQ_SPI,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800123 .flags = IORESOURCE_IRQ,
Yi Li53122692009-06-05 12:11:11 +0000124 },
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800125};
126
Bryan Wu1394f032007-05-06 14:50:22 -0700127/* SPI controller data */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800128static struct bfin5xx_spi_master bfin_spi0_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700129 .num_chipselect = 8,
130 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800131 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Bryan Wu1394f032007-05-06 14:50:22 -0700132};
133
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800134static struct platform_device bfin_spi0_device = {
135 .name = "bfin-spi",
136 .id = 0, /* Bus number */
137 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
138 .resource = bfin_spi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -0700139 .dev = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800140 .platform_data = &bfin_spi0_info, /* Passed to driver */
Bryan Wu1394f032007-05-06 14:50:22 -0700141 },
142};
143#endif /* spi master and devices */
144
145#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
146static struct platform_device rtc_device = {
147 .name = "rtc-bfin",
148 .id = -1,
149};
150#endif
151
Michael Hennerich0d4a89b2008-01-27 19:58:46 +0800152#if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
153static struct platform_device hitachi_fb_device = {
154 .name = "hitachi-tx09",
155};
156#endif
157
Bryan Wu1394f032007-05-06 14:50:22 -0700158#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
Michael Hennerich61f09b52009-07-24 08:48:31 +0000159#include <linux/smc91x.h>
160
161static struct smc91x_platdata smc91x_info = {
162 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
163 .leda = RPC_LED_100_10,
164 .ledb = RPC_LED_TX_RX,
165};
166
Bryan Wu1394f032007-05-06 14:50:22 -0700167static struct resource smc91x_resources[] = {
168 {
169 .start = 0x20200300,
170 .end = 0x20200300 + 16,
171 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800172 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700173 .start = IRQ_PF14,
174 .end = IRQ_PF14,
175 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
176 },
177};
178
179static struct platform_device smc91x_device = {
180 .name = "smc91x",
181 .id = 0,
182 .num_resources = ARRAY_SIZE(smc91x_resources),
183 .resource = smc91x_resources,
Michael Hennerich61f09b52009-07-24 08:48:31 +0000184 .dev = {
185 .platform_data = &smc91x_info,
186 },
Bryan Wu1394f032007-05-06 14:50:22 -0700187};
188#endif
189
190#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
191static struct resource isp1362_hcd_resources[] = {
192 {
193 .start = 0x20308000,
194 .end = 0x20308000,
195 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800196 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700197 .start = 0x20308004,
198 .end = 0x20308004,
199 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800200 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700201 .start = IRQ_PG15,
202 .end = IRQ_PG15,
Michael Hennerich9e758942010-03-18 12:51:49 +0000203 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
Bryan Wu1394f032007-05-06 14:50:22 -0700204 },
205};
206
207static struct isp1362_platform_data isp1362_priv = {
208 .sel15Kres = 1,
209 .clknotstop = 0,
210 .oc_enable = 0,
211 .int_act_high = 0,
212 .int_edge_triggered = 0,
213 .remote_wakeup_connected = 0,
214 .no_power_switching = 1,
215 .power_switching_mode = 0,
216};
217
218static struct platform_device isp1362_hcd_device = {
219 .name = "isp1362-hcd",
220 .id = 0,
221 .dev = {
222 .platform_data = &isp1362_priv,
223 },
224 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
225 .resource = isp1362_hcd_resources,
226};
227#endif
228
229#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
230static struct resource net2272_bfin_resources[] = {
231 {
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000232 .start = 0x20300000,
233 .end = 0x20300000 + 0x100,
Bryan Wu1394f032007-05-06 14:50:22 -0700234 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800235 }, {
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000236 .start = IRQ_PG13,
237 .end = IRQ_PG13,
Bryan Wu1394f032007-05-06 14:50:22 -0700238 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
239 },
240};
241
242static struct platform_device net2272_bfin_device = {
243 .name = "net2272",
244 .id = -1,
245 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
246 .resource = net2272_bfin_resources,
247};
248#endif
249
Mike Frysinger8ea89492008-08-05 18:14:44 +0800250#if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
251static struct mtd_partition cm_partitions[] = {
252 {
253 .name = "bootloader(nor)",
254 .size = 0x40000,
255 .offset = 0,
256 }, {
257 .name = "linux kernel(nor)",
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000258 .size = 0x100000,
Mike Frysinger8ea89492008-08-05 18:14:44 +0800259 .offset = MTDPART_OFS_APPEND,
260 }, {
261 .name = "file system(nor)",
262 .size = MTDPART_SIZ_FULL,
263 .offset = MTDPART_OFS_APPEND,
264 }
265};
266
267static struct physmap_flash_data cm_flash_data = {
268 .width = 2,
269 .parts = cm_partitions,
270 .nr_parts = ARRAY_SIZE(cm_partitions),
271};
272
273static unsigned cm_flash_gpios[] = { GPIO_PF4 };
274
275static struct resource cm_flash_resource[] = {
276 {
277 .name = "cfi_probe",
278 .start = 0x20000000,
279 .end = 0x201fffff,
280 .flags = IORESOURCE_MEM,
281 }, {
282 .start = (unsigned long)cm_flash_gpios,
283 .end = ARRAY_SIZE(cm_flash_gpios),
284 .flags = IORESOURCE_IRQ,
285 }
286};
287
288static struct platform_device cm_flash_device = {
289 .name = "gpio-addr-flash",
290 .id = 0,
291 .dev = {
292 .platform_data = &cm_flash_data,
293 },
294 .num_resources = ARRAY_SIZE(cm_flash_resource),
295 .resource = cm_flash_resource,
296};
297#endif
298
Bryan Wu1394f032007-05-06 14:50:22 -0700299#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000300#ifdef CONFIG_SERIAL_BFIN_UART0
301static struct resource bfin_uart0_resources[] = {
Bryan Wu1394f032007-05-06 14:50:22 -0700302 {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000303 .start = UART0_THR,
304 .end = UART0_GCTL+2,
Bryan Wu1394f032007-05-06 14:50:22 -0700305 .flags = IORESOURCE_MEM,
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000306 },
307 {
308 .start = IRQ_UART0_RX,
309 .end = IRQ_UART0_RX+1,
310 .flags = IORESOURCE_IRQ,
311 },
312 {
313 .start = IRQ_UART0_ERROR,
314 .end = IRQ_UART0_ERROR,
315 .flags = IORESOURCE_IRQ,
316 },
317 {
318 .start = CH_UART0_TX,
319 .end = CH_UART0_TX,
320 .flags = IORESOURCE_DMA,
321 },
322 {
323 .start = CH_UART0_RX,
324 .end = CH_UART0_RX,
325 .flags = IORESOURCE_DMA,
326 },
327#ifdef CONFIG_BFIN_UART0_CTSRTS
328 {
329 /*
330 * Refer to arch/blackfin/mach-xxx/include/mach/gpio.h for the GPIO map.
331 */
332 .start = -1,
333 .end = -1,
334 .flags = IORESOURCE_IO,
335 },
336 {
337 /*
338 * Refer to arch/blackfin/mach-xxx/include/mach/gpio.h for the GPIO map.
339 */
340 .start = -1,
341 .end = -1,
342 .flags = IORESOURCE_IO,
343 },
344#endif
345};
346
Mike Frysingera8b19882010-11-24 09:23:04 +0000347static unsigned short bfin_uart0_peripherals[] = {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000348 P_UART0_TX, P_UART0_RX, 0
349};
350
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000351static struct platform_device bfin_uart0_device = {
352 .name = "bfin-uart",
353 .id = 0,
354 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
355 .resource = bfin_uart0_resources,
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000356 .dev = {
357 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
358 },
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000359};
360#endif
361#ifdef CONFIG_SERIAL_BFIN_UART1
362static struct resource bfin_uart1_resources[] = {
363 {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000364 .start = UART1_THR,
365 .end = UART1_GCTL+2,
Bryan Wu1394f032007-05-06 14:50:22 -0700366 .flags = IORESOURCE_MEM,
367 },
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000368 {
369 .start = IRQ_UART1_RX,
370 .end = IRQ_UART1_RX+1,
371 .flags = IORESOURCE_IRQ,
372 },
373 {
374 .start = IRQ_UART1_ERROR,
375 .end = IRQ_UART1_ERROR,
376 .flags = IORESOURCE_IRQ,
377 },
378 {
379 .start = CH_UART1_TX,
380 .end = CH_UART1_TX,
381 .flags = IORESOURCE_DMA,
382 },
383 {
384 .start = CH_UART1_RX,
385 .end = CH_UART1_RX,
386 .flags = IORESOURCE_DMA,
387 },
388#ifdef CONFIG_BFIN_UART1_CTSRTS
389 {
390 /*
391 * Refer to arch/blackfin/mach-xxx/include/mach/gpio.h for the GPIO map.
392 */
393 .start = -1,
394 .end = -1,
395 .flags = IORESOURCE_IO,
396 },
397 {
398 /*
399 * Refer to arch/blackfin/mach-xxx/include/mach/gpio.h for the GPIO map.
400 */
401 .start = -1,
402 .end = -1,
403 .flags = IORESOURCE_IO,
404 },
405#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700406};
407
Mike Frysingera8b19882010-11-24 09:23:04 +0000408static unsigned short bfin_uart1_peripherals[] = {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000409 P_UART1_TX, P_UART1_RX, 0
410};
411
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000412static struct platform_device bfin_uart1_device = {
Bryan Wu1394f032007-05-06 14:50:22 -0700413 .name = "bfin-uart",
414 .id = 1,
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000415 .num_resources = ARRAY_SIZE(bfin_uart1_resources),
416 .resource = bfin_uart1_resources,
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000417 .dev = {
418 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
419 },
Bryan Wu1394f032007-05-06 14:50:22 -0700420};
421#endif
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000422#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700423
Graf Yang5be36d22008-04-25 03:09:15 +0800424#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang5be36d22008-04-25 03:09:15 +0800425#ifdef CONFIG_BFIN_SIR0
Graf Yang42bd8bc2009-01-07 23:14:39 +0800426static struct resource bfin_sir0_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800427 {
428 .start = 0xFFC00400,
429 .end = 0xFFC004FF,
430 .flags = IORESOURCE_MEM,
431 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800432 {
433 .start = IRQ_UART0_RX,
434 .end = IRQ_UART0_RX+1,
435 .flags = IORESOURCE_IRQ,
436 },
437 {
438 .start = CH_UART0_RX,
439 .end = CH_UART0_RX+1,
440 .flags = IORESOURCE_DMA,
441 },
442};
443static struct platform_device bfin_sir0_device = {
444 .name = "bfin_sir",
445 .id = 0,
446 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
447 .resource = bfin_sir0_resources,
448};
Graf Yang5be36d22008-04-25 03:09:15 +0800449#endif
450#ifdef CONFIG_BFIN_SIR1
Graf Yang42bd8bc2009-01-07 23:14:39 +0800451static struct resource bfin_sir1_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800452 {
453 .start = 0xFFC02000,
454 .end = 0xFFC020FF,
455 .flags = IORESOURCE_MEM,
456 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800457 {
458 .start = IRQ_UART1_RX,
459 .end = IRQ_UART1_RX+1,
460 .flags = IORESOURCE_IRQ,
461 },
462 {
463 .start = CH_UART1_RX,
464 .end = CH_UART1_RX+1,
465 .flags = IORESOURCE_DMA,
466 },
Graf Yang5be36d22008-04-25 03:09:15 +0800467};
Graf Yang42bd8bc2009-01-07 23:14:39 +0800468static struct platform_device bfin_sir1_device = {
Graf Yang5be36d22008-04-25 03:09:15 +0800469 .name = "bfin_sir",
Graf Yang42bd8bc2009-01-07 23:14:39 +0800470 .id = 1,
471 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
472 .resource = bfin_sir1_resources,
Graf Yang5be36d22008-04-25 03:09:15 +0800473};
474#endif
Graf Yang42bd8bc2009-01-07 23:14:39 +0800475#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800476
Mike Frysinger56ce8352008-03-26 06:00:18 +0800477#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
478static struct resource bfin_twi0_resource[] = {
479 [0] = {
480 .start = TWI0_REGBASE,
481 .end = TWI0_REGBASE,
482 .flags = IORESOURCE_MEM,
483 },
484 [1] = {
485 .start = IRQ_TWI,
486 .end = IRQ_TWI,
487 .flags = IORESOURCE_IRQ,
488 },
489};
490
491static struct platform_device i2c_bfin_twi_device = {
492 .name = "i2c-bfin-twi",
493 .id = 0,
494 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
495 .resource = bfin_twi0_resource,
496};
497#endif
498
Bryan Wu1394f032007-05-06 14:50:22 -0700499#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
Sonic Zhangdf5de262009-09-23 05:01:56 +0000500#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
501static struct resource bfin_sport0_uart_resources[] = {
502 {
503 .start = SPORT0_TCR1,
504 .end = SPORT0_MRCS3+4,
505 .flags = IORESOURCE_MEM,
506 },
507 {
508 .start = IRQ_SPORT0_RX,
509 .end = IRQ_SPORT0_RX+1,
510 .flags = IORESOURCE_IRQ,
511 },
512 {
513 .start = IRQ_SPORT0_ERROR,
514 .end = IRQ_SPORT0_ERROR,
515 .flags = IORESOURCE_IRQ,
516 },
517};
518
Mike Frysingera8b19882010-11-24 09:23:04 +0000519static unsigned short bfin_sport0_peripherals[] = {
Sonic Zhangdf5de262009-09-23 05:01:56 +0000520 P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
Sonic Zhange54b6732010-11-12 02:45:38 +0000521 P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0
Sonic Zhangdf5de262009-09-23 05:01:56 +0000522};
523
Bryan Wu1394f032007-05-06 14:50:22 -0700524static struct platform_device bfin_sport0_uart_device = {
525 .name = "bfin-sport-uart",
526 .id = 0,
Sonic Zhangdf5de262009-09-23 05:01:56 +0000527 .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
528 .resource = bfin_sport0_uart_resources,
529 .dev = {
530 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
531 },
532};
533#endif
534#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
535static struct resource bfin_sport1_uart_resources[] = {
536 {
537 .start = SPORT1_TCR1,
538 .end = SPORT1_MRCS3+4,
539 .flags = IORESOURCE_MEM,
540 },
541 {
542 .start = IRQ_SPORT1_RX,
543 .end = IRQ_SPORT1_RX+1,
544 .flags = IORESOURCE_IRQ,
545 },
546 {
547 .start = IRQ_SPORT1_ERROR,
548 .end = IRQ_SPORT1_ERROR,
549 .flags = IORESOURCE_IRQ,
550 },
551};
552
Mike Frysingera8b19882010-11-24 09:23:04 +0000553static unsigned short bfin_sport1_peripherals[] = {
Sonic Zhangdf5de262009-09-23 05:01:56 +0000554 P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
Sonic Zhange54b6732010-11-12 02:45:38 +0000555 P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0
Bryan Wu1394f032007-05-06 14:50:22 -0700556};
557
558static struct platform_device bfin_sport1_uart_device = {
559 .name = "bfin-sport-uart",
560 .id = 1,
Sonic Zhangdf5de262009-09-23 05:01:56 +0000561 .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
562 .resource = bfin_sport1_uart_resources,
563 .dev = {
564 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
565 },
Bryan Wu1394f032007-05-06 14:50:22 -0700566};
567#endif
Sonic Zhangdf5de262009-09-23 05:01:56 +0000568#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700569
570#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
Sonic Zhang02460d02010-06-11 10:44:22 +0000571#include <linux/bfin_mac.h>
572static const unsigned short bfin_mac_peripherals[] = P_MII0;
573
574static struct bfin_phydev_platform_data bfin_phydev_data[] = {
575 {
576 .addr = 1,
577 .irq = IRQ_MAC_PHYINT,
578 },
579};
580
581static struct bfin_mii_bus_platform_data bfin_mii_bus_data = {
582 .phydev_number = 1,
583 .phydev_data = bfin_phydev_data,
584 .phy_mode = PHY_INTERFACE_MODE_MII,
585 .mac_peripherals = bfin_mac_peripherals,
586};
587
Graf Yang65319622009-02-04 16:49:45 +0800588static struct platform_device bfin_mii_bus = {
589 .name = "bfin_mii_bus",
Sonic Zhang02460d02010-06-11 10:44:22 +0000590 .dev = {
591 .platform_data = &bfin_mii_bus_data,
592 }
Graf Yang65319622009-02-04 16:49:45 +0800593};
594
Bryan Wu1394f032007-05-06 14:50:22 -0700595static struct platform_device bfin_mac_device = {
596 .name = "bfin_mac",
Sonic Zhang02460d02010-06-11 10:44:22 +0000597 .dev = {
598 .platform_data = &bfin_mii_bus,
599 }
Bryan Wu1394f032007-05-06 14:50:22 -0700600};
601#endif
602
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800603#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
Mike Frysingerfe5aeb92008-08-05 18:29:56 +0800604#define PATA_INT IRQ_PF14
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800605
606static struct pata_platform_info bfin_pata_platform_data = {
607 .ioport_shift = 2,
608 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
609};
610
611static struct resource bfin_pata_resources[] = {
612 {
613 .start = 0x2030C000,
614 .end = 0x2030C01F,
615 .flags = IORESOURCE_MEM,
616 },
617 {
618 .start = 0x2030D018,
619 .end = 0x2030D01B,
620 .flags = IORESOURCE_MEM,
621 },
622 {
623 .start = PATA_INT,
624 .end = PATA_INT,
625 .flags = IORESOURCE_IRQ,
626 },
627};
628
629static struct platform_device bfin_pata_device = {
630 .name = "pata_platform",
631 .id = -1,
632 .num_resources = ARRAY_SIZE(bfin_pata_resources),
633 .resource = bfin_pata_resources,
634 .dev = {
635 .platform_data = &bfin_pata_platform_data,
636 }
637};
638#endif
639
Michael Hennerich14b03202008-05-07 11:41:26 +0800640static const unsigned int cclk_vlev_datasheet[] =
641{
642 VRPAIR(VLEV_085, 250000000),
643 VRPAIR(VLEV_090, 376000000),
644 VRPAIR(VLEV_095, 426000000),
645 VRPAIR(VLEV_100, 426000000),
646 VRPAIR(VLEV_105, 476000000),
647 VRPAIR(VLEV_110, 476000000),
648 VRPAIR(VLEV_115, 476000000),
649 VRPAIR(VLEV_120, 500000000),
650 VRPAIR(VLEV_125, 533000000),
651 VRPAIR(VLEV_130, 600000000),
652};
653
654static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
655 .tuple_tab = cclk_vlev_datasheet,
656 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
657 .vr_settling_time = 25 /* us */,
658};
659
660static struct platform_device bfin_dpmc = {
661 .name = "bfin dpmc",
662 .dev = {
663 .platform_data = &bfin_dmpc_vreg_data,
664 },
665};
666
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000667static struct platform_device *cm_bf537e_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +0800668
669 &bfin_dpmc,
670
Michael Hennerich0d4a89b2008-01-27 19:58:46 +0800671#if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
672 &hitachi_fb_device,
673#endif
674
Bryan Wu1394f032007-05-06 14:50:22 -0700675#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
676 &rtc_device,
677#endif
678
679#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000680#ifdef CONFIG_SERIAL_BFIN_UART0
681 &bfin_uart0_device,
682#endif
683#ifdef CONFIG_SERIAL_BFIN_UART1
684 &bfin_uart1_device,
685#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700686#endif
687
Graf Yang5be36d22008-04-25 03:09:15 +0800688#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang42bd8bc2009-01-07 23:14:39 +0800689#ifdef CONFIG_BFIN_SIR0
690 &bfin_sir0_device,
691#endif
692#ifdef CONFIG_BFIN_SIR1
693 &bfin_sir1_device,
694#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800695#endif
696
Mike Frysinger56ce8352008-03-26 06:00:18 +0800697#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
698 &i2c_bfin_twi_device,
699#endif
700
Bryan Wu1394f032007-05-06 14:50:22 -0700701#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
Sonic Zhangdf5de262009-09-23 05:01:56 +0000702#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
Bryan Wu1394f032007-05-06 14:50:22 -0700703 &bfin_sport0_uart_device,
Sonic Zhangdf5de262009-09-23 05:01:56 +0000704#endif
705#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
Bryan Wu1394f032007-05-06 14:50:22 -0700706 &bfin_sport1_uart_device,
707#endif
Sonic Zhangdf5de262009-09-23 05:01:56 +0000708#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700709
710#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
711 &isp1362_hcd_device,
712#endif
713
714#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
715 &smc91x_device,
716#endif
717
718#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
Graf Yang65319622009-02-04 16:49:45 +0800719 &bfin_mii_bus,
Bryan Wu1394f032007-05-06 14:50:22 -0700720 &bfin_mac_device,
721#endif
722
723#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
724 &net2272_bfin_device,
725#endif
726
727#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800728 &bfin_spi0_device,
729#endif
730
731#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
732 &bfin_pata_device,
Bryan Wu1394f032007-05-06 14:50:22 -0700733#endif
Mike Frysinger8ea89492008-08-05 18:14:44 +0800734
735#if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
736 &cm_flash_device,
737#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700738};
739
Mike Frysinger9be86312011-05-04 11:20:15 -0400740static int __init net2272_init(void)
741{
742#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
743 int ret;
744
745 ret = gpio_request(GPIO_PG14, "net2272");
746 if (ret)
747 return ret;
748
749 /* Reset USB Chip, PG14 */
750 gpio_direction_output(GPIO_PG14, 0);
751 mdelay(2);
752 gpio_set_value(GPIO_PG14, 1);
753#endif
754
755 return 0;
756}
757
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000758static int __init cm_bf537e_init(void)
Bryan Wu1394f032007-05-06 14:50:22 -0700759{
Harvey Harrisonb85d8582008-04-23 09:39:01 +0800760 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000761 platform_add_devices(cm_bf537e_devices, ARRAY_SIZE(cm_bf537e_devices));
Bryan Wu1394f032007-05-06 14:50:22 -0700762#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
763 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
764#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800765
766#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
Thomas Gleixnerbc2f6bd2011-02-06 18:23:38 +0000767 irq_set_status_flags(PATA_INT, IRQ_NOAUTOEN);
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800768#endif
Mike Frysinger9be86312011-05-04 11:20:15 -0400769
770 if (net2272_init())
771 pr_warning("unable to configure net2272; it probably won't work\n");
772
Bryan Wu1394f032007-05-06 14:50:22 -0700773 return 0;
774}
775
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000776arch_initcall(cm_bf537e_init);
Mike Frysinger137b1522007-11-22 16:07:03 +0800777
Sonic Zhangc13ce9f2009-09-23 09:37:46 +0000778static struct platform_device *cm_bf537e_early_devices[] __initdata = {
779#if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
780#ifdef CONFIG_SERIAL_BFIN_UART0
781 &bfin_uart0_device,
782#endif
783#ifdef CONFIG_SERIAL_BFIN_UART1
784 &bfin_uart1_device,
785#endif
786#endif
787
788#if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
789#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
790 &bfin_sport0_uart_device,
791#endif
792#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
793 &bfin_sport1_uart_device,
794#endif
795#endif
796};
797
798void __init native_machine_early_platform_add_devices(void)
799{
800 printk(KERN_INFO "register early platform devices\n");
801 early_platform_add_devices(cm_bf537e_early_devices,
802 ARRAY_SIZE(cm_bf537e_early_devices));
803}
804
Mike Frysinger9862cc52007-11-15 21:21:20 +0800805void bfin_get_ether_addr(char *addr)
Mike Frysinger137b1522007-11-22 16:07:03 +0800806{
807 random_ether_addr(addr);
808 printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
809}
Mike Frysinger9862cc52007-11-15 21:21:20 +0800810EXPORT_SYMBOL(bfin_get_ether_addr);