]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-omap2/board-omap2evm.c
9bb8fbaf824aa9ebf6c26d9e9b71beba4e6a9bde
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / board-omap2evm.c
1 /*
2  * linux/arch/arm/mach-omap2/board-omap2evm.c
3  *
4  * Copyright (C) 2008 Mistral Solutions Pvt Ltd
5  *
6  * Modified from mach-omap2/board-generic.c
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11  */
12
13 #include <linux/kernel.h>
14 #include <linux/init.h>
15 #include <linux/platform_device.h>
16 #include <linux/delay.h>
17 #include <linux/err.h>
18 #include <linux/clk.h>
19 #include <linux/io.h>
20 #include <linux/input.h>
21
22 #include <mach/hardware.h>
23 #include <asm/mach-types.h>
24 #include <asm/mach/arch.h>
25 #include <asm/mach/map.h>
26
27 #include <mach/gpio.h>
28 #include <mach/board.h>
29 #include <mach/common.h>
30 #include <mach/hsmmc.h>
31 #include <mach/keypad.h>
32
33 static struct resource omap2evm_smc911x_resources[] = {
34         [0] =   {
35                 .start  = OMAP2EVM_ETHR_START,
36                 .end    = (OMAP2EVM_ETHR_START + OMAP2EVM_ETHR_SIZE - 1),
37                 .flags  = IORESOURCE_MEM,
38         },
39         [1] =   {
40                 .start  = OMAP_GPIO_IRQ(OMAP2EVM_ETHR_GPIO_IRQ),
41                 .end    = OMAP_GPIO_IRQ(OMAP2EVM_ETHR_GPIO_IRQ),
42                 .flags  = IORESOURCE_IRQ,
43         },
44 };
45
46 static struct platform_device omap2evm_smc911x_device = {
47         .name       = "smc911x",
48         .id     = -1,
49         .num_resources  = ARRAY_SIZE(omap2evm_smc911x_resources),
50         .resource   = &omap2evm_smc911x_resources [0],
51 };
52
53 static inline void __init omap2evm_init_smc911x(void)
54 {
55         int gpio = OMAP2EVM_ETHR_GPIO_IRQ;
56         int ret;
57
58         ret = gpio_request(gpio, "smc911x IRQ");
59         if (ret < 0) {
60                 printk(KERN_ERR "Failed to request GPIO %d for smc911x IRQ\n",
61                                 gpio);
62                 return;
63         }
64         gpio_direction_input(gpio);
65
66 }
67
68 static struct platform_device omap2_evm_lcd_device = {
69         .name           = "omap2evm_lcd",
70         .id             = -1,
71 };
72
73 static struct omap_lcd_config omap2_evm_lcd_config __initdata = {
74         .ctrl_name      = "internal",
75 };
76
77 static int omap2evm_keymap[] = {
78         KEY(0, 0, KEY_LEFT),
79         KEY(0, 1, KEY_RIGHT),
80         KEY(0, 2, KEY_A),
81         KEY(0, 3, KEY_B),
82         KEY(1, 0, KEY_DOWN),
83         KEY(1, 1, KEY_UP),
84         KEY(1, 2, KEY_E),
85         KEY(1, 3, KEY_F),
86         KEY(2, 0, KEY_ENTER),
87         KEY(2, 1, KEY_I),
88         KEY(2, 2, KEY_J),
89         KEY(2, 3, KEY_K),
90         KEY(3, 0, KEY_M),
91         KEY(3, 1, KEY_N),
92         KEY(3, 2, KEY_O),
93         KEY(3, 3, KEY_P)
94 };
95
96 static struct omap_kp_platform_data omap2evm_kp_data = {
97         .rows           = 4,
98         .cols           = 4,
99         .keymap         = omap2evm_keymap,
100         .keymapsize     = ARRAY_SIZE(omap2evm_keymap),
101         .rep            = 1,
102 };
103
104 static struct platform_device omap2evm_kp_device = {
105         .name           = "omap_twl4030keypad",
106         .id             = -1,
107         .dev            = {
108                                 .platform_data = &omap2evm_kp_data,
109                         },
110 };
111
112 static void __init omap2_evm_init_irq(void)
113 {
114         omap2_init_common_hw(NULL);
115         omap_init_irq();
116         omap_gpio_init();
117         omap2evm_init_smc911x();
118 }
119
120 static struct omap_uart_config omap2_evm_uart_config __initdata = {
121         .enabled_uarts  = ((1 << 0) | (1 << 1) | (1 << 2)),
122 };
123
124 static struct omap_mmc_config omap2_evm_mmc_config __initdata = {
125         .mmc [0] = {
126                 .enabled        = 1,
127                 .wire4          = 1,
128         },
129 };
130
131 static struct omap_board_config_kernel omap2_evm_config[] __initdata = {
132         { OMAP_TAG_UART,        &omap2_evm_uart_config },
133         { OMAP_TAG_LCD,         &omap2_evm_lcd_config },
134         { OMAP_TAG_MMC,         &omap2_evm_mmc_config },
135 };
136
137 static int __init omap2_evm_i2c_init(void)
138 {
139         /*
140          * Registering bus 2 first to avoid twl4030 misbehaving as OMAP2EVM
141          * has twl4030 on bus 2
142          */
143         omap_register_i2c_bus(2, 2600, NULL, 0);
144         omap_register_i2c_bus(1, 400, NULL, 0);
145         return 0;
146 }
147
148 static struct platform_device *omap2_evm_devices[] __initdata = {
149         &omap2_evm_lcd_device,
150         &omap2evm_smc911x_device,
151         &omap2evm_kp_device,
152 };
153
154 static void __init omap2_evm_init(void)
155 {
156         platform_add_devices(omap2_evm_devices, ARRAY_SIZE(omap2_evm_devices));
157         omap_board_config = omap2_evm_config;
158         omap_board_config_size = ARRAY_SIZE(omap2_evm_config);
159         omap_serial_init();
160         hsmmc_init();
161 }
162
163 static void __init omap2_evm_map_io(void)
164 {
165         omap2_set_globals_243x();
166         omap2_map_common_io();
167 }
168
169 arch_initcall(omap2_evm_i2c_init);
170
171 MACHINE_START(OMAP2EVM, "OMAP2EVM Board")
172         /* Maintainer:  Arun KS <arunks@mistralsolutions.com> */
173         .phys_io        = 0x48000000,
174         .io_pg_offst    = ((0xd8000000) >> 18) & 0xfffc,
175         .boot_params    = 0x80000100,
176         .map_io         = omap2_evm_map_io,
177         .init_irq       = omap2_evm_init_irq,
178         .init_machine   = omap2_evm_init,
179         .timer          = &omap_timer,
180 MACHINE_END