From: govindraj.raja@ti.com (Govindraj.R)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v7 10/21] OMAP2+: UART: Get context loss count to context restore
Date: Tue, 18 Oct 2011 20:56:05 +0530 [thread overview]
Message-ID: <1318951576-10165-11-git-send-email-govindraj.raja@ti.com> (raw)
In-Reply-To: <1318951576-10165-1-git-send-email-govindraj.raja@ti.com>
Avoid unconditional context restore every time we gate uart
clocks. Check whether context loss happened based on which
we can context restore uart regs from uart_port structure.
Signed-off-by: Govindraj.R <govindraj.raja@ti.com>
---
arch/arm/mach-omap2/serial.c | 2 ++
arch/arm/plat-omap/include/plat/omap-serial.h | 3 +++
drivers/tty/serial/omap-serial.c | 20 ++++++++++++++++++--
3 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 7dd75f1..f220c84 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -33,6 +33,7 @@
#include <plat/dma.h>
#include <plat/omap_hwmod.h>
#include <plat/omap_device.h>
+#include <plat/omap-pm.h>
#include "prm2xxx_3xxx.h"
#include "pm.h"
@@ -500,6 +501,7 @@ void __init omap_serial_init_port(struct omap_board_data *bdata)
omap_up.dma_enabled = uart->dma_enabled;
omap_up.uartclk = OMAP24XX_BASE_BAUD * 16;
omap_up.flags = UPF_BOOT_AUTOCONF;
+ omap_up.get_context_loss_count = omap_pm_get_dev_context_loss_count;
pdata = &omap_up;
pdata_size = sizeof(struct omap_uart_port_info);
diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h b/arch/arm/plat-omap/include/plat/omap-serial.h
index 5b913c7..f265bb9 100644
--- a/arch/arm/plat-omap/include/plat/omap-serial.h
+++ b/arch/arm/plat-omap/include/plat/omap-serial.h
@@ -62,6 +62,8 @@ struct omap_uart_port_info {
bool dma_enabled; /* To specify DMA Mode */
unsigned int uartclk; /* UART clock rate */
upf_t flags; /* UPF_* flags */
+
+ u32 (*get_context_loss_count)(struct device *);
};
struct uart_omap_dma {
@@ -114,6 +116,7 @@ struct uart_omap_port {
unsigned char msr_saved_flags;
char name[20];
unsigned long port_activity;
+ u32 context_loss_cnt;
};
#endif /* __OMAP_SERIAL_H__ */
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index a7fdf94..289fa7b 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -1439,15 +1439,31 @@ static void serial_omap_restore_context(struct uart_omap_port *up)
#ifdef CONFIG_PM_RUNTIME
static int serial_omap_runtime_suspend(struct device *dev)
{
+ struct uart_omap_port *up = dev_get_drvdata(dev);
+ struct omap_uart_port_info *pdata = dev->platform_data;
+
+ if (!up)
+ return -EINVAL;
+
+ if (pdata->get_context_loss_count)
+ up->context_loss_cnt = pdata->get_context_loss_count(dev);
+
return 0;
}
static int serial_omap_runtime_resume(struct device *dev)
{
struct uart_omap_port *up = dev_get_drvdata(dev);
+ struct omap_uart_port_info *pdata = dev->platform_data;
- if (up)
- serial_omap_restore_context(up);
+ if (up) {
+ if (pdata->get_context_loss_count) {
+ u32 loss_cnt = pdata->get_context_loss_count(dev);
+
+ if (up->context_loss_cnt != loss_cnt)
+ serial_omap_restore_context(up);
+ }
+ }
return 0;
}
--
1.7.4.1
next prev parent reply other threads:[~2011-10-18 15:26 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-18 15:25 [PATCH v7 00/21] OMAP2+: UART: Runtime adaptation + cleanup Govindraj.R
2011-10-18 15:25 ` [PATCH v7 01/21] OMAP2+: UART: cleanup + remove uart pm specific API Govindraj.R
2011-10-18 15:25 ` [PATCH v7 02/21] OMAP2+: UART: cleanup 8250 console driver support Govindraj.R
2011-10-18 15:25 ` [PATCH v7 03/21] OMAP2+: UART: Cleanup part of clock gating mechanism for uart Govindraj.R
2011-10-18 15:25 ` [PATCH v7 04/21] OMAP2+: UART: Add default mux for all uarts Govindraj.R
2011-10-18 15:26 ` [PATCH v7 05/21] OMAP2+: UART: Remove mapbase/membase fields from pdata Govindraj.R
2011-10-18 15:26 ` [PATCH v7 06/21] OMAP2+: UART: Add runtime pm support for omap-serial driver Govindraj.R
2011-10-18 15:26 ` [PATCH v7 07/21] OMAP2+: UART: Remove context_save and move context restore to driver Govindraj.R
2011-10-18 15:26 ` [PATCH v7 08/21] OMAP2+: UART: Ensure all reg values configured are available from port structure Govindraj.R
2011-10-18 15:26 ` [PATCH v7 09/21] OMAP2+: UART: Remove uart reset function Govindraj.R
2011-10-18 15:26 ` Govindraj.R [this message]
2011-10-18 15:26 ` [PATCH v7 11/21] OMAP2+: UART: Move errata handling from serial.c to omap-serial Govindraj.R
2011-11-10 23:44 ` Jon Hunter
2011-11-11 6:11 ` Shubhrajyoti
2011-11-11 10:14 ` Govindraj
2011-10-18 15:26 ` [PATCH v7 12/21] OMAP2+: UART: Add wakeup mechanism for omap-uarts Govindraj.R
2011-10-18 15:26 ` [PATCH v7 13/21] OMAP2+: UART: Remove old and unused clocks handling funcs Govindraj.R
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1318951576-10165-11-git-send-email-govindraj.raja@ti.com \
--to=govindraj.raja@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).