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