Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * TI DA830/OMAP L137 EVM board
0004  *
0005  * Author: Mark A. Greer <mgreer@mvista.com>
0006  * Derived from: arch/arm/mach-davinci/board-dm644x-evm.c
0007  *
0008  * 2007, 2009 (c) MontaVista Software, Inc.
0009  */
0010 #include <linux/kernel.h>
0011 #include <linux/init.h>
0012 #include <linux/console.h>
0013 #include <linux/interrupt.h>
0014 #include <linux/gpio.h>
0015 #include <linux/gpio/machine.h>
0016 #include <linux/platform_device.h>
0017 #include <linux/i2c.h>
0018 #include <linux/platform_data/pcf857x.h>
0019 #include <linux/property.h>
0020 #include <linux/mtd/mtd.h>
0021 #include <linux/mtd/partitions.h>
0022 #include <linux/spi/spi.h>
0023 #include <linux/spi/flash.h>
0024 #include <linux/platform_data/gpio-davinci.h>
0025 #include <linux/platform_data/mtd-davinci.h>
0026 #include <linux/platform_data/mtd-davinci-aemif.h>
0027 #include <linux/platform_data/spi-davinci.h>
0028 #include <linux/platform_data/usb-davinci.h>
0029 #include <linux/platform_data/ti-aemif.h>
0030 #include <linux/regulator/fixed.h>
0031 #include <linux/regulator/machine.h>
0032 #include <linux/nvmem-provider.h>
0033 
0034 #include <asm/mach-types.h>
0035 #include <asm/mach/arch.h>
0036 
0037 #include "common.h"
0038 #include "mux.h"
0039 #include "da8xx.h"
0040 #include "irqs.h"
0041 
0042 #define DA830_EVM_PHY_ID        ""
0043 /*
0044  * USB1 VBUS is controlled by GPIO1[15], over-current is reported on GPIO2[4].
0045  */
0046 #define ON_BD_USB_DRV   GPIO_TO_PIN(1, 15)
0047 #define ON_BD_USB_OVC   GPIO_TO_PIN(2, 4)
0048 
0049 static const short da830_evm_usb11_pins[] = {
0050     DA830_GPIO1_15, DA830_GPIO2_4,
0051     -1
0052 };
0053 
0054 static struct regulator_consumer_supply da830_evm_usb_supplies[] = {
0055     REGULATOR_SUPPLY("vbus", NULL),
0056 };
0057 
0058 static struct regulator_init_data da830_evm_usb_vbus_data = {
0059     .consumer_supplies  = da830_evm_usb_supplies,
0060     .num_consumer_supplies  = ARRAY_SIZE(da830_evm_usb_supplies),
0061     .constraints    = {
0062         .valid_ops_mask = REGULATOR_CHANGE_STATUS,
0063     },
0064 };
0065 
0066 static struct fixed_voltage_config da830_evm_usb_vbus = {
0067     .supply_name        = "vbus",
0068     .microvolts     = 33000000,
0069     .init_data      = &da830_evm_usb_vbus_data,
0070 };
0071 
0072 static struct platform_device da830_evm_usb_vbus_device = {
0073     .name       = "reg-fixed-voltage",
0074     .id     = 0,
0075     .dev        = {
0076         .platform_data = &da830_evm_usb_vbus,
0077     },
0078 };
0079 
0080 static struct gpiod_lookup_table da830_evm_usb_oc_gpio_lookup = {
0081     .dev_id     = "ohci-da8xx",
0082     .table = {
0083         GPIO_LOOKUP("davinci_gpio", ON_BD_USB_OVC, "oc", 0),
0084         { }
0085     },
0086 };
0087 
0088 static struct gpiod_lookup_table da830_evm_usb_vbus_gpio_lookup = {
0089     .dev_id     = "reg-fixed-voltage.0",
0090     .table = {
0091         GPIO_LOOKUP("davinci_gpio", ON_BD_USB_DRV, NULL, 0),
0092         { }
0093     },
0094 };
0095 
0096 static struct gpiod_lookup_table *da830_evm_usb_gpio_lookups[] = {
0097     &da830_evm_usb_oc_gpio_lookup,
0098     &da830_evm_usb_vbus_gpio_lookup,
0099 };
0100 
0101 static struct da8xx_ohci_root_hub da830_evm_usb11_pdata = {
0102     /* TPS2065 switch @ 5V */
0103     .potpgt     = (3 + 1) / 2,  /* 3 ms max */
0104 };
0105 
0106 static __init void da830_evm_usb_init(void)
0107 {
0108     int ret;
0109 
0110     ret = da8xx_register_usb_phy_clocks();
0111     if (ret)
0112         pr_warn("%s: USB PHY CLK registration failed: %d\n",
0113             __func__, ret);
0114 
0115     gpiod_add_lookup_tables(da830_evm_usb_gpio_lookups,
0116                 ARRAY_SIZE(da830_evm_usb_gpio_lookups));
0117 
0118     ret = da8xx_register_usb_phy();
0119     if (ret)
0120         pr_warn("%s: USB PHY registration failed: %d\n",
0121             __func__, ret);
0122 
0123     ret = davinci_cfg_reg(DA830_USB0_DRVVBUS);
0124     if (ret)
0125         pr_warn("%s: USB 2.0 PinMux setup failed: %d\n", __func__, ret);
0126     else {
0127         /*
0128          * TPS2065 switch @ 5V supplies 1 A (sustains 1.5 A),
0129          * with the power on to power good time of 3 ms.
0130          */
0131         ret = da8xx_register_usb20(1000, 3);
0132         if (ret)
0133             pr_warn("%s: USB 2.0 registration failed: %d\n",
0134                 __func__, ret);
0135     }
0136 
0137     ret = davinci_cfg_reg_list(da830_evm_usb11_pins);
0138     if (ret) {
0139         pr_warn("%s: USB 1.1 PinMux setup failed: %d\n", __func__, ret);
0140         return;
0141     }
0142 
0143     ret = platform_device_register(&da830_evm_usb_vbus_device);
0144     if (ret) {
0145         pr_warn("%s: Unable to register the vbus supply\n", __func__);
0146         return;
0147     }
0148 
0149     ret = da8xx_register_usb11(&da830_evm_usb11_pdata);
0150     if (ret)
0151         pr_warn("%s: USB 1.1 registration failed: %d\n", __func__, ret);
0152 }
0153 
0154 static const short da830_evm_mcasp1_pins[] = {
0155     DA830_AHCLKX1, DA830_ACLKX1, DA830_AFSX1, DA830_AHCLKR1, DA830_AFSR1,
0156     DA830_AMUTE1, DA830_AXR1_0, DA830_AXR1_1, DA830_AXR1_2, DA830_AXR1_5,
0157     DA830_ACLKR1, DA830_AXR1_6, DA830_AXR1_7, DA830_AXR1_8, DA830_AXR1_10,
0158     DA830_AXR1_11,
0159     -1
0160 };
0161 
0162 static u8 da830_iis_serializer_direction[] = {
0163     RX_MODE,    INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,
0164     INACTIVE_MODE,  TX_MODE,    INACTIVE_MODE,  INACTIVE_MODE,
0165     INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,
0166 };
0167 
0168 static struct snd_platform_data da830_evm_snd_data = {
0169     .tx_dma_offset  = 0x2000,
0170     .rx_dma_offset  = 0x2000,
0171     .op_mode        = DAVINCI_MCASP_IIS_MODE,
0172     .num_serializer = ARRAY_SIZE(da830_iis_serializer_direction),
0173     .tdm_slots      = 2,
0174     .serial_dir     = da830_iis_serializer_direction,
0175     .asp_chan_q     = EVENTQ_0,
0176     .version    = MCASP_VERSION_2,
0177     .txnumevt   = 1,
0178     .rxnumevt   = 1,
0179 };
0180 
0181 /*
0182  * GPIO2[1] is used as MMC_SD_WP and GPIO2[2] as MMC_SD_INS.
0183  */
0184 static const short da830_evm_mmc_sd_pins[] = {
0185     DA830_MMCSD_DAT_0, DA830_MMCSD_DAT_1, DA830_MMCSD_DAT_2,
0186     DA830_MMCSD_DAT_3, DA830_MMCSD_DAT_4, DA830_MMCSD_DAT_5,
0187     DA830_MMCSD_DAT_6, DA830_MMCSD_DAT_7, DA830_MMCSD_CLK,
0188     DA830_MMCSD_CMD,   DA830_GPIO2_1,     DA830_GPIO2_2,
0189     -1
0190 };
0191 
0192 #define DA830_MMCSD_WP_PIN      GPIO_TO_PIN(2, 1)
0193 #define DA830_MMCSD_CD_PIN      GPIO_TO_PIN(2, 2)
0194 
0195 static struct gpiod_lookup_table mmc_gpios_table = {
0196     .dev_id = "da830-mmc.0",
0197     .table = {
0198         /* gpio chip 1 contains gpio range 32-63 */
0199         GPIO_LOOKUP("davinci_gpio", DA830_MMCSD_CD_PIN, "cd",
0200                 GPIO_ACTIVE_LOW),
0201         GPIO_LOOKUP("davinci_gpio", DA830_MMCSD_WP_PIN, "wp",
0202                 GPIO_ACTIVE_LOW),
0203         { }
0204     },
0205 };
0206 
0207 static struct davinci_mmc_config da830_evm_mmc_config = {
0208     .wires          = 8,
0209     .max_freq       = 50000000,
0210     .caps           = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
0211 };
0212 
0213 static inline void da830_evm_init_mmc(void)
0214 {
0215     int ret;
0216 
0217     ret = davinci_cfg_reg_list(da830_evm_mmc_sd_pins);
0218     if (ret) {
0219         pr_warn("%s: mmc/sd mux setup failed: %d\n", __func__, ret);
0220         return;
0221     }
0222 
0223     gpiod_add_lookup_table(&mmc_gpios_table);
0224 
0225     ret = da8xx_register_mmcsd0(&da830_evm_mmc_config);
0226     if (ret) {
0227         pr_warn("%s: mmc/sd registration failed: %d\n", __func__, ret);
0228         gpiod_remove_lookup_table(&mmc_gpios_table);
0229     }
0230 }
0231 
0232 #define HAS_MMC     IS_ENABLED(CONFIG_MMC_DAVINCI)
0233 
0234 #ifdef CONFIG_DA830_UI_NAND
0235 static struct mtd_partition da830_evm_nand_partitions[] = {
0236     /* bootloader (U-Boot, etc) in first sector */
0237     [0] = {
0238         .name       = "bootloader",
0239         .offset     = 0,
0240         .size       = SZ_128K,
0241         .mask_flags = MTD_WRITEABLE,    /* force read-only */
0242     },
0243     /* bootloader params in the next sector */
0244     [1] = {
0245         .name       = "params",
0246         .offset     = MTDPART_OFS_APPEND,
0247         .size       = SZ_128K,
0248         .mask_flags = MTD_WRITEABLE,    /* force read-only */
0249     },
0250     /* kernel */
0251     [2] = {
0252         .name       = "kernel",
0253         .offset     = MTDPART_OFS_APPEND,
0254         .size       = SZ_2M,
0255         .mask_flags = 0,
0256     },
0257     /* file system */
0258     [3] = {
0259         .name       = "filesystem",
0260         .offset     = MTDPART_OFS_APPEND,
0261         .size       = MTDPART_SIZ_FULL,
0262         .mask_flags = 0,
0263     }
0264 };
0265 
0266 /* flash bbt descriptors */
0267 static uint8_t da830_evm_nand_bbt_pattern[] = { 'B', 'b', 't', '0' };
0268 static uint8_t da830_evm_nand_mirror_pattern[] = { '1', 't', 'b', 'B' };
0269 
0270 static struct nand_bbt_descr da830_evm_nand_bbt_main_descr = {
0271     .options    = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE |
0272               NAND_BBT_WRITE | NAND_BBT_2BIT |
0273               NAND_BBT_VERSION | NAND_BBT_PERCHIP,
0274     .offs       = 2,
0275     .len        = 4,
0276     .veroffs    = 16,
0277     .maxblocks  = 4,
0278     .pattern    = da830_evm_nand_bbt_pattern
0279 };
0280 
0281 static struct nand_bbt_descr da830_evm_nand_bbt_mirror_descr = {
0282     .options    = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE |
0283               NAND_BBT_WRITE | NAND_BBT_2BIT |
0284               NAND_BBT_VERSION | NAND_BBT_PERCHIP,
0285     .offs       = 2,
0286     .len        = 4,
0287     .veroffs    = 16,
0288     .maxblocks  = 4,
0289     .pattern    = da830_evm_nand_mirror_pattern
0290 };
0291 
0292 static struct davinci_aemif_timing da830_evm_nandflash_timing = {
0293     .wsetup         = 24,
0294     .wstrobe        = 21,
0295     .whold          = 14,
0296     .rsetup         = 19,
0297     .rstrobe        = 50,
0298     .rhold          = 0,
0299     .ta             = 20,
0300 };
0301 
0302 static struct davinci_nand_pdata da830_evm_nand_pdata = {
0303     .core_chipsel   = 1,
0304     .parts      = da830_evm_nand_partitions,
0305     .nr_parts   = ARRAY_SIZE(da830_evm_nand_partitions),
0306     .engine_type    = NAND_ECC_ENGINE_TYPE_ON_HOST,
0307     .ecc_bits   = 4,
0308     .bbt_options    = NAND_BBT_USE_FLASH,
0309     .bbt_td     = &da830_evm_nand_bbt_main_descr,
0310     .bbt_md     = &da830_evm_nand_bbt_mirror_descr,
0311     .timing         = &da830_evm_nandflash_timing,
0312 };
0313 
0314 static struct resource da830_evm_nand_resources[] = {
0315     [0] = {     /* First memory resource is NAND I/O window */
0316         .start  = DA8XX_AEMIF_CS3_BASE,
0317         .end    = DA8XX_AEMIF_CS3_BASE + PAGE_SIZE - 1,
0318         .flags  = IORESOURCE_MEM,
0319     },
0320     [1] = {     /* Second memory resource is AEMIF control registers */
0321         .start  = DA8XX_AEMIF_CTL_BASE,
0322         .end    = DA8XX_AEMIF_CTL_BASE + SZ_32K - 1,
0323         .flags  = IORESOURCE_MEM,
0324     },
0325 };
0326 
0327 static struct platform_device da830_evm_aemif_devices[] = {
0328     {
0329         .name       = "davinci_nand",
0330         .id     = 1,
0331         .dev        = {
0332             .platform_data  = &da830_evm_nand_pdata,
0333         },
0334         .num_resources  = ARRAY_SIZE(da830_evm_nand_resources),
0335         .resource   = da830_evm_nand_resources,
0336     },
0337 };
0338 
0339 static struct resource da830_evm_aemif_resource[] = {
0340     {
0341         .start  = DA8XX_AEMIF_CTL_BASE,
0342         .end    = DA8XX_AEMIF_CTL_BASE + SZ_32K - 1,
0343         .flags  = IORESOURCE_MEM,
0344     },
0345 };
0346 
0347 static struct aemif_abus_data da830_evm_aemif_abus_data[] = {
0348     {
0349         .cs = 3,
0350     },
0351 };
0352 
0353 static struct aemif_platform_data da830_evm_aemif_pdata = {
0354     .abus_data      = da830_evm_aemif_abus_data,
0355     .num_abus_data      = ARRAY_SIZE(da830_evm_aemif_abus_data),
0356     .sub_devices        = da830_evm_aemif_devices,
0357     .num_sub_devices    = ARRAY_SIZE(da830_evm_aemif_devices),
0358     .cs_offset      = 2,
0359 };
0360 
0361 static struct platform_device da830_evm_aemif_device = {
0362     .name       = "ti-aemif",
0363     .id     = -1,
0364     .dev = {
0365         .platform_data = &da830_evm_aemif_pdata,
0366     },
0367     .resource   = da830_evm_aemif_resource,
0368     .num_resources  = ARRAY_SIZE(da830_evm_aemif_resource),
0369 };
0370 
0371 /*
0372  * UI board NAND/NOR flashes only use 8-bit data bus.
0373  */
0374 static const short da830_evm_emif25_pins[] = {
0375     DA830_EMA_D_0, DA830_EMA_D_1, DA830_EMA_D_2, DA830_EMA_D_3,
0376     DA830_EMA_D_4, DA830_EMA_D_5, DA830_EMA_D_6, DA830_EMA_D_7,
0377     DA830_EMA_A_0, DA830_EMA_A_1, DA830_EMA_A_2, DA830_EMA_A_3,
0378     DA830_EMA_A_4, DA830_EMA_A_5, DA830_EMA_A_6, DA830_EMA_A_7,
0379     DA830_EMA_A_8, DA830_EMA_A_9, DA830_EMA_A_10, DA830_EMA_A_11,
0380     DA830_EMA_A_12, DA830_EMA_BA_0, DA830_EMA_BA_1, DA830_NEMA_WE,
0381     DA830_NEMA_CS_2, DA830_NEMA_CS_3, DA830_NEMA_OE, DA830_EMA_WAIT_0,
0382     -1
0383 };
0384 
0385 static inline void da830_evm_init_nand(int mux_mode)
0386 {
0387     int ret;
0388 
0389     if (HAS_MMC) {
0390         pr_warn("WARNING: both MMC/SD and NAND are enabled, but they share AEMIF pins\n"
0391             "\tDisable MMC/SD for NAND support\n");
0392         return;
0393     }
0394 
0395     ret = davinci_cfg_reg_list(da830_evm_emif25_pins);
0396     if (ret)
0397         pr_warn("%s: emif25 mux setup failed: %d\n", __func__, ret);
0398 
0399     ret = platform_device_register(&da830_evm_aemif_device);
0400     if (ret)
0401         pr_warn("%s: AEMIF device not registered\n", __func__);
0402 
0403     gpio_direction_output(mux_mode, 1);
0404 }
0405 #else
0406 static inline void da830_evm_init_nand(int mux_mode) { }
0407 #endif
0408 
0409 #ifdef CONFIG_DA830_UI_LCD
0410 static inline void da830_evm_init_lcdc(int mux_mode)
0411 {
0412     int ret;
0413 
0414     ret = davinci_cfg_reg_list(da830_lcdcntl_pins);
0415     if (ret)
0416         pr_warn("%s: lcdcntl mux setup failed: %d\n", __func__, ret);
0417 
0418     ret = da8xx_register_lcdc(&sharp_lcd035q3dg01_pdata);
0419     if (ret)
0420         pr_warn("%s: lcd setup failed: %d\n", __func__, ret);
0421 
0422     gpio_direction_output(mux_mode, 0);
0423 }
0424 #else
0425 static inline void da830_evm_init_lcdc(int mux_mode) { }
0426 #endif
0427 
0428 static struct nvmem_cell_info da830_evm_nvmem_cells[] = {
0429     {
0430         .name       = "macaddr",
0431         .offset     = 0x7f00,
0432         .bytes      = ETH_ALEN,
0433     }
0434 };
0435 
0436 static struct nvmem_cell_table da830_evm_nvmem_cell_table = {
0437     .nvmem_name = "1-00500",
0438     .cells      = da830_evm_nvmem_cells,
0439     .ncells     = ARRAY_SIZE(da830_evm_nvmem_cells),
0440 };
0441 
0442 static struct nvmem_cell_lookup da830_evm_nvmem_cell_lookup = {
0443     .nvmem_name = "1-00500",
0444     .cell_name  = "macaddr",
0445     .dev_id     = "davinci_emac.1",
0446     .con_id     = "mac-address",
0447 };
0448 
0449 static const struct property_entry da830_evm_i2c_eeprom_properties[] = {
0450     PROPERTY_ENTRY_U32("pagesize", 64),
0451     { }
0452 };
0453 
0454 static const struct software_node da830_evm_i2c_eeprom_node = {
0455     .properties = da830_evm_i2c_eeprom_properties,
0456 };
0457 
0458 static int __init da830_evm_ui_expander_setup(struct i2c_client *client,
0459         int gpio, unsigned ngpio, void *context)
0460 {
0461     gpio_request(gpio + 6, "UI MUX_MODE");
0462 
0463     /* Drive mux mode low to match the default without UI card */
0464     gpio_direction_output(gpio + 6, 0);
0465 
0466     da830_evm_init_lcdc(gpio + 6);
0467 
0468     da830_evm_init_nand(gpio + 6);
0469 
0470     return 0;
0471 }
0472 
0473 static void da830_evm_ui_expander_teardown(struct i2c_client *client, int gpio,
0474         unsigned ngpio, void *context)
0475 {
0476     gpio_free(gpio + 6);
0477 }
0478 
0479 static struct pcf857x_platform_data __initdata da830_evm_ui_expander_info = {
0480     .gpio_base  = DAVINCI_N_GPIO,
0481     .setup      = da830_evm_ui_expander_setup,
0482     .teardown   = da830_evm_ui_expander_teardown,
0483 };
0484 
0485 static struct i2c_board_info __initdata da830_evm_i2c_devices[] = {
0486     {
0487         I2C_BOARD_INFO("24c256", 0x50),
0488         .swnode = &da830_evm_i2c_eeprom_node,
0489     },
0490     {
0491         I2C_BOARD_INFO("tlv320aic3x", 0x18),
0492     },
0493     {
0494         I2C_BOARD_INFO("pcf8574", 0x3f),
0495         .platform_data  = &da830_evm_ui_expander_info,
0496     },
0497 };
0498 
0499 static struct davinci_i2c_platform_data da830_evm_i2c_0_pdata = {
0500     .bus_freq   = 100,  /* kHz */
0501     .bus_delay  = 0,    /* usec */
0502 };
0503 
0504 /*
0505  * The following EDMA channels/slots are not being used by drivers (for
0506  * example: Timer, GPIO, UART events etc) on da830/omap-l137 EVM, hence
0507  * they are being reserved for codecs on the DSP side.
0508  */
0509 static const s16 da830_dma_rsv_chans[][2] = {
0510     /* (offset, number) */
0511     { 8,  2},
0512     {12,  2},
0513     {24,  4},
0514     {30,  2},
0515     {-1, -1}
0516 };
0517 
0518 static const s16 da830_dma_rsv_slots[][2] = {
0519     /* (offset, number) */
0520     { 8,  2},
0521     {12,  2},
0522     {24,  4},
0523     {30, 26},
0524     {-1, -1}
0525 };
0526 
0527 static struct edma_rsv_info da830_edma_rsv[] = {
0528     {
0529         .rsv_chans  = da830_dma_rsv_chans,
0530         .rsv_slots  = da830_dma_rsv_slots,
0531     },
0532 };
0533 
0534 static struct mtd_partition da830evm_spiflash_part[] = {
0535     [0] = {
0536         .name = "DSP-UBL",
0537         .offset = 0,
0538         .size = SZ_8K,
0539         .mask_flags = MTD_WRITEABLE,
0540     },
0541     [1] = {
0542         .name = "ARM-UBL",
0543         .offset = MTDPART_OFS_APPEND,
0544         .size = SZ_16K + SZ_8K,
0545         .mask_flags = MTD_WRITEABLE,
0546     },
0547     [2] = {
0548         .name = "U-Boot",
0549         .offset = MTDPART_OFS_APPEND,
0550         .size = SZ_256K - SZ_32K,
0551         .mask_flags = MTD_WRITEABLE,
0552     },
0553     [3] = {
0554         .name = "U-Boot-Environment",
0555         .offset = MTDPART_OFS_APPEND,
0556         .size = SZ_16K,
0557         .mask_flags = 0,
0558     },
0559     [4] = {
0560         .name = "Kernel",
0561         .offset = MTDPART_OFS_APPEND,
0562         .size = MTDPART_SIZ_FULL,
0563         .mask_flags = 0,
0564     },
0565 };
0566 
0567 static struct flash_platform_data da830evm_spiflash_data = {
0568     .name       = "m25p80",
0569     .parts      = da830evm_spiflash_part,
0570     .nr_parts   = ARRAY_SIZE(da830evm_spiflash_part),
0571     .type       = "w25x32",
0572 };
0573 
0574 static struct davinci_spi_config da830evm_spiflash_cfg = {
0575     .io_type    = SPI_IO_TYPE_DMA,
0576     .c2tdelay   = 8,
0577     .t2cdelay   = 8,
0578 };
0579 
0580 static struct spi_board_info da830evm_spi_info[] = {
0581     {
0582         .modalias       = "m25p80",
0583         .platform_data      = &da830evm_spiflash_data,
0584         .controller_data    = &da830evm_spiflash_cfg,
0585         .mode           = SPI_MODE_0,
0586         .max_speed_hz       = 30000000,
0587         .bus_num        = 0,
0588         .chip_select        = 0,
0589     },
0590 };
0591 
0592 static __init void da830_evm_init(void)
0593 {
0594     struct davinci_soc_info *soc_info = &davinci_soc_info;
0595     int ret;
0596 
0597     da830_register_clocks();
0598 
0599     ret = da830_register_gpio();
0600     if (ret)
0601         pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
0602 
0603     ret = da830_register_edma(da830_edma_rsv);
0604     if (ret)
0605         pr_warn("%s: edma registration failed: %d\n", __func__, ret);
0606 
0607     ret = davinci_cfg_reg_list(da830_i2c0_pins);
0608     if (ret)
0609         pr_warn("%s: i2c0 mux setup failed: %d\n", __func__, ret);
0610 
0611     ret = da8xx_register_i2c(0, &da830_evm_i2c_0_pdata);
0612     if (ret)
0613         pr_warn("%s: i2c0 registration failed: %d\n", __func__, ret);
0614 
0615     da830_evm_usb_init();
0616 
0617     soc_info->emac_pdata->rmii_en = 1;
0618     soc_info->emac_pdata->phy_id = DA830_EVM_PHY_ID;
0619 
0620     ret = davinci_cfg_reg_list(da830_cpgmac_pins);
0621     if (ret)
0622         pr_warn("%s: cpgmac mux setup failed: %d\n", __func__, ret);
0623 
0624     ret = da8xx_register_emac();
0625     if (ret)
0626         pr_warn("%s: emac registration failed: %d\n", __func__, ret);
0627 
0628     ret = da8xx_register_watchdog();
0629     if (ret)
0630         pr_warn("%s: watchdog registration failed: %d\n",
0631             __func__, ret);
0632 
0633     davinci_serial_init(da8xx_serial_device);
0634 
0635     nvmem_add_cell_table(&da830_evm_nvmem_cell_table);
0636     nvmem_add_cell_lookups(&da830_evm_nvmem_cell_lookup, 1);
0637 
0638     i2c_register_board_info(1, da830_evm_i2c_devices,
0639             ARRAY_SIZE(da830_evm_i2c_devices));
0640 
0641     ret = davinci_cfg_reg_list(da830_evm_mcasp1_pins);
0642     if (ret)
0643         pr_warn("%s: mcasp1 mux setup failed: %d\n", __func__, ret);
0644 
0645     da8xx_register_mcasp(1, &da830_evm_snd_data);
0646 
0647     da830_evm_init_mmc();
0648 
0649     ret = da8xx_register_rtc();
0650     if (ret)
0651         pr_warn("%s: rtc setup failed: %d\n", __func__, ret);
0652 
0653     ret = spi_register_board_info(da830evm_spi_info,
0654                       ARRAY_SIZE(da830evm_spi_info));
0655     if (ret)
0656         pr_warn("%s: spi info registration failed: %d\n",
0657             __func__, ret);
0658 
0659     ret = da8xx_register_spi_bus(0, ARRAY_SIZE(da830evm_spi_info));
0660     if (ret)
0661         pr_warn("%s: spi 0 registration failed: %d\n", __func__, ret);
0662 
0663     regulator_has_full_constraints();
0664 }
0665 
0666 #ifdef CONFIG_SERIAL_8250_CONSOLE
0667 static int __init da830_evm_console_init(void)
0668 {
0669     if (!machine_is_davinci_da830_evm())
0670         return 0;
0671 
0672     return add_preferred_console("ttyS", 2, "115200");
0673 }
0674 console_initcall(da830_evm_console_init);
0675 #endif
0676 
0677 static void __init da830_evm_map_io(void)
0678 {
0679     da830_init();
0680 }
0681 
0682 MACHINE_START(DAVINCI_DA830_EVM, "DaVinci DA830/OMAP-L137/AM17x EVM")
0683     .atag_offset    = 0x100,
0684     .map_io     = da830_evm_map_io,
0685     .init_irq   = da830_init_irq,
0686     .init_time  = da830_init_time,
0687     .init_machine   = da830_evm_init,
0688     .init_late  = davinci_init_late,
0689     .dma_zone_size  = SZ_128M,
0690 MACHINE_END