blob: fe86afa7ea2e8dbe3abfa58e266eca638e12d73b [file] [log] [blame]
Mark A. Greer85937902009-06-03 18:41:53 -07001/*
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/module.h>
14#include <linux/init.h>
15#include <linux/console.h>
16#include <linux/i2c.h>
17#include <linux/i2c/at24.h>
18
19#include <asm/mach-types.h>
20#include <asm/mach/arch.h>
21
22#include <mach/common.h>
23#include <mach/irqs.h>
24#include <mach/cp_intc.h>
Mark A. Greer32bf0782009-08-28 15:05:21 -070025#include <mach/mux.h>
David A. Griego2eb30c82009-09-15 18:10:20 -070026#include <mach/gpio.h>
Mark A. Greer85937902009-06-03 18:41:53 -070027#include <mach/da8xx.h>
Chaithrika U Se33ef5e2009-08-11 17:01:59 -040028#include <mach/asp.h>
Mark A. Greer85937902009-06-03 18:41:53 -070029
30#define DA830_EVM_PHY_MASK 0x0
31#define DA830_EVM_MDIO_FREQUENCY 2200000 /* PHY bus frequency */
32
33static struct at24_platform_data da830_evm_i2c_eeprom_info = {
34 .byte_len = SZ_256K / 8,
35 .page_size = 64,
36 .flags = AT24_FLAG_ADDR16,
37 .setup = davinci_get_mac_addr,
38 .context = (void *)0x7f00,
39};
40
41static struct i2c_board_info __initdata da830_evm_i2c_devices[] = {
42 {
43 I2C_BOARD_INFO("24c256", 0x50),
44 .platform_data = &da830_evm_i2c_eeprom_info,
45 },
Chaithrika U S1a7ff8f2009-08-25 15:20:05 +030046 {
47 I2C_BOARD_INFO("tlv320aic3x", 0x18),
48 }
Mark A. Greer85937902009-06-03 18:41:53 -070049};
50
51static struct davinci_i2c_platform_data da830_evm_i2c_0_pdata = {
52 .bus_freq = 100, /* kHz */
53 .bus_delay = 0, /* usec */
54};
55
56static struct davinci_uart_config da830_evm_uart_config __initdata = {
57 .enabled_uarts = 0x7,
58};
59
Mark A. Greer32bf0782009-08-28 15:05:21 -070060static const short da830_evm_mcasp1_pins[] = {
61 DA830_AHCLKX1, DA830_ACLKX1, DA830_AFSX1, DA830_AHCLKR1, DA830_AFSR1,
62 DA830_AMUTE1, DA830_AXR1_0, DA830_AXR1_1, DA830_AXR1_2, DA830_AXR1_5,
63 DA830_ACLKR1, DA830_AXR1_6, DA830_AXR1_7, DA830_AXR1_8, DA830_AXR1_10,
64 DA830_AXR1_11,
65 -1
66};
67
Chaithrika U Se33ef5e2009-08-11 17:01:59 -040068static u8 da830_iis_serializer_direction[] = {
69 RX_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
70 INACTIVE_MODE, TX_MODE, INACTIVE_MODE, INACTIVE_MODE,
71 INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
72};
73
74static struct snd_platform_data da830_evm_snd_data = {
75 .tx_dma_offset = 0x2000,
76 .rx_dma_offset = 0x2000,
77 .op_mode = DAVINCI_MCASP_IIS_MODE,
78 .num_serializer = ARRAY_SIZE(da830_iis_serializer_direction),
79 .tdm_slots = 2,
80 .serial_dir = da830_iis_serializer_direction,
81 .eventq_no = EVENTQ_0,
82 .version = MCASP_VERSION_2,
83 .txnumevt = 1,
84 .rxnumevt = 1,
85};
86
David A. Griego2eb30c82009-09-15 18:10:20 -070087/*
88 * GPIO2[1] is used as MMC_SD_WP and GPIO2[2] as MMC_SD_INS.
89 */
90static const short da830_evm_mmc_sd_pins[] = {
91 DA830_MMCSD_DAT_0, DA830_MMCSD_DAT_1, DA830_MMCSD_DAT_2,
92 DA830_MMCSD_DAT_3, DA830_MMCSD_DAT_4, DA830_MMCSD_DAT_5,
93 DA830_MMCSD_DAT_6, DA830_MMCSD_DAT_7, DA830_MMCSD_CLK,
94 DA830_MMCSD_CMD, DA830_GPIO2_1, DA830_GPIO2_2,
95 -1
96};
97
98#define DA830_MMCSD_WP_PIN GPIO_TO_PIN(2, 1)
99
100static int da830_evm_mmc_get_ro(int index)
101{
102 return gpio_get_value(DA830_MMCSD_WP_PIN);
103}
104
105static struct davinci_mmc_config da830_evm_mmc_config = {
106 .get_ro = da830_evm_mmc_get_ro,
107 .wires = 4,
108 .version = MMC_CTLR_VERSION_2,
109};
110
111static inline void da830_evm_init_mmc(void)
112{
113 int ret;
114
115 ret = da8xx_pinmux_setup(da830_evm_mmc_sd_pins);
116 if (ret) {
117 pr_warning("da830_evm_init: mmc/sd mux setup failed: %d\n",
118 ret);
119 return;
120 }
121
122 ret = gpio_request(DA830_MMCSD_WP_PIN, "MMC WP");
123 if (ret) {
124 pr_warning("da830_evm_init: can not open GPIO %d\n",
125 DA830_MMCSD_WP_PIN);
126 return;
127 }
128 gpio_direction_input(DA830_MMCSD_WP_PIN);
129
130 ret = da8xx_register_mmcsd0(&da830_evm_mmc_config);
131 if (ret) {
132 pr_warning("da830_evm_init: mmc/sd registration failed: %d\n",
133 ret);
134 gpio_free(DA830_MMCSD_WP_PIN);
135 }
136}
137
Mark A. Greer85937902009-06-03 18:41:53 -0700138static __init void da830_evm_init(void)
139{
140 struct davinci_soc_info *soc_info = &davinci_soc_info;
141 int ret;
142
143 ret = da8xx_register_edma();
144 if (ret)
145 pr_warning("da830_evm_init: edma registration failed: %d\n",
146 ret);
147
Sudhakar Rajashekharac96b56c2009-07-16 05:45:32 -0400148 ret = da8xx_pinmux_setup(da830_i2c0_pins);
Mark A. Greer85937902009-06-03 18:41:53 -0700149 if (ret)
150 pr_warning("da830_evm_init: i2c0 mux setup failed: %d\n",
151 ret);
152
153 ret = da8xx_register_i2c(0, &da830_evm_i2c_0_pdata);
154 if (ret)
155 pr_warning("da830_evm_init: i2c0 registration failed: %d\n",
156 ret);
157
158 soc_info->emac_pdata->phy_mask = DA830_EVM_PHY_MASK;
159 soc_info->emac_pdata->mdio_max_freq = DA830_EVM_MDIO_FREQUENCY;
160 soc_info->emac_pdata->rmii_en = 1;
161
Sudhakar Rajashekharac96b56c2009-07-16 05:45:32 -0400162 ret = da8xx_pinmux_setup(da830_cpgmac_pins);
Mark A. Greer85937902009-06-03 18:41:53 -0700163 if (ret)
164 pr_warning("da830_evm_init: cpgmac mux setup failed: %d\n",
165 ret);
166
167 ret = da8xx_register_emac();
168 if (ret)
169 pr_warning("da830_evm_init: emac registration failed: %d\n",
170 ret);
171
172 ret = da8xx_register_watchdog();
173 if (ret)
174 pr_warning("da830_evm_init: watchdog registration failed: %d\n",
175 ret);
176
177 davinci_serial_init(&da830_evm_uart_config);
178 i2c_register_board_info(1, da830_evm_i2c_devices,
179 ARRAY_SIZE(da830_evm_i2c_devices));
Chaithrika U Se33ef5e2009-08-11 17:01:59 -0400180
Mark A. Greer32bf0782009-08-28 15:05:21 -0700181 ret = da8xx_pinmux_setup(da830_evm_mcasp1_pins);
Chaithrika U Se33ef5e2009-08-11 17:01:59 -0400182 if (ret)
183 pr_warning("da830_evm_init: mcasp1 mux setup failed: %d\n",
184 ret);
185
Mark A. Greerb8864aa2009-08-28 15:05:02 -0700186 da8xx_register_mcasp(1, &da830_evm_snd_data);
David A. Griego2eb30c82009-09-15 18:10:20 -0700187
188 da830_evm_init_mmc();
Mark A. Greer85937902009-06-03 18:41:53 -0700189}
190
191#ifdef CONFIG_SERIAL_8250_CONSOLE
192static int __init da830_evm_console_init(void)
193{
194 return add_preferred_console("ttyS", 2, "115200");
195}
196console_initcall(da830_evm_console_init);
197#endif
198
199static __init void da830_evm_irq_init(void)
200{
201 struct davinci_soc_info *soc_info = &davinci_soc_info;
202
203 cp_intc_init((void __iomem *)DA8XX_CP_INTC_VIRT, DA830_N_CP_INTC_IRQ,
204 soc_info->intc_irq_prios);
205}
206
207static void __init da830_evm_map_io(void)
208{
209 da830_init();
210}
211
Kevin Hilmanbaf09a42009-07-08 08:32:27 -0700212MACHINE_START(DAVINCI_DA830_EVM, "DaVinci DA830/OMAP L137 EVM")
Mark A. Greer85937902009-06-03 18:41:53 -0700213 .phys_io = IO_PHYS,
214 .io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc,
215 .boot_params = (DA8XX_DDR_BASE + 0x100),
216 .map_io = da830_evm_map_io,
217 .init_irq = da830_evm_irq_init,
218 .timer = &davinci_timer,
219 .init_machine = da830_evm_init,
220MACHINE_END