]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-omap2/board-omap2evm.c
OMAP2EVM: Adding hsmmc support
[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
21 #include <asm/hardware.h>
22 #include <asm/mach-types.h>
23 #include <asm/mach/arch.h>
24 #include <asm/mach/map.h>
25
26 #include <asm/arch/gpio.h>
27 #include <asm/arch/board.h>
28 #include <asm/arch/common.h>
29 #include <asm/arch/hsmmc.h>
30
31 static struct resource omap2evm_smc911x_resources[] = {
32         [0] =   {
33                 .start  = OMAP2EVM_ETHR_START,
34                 .end    = (OMAP2EVM_ETHR_START + OMAP2EVM_ETHR_SIZE - 1),
35                 .flags  = IORESOURCE_MEM,
36         },
37         [1] =   {
38                 .start  = OMAP_GPIO_IRQ(OMAP2EVM_ETHR_GPIO_IRQ),
39                 .end    = OMAP_GPIO_IRQ(OMAP2EVM_ETHR_GPIO_IRQ),
40                 .flags  = IORESOURCE_IRQ,
41         },
42 };
43
44 static struct platform_device omap2evm_smc911x_device = {
45         .name       = "smc911x",
46         .id     = -1,
47         .num_resources  = ARRAY_SIZE(omap2evm_smc911x_resources),
48         .resource   = &omap2evm_smc911x_resources [0],
49 };
50
51 static inline void __init omap2evm_init_smc911x(void)
52 {
53         int gpio = OMAP2EVM_ETHR_GPIO_IRQ;
54         int ret;
55
56         ret = gpio_request(gpio, "smc911x IRQ");
57         if (ret < 0) {
58                 printk(KERN_ERR "Failed to request GPIO %d for smc911x IRQ\n",
59                                 gpio);
60                 return;
61         }
62         gpio_direction_input(gpio);
63
64 }
65
66 static struct platform_device omap2_evm_lcd_device = {
67         .name           = "omap2evm_lcd",
68         .id             = -1,
69 };
70
71 static struct omap_lcd_config omap2_evm_lcd_config __initdata = {
72         .ctrl_name      = "internal",
73 };
74
75 static void __init omap2_evm_init_irq(void)
76 {
77         omap2_init_common_hw(NULL);
78         omap_init_irq();
79         omap_gpio_init();
80         omap2evm_init_smc911x();
81 }
82
83 static struct omap_uart_config omap2_evm_uart_config __initdata = {
84         .enabled_uarts  = ((1 << 0) | (1 << 1) | (1 << 2)),
85 };
86
87 static struct omap_mmc_config omap2_evm_mmc_config __initdata = {
88         .mmc [0] = {
89                 .enabled        = 1,
90                 .wire4          = 1,
91         },
92 };
93
94 static struct omap_board_config_kernel omap2_evm_config[] __initdata = {
95         { OMAP_TAG_UART,        &omap2_evm_uart_config },
96         { OMAP_TAG_LCD,         &omap2_evm_lcd_config },
97         { OMAP_TAG_MMC,         &omap2_evm_mmc_config },
98 };
99
100 static int __init omap2_evm_i2c_init(void)
101 {
102         /*
103          * Registering bus 2 first to avoid twl4030 misbehaving as OMAP2EVM
104          * has twl4030 on bus 2
105          */
106         omap_register_i2c_bus(2, 2600, NULL, 0);
107         omap_register_i2c_bus(1, 400, NULL, 0);
108         return 0;
109 }
110
111 static struct platform_device *omap2_evm_devices[] __initdata = {
112         &omap2_evm_lcd_device,
113         &omap2evm_smc911x_device,
114 };
115
116 static void __init omap2_evm_init(void)
117 {
118         platform_add_devices(omap2_evm_devices, ARRAY_SIZE(omap2_evm_devices));
119         omap_board_config = omap2_evm_config;
120         omap_board_config_size = ARRAY_SIZE(omap2_evm_config);
121         omap_serial_init();
122         hsmmc_init();
123 }
124
125 static void __init omap2_evm_map_io(void)
126 {
127         omap2_set_globals_243x();
128         omap2_map_common_io();
129 }
130
131 arch_initcall(omap2_evm_i2c_init);
132
133 MACHINE_START(OMAP2EVM, "OMAP2EVM Board")
134         /* Maintainer:  Arun KS <arunks@mistralsolutions.com> */
135         .phys_io        = 0x48000000,
136         .io_pg_offst    = ((0xd8000000) >> 18) & 0xfffc,
137         .boot_params    = 0x80000100,
138         .map_io         = omap2_evm_map_io,
139         .init_irq       = omap2_evm_init_irq,
140         .init_machine   = omap2_evm_init,
141         .timer          = &omap_timer,
142 MACHINE_END