aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1/serial.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2005-09-08 18:07:38 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-09-08 18:07:38 -0400
commit7c38cf021b42a4297bc8f860ab627734bdd6c8d1 (patch)
tree89c3b807ca90f5c7e5692ddbcd388511dc289530 /arch/arm/mach-omap1/serial.c
parentd7b6b3589471c3856f1e6dc9c77abc4af962ffdb (diff)
[ARM] 2890/1: OMAP 1/4: Update omap1 specific files, take 2
Patch from Tony Lindgren This patch syncs the mainline kernel with linux-omap tree. The highlights of the patch are: - Convert more drivers to register resources in board-*.c to take advantage of the driver model by David Brownell and Ladislav Michl - Use set_irq_type() for GPIO interrupts instead of omap_set_gpio_edge_ctrl() by David Brownell - Add minimal support for handling optional add-on boards, such as OSK Mistral board with LCD and keypad, by David Brownell - Minimal support for loading functions to SRAM by Tony Lindgren - Wake up from serial port by muxing RX lines temporarily into GPIO interrupts by Tony Lindgren - 32KHz sched_clock by Tony Lindgren and Juha Yrjola Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-omap1/serial.c')
-rw-r--r--arch/arm/mach-omap1/serial.c84
1 files changed, 84 insertions, 0 deletions
diff --git a/arch/arm/mach-omap1/serial.c b/arch/arm/mach-omap1/serial.c
index 214e5d17c8b5..e702e0cb899e 100644
--- a/arch/arm/mach-omap1/serial.c
+++ b/arch/arm/mach-omap1/serial.c
@@ -24,7 +24,11 @@
24 24
25#include <asm/arch/board.h> 25#include <asm/arch/board.h>
26#include <asm/arch/mux.h> 26#include <asm/arch/mux.h>
27#include <asm/arch/gpio.h>
27#include <asm/arch/fpga.h> 28#include <asm/arch/fpga.h>
29#ifdef CONFIG_PM
30#include <asm/arch/pm.h>
31#endif
28 32
29static struct clk * uart1_ck = NULL; 33static struct clk * uart1_ck = NULL;
30static struct clk * uart2_ck = NULL; 34static struct clk * uart2_ck = NULL;
@@ -193,6 +197,86 @@ void __init omap_serial_init(int ports[OMAP_MAX_NR_PORTS])
193 } 197 }
194} 198}
195 199
200#ifdef CONFIG_OMAP_SERIAL_WAKE
201
202static irqreturn_t omap_serial_wake_interrupt(int irq, void *dev_id,
203 struct pt_regs *regs)
204{
205 /* Need to do something with serial port right after wake-up? */
206 return IRQ_HANDLED;
207}
208
209/*
210 * Reroutes serial RX lines to GPIO lines for the duration of
211 * sleep to allow waking up the device from serial port even
212 * in deep sleep.
213 */
214void omap_serial_wake_trigger(int enable)
215{
216 if (!cpu_is_omap16xx())
217 return;
218
219 if (uart1_ck != NULL) {
220 if (enable)
221 omap_cfg_reg(V14_16XX_GPIO37);
222 else
223 omap_cfg_reg(V14_16XX_UART1_RX);
224 }
225 if (uart2_ck != NULL) {
226 if (enable)
227 omap_cfg_reg(R9_16XX_GPIO18);
228 else
229 omap_cfg_reg(R9_16XX_UART2_RX);
230 }
231 if (uart3_ck != NULL) {
232 if (enable)
233 omap_cfg_reg(L14_16XX_GPIO49);
234 else
235 omap_cfg_reg(L14_16XX_UART3_RX);
236 }
237}
238
239static void __init omap_serial_set_port_wakeup(int gpio_nr)
240{
241 int ret;
242
243 ret = omap_request_gpio(gpio_nr);
244 if (ret < 0) {
245 printk(KERN_ERR "Could not request UART wake GPIO: %i\n",
246 gpio_nr);
247 return;
248 }
249 omap_set_gpio_direction(gpio_nr, 1);
250 set_irq_type(OMAP_GPIO_IRQ(gpio_nr), IRQT_RISING);
251 ret = request_irq(OMAP_GPIO_IRQ(gpio_nr), &omap_serial_wake_interrupt,
252 0, "serial wakeup", NULL);
253 if (ret) {
254 omap_free_gpio(gpio_nr);
255 printk(KERN_ERR "No interrupt for UART wake GPIO: %i\n",
256 gpio_nr);
257 return;
258 }
259 enable_irq_wake(OMAP_GPIO_IRQ(gpio_nr));
260}
261
262static int __init omap_serial_wakeup_init(void)
263{
264 if (!cpu_is_omap16xx())
265 return 0;
266
267 if (uart1_ck != NULL)
268 omap_serial_set_port_wakeup(37);
269 if (uart2_ck != NULL)
270 omap_serial_set_port_wakeup(18);
271 if (uart3_ck != NULL)
272 omap_serial_set_port_wakeup(49);
273
274 return 0;
275}
276late_initcall(omap_serial_wakeup_init);
277
278#endif /* CONFIG_OMAP_SERIAL_WAKE */
279
196static int __init omap_init(void) 280static int __init omap_init(void)
197{ 281{
198 return platform_device_register(&serial_device); 282 return platform_device_register(&serial_device);