Merge branch 'core-iommu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[sfrench/cifs-2.6.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/delay.h>
17 #include <linux/platform_device.h>
18
19 #include <asm/setup.h>
20 #include <asm/mach/arch.h>
21 #include <asm/mach-types.h>
22
23 #include <mach/pxa25x.h>
24 #include <mach/eseries-gpio.h>
25 #include <mach/udc.h>
26 #include <mach/irda.h>
27
28 #include "generic.h"
29 #include "clock.h"
30
31 /* Only e800 has 128MB RAM */
32 void __init eseries_fixup(struct machine_desc *desc,
33         struct tag *tags, char **cmdline, struct meminfo *mi)
34 {
35         mi->nr_banks=1;
36         mi->bank[0].start = 0xa0000000;
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 struct pxaficp_platform_data e7xx_ficp_platform_data = {
50         .gpio_pwdown            = GPIO_E7XX_IR_OFF,
51         .transceiver_cap        = IR_SIRMODE | IR_OFF,
52 };
53
54 int eseries_tmio_enable(struct platform_device *dev)
55 {
56         /* Reset - bring SUSPEND high before PCLR */
57         gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
58         gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 0);
59         msleep(1);
60         gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 1);
61         msleep(1);
62         gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 1);
63         msleep(1);
64         return 0;
65 }
66
67 int eseries_tmio_disable(struct platform_device *dev)
68 {
69         gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
70         gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 0);
71         return 0;
72 }
73
74 int eseries_tmio_suspend(struct platform_device *dev)
75 {
76         gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
77         return 0;
78 }
79
80 int eseries_tmio_resume(struct platform_device *dev)
81 {
82         gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 1);
83         msleep(1);
84         return 0;
85 }
86
87 void eseries_get_tmio_gpios(void)
88 {
89         gpio_request(GPIO_ESERIES_TMIO_SUSPEND, NULL);
90         gpio_request(GPIO_ESERIES_TMIO_PCLR, NULL);
91         gpio_direction_output(GPIO_ESERIES_TMIO_SUSPEND, 0);
92         gpio_direction_output(GPIO_ESERIES_TMIO_PCLR, 0);
93 }
94
95 /* TMIO controller uses the same resources on all e-series machines. */
96 struct resource eseries_tmio_resources[] = {
97         [0] = {
98                 .start  = PXA_CS4_PHYS,
99                 .end    = PXA_CS4_PHYS + 0x1fffff,
100                 .flags  = IORESOURCE_MEM,
101         },
102         [1] = {
103                 .start  = IRQ_GPIO(GPIO_ESERIES_TMIO_IRQ),
104                 .end    = IRQ_GPIO(GPIO_ESERIES_TMIO_IRQ),
105                 .flags  = IORESOURCE_IRQ,
106         },
107 };
108
109 /* Some e-series hardware cannot control the 32K clock */
110 static void clk_32k_dummy(struct clk *clk)
111 {
112 }
113
114 static const struct clkops clk_32k_dummy_ops = {
115         .enable         = clk_32k_dummy,
116         .disable        = clk_32k_dummy,
117 };
118
119 static struct clk tmio_dummy_clk = {
120         .ops    = &clk_32k_dummy_ops,
121         .rate   = 32768,
122 };
123
124 static struct clk_lookup eseries_clkregs[] = {
125         INIT_CLKREG(&tmio_dummy_clk, NULL, "CLK_CK32K"),
126 };
127
128 void eseries_register_clks(void)
129 {
130         clkdev_add_table(eseries_clkregs, ARRAY_SIZE(eseries_clkregs));
131 }
132