powerpc/64s/exception: clean up system call entry
[linux-2.6-block.git] / arch / arm / mach-davinci / board-da830-evm.c
1 /*
2  * TI DA830/OMAP L137 EVM board
3  *
4  * Author: Mark A. Greer <mgreer@mvista.com>
5  * Derived from: arch/arm/mach-davinci/board-dm644x-evm.c
6  *
7  * 2007, 2009 (c) MontaVista Software, Inc. This file is licensed under
8  * the terms of the GNU General Public License version 2. This program
9  * is licensed "as is" without any warranty of any kind, whether express
10  * or implied.
11  */
12 #include <linux/kernel.h>
13 #include <linux/init.h>
14 #include <linux/console.h>
15 #include <linux/interrupt.h>
16 #include <linux/gpio.h>
17 #include <linux/gpio/machine.h>
18 #include <linux/platform_device.h>
19 #include <linux/i2c.h>
20 #include <linux/platform_data/pcf857x.h>
21 #include <linux/property.h>
22 #include <linux/mtd/mtd.h>
23 #include <linux/mtd/partitions.h>
24 #include <linux/spi/spi.h>
25 #include <linux/spi/flash.h>
26 #include <linux/platform_data/gpio-davinci.h>
27 #include <linux/platform_data/mtd-davinci.h>
28 #include <linux/platform_data/mtd-davinci-aemif.h>
29 #include <linux/platform_data/spi-davinci.h>
30 #include <linux/platform_data/usb-davinci.h>
31 #include <linux/platform_data/ti-aemif.h>
32 #include <linux/regulator/fixed.h>
33 #include <linux/regulator/machine.h>
34 #include <linux/nvmem-provider.h>
35
36 #include <asm/mach-types.h>
37 #include <asm/mach/arch.h>
38
39 #include <mach/common.h>
40 #include <mach/mux.h>
41 #include <mach/da8xx.h>
42
43 #include "irqs.h"
44
45 #define DA830_EVM_PHY_ID                ""
46 /*
47  * USB1 VBUS is controlled by GPIO1[15], over-current is reported on GPIO2[4].
48  */
49 #define ON_BD_USB_DRV   GPIO_TO_PIN(1, 15)
50 #define ON_BD_USB_OVC   GPIO_TO_PIN(2, 4)
51
52 static const short da830_evm_usb11_pins[] = {
53         DA830_GPIO1_15, DA830_GPIO2_4,
54         -1
55 };
56
57 static struct regulator_consumer_supply da830_evm_usb_supplies[] = {
58         REGULATOR_SUPPLY("vbus", NULL),
59 };
60
61 static struct regulator_init_data da830_evm_usb_vbus_data = {
62         .consumer_supplies      = da830_evm_usb_supplies,
63         .num_consumer_supplies  = ARRAY_SIZE(da830_evm_usb_supplies),
64 };
65
66 static struct fixed_voltage_config da830_evm_usb_vbus = {
67         .supply_name            = "vbus",
68         .microvolts             = 33000000,
69         .init_data              = &da830_evm_usb_vbus_data,
70 };
71
72 static struct platform_device da830_evm_usb_vbus_device = {
73         .name           = "reg-fixed-voltage",
74         .id             = 0,
75         .dev            = {
76                 .platform_data = &da830_evm_usb_vbus,
77         },
78 };
79
80 static struct gpiod_lookup_table da830_evm_usb_oc_gpio_lookup = {
81         .dev_id         = "ohci-da8xx",
82         .table = {
83                 GPIO_LOOKUP("davinci_gpio", ON_BD_USB_OVC, "oc", 0),
84                 { }
85         },
86 };
87
88 static struct gpiod_lookup_table da830_evm_usb_vbus_gpio_lookup = {
89         .dev_id         = "reg-fixed-voltage.0",
90         .table = {
91                 GPIO_LOOKUP("davinci_gpio", ON_BD_USB_DRV, "vbus", 0),
92                 { }
93         },
94 };
95
96 static struct gpiod_lookup_table *da830_evm_usb_gpio_lookups[] = {
97         &da830_evm_usb_oc_gpio_lookup,
98         &da830_evm_usb_vbus_gpio_lookup,
99 };
100
101 static struct da8xx_ohci_root_hub da830_evm_usb11_pdata = {
102         /* TPS2065 switch @ 5V */
103         .potpgt         = (3 + 1) / 2,  /* 3 ms max */
104 };
105
106 static __init void da830_evm_usb_init(void)
107 {
108         int ret;
109
110         ret = da8xx_register_usb_phy_clocks();
111         if (ret)
112                 pr_warn("%s: USB PHY CLK registration failed: %d\n",
113                         __func__, ret);
114
115         gpiod_add_lookup_tables(da830_evm_usb_gpio_lookups,
116                                 ARRAY_SIZE(da830_evm_usb_gpio_lookups));
117
118         ret = da8xx_register_usb_phy();
119         if (ret)
120                 pr_warn("%s: USB PHY registration failed: %d\n",
121                         __func__, ret);
122
123         ret = davinci_cfg_reg(DA830_USB0_DRVVBUS);
124         if (ret)
125                 pr_warn("%s: USB 2.0 PinMux setup failed: %d\n", __func__, ret);
126         else {
127                 /*
128                  * TPS2065 switch @ 5V supplies 1 A (sustains 1.5 A),
129                  * with the power on to power good time of 3 ms.
130                  */
131                 ret = da8xx_register_usb20(1000, 3);
132                 if (ret)
133                         pr_warn("%s: USB 2.0 registration failed: %d\n",
134                                 __func__, ret);
135         }
136
137         ret = davinci_cfg_reg_list(da830_evm_usb11_pins);
138         if (ret) {
139                 pr_warn("%s: USB 1.1 PinMux setup failed: %d\n", __func__, ret);
140                 return;
141         }
142
143         ret = platform_device_register(&da830_evm_usb_vbus_device);
144         if (ret) {
145                 pr_warn("%s: Unable to register the vbus supply\n", __func__);
146                 return;
147         }
148
149         ret = da8xx_register_usb11(&da830_evm_usb11_pdata);
150         if (ret)
151                 pr_warn("%s: USB 1.1 registration failed: %d\n", __func__, ret);
152 }
153
154 static const short da830_evm_mcasp1_pins[] = {
155         DA830_AHCLKX1, DA830_ACLKX1, DA830_AFSX1, DA830_AHCLKR1, DA830_AFSR1,
156         DA830_AMUTE1, DA830_AXR1_0, DA830_AXR1_1, DA830_AXR1_2, DA830_AXR1_5,
157         DA830_ACLKR1, DA830_AXR1_6, DA830_AXR1_7, DA830_AXR1_8, DA830_AXR1_10,
158         DA830_AXR1_11,
159         -1
160 };
161
162 static u8 da830_iis_serializer_direction[] = {
163         RX_MODE,        INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,
164         INACTIVE_MODE,  TX_MODE,        INACTIVE_MODE,  INACTIVE_MODE,
165         INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,
166 };
167
168 static struct snd_platform_data da830_evm_snd_data = {
169         .tx_dma_offset  = 0x2000,
170         .rx_dma_offset  = 0x2000,
171         .op_mode        = DAVINCI_MCASP_IIS_MODE,
172         .num_serializer = ARRAY_SIZE(da830_iis_serializer_direction),
173         .tdm_slots      = 2,
174         .serial_dir     = da830_iis_serializer_direction,
175         .asp_chan_q     = EVENTQ_0,
176         .version        = MCASP_VERSION_2,
177         .txnumevt       = 1,
178         .rxnumevt       = 1,
179 };
180
181 /*
182  * GPIO2[1] is used as MMC_SD_WP and GPIO2[2] as MMC_SD_INS.
183  */
184 static const short da830_evm_mmc_sd_pins[] = {
185         DA830_MMCSD_DAT_0, DA830_MMCSD_DAT_1, DA830_MMCSD_DAT_2,
186         DA830_MMCSD_DAT_3, DA830_MMCSD_DAT_4, DA830_MMCSD_DAT_5,
187         DA830_MMCSD_DAT_6, DA830_MMCSD_DAT_7, DA830_MMCSD_CLK,
188         DA830_MMCSD_CMD,   DA830_GPIO2_1,     DA830_GPIO2_2,
189         -1
190 };
191
192 #define DA830_MMCSD_WP_PIN              GPIO_TO_PIN(2, 1)
193 #define DA830_MMCSD_CD_PIN              GPIO_TO_PIN(2, 2)
194
195 static struct gpiod_lookup_table mmc_gpios_table = {
196         .dev_id = "da830-mmc.0",
197         .table = {
198                 /* gpio chip 1 contains gpio range 32-63 */
199                 GPIO_LOOKUP("davinci_gpio", DA830_MMCSD_CD_PIN, "cd",
200                             GPIO_ACTIVE_LOW),
201                 GPIO_LOOKUP("davinci_gpio", DA830_MMCSD_WP_PIN, "wp",
202                             GPIO_ACTIVE_LOW),
203                 { }
204         },
205 };
206
207 static struct davinci_mmc_config da830_evm_mmc_config = {
208         .wires                  = 8,
209         .max_freq               = 50000000,
210         .caps                   = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
211 };
212
213 static inline void da830_evm_init_mmc(void)
214 {
215         int ret;
216
217         ret = davinci_cfg_reg_list(da830_evm_mmc_sd_pins);
218         if (ret) {
219                 pr_warn("%s: mmc/sd mux setup failed: %d\n", __func__, ret);
220                 return;
221         }
222
223         gpiod_add_lookup_table(&mmc_gpios_table);
224
225         ret = da8xx_register_mmcsd0(&da830_evm_mmc_config);
226         if (ret) {
227                 pr_warn("%s: mmc/sd registration failed: %d\n", __func__, ret);
228                 gpiod_remove_lookup_table(&mmc_gpios_table);
229         }
230 }
231
232 #define HAS_MMC         IS_ENABLED(CONFIG_MMC_DAVINCI)
233
234 #ifdef CONFIG_DA830_UI_NAND
235 static struct mtd_partition da830_evm_nand_partitions[] = {
236         /* bootloader (U-Boot, etc) in first sector */
237         [0] = {
238                 .name           = "bootloader",
239                 .offset         = 0,
240                 .size           = SZ_128K,
241                 .mask_flags     = MTD_WRITEABLE,        /* force read-only */
242         },
243         /* bootloader params in the next sector */
244         [1] = {
245                 .name           = "params",
246                 .offset         = MTDPART_OFS_APPEND,
247                 .size           = SZ_128K,
248                 .mask_flags     = MTD_WRITEABLE,        /* force read-only */
249         },
250         /* kernel */
251         [2] = {
252                 .name           = "kernel",
253                 .offset         = MTDPART_OFS_APPEND,
254                 .size           = SZ_2M,
255                 .mask_flags     = 0,
256         },
257         /* file system */
258         [3] = {
259                 .name           = "filesystem",
260                 .offset         = MTDPART_OFS_APPEND,
261                 .size           = MTDPART_SIZ_FULL,
262                 .mask_flags     = 0,
263         }
264 };
265
266 /* flash bbt decriptors */
267 static uint8_t da830_evm_nand_bbt_pattern[] = { 'B', 'b', 't', '0' };
268 static uint8_t da830_evm_nand_mirror_pattern[] = { '1', 't', 'b', 'B' };
269
270 static struct nand_bbt_descr da830_evm_nand_bbt_main_descr = {
271         .options        = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE |
272                           NAND_BBT_WRITE | NAND_BBT_2BIT |
273                           NAND_BBT_VERSION | NAND_BBT_PERCHIP,
274         .offs           = 2,
275         .len            = 4,
276         .veroffs        = 16,
277         .maxblocks      = 4,
278         .pattern        = da830_evm_nand_bbt_pattern
279 };
280
281 static struct nand_bbt_descr da830_evm_nand_bbt_mirror_descr = {
282         .options        = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE |
283                           NAND_BBT_WRITE | NAND_BBT_2BIT |
284                           NAND_BBT_VERSION | NAND_BBT_PERCHIP,
285         .offs           = 2,
286         .len            = 4,
287         .veroffs        = 16,
288         .maxblocks      = 4,
289         .pattern        = da830_evm_nand_mirror_pattern
290 };
291
292 static struct davinci_aemif_timing da830_evm_nandflash_timing = {
293         .wsetup         = 24,
294         .wstrobe        = 21,
295         .whold          = 14,
296         .rsetup         = 19,
297         .rstrobe        = 50,
298         .rhold          = 0,
299         .ta             = 20,
300 };
301
302 static struct davinci_nand_pdata da830_evm_nand_pdata = {
303         .core_chipsel   = 1,
304         .parts          = da830_evm_nand_partitions,
305         .nr_parts       = ARRAY_SIZE(da830_evm_nand_partitions),
306         .ecc_mode       = NAND_ECC_HW,
307         .ecc_bits       = 4,
308         .bbt_options    = NAND_BBT_USE_FLASH,
309         .bbt_td         = &da830_evm_nand_bbt_main_descr,
310         .bbt_md         = &da830_evm_nand_bbt_mirror_descr,
311         .timing         = &da830_evm_nandflash_timing,
312 };
313
314 static struct resource da830_evm_nand_resources[] = {
315         [0] = {         /* First memory resource is NAND I/O window */
316                 .start  = DA8XX_AEMIF_CS3_BASE,
317                 .end    = DA8XX_AEMIF_CS3_BASE + PAGE_SIZE - 1,
318                 .flags  = IORESOURCE_MEM,
319         },
320         [1] = {         /* Second memory resource is AEMIF control registers */
321                 .start  = DA8XX_AEMIF_CTL_BASE,
322                 .end    = DA8XX_AEMIF_CTL_BASE + SZ_32K - 1,
323                 .flags  = IORESOURCE_MEM,
324         },
325 };
326
327 static struct platform_device da830_evm_aemif_devices[] = {
328         {
329                 .name           = "davinci_nand",
330                 .id             = 1,
331                 .dev            = {
332                         .platform_data  = &da830_evm_nand_pdata,
333                 },
334                 .num_resources  = ARRAY_SIZE(da830_evm_nand_resources),
335                 .resource       = da830_evm_nand_resources,
336         },
337 };
338
339 static struct resource da830_evm_aemif_resource[] = {
340         {
341                 .start  = DA8XX_AEMIF_CTL_BASE,
342                 .end    = DA8XX_AEMIF_CTL_BASE + SZ_32K - 1,
343                 .flags  = IORESOURCE_MEM,
344         },
345 };
346
347 static struct aemif_abus_data da830_evm_aemif_abus_data[] = {
348         {
349                 .cs     = 3,
350         },
351 };
352
353 static struct aemif_platform_data da830_evm_aemif_pdata = {
354         .abus_data              = da830_evm_aemif_abus_data,
355         .num_abus_data          = ARRAY_SIZE(da830_evm_aemif_abus_data),
356         .sub_devices            = da830_evm_aemif_devices,
357         .num_sub_devices        = ARRAY_SIZE(da830_evm_aemif_devices),
358         .cs_offset              = 2,
359 };
360
361 static struct platform_device da830_evm_aemif_device = {
362         .name           = "ti-aemif",
363         .id             = -1,
364         .dev = {
365                 .platform_data = &da830_evm_aemif_pdata,
366         },
367         .resource       = da830_evm_aemif_resource,
368         .num_resources  = ARRAY_SIZE(da830_evm_aemif_resource),
369 };
370
371 /*
372  * UI board NAND/NOR flashes only use 8-bit data bus.
373  */
374 static const short da830_evm_emif25_pins[] = {
375         DA830_EMA_D_0, DA830_EMA_D_1, DA830_EMA_D_2, DA830_EMA_D_3,
376         DA830_EMA_D_4, DA830_EMA_D_5, DA830_EMA_D_6, DA830_EMA_D_7,
377         DA830_EMA_A_0, DA830_EMA_A_1, DA830_EMA_A_2, DA830_EMA_A_3,
378         DA830_EMA_A_4, DA830_EMA_A_5, DA830_EMA_A_6, DA830_EMA_A_7,
379         DA830_EMA_A_8, DA830_EMA_A_9, DA830_EMA_A_10, DA830_EMA_A_11,
380         DA830_EMA_A_12, DA830_EMA_BA_0, DA830_EMA_BA_1, DA830_NEMA_WE,
381         DA830_NEMA_CS_2, DA830_NEMA_CS_3, DA830_NEMA_OE, DA830_EMA_WAIT_0,
382         -1
383 };
384
385 static inline void da830_evm_init_nand(int mux_mode)
386 {
387         int ret;
388
389         if (HAS_MMC) {
390                 pr_warn("WARNING: both MMC/SD and NAND are enabled, but they share AEMIF pins\n"
391                         "\tDisable MMC/SD for NAND support\n");
392                 return;
393         }
394
395         ret = davinci_cfg_reg_list(da830_evm_emif25_pins);
396         if (ret)
397                 pr_warn("%s: emif25 mux setup failed: %d\n", __func__, ret);
398
399         ret = platform_device_register(&da830_evm_aemif_device);
400         if (ret)
401                 pr_warn("%s: AEMIF device not registered\n", __func__);
402
403         gpio_direction_output(mux_mode, 1);
404 }
405 #else
406 static inline void da830_evm_init_nand(int mux_mode) { }
407 #endif
408
409 #ifdef CONFIG_DA830_UI_LCD
410 static inline void da830_evm_init_lcdc(int mux_mode)
411 {
412         int ret;
413
414         ret = davinci_cfg_reg_list(da830_lcdcntl_pins);
415         if (ret)
416                 pr_warn("%s: lcdcntl mux setup failed: %d\n", __func__, ret);
417
418         ret = da8xx_register_lcdc(&sharp_lcd035q3dg01_pdata);
419         if (ret)
420                 pr_warn("%s: lcd setup failed: %d\n", __func__, ret);
421
422         gpio_direction_output(mux_mode, 0);
423 }
424 #else
425 static inline void da830_evm_init_lcdc(int mux_mode) { }
426 #endif
427
428 static struct nvmem_cell_info da830_evm_nvmem_cells[] = {
429         {
430                 .name           = "macaddr",
431                 .offset         = 0x7f00,
432                 .bytes          = ETH_ALEN,
433         }
434 };
435
436 static struct nvmem_cell_table da830_evm_nvmem_cell_table = {
437         .nvmem_name     = "1-00500",
438         .cells          = da830_evm_nvmem_cells,
439         .ncells         = ARRAY_SIZE(da830_evm_nvmem_cells),
440 };
441
442 static struct nvmem_cell_lookup da830_evm_nvmem_cell_lookup = {
443         .nvmem_name     = "1-00500",
444         .cell_name      = "macaddr",
445         .dev_id         = "davinci_emac.1",
446         .con_id         = "mac-address",
447 };
448
449 static const struct property_entry da830_evm_i2c_eeprom_properties[] = {
450         PROPERTY_ENTRY_U32("pagesize", 64),
451         { }
452 };
453
454 static int __init da830_evm_ui_expander_setup(struct i2c_client *client,
455                 int gpio, unsigned ngpio, void *context)
456 {
457         gpio_request(gpio + 6, "UI MUX_MODE");
458
459         /* Drive mux mode low to match the default without UI card */
460         gpio_direction_output(gpio + 6, 0);
461
462         da830_evm_init_lcdc(gpio + 6);
463
464         da830_evm_init_nand(gpio + 6);
465
466         return 0;
467 }
468
469 static int da830_evm_ui_expander_teardown(struct i2c_client *client, int gpio,
470                 unsigned ngpio, void *context)
471 {
472         gpio_free(gpio + 6);
473         return 0;
474 }
475
476 static struct pcf857x_platform_data __initdata da830_evm_ui_expander_info = {
477         .gpio_base      = DAVINCI_N_GPIO,
478         .setup          = da830_evm_ui_expander_setup,
479         .teardown       = da830_evm_ui_expander_teardown,
480 };
481
482 static struct i2c_board_info __initdata da830_evm_i2c_devices[] = {
483         {
484                 I2C_BOARD_INFO("24c256", 0x50),
485                 .properties = da830_evm_i2c_eeprom_properties,
486         },
487         {
488                 I2C_BOARD_INFO("tlv320aic3x", 0x18),
489         },
490         {
491                 I2C_BOARD_INFO("pcf8574", 0x3f),
492                 .platform_data  = &da830_evm_ui_expander_info,
493         },
494 };
495
496 static struct davinci_i2c_platform_data da830_evm_i2c_0_pdata = {
497         .bus_freq       = 100,  /* kHz */
498         .bus_delay      = 0,    /* usec */
499 };
500
501 /*
502  * The following EDMA channels/slots are not being used by drivers (for
503  * example: Timer, GPIO, UART events etc) on da830/omap-l137 EVM, hence
504  * they are being reserved for codecs on the DSP side.
505  */
506 static const s16 da830_dma_rsv_chans[][2] = {
507         /* (offset, number) */
508         { 8,  2},
509         {12,  2},
510         {24,  4},
511         {30,  2},
512         {-1, -1}
513 };
514
515 static const s16 da830_dma_rsv_slots[][2] = {
516         /* (offset, number) */
517         { 8,  2},
518         {12,  2},
519         {24,  4},
520         {30, 26},
521         {-1, -1}
522 };
523
524 static struct edma_rsv_info da830_edma_rsv[] = {
525         {
526                 .rsv_chans      = da830_dma_rsv_chans,
527                 .rsv_slots      = da830_dma_rsv_slots,
528         },
529 };
530
531 static struct mtd_partition da830evm_spiflash_part[] = {
532         [0] = {
533                 .name = "DSP-UBL",
534                 .offset = 0,
535                 .size = SZ_8K,
536                 .mask_flags = MTD_WRITEABLE,
537         },
538         [1] = {
539                 .name = "ARM-UBL",
540                 .offset = MTDPART_OFS_APPEND,
541                 .size = SZ_16K + SZ_8K,
542                 .mask_flags = MTD_WRITEABLE,
543         },
544         [2] = {
545                 .name = "U-Boot",
546                 .offset = MTDPART_OFS_APPEND,
547                 .size = SZ_256K - SZ_32K,
548                 .mask_flags = MTD_WRITEABLE,
549         },
550         [3] = {
551                 .name = "U-Boot-Environment",
552                 .offset = MTDPART_OFS_APPEND,
553                 .size = SZ_16K,
554                 .mask_flags = 0,
555         },
556         [4] = {
557                 .name = "Kernel",
558                 .offset = MTDPART_OFS_APPEND,
559                 .size = MTDPART_SIZ_FULL,
560                 .mask_flags = 0,
561         },
562 };
563
564 static struct flash_platform_data da830evm_spiflash_data = {
565         .name           = "m25p80",
566         .parts          = da830evm_spiflash_part,
567         .nr_parts       = ARRAY_SIZE(da830evm_spiflash_part),
568         .type           = "w25x32",
569 };
570
571 static struct davinci_spi_config da830evm_spiflash_cfg = {
572         .io_type        = SPI_IO_TYPE_DMA,
573         .c2tdelay       = 8,
574         .t2cdelay       = 8,
575 };
576
577 static struct spi_board_info da830evm_spi_info[] = {
578         {
579                 .modalias               = "m25p80",
580                 .platform_data          = &da830evm_spiflash_data,
581                 .controller_data        = &da830evm_spiflash_cfg,
582                 .mode                   = SPI_MODE_0,
583                 .max_speed_hz           = 30000000,
584                 .bus_num                = 0,
585                 .chip_select            = 0,
586         },
587 };
588
589 static __init void da830_evm_init(void)
590 {
591         struct davinci_soc_info *soc_info = &davinci_soc_info;
592         int ret;
593
594         da830_register_clocks();
595
596         ret = da830_register_gpio();
597         if (ret)
598                 pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
599
600         ret = da830_register_edma(da830_edma_rsv);
601         if (ret)
602                 pr_warn("%s: edma registration failed: %d\n", __func__, ret);
603
604         ret = davinci_cfg_reg_list(da830_i2c0_pins);
605         if (ret)
606                 pr_warn("%s: i2c0 mux setup failed: %d\n", __func__, ret);
607
608         ret = da8xx_register_i2c(0, &da830_evm_i2c_0_pdata);
609         if (ret)
610                 pr_warn("%s: i2c0 registration failed: %d\n", __func__, ret);
611
612         da830_evm_usb_init();
613
614         soc_info->emac_pdata->rmii_en = 1;
615         soc_info->emac_pdata->phy_id = DA830_EVM_PHY_ID;
616
617         ret = davinci_cfg_reg_list(da830_cpgmac_pins);
618         if (ret)
619                 pr_warn("%s: cpgmac mux setup failed: %d\n", __func__, ret);
620
621         ret = da8xx_register_emac();
622         if (ret)
623                 pr_warn("%s: emac registration failed: %d\n", __func__, ret);
624
625         ret = da8xx_register_watchdog();
626         if (ret)
627                 pr_warn("%s: watchdog registration failed: %d\n",
628                         __func__, ret);
629
630         davinci_serial_init(da8xx_serial_device);
631
632         nvmem_add_cell_table(&da830_evm_nvmem_cell_table);
633         nvmem_add_cell_lookups(&da830_evm_nvmem_cell_lookup, 1);
634
635         i2c_register_board_info(1, da830_evm_i2c_devices,
636                         ARRAY_SIZE(da830_evm_i2c_devices));
637
638         ret = davinci_cfg_reg_list(da830_evm_mcasp1_pins);
639         if (ret)
640                 pr_warn("%s: mcasp1 mux setup failed: %d\n", __func__, ret);
641
642         da8xx_register_mcasp(1, &da830_evm_snd_data);
643
644         da830_evm_init_mmc();
645
646         ret = da8xx_register_rtc();
647         if (ret)
648                 pr_warn("%s: rtc setup failed: %d\n", __func__, ret);
649
650         ret = spi_register_board_info(da830evm_spi_info,
651                                       ARRAY_SIZE(da830evm_spi_info));
652         if (ret)
653                 pr_warn("%s: spi info registration failed: %d\n",
654                         __func__, ret);
655
656         ret = da8xx_register_spi_bus(0, ARRAY_SIZE(da830evm_spi_info));
657         if (ret)
658                 pr_warn("%s: spi 0 registration failed: %d\n", __func__, ret);
659
660         regulator_has_full_constraints();
661 }
662
663 #ifdef CONFIG_SERIAL_8250_CONSOLE
664 static int __init da830_evm_console_init(void)
665 {
666         if (!machine_is_davinci_da830_evm())
667                 return 0;
668
669         return add_preferred_console("ttyS", 2, "115200");
670 }
671 console_initcall(da830_evm_console_init);
672 #endif
673
674 static void __init da830_evm_map_io(void)
675 {
676         da830_init();
677 }
678
679 MACHINE_START(DAVINCI_DA830_EVM, "DaVinci DA830/OMAP-L137/AM17x EVM")
680         .atag_offset    = 0x100,
681         .map_io         = da830_evm_map_io,
682         .init_irq       = da830_init_irq,
683         .init_time      = da830_init_time,
684         .init_machine   = da830_evm_init,
685         .init_late      = davinci_init_late,
686         .dma_zone_size  = SZ_128M,
687 MACHINE_END