davinci: Audio support for DA850/OMAP-L138 EVM
[linux-ginger.git] / arch / arm / mach-davinci / board-da850-evm.c
blob52bfe4cba25c52f3a336b2703be6599b12f4c52f
1 /*
2 * TI DA850/OMAP-L138 EVM board
4 * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
6 * Derived from: arch/arm/mach-davinci/board-da830-evm.c
7 * Original Copyrights follow:
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.
14 #include <linux/kernel.h>
15 #include <linux/module.h>
16 #include <linux/init.h>
17 #include <linux/console.h>
18 #include <linux/i2c.h>
19 #include <linux/i2c/at24.h>
21 #include <asm/mach-types.h>
22 #include <asm/mach/arch.h>
24 #include <mach/common.h>
25 #include <mach/irqs.h>
26 #include <mach/cp_intc.h>
27 #include <mach/da8xx.h>
29 #define DA850_EVM_PHY_MASK 0x1
30 #define DA850_EVM_MDIO_FREQUENCY 2200000 /* PHY bus frequency */
32 static struct davinci_i2c_platform_data da850_evm_i2c_0_pdata = {
33 .bus_freq = 100, /* kHz */
34 .bus_delay = 0, /* usec */
37 static struct davinci_uart_config da850_evm_uart_config __initdata = {
38 .enabled_uarts = 0x7,
41 /* davinci da850 evm audio machine driver */
42 static u8 da850_iis_serializer_direction[] = {
43 INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
44 INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
45 INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, TX_MODE,
46 RX_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
49 static struct snd_platform_data da850_evm_snd_data = {
50 .tx_dma_offset = 0x2000,
51 .rx_dma_offset = 0x2000,
52 .op_mode = DAVINCI_MCASP_IIS_MODE,
53 .num_serializer = ARRAY_SIZE(da850_iis_serializer_direction),
54 .tdm_slots = 2,
55 .serial_dir = da850_iis_serializer_direction,
56 .eventq_no = EVENTQ_1,
57 .version = MCASP_VERSION_2,
58 .txnumevt = 1,
59 .rxnumevt = 1,
63 static __init void da850_evm_init(void)
65 struct davinci_soc_info *soc_info = &davinci_soc_info;
66 int ret;
68 ret = da8xx_register_edma();
69 if (ret)
70 pr_warning("da850_evm_init: edma registration failed: %d\n",
71 ret);
73 ret = da8xx_pinmux_setup(da850_i2c0_pins);
74 if (ret)
75 pr_warning("da850_evm_init: i2c0 mux setup failed: %d\n",
76 ret);
78 ret = da8xx_register_i2c(0, &da850_evm_i2c_0_pdata);
79 if (ret)
80 pr_warning("da850_evm_init: i2c0 registration failed: %d\n",
81 ret);
83 soc_info->emac_pdata->phy_mask = DA850_EVM_PHY_MASK;
84 soc_info->emac_pdata->mdio_max_freq = DA850_EVM_MDIO_FREQUENCY;
85 soc_info->emac_pdata->rmii_en = 0;
87 ret = da8xx_pinmux_setup(da850_cpgmac_pins);
88 if (ret)
89 pr_warning("da850_evm_init: cpgmac mux setup failed: %d\n",
90 ret);
92 ret = da8xx_register_emac();
93 if (ret)
94 pr_warning("da850_evm_init: emac registration failed: %d\n",
95 ret);
97 ret = da8xx_register_watchdog();
98 if (ret)
99 pr_warning("da830_evm_init: watchdog registration failed: %d\n",
100 ret);
102 davinci_serial_init(&da850_evm_uart_config);
105 * shut down uart 0 and 1; they are not used on the board and
106 * accessing them causes endless "too much work in irq53" messages
107 * with arago fs
109 __raw_writel(0, IO_ADDRESS(DA8XX_UART1_BASE) + 0x30);
110 __raw_writel(0, IO_ADDRESS(DA8XX_UART0_BASE) + 0x30);
112 ret = da8xx_pinmux_setup(da850_mcasp_pins);
113 if (ret)
114 pr_warning("da850_evm_init: mcasp mux setup failed: %d\n",
115 ret);
117 da8xx_init_mcasp(0, &da850_evm_snd_data);
120 #ifdef CONFIG_SERIAL_8250_CONSOLE
121 static int __init da850_evm_console_init(void)
123 return add_preferred_console("ttyS", 2, "115200");
125 console_initcall(da850_evm_console_init);
126 #endif
128 static __init void da850_evm_irq_init(void)
130 struct davinci_soc_info *soc_info = &davinci_soc_info;
132 cp_intc_init((void __iomem *)DA8XX_CP_INTC_VIRT, DA850_N_CP_INTC_IRQ,
133 soc_info->intc_irq_prios);
136 static void __init da850_evm_map_io(void)
138 da850_init();
141 MACHINE_START(DAVINCI_DA850_EVM, "DaVinci DA850/OMAP-L138 EVM")
142 .phys_io = IO_PHYS,
143 .io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc,
144 .boot_params = (DA8XX_DDR_BASE + 0x100),
145 .map_io = da850_evm_map_io,
146 .init_irq = da850_evm_irq_init,
147 .timer = &davinci_timer,
148 .init_machine = da850_evm_init,
149 MACHINE_END