Merge master.kernel.org:/home/rmk/linux-2.6-serial
[linux-2.6] / arch / arm / mach-omap1 / board-h3.c
1 /*
2  * linux/arch/arm/mach-omap1/board-h3.c
3  *
4  * This file contains OMAP1710 H3 specific code.
5  *
6  * Copyright (C) 2004 Texas Instruments, Inc.
7  * Copyright (C) 2002 MontaVista Software, Inc.
8  * Copyright (C) 2001 RidgeRun, Inc.
9  * Author: RidgeRun, Inc.
10  *         Greg Lonnon (glonnon@ridgerun.com) or info@ridgerun.com
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License version 2 as
14  * published by the Free Software Foundation.
15  */
16
17 #include <linux/config.h>
18 #include <linux/types.h>
19 #include <linux/init.h>
20 #include <linux/major.h>
21 #include <linux/kernel.h>
22 #include <linux/platform_device.h>
23 #include <linux/errno.h>
24 #include <linux/mtd/mtd.h>
25 #include <linux/mtd/partitions.h>
26
27 #include <asm/setup.h>
28 #include <asm/page.h>
29 #include <asm/hardware.h>
30 #include <asm/mach-types.h>
31 #include <asm/mach/arch.h>
32 #include <asm/mach/flash.h>
33 #include <asm/mach/map.h>
34
35 #include <asm/arch/gpio.h>
36 #include <asm/arch/irqs.h>
37 #include <asm/arch/mux.h>
38 #include <asm/arch/tc.h>
39 #include <asm/arch/usb.h>
40 #include <asm/arch/common.h>
41
42 extern int omap_gpio_init(void);
43
44 static int __initdata h3_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1};
45
46 static struct mtd_partition h3_partitions[] = {
47         /* bootloader (U-Boot, etc) in first sector */
48         {
49               .name             = "bootloader",
50               .offset           = 0,
51               .size             = SZ_128K,
52               .mask_flags       = MTD_WRITEABLE, /* force read-only */
53         },
54         /* bootloader params in the next sector */
55         {
56               .name             = "params",
57               .offset           = MTDPART_OFS_APPEND,
58               .size             = SZ_128K,
59               .mask_flags       = 0,
60         },
61         /* kernel */
62         {
63               .name             = "kernel",
64               .offset           = MTDPART_OFS_APPEND,
65               .size             = SZ_2M,
66               .mask_flags       = 0
67         },
68         /* file system */
69         {
70               .name             = "filesystem",
71               .offset           = MTDPART_OFS_APPEND,
72               .size             = MTDPART_SIZ_FULL,
73               .mask_flags       = 0
74         }
75 };
76
77 static struct flash_platform_data h3_flash_data = {
78         .map_name       = "cfi_probe",
79         .width          = 2,
80         .parts          = h3_partitions,
81         .nr_parts       = ARRAY_SIZE(h3_partitions),
82 };
83
84 static struct resource h3_flash_resource = {
85         /* This is on CS3, wherever it's mapped */
86         .flags          = IORESOURCE_MEM,
87 };
88
89 static struct platform_device flash_device = {
90         .name           = "omapflash",
91         .id             = 0,
92         .dev            = {
93                 .platform_data  = &h3_flash_data,
94         },
95         .num_resources  = 1,
96         .resource       = &h3_flash_resource,
97 };
98
99 static struct resource smc91x_resources[] = {
100         [0] = {
101                 .start  = OMAP1710_ETHR_START,          /* Physical */
102                 .end    = OMAP1710_ETHR_START + 0xf,
103                 .flags  = IORESOURCE_MEM,
104         },
105         [1] = {
106                 .start  = OMAP_GPIO_IRQ(40),
107                 .end    = OMAP_GPIO_IRQ(40),
108                 .flags  = IORESOURCE_IRQ,
109         },
110 };
111
112 static struct platform_device smc91x_device = {
113         .name           = "smc91x",
114         .id             = 0,
115         .num_resources  = ARRAY_SIZE(smc91x_resources),
116         .resource       = smc91x_resources,
117 };
118
119 #define GPTIMER_BASE            0xFFFB1400
120 #define GPTIMER_REGS(x) (0xFFFB1400 + (x * 0x800))
121 #define GPTIMER_REGS_SIZE       0x46
122
123 static struct resource intlat_resources[] = {
124         [0] = {
125                 .start  = GPTIMER_REGS(0),            /* Physical */
126                 .end    = GPTIMER_REGS(0) + GPTIMER_REGS_SIZE,
127                 .flags  = IORESOURCE_MEM,
128         },
129         [1] = {
130                 .start  = INT_1610_GPTIMER1,
131                 .end    = INT_1610_GPTIMER1,
132                 .flags  = IORESOURCE_IRQ,
133         },
134 };
135
136 static struct platform_device intlat_device = {
137         .name      = "omap_intlat",
138         .id          = 0,
139         .num_resources  = ARRAY_SIZE(intlat_resources),
140         .resource       = intlat_resources,
141 };
142
143 static struct platform_device *devices[] __initdata = {
144         &flash_device,
145         &smc91x_device,
146         &intlat_device,
147 };
148
149 static struct omap_usb_config h3_usb_config __initdata = {
150         /* usb1 has a Mini-AB port and external isp1301 transceiver */
151         .otg        = 2,
152
153 #ifdef CONFIG_USB_GADGET_OMAP
154         .hmc_mode       = 19,   /* 0:host(off) 1:dev|otg 2:disabled */
155 #elif  defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
156         /* NONSTANDARD CABLE NEEDED (B-to-Mini-B) */
157         .hmc_mode       = 20,   /* 1:dev|otg(off) 1:host 2:disabled */
158 #endif
159
160         .pins[1]        = 3,
161 };
162
163 static struct omap_mmc_config h3_mmc_config __initdata = {
164         .mmc[0] = {
165                 .enabled        = 1,
166                 .power_pin      = -1,   /* tps65010 GPIO4 */
167                 .switch_pin     = OMAP_MPUIO(1),
168         },
169 };
170
171 static struct omap_board_config_kernel h3_config[] = {
172         { OMAP_TAG_USB,  &h3_usb_config },
173         { OMAP_TAG_MMC,  &h3_mmc_config },
174 };
175
176 static void __init h3_init(void)
177 {
178         h3_flash_resource.end = h3_flash_resource.start = omap_cs3_phys();
179         h3_flash_resource.end += OMAP_CS3_SIZE - 1;
180         (void) platform_add_devices(devices, ARRAY_SIZE(devices));
181         omap_board_config = h3_config;
182         omap_board_config_size = ARRAY_SIZE(h3_config);
183 }
184
185 static void __init h3_init_smc91x(void)
186 {
187         omap_cfg_reg(W15_1710_GPIO40);
188         if (omap_request_gpio(40) < 0) {
189                 printk("Error requesting gpio 40 for smc91x irq\n");
190                 return;
191         }
192 }
193
194 void h3_init_irq(void)
195 {
196         omap_init_irq();
197         omap_gpio_init();
198         h3_init_smc91x();
199 }
200
201 static void __init h3_map_io(void)
202 {
203         omap_map_common_io();
204         omap_serial_init(h3_serial_ports);
205 }
206
207 MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board")
208         /* Maintainer: Texas Instruments, Inc. */
209         .phys_ram       = 0x10000000,
210         .phys_io        = 0xfff00000,
211         .io_pg_offst    = ((0xfef00000) >> 18) & 0xfffc,
212         .boot_params    = 0x10000100,
213         .map_io         = h3_map_io,
214         .init_irq       = h3_init_irq,
215         .init_machine   = h3_init,
216         .timer          = &omap_timer,
217 MACHINE_END