davinci: add spi devices support for da850/omap-l138/am18x evm
[pandora-kernel.git] / arch / arm / mach-davinci / board-da850-evm.c
1 /*
2  * TI DA850/OMAP-L138 EVM board
3  *
4  * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
5  *
6  * Derived from: arch/arm/mach-davinci/board-da830-evm.c
7  * Original Copyrights follow:
8  *
9  * 2007, 2009 (c) MontaVista Software, Inc. This file is licensed under
10  * the terms of the GNU General Public License version 2. This program
11  * is licensed "as is" without any warranty of any kind, whether express
12  * or implied.
13  */
14 #include <linux/kernel.h>
15 #include <linux/init.h>
16 #include <linux/console.h>
17 #include <linux/i2c.h>
18 #include <linux/i2c/at24.h>
19 #include <linux/i2c/pca953x.h>
20 #include <linux/input.h>
21 #include <linux/mfd/tps6507x.h>
22 #include <linux/gpio.h>
23 #include <linux/gpio_keys.h>
24 #include <linux/platform_device.h>
25 #include <linux/mtd/mtd.h>
26 #include <linux/mtd/nand.h>
27 #include <linux/mtd/partitions.h>
28 #include <linux/mtd/physmap.h>
29 #include <linux/regulator/machine.h>
30 #include <linux/regulator/tps6507x.h>
31 #include <linux/input/tps6507x-ts.h>
32 #include <linux/spi/spi.h>
33 #include <linux/spi/flash.h>
34
35 #include <asm/mach-types.h>
36 #include <asm/mach/arch.h>
37
38 #include <mach/cp_intc.h>
39 #include <mach/da8xx.h>
40 #include <mach/nand.h>
41 #include <mach/mux.h>
42 #include <mach/aemif.h>
43 #include <mach/spi.h>
44
45 #define DA850_EVM_PHY_ID                "0:00"
46 #define DA850_LCD_PWR_PIN               GPIO_TO_PIN(2, 8)
47 #define DA850_LCD_BL_PIN                GPIO_TO_PIN(2, 15)
48
49 #define DA850_MMCSD_CD_PIN              GPIO_TO_PIN(4, 0)
50 #define DA850_MMCSD_WP_PIN              GPIO_TO_PIN(4, 1)
51
52 #define DA850_MII_MDIO_CLKEN_PIN        GPIO_TO_PIN(2, 6)
53
54 static struct mtd_partition da850evm_spiflash_part[] = {
55         [0] = {
56                 .name = "UBL",
57                 .offset = 0,
58                 .size = SZ_64K,
59                 .mask_flags = MTD_WRITEABLE,
60         },
61         [1] = {
62                 .name = "U-Boot",
63                 .offset = MTDPART_OFS_APPEND,
64                 .size = SZ_512K,
65                 .mask_flags = MTD_WRITEABLE,
66         },
67         [2] = {
68                 .name = "U-Boot-Env",
69                 .offset = MTDPART_OFS_APPEND,
70                 .size = SZ_64K,
71                 .mask_flags = MTD_WRITEABLE,
72         },
73         [3] = {
74                 .name = "Kernel",
75                 .offset = MTDPART_OFS_APPEND,
76                 .size = SZ_2M + SZ_512K,
77                 .mask_flags = 0,
78         },
79         [4] = {
80                 .name = "Filesystem",
81                 .offset = MTDPART_OFS_APPEND,
82                 .size = SZ_4M,
83                 .mask_flags = 0,
84         },
85         [5] = {
86                 .name = "MAC-Address",
87                 .offset = SZ_8M - SZ_64K,
88                 .size = SZ_64K,
89                 .mask_flags = MTD_WRITEABLE,
90         },
91 };
92
93 static struct flash_platform_data da850evm_spiflash_data = {
94         .name           = "m25p80",
95         .parts          = da850evm_spiflash_part,
96         .nr_parts       = ARRAY_SIZE(da850evm_spiflash_part),
97         .type           = "m25p64",
98 };
99
100 static struct davinci_spi_config da850evm_spiflash_cfg = {
101         .io_type        = SPI_IO_TYPE_DMA,
102         .c2tdelay       = 8,
103         .t2cdelay       = 8,
104 };
105
106 static struct spi_board_info da850evm_spi_info[] = {
107         {
108                 .modalias               = "m25p80",
109                 .platform_data          = &da850evm_spiflash_data,
110                 .controller_data        = &da850evm_spiflash_cfg,
111                 .mode                   = SPI_MODE_0,
112                 .max_speed_hz           = 30000000,
113                 .bus_num                = 1,
114                 .chip_select            = 0,
115         },
116 };
117
118 static struct mtd_partition da850_evm_norflash_partition[] = {
119         {
120                 .name           = "bootloaders + env",
121                 .offset         = 0,
122                 .size           = SZ_512K,
123                 .mask_flags     = MTD_WRITEABLE,
124         },
125         {
126                 .name           = "kernel",
127                 .offset         = MTDPART_OFS_APPEND,
128                 .size           = SZ_2M,
129                 .mask_flags     = 0,
130         },
131         {
132                 .name           = "filesystem",
133                 .offset         = MTDPART_OFS_APPEND,
134                 .size           = MTDPART_SIZ_FULL,
135                 .mask_flags     = 0,
136         },
137 };
138
139 static struct physmap_flash_data da850_evm_norflash_data = {
140         .width          = 2,
141         .parts          = da850_evm_norflash_partition,
142         .nr_parts       = ARRAY_SIZE(da850_evm_norflash_partition),
143 };
144
145 static struct resource da850_evm_norflash_resource[] = {
146         {
147                 .start  = DA8XX_AEMIF_CS2_BASE,
148                 .end    = DA8XX_AEMIF_CS2_BASE + SZ_32M - 1,
149                 .flags  = IORESOURCE_MEM,
150         },
151 };
152
153 static struct platform_device da850_evm_norflash_device = {
154         .name           = "physmap-flash",
155         .id             = 0,
156         .dev            = {
157                 .platform_data  = &da850_evm_norflash_data,
158         },
159         .num_resources  = 1,
160         .resource       = da850_evm_norflash_resource,
161 };
162
163 static struct davinci_pm_config da850_pm_pdata = {
164         .sleepcount = 128,
165 };
166
167 static struct platform_device da850_pm_device = {
168         .name           = "pm-davinci",
169         .dev = {
170                 .platform_data  = &da850_pm_pdata,
171         },
172         .id             = -1,
173 };
174
175 /* DA850/OMAP-L138 EVM includes a 512 MByte large-page NAND flash
176  * (128K blocks). It may be used instead of the (default) SPI flash
177  * to boot, using TI's tools to install the secondary boot loader
178  * (UBL) and U-Boot.
179  */
180 static struct mtd_partition da850_evm_nandflash_partition[] = {
181         {
182                 .name           = "u-boot env",
183                 .offset         = 0,
184                 .size           = SZ_128K,
185                 .mask_flags     = MTD_WRITEABLE,
186          },
187         {
188                 .name           = "UBL",
189                 .offset         = MTDPART_OFS_APPEND,
190                 .size           = SZ_128K,
191                 .mask_flags     = MTD_WRITEABLE,
192         },
193         {
194                 .name           = "u-boot",
195                 .offset         = MTDPART_OFS_APPEND,
196                 .size           = 4 * SZ_128K,
197                 .mask_flags     = MTD_WRITEABLE,
198         },
199         {
200                 .name           = "kernel",
201                 .offset         = 0x200000,
202                 .size           = SZ_2M,
203                 .mask_flags     = 0,
204         },
205         {
206                 .name           = "filesystem",
207                 .offset         = MTDPART_OFS_APPEND,
208                 .size           = MTDPART_SIZ_FULL,
209                 .mask_flags     = 0,
210         },
211 };
212
213 static struct davinci_aemif_timing da850_evm_nandflash_timing = {
214         .wsetup         = 24,
215         .wstrobe        = 21,
216         .whold          = 14,
217         .rsetup         = 19,
218         .rstrobe        = 50,
219         .rhold          = 0,
220         .ta             = 20,
221 };
222
223 static struct davinci_nand_pdata da850_evm_nandflash_data = {
224         .parts          = da850_evm_nandflash_partition,
225         .nr_parts       = ARRAY_SIZE(da850_evm_nandflash_partition),
226         .ecc_mode       = NAND_ECC_HW,
227         .ecc_bits       = 4,
228         .options        = NAND_USE_FLASH_BBT,
229         .timing         = &da850_evm_nandflash_timing,
230 };
231
232 static struct resource da850_evm_nandflash_resource[] = {
233         {
234                 .start  = DA8XX_AEMIF_CS3_BASE,
235                 .end    = DA8XX_AEMIF_CS3_BASE + SZ_512K + 2 * SZ_1K - 1,
236                 .flags  = IORESOURCE_MEM,
237         },
238         {
239                 .start  = DA8XX_AEMIF_CTL_BASE,
240                 .end    = DA8XX_AEMIF_CTL_BASE + SZ_32K - 1,
241                 .flags  = IORESOURCE_MEM,
242         },
243 };
244
245 static struct platform_device da850_evm_nandflash_device = {
246         .name           = "davinci_nand",
247         .id             = 1,
248         .dev            = {
249                 .platform_data  = &da850_evm_nandflash_data,
250         },
251         .num_resources  = ARRAY_SIZE(da850_evm_nandflash_resource),
252         .resource       = da850_evm_nandflash_resource,
253 };
254
255 static struct platform_device *da850_evm_devices[] __initdata = {
256         &da850_evm_nandflash_device,
257         &da850_evm_norflash_device,
258 };
259
260 #define DA8XX_AEMIF_CE2CFG_OFFSET       0x10
261 #define DA8XX_AEMIF_ASIZE_16BIT         0x1
262
263 static void __init da850_evm_init_nor(void)
264 {
265         void __iomem *aemif_addr;
266
267         aemif_addr = ioremap(DA8XX_AEMIF_CTL_BASE, SZ_32K);
268
269         /* Configure data bus width of CS2 to 16 bit */
270         writel(readl(aemif_addr + DA8XX_AEMIF_CE2CFG_OFFSET) |
271                 DA8XX_AEMIF_ASIZE_16BIT,
272                 aemif_addr + DA8XX_AEMIF_CE2CFG_OFFSET);
273
274         iounmap(aemif_addr);
275 }
276
277 static const short da850_evm_nand_pins[] = {
278         DA850_EMA_D_0, DA850_EMA_D_1, DA850_EMA_D_2, DA850_EMA_D_3,
279         DA850_EMA_D_4, DA850_EMA_D_5, DA850_EMA_D_6, DA850_EMA_D_7,
280         DA850_EMA_A_1, DA850_EMA_A_2, DA850_NEMA_CS_3, DA850_NEMA_CS_4,
281         DA850_NEMA_WE, DA850_NEMA_OE,
282         -1
283 };
284
285 static const short da850_evm_nor_pins[] = {
286         DA850_EMA_BA_1, DA850_EMA_CLK, DA850_EMA_WAIT_1, DA850_NEMA_CS_2,
287         DA850_NEMA_WE, DA850_NEMA_OE, DA850_EMA_D_0, DA850_EMA_D_1,
288         DA850_EMA_D_2, DA850_EMA_D_3, DA850_EMA_D_4, DA850_EMA_D_5,
289         DA850_EMA_D_6, DA850_EMA_D_7, DA850_EMA_D_8, DA850_EMA_D_9,
290         DA850_EMA_D_10, DA850_EMA_D_11, DA850_EMA_D_12, DA850_EMA_D_13,
291         DA850_EMA_D_14, DA850_EMA_D_15, DA850_EMA_A_0, DA850_EMA_A_1,
292         DA850_EMA_A_2, DA850_EMA_A_3, DA850_EMA_A_4, DA850_EMA_A_5,
293         DA850_EMA_A_6, DA850_EMA_A_7, DA850_EMA_A_8, DA850_EMA_A_9,
294         DA850_EMA_A_10, DA850_EMA_A_11, DA850_EMA_A_12, DA850_EMA_A_13,
295         DA850_EMA_A_14, DA850_EMA_A_15, DA850_EMA_A_16, DA850_EMA_A_17,
296         DA850_EMA_A_18, DA850_EMA_A_19, DA850_EMA_A_20, DA850_EMA_A_21,
297         DA850_EMA_A_22, DA850_EMA_A_23,
298         -1
299 };
300
301 static u32 ui_card_detected;
302
303 #if defined(CONFIG_MMC_DAVINCI) || \
304     defined(CONFIG_MMC_DAVINCI_MODULE)
305 #define HAS_MMC 1
306 #else
307 #define HAS_MMC 0
308 #endif
309
310 static inline void da850_evm_setup_nor_nand(void)
311 {
312         int ret = 0;
313
314         if (ui_card_detected & !HAS_MMC) {
315                 ret = davinci_cfg_reg_list(da850_evm_nand_pins);
316                 if (ret)
317                         pr_warning("da850_evm_init: nand mux setup failed: "
318                                         "%d\n", ret);
319
320                 ret = davinci_cfg_reg_list(da850_evm_nor_pins);
321                 if (ret)
322                         pr_warning("da850_evm_init: nor mux setup failed: %d\n",
323                                 ret);
324
325                 da850_evm_init_nor();
326
327                 platform_add_devices(da850_evm_devices,
328                                         ARRAY_SIZE(da850_evm_devices));
329         }
330 }
331
332 #ifdef CONFIG_DA850_UI_RMII
333 static inline void da850_evm_setup_emac_rmii(int rmii_sel)
334 {
335         struct davinci_soc_info *soc_info = &davinci_soc_info;
336
337         soc_info->emac_pdata->rmii_en = 1;
338         gpio_set_value_cansleep(rmii_sel, 0);
339 }
340 #else
341 static inline void da850_evm_setup_emac_rmii(int rmii_sel) { }
342 #endif
343
344
345 #define DA850_KEYS_DEBOUNCE_MS  10
346 /*
347  * At 200ms polling interval it is possible to miss an
348  * event by tapping very lightly on the push button but most
349  * pushes do result in an event; longer intervals require the
350  * user to hold the button whereas shorter intervals require
351  * more CPU time for polling.
352  */
353 #define DA850_GPIO_KEYS_POLL_MS 200
354
355 enum da850_evm_ui_exp_pins {
356         DA850_EVM_UI_EXP_SEL_C = 5,
357         DA850_EVM_UI_EXP_SEL_B,
358         DA850_EVM_UI_EXP_SEL_A,
359         DA850_EVM_UI_EXP_PB8,
360         DA850_EVM_UI_EXP_PB7,
361         DA850_EVM_UI_EXP_PB6,
362         DA850_EVM_UI_EXP_PB5,
363         DA850_EVM_UI_EXP_PB4,
364         DA850_EVM_UI_EXP_PB3,
365         DA850_EVM_UI_EXP_PB2,
366         DA850_EVM_UI_EXP_PB1,
367 };
368
369 static const char const *da850_evm_ui_exp[] = {
370         [DA850_EVM_UI_EXP_SEL_C]        = "sel_c",
371         [DA850_EVM_UI_EXP_SEL_B]        = "sel_b",
372         [DA850_EVM_UI_EXP_SEL_A]        = "sel_a",
373         [DA850_EVM_UI_EXP_PB8]          = "pb8",
374         [DA850_EVM_UI_EXP_PB7]          = "pb7",
375         [DA850_EVM_UI_EXP_PB6]          = "pb6",
376         [DA850_EVM_UI_EXP_PB5]          = "pb5",
377         [DA850_EVM_UI_EXP_PB4]          = "pb4",
378         [DA850_EVM_UI_EXP_PB3]          = "pb3",
379         [DA850_EVM_UI_EXP_PB2]          = "pb2",
380         [DA850_EVM_UI_EXP_PB1]          = "pb1",
381 };
382
383 #define DA850_N_UI_PB           8
384
385 static struct gpio_keys_button da850_evm_ui_keys[] = {
386         [0 ... DA850_N_UI_PB - 1] = {
387                 .type                   = EV_KEY,
388                 .active_low             = 1,
389                 .wakeup                 = 0,
390                 .debounce_interval      = DA850_KEYS_DEBOUNCE_MS,
391                 .code                   = -1, /* assigned at runtime */
392                 .gpio                   = -1, /* assigned at runtime */
393                 .desc                   = NULL, /* assigned at runtime */
394         },
395 };
396
397 static struct gpio_keys_platform_data da850_evm_ui_keys_pdata = {
398         .buttons = da850_evm_ui_keys,
399         .nbuttons = ARRAY_SIZE(da850_evm_ui_keys),
400         .poll_interval = DA850_GPIO_KEYS_POLL_MS,
401 };
402
403 static struct platform_device da850_evm_ui_keys_device = {
404         .name = "gpio-keys-polled",
405         .id = 0,
406         .dev = {
407                 .platform_data = &da850_evm_ui_keys_pdata
408         },
409 };
410
411 static void da850_evm_ui_keys_init(unsigned gpio)
412 {
413         int i;
414         struct gpio_keys_button *button;
415
416         for (i = 0; i < DA850_N_UI_PB; i++) {
417                 button = &da850_evm_ui_keys[i];
418                 button->code = KEY_F8 - i;
419                 button->desc = (char *)
420                                 da850_evm_ui_exp[DA850_EVM_UI_EXP_PB8 + i];
421                 button->gpio = gpio + DA850_EVM_UI_EXP_PB8 + i;
422         }
423 }
424
425 static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio,
426                                                 unsigned ngpio, void *c)
427 {
428         int sel_a, sel_b, sel_c, ret;
429
430         sel_a = gpio + DA850_EVM_UI_EXP_SEL_A;
431         sel_b = gpio + DA850_EVM_UI_EXP_SEL_B;
432         sel_c = gpio + DA850_EVM_UI_EXP_SEL_C;
433
434         ret = gpio_request(sel_a, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_A]);
435         if (ret) {
436                 pr_warning("Cannot open UI expander pin %d\n", sel_a);
437                 goto exp_setup_sela_fail;
438         }
439
440         ret = gpio_request(sel_b, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_B]);
441         if (ret) {
442                 pr_warning("Cannot open UI expander pin %d\n", sel_b);
443                 goto exp_setup_selb_fail;
444         }
445
446         ret = gpio_request(sel_c, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_C]);
447         if (ret) {
448                 pr_warning("Cannot open UI expander pin %d\n", sel_c);
449                 goto exp_setup_selc_fail;
450         }
451
452         /* deselect all functionalities */
453         gpio_direction_output(sel_a, 1);
454         gpio_direction_output(sel_b, 1);
455         gpio_direction_output(sel_c, 1);
456
457         da850_evm_ui_keys_init(gpio);
458         ret = platform_device_register(&da850_evm_ui_keys_device);
459         if (ret) {
460                 pr_warning("Could not register UI GPIO expander push-buttons");
461                 goto exp_setup_keys_fail;
462         }
463
464         ui_card_detected = 1;
465         pr_info("DA850/OMAP-L138 EVM UI card detected\n");
466
467         da850_evm_setup_nor_nand();
468
469         da850_evm_setup_emac_rmii(sel_a);
470
471         return 0;
472
473 exp_setup_keys_fail:
474         gpio_free(sel_c);
475 exp_setup_selc_fail:
476         gpio_free(sel_b);
477 exp_setup_selb_fail:
478         gpio_free(sel_a);
479 exp_setup_sela_fail:
480         return ret;
481 }
482
483 static int da850_evm_ui_expander_teardown(struct i2c_client *client,
484                                         unsigned gpio, unsigned ngpio, void *c)
485 {
486         platform_device_unregister(&da850_evm_ui_keys_device);
487
488         /* deselect all functionalities */
489         gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_C, 1);
490         gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_B, 1);
491         gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_A, 1);
492
493         gpio_free(gpio + DA850_EVM_UI_EXP_SEL_C);
494         gpio_free(gpio + DA850_EVM_UI_EXP_SEL_B);
495         gpio_free(gpio + DA850_EVM_UI_EXP_SEL_A);
496
497         return 0;
498 }
499
500 /* assign the baseboard expander's GPIOs after the UI board's */
501 #define DA850_UI_EXPANDER_N_GPIOS ARRAY_SIZE(da850_evm_ui_exp)
502 #define DA850_BB_EXPANDER_GPIO_BASE (DAVINCI_N_GPIO + DA850_UI_EXPANDER_N_GPIOS)
503
504 enum da850_evm_bb_exp_pins {
505         DA850_EVM_BB_EXP_DEEP_SLEEP_EN = 0,
506         DA850_EVM_BB_EXP_SW_RST,
507         DA850_EVM_BB_EXP_TP_23,
508         DA850_EVM_BB_EXP_TP_22,
509         DA850_EVM_BB_EXP_TP_21,
510         DA850_EVM_BB_EXP_USER_PB1,
511         DA850_EVM_BB_EXP_USER_LED2,
512         DA850_EVM_BB_EXP_USER_LED1,
513         DA850_EVM_BB_EXP_USER_SW1,
514         DA850_EVM_BB_EXP_USER_SW2,
515         DA850_EVM_BB_EXP_USER_SW3,
516         DA850_EVM_BB_EXP_USER_SW4,
517         DA850_EVM_BB_EXP_USER_SW5,
518         DA850_EVM_BB_EXP_USER_SW6,
519         DA850_EVM_BB_EXP_USER_SW7,
520         DA850_EVM_BB_EXP_USER_SW8
521 };
522
523 static const char const *da850_evm_bb_exp[] = {
524         [DA850_EVM_BB_EXP_DEEP_SLEEP_EN]        = "deep_sleep_en",
525         [DA850_EVM_BB_EXP_SW_RST]               = "sw_rst",
526         [DA850_EVM_BB_EXP_TP_23]                = "tp_23",
527         [DA850_EVM_BB_EXP_TP_22]                = "tp_22",
528         [DA850_EVM_BB_EXP_TP_21]                = "tp_21",
529         [DA850_EVM_BB_EXP_USER_PB1]             = "user_pb1",
530         [DA850_EVM_BB_EXP_USER_LED2]            = "user_led2",
531         [DA850_EVM_BB_EXP_USER_LED1]            = "user_led1",
532         [DA850_EVM_BB_EXP_USER_SW1]             = "user_sw1",
533         [DA850_EVM_BB_EXP_USER_SW2]             = "user_sw2",
534         [DA850_EVM_BB_EXP_USER_SW3]             = "user_sw3",
535         [DA850_EVM_BB_EXP_USER_SW4]             = "user_sw4",
536         [DA850_EVM_BB_EXP_USER_SW5]             = "user_sw5",
537         [DA850_EVM_BB_EXP_USER_SW6]             = "user_sw6",
538         [DA850_EVM_BB_EXP_USER_SW7]             = "user_sw7",
539         [DA850_EVM_BB_EXP_USER_SW8]             = "user_sw8",
540 };
541
542 #define DA850_N_BB_USER_SW      8
543
544 static struct gpio_keys_button da850_evm_bb_keys[] = {
545         [0] = {
546                 .type                   = EV_KEY,
547                 .active_low             = 1,
548                 .wakeup                 = 0,
549                 .debounce_interval      = DA850_KEYS_DEBOUNCE_MS,
550                 .code                   = KEY_PROG1,
551                 .desc                   = NULL, /* assigned at runtime */
552                 .gpio                   = -1, /* assigned at runtime */
553         },
554         [1 ... DA850_N_BB_USER_SW] = {
555                 .type                   = EV_SW,
556                 .active_low             = 1,
557                 .wakeup                 = 0,
558                 .debounce_interval      = DA850_KEYS_DEBOUNCE_MS,
559                 .code                   = -1, /* assigned at runtime */
560                 .desc                   = NULL, /* assigned at runtime */
561                 .gpio                   = -1, /* assigned at runtime */
562         },
563 };
564
565 static struct gpio_keys_platform_data da850_evm_bb_keys_pdata = {
566         .buttons = da850_evm_bb_keys,
567         .nbuttons = ARRAY_SIZE(da850_evm_bb_keys),
568         .poll_interval = DA850_GPIO_KEYS_POLL_MS,
569 };
570
571 static struct platform_device da850_evm_bb_keys_device = {
572         .name = "gpio-keys-polled",
573         .id = 1,
574         .dev = {
575                 .platform_data = &da850_evm_bb_keys_pdata
576         },
577 };
578
579 static void da850_evm_bb_keys_init(unsigned gpio)
580 {
581         int i;
582         struct gpio_keys_button *button;
583
584         button = &da850_evm_bb_keys[0];
585         button->desc = (char *)
586                 da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_PB1];
587         button->gpio = gpio + DA850_EVM_BB_EXP_USER_PB1;
588
589         for (i = 0; i < DA850_N_BB_USER_SW; i++) {
590                 button = &da850_evm_bb_keys[i + 1];
591                 button->code = SW_LID + i;
592                 button->desc = (char *)
593                                 da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_SW1 + i];
594                 button->gpio = gpio + DA850_EVM_BB_EXP_USER_SW1 + i;
595         }
596 }
597
598 #define DA850_N_BB_USER_LED     2
599
600 static struct gpio_led da850_evm_bb_leds[] = {
601         [0 ... DA850_N_BB_USER_LED - 1] = {
602                 .active_low = 1,
603                 .gpio = -1, /* assigned at runtime */
604                 .name = NULL, /* assigned at runtime */
605         },
606 };
607
608 static struct gpio_led_platform_data da850_evm_bb_leds_pdata = {
609         .leds = da850_evm_bb_leds,
610         .num_leds = ARRAY_SIZE(da850_evm_bb_leds),
611 };
612
613 static struct platform_device da850_evm_bb_leds_device = {
614         .name           = "leds-gpio",
615         .id             = -1,
616         .dev = {
617                 .platform_data = &da850_evm_bb_leds_pdata
618         }
619 };
620
621 static void da850_evm_bb_leds_init(unsigned gpio)
622 {
623         int i;
624         struct gpio_led *led;
625
626         for (i = 0; i < DA850_N_BB_USER_LED; i++) {
627                 led = &da850_evm_bb_leds[i];
628
629                 led->gpio = gpio + DA850_EVM_BB_EXP_USER_LED2 + i;
630                 led->name =
631                         da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_LED2 + i];
632         }
633 }
634
635 static int da850_evm_bb_expander_setup(struct i2c_client *client,
636                                                 unsigned gpio, unsigned ngpio,
637                                                 void *c)
638 {
639         int ret;
640
641         /*
642          * Register the switches and pushbutton on the baseboard as a gpio-keys
643          * device.
644          */
645         da850_evm_bb_keys_init(gpio);
646         ret = platform_device_register(&da850_evm_bb_keys_device);
647         if (ret) {
648                 pr_warning("Could not register baseboard GPIO expander keys");
649                 goto io_exp_setup_sw_fail;
650         }
651
652         da850_evm_bb_leds_init(gpio);
653         ret = platform_device_register(&da850_evm_bb_leds_device);
654         if (ret) {
655                 pr_warning("Could not register baseboard GPIO expander LEDS");
656                 goto io_exp_setup_leds_fail;
657         }
658
659         return 0;
660
661 io_exp_setup_leds_fail:
662         platform_device_unregister(&da850_evm_bb_keys_device);
663 io_exp_setup_sw_fail:
664         return ret;
665 }
666
667 static int da850_evm_bb_expander_teardown(struct i2c_client *client,
668                                         unsigned gpio, unsigned ngpio, void *c)
669 {
670         platform_device_unregister(&da850_evm_bb_leds_device);
671         platform_device_unregister(&da850_evm_bb_keys_device);
672
673         return 0;
674 }
675
676 static struct pca953x_platform_data da850_evm_ui_expander_info = {
677         .gpio_base      = DAVINCI_N_GPIO,
678         .setup          = da850_evm_ui_expander_setup,
679         .teardown       = da850_evm_ui_expander_teardown,
680         .names          = da850_evm_ui_exp,
681 };
682
683 static struct pca953x_platform_data da850_evm_bb_expander_info = {
684         .gpio_base      = DA850_BB_EXPANDER_GPIO_BASE,
685         .setup          = da850_evm_bb_expander_setup,
686         .teardown       = da850_evm_bb_expander_teardown,
687         .names          = da850_evm_bb_exp,
688 };
689
690 static struct i2c_board_info __initdata da850_evm_i2c_devices[] = {
691         {
692                 I2C_BOARD_INFO("tlv320aic3x", 0x18),
693         },
694         {
695                 I2C_BOARD_INFO("tca6416", 0x20),
696                 .platform_data = &da850_evm_ui_expander_info,
697         },
698         {
699                 I2C_BOARD_INFO("tca6416", 0x21),
700                 .platform_data = &da850_evm_bb_expander_info,
701         },
702 };
703
704 static struct davinci_i2c_platform_data da850_evm_i2c_0_pdata = {
705         .bus_freq       = 100,  /* kHz */
706         .bus_delay      = 0,    /* usec */
707 };
708
709 static struct davinci_uart_config da850_evm_uart_config __initdata = {
710         .enabled_uarts = 0x7,
711 };
712
713 /* davinci da850 evm audio machine driver */
714 static u8 da850_iis_serializer_direction[] = {
715         INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,
716         INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,
717         INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,  TX_MODE,
718         RX_MODE,        INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,
719 };
720
721 static struct snd_platform_data da850_evm_snd_data = {
722         .tx_dma_offset  = 0x2000,
723         .rx_dma_offset  = 0x2000,
724         .op_mode        = DAVINCI_MCASP_IIS_MODE,
725         .num_serializer = ARRAY_SIZE(da850_iis_serializer_direction),
726         .tdm_slots      = 2,
727         .serial_dir     = da850_iis_serializer_direction,
728         .asp_chan_q     = EVENTQ_1,
729         .version        = MCASP_VERSION_2,
730         .txnumevt       = 1,
731         .rxnumevt       = 1,
732 };
733
734 static const short da850_evm_mcasp_pins[] __initconst = {
735         DA850_AHCLKX, DA850_ACLKX, DA850_AFSX,
736         DA850_AHCLKR, DA850_ACLKR, DA850_AFSR, DA850_AMUTE,
737         DA850_AXR_11, DA850_AXR_12,
738         -1
739 };
740
741 static int da850_evm_mmc_get_ro(int index)
742 {
743         return gpio_get_value(DA850_MMCSD_WP_PIN);
744 }
745
746 static int da850_evm_mmc_get_cd(int index)
747 {
748         return !gpio_get_value(DA850_MMCSD_CD_PIN);
749 }
750
751 static struct davinci_mmc_config da850_mmc_config = {
752         .get_ro         = da850_evm_mmc_get_ro,
753         .get_cd         = da850_evm_mmc_get_cd,
754         .wires          = 4,
755         .max_freq       = 50000000,
756         .caps           = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
757         .version        = MMC_CTLR_VERSION_2,
758 };
759
760 static const short da850_evm_mmcsd0_pins[] __initconst = {
761         DA850_MMCSD0_DAT_0, DA850_MMCSD0_DAT_1, DA850_MMCSD0_DAT_2,
762         DA850_MMCSD0_DAT_3, DA850_MMCSD0_CLK, DA850_MMCSD0_CMD,
763         DA850_GPIO4_0, DA850_GPIO4_1,
764         -1
765 };
766
767 static void da850_panel_power_ctrl(int val)
768 {
769         /* lcd backlight */
770         gpio_set_value(DA850_LCD_BL_PIN, val);
771
772         /* lcd power */
773         gpio_set_value(DA850_LCD_PWR_PIN, val);
774 }
775
776 static int da850_lcd_hw_init(void)
777 {
778         int status;
779
780         status = gpio_request(DA850_LCD_BL_PIN, "lcd bl\n");
781         if (status < 0)
782                 return status;
783
784         status = gpio_request(DA850_LCD_PWR_PIN, "lcd pwr\n");
785         if (status < 0) {
786                 gpio_free(DA850_LCD_BL_PIN);
787                 return status;
788         }
789
790         gpio_direction_output(DA850_LCD_BL_PIN, 0);
791         gpio_direction_output(DA850_LCD_PWR_PIN, 0);
792
793         /* Switch off panel power and backlight */
794         da850_panel_power_ctrl(0);
795
796         /* Switch on panel power and backlight */
797         da850_panel_power_ctrl(1);
798
799         return 0;
800 }
801
802 /* TPS65070 voltage regulator support */
803
804 /* 3.3V */
805 static struct regulator_consumer_supply tps65070_dcdc1_consumers[] = {
806         {
807                 .supply = "usb0_vdda33",
808         },
809         {
810                 .supply = "usb1_vdda33",
811         },
812 };
813
814 /* 3.3V or 1.8V */
815 static struct regulator_consumer_supply tps65070_dcdc2_consumers[] = {
816         {
817                 .supply = "dvdd3318_a",
818         },
819         {
820                 .supply = "dvdd3318_b",
821         },
822         {
823                 .supply = "dvdd3318_c",
824         },
825 };
826
827 /* 1.2V */
828 static struct regulator_consumer_supply tps65070_dcdc3_consumers[] = {
829         {
830                 .supply = "cvdd",
831         },
832 };
833
834 /* 1.8V LDO */
835 static struct regulator_consumer_supply tps65070_ldo1_consumers[] = {
836         {
837                 .supply = "sata_vddr",
838         },
839         {
840                 .supply = "usb0_vdda18",
841         },
842         {
843                 .supply = "usb1_vdda18",
844         },
845         {
846                 .supply = "ddr_dvdd18",
847         },
848 };
849
850 /* 1.2V LDO */
851 static struct regulator_consumer_supply tps65070_ldo2_consumers[] = {
852         {
853                 .supply = "sata_vdd",
854         },
855         {
856                 .supply = "pll0_vdda",
857         },
858         {
859                 .supply = "pll1_vdda",
860         },
861         {
862                 .supply = "usbs_cvdd",
863         },
864         {
865                 .supply = "vddarnwa1",
866         },
867 };
868
869 /* We take advantage of the fact that both defdcdc{2,3} are tied high */
870 static struct tps6507x_reg_platform_data tps6507x_platform_data = {
871         .defdcdc_default = true,
872 };
873
874 static struct regulator_init_data tps65070_regulator_data[] = {
875         /* dcdc1 */
876         {
877                 .constraints = {
878                         .min_uV = 3150000,
879                         .max_uV = 3450000,
880                         .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
881                                 REGULATOR_CHANGE_STATUS),
882                         .boot_on = 1,
883                 },
884                 .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc1_consumers),
885                 .consumer_supplies = tps65070_dcdc1_consumers,
886         },
887
888         /* dcdc2 */
889         {
890                 .constraints = {
891                         .min_uV = 1710000,
892                         .max_uV = 3450000,
893                         .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
894                                 REGULATOR_CHANGE_STATUS),
895                         .boot_on = 1,
896                 },
897                 .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc2_consumers),
898                 .consumer_supplies = tps65070_dcdc2_consumers,
899                 .driver_data = &tps6507x_platform_data,
900         },
901
902         /* dcdc3 */
903         {
904                 .constraints = {
905                         .min_uV = 950000,
906                         .max_uV = 1350000,
907                         .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
908                                 REGULATOR_CHANGE_STATUS),
909                         .boot_on = 1,
910                 },
911                 .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc3_consumers),
912                 .consumer_supplies = tps65070_dcdc3_consumers,
913                 .driver_data = &tps6507x_platform_data,
914         },
915
916         /* ldo1 */
917         {
918                 .constraints = {
919                         .min_uV = 1710000,
920                         .max_uV = 1890000,
921                         .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
922                                 REGULATOR_CHANGE_STATUS),
923                         .boot_on = 1,
924                 },
925                 .num_consumer_supplies = ARRAY_SIZE(tps65070_ldo1_consumers),
926                 .consumer_supplies = tps65070_ldo1_consumers,
927         },
928
929         /* ldo2 */
930         {
931                 .constraints = {
932                         .min_uV = 1140000,
933                         .max_uV = 1320000,
934                         .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
935                                 REGULATOR_CHANGE_STATUS),
936                         .boot_on = 1,
937                 },
938                 .num_consumer_supplies = ARRAY_SIZE(tps65070_ldo2_consumers),
939                 .consumer_supplies = tps65070_ldo2_consumers,
940         },
941 };
942
943 static struct touchscreen_init_data tps6507x_touchscreen_data = {
944         .poll_period =  30,     /* ms between touch samples */
945         .min_pressure = 0x30,   /* minimum pressure to trigger touch */
946         .vref = 0,              /* turn off vref when not using A/D */
947         .vendor = 0,            /* /sys/class/input/input?/id/vendor */
948         .product = 65070,       /* /sys/class/input/input?/id/product */
949         .version = 0x100,       /* /sys/class/input/input?/id/version */
950 };
951
952 static struct tps6507x_board tps_board = {
953         .tps6507x_pmic_init_data = &tps65070_regulator_data[0],
954         .tps6507x_ts_init_data = &tps6507x_touchscreen_data,
955 };
956
957 static struct i2c_board_info __initdata da850_evm_tps65070_info[] = {
958         {
959                 I2C_BOARD_INFO("tps6507x", 0x48),
960                 .platform_data = &tps_board,
961         },
962 };
963
964 static int __init pmic_tps65070_init(void)
965 {
966         return i2c_register_board_info(1, da850_evm_tps65070_info,
967                                         ARRAY_SIZE(da850_evm_tps65070_info));
968 }
969
970 static const short da850_evm_lcdc_pins[] = {
971         DA850_GPIO2_8, DA850_GPIO2_15,
972         -1
973 };
974
975 static const short da850_evm_mii_pins[] = {
976         DA850_MII_TXEN, DA850_MII_TXCLK, DA850_MII_COL, DA850_MII_TXD_3,
977         DA850_MII_TXD_2, DA850_MII_TXD_1, DA850_MII_TXD_0, DA850_MII_RXER,
978         DA850_MII_CRS, DA850_MII_RXCLK, DA850_MII_RXDV, DA850_MII_RXD_3,
979         DA850_MII_RXD_2, DA850_MII_RXD_1, DA850_MII_RXD_0, DA850_MDIO_CLK,
980         DA850_MDIO_D,
981         -1
982 };
983
984 static const short da850_evm_rmii_pins[] = {
985         DA850_RMII_TXD_0, DA850_RMII_TXD_1, DA850_RMII_TXEN,
986         DA850_RMII_CRS_DV, DA850_RMII_RXD_0, DA850_RMII_RXD_1,
987         DA850_RMII_RXER, DA850_RMII_MHZ_50_CLK, DA850_MDIO_CLK,
988         DA850_MDIO_D,
989         -1
990 };
991
992 static int __init da850_evm_config_emac(void)
993 {
994         void __iomem *cfg_chip3_base;
995         int ret;
996         u32 val;
997         struct davinci_soc_info *soc_info = &davinci_soc_info;
998         u8 rmii_en = soc_info->emac_pdata->rmii_en;
999
1000         if (!machine_is_davinci_da850_evm())
1001                 return 0;
1002
1003         cfg_chip3_base = DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG);
1004
1005         val = __raw_readl(cfg_chip3_base);
1006
1007         if (rmii_en) {
1008                 val |= BIT(8);
1009                 ret = davinci_cfg_reg_list(da850_evm_rmii_pins);
1010                 pr_info("EMAC: RMII PHY configured, MII PHY will not be"
1011                                                         " functional\n");
1012         } else {
1013                 val &= ~BIT(8);
1014                 ret = davinci_cfg_reg_list(da850_evm_mii_pins);
1015                 pr_info("EMAC: MII PHY configured, RMII PHY will not be"
1016                                                         " functional\n");
1017         }
1018
1019         if (ret)
1020                 pr_warning("da850_evm_init: cpgmac/rmii mux setup failed: %d\n",
1021                                 ret);
1022
1023         /* configure the CFGCHIP3 register for RMII or MII */
1024         __raw_writel(val, cfg_chip3_base);
1025
1026         ret = davinci_cfg_reg(DA850_GPIO2_6);
1027         if (ret)
1028                 pr_warning("da850_evm_init:GPIO(2,6) mux setup "
1029                                                         "failed\n");
1030
1031         ret = gpio_request(DA850_MII_MDIO_CLKEN_PIN, "mdio_clk_en");
1032         if (ret) {
1033                 pr_warning("Cannot open GPIO %d\n",
1034                                         DA850_MII_MDIO_CLKEN_PIN);
1035                 return ret;
1036         }
1037
1038         /* Enable/Disable MII MDIO clock */
1039         gpio_direction_output(DA850_MII_MDIO_CLKEN_PIN, rmii_en);
1040
1041         soc_info->emac_pdata->phy_id = DA850_EVM_PHY_ID;
1042
1043         ret = da8xx_register_emac();
1044         if (ret)
1045                 pr_warning("da850_evm_init: emac registration failed: %d\n",
1046                                 ret);
1047
1048         return 0;
1049 }
1050 device_initcall(da850_evm_config_emac);
1051
1052 /*
1053  * The following EDMA channels/slots are not being used by drivers (for
1054  * example: Timer, GPIO, UART events etc) on da850/omap-l138 EVM, hence
1055  * they are being reserved for codecs on the DSP side.
1056  */
1057 static const s16 da850_dma0_rsv_chans[][2] = {
1058         /* (offset, number) */
1059         { 8,  6},
1060         {24,  4},
1061         {30,  2},
1062         {-1, -1}
1063 };
1064
1065 static const s16 da850_dma0_rsv_slots[][2] = {
1066         /* (offset, number) */
1067         { 8,  6},
1068         {24,  4},
1069         {30, 50},
1070         {-1, -1}
1071 };
1072
1073 static const s16 da850_dma1_rsv_chans[][2] = {
1074         /* (offset, number) */
1075         { 0, 28},
1076         {30,  2},
1077         {-1, -1}
1078 };
1079
1080 static const s16 da850_dma1_rsv_slots[][2] = {
1081         /* (offset, number) */
1082         { 0, 28},
1083         {30, 90},
1084         {-1, -1}
1085 };
1086
1087 static struct edma_rsv_info da850_edma_cc0_rsv = {
1088         .rsv_chans      = da850_dma0_rsv_chans,
1089         .rsv_slots      = da850_dma0_rsv_slots,
1090 };
1091
1092 static struct edma_rsv_info da850_edma_cc1_rsv = {
1093         .rsv_chans      = da850_dma1_rsv_chans,
1094         .rsv_slots      = da850_dma1_rsv_slots,
1095 };
1096
1097 static struct edma_rsv_info *da850_edma_rsv[2] = {
1098         &da850_edma_cc0_rsv,
1099         &da850_edma_cc1_rsv,
1100 };
1101
1102 #ifdef CONFIG_CPU_FREQ
1103 static __init int da850_evm_init_cpufreq(void)
1104 {
1105         switch (system_rev & 0xF) {
1106         case 3:
1107                 da850_max_speed = 456000;
1108                 break;
1109         case 2:
1110                 da850_max_speed = 408000;
1111                 break;
1112         case 1:
1113                 da850_max_speed = 372000;
1114                 break;
1115         }
1116
1117         return da850_register_cpufreq("pll0_sysclk3");
1118 }
1119 #else
1120 static __init int da850_evm_init_cpufreq(void) { return 0; }
1121 #endif
1122
1123 static __init void da850_evm_init(void)
1124 {
1125         int ret;
1126
1127         ret = pmic_tps65070_init();
1128         if (ret)
1129                 pr_warning("da850_evm_init: TPS65070 PMIC init failed: %d\n",
1130                                 ret);
1131
1132         ret = da850_register_edma(da850_edma_rsv);
1133         if (ret)
1134                 pr_warning("da850_evm_init: edma registration failed: %d\n",
1135                                 ret);
1136
1137         ret = davinci_cfg_reg_list(da850_i2c0_pins);
1138         if (ret)
1139                 pr_warning("da850_evm_init: i2c0 mux setup failed: %d\n",
1140                                 ret);
1141
1142         ret = da8xx_register_i2c(0, &da850_evm_i2c_0_pdata);
1143         if (ret)
1144                 pr_warning("da850_evm_init: i2c0 registration failed: %d\n",
1145                                 ret);
1146
1147
1148         ret = da8xx_register_watchdog();
1149         if (ret)
1150                 pr_warning("da830_evm_init: watchdog registration failed: %d\n",
1151                                 ret);
1152
1153         if (HAS_MMC) {
1154                 ret = davinci_cfg_reg_list(da850_evm_mmcsd0_pins);
1155                 if (ret)
1156                         pr_warning("da850_evm_init: mmcsd0 mux setup failed:"
1157                                         " %d\n", ret);
1158
1159                 ret = gpio_request(DA850_MMCSD_CD_PIN, "MMC CD\n");
1160                 if (ret)
1161                         pr_warning("da850_evm_init: can not open GPIO %d\n",
1162                                         DA850_MMCSD_CD_PIN);
1163                 gpio_direction_input(DA850_MMCSD_CD_PIN);
1164
1165                 ret = gpio_request(DA850_MMCSD_WP_PIN, "MMC WP\n");
1166                 if (ret)
1167                         pr_warning("da850_evm_init: can not open GPIO %d\n",
1168                                         DA850_MMCSD_WP_PIN);
1169                 gpio_direction_input(DA850_MMCSD_WP_PIN);
1170
1171                 ret = da8xx_register_mmcsd0(&da850_mmc_config);
1172                 if (ret)
1173                         pr_warning("da850_evm_init: mmcsd0 registration failed:"
1174                                         " %d\n", ret);
1175         }
1176
1177         davinci_serial_init(&da850_evm_uart_config);
1178
1179         i2c_register_board_info(1, da850_evm_i2c_devices,
1180                         ARRAY_SIZE(da850_evm_i2c_devices));
1181
1182         /*
1183          * shut down uart 0 and 1; they are not used on the board and
1184          * accessing them causes endless "too much work in irq53" messages
1185          * with arago fs
1186          */
1187         __raw_writel(0, IO_ADDRESS(DA8XX_UART1_BASE) + 0x30);
1188         __raw_writel(0, IO_ADDRESS(DA8XX_UART0_BASE) + 0x30);
1189
1190         ret = davinci_cfg_reg_list(da850_evm_mcasp_pins);
1191         if (ret)
1192                 pr_warning("da850_evm_init: mcasp mux setup failed: %d\n",
1193                                 ret);
1194
1195         da8xx_register_mcasp(0, &da850_evm_snd_data);
1196
1197         ret = davinci_cfg_reg_list(da850_lcdcntl_pins);
1198         if (ret)
1199                 pr_warning("da850_evm_init: lcdcntl mux setup failed: %d\n",
1200                                 ret);
1201
1202         /* Handle board specific muxing for LCD here */
1203         ret = davinci_cfg_reg_list(da850_evm_lcdc_pins);
1204         if (ret)
1205                 pr_warning("da850_evm_init: evm specific lcd mux setup "
1206                                 "failed: %d\n", ret);
1207
1208         ret = da850_lcd_hw_init();
1209         if (ret)
1210                 pr_warning("da850_evm_init: lcd initialization failed: %d\n",
1211                                 ret);
1212
1213         sharp_lk043t1dg01_pdata.panel_power_ctrl = da850_panel_power_ctrl,
1214         ret = da8xx_register_lcdc(&sharp_lk043t1dg01_pdata);
1215         if (ret)
1216                 pr_warning("da850_evm_init: lcdc registration failed: %d\n",
1217                                 ret);
1218
1219         ret = da8xx_register_rtc();
1220         if (ret)
1221                 pr_warning("da850_evm_init: rtc setup failed: %d\n", ret);
1222
1223         ret = da850_evm_init_cpufreq();
1224         if (ret)
1225                 pr_warning("da850_evm_init: cpufreq registration failed: %d\n",
1226                                 ret);
1227
1228         ret = da8xx_register_cpuidle();
1229         if (ret)
1230                 pr_warning("da850_evm_init: cpuidle registration failed: %d\n",
1231                                 ret);
1232
1233         ret = da850_register_pm(&da850_pm_device);
1234         if (ret)
1235                 pr_warning("da850_evm_init: suspend registration failed: %d\n",
1236                                 ret);
1237
1238         ret = da8xx_register_spi(1, da850evm_spi_info,
1239                                  ARRAY_SIZE(da850evm_spi_info));
1240         if (ret)
1241                 pr_warning("da850_evm_init: spi 1 registration failed: %d\n",
1242                                 ret);
1243 }
1244
1245 #ifdef CONFIG_SERIAL_8250_CONSOLE
1246 static int __init da850_evm_console_init(void)
1247 {
1248         if (!machine_is_davinci_da850_evm())
1249                 return 0;
1250
1251         return add_preferred_console("ttyS", 2, "115200");
1252 }
1253 console_initcall(da850_evm_console_init);
1254 #endif
1255
1256 static void __init da850_evm_map_io(void)
1257 {
1258         da850_init();
1259 }
1260
1261 MACHINE_START(DAVINCI_DA850_EVM, "DaVinci DA850/OMAP-L138/AM18x EVM")
1262         .boot_params    = (DA8XX_DDR_BASE + 0x100),
1263         .map_io         = da850_evm_map_io,
1264         .init_irq       = cp_intc_init,
1265         .timer          = &davinci_timer,
1266         .init_machine   = da850_evm_init,
1267 MACHINE_END