blob: 88dee43e7abe8c4e34da9016b2333c539ef6b9a2 [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 * 2005 National ICT Australia (NICTA)
4 * Aidan Williams <aidan@nicta.com.au>
Bryan Wu1394f032007-05-06 14:50:22 -07005 *
Robin Getz96f10502009-09-24 14:11:24 +00006 * Licensed under the GPL-2 or later.
Bryan Wu1394f032007-05-06 14:50:22 -07007 */
8
9#include <linux/device.h>
10#include <linux/platform_device.h>
Mike Frysingerde8c43f2008-01-24 17:14:04 +080011#include <linux/mtd/mtd.h>
12#include <linux/mtd/partitions.h>
13#include <linux/mtd/physmap.h>
Bryan Wu1394f032007-05-06 14:50:22 -070014#include <linux/spi/spi.h>
Michael Hennerich140a9ae2007-05-21 18:09:13 +080015#include <linux/irq.h>
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080016#include <linux/interrupt.h>
Barry Song027285e2010-06-28 08:39:37 +000017#include <linux/delay.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080018#include <asm/dma.h>
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080019#include <asm/bfin5xx_spi.h>
Bryan Wu5d448dd2007-11-12 23:24:42 +080020#include <asm/portmux.h>
Michael Hennerich14b03202008-05-07 11:41:26 +080021#include <asm/dpmc.h>
Bryan Wu1394f032007-05-06 14:50:22 -070022
23/*
24 * Name the Board for the /proc/cpuinfo
25 */
Mike Frysingerfe85cad2008-11-18 17:48:22 +080026const char bfin_board_name[] = "ADI BF561-EZKIT";
Bryan Wu1394f032007-05-06 14:50:22 -070027
Steven Miaoc4a2c582014-04-12 02:07:27 +080028#if IS_ENABLED(CONFIG_USB_ISP1760_HCD)
Michael Hennerich3f375692008-11-18 17:48:22 +080029#include <linux/usb/isp1760.h>
30static struct resource bfin_isp1760_resources[] = {
31 [0] = {
32 .start = 0x2C0F0000,
33 .end = 0x203C0000 + 0xfffff,
Michael Hennerich140a9ae2007-05-21 18:09:13 +080034 .flags = IORESOURCE_MEM,
35 },
Michael Hennerich3f375692008-11-18 17:48:22 +080036 [1] = {
37 .start = IRQ_PF10,
38 .end = IRQ_PF10,
Michael Hennerich140a9ae2007-05-21 18:09:13 +080039 .flags = IORESOURCE_IRQ,
40 },
41};
42
Michael Hennerich3f375692008-11-18 17:48:22 +080043static struct isp1760_platform_data isp1760_priv = {
44 .is_isp1761 = 0,
Michael Hennerich3f375692008-11-18 17:48:22 +080045 .bus_width_16 = 1,
46 .port1_otg = 0,
47 .analog_oc = 0,
48 .dack_polarity_high = 0,
49 .dreq_polarity_high = 0,
50};
51
52static struct platform_device bfin_isp1760_device = {
Michael Hennerichc6feb762009-10-15 10:37:33 +000053 .name = "isp1760",
Michael Hennerich140a9ae2007-05-21 18:09:13 +080054 .id = 0,
Michael Hennerich3f375692008-11-18 17:48:22 +080055 .dev = {
56 .platform_data = &isp1760_priv,
57 },
58 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
59 .resource = bfin_isp1760_resources,
Michael Hennerich140a9ae2007-05-21 18:09:13 +080060};
Michael Hennerich140a9ae2007-05-21 18:09:13 +080061#endif
62
Steven Miaoc4a2c582014-04-12 02:07:27 +080063#if IS_ENABLED(CONFIG_USB_ISP1362_HCD)
Michael Henneriche9d76c22008-02-02 14:55:28 +080064#include <linux/usb/isp1362.h>
65
66static struct resource isp1362_hcd_resources[] = {
67 {
68 .start = 0x2c060000,
69 .end = 0x2c060000,
70 .flags = IORESOURCE_MEM,
71 }, {
72 .start = 0x2c060004,
73 .end = 0x2c060004,
74 .flags = IORESOURCE_MEM,
75 }, {
76 .start = IRQ_PF8,
77 .end = IRQ_PF8,
Michael Hennerich9e758942010-03-18 12:51:49 +000078 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
Michael Henneriche9d76c22008-02-02 14:55:28 +080079 },
80};
81
82static struct isp1362_platform_data isp1362_priv = {
83 .sel15Kres = 1,
84 .clknotstop = 0,
85 .oc_enable = 0,
86 .int_act_high = 0,
87 .int_edge_triggered = 0,
88 .remote_wakeup_connected = 0,
89 .no_power_switching = 1,
90 .power_switching_mode = 0,
91};
92
93static struct platform_device isp1362_hcd_device = {
94 .name = "isp1362-hcd",
95 .id = 0,
96 .dev = {
97 .platform_data = &isp1362_priv,
98 },
99 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
100 .resource = isp1362_hcd_resources,
101};
102#endif
103
Steven Miaoc4a2c582014-04-12 02:07:27 +0800104#if IS_ENABLED(CONFIG_USB_NET2272)
Michael Hennerich83d9cde2008-02-02 16:25:17 +0800105static struct resource net2272_bfin_resources[] = {
106 {
107 .start = 0x2C000000,
108 .end = 0x2C000000 + 0x7F,
109 .flags = IORESOURCE_MEM,
110 }, {
Mike Frysinger9be86312011-05-04 11:20:15 -0400111 .start = 1,
112 .flags = IORESOURCE_BUS,
113 }, {
Michael Hennerich83d9cde2008-02-02 16:25:17 +0800114 .start = IRQ_PF10,
115 .end = IRQ_PF10,
116 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
117 },
118};
119
120static struct platform_device net2272_bfin_device = {
121 .name = "net2272",
122 .id = -1,
123 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
124 .resource = net2272_bfin_resources,
125};
126#endif
127
Bryan Wu1394f032007-05-06 14:50:22 -0700128/*
129 * USB-LAN EzExtender board
130 * Driver needs to know address, irq and flag pin.
131 */
Steven Miaoc4a2c582014-04-12 02:07:27 +0800132#if IS_ENABLED(CONFIG_SMC91X)
Michael Hennerich61f09b52009-07-24 08:48:31 +0000133#include <linux/smc91x.h>
134
135static struct smc91x_platdata smc91x_info = {
136 .flags = SMC91X_USE_32BIT | SMC91X_NOWAIT,
137 .leda = RPC_LED_100_10,
138 .ledb = RPC_LED_TX_RX,
139};
140
Bryan Wu1394f032007-05-06 14:50:22 -0700141static struct resource smc91x_resources[] = {
142 {
143 .name = "smc91x-regs",
144 .start = 0x2C010300,
145 .end = 0x2C010300 + 16,
146 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800147 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700148
149 .start = IRQ_PF9,
150 .end = IRQ_PF9,
151 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
152 },
153};
154
155static struct platform_device smc91x_device = {
156 .name = "smc91x",
157 .id = 0,
158 .num_resources = ARRAY_SIZE(smc91x_resources),
159 .resource = smc91x_resources,
Michael Hennerich61f09b52009-07-24 08:48:31 +0000160 .dev = {
161 .platform_data = &smc91x_info,
162 },
Bryan Wu1394f032007-05-06 14:50:22 -0700163};
164#endif
165
Steven Miaoc4a2c582014-04-12 02:07:27 +0800166#if IS_ENABLED(CONFIG_SERIAL_BFIN)
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000167#ifdef CONFIG_SERIAL_BFIN_UART0
168static struct resource bfin_uart0_resources[] = {
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800169 {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000170 .start = BFIN_UART_THR,
171 .end = BFIN_UART_GCTL+2,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800172 .flags = IORESOURCE_MEM,
173 },
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000174 {
Sonic Zhangedb0a642011-08-01 17:53:21 +0800175 .start = IRQ_UART_TX,
176 .end = IRQ_UART_TX,
177 .flags = IORESOURCE_IRQ,
178 },
179 {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000180 .start = IRQ_UART_RX,
Sonic Zhangedb0a642011-08-01 17:53:21 +0800181 .end = IRQ_UART_RX,
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000182 .flags = IORESOURCE_IRQ,
183 },
184 {
185 .start = IRQ_UART_ERROR,
186 .end = IRQ_UART_ERROR,
187 .flags = IORESOURCE_IRQ,
188 },
189 {
190 .start = CH_UART_TX,
191 .end = CH_UART_TX,
192 .flags = IORESOURCE_DMA,
193 },
194 {
195 .start = CH_UART_RX,
196 .end = CH_UART_RX,
197 .flags = IORESOURCE_DMA,
198 },
Bryan Wu1394f032007-05-06 14:50:22 -0700199};
200
Mike Frysingera8b19882010-11-24 09:23:04 +0000201static unsigned short bfin_uart0_peripherals[] = {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000202 P_UART0_TX, P_UART0_RX, 0
Bryan Wu1394f032007-05-06 14:50:22 -0700203};
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000204
205static struct platform_device bfin_uart0_device = {
206 .name = "bfin-uart",
207 .id = 0,
208 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
209 .resource = bfin_uart0_resources,
210 .dev = {
211 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
212 },
213};
214#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700215#endif
216
Steven Miaoc4a2c582014-04-12 02:07:27 +0800217#if IS_ENABLED(CONFIG_BFIN_SIR)
Graf Yang5be36d22008-04-25 03:09:15 +0800218#ifdef CONFIG_BFIN_SIR0
Graf Yang42bd8bc2009-01-07 23:14:39 +0800219static struct resource bfin_sir0_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800220 {
221 .start = 0xFFC00400,
222 .end = 0xFFC004FF,
223 .flags = IORESOURCE_MEM,
224 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800225 {
226 .start = IRQ_UART0_RX,
227 .end = IRQ_UART0_RX+1,
228 .flags = IORESOURCE_IRQ,
229 },
230 {
231 .start = CH_UART0_RX,
232 .end = CH_UART0_RX+1,
233 .flags = IORESOURCE_DMA,
234 },
Graf Yang5be36d22008-04-25 03:09:15 +0800235};
236
Graf Yang42bd8bc2009-01-07 23:14:39 +0800237static struct platform_device bfin_sir0_device = {
Graf Yang5be36d22008-04-25 03:09:15 +0800238 .name = "bfin_sir",
239 .id = 0,
Graf Yang42bd8bc2009-01-07 23:14:39 +0800240 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
241 .resource = bfin_sir0_resources,
Graf Yang5be36d22008-04-25 03:09:15 +0800242};
243#endif
Graf Yang42bd8bc2009-01-07 23:14:39 +0800244#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800245
Steven Miaoc4a2c582014-04-12 02:07:27 +0800246#if IS_ENABLED(CONFIG_MTD_PHYSMAP)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800247static struct mtd_partition ezkit_partitions[] = {
248 {
Robin Getzaa582972008-08-05 17:47:29 +0800249 .name = "bootloader(nor)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800250 .size = 0x40000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800251 .offset = 0,
252 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800253 .name = "linux kernel(nor)",
Grace Panac76d882008-04-24 06:33:56 +0800254 .size = 0x1C0000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800255 .offset = MTDPART_OFS_APPEND,
256 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800257 .name = "file system(nor)",
Mike Frysinger56072042011-05-09 18:46:17 -0400258 .size = 0x800000 - 0x40000 - 0x1C0000 - 0x2000 * 8,
259 .offset = MTDPART_OFS_APPEND,
260 }, {
261 .name = "config(nor)",
262 .size = 0x2000 * 7,
263 .offset = MTDPART_OFS_APPEND,
264 }, {
265 .name = "u-boot env(nor)",
266 .size = 0x2000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800267 .offset = MTDPART_OFS_APPEND,
268 }
269};
270
271static struct physmap_flash_data ezkit_flash_data = {
272 .width = 2,
273 .parts = ezkit_partitions,
274 .nr_parts = ARRAY_SIZE(ezkit_partitions),
275};
276
277static struct resource ezkit_flash_resource = {
278 .start = 0x20000000,
279 .end = 0x207fffff,
280 .flags = IORESOURCE_MEM,
281};
282
283static struct platform_device ezkit_flash_device = {
284 .name = "physmap-flash",
285 .id = 0,
286 .dev = {
287 .platform_data = &ezkit_flash_data,
288 },
289 .num_resources = 1,
290 .resource = &ezkit_flash_resource,
291};
Mike Frysinger793dc272008-03-26 08:09:12 +0800292#endif
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800293
Steven Miaoc4a2c582014-04-12 02:07:27 +0800294#if IS_ENABLED(CONFIG_SPI_BFIN5XX)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800295/* SPI (0) */
296static struct resource bfin_spi0_resource[] = {
297 [0] = {
298 .start = SPI0_REGBASE,
299 .end = SPI0_REGBASE + 0xFF,
300 .flags = IORESOURCE_MEM,
301 },
302 [1] = {
303 .start = CH_SPI,
304 .end = CH_SPI,
Yi Li53122692009-06-05 12:11:11 +0000305 .flags = IORESOURCE_DMA,
306 },
307 [2] = {
308 .start = IRQ_SPI,
309 .end = IRQ_SPI,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800310 .flags = IORESOURCE_IRQ,
311 }
312};
313
Bryan Wu1394f032007-05-06 14:50:22 -0700314/* SPI controller data */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800315static struct bfin5xx_spi_master bfin_spi0_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700316 .num_chipselect = 8,
317 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800318 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Bryan Wu1394f032007-05-06 14:50:22 -0700319};
320
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800321static struct platform_device bfin_spi0_device = {
322 .name = "bfin-spi",
323 .id = 0, /* Bus number */
324 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
325 .resource = bfin_spi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -0700326 .dev = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800327 .platform_data = &bfin_spi0_info, /* Passed to driver */
Bryan Wu1394f032007-05-06 14:50:22 -0700328 },
329};
Mike Frysinger5bda2722008-06-07 15:03:01 +0800330#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700331
332static struct spi_board_info bfin_spi_board_info[] __initdata = {
Steven Miaoc4a2c582014-04-12 02:07:27 +0800333#if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD183X)
Bryan Wu1394f032007-05-06 14:50:22 -0700334 {
Barry Song7ba80062010-01-28 09:37:21 +0000335 .modalias = "ad183x",
Bryan Wu1394f032007-05-06 14:50:22 -0700336 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800337 .bus_num = 0,
Barry Song7ba80062010-01-28 09:37:21 +0000338 .chip_select = 4,
Barry Song027285e2010-06-28 08:39:37 +0000339 .platform_data = "ad1836", /* only includes chip name for the moment */
Barry Song027285e2010-06-28 08:39:37 +0000340 .mode = SPI_MODE_3,
Bryan Wu1394f032007-05-06 14:50:22 -0700341 },
342#endif
Steven Miaoc4a2c582014-04-12 02:07:27 +0800343#if IS_ENABLED(CONFIG_SPI_SPIDEV)
Michael Hennerich6e668932008-02-09 01:54:09 +0800344 {
345 .modalias = "spidev",
346 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
347 .bus_num = 0,
348 .chip_select = 1,
Michael Hennerich6e668932008-02-09 01:54:09 +0800349 },
350#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700351};
352
Steven Miaoc4a2c582014-04-12 02:07:27 +0800353#if IS_ENABLED(CONFIG_KEYBOARD_GPIO)
Michael Hennerich2463ef22008-01-27 16:49:48 +0800354#include <linux/input.h>
355#include <linux/gpio_keys.h>
356
357static struct gpio_keys_button bfin_gpio_keys_table[] = {
358 {BTN_0, GPIO_PF5, 1, "gpio-keys: BTN0"},
359 {BTN_1, GPIO_PF6, 1, "gpio-keys: BTN1"},
360 {BTN_2, GPIO_PF7, 1, "gpio-keys: BTN2"},
361 {BTN_3, GPIO_PF8, 1, "gpio-keys: BTN3"},
362};
363
364static struct gpio_keys_platform_data bfin_gpio_keys_data = {
365 .buttons = bfin_gpio_keys_table,
366 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
367};
368
369static struct platform_device bfin_device_gpiokeys = {
370 .name = "gpio-keys",
371 .dev = {
372 .platform_data = &bfin_gpio_keys_data,
373 },
374};
375#endif
376
Steven Miaoc4a2c582014-04-12 02:07:27 +0800377#if IS_ENABLED(CONFIG_I2C_GPIO)
Bryan Wue3163952008-01-24 16:19:15 +0800378#include <linux/i2c-gpio.h>
379
380static struct i2c_gpio_platform_data i2c_gpio_data = {
Mike Frysinger3d7dc882010-07-02 21:02:50 +0000381 .sda_pin = GPIO_PF1,
382 .scl_pin = GPIO_PF0,
Bryan Wue3163952008-01-24 16:19:15 +0800383 .sda_is_open_drain = 0,
384 .scl_is_open_drain = 0,
Aaron Wu7c8e62d2011-12-12 18:04:54 +0800385 .udelay = 10,
Bryan Wue3163952008-01-24 16:19:15 +0800386};
387
388static struct platform_device i2c_gpio_device = {
389 .name = "i2c-gpio",
390 .id = 0,
391 .dev = {
392 .platform_data = &i2c_gpio_data,
393 },
394};
395#endif
396
Michael Hennerich14b03202008-05-07 11:41:26 +0800397static const unsigned int cclk_vlev_datasheet[] =
398{
399 VRPAIR(VLEV_085, 250000000),
400 VRPAIR(VLEV_090, 300000000),
401 VRPAIR(VLEV_095, 313000000),
402 VRPAIR(VLEV_100, 350000000),
403 VRPAIR(VLEV_105, 400000000),
404 VRPAIR(VLEV_110, 444000000),
405 VRPAIR(VLEV_115, 450000000),
406 VRPAIR(VLEV_120, 475000000),
407 VRPAIR(VLEV_125, 500000000),
408 VRPAIR(VLEV_130, 600000000),
409};
410
411static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
412 .tuple_tab = cclk_vlev_datasheet,
413 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
414 .vr_settling_time = 25 /* us */,
415};
416
417static struct platform_device bfin_dpmc = {
418 .name = "bfin dpmc",
419 .dev = {
420 .platform_data = &bfin_dmpc_vreg_data,
421 },
422};
423
Steven Miaoc4a2c582014-04-12 02:07:27 +0800424#if IS_ENABLED(CONFIG_VIDEO_BLACKFIN_CAPTURE)
Bob Liudda67792012-01-05 11:11:20 +0800425#include <linux/videodev2.h>
426#include <media/blackfin/bfin_capture.h>
427#include <media/blackfin/ppi.h>
428
429static const unsigned short ppi_req[] = {
430 P_PPI0_D0, P_PPI0_D1, P_PPI0_D2, P_PPI0_D3,
431 P_PPI0_D4, P_PPI0_D5, P_PPI0_D6, P_PPI0_D7,
432 P_PPI0_CLK, P_PPI0_FS1, P_PPI0_FS2,
433 0,
434};
435
436static const struct ppi_info ppi_info = {
437 .type = PPI_TYPE_PPI,
438 .dma_ch = CH_PPI0,
439 .irq_err = IRQ_PPI1_ERROR,
440 .base = (void __iomem *)PPI0_CONTROL,
441 .pin_req = ppi_req,
442};
443
Steven Miaoc4a2c582014-04-12 02:07:27 +0800444#if IS_ENABLED(CONFIG_VIDEO_ADV7183)
Bob Liudda67792012-01-05 11:11:20 +0800445#include <media/adv7183.h>
446static struct v4l2_input adv7183_inputs[] = {
447 {
448 .index = 0,
449 .name = "Composite",
450 .type = V4L2_INPUT_TYPE_CAMERA,
451 .std = V4L2_STD_ALL,
Scott Jiangc38670b2012-06-20 18:46:54 -0400452 .capabilities = V4L2_IN_CAP_STD,
Bob Liudda67792012-01-05 11:11:20 +0800453 },
454 {
455 .index = 1,
456 .name = "S-Video",
457 .type = V4L2_INPUT_TYPE_CAMERA,
458 .std = V4L2_STD_ALL,
Scott Jiangc38670b2012-06-20 18:46:54 -0400459 .capabilities = V4L2_IN_CAP_STD,
Bob Liudda67792012-01-05 11:11:20 +0800460 },
461 {
462 .index = 2,
463 .name = "Component",
464 .type = V4L2_INPUT_TYPE_CAMERA,
465 .std = V4L2_STD_ALL,
Scott Jiangc38670b2012-06-20 18:46:54 -0400466 .capabilities = V4L2_IN_CAP_STD,
Bob Liudda67792012-01-05 11:11:20 +0800467 },
468};
469
470static struct bcap_route adv7183_routes[] = {
471 {
472 .input = ADV7183_COMPOSITE4,
473 .output = ADV7183_8BIT_OUT,
474 },
475 {
476 .input = ADV7183_SVIDEO0,
477 .output = ADV7183_8BIT_OUT,
478 },
479 {
480 .input = ADV7183_COMPONENT0,
481 .output = ADV7183_8BIT_OUT,
482 },
483};
484
485
486static const unsigned adv7183_gpio[] = {
487 GPIO_PF13, /* reset pin */
488 GPIO_PF2, /* output enable pin */
489};
490
491static struct bfin_capture_config bfin_capture_data = {
492 .card_name = "BF561",
493 .inputs = adv7183_inputs,
494 .num_inputs = ARRAY_SIZE(adv7183_inputs),
495 .routes = adv7183_routes,
496 .i2c_adapter_id = 0,
497 .board_info = {
498 .type = "adv7183",
499 .addr = 0x20,
500 .platform_data = (void *)adv7183_gpio,
501 },
502 .ppi_info = &ppi_info,
503 .ppi_control = (PACK_EN | DLEN_8 | DMA32 | FLD_SEL),
504};
505#endif
506
507static struct platform_device bfin_capture_device = {
508 .name = "bfin_capture",
509 .dev = {
510 .platform_data = &bfin_capture_data,
511 },
512};
513#endif
514
Steven Miaoc4a2c582014-04-12 02:07:27 +0800515#if IS_ENABLED(CONFIG_SND_BF5XX_I2S)
Barry Song027285e2010-06-28 08:39:37 +0000516static struct platform_device bfin_i2s = {
517 .name = "bfin-i2s",
518 .id = CONFIG_SND_BF5XX_SPORT_NUM,
519 /* TODO: add platform data here */
520};
521#endif
522
Steven Miaoc4a2c582014-04-12 02:07:27 +0800523#if IS_ENABLED(CONFIG_SND_BF5XX_AC97)
Barry Song027285e2010-06-28 08:39:37 +0000524static struct platform_device bfin_ac97 = {
525 .name = "bfin-ac97",
526 .id = CONFIG_SND_BF5XX_SPORT_NUM,
527 /* TODO: add platform data here */
528};
529#endif
530
Steven Miaoc4a2c582014-04-12 02:07:27 +0800531#if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD1836)
Scott Jiang63f49dc2012-08-10 18:06:09 -0400532static const char * const ad1836_link[] = {
Lars-Peter Clausen34f40952013-05-28 19:22:16 +0200533 "bfin-i2s.0",
Scott Jiang63f49dc2012-08-10 18:06:09 -0400534 "spi0.4",
535};
536static struct platform_device bfin_ad1836_machine = {
537 .name = "bfin-snd-ad1836",
538 .id = -1,
539 .dev = {
540 .platform_data = (void *)ad1836_link,
541 },
542};
543#endif
544
Bryan Wu1394f032007-05-06 14:50:22 -0700545static struct platform_device *ezkit_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +0800546
547 &bfin_dpmc,
548
Steven Miaoc4a2c582014-04-12 02:07:27 +0800549#if IS_ENABLED(CONFIG_SMC91X)
Bryan Wu1394f032007-05-06 14:50:22 -0700550 &smc91x_device,
551#endif
Michael Hennerich561cc182007-11-17 23:56:08 +0800552
Steven Miaoc4a2c582014-04-12 02:07:27 +0800553#if IS_ENABLED(CONFIG_USB_NET2272)
Michael Hennerich83d9cde2008-02-02 16:25:17 +0800554 &net2272_bfin_device,
555#endif
556
Steven Miaoc4a2c582014-04-12 02:07:27 +0800557#if IS_ENABLED(CONFIG_USB_ISP1760_HCD)
Michael Hennerich3f375692008-11-18 17:48:22 +0800558 &bfin_isp1760_device,
559#endif
560
Steven Miaoc4a2c582014-04-12 02:07:27 +0800561#if IS_ENABLED(CONFIG_SPI_BFIN5XX)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800562 &bfin_spi0_device,
Bryan Wu1394f032007-05-06 14:50:22 -0700563#endif
Michael Hennerich2463ef22008-01-27 16:49:48 +0800564
Steven Miaoc4a2c582014-04-12 02:07:27 +0800565#if IS_ENABLED(CONFIG_SERIAL_BFIN)
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000566#ifdef CONFIG_SERIAL_BFIN_UART0
567 &bfin_uart0_device,
568#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700569#endif
Michael Hennerich2463ef22008-01-27 16:49:48 +0800570
Steven Miaoc4a2c582014-04-12 02:07:27 +0800571#if IS_ENABLED(CONFIG_BFIN_SIR)
Graf Yang42bd8bc2009-01-07 23:14:39 +0800572#ifdef CONFIG_BFIN_SIR0
573 &bfin_sir0_device,
574#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800575#endif
576
Steven Miaoc4a2c582014-04-12 02:07:27 +0800577#if IS_ENABLED(CONFIG_KEYBOARD_GPIO)
Michael Hennerich2463ef22008-01-27 16:49:48 +0800578 &bfin_device_gpiokeys,
579#endif
Bryan Wue3163952008-01-24 16:19:15 +0800580
Steven Miaoc4a2c582014-04-12 02:07:27 +0800581#if IS_ENABLED(CONFIG_I2C_GPIO)
Bryan Wue3163952008-01-24 16:19:15 +0800582 &i2c_gpio_device,
583#endif
Michael Henneriche9d76c22008-02-02 14:55:28 +0800584
Steven Miaoc4a2c582014-04-12 02:07:27 +0800585#if IS_ENABLED(CONFIG_USB_ISP1362_HCD)
Michael Henneriche9d76c22008-02-02 14:55:28 +0800586 &isp1362_hcd_device,
587#endif
588
Steven Miaoc4a2c582014-04-12 02:07:27 +0800589#if IS_ENABLED(CONFIG_MTD_PHYSMAP)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800590 &ezkit_flash_device,
Mike Frysinger793dc272008-03-26 08:09:12 +0800591#endif
Barry Song027285e2010-06-28 08:39:37 +0000592
Steven Miaoc4a2c582014-04-12 02:07:27 +0800593#if IS_ENABLED(CONFIG_VIDEO_BLACKFIN_CAPTURE)
Bob Liudda67792012-01-05 11:11:20 +0800594 &bfin_capture_device,
595#endif
596
Steven Miaoc4a2c582014-04-12 02:07:27 +0800597#if IS_ENABLED(CONFIG_SND_BF5XX_I2S)
Barry Song027285e2010-06-28 08:39:37 +0000598 &bfin_i2s,
599#endif
600
Steven Miaoc4a2c582014-04-12 02:07:27 +0800601#if IS_ENABLED(CONFIG_SND_BF5XX_AC97)
Barry Song027285e2010-06-28 08:39:37 +0000602 &bfin_ac97,
603#endif
Scott Jiang63f49dc2012-08-10 18:06:09 -0400604
Steven Miaoc4a2c582014-04-12 02:07:27 +0800605#if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD1836)
Scott Jiang63f49dc2012-08-10 18:06:09 -0400606 &bfin_ad1836_machine,
607#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700608};
609
Mike Frysinger9be86312011-05-04 11:20:15 -0400610static int __init net2272_init(void)
611{
Steven Miaoc4a2c582014-04-12 02:07:27 +0800612#if IS_ENABLED(CONFIG_USB_NET2272)
Mike Frysinger9be86312011-05-04 11:20:15 -0400613 int ret;
614
615 ret = gpio_request(GPIO_PF11, "net2272");
616 if (ret)
617 return ret;
618
619 /* Reset the USB chip */
620 gpio_direction_output(GPIO_PF11, 0);
621 mdelay(2);
622 gpio_set_value(GPIO_PF11, 1);
623#endif
624
625 return 0;
626}
627
Bryan Wu1394f032007-05-06 14:50:22 -0700628static int __init ezkit_init(void)
629{
630 int ret;
631
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800632 printk(KERN_INFO "%s(): registering device resources\n", __func__);
633
634 ret = platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
Bryan Wu1394f032007-05-06 14:50:22 -0700635 if (ret < 0)
636 return ret;
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800637
Steven Miaoc4a2c582014-04-12 02:07:27 +0800638#if IS_ENABLED(CONFIG_SMC91X)
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800639 bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() | (1 << 12));
640 SSYNC();
641#endif
642
Steven Miaoc4a2c582014-04-12 02:07:27 +0800643#if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD183X)
Barry Song027285e2010-06-28 08:39:37 +0000644 bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() | (1 << 15));
645 bfin_write_FIO0_FLAG_S(1 << 15);
646 SSYNC();
647 /*
648 * This initialization lasts for approximately 4500 MCLKs.
649 * MCLK = 12.288MHz
650 */
651 udelay(400);
652#endif
653
Mike Frysinger9be86312011-05-04 11:20:15 -0400654 if (net2272_init())
655 pr_warning("unable to configure net2272; it probably won't work\n");
656
Mike Frysinger5bda2722008-06-07 15:03:01 +0800657 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800658 return 0;
Bryan Wu1394f032007-05-06 14:50:22 -0700659}
660
661arch_initcall(ezkit_init);
Sonic Zhangc13ce9f2009-09-23 09:37:46 +0000662
663static struct platform_device *ezkit_early_devices[] __initdata = {
664#if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
665#ifdef CONFIG_SERIAL_BFIN_UART0
666 &bfin_uart0_device,
667#endif
668#endif
669};
670
671void __init native_machine_early_platform_add_devices(void)
672{
673 printk(KERN_INFO "register early platform devices\n");
674 early_platform_add_devices(ezkit_early_devices,
675 ARRAY_SIZE(ezkit_early_devices));
676}