blob: b1df784ed70291fbe516e29a39ea7d654fa437d0 [file] [log] [blame]
Sudhakar Rajashekhara0fbc5592009-07-16 06:42:18 -04001/*
2 * TI DA850/OMAP-L138 EVM board
3 *
4 * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
5 *
6 * Derived from: arch/arm/mach-davinci/board-da830-evm.c
7 * Original Copyrights follow:
8 *
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.
13 */
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>
Sudhakar Rajashekhara5cbdf272009-08-13 14:33:14 -040020#include <linux/gpio.h>
Sudhakar Rajashekhara0fbc5592009-07-16 06:42:18 -040021
22#include <asm/mach-types.h>
23#include <asm/mach/arch.h>
24
25#include <mach/common.h>
26#include <mach/irqs.h>
27#include <mach/cp_intc.h>
28#include <mach/da8xx.h>
29
Sudhakar Rajashekhara5a4b1312009-07-17 04:47:10 -040030#define DA850_EVM_PHY_MASK 0x1
31#define DA850_EVM_MDIO_FREQUENCY 2200000 /* PHY bus frequency */
32
Sudhakar Rajashekhara5cbdf272009-08-13 14:33:14 -040033#define DA850_LCD_BL_PIN GPIO_TO_PIN(2, 15)
34#define DA850_LCD_PWR_PIN GPIO_TO_PIN(8, 10)
35
Sudhakar Rajashekhara0fbc5592009-07-16 06:42:18 -040036static struct davinci_i2c_platform_data da850_evm_i2c_0_pdata = {
37 .bus_freq = 100, /* kHz */
38 .bus_delay = 0, /* usec */
39};
40
41static struct davinci_uart_config da850_evm_uart_config __initdata = {
42 .enabled_uarts = 0x7,
43};
44
Chaithrika U S491214e2009-08-11 17:03:25 -040045/* davinci da850 evm audio machine driver */
46static u8 da850_iis_serializer_direction[] = {
47 INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
48 INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
49 INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, TX_MODE,
50 RX_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
51};
52
53static struct snd_platform_data da850_evm_snd_data = {
54 .tx_dma_offset = 0x2000,
55 .rx_dma_offset = 0x2000,
56 .op_mode = DAVINCI_MCASP_IIS_MODE,
57 .num_serializer = ARRAY_SIZE(da850_iis_serializer_direction),
58 .tdm_slots = 2,
59 .serial_dir = da850_iis_serializer_direction,
60 .eventq_no = EVENTQ_1,
61 .version = MCASP_VERSION_2,
62 .txnumevt = 1,
63 .rxnumevt = 1,
64};
65
Sudhakar Rajashekhara5cbdf272009-08-13 14:33:14 -040066static int da850_lcd_hw_init(void)
67{
68 int status;
69
70 status = gpio_request(DA850_LCD_BL_PIN, "lcd bl\n");
71 if (status < 0)
72 return status;
73
74 status = gpio_request(DA850_LCD_PWR_PIN, "lcd pwr\n");
75 if (status < 0) {
76 gpio_free(DA850_LCD_BL_PIN);
77 return status;
78 }
79
80 gpio_direction_output(DA850_LCD_BL_PIN, 0);
81 gpio_direction_output(DA850_LCD_PWR_PIN, 0);
82
83 /* disable lcd backlight */
84 gpio_set_value(DA850_LCD_BL_PIN, 0);
85
86 /* disable lcd power */
87 gpio_set_value(DA850_LCD_PWR_PIN, 0);
88
89 /* enable lcd power */
90 gpio_set_value(DA850_LCD_PWR_PIN, 1);
91
92 /* enable lcd backlight */
93 gpio_set_value(DA850_LCD_BL_PIN, 1);
94
95 return 0;
96}
Chaithrika U S491214e2009-08-11 17:03:25 -040097
Sudhakar Rajashekhara0fbc5592009-07-16 06:42:18 -040098static __init void da850_evm_init(void)
99{
Sudhakar Rajashekhara5a4b1312009-07-17 04:47:10 -0400100 struct davinci_soc_info *soc_info = &davinci_soc_info;
Sudhakar Rajashekhara0fbc5592009-07-16 06:42:18 -0400101 int ret;
102
103 ret = da8xx_register_edma();
104 if (ret)
105 pr_warning("da850_evm_init: edma registration failed: %d\n",
106 ret);
107
108 ret = da8xx_pinmux_setup(da850_i2c0_pins);
109 if (ret)
110 pr_warning("da850_evm_init: i2c0 mux setup failed: %d\n",
111 ret);
112
113 ret = da8xx_register_i2c(0, &da850_evm_i2c_0_pdata);
114 if (ret)
115 pr_warning("da850_evm_init: i2c0 registration failed: %d\n",
116 ret);
117
Sudhakar Rajashekhara5a4b1312009-07-17 04:47:10 -0400118 soc_info->emac_pdata->phy_mask = DA850_EVM_PHY_MASK;
119 soc_info->emac_pdata->mdio_max_freq = DA850_EVM_MDIO_FREQUENCY;
120 soc_info->emac_pdata->rmii_en = 0;
121
122 ret = da8xx_pinmux_setup(da850_cpgmac_pins);
123 if (ret)
124 pr_warning("da850_evm_init: cpgmac mux setup failed: %d\n",
125 ret);
126
127 ret = da8xx_register_emac();
128 if (ret)
129 pr_warning("da850_evm_init: emac registration failed: %d\n",
130 ret);
131
Sudhakar Rajashekhara0fbc5592009-07-16 06:42:18 -0400132 ret = da8xx_register_watchdog();
133 if (ret)
134 pr_warning("da830_evm_init: watchdog registration failed: %d\n",
135 ret);
136
137 davinci_serial_init(&da850_evm_uart_config);
138
139 /*
140 * shut down uart 0 and 1; they are not used on the board and
141 * accessing them causes endless "too much work in irq53" messages
142 * with arago fs
143 */
144 __raw_writel(0, IO_ADDRESS(DA8XX_UART1_BASE) + 0x30);
145 __raw_writel(0, IO_ADDRESS(DA8XX_UART0_BASE) + 0x30);
Chaithrika U S491214e2009-08-11 17:03:25 -0400146
147 ret = da8xx_pinmux_setup(da850_mcasp_pins);
148 if (ret)
149 pr_warning("da850_evm_init: mcasp mux setup failed: %d\n",
150 ret);
151
152 da8xx_init_mcasp(0, &da850_evm_snd_data);
Sudhakar Rajashekhara5cbdf272009-08-13 14:33:14 -0400153
154 ret = da8xx_pinmux_setup(da850_lcdcntl_pins);
155 if (ret)
156 pr_warning("da850_evm_init: lcdcntl mux setup failed: %d\n",
157 ret);
158
159 ret = da850_lcd_hw_init();
160 if (ret)
161 pr_warning("da850_evm_init: lcd initialization failed: %d\n",
162 ret);
163
164 ret = da8xx_register_lcdc();
165 if (ret)
166 pr_warning("da850_evm_init: lcdc registration failed: %d\n",
167 ret);
Sudhakar Rajashekhara0fbc5592009-07-16 06:42:18 -0400168}
169
170#ifdef CONFIG_SERIAL_8250_CONSOLE
171static int __init da850_evm_console_init(void)
172{
173 return add_preferred_console("ttyS", 2, "115200");
174}
175console_initcall(da850_evm_console_init);
176#endif
177
178static __init void da850_evm_irq_init(void)
179{
180 struct davinci_soc_info *soc_info = &davinci_soc_info;
181
182 cp_intc_init((void __iomem *)DA8XX_CP_INTC_VIRT, DA850_N_CP_INTC_IRQ,
183 soc_info->intc_irq_prios);
184}
185
186static void __init da850_evm_map_io(void)
187{
188 da850_init();
189}
190
191MACHINE_START(DAVINCI_DA850_EVM, "DaVinci DA850/OMAP-L138 EVM")
192 .phys_io = IO_PHYS,
193 .io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc,
194 .boot_params = (DA8XX_DDR_BASE + 0x100),
195 .map_io = da850_evm_map_io,
196 .init_irq = da850_evm_irq_init,
197 .timer = &davinci_timer,
198 .init_machine = da850_evm_init,
199MACHINE_END