[PATCH] IB: Update FMR functions
[linux-2.6] / arch / arm / mach-omap1 / board-osk.c
1 /*
2  * linux/arch/arm/mach-omap1/board-osk.c
3  *
4  * Board specific init for OMAP5912 OSK
5  *
6  * Written by Dirk Behme <dirk.behme@de.bosch.com>
7  *
8  * This program is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
14  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
15  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
16  * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
19  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23  *
24  * You should have received a copy of the  GNU General Public License along
25  * with this program; if not, write  to the Free Software Foundation, Inc.,
26  * 675 Mass Ave, Cambridge, MA 02139, USA.
27  */
28
29 #include <linux/kernel.h>
30 #include <linux/init.h>
31 #include <linux/device.h>
32
33 #include <asm/hardware.h>
34 #include <asm/mach-types.h>
35 #include <asm/mach/arch.h>
36 #include <asm/mach/map.h>
37
38 #include <asm/arch/gpio.h>
39 #include <asm/arch/usb.h>
40 #include <asm/arch/mux.h>
41 #include <asm/arch/tc.h>
42 #include <asm/arch/common.h>
43
44 static struct map_desc osk5912_io_desc[] __initdata = {
45 { OMAP_OSK_NOR_FLASH_BASE, OMAP_OSK_NOR_FLASH_START, OMAP_OSK_NOR_FLASH_SIZE,
46         MT_DEVICE },
47 };
48
49 static int __initdata osk_serial_ports[OMAP_MAX_NR_PORTS] = {1, 0, 0};
50
51 static struct resource osk5912_smc91x_resources[] = {
52         [0] = {
53                 .start  = OMAP_OSK_ETHR_START,          /* Physical */
54                 .end    = OMAP_OSK_ETHR_START + 0xf,
55                 .flags  = IORESOURCE_MEM,
56         },
57         [1] = {
58                 .start  = OMAP_GPIO_IRQ(0),
59                 .end    = OMAP_GPIO_IRQ(0),
60                 .flags  = IORESOURCE_IRQ,
61         },
62 };
63
64 static struct platform_device osk5912_smc91x_device = {
65         .name           = "smc91x",
66         .id             = -1,
67         .num_resources  = ARRAY_SIZE(osk5912_smc91x_resources),
68         .resource       = osk5912_smc91x_resources,
69 };
70
71 static struct resource osk5912_cf_resources[] = {
72         [0] = {
73                 .start  = OMAP_GPIO_IRQ(62),
74                 .end    = OMAP_GPIO_IRQ(62),
75                 .flags  = IORESOURCE_IRQ,
76         },
77 };
78
79 static struct platform_device osk5912_cf_device = {
80         .name           = "omap_cf",
81         .id             = -1,
82         .dev = {
83                 .platform_data  = (void *) 2 /* CS2 */,
84         },
85         .num_resources  = ARRAY_SIZE(osk5912_cf_resources),
86         .resource       = osk5912_cf_resources,
87 };
88
89 static struct platform_device *osk5912_devices[] __initdata = {
90         &osk5912_smc91x_device,
91         &osk5912_cf_device,
92 };
93
94 static void __init osk_init_smc91x(void)
95 {
96         if ((omap_request_gpio(0)) < 0) {
97                 printk("Error requesting gpio 0 for smc91x irq\n");
98                 return;
99         }
100         omap_set_gpio_edge_ctrl(0, OMAP_GPIO_RISING_EDGE);
101
102         /* Check EMIFS wait states to fix errors with SMC_GET_PKT_HDR */
103         EMIFS_CCS(1) |= 0x2;
104 }
105
106 static void __init osk_init_cf(void)
107 {
108         omap_cfg_reg(M7_1610_GPIO62);
109         if ((omap_request_gpio(62)) < 0) {
110                 printk("Error requesting gpio 62 for CF irq\n");
111                 return;
112         }
113         /* it's really active-low */
114         omap_set_gpio_edge_ctrl(62, OMAP_GPIO_FALLING_EDGE);
115 }
116
117 void osk_init_irq(void)
118 {
119         omap_init_irq();
120         omap_gpio_init();
121         osk_init_smc91x();
122         osk_init_cf();
123 }
124
125 static struct omap_usb_config osk_usb_config __initdata = {
126         /* has usb host connector (A) ... for development it can also
127          * be used, with a NONSTANDARD gender-bending cable/dongle, as
128          * a peripheral.
129          */
130 #ifdef  CONFIG_USB_GADGET_OMAP
131         .register_dev   = 1,
132         .hmc_mode       = 0,
133 #else
134         .register_host  = 1,
135         .hmc_mode       = 16,
136         .rwc            = 1,
137 #endif
138         .pins[0]        = 2,
139 };
140
141 static struct omap_board_config_kernel osk_config[] = {
142         { OMAP_TAG_USB,           &osk_usb_config },
143 };
144
145 static void __init osk_init(void)
146 {
147         platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices));
148         omap_board_config = osk_config;
149         omap_board_config_size = ARRAY_SIZE(osk_config);
150         USB_TRANSCEIVER_CTRL_REG |= (3 << 1);
151 }
152
153 static void __init osk_map_io(void)
154 {
155         omap_map_common_io();
156         iotable_init(osk5912_io_desc, ARRAY_SIZE(osk5912_io_desc));
157         omap_serial_init(osk_serial_ports);
158 }
159
160 MACHINE_START(OMAP_OSK, "TI-OSK")
161         /* Maintainer: Dirk Behme <dirk.behme@de.bosch.com> */
162         .phys_ram       = 0x10000000,
163         .phys_io        = 0xfff00000,
164         .io_pg_offst    = ((0xfef00000) >> 18) & 0xfffc,
165         .boot_params    = 0x10000100,
166         .map_io         = osk_map_io,
167         .init_irq       = osk_init_irq,
168         .init_machine   = osk_init,
169         .timer          = &omap_timer,
170 MACHINE_END