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>
22 #include <linux/input.h>
23 #include <linux/spi/spi.h>
24 #include <linux/spi/ads7846.h>
26 #include <asm/hardware.h>
27 #include <asm/mach-types.h>
28 #include <asm/mach/arch.h>
29 #include <asm/mach/map.h>
31 #include <asm/arch/gpio.h>
32 #include <asm/arch/keypad.h>
33 #include <asm/arch/board.h>
34 #include <asm/arch/hsmmc.h>
35 #include <asm/arch/usb-musb.h>
36 #include <asm/arch/usb-ehci.h>
37 #include <asm/arch/common.h>
38 #include <asm/arch/mcspi.h>
40 static struct resource omap3evm_smc911x_resources[] = {
42 .start = OMAP3EVM_ETHR_START,
43 .end = (OMAP3EVM_ETHR_START + OMAP3EVM_ETHR_SIZE - 1),
44 .flags = IORESOURCE_MEM,
47 .start = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ),
48 .end = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ),
49 .flags = IORESOURCE_IRQ,
53 static struct platform_device omap3evm_smc911x_device = {
56 .num_resources = ARRAY_SIZE(omap3evm_smc911x_resources),
57 .resource = &omap3evm_smc911x_resources [0],
60 static inline void __init omap3evm_init_smc911x(void)
66 eth_cs = OMAP3EVM_SMC911X_CS;
68 l3ck = clk_get(NULL, "l3_ck");
72 rate = clk_get_rate(l3ck);
74 if (omap_request_gpio(OMAP3EVM_ETHR_GPIO_IRQ) < 0) {
75 printk(KERN_ERR "Failed to request GPIO%d for smc911x IRQ\n",
76 OMAP3EVM_ETHR_GPIO_IRQ);
80 omap_set_gpio_direction(OMAP3EVM_ETHR_GPIO_IRQ, 1);
83 static struct omap_uart_config omap3_evm_uart_config __initdata = {
84 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
87 static int __init omap3_evm_i2c_init(void)
89 omap_register_i2c_bus(1, 2600, NULL, 0);
90 omap_register_i2c_bus(2, 400, NULL, 0);
91 omap_register_i2c_bus(3, 400, NULL, 0);
95 static struct omap_mmc_config omap3_evm_mmc_config __initdata = {
102 static struct platform_device omap3_evm_lcd_device = {
103 .name = "omap3evm_lcd",
107 static struct omap_lcd_config omap3_evm_lcd_config __initdata = {
108 .ctrl_name = "internal",
111 static struct platform_device omap3_evm_twl4030rtc_device = {
112 .name = "twl4030_rtc",
116 static void ads7846_dev_init(void)
118 if (omap_request_gpio(OMAP3_EVM_TS_GPIO) < 0)
119 printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
121 omap_set_gpio_direction(OMAP3_EVM_TS_GPIO, 1);
123 omap_set_gpio_debounce(OMAP3_EVM_TS_GPIO, 1);
124 omap_set_gpio_debounce_time(OMAP3_EVM_TS_GPIO, 0xa);
127 static int ads7846_get_pendown_state(void)
129 return !omap_get_gpio_datain(OMAP3_EVM_TS_GPIO);
132 struct ads7846_platform_data ads7846_config = {
133 .get_pendown_state = ads7846_get_pendown_state,
137 static struct omap2_mcspi_device_config ads7846_mcspi_config = {
139 .single_channel = 1, /* 0: slave, 1: master */
142 struct spi_board_info omap3evm_spi_board_info[] = {
144 .modalias = "ads7846",
147 .max_speed_hz = 1500000,
148 .controller_data = &ads7846_mcspi_config,
149 .irq = OMAP_GPIO_IRQ(OMAP3_EVM_TS_GPIO),
150 .platform_data = &ads7846_config,
154 static int omap3evm_keymap[] = {
156 KEY(0, 1, KEY_RIGHT),
163 KEY(2, 0, KEY_ENTER),
173 static struct omap_kp_platform_data omap3evm_kp_data = {
176 .keymap = omap3evm_keymap,
177 .keymapsize = ARRAY_SIZE(omap3evm_keymap),
181 static struct platform_device omap3evm_kp_device = {
182 .name = "omap_twl4030keypad",
185 .platform_data = &omap3evm_kp_data,
189 static void __init omap3_evm_init_irq(void)
191 omap2_init_common_hw(NULL);
194 omap3evm_init_smc911x();
197 static struct omap_board_config_kernel omap3_evm_config[] __initdata = {
198 { OMAP_TAG_UART, &omap3_evm_uart_config },
199 { OMAP_TAG_MMC, &omap3_evm_mmc_config },
200 { OMAP_TAG_LCD, &omap3_evm_lcd_config },
203 static struct platform_device *omap3_evm_devices[] __initdata = {
204 &omap3_evm_lcd_device,
206 #ifdef CONFIG_RTC_DRV_TWL4030
207 &omap3_evm_twl4030rtc_device,
209 &omap3evm_smc911x_device,
212 static void __init omap3_evm_init(void)
214 platform_add_devices(omap3_evm_devices, ARRAY_SIZE(omap3_evm_devices));
215 omap_board_config = omap3_evm_config;
216 omap_board_config_size = ARRAY_SIZE(omap3_evm_config);
218 spi_register_board_info(omap3evm_spi_board_info,
219 ARRAY_SIZE(omap3evm_spi_board_info));
225 omap3evm_flash_init();
229 arch_initcall(omap3_evm_i2c_init);
231 static void __init omap3_evm_map_io(void)
233 omap2_set_globals_343x();
234 omap2_map_common_io();
237 MACHINE_START(OMAP3EVM, "OMAP3 EVM")
238 /* Maintainer: Syed Mohammed Khasim - Texas Instruments */
239 .phys_io = 0x48000000,
240 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
241 .boot_params = 0x80000100,
242 .map_io = omap3_evm_map_io,
243 .init_irq = omap3_evm_init_irq,
244 .init_machine = omap3_evm_init,
245 .timer = &omap_timer,