blob: ba81498587145520af9ff08f4c79c10349283800 [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
Michael Hennerich140a9ae2007-05-21 18:09:13 +080028#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
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 Hennerichc6feb7682009-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
Michael Henneriche9d76c22008-02-02 14:55:28 +080063#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
64#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
Michael Hennerich83d9cde2008-02-02 16:25:17 +0800104#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
105static 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 */
132#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
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
166#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
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 {
175 .start = IRQ_UART_RX,
176 .end = IRQ_UART_RX+1,
177 .flags = IORESOURCE_IRQ,
178 },
179 {
180 .start = IRQ_UART_ERROR,
181 .end = IRQ_UART_ERROR,
182 .flags = IORESOURCE_IRQ,
183 },
184 {
185 .start = CH_UART_TX,
186 .end = CH_UART_TX,
187 .flags = IORESOURCE_DMA,
188 },
189 {
190 .start = CH_UART_RX,
191 .end = CH_UART_RX,
192 .flags = IORESOURCE_DMA,
193 },
Bryan Wu1394f032007-05-06 14:50:22 -0700194};
195
Mike Frysingera8b19882010-11-24 09:23:04 +0000196static unsigned short bfin_uart0_peripherals[] = {
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000197 P_UART0_TX, P_UART0_RX, 0
Bryan Wu1394f032007-05-06 14:50:22 -0700198};
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000199
200static struct platform_device bfin_uart0_device = {
201 .name = "bfin-uart",
202 .id = 0,
203 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
204 .resource = bfin_uart0_resources,
205 .dev = {
206 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
207 },
208};
209#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700210#endif
211
Graf Yang5be36d22008-04-25 03:09:15 +0800212#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang5be36d22008-04-25 03:09:15 +0800213#ifdef CONFIG_BFIN_SIR0
Graf Yang42bd8bc2009-01-07 23:14:39 +0800214static struct resource bfin_sir0_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800215 {
216 .start = 0xFFC00400,
217 .end = 0xFFC004FF,
218 .flags = IORESOURCE_MEM,
219 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800220 {
221 .start = IRQ_UART0_RX,
222 .end = IRQ_UART0_RX+1,
223 .flags = IORESOURCE_IRQ,
224 },
225 {
226 .start = CH_UART0_RX,
227 .end = CH_UART0_RX+1,
228 .flags = IORESOURCE_DMA,
229 },
Graf Yang5be36d22008-04-25 03:09:15 +0800230};
231
Graf Yang42bd8bc2009-01-07 23:14:39 +0800232static struct platform_device bfin_sir0_device = {
Graf Yang5be36d22008-04-25 03:09:15 +0800233 .name = "bfin_sir",
234 .id = 0,
Graf Yang42bd8bc2009-01-07 23:14:39 +0800235 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
236 .resource = bfin_sir0_resources,
Graf Yang5be36d22008-04-25 03:09:15 +0800237};
238#endif
Graf Yang42bd8bc2009-01-07 23:14:39 +0800239#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800240
Mike Frysinger793dc272008-03-26 08:09:12 +0800241#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800242static struct mtd_partition ezkit_partitions[] = {
243 {
Robin Getzaa582972008-08-05 17:47:29 +0800244 .name = "bootloader(nor)",
Mike Frysingeredf05642008-02-25 11:38:11 +0800245 .size = 0x40000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800246 .offset = 0,
247 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800248 .name = "linux kernel(nor)",
Grace Panac76d882008-04-24 06:33:56 +0800249 .size = 0x1C0000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800250 .offset = MTDPART_OFS_APPEND,
251 }, {
Robin Getzaa582972008-08-05 17:47:29 +0800252 .name = "file system(nor)",
Mike Frysinger56072042011-05-09 18:46:17 -0400253 .size = 0x800000 - 0x40000 - 0x1C0000 - 0x2000 * 8,
254 .offset = MTDPART_OFS_APPEND,
255 }, {
256 .name = "config(nor)",
257 .size = 0x2000 * 7,
258 .offset = MTDPART_OFS_APPEND,
259 }, {
260 .name = "u-boot env(nor)",
261 .size = 0x2000,
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800262 .offset = MTDPART_OFS_APPEND,
263 }
264};
265
266static struct physmap_flash_data ezkit_flash_data = {
267 .width = 2,
268 .parts = ezkit_partitions,
269 .nr_parts = ARRAY_SIZE(ezkit_partitions),
270};
271
272static struct resource ezkit_flash_resource = {
273 .start = 0x20000000,
274 .end = 0x207fffff,
275 .flags = IORESOURCE_MEM,
276};
277
278static struct platform_device ezkit_flash_device = {
279 .name = "physmap-flash",
280 .id = 0,
281 .dev = {
282 .platform_data = &ezkit_flash_data,
283 },
284 .num_resources = 1,
285 .resource = &ezkit_flash_resource,
286};
Mike Frysinger793dc272008-03-26 08:09:12 +0800287#endif
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800288
Barry Song7ba80062010-01-28 09:37:21 +0000289#if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
290 || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
Bryan Wu1394f032007-05-06 14:50:22 -0700291static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
292 .enable_dma = 0,
293 .bits_per_word = 16,
294};
295#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800296
297#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
298static struct bfin5xx_spi_chip spidev_chip_info = {
299 .enable_dma = 0,
300 .bits_per_word = 8,
301};
302#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700303
Mike Frysinger5bda2722008-06-07 15:03:01 +0800304#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800305/* SPI (0) */
306static struct resource bfin_spi0_resource[] = {
307 [0] = {
308 .start = SPI0_REGBASE,
309 .end = SPI0_REGBASE + 0xFF,
310 .flags = IORESOURCE_MEM,
311 },
312 [1] = {
313 .start = CH_SPI,
314 .end = CH_SPI,
Yi Li53122692009-06-05 12:11:11 +0000315 .flags = IORESOURCE_DMA,
316 },
317 [2] = {
318 .start = IRQ_SPI,
319 .end = IRQ_SPI,
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800320 .flags = IORESOURCE_IRQ,
321 }
322};
323
Bryan Wu1394f032007-05-06 14:50:22 -0700324/* SPI controller data */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800325static struct bfin5xx_spi_master bfin_spi0_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700326 .num_chipselect = 8,
327 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800328 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Bryan Wu1394f032007-05-06 14:50:22 -0700329};
330
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800331static struct platform_device bfin_spi0_device = {
332 .name = "bfin-spi",
333 .id = 0, /* Bus number */
334 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
335 .resource = bfin_spi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -0700336 .dev = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800337 .platform_data = &bfin_spi0_info, /* Passed to driver */
Bryan Wu1394f032007-05-06 14:50:22 -0700338 },
339};
Mike Frysinger5bda2722008-06-07 15:03:01 +0800340#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700341
342static struct spi_board_info bfin_spi_board_info[] __initdata = {
Barry Song7ba80062010-01-28 09:37:21 +0000343#if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
344 || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
Bryan Wu1394f032007-05-06 14:50:22 -0700345 {
Barry Song7ba80062010-01-28 09:37:21 +0000346 .modalias = "ad183x",
Bryan Wu1394f032007-05-06 14:50:22 -0700347 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800348 .bus_num = 0,
Barry Song7ba80062010-01-28 09:37:21 +0000349 .chip_select = 4,
Barry Song027285e2010-06-28 08:39:37 +0000350 .platform_data = "ad1836", /* only includes chip name for the moment */
Bryan Wu1394f032007-05-06 14:50:22 -0700351 .controller_data = &ad1836_spi_chip_info,
Barry Song027285e2010-06-28 08:39:37 +0000352 .mode = SPI_MODE_3,
Bryan Wu1394f032007-05-06 14:50:22 -0700353 },
354#endif
Michael Hennerich6e668932008-02-09 01:54:09 +0800355#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
356 {
357 .modalias = "spidev",
358 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
359 .bus_num = 0,
360 .chip_select = 1,
361 .controller_data = &spidev_chip_info,
362 },
363#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700364};
365
Michael Hennerich2463ef22008-01-27 16:49:48 +0800366#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
367#include <linux/input.h>
368#include <linux/gpio_keys.h>
369
370static struct gpio_keys_button bfin_gpio_keys_table[] = {
371 {BTN_0, GPIO_PF5, 1, "gpio-keys: BTN0"},
372 {BTN_1, GPIO_PF6, 1, "gpio-keys: BTN1"},
373 {BTN_2, GPIO_PF7, 1, "gpio-keys: BTN2"},
374 {BTN_3, GPIO_PF8, 1, "gpio-keys: BTN3"},
375};
376
377static struct gpio_keys_platform_data bfin_gpio_keys_data = {
378 .buttons = bfin_gpio_keys_table,
379 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
380};
381
382static struct platform_device bfin_device_gpiokeys = {
383 .name = "gpio-keys",
384 .dev = {
385 .platform_data = &bfin_gpio_keys_data,
386 },
387};
388#endif
389
Bryan Wue3163952008-01-24 16:19:15 +0800390#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
391#include <linux/i2c-gpio.h>
392
393static struct i2c_gpio_platform_data i2c_gpio_data = {
Mike Frysinger3d7dc882010-07-02 21:02:50 +0000394 .sda_pin = GPIO_PF1,
395 .scl_pin = GPIO_PF0,
Bryan Wue3163952008-01-24 16:19:15 +0800396 .sda_is_open_drain = 0,
397 .scl_is_open_drain = 0,
398 .udelay = 40,
399};
400
401static struct platform_device i2c_gpio_device = {
402 .name = "i2c-gpio",
403 .id = 0,
404 .dev = {
405 .platform_data = &i2c_gpio_data,
406 },
407};
408#endif
409
Michael Hennerich14b03202008-05-07 11:41:26 +0800410static const unsigned int cclk_vlev_datasheet[] =
411{
412 VRPAIR(VLEV_085, 250000000),
413 VRPAIR(VLEV_090, 300000000),
414 VRPAIR(VLEV_095, 313000000),
415 VRPAIR(VLEV_100, 350000000),
416 VRPAIR(VLEV_105, 400000000),
417 VRPAIR(VLEV_110, 444000000),
418 VRPAIR(VLEV_115, 450000000),
419 VRPAIR(VLEV_120, 475000000),
420 VRPAIR(VLEV_125, 500000000),
421 VRPAIR(VLEV_130, 600000000),
422};
423
424static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
425 .tuple_tab = cclk_vlev_datasheet,
426 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
427 .vr_settling_time = 25 /* us */,
428};
429
430static struct platform_device bfin_dpmc = {
431 .name = "bfin dpmc",
432 .dev = {
433 .platform_data = &bfin_dmpc_vreg_data,
434 },
435};
436
Barry Song027285e2010-06-28 08:39:37 +0000437#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
438static struct platform_device bfin_i2s = {
439 .name = "bfin-i2s",
440 .id = CONFIG_SND_BF5XX_SPORT_NUM,
441 /* TODO: add platform data here */
442};
443#endif
444
445#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
446static struct platform_device bfin_tdm = {
447 .name = "bfin-tdm",
448 .id = CONFIG_SND_BF5XX_SPORT_NUM,
449 /* TODO: add platform data here */
450};
451#endif
452
453#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
454static struct platform_device bfin_ac97 = {
455 .name = "bfin-ac97",
456 .id = CONFIG_SND_BF5XX_SPORT_NUM,
457 /* TODO: add platform data here */
458};
459#endif
460
Bryan Wu1394f032007-05-06 14:50:22 -0700461static struct platform_device *ezkit_devices[] __initdata = {
Michael Hennerich14b03202008-05-07 11:41:26 +0800462
463 &bfin_dpmc,
464
Bryan Wu1394f032007-05-06 14:50:22 -0700465#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
466 &smc91x_device,
467#endif
Michael Hennerich561cc182007-11-17 23:56:08 +0800468
Michael Hennerich83d9cde2008-02-02 16:25:17 +0800469#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
470 &net2272_bfin_device,
471#endif
472
Michael Hennerich3f375692008-11-18 17:48:22 +0800473#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
474 &bfin_isp1760_device,
475#endif
476
Bryan Wu1394f032007-05-06 14:50:22 -0700477#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800478 &bfin_spi0_device,
Bryan Wu1394f032007-05-06 14:50:22 -0700479#endif
Michael Hennerich2463ef22008-01-27 16:49:48 +0800480
Bryan Wu1394f032007-05-06 14:50:22 -0700481#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000482#ifdef CONFIG_SERIAL_BFIN_UART0
483 &bfin_uart0_device,
484#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700485#endif
Michael Hennerich2463ef22008-01-27 16:49:48 +0800486
Graf Yang5be36d22008-04-25 03:09:15 +0800487#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang42bd8bc2009-01-07 23:14:39 +0800488#ifdef CONFIG_BFIN_SIR0
489 &bfin_sir0_device,
490#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800491#endif
492
Michael Hennerich2463ef22008-01-27 16:49:48 +0800493#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
494 &bfin_device_gpiokeys,
495#endif
Bryan Wue3163952008-01-24 16:19:15 +0800496
497#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
498 &i2c_gpio_device,
499#endif
Michael Henneriche9d76c22008-02-02 14:55:28 +0800500
501#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
502 &isp1362_hcd_device,
503#endif
504
Mike Frysinger793dc272008-03-26 08:09:12 +0800505#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
Mike Frysingerde8c43f2008-01-24 17:14:04 +0800506 &ezkit_flash_device,
Mike Frysinger793dc272008-03-26 08:09:12 +0800507#endif
Barry Song027285e2010-06-28 08:39:37 +0000508
509#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
510 &bfin_i2s,
511#endif
512
513#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
514 &bfin_tdm,
515#endif
516
517#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
518 &bfin_ac97,
519#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700520};
521
Mike Frysinger9be86312011-05-04 11:20:15 -0400522static int __init net2272_init(void)
523{
524#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
525 int ret;
526
527 ret = gpio_request(GPIO_PF11, "net2272");
528 if (ret)
529 return ret;
530
531 /* Reset the USB chip */
532 gpio_direction_output(GPIO_PF11, 0);
533 mdelay(2);
534 gpio_set_value(GPIO_PF11, 1);
535#endif
536
537 return 0;
538}
539
Bryan Wu1394f032007-05-06 14:50:22 -0700540static int __init ezkit_init(void)
541{
542 int ret;
543
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800544 printk(KERN_INFO "%s(): registering device resources\n", __func__);
545
546 ret = platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
Bryan Wu1394f032007-05-06 14:50:22 -0700547 if (ret < 0)
548 return ret;
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800549
550#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
551 bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() | (1 << 12));
552 SSYNC();
553#endif
554
Barry Song027285e2010-06-28 08:39:37 +0000555#if defined(CONFIG_SND_BF5XX_SOC_AD183X) || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
556 bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() | (1 << 15));
557 bfin_write_FIO0_FLAG_S(1 << 15);
558 SSYNC();
559 /*
560 * This initialization lasts for approximately 4500 MCLKs.
561 * MCLK = 12.288MHz
562 */
563 udelay(400);
564#endif
565
Mike Frysinger9be86312011-05-04 11:20:15 -0400566 if (net2272_init())
567 pr_warning("unable to configure net2272; it probably won't work\n");
568
Mike Frysinger5bda2722008-06-07 15:03:01 +0800569 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800570 return 0;
Bryan Wu1394f032007-05-06 14:50:22 -0700571}
572
573arch_initcall(ezkit_init);
Sonic Zhangc13ce9f2009-09-23 09:37:46 +0000574
575static struct platform_device *ezkit_early_devices[] __initdata = {
576#if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
577#ifdef CONFIG_SERIAL_BFIN_UART0
578 &bfin_uart0_device,
579#endif
580#endif
581};
582
583void __init native_machine_early_platform_add_devices(void)
584{
585 printk(KERN_INFO "register early platform devices\n");
586 early_platform_add_devices(ezkit_early_devices,
587 ARRAY_SIZE(ezkit_early_devices));
588}