From 9f9ac1e84a24670eea1430040e0aef278b4daffa Mon Sep 17 00:00:00 2001 From: "Govindraj.R" Date: Mon, 7 Nov 2011 18:56:12 +0530 Subject: ARM: OMAP2+: UART: Remove context_save and move context restore to driver Remove context save function from serial.c and move context restore function to omap-serial. Remove all regs stored in omap_uart_state for contex_save/restore, reg read write funcs used in context_save/restore, io_addresses populated for read/write funcs. Clock gating mechanism was done in serial.c and had no info on uart state thus we needed context save and restore in serial.c With runtime conversion and clock gating done within uart driver context restore can be done from regs value available from uart_omap_port structure. Signed-off-by: Govindraj.R Acked-by: Greg Kroah-Hartman (for drivers/tty changes) Signed-off-by: Kevin Hilman --- drivers/tty/serial/omap-serial.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'drivers/tty/serial/omap-serial.c') diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index f16ef4b9363d..a834e913a6e4 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c @@ -1408,6 +1408,25 @@ static int serial_omap_remove(struct platform_device *dev) return 0; } +static void serial_omap_restore_context(struct uart_omap_port *up) +{ + serial_out(up, UART_OMAP_MDR1, UART_OMAP_MDR1_DISABLE); + serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); /* Config B mode */ + serial_out(up, UART_EFR, UART_EFR_ECB); + serial_out(up, UART_LCR, 0x0); /* Operational mode */ + serial_out(up, UART_IER, 0x0); + serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); /* Config B mode */ + serial_out(up, UART_LCR, 0x0); /* Operational mode */ + serial_out(up, UART_IER, up->ier); + serial_out(up, UART_FCR, up->fcr); + serial_out(up, UART_LCR, UART_LCR_CONF_MODE_A); + serial_out(up, UART_MCR, up->mcr); + serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); /* Config B mode */ + serial_out(up, UART_EFR, up->efr); + serial_out(up, UART_LCR, up->lcr); + serial_out(up, UART_OMAP_MDR1, UART_OMAP_MDR1_16X_MODE); +} + #ifdef CONFIG_PM_RUNTIME static int serial_omap_runtime_suspend(struct device *dev) { @@ -1416,6 +1435,11 @@ static int serial_omap_runtime_suspend(struct device *dev) static int serial_omap_runtime_resume(struct device *dev) { + struct uart_omap_port *up = dev_get_drvdata(dev); + + if (up) + serial_omap_restore_context(up); + return 0; } #endif -- cgit v1.2.2