Commit | Line | Data |
---|---|---|
1394f032 | 1 | /* |
96f1050d RG |
2 | * Copyright 2004-2009 Analog Devices Inc. |
3 | * 2005 National ICT Australia (NICTA) | |
4 | * Aidan Williams <aidan@nicta.com.au> | |
1394f032 | 5 | * |
96f1050d | 6 | * Licensed under the GPL-2 or later. |
1394f032 BW |
7 | */ |
8 | ||
9 | #include <linux/device.h> | |
10 | #include <linux/platform_device.h> | |
de8c43f2 MF |
11 | #include <linux/mtd/mtd.h> |
12 | #include <linux/mtd/partitions.h> | |
13 | #include <linux/mtd/physmap.h> | |
1394f032 | 14 | #include <linux/spi/spi.h> |
140a9aec | 15 | #include <linux/irq.h> |
1f83b8f1 | 16 | #include <linux/interrupt.h> |
4ba7b5f0 | 17 | #include <linux/gpio.h> |
027285e8 | 18 | #include <linux/delay.h> |
c6c4d7bb | 19 | #include <asm/dma.h> |
1f83b8f1 | 20 | #include <asm/bfin5xx_spi.h> |
5d448dd5 | 21 | #include <asm/portmux.h> |
14b03204 | 22 | #include <asm/dpmc.h> |
1394f032 BW |
23 | |
24 | /* | |
25 | * Name the Board for the /proc/cpuinfo | |
26 | */ | |
fe85cad2 | 27 | const char bfin_board_name[] = "ADI BF561-EZKIT"; |
1394f032 | 28 | |
c4a2c58d | 29 | #if IS_ENABLED(CONFIG_USB_ISP1760_HCD) |
3f375690 MH |
30 | #include <linux/usb/isp1760.h> |
31 | static struct resource bfin_isp1760_resources[] = { | |
32 | [0] = { | |
33 | .start = 0x2C0F0000, | |
34 | .end = 0x203C0000 + 0xfffff, | |
140a9aec MH |
35 | .flags = IORESOURCE_MEM, |
36 | }, | |
3f375690 MH |
37 | [1] = { |
38 | .start = IRQ_PF10, | |
39 | .end = IRQ_PF10, | |
140a9aec MH |
40 | .flags = IORESOURCE_IRQ, |
41 | }, | |
42 | }; | |
43 | ||
3f375690 MH |
44 | static struct isp1760_platform_data isp1760_priv = { |
45 | .is_isp1761 = 0, | |
3f375690 MH |
46 | .bus_width_16 = 1, |
47 | .port1_otg = 0, | |
48 | .analog_oc = 0, | |
49 | .dack_polarity_high = 0, | |
50 | .dreq_polarity_high = 0, | |
140a9aec MH |
51 | }; |
52 | ||
3f375690 | 53 | static struct platform_device bfin_isp1760_device = { |
c6feb768 | 54 | .name = "isp1760", |
3f375690 MH |
55 | .id = 0, |
56 | .dev = { | |
57 | .platform_data = &isp1760_priv, | |
58 | }, | |
59 | .num_resources = ARRAY_SIZE(bfin_isp1760_resources), | |
60 | .resource = bfin_isp1760_resources, | |
140a9aec | 61 | }; |
140a9aec MH |
62 | #endif |
63 | ||
c4a2c58d | 64 | #if IS_ENABLED(CONFIG_USB_ISP1362_HCD) |
e9d76c2d MH |
65 | #include <linux/usb/isp1362.h> |
66 | ||
67 | static struct resource isp1362_hcd_resources[] = { | |
68 | { | |
69 | .start = 0x2c060000, | |
70 | .end = 0x2c060000, | |
71 | .flags = IORESOURCE_MEM, | |
72 | }, { | |
73 | .start = 0x2c060004, | |
74 | .end = 0x2c060004, | |
75 | .flags = IORESOURCE_MEM, | |
76 | }, { | |
77 | .start = IRQ_PF8, | |
78 | .end = IRQ_PF8, | |
9e75894c | 79 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE, |
e9d76c2d MH |
80 | }, |
81 | }; | |
82 | ||
83 | static struct isp1362_platform_data isp1362_priv = { | |
84 | .sel15Kres = 1, | |
85 | .clknotstop = 0, | |
86 | .oc_enable = 0, | |
87 | .int_act_high = 0, | |
88 | .int_edge_triggered = 0, | |
89 | .remote_wakeup_connected = 0, | |
90 | .no_power_switching = 1, | |
91 | .power_switching_mode = 0, | |
92 | }; | |
93 | ||
94 | static struct platform_device isp1362_hcd_device = { | |
95 | .name = "isp1362-hcd", | |
96 | .id = 0, | |
97 | .dev = { | |
98 | .platform_data = &isp1362_priv, | |
99 | }, | |
100 | .num_resources = ARRAY_SIZE(isp1362_hcd_resources), | |
101 | .resource = isp1362_hcd_resources, | |
102 | }; | |
103 | #endif | |
104 | ||
c4a2c58d | 105 | #if IS_ENABLED(CONFIG_USB_NET2272) |
83d9cde0 MH |
106 | static struct resource net2272_bfin_resources[] = { |
107 | { | |
108 | .start = 0x2C000000, | |
109 | .end = 0x2C000000 + 0x7F, | |
110 | .flags = IORESOURCE_MEM, | |
9be8631b MF |
111 | }, { |
112 | .start = 1, | |
113 | .flags = IORESOURCE_BUS, | |
83d9cde0 MH |
114 | }, { |
115 | .start = IRQ_PF10, | |
116 | .end = IRQ_PF10, | |
117 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, | |
118 | }, | |
119 | }; | |
120 | ||
121 | static struct platform_device net2272_bfin_device = { | |
122 | .name = "net2272", | |
123 | .id = -1, | |
124 | .num_resources = ARRAY_SIZE(net2272_bfin_resources), | |
125 | .resource = net2272_bfin_resources, | |
126 | }; | |
127 | #endif | |
128 | ||
1394f032 BW |
129 | /* |
130 | * USB-LAN EzExtender board | |
131 | * Driver needs to know address, irq and flag pin. | |
132 | */ | |
c4a2c58d | 133 | #if IS_ENABLED(CONFIG_SMC91X) |
61f09b5a MH |
134 | #include <linux/smc91x.h> |
135 | ||
136 | static struct smc91x_platdata smc91x_info = { | |
2fb04fdf RK |
137 | .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT | SMC91X_USE_32BIT | |
138 | SMC91X_NOWAIT, | |
61f09b5a MH |
139 | .leda = RPC_LED_100_10, |
140 | .ledb = RPC_LED_TX_RX, | |
141 | }; | |
142 | ||
1394f032 BW |
143 | static struct resource smc91x_resources[] = { |
144 | { | |
145 | .name = "smc91x-regs", | |
146 | .start = 0x2C010300, | |
147 | .end = 0x2C010300 + 16, | |
148 | .flags = IORESOURCE_MEM, | |
1f83b8f1 | 149 | }, { |
1394f032 BW |
150 | |
151 | .start = IRQ_PF9, | |
152 | .end = IRQ_PF9, | |
153 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, | |
154 | }, | |
155 | }; | |
156 | ||
157 | static struct platform_device smc91x_device = { | |
158 | .name = "smc91x", | |
159 | .id = 0, | |
160 | .num_resources = ARRAY_SIZE(smc91x_resources), | |
161 | .resource = smc91x_resources, | |
61f09b5a MH |
162 | .dev = { |
163 | .platform_data = &smc91x_info, | |
164 | }, | |
1394f032 BW |
165 | }; |
166 | #endif | |
167 | ||
c4a2c58d | 168 | #if IS_ENABLED(CONFIG_SERIAL_BFIN) |
6bd1fbea SZ |
169 | #ifdef CONFIG_SERIAL_BFIN_UART0 |
170 | static struct resource bfin_uart0_resources[] = { | |
1f83b8f1 | 171 | { |
6bd1fbea SZ |
172 | .start = BFIN_UART_THR, |
173 | .end = BFIN_UART_GCTL+2, | |
1f83b8f1 MF |
174 | .flags = IORESOURCE_MEM, |
175 | }, | |
edb0a640 SZ |
176 | { |
177 | .start = IRQ_UART_TX, | |
178 | .end = IRQ_UART_TX, | |
179 | .flags = IORESOURCE_IRQ, | |
180 | }, | |
6bd1fbea SZ |
181 | { |
182 | .start = IRQ_UART_RX, | |
edb0a640 | 183 | .end = IRQ_UART_RX, |
6bd1fbea SZ |
184 | .flags = IORESOURCE_IRQ, |
185 | }, | |
186 | { | |
187 | .start = IRQ_UART_ERROR, | |
188 | .end = IRQ_UART_ERROR, | |
189 | .flags = IORESOURCE_IRQ, | |
190 | }, | |
191 | { | |
192 | .start = CH_UART_TX, | |
193 | .end = CH_UART_TX, | |
194 | .flags = IORESOURCE_DMA, | |
195 | }, | |
196 | { | |
197 | .start = CH_UART_RX, | |
198 | .end = CH_UART_RX, | |
199 | .flags = IORESOURCE_DMA, | |
200 | }, | |
201 | }; | |
202 | ||
a8b19886 | 203 | static unsigned short bfin_uart0_peripherals[] = { |
6bd1fbea | 204 | P_UART0_TX, P_UART0_RX, 0 |
1394f032 BW |
205 | }; |
206 | ||
6bd1fbea | 207 | static struct platform_device bfin_uart0_device = { |
1f83b8f1 | 208 | .name = "bfin-uart", |
6bd1fbea SZ |
209 | .id = 0, |
210 | .num_resources = ARRAY_SIZE(bfin_uart0_resources), | |
211 | .resource = bfin_uart0_resources, | |
212 | .dev = { | |
213 | .platform_data = &bfin_uart0_peripherals, /* Passed to driver */ | |
214 | }, | |
1394f032 BW |
215 | }; |
216 | #endif | |
6bd1fbea | 217 | #endif |
1394f032 | 218 | |
c4a2c58d | 219 | #if IS_ENABLED(CONFIG_BFIN_SIR) |
5be36d22 | 220 | #ifdef CONFIG_BFIN_SIR0 |
42bd8bcb | 221 | static struct resource bfin_sir0_resources[] = { |
5be36d22 GY |
222 | { |
223 | .start = 0xFFC00400, | |
224 | .end = 0xFFC004FF, | |
225 | .flags = IORESOURCE_MEM, | |
226 | }, | |
42bd8bcb GY |
227 | { |
228 | .start = IRQ_UART0_RX, | |
229 | .end = IRQ_UART0_RX+1, | |
230 | .flags = IORESOURCE_IRQ, | |
231 | }, | |
232 | { | |
233 | .start = CH_UART0_RX, | |
234 | .end = CH_UART0_RX+1, | |
235 | .flags = IORESOURCE_DMA, | |
236 | }, | |
5be36d22 GY |
237 | }; |
238 | ||
42bd8bcb | 239 | static struct platform_device bfin_sir0_device = { |
5be36d22 GY |
240 | .name = "bfin_sir", |
241 | .id = 0, | |
42bd8bcb GY |
242 | .num_resources = ARRAY_SIZE(bfin_sir0_resources), |
243 | .resource = bfin_sir0_resources, | |
5be36d22 GY |
244 | }; |
245 | #endif | |
42bd8bcb | 246 | #endif |
5be36d22 | 247 | |
c4a2c58d | 248 | #if IS_ENABLED(CONFIG_MTD_PHYSMAP) |
de8c43f2 MF |
249 | static struct mtd_partition ezkit_partitions[] = { |
250 | { | |
aa582977 | 251 | .name = "bootloader(nor)", |
edf05641 | 252 | .size = 0x40000, |
de8c43f2 MF |
253 | .offset = 0, |
254 | }, { | |
aa582977 | 255 | .name = "linux kernel(nor)", |
ac76d889 | 256 | .size = 0x1C0000, |
de8c43f2 MF |
257 | .offset = MTDPART_OFS_APPEND, |
258 | }, { | |
aa582977 | 259 | .name = "file system(nor)", |
56072047 MF |
260 | .size = 0x800000 - 0x40000 - 0x1C0000 - 0x2000 * 8, |
261 | .offset = MTDPART_OFS_APPEND, | |
262 | }, { | |
263 | .name = "config(nor)", | |
264 | .size = 0x2000 * 7, | |
265 | .offset = MTDPART_OFS_APPEND, | |
266 | }, { | |
267 | .name = "u-boot env(nor)", | |
268 | .size = 0x2000, | |
de8c43f2 MF |
269 | .offset = MTDPART_OFS_APPEND, |
270 | } | |
271 | }; | |
272 | ||
273 | static struct physmap_flash_data ezkit_flash_data = { | |
274 | .width = 2, | |
275 | .parts = ezkit_partitions, | |
276 | .nr_parts = ARRAY_SIZE(ezkit_partitions), | |
277 | }; | |
278 | ||
279 | static struct resource ezkit_flash_resource = { | |
280 | .start = 0x20000000, | |
281 | .end = 0x207fffff, | |
282 | .flags = IORESOURCE_MEM, | |
283 | }; | |
284 | ||
285 | static struct platform_device ezkit_flash_device = { | |
286 | .name = "physmap-flash", | |
287 | .id = 0, | |
288 | .dev = { | |
289 | .platform_data = &ezkit_flash_data, | |
290 | }, | |
291 | .num_resources = 1, | |
292 | .resource = &ezkit_flash_resource, | |
293 | }; | |
793dc27b | 294 | #endif |
de8c43f2 | 295 | |
c4a2c58d | 296 | #if IS_ENABLED(CONFIG_SPI_BFIN5XX) |
c6c4d7bb BW |
297 | /* SPI (0) */ |
298 | static struct resource bfin_spi0_resource[] = { | |
299 | [0] = { | |
300 | .start = SPI0_REGBASE, | |
301 | .end = SPI0_REGBASE + 0xFF, | |
302 | .flags = IORESOURCE_MEM, | |
303 | }, | |
304 | [1] = { | |
305 | .start = CH_SPI, | |
306 | .end = CH_SPI, | |
53122693 YL |
307 | .flags = IORESOURCE_DMA, |
308 | }, | |
309 | [2] = { | |
310 | .start = IRQ_SPI, | |
311 | .end = IRQ_SPI, | |
c6c4d7bb BW |
312 | .flags = IORESOURCE_IRQ, |
313 | } | |
314 | }; | |
315 | ||
1394f032 | 316 | /* SPI controller data */ |
c6c4d7bb | 317 | static struct bfin5xx_spi_master bfin_spi0_info = { |
1394f032 BW |
318 | .num_chipselect = 8, |
319 | .enable_dma = 1, /* master has the ability to do dma transfer */ | |
5d448dd5 | 320 | .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0}, |
1394f032 BW |
321 | }; |
322 | ||
c6c4d7bb BW |
323 | static struct platform_device bfin_spi0_device = { |
324 | .name = "bfin-spi", | |
325 | .id = 0, /* Bus number */ | |
326 | .num_resources = ARRAY_SIZE(bfin_spi0_resource), | |
327 | .resource = bfin_spi0_resource, | |
1394f032 | 328 | .dev = { |
c6c4d7bb | 329 | .platform_data = &bfin_spi0_info, /* Passed to driver */ |
1394f032 BW |
330 | }, |
331 | }; | |
5bda2723 | 332 | #endif |
1394f032 BW |
333 | |
334 | static struct spi_board_info bfin_spi_board_info[] __initdata = { | |
c4a2c58d | 335 | #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD183X) |
1394f032 | 336 | { |
7ba80063 | 337 | .modalias = "ad183x", |
1394f032 | 338 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ |
c6c4d7bb | 339 | .bus_num = 0, |
7ba80063 | 340 | .chip_select = 4, |
027285e8 | 341 | .platform_data = "ad1836", /* only includes chip name for the moment */ |
027285e8 | 342 | .mode = SPI_MODE_3, |
1394f032 BW |
343 | }, |
344 | #endif | |
c4a2c58d | 345 | #if IS_ENABLED(CONFIG_SPI_SPIDEV) |
6e668936 MH |
346 | { |
347 | .modalias = "spidev", | |
348 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ | |
349 | .bus_num = 0, | |
350 | .chip_select = 1, | |
6e668936 MH |
351 | }, |
352 | #endif | |
1394f032 BW |
353 | }; |
354 | ||
c4a2c58d | 355 | #if IS_ENABLED(CONFIG_KEYBOARD_GPIO) |
2463ef22 MH |
356 | #include <linux/input.h> |
357 | #include <linux/gpio_keys.h> | |
358 | ||
359 | static struct gpio_keys_button bfin_gpio_keys_table[] = { | |
360 | {BTN_0, GPIO_PF5, 1, "gpio-keys: BTN0"}, | |
361 | {BTN_1, GPIO_PF6, 1, "gpio-keys: BTN1"}, | |
362 | {BTN_2, GPIO_PF7, 1, "gpio-keys: BTN2"}, | |
363 | {BTN_3, GPIO_PF8, 1, "gpio-keys: BTN3"}, | |
364 | }; | |
365 | ||
366 | static struct gpio_keys_platform_data bfin_gpio_keys_data = { | |
367 | .buttons = bfin_gpio_keys_table, | |
368 | .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table), | |
369 | }; | |
370 | ||
371 | static struct platform_device bfin_device_gpiokeys = { | |
372 | .name = "gpio-keys", | |
373 | .dev = { | |
374 | .platform_data = &bfin_gpio_keys_data, | |
375 | }, | |
376 | }; | |
377 | #endif | |
378 | ||
c4a2c58d | 379 | #if IS_ENABLED(CONFIG_I2C_GPIO) |
e3163954 BW |
380 | #include <linux/i2c-gpio.h> |
381 | ||
382 | static struct i2c_gpio_platform_data i2c_gpio_data = { | |
3d7dc883 MF |
383 | .sda_pin = GPIO_PF1, |
384 | .scl_pin = GPIO_PF0, | |
e3163954 BW |
385 | .sda_is_open_drain = 0, |
386 | .scl_is_open_drain = 0, | |
7c8e62de | 387 | .udelay = 10, |
e3163954 BW |
388 | }; |
389 | ||
390 | static struct platform_device i2c_gpio_device = { | |
391 | .name = "i2c-gpio", | |
392 | .id = 0, | |
393 | .dev = { | |
394 | .platform_data = &i2c_gpio_data, | |
395 | }, | |
396 | }; | |
397 | #endif | |
398 | ||
14b03204 MH |
399 | static const unsigned int cclk_vlev_datasheet[] = |
400 | { | |
401 | VRPAIR(VLEV_085, 250000000), | |
402 | VRPAIR(VLEV_090, 300000000), | |
403 | VRPAIR(VLEV_095, 313000000), | |
404 | VRPAIR(VLEV_100, 350000000), | |
405 | VRPAIR(VLEV_105, 400000000), | |
406 | VRPAIR(VLEV_110, 444000000), | |
407 | VRPAIR(VLEV_115, 450000000), | |
408 | VRPAIR(VLEV_120, 475000000), | |
409 | VRPAIR(VLEV_125, 500000000), | |
410 | VRPAIR(VLEV_130, 600000000), | |
411 | }; | |
412 | ||
413 | static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = { | |
414 | .tuple_tab = cclk_vlev_datasheet, | |
415 | .tabsize = ARRAY_SIZE(cclk_vlev_datasheet), | |
416 | .vr_settling_time = 25 /* us */, | |
417 | }; | |
418 | ||
419 | static struct platform_device bfin_dpmc = { | |
420 | .name = "bfin dpmc", | |
421 | .dev = { | |
422 | .platform_data = &bfin_dmpc_vreg_data, | |
423 | }, | |
424 | }; | |
425 | ||
c4a2c58d | 426 | #if IS_ENABLED(CONFIG_VIDEO_BLACKFIN_CAPTURE) |
dda6779f BL |
427 | #include <linux/videodev2.h> |
428 | #include <media/blackfin/bfin_capture.h> | |
429 | #include <media/blackfin/ppi.h> | |
430 | ||
431 | static const unsigned short ppi_req[] = { | |
432 | P_PPI0_D0, P_PPI0_D1, P_PPI0_D2, P_PPI0_D3, | |
433 | P_PPI0_D4, P_PPI0_D5, P_PPI0_D6, P_PPI0_D7, | |
434 | P_PPI0_CLK, P_PPI0_FS1, P_PPI0_FS2, | |
435 | 0, | |
436 | }; | |
437 | ||
438 | static const struct ppi_info ppi_info = { | |
439 | .type = PPI_TYPE_PPI, | |
440 | .dma_ch = CH_PPI0, | |
441 | .irq_err = IRQ_PPI1_ERROR, | |
442 | .base = (void __iomem *)PPI0_CONTROL, | |
443 | .pin_req = ppi_req, | |
444 | }; | |
445 | ||
c4a2c58d | 446 | #if IS_ENABLED(CONFIG_VIDEO_ADV7183) |
b5dcee22 | 447 | #include <media/i2c/adv7183.h> |
dda6779f BL |
448 | static struct v4l2_input adv7183_inputs[] = { |
449 | { | |
450 | .index = 0, | |
451 | .name = "Composite", | |
452 | .type = V4L2_INPUT_TYPE_CAMERA, | |
453 | .std = V4L2_STD_ALL, | |
c38670bc | 454 | .capabilities = V4L2_IN_CAP_STD, |
dda6779f BL |
455 | }, |
456 | { | |
457 | .index = 1, | |
458 | .name = "S-Video", | |
459 | .type = V4L2_INPUT_TYPE_CAMERA, | |
460 | .std = V4L2_STD_ALL, | |
c38670bc | 461 | .capabilities = V4L2_IN_CAP_STD, |
dda6779f BL |
462 | }, |
463 | { | |
464 | .index = 2, | |
465 | .name = "Component", | |
466 | .type = V4L2_INPUT_TYPE_CAMERA, | |
467 | .std = V4L2_STD_ALL, | |
c38670bc | 468 | .capabilities = V4L2_IN_CAP_STD, |
dda6779f BL |
469 | }, |
470 | }; | |
471 | ||
472 | static struct bcap_route adv7183_routes[] = { | |
473 | { | |
474 | .input = ADV7183_COMPOSITE4, | |
475 | .output = ADV7183_8BIT_OUT, | |
476 | }, | |
477 | { | |
478 | .input = ADV7183_SVIDEO0, | |
479 | .output = ADV7183_8BIT_OUT, | |
480 | }, | |
481 | { | |
482 | .input = ADV7183_COMPONENT0, | |
483 | .output = ADV7183_8BIT_OUT, | |
484 | }, | |
485 | }; | |
486 | ||
487 | ||
488 | static const unsigned adv7183_gpio[] = { | |
489 | GPIO_PF13, /* reset pin */ | |
490 | GPIO_PF2, /* output enable pin */ | |
491 | }; | |
492 | ||
493 | static struct bfin_capture_config bfin_capture_data = { | |
494 | .card_name = "BF561", | |
495 | .inputs = adv7183_inputs, | |
496 | .num_inputs = ARRAY_SIZE(adv7183_inputs), | |
497 | .routes = adv7183_routes, | |
498 | .i2c_adapter_id = 0, | |
499 | .board_info = { | |
500 | .type = "adv7183", | |
501 | .addr = 0x20, | |
502 | .platform_data = (void *)adv7183_gpio, | |
503 | }, | |
504 | .ppi_info = &ppi_info, | |
505 | .ppi_control = (PACK_EN | DLEN_8 | DMA32 | FLD_SEL), | |
506 | }; | |
507 | #endif | |
508 | ||
509 | static struct platform_device bfin_capture_device = { | |
510 | .name = "bfin_capture", | |
511 | .dev = { | |
512 | .platform_data = &bfin_capture_data, | |
513 | }, | |
514 | }; | |
515 | #endif | |
516 | ||
c4a2c58d | 517 | #if IS_ENABLED(CONFIG_SND_BF5XX_I2S) |
027285e8 BS |
518 | static struct platform_device bfin_i2s = { |
519 | .name = "bfin-i2s", | |
520 | .id = CONFIG_SND_BF5XX_SPORT_NUM, | |
521 | /* TODO: add platform data here */ | |
522 | }; | |
523 | #endif | |
524 | ||
c4a2c58d | 525 | #if IS_ENABLED(CONFIG_SND_BF5XX_AC97) |
027285e8 BS |
526 | static struct platform_device bfin_ac97 = { |
527 | .name = "bfin-ac97", | |
528 | .id = CONFIG_SND_BF5XX_SPORT_NUM, | |
529 | /* TODO: add platform data here */ | |
530 | }; | |
531 | #endif | |
532 | ||
c4a2c58d | 533 | #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD1836) |
63f49dce | 534 | static const char * const ad1836_link[] = { |
34f40955 | 535 | "bfin-i2s.0", |
63f49dce SJ |
536 | "spi0.4", |
537 | }; | |
538 | static struct platform_device bfin_ad1836_machine = { | |
539 | .name = "bfin-snd-ad1836", | |
540 | .id = -1, | |
541 | .dev = { | |
542 | .platform_data = (void *)ad1836_link, | |
543 | }, | |
544 | }; | |
545 | #endif | |
546 | ||
1394f032 | 547 | static struct platform_device *ezkit_devices[] __initdata = { |
14b03204 MH |
548 | |
549 | &bfin_dpmc, | |
550 | ||
c4a2c58d | 551 | #if IS_ENABLED(CONFIG_SMC91X) |
1394f032 BW |
552 | &smc91x_device, |
553 | #endif | |
561cc18b | 554 | |
c4a2c58d | 555 | #if IS_ENABLED(CONFIG_USB_NET2272) |
83d9cde0 MH |
556 | &net2272_bfin_device, |
557 | #endif | |
558 | ||
c4a2c58d | 559 | #if IS_ENABLED(CONFIG_USB_ISP1760_HCD) |
3f375690 MH |
560 | &bfin_isp1760_device, |
561 | #endif | |
562 | ||
c4a2c58d | 563 | #if IS_ENABLED(CONFIG_SPI_BFIN5XX) |
c6c4d7bb | 564 | &bfin_spi0_device, |
1394f032 | 565 | #endif |
2463ef22 | 566 | |
c4a2c58d | 567 | #if IS_ENABLED(CONFIG_SERIAL_BFIN) |
6bd1fbea SZ |
568 | #ifdef CONFIG_SERIAL_BFIN_UART0 |
569 | &bfin_uart0_device, | |
570 | #endif | |
1394f032 | 571 | #endif |
2463ef22 | 572 | |
c4a2c58d | 573 | #if IS_ENABLED(CONFIG_BFIN_SIR) |
42bd8bcb GY |
574 | #ifdef CONFIG_BFIN_SIR0 |
575 | &bfin_sir0_device, | |
576 | #endif | |
5be36d22 GY |
577 | #endif |
578 | ||
c4a2c58d | 579 | #if IS_ENABLED(CONFIG_KEYBOARD_GPIO) |
2463ef22 MH |
580 | &bfin_device_gpiokeys, |
581 | #endif | |
e3163954 | 582 | |
c4a2c58d | 583 | #if IS_ENABLED(CONFIG_I2C_GPIO) |
e3163954 BW |
584 | &i2c_gpio_device, |
585 | #endif | |
e9d76c2d | 586 | |
c4a2c58d | 587 | #if IS_ENABLED(CONFIG_USB_ISP1362_HCD) |
e9d76c2d MH |
588 | &isp1362_hcd_device, |
589 | #endif | |
590 | ||
c4a2c58d | 591 | #if IS_ENABLED(CONFIG_MTD_PHYSMAP) |
de8c43f2 | 592 | &ezkit_flash_device, |
793dc27b | 593 | #endif |
027285e8 | 594 | |
c4a2c58d | 595 | #if IS_ENABLED(CONFIG_VIDEO_BLACKFIN_CAPTURE) |
dda6779f BL |
596 | &bfin_capture_device, |
597 | #endif | |
598 | ||
c4a2c58d | 599 | #if IS_ENABLED(CONFIG_SND_BF5XX_I2S) |
027285e8 BS |
600 | &bfin_i2s, |
601 | #endif | |
602 | ||
c4a2c58d | 603 | #if IS_ENABLED(CONFIG_SND_BF5XX_AC97) |
027285e8 BS |
604 | &bfin_ac97, |
605 | #endif | |
63f49dce | 606 | |
c4a2c58d | 607 | #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD1836) |
63f49dce SJ |
608 | &bfin_ad1836_machine, |
609 | #endif | |
1394f032 BW |
610 | }; |
611 | ||
9be8631b MF |
612 | static int __init net2272_init(void) |
613 | { | |
c4a2c58d | 614 | #if IS_ENABLED(CONFIG_USB_NET2272) |
9be8631b MF |
615 | int ret; |
616 | ||
617 | ret = gpio_request(GPIO_PF11, "net2272"); | |
618 | if (ret) | |
619 | return ret; | |
620 | ||
621 | /* Reset the USB chip */ | |
622 | gpio_direction_output(GPIO_PF11, 0); | |
623 | mdelay(2); | |
624 | gpio_set_value(GPIO_PF11, 1); | |
625 | #endif | |
626 | ||
627 | return 0; | |
628 | } | |
629 | ||
1394f032 BW |
630 | static int __init ezkit_init(void) |
631 | { | |
632 | int ret; | |
633 | ||
c0fc525d MF |
634 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
635 | ||
636 | ret = platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices)); | |
1394f032 BW |
637 | if (ret < 0) |
638 | return ret; | |
c0fc525d | 639 | |
c4a2c58d | 640 | #if IS_ENABLED(CONFIG_SMC91X) |
c0fc525d MF |
641 | bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() | (1 << 12)); |
642 | SSYNC(); | |
643 | #endif | |
644 | ||
c4a2c58d | 645 | #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD183X) |
027285e8 BS |
646 | bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() | (1 << 15)); |
647 | bfin_write_FIO0_FLAG_S(1 << 15); | |
648 | SSYNC(); | |
649 | /* | |
650 | * This initialization lasts for approximately 4500 MCLKs. | |
651 | * MCLK = 12.288MHz | |
652 | */ | |
653 | udelay(400); | |
654 | #endif | |
655 | ||
9be8631b MF |
656 | if (net2272_init()) |
657 | pr_warning("unable to configure net2272; it probably won't work\n"); | |
658 | ||
5bda2723 | 659 | spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); |
c6c4d7bb | 660 | return 0; |
1394f032 BW |
661 | } |
662 | ||
663 | arch_initcall(ezkit_init); | |
c13ce9fd SZ |
664 | |
665 | static struct platform_device *ezkit_early_devices[] __initdata = { | |
666 | #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK) | |
667 | #ifdef CONFIG_SERIAL_BFIN_UART0 | |
668 | &bfin_uart0_device, | |
669 | #endif | |
670 | #endif | |
671 | }; | |
672 | ||
673 | void __init native_machine_early_platform_add_devices(void) | |
674 | { | |
675 | printk(KERN_INFO "register early platform devices\n"); | |
676 | early_platform_add_devices(ezkit_early_devices, | |
677 | ARRAY_SIZE(ezkit_early_devices)); | |
678 | } |