aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap2/pm24xx.c18
-rw-r--r--arch/arm/mach-omap2/pm34xx.c32
-rw-r--r--arch/arm/mach-omap2/serial.c65
-rw-r--r--arch/arm/plat-omap/include/plat/serial.h4
4 files changed, 0 insertions, 119 deletions
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c
index ef8595c8029..22af2f2fdbf 100644
--- a/arch/arm/mach-omap2/pm24xx.c
+++ b/arch/arm/mach-omap2/pm24xx.c
@@ -30,7 +30,6 @@
30#include <linux/irq.h> 30#include <linux/irq.h>
31#include <linux/time.h> 31#include <linux/time.h>
32#include <linux/gpio.h> 32#include <linux/gpio.h>
33#include <linux/console.h>
34 33
35#include <asm/mach/time.h> 34#include <asm/mach/time.h>
36#include <asm/mach/irq.h> 35#include <asm/mach/irq.h>
@@ -127,27 +126,11 @@ static void omap2_enter_full_retention(void)
127 if (omap_irq_pending()) 126 if (omap_irq_pending())
128 goto no_sleep; 127 goto no_sleep;
129 128
130 /* Block console output in case it is on one of the OMAP UARTs */
131 if (!is_suspending())
132 if (!console_trylock())
133 goto no_sleep;
134
135 omap_uart_prepare_idle(0);
136 omap_uart_prepare_idle(1);
137 omap_uart_prepare_idle(2);
138
139 /* Jump to SRAM suspend code */ 129 /* Jump to SRAM suspend code */
140 omap2_sram_suspend(sdrc_read_reg(SDRC_DLLA_CTRL), 130 omap2_sram_suspend(sdrc_read_reg(SDRC_DLLA_CTRL),
141 OMAP_SDRC_REGADDR(SDRC_DLLA_CTRL), 131 OMAP_SDRC_REGADDR(SDRC_DLLA_CTRL),
142 OMAP_SDRC_REGADDR(SDRC_POWER)); 132 OMAP_SDRC_REGADDR(SDRC_POWER));
143 133
144 omap_uart_resume_idle(2);
145 omap_uart_resume_idle(1);
146 omap_uart_resume_idle(0);
147
148 if (!is_suspending())
149 console_unlock();
150
151no_sleep: 134no_sleep:
152 omap2_gpio_resume_after_idle(); 135 omap2_gpio_resume_after_idle();
153 136
@@ -291,7 +274,6 @@ static int omap2_pm_suspend(void)
291 mir1 = omap_readl(0x480fe0a4); 274 mir1 = omap_readl(0x480fe0a4);
292 omap_writel(1 << 5, 0x480fe0ac); 275 omap_writel(1 << 5, 0x480fe0ac);
293 276
294 omap_uart_prepare_suspend();
295 omap2_enter_full_retention(); 277 omap2_enter_full_retention();
296 278
297 omap_writel(mir1, 0x480fe0a4); 279 omap_writel(mir1, 0x480fe0a4);
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index fa637dfdda5..4feee45ef06 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -28,7 +28,6 @@
28#include <linux/clk.h> 28#include <linux/clk.h>
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/slab.h> 30#include <linux/slab.h>
31#include <linux/console.h>
32#include <trace/events/power.h> 31#include <trace/events/power.h>
33 32
34#include <asm/suspend.h> 33#include <asm/suspend.h>
@@ -54,15 +53,6 @@
54 53
55#ifdef CONFIG_SUSPEND 54#ifdef CONFIG_SUSPEND
56static suspend_state_t suspend_state = PM_SUSPEND_ON; 55static suspend_state_t suspend_state = PM_SUSPEND_ON;
57static inline bool is_suspending(void)
58{
59 return (suspend_state != PM_SUSPEND_ON) && console_suspend_enabled;
60}
61#else
62static inline bool is_suspending(void)
63{
64 return false;
65}
66#endif 56#endif
67 57
68/* pm34xx errata defined in pm.h */ 58/* pm34xx errata defined in pm.h */
@@ -376,20 +366,11 @@ void omap_sram_idle(void)
376 omap3_enable_io_chain(); 366 omap3_enable_io_chain();
377 } 367 }
378 368
379 /* Block console output in case it is on one of the OMAP UARTs */
380 if (!is_suspending())
381 if (per_next_state < PWRDM_POWER_ON ||
382 core_next_state < PWRDM_POWER_ON)
383 if (!console_trylock())
384 goto console_still_active;
385
386 pwrdm_pre_transition(); 369 pwrdm_pre_transition();
387 370
388 /* PER */ 371 /* PER */
389 if (per_next_state < PWRDM_POWER_ON) { 372 if (per_next_state < PWRDM_POWER_ON) {
390 per_going_off = (per_next_state == PWRDM_POWER_OFF) ? 1 : 0; 373 per_going_off = (per_next_state == PWRDM_POWER_OFF) ? 1 : 0;
391 omap_uart_prepare_idle(2);
392 omap_uart_prepare_idle(3);
393 omap2_gpio_prepare_for_idle(per_going_off); 374 omap2_gpio_prepare_for_idle(per_going_off);
394 if (per_next_state == PWRDM_POWER_OFF) 375 if (per_next_state == PWRDM_POWER_OFF)
395 omap3_per_save_context(); 376 omap3_per_save_context();
@@ -397,8 +378,6 @@ void omap_sram_idle(void)
397 378
398 /* CORE */ 379 /* CORE */
399 if (core_next_state < PWRDM_POWER_ON) { 380 if (core_next_state < PWRDM_POWER_ON) {
400 omap_uart_prepare_idle(0);
401 omap_uart_prepare_idle(1);
402 if (core_next_state == PWRDM_POWER_OFF) { 381 if (core_next_state == PWRDM_POWER_OFF) {
403 omap3_core_save_context(); 382 omap3_core_save_context();
404 omap3_cm_save_context(); 383 omap3_cm_save_context();
@@ -447,8 +426,6 @@ void omap_sram_idle(void)
447 omap3_sram_restore_context(); 426 omap3_sram_restore_context();
448 omap2_sms_restore_context(); 427 omap2_sms_restore_context();
449 } 428 }
450 omap_uart_resume_idle(0);
451 omap_uart_resume_idle(1);
452 if (core_next_state == PWRDM_POWER_OFF) 429 if (core_next_state == PWRDM_POWER_OFF)
453 omap2_prm_clear_mod_reg_bits(OMAP3430_AUTO_OFF_MASK, 430 omap2_prm_clear_mod_reg_bits(OMAP3430_AUTO_OFF_MASK,
454 OMAP3430_GR_MOD, 431 OMAP3430_GR_MOD,
@@ -464,14 +441,8 @@ void omap_sram_idle(void)
464 omap2_gpio_resume_after_idle(); 441 omap2_gpio_resume_after_idle();
465 if (per_prev_state == PWRDM_POWER_OFF) 442 if (per_prev_state == PWRDM_POWER_OFF)
466 omap3_per_restore_context(); 443 omap3_per_restore_context();
467 omap_uart_resume_idle(2);
468 omap_uart_resume_idle(3);
469 } 444 }
470 445
471 if (!is_suspending())
472 console_unlock();
473
474console_still_active:
475 /* Disable IO-PAD and IO-CHAIN wakeup */ 446 /* Disable IO-PAD and IO-CHAIN wakeup */
476 if (omap3_has_io_wakeup() && 447 if (omap3_has_io_wakeup() &&
477 (per_next_state < PWRDM_POWER_ON || 448 (per_next_state < PWRDM_POWER_ON ||
@@ -533,7 +504,6 @@ static int omap3_pm_suspend(void)
533 goto restore; 504 goto restore;
534 } 505 }
535 506
536 omap_uart_prepare_suspend();
537 omap3_intc_suspend(); 507 omap3_intc_suspend();
538 508
539 omap_sram_idle(); 509 omap_sram_idle();
@@ -580,14 +550,12 @@ static int omap3_pm_begin(suspend_state_t state)
580{ 550{
581 disable_hlt(); 551 disable_hlt();
582 suspend_state = state; 552 suspend_state = state;
583 omap_uart_enable_irqs(0);
584 return 0; 553 return 0;
585} 554}
586 555
587static void omap3_pm_end(void) 556static void omap3_pm_end(void)
588{ 557{
589 suspend_state = PM_SUSPEND_ON; 558 suspend_state = PM_SUSPEND_ON;
590 omap_uart_enable_irqs(1);
591 enable_hlt(); 559 enable_hlt();
592 return; 560 return;
593} 561}
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index d0f009cbfb5..6378a2a5d6b 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -367,51 +367,6 @@ static void omap_uart_idle_timer(unsigned long data)
367 omap_uart_allow_sleep(uart); 367 omap_uart_allow_sleep(uart);
368} 368}
369 369
370void omap_uart_prepare_idle(int num)
371{
372 struct omap_uart_state *uart;
373
374 list_for_each_entry(uart, &uart_list, node) {
375 if (num == uart->num && uart->can_sleep) {
376 omap_uart_disable_clocks(uart);
377 return;
378 }
379 }
380}
381
382void omap_uart_resume_idle(int num)
383{
384 struct omap_uart_state *uart;
385
386 list_for_each_entry(uart, &uart_list, node) {
387 if (num == uart->num && uart->can_sleep) {
388 omap_uart_enable_clocks(uart);
389
390 /* Check for IO pad wakeup */
391 if (cpu_is_omap34xx() && uart->padconf) {
392 u16 p = omap_ctrl_readw(uart->padconf);
393
394 if (p & OMAP3_PADCONF_WAKEUPEVENT0)
395 omap_uart_block_sleep(uart);
396 }
397
398 /* Check for normal UART wakeup */
399 if (__raw_readl(uart->wk_st) & uart->wk_mask)
400 omap_uart_block_sleep(uart);
401 return;
402 }
403 }
404}
405
406void omap_uart_prepare_suspend(void)
407{
408 struct omap_uart_state *uart;
409
410 list_for_each_entry(uart, &uart_list, node) {
411 omap_uart_allow_sleep(uart);
412 }
413}
414
415int omap_uart_can_sleep(void) 370int omap_uart_can_sleep(void)
416{ 371{
417 struct omap_uart_state *uart; 372 struct omap_uart_state *uart;
@@ -530,26 +485,6 @@ static void omap_uart_idle_init(struct omap_uart_state *uart)
530 WARN_ON(ret); 485 WARN_ON(ret);
531} 486}
532 487
533void omap_uart_enable_irqs(int enable)
534{
535 int ret;
536 struct omap_uart_state *uart;
537
538 list_for_each_entry(uart, &uart_list, node) {
539 if (enable) {
540 pm_runtime_put_sync(&uart->pdev->dev);
541 ret = request_threaded_irq(uart->irq, NULL,
542 omap_uart_interrupt,
543 IRQF_SHARED,
544 "serial idle",
545 (void *)uart);
546 } else {
547 pm_runtime_get_noresume(&uart->pdev->dev);
548 free_irq(uart->irq, (void *)uart);
549 }
550 }
551}
552
553static ssize_t sleep_timeout_show(struct device *dev, 488static ssize_t sleep_timeout_show(struct device *dev,
554 struct device_attribute *attr, 489 struct device_attribute *attr,
555 char *buf) 490 char *buf)
diff --git a/arch/arm/plat-omap/include/plat/serial.h b/arch/arm/plat-omap/include/plat/serial.h
index 6975ee3f521..73d990780da 100644
--- a/arch/arm/plat-omap/include/plat/serial.h
+++ b/arch/arm/plat-omap/include/plat/serial.h
@@ -111,10 +111,6 @@ extern void omap_serial_init(void);
111extern void omap_serial_init_port(struct omap_board_data *bdata); 111extern void omap_serial_init_port(struct omap_board_data *bdata);
112extern int omap_uart_can_sleep(void); 112extern int omap_uart_can_sleep(void);
113extern void omap_uart_check_wakeup(void); 113extern void omap_uart_check_wakeup(void);
114extern void omap_uart_prepare_suspend(void);
115extern void omap_uart_prepare_idle(int num);
116extern void omap_uart_resume_idle(int num);
117extern void omap_uart_enable_irqs(int enable);
118#endif 114#endif
119 115
120#endif 116#endif