blob: 85e4fc9f9c22e061b5f39d2c2144bee84c111b76 [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>
Lars-Peter Clausen90590542011-11-11 11:06:38 +010011#include <linux/export.h>
Mike Frysinger43f73fe2007-12-24 19:35:35 +080012#include <linux/etherdevice.h>
Bryan Wu1394f032007-05-06 14:50:22 -070013#include <linux/platform_device.h>
14#include <linux/mtd/mtd.h>
15#include <linux/mtd/partitions.h>
Mike Frysinger8ea89492008-08-05 18:14:44 +080016#include <linux/mtd/physmap.h>
Bryan Wu1394f032007-05-06 14:50:22 -070017#include <linux/spi/spi.h>
18#include <linux/spi/flash.h>
Mike Frysingerb964c592008-05-10 00:06:10 +080019#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
Mike Frysingerf02bcec2007-11-15 21:29:15 +080020#include <linux/usb/isp1362.h>
Mike Frysingerb964c592008-05-10 00:06:10 +080021#endif
Jeff Garzik0a87e3e2008-02-01 18:02:30 -050022#include <linux/ata_platform.h>
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080023#include <linux/irq.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080024#include <asm/dma.h>
Bryan Wu1394f032007-05-06 14:50:22 -070025#include <asm/bfin5xx_spi.h>
Bryan Wu5d448dd2007-11-12 23:24:42 +080026#include <asm/portmux.h>
Michael Hennerich14b03202008-05-07 11:41:26 +080027#include <asm/dpmc.h>
Harald Krapfenbauera54081c2012-08-14 12:04:06 +020028#include <asm/bfin_sport.h>
Bryan Wu1394f032007-05-06 14:50:22 -070029
30/*
31 * Name the Board for the /proc/cpuinfo
32 */
Harald Krapfenbauer60584342009-09-10 15:12:08 +000033const char bfin_board_name[] = "Bluetechnix CM BF537E";
Bryan Wu1394f032007-05-06 14:50:22 -070034
Sonic Zhang7d157fb2011-11-07 18:40:10 +080035#if defined(CONFIG_SPI_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_MODULE)
Bryan Wu1394f032007-05-06 14:50:22 -070036/* all SPI peripherals info goes here */
37
38#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
39static struct mtd_partition bfin_spi_flash_partitions[] = {
40 {
Robin Getzaa582972008-08-05 17:47:29 +080041 .name = "bootloader(spi)",
Bryan Wu1394f032007-05-06 14:50:22 -070042 .size = 0x00020000,
43 .offset = 0,
44 .mask_flags = MTD_CAP_ROM
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080045 }, {
Robin Getzaa582972008-08-05 17:47:29 +080046 .name = "linux kernel(spi)",
Bryan Wu1394f032007-05-06 14:50:22 -070047 .size = 0xe0000,
48 .offset = 0x20000
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080049 }, {
Robin Getzaa582972008-08-05 17:47:29 +080050 .name = "file system(spi)",
Bryan Wu1394f032007-05-06 14:50:22 -070051 .size = 0x700000,
52 .offset = 0x00100000,
53 }
54};
55
56static struct flash_platform_data bfin_spi_flash_data = {
57 .name = "m25p80",
58 .parts = bfin_spi_flash_partitions,
59 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
60 .type = "m25p64",
61};
62
63/* SPI flash chip (m25p64) */
64static struct bfin5xx_spi_chip spi_flash_chip_info = {
65 .enable_dma = 0, /* use dma transfer with this chip*/
Bryan Wu1394f032007-05-06 14:50:22 -070066};
67#endif
68
Michael Hennerichf3f704d2009-03-06 00:27:57 +080069#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
70static struct bfin5xx_spi_chip mmc_spi_chip_info = {
71 .enable_dma = 0,
Bryan Wu1394f032007-05-06 14:50:22 -070072};
73#endif
74
75static struct spi_board_info bfin_spi_board_info[] __initdata = {
76#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
77 {
78 /* the modalias must be the same as spi device driver name */
79 .modalias = "m25p80", /* Name of spi_driver for this device */
80 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080081 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -070082 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
83 .platform_data = &bfin_spi_flash_data,
84 .controller_data = &spi_flash_chip_info,
85 .mode = SPI_MODE_3,
86 },
87#endif
88
Barry Song7ba80062010-01-28 09:37:21 +000089#if defined(CONFIG_SND_BF5XX_SOC_AD183X) || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
Bryan Wu1394f032007-05-06 14:50:22 -070090 {
Barry Song7ba80062010-01-28 09:37:21 +000091 .modalias = "ad183x",
Bryan Wu1394f032007-05-06 14:50:22 -070092 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080093 .bus_num = 0,
Barry Song7ba80062010-01-28 09:37:21 +000094 .chip_select = 4,
Bryan Wu1394f032007-05-06 14:50:22 -070095 },
96#endif
97
Michael Hennerichf3f704d2009-03-06 00:27:57 +080098#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
Bryan Wu1394f032007-05-06 14:50:22 -070099 {
Michael Hennerichf3f704d2009-03-06 00:27:57 +0800100 .modalias = "mmc_spi",
101 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800102 .bus_num = 0,
Michael Hennerichf3f704d2009-03-06 00:27:57 +0800103 .chip_select = 1,
104 .controller_data = &mmc_spi_chip_info,
Bryan Wu1394f032007-05-06 14:50:22 -0700105 .mode = SPI_MODE_3,
106 },
107#endif
108};
109
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800110/* SPI (0) */
111static struct resource bfin_spi0_resource[] = {
112 [0] = {
113 .start = SPI0_REGBASE,
114 .end = SPI0_REGBASE + 0xFF,
115 .flags = IORESOURCE_MEM,
116 },
117 [1] = {
118 .start = CH_SPI,
119 .end = CH_SPI,
Yi Li53122692009-06-05 12:11:11 +0000120 .flags = IORESOURCE_DMA,
121 },
122 [2] = {
123 .start = IRQ_SPI,
124 .end = IRQ_SPI,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800125 .flags = IORESOURCE_IRQ,
Yi Li53122692009-06-05 12:11:11 +0000126 },
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800127};
128
Bryan Wu1394f032007-05-06 14:50:22 -0700129/* SPI controller data */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800130static struct bfin5xx_spi_master bfin_spi0_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700131 .num_chipselect = 8,
132 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800133 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Bryan Wu1394f032007-05-06 14:50:22 -0700134};
135
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800136static struct platform_device bfin_spi0_device = {
137 .name = "bfin-spi",
138 .id = 0, /* Bus number */
139 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
140 .resource = bfin_spi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -0700141 .dev = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800142 .platform_data = &bfin_spi0_info, /* Passed to driver */
Bryan Wu1394f032007-05-06 14:50:22 -0700143 },
144};
145#endif /* spi master and devices */
146
Harald Krapfenbauera54081c2012-08-14 12:04:06 +0200147#if defined(CONFIG_SPI_BFIN_SPORT) || defined(CONFIG_SPI_BFIN_SPORT_MODULE)
148
149/* SPORT SPI controller data */
150static struct bfin5xx_spi_master bfin_sport_spi0_info = {
151 .num_chipselect = MAX_BLACKFIN_GPIOS,
152 .enable_dma = 0, /* master don't support DMA */
153 .pin_req = {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_DRPRI,
154 P_SPORT0_RSCLK, P_SPORT0_TFS, P_SPORT0_RFS, 0},
155};
156
157static struct resource bfin_sport_spi0_resource[] = {
158 [0] = {
159 .start = SPORT0_TCR1,
160 .end = SPORT0_TCR1 + 0xFF,
161 .flags = IORESOURCE_MEM,
162 },
163 [1] = {
164 .start = IRQ_SPORT0_ERROR,
165 .end = IRQ_SPORT0_ERROR,
166 .flags = IORESOURCE_IRQ,
167 },
168};
169
170static struct platform_device bfin_sport_spi0_device = {
171 .name = "bfin-sport-spi",
172 .id = 1, /* Bus number */
173 .num_resources = ARRAY_SIZE(bfin_sport_spi0_resource),
174 .resource = bfin_sport_spi0_resource,
175 .dev = {
176 .platform_data = &bfin_sport_spi0_info, /* Passed to driver */
177 },
178};
179
180static struct bfin5xx_spi_master bfin_sport_spi1_info = {
181 .num_chipselect = MAX_BLACKFIN_GPIOS,
182 .enable_dma = 0, /* master don't support DMA */
183 .pin_req = {P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_DRPRI,
184 P_SPORT1_RSCLK, P_SPORT1_TFS, P_SPORT1_RFS, 0},
185};
186
187static struct resource bfin_sport_spi1_resource[] = {
188 [0] = {
189 .start = SPORT1_TCR1,
190 .end = SPORT1_TCR1 + 0xFF,
191 .flags = IORESOURCE_MEM,
192 },
193 [1] = {
194 .start = IRQ_SPORT1_ERROR,
195 .end = IRQ_SPORT1_ERROR,
196 .flags = IORESOURCE_IRQ,
197 },
198};
199
200static struct platform_device bfin_sport_spi1_device = {
201 .name = "bfin-sport-spi",
202 .id = 2, /* Bus number */
203 .num_resources = ARRAY_SIZE(bfin_sport_spi1_resource),
204 .resource = bfin_sport_spi1_resource,
205 .dev = {
206 .platform_data = &bfin_sport_spi1_info, /* Passed to driver */
207 },
208};
209
210#endif /* sport spi master and devices */
211
Bryan Wu1394f032007-05-06 14:50:22 -0700212#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
213static struct platform_device rtc_device = {
214 .name = "rtc-bfin",
215 .id = -1,
216};
217#endif
218
Michael Hennerich0d4a89b2008-01-27 19:58:46 +0800219#if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
220static struct platform_device hitachi_fb_device = {
221 .name = "hitachi-tx09",
222};
223#endif
224
Bryan Wu1394f032007-05-06 14:50:22 -0700225#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
Michael Hennerich61f09b52009-07-24 08:48:31 +0000226#include <linux/smc91x.h>
227
228static struct smc91x_platdata smc91x_info = {
229 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
230 .leda = RPC_LED_100_10,
231 .ledb = RPC_LED_TX_RX,
232};
233
Bryan Wu1394f032007-05-06 14:50:22 -0700234static struct resource smc91x_resources[] = {
235 {
236 .start = 0x20200300,
237 .end = 0x20200300 + 16,
238 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800239 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700240 .start = IRQ_PF14,
241 .end = IRQ_PF14,
242 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
243 },
244};
245
246static struct platform_device smc91x_device = {
247 .name = "smc91x",
248 .id = 0,
249 .num_resources = ARRAY_SIZE(smc91x_resources),
250 .resource = smc91x_resources,
Michael Hennerich61f09b52009-07-24 08:48:31 +0000251 .dev = {
252 .platform_data = &smc91x_info,
253 },
Bryan Wu1394f032007-05-06 14:50:22 -0700254};
255#endif
256
257#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
258static struct resource isp1362_hcd_resources[] = {
259 {
260 .start = 0x20308000,
261 .end = 0x20308000,
262 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800263 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700264 .start = 0x20308004,
265 .end = 0x20308004,
266 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800267 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700268 .start = IRQ_PG15,
269 .end = IRQ_PG15,
Michael Hennerich9e758942010-03-18 12:51:49 +0000270 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
Bryan Wu1394f032007-05-06 14:50:22 -0700271 },
272};
273
274static struct isp1362_platform_data isp1362_priv = {
275 .sel15Kres = 1,
276 .clknotstop = 0,
277 .oc_enable = 0,
278 .int_act_high = 0,
279 .int_edge_triggered = 0,
280 .remote_wakeup_connected = 0,
281 .no_power_switching = 1,
282 .power_switching_mode = 0,
283};
284
285static struct platform_device isp1362_hcd_device = {
286 .name = "isp1362-hcd",
287 .id = 0,
288 .dev = {
289 .platform_data = &isp1362_priv,
290 },
291 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
292 .resource = isp1362_hcd_resources,
293};
294#endif
295
296#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
297static struct resource net2272_bfin_resources[] = {
298 {
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000299 .start = 0x20300000,
300 .end = 0x20300000 + 0x100,
Bryan Wu1394f032007-05-06 14:50:22 -0700301 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800302 }, {
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000303 .start = IRQ_PG13,
304 .end = IRQ_PG13,
Bryan Wu1394f032007-05-06 14:50:22 -0700305 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
306 },
307};
308
309static struct platform_device net2272_bfin_device = {
310 .name = "net2272",
311 .id = -1,
312 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
313 .resource = net2272_bfin_resources,
314};
315#endif
316
Mike Frysinger8ea89492008-08-05 18:14:44 +0800317#if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
318static struct mtd_partition cm_partitions[] = {
319 {
320 .name = "bootloader(nor)",
321 .size = 0x40000,
322 .offset = 0,
323 }, {
324 .name = "linux kernel(nor)",
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000325 .size = 0x100000,
Mike Frysinger8ea89492008-08-05 18:14:44 +0800326 .offset = MTDPART_OFS_APPEND,
327 }, {
328 .name = "file system(nor)",
329 .size = MTDPART_SIZ_FULL,
330 .offset = MTDPART_OFS_APPEND,
331 }
332};
333
334static struct physmap_flash_data cm_flash_data = {
335 .width = 2,
336 .parts = cm_partitions,
337 .nr_parts = ARRAY_SIZE(cm_partitions),
338};
339
340static unsigned cm_flash_gpios[] = { GPIO_PF4 };
341
342static struct resource cm_flash_resource[] = {
343 {
344 .name = "cfi_probe",
345 .start = 0x20000000,
346 .end = 0x201fffff,
347 .flags = IORESOURCE_MEM,
348 }, {
349 .start = (unsigned long)cm_flash_gpios,
350 .end = ARRAY_SIZE(cm_flash_gpios),
351 .flags = IORESOURCE_IRQ,
352 }
353};
354
355static struct platform_device cm_flash_device = {
356 .name = "gpio-addr-flash",
357 .id = 0,
358 .dev = {
359 .platform_data = &cm_flash_data,
360 },
361 .num_resources = ARRAY_SIZE(cm_flash_resource),
362 .resource = cm_flash_resource,
363};
364#endif
365
Bryan Wu1394f032007-05-06 14:50:22 -0700366#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000367#ifdef CONFIG_SERIAL_BFIN_UART0
368static struct resource bfin_uart0_resources[] = {
Bryan Wu1394f032007-05-06 14:50:22 -0700369 {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000370 .start = UART0_THR,
371 .end = UART0_GCTL+2,
Bryan Wu1394f032007-05-06 14:50:22 -0700372 .flags = IORESOURCE_MEM,
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000373 },
374 {
Sonic Zhangedb0a642011-08-01 17:53:21 +0800375 .start = IRQ_UART0_TX,
376 .end = IRQ_UART0_TX,
377 .flags = IORESOURCE_IRQ,
378 },
379 {
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000380 .start = IRQ_UART0_RX,
Sonic Zhangedb0a642011-08-01 17:53:21 +0800381 .end = IRQ_UART0_RX,
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000382 .flags = IORESOURCE_IRQ,
383 },
384 {
385 .start = IRQ_UART0_ERROR,
386 .end = IRQ_UART0_ERROR,
387 .flags = IORESOURCE_IRQ,
388 },
389 {
390 .start = CH_UART0_TX,
391 .end = CH_UART0_TX,
392 .flags = IORESOURCE_DMA,
393 },
394 {
395 .start = CH_UART0_RX,
396 .end = CH_UART0_RX,
397 .flags = IORESOURCE_DMA,
398 },
399#ifdef CONFIG_BFIN_UART0_CTSRTS
400 {
401 /*
402 * Refer to arch/blackfin/mach-xxx/include/mach/gpio.h for the GPIO map.
403 */
404 .start = -1,
405 .end = -1,
406 .flags = IORESOURCE_IO,
407 },
408 {
409 /*
410 * Refer to arch/blackfin/mach-xxx/include/mach/gpio.h for the GPIO map.
411 */
412 .start = -1,
413 .end = -1,
414 .flags = IORESOURCE_IO,
415 },
416#endif
417};
418
Mike Frysingera8b19882010-11-24 09:23:04 +0000419static unsigned short bfin_uart0_peripherals[] = {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000420 P_UART0_TX, P_UART0_RX, 0
421};
422
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000423static struct platform_device bfin_uart0_device = {
424 .name = "bfin-uart",
425 .id = 0,
426 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
427 .resource = bfin_uart0_resources,
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000428 .dev = {
429 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
430 },
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000431};
432#endif
433#ifdef CONFIG_SERIAL_BFIN_UART1
434static struct resource bfin_uart1_resources[] = {
435 {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000436 .start = UART1_THR,
437 .end = UART1_GCTL+2,
Bryan Wu1394f032007-05-06 14:50:22 -0700438 .flags = IORESOURCE_MEM,
439 },
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000440 {
Sonic Zhangedb0a642011-08-01 17:53:21 +0800441 .start = IRQ_UART1_TX,
442 .end = IRQ_UART1_TX,
443 .flags = IORESOURCE_IRQ,
444 },
445 {
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000446 .start = IRQ_UART1_RX,
Sonic Zhangedb0a642011-08-01 17:53:21 +0800447 .end = IRQ_UART1_RX,
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000448 .flags = IORESOURCE_IRQ,
449 },
450 {
451 .start = IRQ_UART1_ERROR,
452 .end = IRQ_UART1_ERROR,
453 .flags = IORESOURCE_IRQ,
454 },
455 {
456 .start = CH_UART1_TX,
457 .end = CH_UART1_TX,
458 .flags = IORESOURCE_DMA,
459 },
460 {
461 .start = CH_UART1_RX,
462 .end = CH_UART1_RX,
463 .flags = IORESOURCE_DMA,
464 },
465#ifdef CONFIG_BFIN_UART1_CTSRTS
466 {
467 /*
468 * Refer to arch/blackfin/mach-xxx/include/mach/gpio.h for the GPIO map.
469 */
470 .start = -1,
471 .end = -1,
472 .flags = IORESOURCE_IO,
473 },
474 {
475 /*
476 * Refer to arch/blackfin/mach-xxx/include/mach/gpio.h for the GPIO map.
477 */
478 .start = -1,
479 .end = -1,
480 .flags = IORESOURCE_IO,
481 },
482#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700483};
484
Mike Frysingera8b19882010-11-24 09:23:04 +0000485static unsigned short bfin_uart1_peripherals[] = {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000486 P_UART1_TX, P_UART1_RX, 0
487};
488
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000489static struct platform_device bfin_uart1_device = {
Bryan Wu1394f032007-05-06 14:50:22 -0700490 .name = "bfin-uart",
491 .id = 1,
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000492 .num_resources = ARRAY_SIZE(bfin_uart1_resources),
493 .resource = bfin_uart1_resources,
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000494 .dev = {
495 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
496 },
Bryan Wu1394f032007-05-06 14:50:22 -0700497};
498#endif
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000499#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700500
Graf Yang5be36d22008-04-25 03:09:15 +0800501#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang5be36d22008-04-25 03:09:15 +0800502#ifdef CONFIG_BFIN_SIR0
Graf Yang42bd8bc2009-01-07 23:14:39 +0800503static struct resource bfin_sir0_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800504 {
505 .start = 0xFFC00400,
506 .end = 0xFFC004FF,
507 .flags = IORESOURCE_MEM,
508 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800509 {
510 .start = IRQ_UART0_RX,
511 .end = IRQ_UART0_RX+1,
512 .flags = IORESOURCE_IRQ,
513 },
514 {
515 .start = CH_UART0_RX,
516 .end = CH_UART0_RX+1,
517 .flags = IORESOURCE_DMA,
518 },
519};
520static struct platform_device bfin_sir0_device = {
521 .name = "bfin_sir",
522 .id = 0,
523 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
524 .resource = bfin_sir0_resources,
525};
Graf Yang5be36d22008-04-25 03:09:15 +0800526#endif
527#ifdef CONFIG_BFIN_SIR1
Graf Yang42bd8bc2009-01-07 23:14:39 +0800528static struct resource bfin_sir1_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800529 {
530 .start = 0xFFC02000,
531 .end = 0xFFC020FF,
532 .flags = IORESOURCE_MEM,
533 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800534 {
535 .start = IRQ_UART1_RX,
536 .end = IRQ_UART1_RX+1,
537 .flags = IORESOURCE_IRQ,
538 },
539 {
540 .start = CH_UART1_RX,
541 .end = CH_UART1_RX+1,
542 .flags = IORESOURCE_DMA,
543 },
Graf Yang5be36d22008-04-25 03:09:15 +0800544};
Graf Yang42bd8bc2009-01-07 23:14:39 +0800545static struct platform_device bfin_sir1_device = {
Graf Yang5be36d22008-04-25 03:09:15 +0800546 .name = "bfin_sir",
Graf Yang42bd8bc2009-01-07 23:14:39 +0800547 .id = 1,
548 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
549 .resource = bfin_sir1_resources,
Graf Yang5be36d22008-04-25 03:09:15 +0800550};
551#endif
Graf Yang42bd8bc2009-01-07 23:14:39 +0800552#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800553
Mike Frysinger56ce8352008-03-26 06:00:18 +0800554#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
Sonic Zhangcf93feb2012-05-15 15:25:50 +0800555static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
556
Mike Frysinger56ce8352008-03-26 06:00:18 +0800557static struct resource bfin_twi0_resource[] = {
558 [0] = {
559 .start = TWI0_REGBASE,
560 .end = TWI0_REGBASE,
561 .flags = IORESOURCE_MEM,
562 },
563 [1] = {
564 .start = IRQ_TWI,
565 .end = IRQ_TWI,
566 .flags = IORESOURCE_IRQ,
567 },
568};
569
570static struct platform_device i2c_bfin_twi_device = {
571 .name = "i2c-bfin-twi",
572 .id = 0,
573 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
574 .resource = bfin_twi0_resource,
Sonic Zhangcf93feb2012-05-15 15:25:50 +0800575 .dev = {
576 .platform_data = &bfin_twi0_pins,
577 },
Mike Frysinger56ce8352008-03-26 06:00:18 +0800578};
579#endif
580
Harald Krapfenbauera54081c2012-08-14 12:04:06 +0200581#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) \
582|| defined(CONFIG_BFIN_SPORT) || defined(CONFIG_BFIN_SPORT_MODULE)
583unsigned short bfin_sport0_peripherals[] = {
584 P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
585 P_SPORT0_DRPRI, P_SPORT0_RSCLK, P_SPORT0_DRSEC, P_SPORT0_DTSEC, 0
586};
587#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700588#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
Sonic Zhangdf5de262009-09-23 05:01:56 +0000589#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
590static struct resource bfin_sport0_uart_resources[] = {
591 {
592 .start = SPORT0_TCR1,
593 .end = SPORT0_MRCS3+4,
594 .flags = IORESOURCE_MEM,
595 },
596 {
597 .start = IRQ_SPORT0_RX,
598 .end = IRQ_SPORT0_RX+1,
599 .flags = IORESOURCE_IRQ,
600 },
601 {
602 .start = IRQ_SPORT0_ERROR,
603 .end = IRQ_SPORT0_ERROR,
604 .flags = IORESOURCE_IRQ,
605 },
606};
607
Bryan Wu1394f032007-05-06 14:50:22 -0700608static struct platform_device bfin_sport0_uart_device = {
609 .name = "bfin-sport-uart",
610 .id = 0,
Sonic Zhangdf5de262009-09-23 05:01:56 +0000611 .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
612 .resource = bfin_sport0_uart_resources,
613 .dev = {
614 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
615 },
616};
617#endif
618#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
619static struct resource bfin_sport1_uart_resources[] = {
620 {
621 .start = SPORT1_TCR1,
622 .end = SPORT1_MRCS3+4,
623 .flags = IORESOURCE_MEM,
624 },
625 {
626 .start = IRQ_SPORT1_RX,
627 .end = IRQ_SPORT1_RX+1,
628 .flags = IORESOURCE_IRQ,
629 },
630 {
631 .start = IRQ_SPORT1_ERROR,
632 .end = IRQ_SPORT1_ERROR,
633 .flags = IORESOURCE_IRQ,
634 },
635};
636
Mike Frysingera8b19882010-11-24 09:23:04 +0000637static unsigned short bfin_sport1_peripherals[] = {
Sonic Zhangdf5de262009-09-23 05:01:56 +0000638 P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
Sonic Zhange54b6732010-11-12 02:45:38 +0000639 P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0
Bryan Wu1394f032007-05-06 14:50:22 -0700640};
641
642static struct platform_device bfin_sport1_uart_device = {
643 .name = "bfin-sport-uart",
644 .id = 1,
Sonic Zhangdf5de262009-09-23 05:01:56 +0000645 .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
646 .resource = bfin_sport1_uart_resources,
647 .dev = {
648 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
649 },
Bryan Wu1394f032007-05-06 14:50:22 -0700650};
651#endif
Sonic Zhangdf5de262009-09-23 05:01:56 +0000652#endif
Harald Krapfenbauera54081c2012-08-14 12:04:06 +0200653#if defined(CONFIG_BFIN_SPORT) || defined(CONFIG_BFIN_SPORT_MODULE)
654static struct resource bfin_sport0_resources[] = {
655 {
656 .start = SPORT0_TCR1,
657 .end = SPORT0_MRCS3+4,
658 .flags = IORESOURCE_MEM,
659 },
660 {
661 .start = IRQ_SPORT0_RX,
662 .end = IRQ_SPORT0_RX+1,
663 .flags = IORESOURCE_IRQ,
664 },
665 {
666 .start = IRQ_SPORT0_TX,
667 .end = IRQ_SPORT0_TX+1,
668 .flags = IORESOURCE_IRQ,
669 },
670 {
671 .start = IRQ_SPORT0_ERROR,
672 .end = IRQ_SPORT0_ERROR,
673 .flags = IORESOURCE_IRQ,
674 },
675 {
676 .start = CH_SPORT0_TX,
677 .end = CH_SPORT0_TX,
678 .flags = IORESOURCE_DMA,
679 },
680 {
681 .start = CH_SPORT0_RX,
682 .end = CH_SPORT0_RX,
683 .flags = IORESOURCE_DMA,
684 },
685};
686static struct platform_device bfin_sport0_device = {
687 .name = "bfin_sport_raw",
688 .id = 0,
689 .num_resources = ARRAY_SIZE(bfin_sport0_resources),
690 .resource = bfin_sport0_resources,
691 .dev = {
692 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
693 },
694};
695#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700696
697#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
Sonic Zhang02460d02010-06-11 10:44:22 +0000698#include <linux/bfin_mac.h>
699static const unsigned short bfin_mac_peripherals[] = P_MII0;
700
701static struct bfin_phydev_platform_data bfin_phydev_data[] = {
702 {
703 .addr = 1,
704 .irq = IRQ_MAC_PHYINT,
705 },
706};
707
708static struct bfin_mii_bus_platform_data bfin_mii_bus_data = {
709 .phydev_number = 1,
710 .phydev_data = bfin_phydev_data,
711 .phy_mode = PHY_INTERFACE_MODE_MII,
712 .mac_peripherals = bfin_mac_peripherals,
713};
714
Graf Yang65319622009-02-04 16:49:45 +0800715static struct platform_device bfin_mii_bus = {
716 .name = "bfin_mii_bus",
Sonic Zhang02460d02010-06-11 10:44:22 +0000717 .dev = {
718 .platform_data = &bfin_mii_bus_data,
719 }
Graf Yang65319622009-02-04 16:49:45 +0800720};
721
Bryan Wu1394f032007-05-06 14:50:22 -0700722static struct platform_device bfin_mac_device = {
723 .name = "bfin_mac",
Sonic Zhang02460d02010-06-11 10:44:22 +0000724 .dev = {
725 .platform_data = &bfin_mii_bus,
726 }
Bryan Wu1394f032007-05-06 14:50:22 -0700727};
728#endif
729
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800730#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
Mike Frysingerfe5aeb92008-08-05 18:29:56 +0800731#define PATA_INT IRQ_PF14
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800732
733static struct pata_platform_info bfin_pata_platform_data = {
734 .ioport_shift = 2,
Yong Zhang7832bb52011-09-07 16:10:03 +0800735 .irq_type = IRQF_TRIGGER_HIGH,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800736};
737
738static struct resource bfin_pata_resources[] = {
739 {
740 .start = 0x2030C000,
741 .end = 0x2030C01F,
742 .flags = IORESOURCE_MEM,
743 },
744 {
745 .start = 0x2030D018,
746 .end = 0x2030D01B,
747 .flags = IORESOURCE_MEM,
748 },
749 {
750 .start = PATA_INT,
751 .end = PATA_INT,
752 .flags = IORESOURCE_IRQ,
753 },
754};
755
756static struct platform_device bfin_pata_device = {
757 .name = "pata_platform",
758 .id = -1,
759 .num_resources = ARRAY_SIZE(bfin_pata_resources),
760 .resource = bfin_pata_resources,
761 .dev = {
762 .platform_data = &bfin_pata_platform_data,
763 }
764};
765#endif
766
Michael Hennerich14b03202008-05-07 11:41:26 +0800767static const unsigned int cclk_vlev_datasheet[] =
768{
769 VRPAIR(VLEV_085, 250000000),
770 VRPAIR(VLEV_090, 376000000),
771 VRPAIR(VLEV_095, 426000000),
772 VRPAIR(VLEV_100, 426000000),
773 VRPAIR(VLEV_105, 476000000),
774 VRPAIR(VLEV_110, 476000000),
775 VRPAIR(VLEV_115, 476000000),
776 VRPAIR(VLEV_120, 500000000),
777 VRPAIR(VLEV_125, 533000000),
778 VRPAIR(VLEV_130, 600000000),
779};
780
781static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
782 .tuple_tab = cclk_vlev_datasheet,
783 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
784 .vr_settling_time = 25 /* us */,
785};
786
787static struct platform_device bfin_dpmc = {
788 .name = "bfin dpmc",
789 .dev = {
790 .platform_data = &bfin_dmpc_vreg_data,
791 },
792};
793
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000794static struct platform_device *cm_bf537e_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +0800795
796 &bfin_dpmc,
797
Harald Krapfenbauera54081c2012-08-14 12:04:06 +0200798#if defined(CONFIG_BFIN_SPORT) || defined(CONFIG_BFIN_SPORT_MODULE)
799 &bfin_sport0_device,
800#endif
801
Michael Hennerich0d4a89b2008-01-27 19:58:46 +0800802#if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
803 &hitachi_fb_device,
804#endif
805
Bryan Wu1394f032007-05-06 14:50:22 -0700806#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
807 &rtc_device,
808#endif
809
810#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000811#ifdef CONFIG_SERIAL_BFIN_UART0
812 &bfin_uart0_device,
813#endif
814#ifdef CONFIG_SERIAL_BFIN_UART1
815 &bfin_uart1_device,
816#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700817#endif
818
Graf Yang5be36d22008-04-25 03:09:15 +0800819#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang42bd8bc2009-01-07 23:14:39 +0800820#ifdef CONFIG_BFIN_SIR0
821 &bfin_sir0_device,
822#endif
823#ifdef CONFIG_BFIN_SIR1
824 &bfin_sir1_device,
825#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800826#endif
827
Mike Frysinger56ce8352008-03-26 06:00:18 +0800828#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
829 &i2c_bfin_twi_device,
830#endif
831
Bryan Wu1394f032007-05-06 14:50:22 -0700832#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
Sonic Zhangdf5de262009-09-23 05:01:56 +0000833#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
Bryan Wu1394f032007-05-06 14:50:22 -0700834 &bfin_sport0_uart_device,
Sonic Zhangdf5de262009-09-23 05:01:56 +0000835#endif
836#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
Bryan Wu1394f032007-05-06 14:50:22 -0700837 &bfin_sport1_uart_device,
838#endif
Sonic Zhangdf5de262009-09-23 05:01:56 +0000839#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700840
841#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
842 &isp1362_hcd_device,
843#endif
844
845#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
846 &smc91x_device,
847#endif
848
849#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
Graf Yang65319622009-02-04 16:49:45 +0800850 &bfin_mii_bus,
Bryan Wu1394f032007-05-06 14:50:22 -0700851 &bfin_mac_device,
852#endif
853
854#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
855 &net2272_bfin_device,
856#endif
857
Sonic Zhang7d157fb2011-11-07 18:40:10 +0800858#if defined(CONFIG_SPI_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800859 &bfin_spi0_device,
860#endif
861
Harald Krapfenbauera54081c2012-08-14 12:04:06 +0200862#if defined(CONFIG_SPI_BFIN_SPORT) || defined(CONFIG_SPI_BFIN_SPORT_MODULE)
863 &bfin_sport_spi0_device,
864 &bfin_sport_spi1_device,
865#endif
866
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800867#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
868 &bfin_pata_device,
Bryan Wu1394f032007-05-06 14:50:22 -0700869#endif
Mike Frysinger8ea89492008-08-05 18:14:44 +0800870
871#if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
872 &cm_flash_device,
873#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700874};
875
Mike Frysinger9be86312011-05-04 11:20:15 -0400876static int __init net2272_init(void)
877{
878#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
879 int ret;
880
881 ret = gpio_request(GPIO_PG14, "net2272");
882 if (ret)
883 return ret;
884
885 /* Reset USB Chip, PG14 */
886 gpio_direction_output(GPIO_PG14, 0);
887 mdelay(2);
888 gpio_set_value(GPIO_PG14, 1);
889#endif
890
891 return 0;
892}
893
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000894static int __init cm_bf537e_init(void)
Bryan Wu1394f032007-05-06 14:50:22 -0700895{
Harvey Harrisonb85d8582008-04-23 09:39:01 +0800896 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000897 platform_add_devices(cm_bf537e_devices, ARRAY_SIZE(cm_bf537e_devices));
Sonic Zhang7d157fb2011-11-07 18:40:10 +0800898#if defined(CONFIG_SPI_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_MODULE)
Bryan Wu1394f032007-05-06 14:50:22 -0700899 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
900#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800901
902#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
Thomas Gleixnerbc2f6bd2011-02-06 18:23:38 +0000903 irq_set_status_flags(PATA_INT, IRQ_NOAUTOEN);
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800904#endif
Mike Frysinger9be86312011-05-04 11:20:15 -0400905
906 if (net2272_init())
907 pr_warning("unable to configure net2272; it probably won't work\n");
908
Bryan Wu1394f032007-05-06 14:50:22 -0700909 return 0;
910}
911
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000912arch_initcall(cm_bf537e_init);
Mike Frysinger137b1522007-11-22 16:07:03 +0800913
Sonic Zhangc13ce9f2009-09-23 09:37:46 +0000914static struct platform_device *cm_bf537e_early_devices[] __initdata = {
915#if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
916#ifdef CONFIG_SERIAL_BFIN_UART0
917 &bfin_uart0_device,
918#endif
919#ifdef CONFIG_SERIAL_BFIN_UART1
920 &bfin_uart1_device,
921#endif
922#endif
923
924#if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
925#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
926 &bfin_sport0_uart_device,
927#endif
928#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
929 &bfin_sport1_uart_device,
930#endif
931#endif
932};
933
934void __init native_machine_early_platform_add_devices(void)
935{
936 printk(KERN_INFO "register early platform devices\n");
937 early_platform_add_devices(cm_bf537e_early_devices,
938 ARRAY_SIZE(cm_bf537e_early_devices));
939}
940
Danny Kukawkafa63c6d2012-02-16 07:09:30 +0000941int bfin_get_ether_addr(char *addr)
Mike Frysinger137b1522007-11-22 16:07:03 +0800942{
Danny Kukawkafa63c6d2012-02-16 07:09:30 +0000943 return 1;
Mike Frysinger137b1522007-11-22 16:07:03 +0800944}
Mike Frysinger9862cc52007-11-15 21:21:20 +0800945EXPORT_SYMBOL(bfin_get_ether_addr);