aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/mach-omap2/serial.c
diff options
context:
space:
mode:
authorGovindraj.R <govindraj.raja@ti.com>2011-10-13 14:11:09 +0530
committerKevin Hilman <khilman@ti.com>2011-12-14 16:05:23 -0800
commit62f3ec5fbd5fddce62b7a71adc04723a5eb903da (patch)
tree682d86d38cf888bd10622479d779e862ebcee6d3 /arch/arm/mach-omap2/serial.c
parent94734749af794c080f6af6ac3ce8c1c13ee2dbbd (diff)
ARM: OMAP2+: UART: Add wakeup mechanism for omap-uarts
From the runtime callbacks enable hwmod wakeups for uart which will internally enable io-pad wakeups for uarts if they have rx-pad pins set as wakeup capabale. Use the io-ring wakeup mechanism after uart clock gating and leave the PM_WKST set for uart to default reset values cleanup the code in serial.c which was handling PM_WKST reg. Irq_chaing(PRM_DRIVER) is used to wakeup uart after uart clocks are gated using pad wakeup mechanism. Signed-off-by: Govindraj.R <govindraj.raja@ti.com> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> (for drivers/tty changes) Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2/serial.c')
-rw-r--r--arch/arm/mach-omap2/serial.c96
1 files changed, 12 insertions, 84 deletions
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 77a25cb1dcca..aa6f7f05a1e3 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -56,10 +56,6 @@ struct omap_uart_state {
int num;
int can_sleep;
- void __iomem *wk_st;
- void __iomem *wk_en;
- u32 wk_mask;
-
int clocked;
struct list_head node;
@@ -92,26 +88,6 @@ static inline void omap_uart_disable_clocks(struct omap_uart_state *uart)
omap_device_idle(uart->pdev);
}
-static void omap_uart_enable_wakeup(struct omap_uart_state *uart)
-{
- /* Set wake-enable bit */
- if (uart->wk_en && uart->wk_mask) {
- u32 v = __raw_readl(uart->wk_en);
- v |= uart->wk_mask;
- __raw_writel(v, uart->wk_en);
- }
-}
-
-static void omap_uart_disable_wakeup(struct omap_uart_state *uart)
-{
- /* Clear wake-enable bit */
- if (uart->wk_en && uart->wk_mask) {
- u32 v = __raw_readl(uart->wk_en);
- v &= ~uart->wk_mask;
- __raw_writel(v, uart->wk_en);
- }
-}
-
static void omap_uart_block_sleep(struct omap_uart_state *uart)
{
omap_uart_enable_clocks(uart);
@@ -141,65 +117,17 @@ int omap_uart_can_sleep(void)
return can_sleep;
}
-static void omap_uart_idle_init(struct omap_uart_state *uart)
+static void omap_uart_enable_wakeup(struct platform_device *pdev, bool enable)
{
- int ret;
-
- uart->can_sleep = 0;
- omap_uart_smart_idle_enable(uart, 0);
+ struct omap_device *od = to_omap_device(pdev);
- if (cpu_is_omap34xx() && !(cpu_is_ti81xx() || cpu_is_am33xx())) {
- u32 mod = (uart->num > 1) ? OMAP3430_PER_MOD : CORE_MOD;
- u32 wk_mask = 0;
+ if (!od)
+ return;
- /* XXX These PRM accesses do not belong here */
- uart->wk_en = OMAP34XX_PRM_REGADDR(mod, PM_WKEN1);
- uart->wk_st = OMAP34XX_PRM_REGADDR(mod, PM_WKST1);
- switch (uart->num) {
- case 0:
- wk_mask = OMAP3430_ST_UART1_MASK;
- break;
- case 1:
- wk_mask = OMAP3430_ST_UART2_MASK;
- break;
- case 2:
- wk_mask = OMAP3430_ST_UART3_MASK;
- break;
- case 3:
- wk_mask = OMAP3630_ST_UART4_MASK;
- break;
- }
- uart->wk_mask = wk_mask;
- } else if (cpu_is_omap24xx()) {
- u32 wk_mask = 0;
- u32 wk_en = PM_WKEN1, wk_st = PM_WKST1;
-
- switch (uart->num) {
- case 0:
- wk_mask = OMAP24XX_ST_UART1_MASK;
- break;
- case 1:
- wk_mask = OMAP24XX_ST_UART2_MASK;
- break;
- case 2:
- wk_en = OMAP24XX_PM_WKEN2;
- wk_st = OMAP24XX_PM_WKST2;
- wk_mask = OMAP24XX_ST_UART3_MASK;
- break;
- }
- uart->wk_mask = wk_mask;
- if (cpu_is_omap2430()) {
- uart->wk_en = OMAP2430_PRM_REGADDR(CORE_MOD, wk_en);
- uart->wk_st = OMAP2430_PRM_REGADDR(CORE_MOD, wk_st);
- } else if (cpu_is_omap2420()) {
- uart->wk_en = OMAP2420_PRM_REGADDR(CORE_MOD, wk_en);
- uart->wk_st = OMAP2420_PRM_REGADDR(CORE_MOD, wk_st);
- }
- } else {
- uart->wk_en = NULL;
- uart->wk_st = NULL;
- uart->wk_mask = 0;
- }
+ if (enable)
+ omap_hwmod_enable_wakeup(od->hwmods[0]);
+ else
+ omap_hwmod_disable_wakeup(od->hwmods[0]);
}
/*
@@ -222,6 +150,8 @@ static void omap_uart_set_forceidle(struct platform_device *pdev)
}
#else
+static void omap_uart_enable_wakeup(struct platform_device *pdev, bool enable)
+{}
static void omap_uart_set_noidle(struct platform_device *pdev) {}
static void omap_uart_set_forceidle(struct platform_device *pdev) {}
static void omap_uart_block_sleep(struct omap_uart_state *uart)
@@ -437,6 +367,7 @@ void __init omap_serial_init_port(struct omap_board_data *bdata)
omap_up.get_context_loss_count = omap_pm_get_dev_context_loss_count;
omap_up.set_forceidle = omap_uart_set_forceidle;
omap_up.set_noidle = omap_uart_set_noidle;
+ omap_up.enable_wakeup = omap_uart_enable_wakeup;
/* Enable the MDR1 Errata i202 for OMAP2430/3xxx/44xx */
if (!cpu_is_omap2420() && !cpu_is_ti816x())
@@ -474,15 +405,12 @@ void __init omap_serial_init_port(struct omap_board_data *bdata)
omap_hwmod_idle(uart->oh);
omap_device_enable(uart->pdev);
- omap_uart_idle_init(uart);
- omap_hwmod_enable_wakeup(uart->oh);
omap_device_idle(uart->pdev);
omap_uart_block_sleep(uart);
console_unlock();
- if (((cpu_is_omap34xx() || cpu_is_omap44xx()) && bdata->pads) ||
- (pdata->wk_en && pdata->wk_mask))
+ if ((cpu_is_omap34xx() || cpu_is_omap44xx()) && bdata->pads)
device_init_wakeup(&pdev->dev, true);
}