2 * linux/arch/arm/mach-omap2/board-omap3evm.c
4 * Copyright (C) 2008 Texas Instruments
6 * Modified from mach-omap2/board-3430sdp.c
8 * Initial code: Syed Mohammed Khasim
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
15 #include <linux/kernel.h>
16 #include <linux/init.h>
17 #include <linux/platform_device.h>
18 #include <linux/delay.h>
19 #include <linux/err.h>
20 #include <linux/clk.h>
21 #include <linux/input.h>
23 #include <linux/spi/spi.h>
24 #include <linux/spi/ads7846.h>
25 #include <linux/i2c/twl4030.h>
27 #include <mach/hardware.h>
28 #include <asm/mach-types.h>
29 #include <asm/mach/arch.h>
30 #include <asm/mach/map.h>
32 #include <mach/gpio.h>
33 #include <mach/keypad.h>
34 #include <mach/board.h>
36 #include <mach/usb-musb.h>
37 #include <mach/usb-ehci.h>
38 #include <mach/common.h>
39 #include <mach/mcspi.h>
41 #include "sdram-micron-mt46h32m32lf-6.h"
42 #include "twl4030-generic-scripts.h"
43 #include "mmc-twl4030.h"
46 static struct resource omap3evm_smc911x_resources[] = {
48 .start = OMAP3EVM_ETHR_START,
49 .end = (OMAP3EVM_ETHR_START + OMAP3EVM_ETHR_SIZE - 1),
50 .flags = IORESOURCE_MEM,
53 .start = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ),
54 .end = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ),
55 .flags = IORESOURCE_IRQ,
59 static struct platform_device omap3evm_smc911x_device = {
62 .num_resources = ARRAY_SIZE(omap3evm_smc911x_resources),
63 .resource = &omap3evm_smc911x_resources [0],
66 static inline void __init omap3evm_init_smc911x(void)
72 eth_cs = OMAP3EVM_SMC911X_CS;
74 l3ck = clk_get(NULL, "l3_ck");
78 rate = clk_get_rate(l3ck);
80 if (omap_request_gpio(OMAP3EVM_ETHR_GPIO_IRQ) < 0) {
81 printk(KERN_ERR "Failed to request GPIO%d for smc911x IRQ\n",
82 OMAP3EVM_ETHR_GPIO_IRQ);
86 omap_set_gpio_direction(OMAP3EVM_ETHR_GPIO_IRQ, 1);
89 static struct omap_uart_config omap3_evm_uart_config __initdata = {
90 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
93 static struct twl4030_gpio_platform_data omap3evm_gpio_data = {
94 .gpio_base = OMAP_MAX_GPIO_LINES,
95 .irq_base = TWL4030_GPIO_IRQ_BASE,
96 .irq_end = TWL4030_GPIO_IRQ_END,
99 static struct twl4030_usb_data omap3evm_usb_data = {
100 .usb_mode = T2_USB_MODE_ULPI,
103 static int omap3evm_keymap[] = {
105 KEY(0, 1, KEY_RIGHT),
112 KEY(2, 0, KEY_ENTER),
122 static struct twl4030_keypad_data omap3evm_kp_data = {
125 .keymap = omap3evm_keymap,
126 .keymapsize = ARRAY_SIZE(omap3evm_keymap),
128 .irq = TWL4030_MODIRQ_KEYPAD,
131 static struct twl4030_madc_platform_data omap3evm_madc_data = {
135 static struct twl4030_platform_data omap3evm_twldata = {
136 .irq_base = TWL4030_IRQ_BASE,
137 .irq_end = TWL4030_IRQ_END,
139 /* platform_data for children goes here */
140 .keypad = &omap3evm_kp_data,
141 .madc = &omap3evm_madc_data,
142 .usb = &omap3evm_usb_data,
143 .power = &generic3430_t2scripts_data,
144 .gpio = &omap3evm_gpio_data,
147 static struct i2c_board_info __initdata omap3evm_i2c_boardinfo[] = {
149 I2C_BOARD_INFO("twl4030", 0x48),
150 .flags = I2C_CLIENT_WAKE,
151 .irq = INT_34XX_SYS_NIRQ,
152 .platform_data = &omap3evm_twldata,
156 static int __init omap3_evm_i2c_init(void)
158 omap_register_i2c_bus(1, 2600, omap3evm_i2c_boardinfo,
159 ARRAY_SIZE(omap3evm_i2c_boardinfo));
160 omap_register_i2c_bus(2, 400, NULL, 0);
161 omap_register_i2c_bus(3, 400, NULL, 0);
165 static struct platform_device omap3_evm_lcd_device = {
166 .name = "omap3evm_lcd",
170 static struct omap_lcd_config omap3_evm_lcd_config __initdata = {
171 .ctrl_name = "internal",
174 static void ads7846_dev_init(void)
176 if (omap_request_gpio(OMAP3_EVM_TS_GPIO) < 0)
177 printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
179 omap_set_gpio_direction(OMAP3_EVM_TS_GPIO, 1);
181 omap_set_gpio_debounce(OMAP3_EVM_TS_GPIO, 1);
182 omap_set_gpio_debounce_time(OMAP3_EVM_TS_GPIO, 0xa);
185 static int ads7846_get_pendown_state(void)
187 return !omap_get_gpio_datain(OMAP3_EVM_TS_GPIO);
190 struct ads7846_platform_data ads7846_config = {
198 .get_pendown_state = ads7846_get_pendown_state,
200 .settle_delay_usecs = 150,
203 static struct omap2_mcspi_device_config ads7846_mcspi_config = {
205 .single_channel = 1, /* 0: slave, 1: master */
208 struct spi_board_info omap3evm_spi_board_info[] = {
210 .modalias = "ads7846",
213 .max_speed_hz = 1500000,
214 .controller_data = &ads7846_mcspi_config,
215 .irq = OMAP_GPIO_IRQ(OMAP3_EVM_TS_GPIO),
216 .platform_data = &ads7846_config,
220 static void __init omap3_evm_init_irq(void)
222 omap2_init_common_hw(mt46h32m32lf6_sdrc_params);
225 omap3evm_init_smc911x();
228 static struct omap_board_config_kernel omap3_evm_config[] __initdata = {
229 { OMAP_TAG_UART, &omap3_evm_uart_config },
230 { OMAP_TAG_LCD, &omap3_evm_lcd_config },
233 static struct platform_device *omap3_evm_devices[] __initdata = {
234 &omap3_evm_lcd_device,
235 &omap3evm_smc911x_device,
238 static struct twl4030_hsmmc_info mmc[] __initdata = {
247 static void __init omap3_evm_init(void)
249 omap3_evm_i2c_init();
251 platform_add_devices(omap3_evm_devices, ARRAY_SIZE(omap3_evm_devices));
252 omap_board_config = omap3_evm_config;
253 omap_board_config_size = ARRAY_SIZE(omap3_evm_config);
255 spi_register_board_info(omap3evm_spi_board_info,
256 ARRAY_SIZE(omap3evm_spi_board_info));
262 omap3evm_flash_init();
266 static void __init omap3_evm_map_io(void)
268 omap2_set_globals_343x();
269 omap2_map_common_io();
272 MACHINE_START(OMAP3EVM, "OMAP3 EVM")
273 /* Maintainer: Syed Mohammed Khasim - Texas Instruments */
274 .phys_io = 0x48000000,
275 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
276 .boot_params = 0x80000100,
277 .map_io = omap3_evm_map_io,
278 .init_irq = omap3_evm_init_irq,
279 .init_machine = omap3_evm_init,
280 .timer = &omap_timer,