blob: 0143d8bef909483be39128812faa86f926ddfdfd [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>
Lars-Peter Clausen90590542011-11-11 11:06:38 +010012#include <linux/export.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 Krapfenbauer60584342009-09-10 15:12:08 +000028#include <linux/spi/mmc_spi.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 BF537U";
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
147#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
148static struct platform_device rtc_device = {
149 .name = "rtc-bfin",
150 .id = -1,
151};
152#endif
153
Michael Hennerich0d4a89b2008-01-27 19:58:46 +0800154#if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
155static struct platform_device hitachi_fb_device = {
156 .name = "hitachi-tx09",
157};
158#endif
159
Bryan Wu1394f032007-05-06 14:50:22 -0700160#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
Michael Hennerich61f09b52009-07-24 08:48:31 +0000161#include <linux/smc91x.h>
162
163static struct smc91x_platdata smc91x_info = {
164 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
165 .leda = RPC_LED_100_10,
166 .ledb = RPC_LED_TX_RX,
167};
168
Bryan Wu1394f032007-05-06 14:50:22 -0700169static struct resource smc91x_resources[] = {
170 {
171 .start = 0x20200300,
172 .end = 0x20200300 + 16,
173 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800174 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700175 .start = IRQ_PF14,
176 .end = IRQ_PF14,
177 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
178 },
179};
180
181static struct platform_device smc91x_device = {
182 .name = "smc91x",
183 .id = 0,
184 .num_resources = ARRAY_SIZE(smc91x_resources),
185 .resource = smc91x_resources,
Michael Hennerich61f09b52009-07-24 08:48:31 +0000186 .dev = {
187 .platform_data = &smc91x_info,
188 },
Bryan Wu1394f032007-05-06 14:50:22 -0700189};
190#endif
191
192#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
193static struct resource isp1362_hcd_resources[] = {
194 {
195 .start = 0x20308000,
196 .end = 0x20308000,
197 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800198 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700199 .start = 0x20308004,
200 .end = 0x20308004,
201 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800202 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700203 .start = IRQ_PG15,
204 .end = IRQ_PG15,
Michael Hennerich9e758942010-03-18 12:51:49 +0000205 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
Bryan Wu1394f032007-05-06 14:50:22 -0700206 },
207};
208
209static struct isp1362_platform_data isp1362_priv = {
210 .sel15Kres = 1,
211 .clknotstop = 0,
212 .oc_enable = 0,
213 .int_act_high = 0,
214 .int_edge_triggered = 0,
215 .remote_wakeup_connected = 0,
216 .no_power_switching = 1,
217 .power_switching_mode = 0,
218};
219
220static struct platform_device isp1362_hcd_device = {
221 .name = "isp1362-hcd",
222 .id = 0,
223 .dev = {
224 .platform_data = &isp1362_priv,
225 },
226 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
227 .resource = isp1362_hcd_resources,
228};
229#endif
230
231#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
232static struct resource net2272_bfin_resources[] = {
233 {
234 .start = 0x20200000,
235 .end = 0x20200000 + 0x100,
236 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800237 }, {
Michael Hennerich8ecc7362007-10-29 17:24:23 +0800238 .start = IRQ_PH14,
239 .end = IRQ_PH14,
Bryan Wu1394f032007-05-06 14:50:22 -0700240 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
241 },
242};
243
244static struct platform_device net2272_bfin_device = {
245 .name = "net2272",
246 .id = -1,
247 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
248 .resource = net2272_bfin_resources,
249};
250#endif
251
Mike Frysinger8ea89492008-08-05 18:14:44 +0800252#if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
253static struct mtd_partition cm_partitions[] = {
254 {
255 .name = "bootloader(nor)",
256 .size = 0x40000,
257 .offset = 0,
258 }, {
259 .name = "linux kernel(nor)",
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000260 .size = 0x100000,
Mike Frysinger8ea89492008-08-05 18:14:44 +0800261 .offset = MTDPART_OFS_APPEND,
262 }, {
263 .name = "file system(nor)",
264 .size = MTDPART_SIZ_FULL,
265 .offset = MTDPART_OFS_APPEND,
266 }
267};
268
269static struct physmap_flash_data cm_flash_data = {
270 .width = 2,
271 .parts = cm_partitions,
272 .nr_parts = ARRAY_SIZE(cm_partitions),
273};
274
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000275static unsigned cm_flash_gpios[] = { GPIO_PH0 };
Mike Frysinger8ea89492008-08-05 18:14:44 +0800276
277static struct resource cm_flash_resource[] = {
278 {
279 .name = "cfi_probe",
280 .start = 0x20000000,
281 .end = 0x201fffff,
282 .flags = IORESOURCE_MEM,
283 }, {
284 .start = (unsigned long)cm_flash_gpios,
285 .end = ARRAY_SIZE(cm_flash_gpios),
286 .flags = IORESOURCE_IRQ,
287 }
288};
289
290static struct platform_device cm_flash_device = {
291 .name = "gpio-addr-flash",
292 .id = 0,
293 .dev = {
294 .platform_data = &cm_flash_data,
295 },
296 .num_resources = ARRAY_SIZE(cm_flash_resource),
297 .resource = cm_flash_resource,
298};
299#endif
300
Bryan Wu1394f032007-05-06 14:50:22 -0700301#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000302#ifdef CONFIG_SERIAL_BFIN_UART0
303static struct resource bfin_uart0_resources[] = {
Bryan Wu1394f032007-05-06 14:50:22 -0700304 {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000305 .start = UART0_THR,
306 .end = UART0_GCTL+2,
Bryan Wu1394f032007-05-06 14:50:22 -0700307 .flags = IORESOURCE_MEM,
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000308 },
309 {
Sonic Zhangedb0a642011-08-01 17:53:21 +0800310 .start = IRQ_UART0_TX,
311 .end = IRQ_UART0_TX,
312 .flags = IORESOURCE_IRQ,
313 },
314 {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000315 .start = IRQ_UART0_RX,
Sonic Zhangedb0a642011-08-01 17:53:21 +0800316 .end = IRQ_UART0_RX,
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000317 .flags = IORESOURCE_IRQ,
318 },
319 {
320 .start = IRQ_UART0_ERROR,
321 .end = IRQ_UART0_ERROR,
322 .flags = IORESOURCE_IRQ,
323 },
324 {
325 .start = CH_UART0_TX,
326 .end = CH_UART0_TX,
327 .flags = IORESOURCE_DMA,
328 },
329 {
330 .start = CH_UART0_RX,
331 .end = CH_UART0_RX,
332 .flags = IORESOURCE_DMA,
Bryan Wu1394f032007-05-06 14:50:22 -0700333 },
334};
335
Mike Frysingera8b19882010-11-24 09:23:04 +0000336static unsigned short bfin_uart0_peripherals[] = {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000337 P_UART0_TX, P_UART0_RX, 0
338};
339
340static struct platform_device bfin_uart0_device = {
341 .name = "bfin-uart",
342 .id = 0,
343 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
344 .resource = bfin_uart0_resources,
345 .dev = {
346 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
347 },
348};
349#endif
350#ifdef CONFIG_SERIAL_BFIN_UART1
351static struct resource bfin_uart1_resources[] = {
352 {
353 .start = UART1_THR,
354 .end = UART1_GCTL+2,
355 .flags = IORESOURCE_MEM,
356 },
357 {
Sonic Zhangedb0a642011-08-01 17:53:21 +0800358 .start = IRQ_UART1_TX,
359 .end = IRQ_UART1_TX,
360 .flags = IORESOURCE_IRQ,
361 },
362 {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000363 .start = IRQ_UART1_RX,
Sonic Zhangedb0a642011-08-01 17:53:21 +0800364 .end = IRQ_UART1_RX,
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000365 .flags = IORESOURCE_IRQ,
366 },
367 {
368 .start = IRQ_UART1_ERROR,
369 .end = IRQ_UART1_ERROR,
370 .flags = IORESOURCE_IRQ,
371 },
372 {
373 .start = CH_UART1_TX,
374 .end = CH_UART1_TX,
375 .flags = IORESOURCE_DMA,
376 },
377 {
378 .start = CH_UART1_RX,
379 .end = CH_UART1_RX,
380 .flags = IORESOURCE_DMA,
381 },
382};
383
Mike Frysingera8b19882010-11-24 09:23:04 +0000384static unsigned short bfin_uart1_peripherals[] = {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000385 P_UART1_TX, P_UART1_RX, 0
386};
387
388static struct platform_device bfin_uart1_device = {
Bryan Wu1394f032007-05-06 14:50:22 -0700389 .name = "bfin-uart",
390 .id = 1,
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000391 .num_resources = ARRAY_SIZE(bfin_uart1_resources),
392 .resource = bfin_uart1_resources,
393 .dev = {
394 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
395 },
Bryan Wu1394f032007-05-06 14:50:22 -0700396};
397#endif
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000398#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700399
Graf Yang5be36d22008-04-25 03:09:15 +0800400#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang5be36d22008-04-25 03:09:15 +0800401#ifdef CONFIG_BFIN_SIR0
Graf Yang42bd8bc2009-01-07 23:14:39 +0800402static struct resource bfin_sir0_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800403 {
404 .start = 0xFFC00400,
405 .end = 0xFFC004FF,
406 .flags = IORESOURCE_MEM,
407 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800408 {
409 .start = IRQ_UART0_RX,
410 .end = IRQ_UART0_RX+1,
411 .flags = IORESOURCE_IRQ,
412 },
413 {
414 .start = CH_UART0_RX,
415 .end = CH_UART0_RX+1,
416 .flags = IORESOURCE_DMA,
417 },
418};
419static struct platform_device bfin_sir0_device = {
420 .name = "bfin_sir",
421 .id = 0,
422 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
423 .resource = bfin_sir0_resources,
424};
Graf Yang5be36d22008-04-25 03:09:15 +0800425#endif
426#ifdef CONFIG_BFIN_SIR1
Graf Yang42bd8bc2009-01-07 23:14:39 +0800427static struct resource bfin_sir1_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800428 {
429 .start = 0xFFC02000,
430 .end = 0xFFC020FF,
431 .flags = IORESOURCE_MEM,
432 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800433 {
434 .start = IRQ_UART1_RX,
435 .end = IRQ_UART1_RX+1,
436 .flags = IORESOURCE_IRQ,
437 },
438 {
439 .start = CH_UART1_RX,
440 .end = CH_UART1_RX+1,
441 .flags = IORESOURCE_DMA,
442 },
Graf Yang5be36d22008-04-25 03:09:15 +0800443};
Graf Yang42bd8bc2009-01-07 23:14:39 +0800444static struct platform_device bfin_sir1_device = {
Graf Yang5be36d22008-04-25 03:09:15 +0800445 .name = "bfin_sir",
Graf Yang42bd8bc2009-01-07 23:14:39 +0800446 .id = 1,
447 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
448 .resource = bfin_sir1_resources,
Graf Yang5be36d22008-04-25 03:09:15 +0800449};
450#endif
Graf Yang42bd8bc2009-01-07 23:14:39 +0800451#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800452
Mike Frysinger56ce8352008-03-26 06:00:18 +0800453#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
Sonic Zhangcf93feb2012-05-15 15:25:50 +0800454static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
455
Mike Frysinger56ce8352008-03-26 06:00:18 +0800456static struct resource bfin_twi0_resource[] = {
457 [0] = {
458 .start = TWI0_REGBASE,
459 .end = TWI0_REGBASE,
460 .flags = IORESOURCE_MEM,
461 },
462 [1] = {
463 .start = IRQ_TWI,
464 .end = IRQ_TWI,
465 .flags = IORESOURCE_IRQ,
466 },
467};
468
469static struct platform_device i2c_bfin_twi_device = {
470 .name = "i2c-bfin-twi",
471 .id = 0,
472 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
473 .resource = bfin_twi0_resource,
Sonic Zhangcf93feb2012-05-15 15:25:50 +0800474 .dev = {
475 .platform_data = &bfin_twi0_pins,
476 },
Mike Frysinger56ce8352008-03-26 06:00:18 +0800477};
478#endif
479
Bryan Wu1394f032007-05-06 14:50:22 -0700480#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
Sonic Zhangdf5de262009-09-23 05:01:56 +0000481#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
482static struct resource bfin_sport0_uart_resources[] = {
483 {
484 .start = SPORT0_TCR1,
485 .end = SPORT0_MRCS3+4,
486 .flags = IORESOURCE_MEM,
487 },
488 {
489 .start = IRQ_SPORT0_RX,
490 .end = IRQ_SPORT0_RX+1,
491 .flags = IORESOURCE_IRQ,
492 },
493 {
494 .start = IRQ_SPORT0_ERROR,
495 .end = IRQ_SPORT0_ERROR,
496 .flags = IORESOURCE_IRQ,
497 },
498};
499
Mike Frysingera8b19882010-11-24 09:23:04 +0000500static unsigned short bfin_sport0_peripherals[] = {
Sonic Zhangdf5de262009-09-23 05:01:56 +0000501 P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
Sonic Zhange54b6732010-11-12 02:45:38 +0000502 P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0
Sonic Zhangdf5de262009-09-23 05:01:56 +0000503};
504
Bryan Wu1394f032007-05-06 14:50:22 -0700505static struct platform_device bfin_sport0_uart_device = {
506 .name = "bfin-sport-uart",
507 .id = 0,
Sonic Zhangdf5de262009-09-23 05:01:56 +0000508 .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
509 .resource = bfin_sport0_uart_resources,
510 .dev = {
511 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
512 },
513};
514#endif
515#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
516static struct resource bfin_sport1_uart_resources[] = {
517 {
518 .start = SPORT1_TCR1,
519 .end = SPORT1_MRCS3+4,
520 .flags = IORESOURCE_MEM,
521 },
522 {
523 .start = IRQ_SPORT1_RX,
524 .end = IRQ_SPORT1_RX+1,
525 .flags = IORESOURCE_IRQ,
526 },
527 {
528 .start = IRQ_SPORT1_ERROR,
529 .end = IRQ_SPORT1_ERROR,
530 .flags = IORESOURCE_IRQ,
531 },
532};
533
Mike Frysingera8b19882010-11-24 09:23:04 +0000534static unsigned short bfin_sport1_peripherals[] = {
Sonic Zhangdf5de262009-09-23 05:01:56 +0000535 P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
Sonic Zhange54b6732010-11-12 02:45:38 +0000536 P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0
Bryan Wu1394f032007-05-06 14:50:22 -0700537};
538
539static struct platform_device bfin_sport1_uart_device = {
540 .name = "bfin-sport-uart",
541 .id = 1,
Sonic Zhangdf5de262009-09-23 05:01:56 +0000542 .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
543 .resource = bfin_sport1_uart_resources,
544 .dev = {
545 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
546 },
Bryan Wu1394f032007-05-06 14:50:22 -0700547};
548#endif
Sonic Zhangdf5de262009-09-23 05:01:56 +0000549#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700550
551#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
Sonic Zhang02460d02010-06-11 10:44:22 +0000552#include <linux/bfin_mac.h>
553static const unsigned short bfin_mac_peripherals[] = P_MII0;
554
555static struct bfin_phydev_platform_data bfin_phydev_data[] = {
556 {
557 .addr = 1,
558 .irq = IRQ_MAC_PHYINT,
559 },
560};
561
562static struct bfin_mii_bus_platform_data bfin_mii_bus_data = {
563 .phydev_number = 1,
564 .phydev_data = bfin_phydev_data,
565 .phy_mode = PHY_INTERFACE_MODE_MII,
566 .mac_peripherals = bfin_mac_peripherals,
567};
568
Graf Yang65319622009-02-04 16:49:45 +0800569static struct platform_device bfin_mii_bus = {
570 .name = "bfin_mii_bus",
Sonic Zhang02460d02010-06-11 10:44:22 +0000571 .dev = {
572 .platform_data = &bfin_mii_bus_data,
573 }
Graf Yang65319622009-02-04 16:49:45 +0800574};
575
Bryan Wu1394f032007-05-06 14:50:22 -0700576static struct platform_device bfin_mac_device = {
577 .name = "bfin_mac",
Sonic Zhang02460d02010-06-11 10:44:22 +0000578 .dev = {
579 .platform_data = &bfin_mii_bus,
580 }
Bryan Wu1394f032007-05-06 14:50:22 -0700581};
582#endif
583
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800584#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
Mike Frysingerfe5aeb92008-08-05 18:29:56 +0800585#define PATA_INT IRQ_PF14
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800586
587static struct pata_platform_info bfin_pata_platform_data = {
588 .ioport_shift = 2,
Yong Zhang7832bb52011-09-07 16:10:03 +0800589 .irq_type = IRQF_TRIGGER_HIGH,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800590};
591
592static struct resource bfin_pata_resources[] = {
593 {
594 .start = 0x2030C000,
595 .end = 0x2030C01F,
596 .flags = IORESOURCE_MEM,
597 },
598 {
599 .start = 0x2030D018,
600 .end = 0x2030D01B,
601 .flags = IORESOURCE_MEM,
602 },
603 {
604 .start = PATA_INT,
605 .end = PATA_INT,
606 .flags = IORESOURCE_IRQ,
607 },
608};
609
610static struct platform_device bfin_pata_device = {
611 .name = "pata_platform",
612 .id = -1,
613 .num_resources = ARRAY_SIZE(bfin_pata_resources),
614 .resource = bfin_pata_resources,
615 .dev = {
616 .platform_data = &bfin_pata_platform_data,
617 }
618};
619#endif
620
Michael Hennerich14b03202008-05-07 11:41:26 +0800621static const unsigned int cclk_vlev_datasheet[] =
622{
623 VRPAIR(VLEV_085, 250000000),
624 VRPAIR(VLEV_090, 376000000),
625 VRPAIR(VLEV_095, 426000000),
626 VRPAIR(VLEV_100, 426000000),
627 VRPAIR(VLEV_105, 476000000),
628 VRPAIR(VLEV_110, 476000000),
629 VRPAIR(VLEV_115, 476000000),
630 VRPAIR(VLEV_120, 500000000),
631 VRPAIR(VLEV_125, 533000000),
632 VRPAIR(VLEV_130, 600000000),
633};
634
635static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
636 .tuple_tab = cclk_vlev_datasheet,
637 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
638 .vr_settling_time = 25 /* us */,
639};
640
641static struct platform_device bfin_dpmc = {
642 .name = "bfin dpmc",
643 .dev = {
644 .platform_data = &bfin_dmpc_vreg_data,
645 },
646};
647
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000648static struct platform_device *cm_bf537u_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +0800649
650 &bfin_dpmc,
651
Michael Hennerich0d4a89b2008-01-27 19:58:46 +0800652#if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
653 &hitachi_fb_device,
654#endif
655
Bryan Wu1394f032007-05-06 14:50:22 -0700656#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
657 &rtc_device,
658#endif
659
660#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000661#ifdef CONFIG_SERIAL_BFIN_UART0
662 &bfin_uart0_device,
663#endif
664#ifdef CONFIG_SERIAL_BFIN_UART1
665 &bfin_uart1_device,
666#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700667#endif
668
Graf Yang5be36d22008-04-25 03:09:15 +0800669#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang42bd8bc2009-01-07 23:14:39 +0800670#ifdef CONFIG_BFIN_SIR0
671 &bfin_sir0_device,
672#endif
673#ifdef CONFIG_BFIN_SIR1
674 &bfin_sir1_device,
675#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800676#endif
677
Mike Frysinger56ce8352008-03-26 06:00:18 +0800678#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
679 &i2c_bfin_twi_device,
680#endif
681
Bryan Wu1394f032007-05-06 14:50:22 -0700682#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
Sonic Zhangdf5de262009-09-23 05:01:56 +0000683#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
Bryan Wu1394f032007-05-06 14:50:22 -0700684 &bfin_sport0_uart_device,
Sonic Zhangdf5de262009-09-23 05:01:56 +0000685#endif
686#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
Bryan Wu1394f032007-05-06 14:50:22 -0700687 &bfin_sport1_uart_device,
688#endif
Sonic Zhangdf5de262009-09-23 05:01:56 +0000689#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700690
691#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
692 &isp1362_hcd_device,
693#endif
694
695#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
696 &smc91x_device,
697#endif
698
699#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
Graf Yang65319622009-02-04 16:49:45 +0800700 &bfin_mii_bus,
Bryan Wu1394f032007-05-06 14:50:22 -0700701 &bfin_mac_device,
702#endif
703
704#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
705 &net2272_bfin_device,
706#endif
707
Sonic Zhang7d157fb2011-11-07 18:40:10 +0800708#if defined(CONFIG_SPI_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800709 &bfin_spi0_device,
710#endif
711
712#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
713 &bfin_pata_device,
Bryan Wu1394f032007-05-06 14:50:22 -0700714#endif
Mike Frysinger8ea89492008-08-05 18:14:44 +0800715
716#if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
717 &cm_flash_device,
718#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700719};
720
Mike Frysinger9be86312011-05-04 11:20:15 -0400721static int __init net2272_init(void)
722{
723#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
724 int ret;
725
726 ret = gpio_request(GPIO_PH15, driver_name);
727 if (ret)
728 return ret;
729
730 ret = gpio_request(GPIO_PH13, "net2272");
731 if (ret) {
732 gpio_free(GPIO_PH15);
733 return ret;
734 }
735
736 /* Set PH15 Low make /AMS2 work properly */
737 gpio_direction_output(GPIO_PH15, 0);
738
739 /* enable CLKBUF output */
740 bfin_write_VR_CTL(bfin_read_VR_CTL() | CLKBUFOE);
741
742 /* Reset the USB chip */
743 gpio_direction_output(GPIO_PH13, 0);
744 mdelay(2);
745 gpio_set_value(GPIO_PH13, 1);
746#endif
747
748 return 0;
749}
750
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000751static int __init cm_bf537u_init(void)
Bryan Wu1394f032007-05-06 14:50:22 -0700752{
Harvey Harrisonb85d8582008-04-23 09:39:01 +0800753 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000754 platform_add_devices(cm_bf537u_devices, ARRAY_SIZE(cm_bf537u_devices));
Sonic Zhang7d157fb2011-11-07 18:40:10 +0800755#if defined(CONFIG_SPI_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_MODULE)
Bryan Wu1394f032007-05-06 14:50:22 -0700756 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
757#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800758
759#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
Thomas Gleixnerbc2f6bd2011-02-06 18:23:38 +0000760 irq_set_status_flags(PATA_INT, IRQ_NOAUTOEN);
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800761#endif
Mike Frysinger9be86312011-05-04 11:20:15 -0400762
763 if (net2272_init())
764 pr_warning("unable to configure net2272; it probably won't work\n");
765
Bryan Wu1394f032007-05-06 14:50:22 -0700766 return 0;
767}
768
Harald Krapfenbauer60584342009-09-10 15:12:08 +0000769arch_initcall(cm_bf537u_init);
Mike Frysinger137b1522007-11-22 16:07:03 +0800770
Sonic Zhangc13ce9f2009-09-23 09:37:46 +0000771static struct platform_device *cm_bf537u_early_devices[] __initdata = {
772#if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
773#ifdef CONFIG_SERIAL_BFIN_UART0
774 &bfin_uart0_device,
775#endif
776#ifdef CONFIG_SERIAL_BFIN_UART1
777 &bfin_uart1_device,
778#endif
779#endif
780
781#if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
782#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
783 &bfin_sport0_uart_device,
784#endif
785#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
786 &bfin_sport1_uart_device,
787#endif
788#endif
789};
790
791void __init native_machine_early_platform_add_devices(void)
792{
793 printk(KERN_INFO "register early platform devices\n");
794 early_platform_add_devices(cm_bf537u_early_devices,
795 ARRAY_SIZE(cm_bf537u_early_devices));
796}
797
Danny Kukawkafa63c6d2012-02-16 07:09:30 +0000798int bfin_get_ether_addr(char *addr)
Mike Frysinger137b1522007-11-22 16:07:03 +0800799{
Danny Kukawkafa63c6d2012-02-16 07:09:30 +0000800 return 1;
Mike Frysinger137b1522007-11-22 16:07:03 +0800801}
Mike Frysinger9862cc52007-11-15 21:21:20 +0800802EXPORT_SYMBOL(bfin_get_ether_addr);