diff options
Diffstat (limited to 'arch/arm/mach-pxa/eseries.c')
-rw-r--r-- | arch/arm/mach-pxa/eseries.c | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c index d28849b50a14..dfce7d5b659e 100644 --- a/arch/arm/mach-pxa/eseries.c +++ b/arch/arm/mach-pxa/eseries.c | |||
@@ -12,6 +12,9 @@ | |||
12 | 12 | ||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/gpio.h> | ||
16 | #include <linux/delay.h> | ||
17 | #include <linux/platform_device.h> | ||
15 | 18 | ||
16 | #include <asm/setup.h> | 19 | #include <asm/setup.h> |
17 | #include <asm/mach/arch.h> | 20 | #include <asm/mach/arch.h> |
@@ -21,8 +24,10 @@ | |||
21 | #include <mach/hardware.h> | 24 | #include <mach/hardware.h> |
22 | #include <mach/eseries-gpio.h> | 25 | #include <mach/eseries-gpio.h> |
23 | #include <mach/udc.h> | 26 | #include <mach/udc.h> |
27 | #include <mach/irda.h> | ||
24 | 28 | ||
25 | #include "generic.h" | 29 | #include "generic.h" |
30 | #include "clock.h" | ||
26 | 31 | ||
27 | /* Only e800 has 128MB RAM */ | 32 | /* Only e800 has 128MB RAM */ |
28 | void __init eseries_fixup(struct machine_desc *desc, | 33 | void __init eseries_fixup(struct machine_desc *desc, |
@@ -43,3 +48,122 @@ struct pxa2xx_udc_mach_info e7xx_udc_mach_info = { | |||
43 | .gpio_pullup_inverted = 1 | 48 | .gpio_pullup_inverted = 1 |
44 | }; | 49 | }; |
45 | 50 | ||
51 | static void e7xx_irda_transceiver_mode(struct device *dev, int mode) | ||
52 | { | ||
53 | if (mode & IR_OFF) { | ||
54 | gpio_set_value(GPIO_E7XX_IR_OFF, 1); | ||
55 | pxa2xx_transceiver_mode(dev, mode); | ||
56 | } else { | ||
57 | pxa2xx_transceiver_mode(dev, mode); | ||
58 | gpio_set_value(GPIO_E7XX_IR_OFF, 0); | ||
59 | } | ||
60 | } | ||
61 | |||
62 | int e7xx_irda_init(void) | ||
63 | { | ||
64 | int ret; | ||
65 | |||
66 | ret = gpio_request(GPIO_E7XX_IR_OFF, "IrDA power"); | ||
67 | if (ret) | ||
68 | goto out; | ||
69 | |||
70 | ret = gpio_direction_output(GPIO_E7XX_IR_OFF, 0); | ||
71 | if (ret) | ||
72 | goto out; | ||
73 | |||
74 | e7xx_irda_transceiver_mode(NULL, IR_SIRMODE | IR_OFF); | ||
75 | out: | ||
76 | return ret; | ||
77 | } | ||
78 | |||
79 | static void e7xx_irda_shutdown(struct device *dev) | ||
80 | { | ||
81 | e7xx_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF); | ||
82 | gpio_free(GPIO_E7XX_IR_OFF); | ||
83 | } | ||
84 | |||
85 | struct pxaficp_platform_data e7xx_ficp_platform_data = { | ||
86 | .transceiver_cap = IR_SIRMODE | IR_OFF, | ||
87 | .transceiver_mode = e7xx_irda_transceiver_mode, | ||
88 | .shutdown = e7xx_irda_shutdown, | ||
89 | }; | ||
90 | |||
91 | int eseries_tmio_enable(struct platform_device *dev) | ||
92 | { | ||
93 | /* Reset - bring SUSPEND high before PCLR */ | ||
94 | gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0); | ||
95 | gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 0); | ||
96 | msleep(1); | ||
97 | gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 1); | ||
98 | msleep(1); | ||
99 | gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 1); | ||
100 | msleep(1); | ||
101 | return 0; | ||
102 | } | ||
103 | |||
104 | int eseries_tmio_disable(struct platform_device *dev) | ||
105 | { | ||
106 | gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0); | ||
107 | gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 0); | ||
108 | return 0; | ||
109 | } | ||
110 | |||
111 | int eseries_tmio_suspend(struct platform_device *dev) | ||
112 | { | ||
113 | gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0); | ||
114 | return 0; | ||
115 | } | ||
116 | |||
117 | int eseries_tmio_resume(struct platform_device *dev) | ||
118 | { | ||
119 | gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 1); | ||
120 | msleep(1); | ||
121 | return 0; | ||
122 | } | ||
123 | |||
124 | void eseries_get_tmio_gpios(void) | ||
125 | { | ||
126 | gpio_request(GPIO_ESERIES_TMIO_SUSPEND, NULL); | ||
127 | gpio_request(GPIO_ESERIES_TMIO_PCLR, NULL); | ||
128 | gpio_direction_output(GPIO_ESERIES_TMIO_SUSPEND, 0); | ||
129 | gpio_direction_output(GPIO_ESERIES_TMIO_PCLR, 0); | ||
130 | } | ||
131 | |||
132 | /* TMIO controller uses the same resources on all e-series machines. */ | ||
133 | struct resource eseries_tmio_resources[] = { | ||
134 | [0] = { | ||
135 | .start = PXA_CS4_PHYS, | ||
136 | .end = PXA_CS4_PHYS + 0x1fffff, | ||
137 | .flags = IORESOURCE_MEM, | ||
138 | }, | ||
139 | [1] = { | ||
140 | .start = IRQ_GPIO(GPIO_ESERIES_TMIO_IRQ), | ||
141 | .end = IRQ_GPIO(GPIO_ESERIES_TMIO_IRQ), | ||
142 | .flags = IORESOURCE_IRQ, | ||
143 | }, | ||
144 | }; | ||
145 | |||
146 | /* Some e-series hardware cannot control the 32K clock */ | ||
147 | static void clk_32k_dummy(struct clk *clk) | ||
148 | { | ||
149 | } | ||
150 | |||
151 | static const struct clkops clk_32k_dummy_ops = { | ||
152 | .enable = clk_32k_dummy, | ||
153 | .disable = clk_32k_dummy, | ||
154 | }; | ||
155 | |||
156 | static struct clk tmio_dummy_clk = { | ||
157 | .ops = &clk_32k_dummy_ops, | ||
158 | .rate = 32768, | ||
159 | }; | ||
160 | |||
161 | static struct clk_lookup eseries_clkregs[] = { | ||
162 | INIT_CLKREG(&tmio_dummy_clk, NULL, "CLK_CK32K"), | ||
163 | }; | ||
164 | |||
165 | void eseries_register_clks(void) | ||
166 | { | ||
167 | clks_register(eseries_clkregs, ARRAY_SIZE(eseries_clkregs)); | ||
168 | } | ||
169 | |||