cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

board-da830-evm.c (17643B)


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