aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/board-h4.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/board-h4.c')
-rw-r--r--arch/arm/mach-omap2/board-h4.c135
1 files changed, 38 insertions, 97 deletions
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index 5e9b14675b1e..e7d017cdc438 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -33,10 +33,8 @@
33 33
34#include <mach/control.h> 34#include <mach/control.h>
35#include <mach/gpio.h> 35#include <mach/gpio.h>
36#include <mach/gpioexpander.h>
37#include <mach/mux.h> 36#include <mach/mux.h>
38#include <mach/usb.h> 37#include <mach/usb.h>
39#include <mach/irda.h>
40#include <mach/board.h> 38#include <mach/board.h>
41#include <mach/common.h> 39#include <mach/common.h>
42#include <mach/keypad.h> 40#include <mach/keypad.h>
@@ -47,6 +45,8 @@
47#define H4_FLASH_CS 0 45#define H4_FLASH_CS 0
48#define H4_SMC91X_CS 1 46#define H4_SMC91X_CS 1
49 47
48#define H4_ETHR_GPIO_IRQ 92
49
50static unsigned int row_gpios[6] = { 88, 89, 124, 11, 6, 96 }; 50static unsigned int row_gpios[6] = { 88, 89, 124, 11, 6, 96 };
51static unsigned int col_gpios[7] = { 90, 91, 100, 36, 12, 97, 98 }; 51static unsigned int col_gpios[7] = { 90, 91, 100, 36, 12, 97, 98 };
52 52
@@ -136,98 +136,6 @@ static struct platform_device h4_flash_device = {
136 .resource = &h4_flash_resource, 136 .resource = &h4_flash_resource,
137}; 137};
138 138
139/* Select between the IrDA and aGPS module
140 */
141static int h4_select_irda(struct device *dev, int state)
142{
143 unsigned char expa;
144 int err = 0;
145
146 if ((err = read_gpio_expa(&expa, 0x21))) {
147 printk(KERN_ERR "Error reading from I/O expander\n");
148 return err;
149 }
150
151 /* 'P6' enable/disable IRDA_TX and IRDA_RX */
152 if (state & IR_SEL) { /* IrDa */
153 if ((err = write_gpio_expa(expa | 0x01, 0x21))) {
154 printk(KERN_ERR "Error writing to I/O expander\n");
155 return err;
156 }
157 } else {
158 if ((err = write_gpio_expa(expa & ~0x01, 0x21))) {
159 printk(KERN_ERR "Error writing to I/O expander\n");
160 return err;
161 }
162 }
163 return err;
164}
165
166static void set_trans_mode(struct work_struct *work)
167{
168 struct omap_irda_config *irda_config =
169 container_of(work, struct omap_irda_config, gpio_expa.work);
170 int mode = irda_config->mode;
171 unsigned char expa;
172 int err = 0;
173
174 if ((err = read_gpio_expa(&expa, 0x20)) != 0) {
175 printk(KERN_ERR "Error reading from I/O expander\n");
176 }
177
178 expa &= ~0x01;
179
180 if (!(mode & IR_SIRMODE)) { /* MIR/FIR */
181 expa |= 0x01;
182 }
183
184 if ((err = write_gpio_expa(expa, 0x20)) != 0) {
185 printk(KERN_ERR "Error writing to I/O expander\n");
186 }
187}
188
189static int h4_transceiver_mode(struct device *dev, int mode)
190{
191 struct omap_irda_config *irda_config = dev->platform_data;
192
193 irda_config->mode = mode;
194 cancel_delayed_work(&irda_config->gpio_expa);
195 PREPARE_DELAYED_WORK(&irda_config->gpio_expa, set_trans_mode);
196 schedule_delayed_work(&irda_config->gpio_expa, 0);
197
198 return 0;
199}
200
201static struct omap_irda_config h4_irda_data = {
202 .transceiver_cap = IR_SIRMODE | IR_MIRMODE | IR_FIRMODE,
203 .transceiver_mode = h4_transceiver_mode,
204 .select_irda = h4_select_irda,
205 .rx_channel = OMAP24XX_DMA_UART3_RX,
206 .tx_channel = OMAP24XX_DMA_UART3_TX,
207 .dest_start = OMAP_UART3_BASE,
208 .src_start = OMAP_UART3_BASE,
209 .tx_trigger = OMAP24XX_DMA_UART3_TX,
210 .rx_trigger = OMAP24XX_DMA_UART3_RX,
211};
212
213static struct resource h4_irda_resources[] = {
214 [0] = {
215 .start = INT_24XX_UART3_IRQ,
216 .end = INT_24XX_UART3_IRQ,
217 .flags = IORESOURCE_IRQ,
218 },
219};
220
221static struct platform_device h4_irda_device = {
222 .name = "omapirda",
223 .id = -1,
224 .dev = {
225 .platform_data = &h4_irda_data,
226 },
227 .num_resources = 1,
228 .resource = h4_irda_resources,
229};
230
231static struct omap_kp_platform_data h4_kp_data = { 139static struct omap_kp_platform_data h4_kp_data = {
232 .rows = 6, 140 .rows = 6,
233 .cols = 7, 141 .cols = 7,
@@ -253,7 +161,6 @@ static struct platform_device h4_lcd_device = {
253 161
254static struct platform_device *h4_devices[] __initdata = { 162static struct platform_device *h4_devices[] __initdata = {
255 &h4_flash_device, 163 &h4_flash_device,
256 &h4_irda_device,
257 &h4_kp_device, 164 &h4_kp_device,
258 &h4_lcd_device, 165 &h4_lcd_device,
259}; 166};
@@ -341,7 +248,7 @@ static inline void __init h4_init_debug(void)
341 udelay(100); 248 udelay(100);
342 249
343 omap_cfg_reg(M15_24XX_GPIO92); 250 omap_cfg_reg(M15_24XX_GPIO92);
344 if (debug_card_init(cs_mem_base, OMAP24XX_ETHR_GPIO_IRQ) < 0) 251 if (debug_card_init(cs_mem_base, H4_ETHR_GPIO_IRQ) < 0)
345 gpmc_cs_free(eth_cs); 252 gpmc_cs_free(eth_cs);
346 253
347out: 254out:
@@ -363,7 +270,7 @@ static void __init h4_init_flash(void)
363 270
364static void __init omap_h4_init_irq(void) 271static void __init omap_h4_init_irq(void)
365{ 272{
366 omap2_init_common_hw(); 273 omap2_init_common_hw(NULL);
367 omap_init_irq(); 274 omap_init_irq();
368 omap_gpio_init(); 275 omap_gpio_init();
369 h4_init_flash(); 276 h4_init_flash();
@@ -377,6 +284,39 @@ static struct omap_lcd_config h4_lcd_config __initdata = {
377 .ctrl_name = "internal", 284 .ctrl_name = "internal",
378}; 285};
379 286
287static struct omap_usb_config h4_usb_config __initdata = {
288#ifdef CONFIG_MACH_OMAP2_H4_USB1
289 /* NOTE: usb1 could also be used with 3 wire signaling */
290 .pins[1] = 4,
291#endif
292
293#ifdef CONFIG_MACH_OMAP_H4_OTG
294 /* S1.10 ON -- USB OTG port
295 * usb0 switched to Mini-AB port and isp1301 transceiver;
296 * S2.POS3 = OFF, S2.POS4 = ON ... to allow battery charging
297 */
298 .otg = 1,
299 .pins[0] = 4,
300#ifdef CONFIG_USB_GADGET_OMAP
301 /* use OTG cable, or standard A-to-MiniB */
302 .hmc_mode = 0x14, /* 0:dev/otg 1:host 2:disable */
303#elif defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
304 /* use OTG cable, or NONSTANDARD (B-to-MiniB) */
305 .hmc_mode = 0x11, /* 0:host 1:host 2:disable */
306#endif /* XX */
307
308#else
309 /* S1.10 OFF -- usb "download port"
310 * usb0 switched to Mini-B port and isp1105 transceiver;
311 * S2.POS3 = ON, S2.POS4 = OFF ... to enable battery charging
312 */
313 .register_dev = 1,
314 .pins[0] = 3,
315/* .hmc_mode = 0x14,*/ /* 0:dev 1:host 2:disable */
316 .hmc_mode = 0x00, /* 0:dev|otg 1:disable 2:disable */
317#endif
318};
319
380static struct omap_board_config_kernel h4_config[] = { 320static struct omap_board_config_kernel h4_config[] = {
381 { OMAP_TAG_UART, &h4_uart_config }, 321 { OMAP_TAG_UART, &h4_uart_config },
382 { OMAP_TAG_LCD, &h4_lcd_config }, 322 { OMAP_TAG_LCD, &h4_lcd_config },
@@ -428,6 +368,7 @@ static void __init omap_h4_init(void)
428 platform_add_devices(h4_devices, ARRAY_SIZE(h4_devices)); 368 platform_add_devices(h4_devices, ARRAY_SIZE(h4_devices));
429 omap_board_config = h4_config; 369 omap_board_config = h4_config;
430 omap_board_config_size = ARRAY_SIZE(h4_config); 370 omap_board_config_size = ARRAY_SIZE(h4_config);
371 omap_usb_init(&h4_usb_config);
431 omap_serial_init(); 372 omap_serial_init();
432} 373}
433 374