]> pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-pxa/eseries.c
[ARM] IrDA support for e7xx
[linux-2.6-omap-h63xx.git] / arch / arm / mach-pxa / eseries.c
1 /*
2  * Hardware definitions for the Toshiba eseries PDAs
3  *
4  * Copyright (c) 2003 Ian Molton <spyro@f2s.com>
5  *
6  * This file is licensed under
7  * the terms of the GNU General Public License version 2. This program
8  * is licensed "as is" without any warranty of any kind, whether express
9  * or implied.
10  *
11  */
12
13 #include <linux/kernel.h>
14 #include <linux/init.h>
15 #include <linux/gpio.h>
16 #include <linux/platform_device.h>
17
18 #include <asm/setup.h>
19 #include <asm/mach/arch.h>
20 #include <asm/mach-types.h>
21
22 #include <mach/mfp-pxa25x.h>
23 #include <mach/hardware.h>
24 #include <mach/eseries-gpio.h>
25 #include <mach/udc.h>
26 #include <mach/irda.h>
27
28 #include "generic.h"
29
30 /* Only e800 has 128MB RAM */
31 void __init eseries_fixup(struct machine_desc *desc,
32         struct tag *tags, char **cmdline, struct meminfo *mi)
33 {
34         mi->nr_banks=1;
35         mi->bank[0].start = 0xa0000000;
36         mi->bank[0].node = 0;
37         if (machine_is_e800())
38                 mi->bank[0].size = (128*1024*1024);
39         else
40                 mi->bank[0].size = (64*1024*1024);
41 }
42
43 struct pxa2xx_udc_mach_info e7xx_udc_mach_info = {
44         .gpio_vbus   = GPIO_E7XX_USB_DISC,
45         .gpio_pullup = GPIO_E7XX_USB_PULLUP,
46         .gpio_pullup_inverted = 1
47 };
48
49 static void e7xx_irda_transceiver_mode(struct device *dev, int mode)
50 {
51         if (mode & IR_OFF) {
52                 gpio_set_value(GPIO_E7XX_IR_OFF, 1);
53                 pxa2xx_transceiver_mode(dev, mode);
54         } else {
55                 pxa2xx_transceiver_mode(dev, mode);
56                 gpio_set_value(GPIO_E7XX_IR_OFF, 0);
57         }
58 }
59
60 int e7xx_irda_init(void)
61 {
62         int ret;
63
64         ret = gpio_request(GPIO_E7XX_IR_OFF, "IrDA power");
65         if (ret)
66                 goto out;
67
68         ret = gpio_direction_output(GPIO_E7XX_IR_OFF, 0);
69         if (ret)
70                 goto out;
71
72         e7xx_irda_transceiver_mode(NULL, IR_SIRMODE | IR_OFF);
73 out:
74         return ret;
75 }
76
77 static void e7xx_irda_shutdown(struct device *dev)
78 {
79         e7xx_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF);
80         gpio_free(GPIO_E7XX_IR_OFF);
81 }
82
83 struct pxaficp_platform_data e7xx_ficp_platform_data = {
84         .transceiver_cap  = IR_SIRMODE | IR_OFF,
85         .transceiver_mode = e7xx_irda_transceiver_mode,
86         .shutdown = e7xx_irda_shutdown,
87 };
88