vserver 1.9.5.x5
[linux-2.6.git] / arch / arm / mach-omap / board-osk.c
1 /*
2  * linux/arch/arm/mach-omap/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/clocks.h>
39 #include <asm/arch/gpio.h>
40 #include <asm/arch/fpga.h>
41 #include <asm/arch/usb.h>
42
43 #include "common.h"
44
45 static struct map_desc osk5912_io_desc[] __initdata = {
46 { OMAP_OSK_NOR_FLASH_BASE, OMAP_OSK_NOR_FLASH_START, OMAP_OSK_NOR_FLASH_SIZE,
47         MT_DEVICE },
48 };
49
50 static int __initdata osk_serial_ports[OMAP_MAX_NR_PORTS] = {1, 0, 0};
51
52 static struct resource osk5912_smc91x_resources[] = {
53         [0] = {
54                 .start  = OMAP_OSK_ETHR_START,          /* Physical */
55                 .end    = OMAP_OSK_ETHR_START + SZ_4K,
56                 .flags  = IORESOURCE_MEM,
57         },
58         [1] = {
59                 .start  = OMAP_GPIO_IRQ(0),
60                 .end    = OMAP_GPIO_IRQ(0),
61                 .flags  = IORESOURCE_IRQ,
62         },
63 };
64
65 static struct platform_device osk5912_smc91x_device = {
66         .name           = "smc91x",
67         .id             = 0,
68         .num_resources  = ARRAY_SIZE(osk5912_smc91x_resources),
69         .resource       = osk5912_smc91x_resources,
70 };
71
72 static struct platform_device *osk5912_devices[] __initdata = {
73         &osk5912_smc91x_device,
74 };
75
76 static void __init osk_init_smc91x(void)
77 {
78         if ((omap_request_gpio(0)) < 0) {
79                 printk("Error requesting gpio 0 for smc91x irq\n");
80                 return;
81         }
82         omap_set_gpio_edge_ctrl(0, OMAP_GPIO_RISING_EDGE);
83 }
84
85 void osk_init_irq(void)
86 {
87         omap_init_irq();
88         omap_gpio_init();
89         osk_init_smc91x();
90 }
91
92 static struct omap_usb_config osk_usb_config __initdata = {
93         /* has usb host and device, but no Mini-AB port */
94         .register_host  = 1,
95         .hmc_mode       = 16,
96         .pins[0]        = 2,
97 };
98
99 static struct omap_board_config_kernel osk_config[] = {
100         { OMAP_TAG_USB,           &osk_usb_config },
101 };
102
103 static void __init osk_init(void)
104 {
105         platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices));
106         omap_board_config = osk_config;
107         omap_board_config_size = ARRAY_SIZE(osk_config);
108 }
109
110 static void __init osk_map_io(void)
111 {
112         omap_map_io();
113         iotable_init(osk5912_io_desc, ARRAY_SIZE(osk5912_io_desc));
114         omap_serial_init(osk_serial_ports);
115 }
116
117 MACHINE_START(OMAP_OSK, "TI-OSK")
118         MAINTAINER("Dirk Behme <dirk.behme@de.bosch.com>")
119         BOOT_MEM(0x10000000, 0xfff00000, 0xfef00000)
120         BOOT_PARAMS(0x10000100)
121         MAPIO(osk_map_io)
122         INITIRQ(osk_init_irq)
123         INIT_MACHINE(osk_init)
124         .timer          = &omap_timer,
125 MACHINE_END