]> xenbits.xensource.com Git - people/aperard/linux-chromebook.git/commitdiff
CHROMIUM: serial: exynos: Resume UART earlier with SAMSUNG_PM_DEBUG
authorMichael Spang <spang@chromium.org>
Fri, 9 Nov 2012 19:33:47 +0000 (14:33 -0500)
committerGerrit <chrome-bot@google.com>
Thu, 6 Dec 2012 16:26:58 +0000 (08:26 -0800)
Even with SAMSUNG_PM_DEBUG enabled, we're losing lots of console UART
output during resume. This patch makes SAMSUNG_PM_DEBUG correcly
resume the UART as early as possible, so that no output is lost.

BUG=chrome-os-partner:10932
TEST=powerd_suspend with no_console_suspend and SAMSUNG_PM_DEBUG

Change-Id: Ic892ed225c9075e8d72d851a4f2e22263ee6047d
Signed-off-by: Michael Spang <spang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/37734
Reviewed-by: Jon Kliegman <kliegs@chromium.org>
arch/arm/mach-exynos/include/mach/pm-core.h
arch/arm/mach-exynos/include/mach/regs-pmu.h
arch/arm/mach-exynos/pmu.c
arch/arm/mach-s3c24xx/include/mach/pm-core.h
arch/arm/mach-s3c64xx/include/mach/pm-core.h
arch/arm/mach-s5p64x0/include/mach/pm-core.h
arch/arm/mach-s5pv210/include/mach/pm-core.h
arch/arm/plat-samsung/pm.c

index 7dbbfec13ea5b786c57f0ae989ca4fde6ad54f1a..360e8f64c36ad2a881955de152921e17e601bd86 100644 (file)
 #ifndef __ASM_ARCH_PM_CORE_H
 #define __ASM_ARCH_PM_CORE_H __FILE__
 
+#include <linux/delay.h>
+#include <linux/gpio.h>
 #include <mach/regs-pmu.h>
+#include <plat/gpio-cfg.h>
+#include <plat/gpio-core.h>
 
 static inline void s3c_pm_debug_init_uart(void)
 {
        /* nothing here yet */
 }
 
+#ifdef CONFIG_SAMSUNG_PM_DEBUG
+
+static inline void s3c_pm_arch_restore_uarts(void)
+{
+       if (soc_is_exynos5250()) {
+               WARN_ON_ONCE(!(__raw_readl(S5P_PAD_RET_UART_OPTION) &
+                              EXYNOS5_PAD_RET_UART_AUTOMATIC_WAKEUP));
+
+               /* force gpio pins GPA1(4) and GPA1(5) to UART3 mode */
+               s3c_gpio_cfgpin(EXYNOS5_GPA1(4), S3C_GPIO_SPECIAL(2));
+               s3c_gpio_cfgpin(EXYNOS5_GPA1(5), S3C_GPIO_SPECIAL(2));
+
+               /* wait for things to settle */
+               mdelay(1);
+       }
+}
+
+#endif
+
 static inline void s3c_pm_arch_prepare_irqs(void)
 {
        __raw_writel(s3c_irqwake_eintmask, S5P_EINT_WAKEUP_MASK);
index ed99e6c09c85e419b2a9c81e6278c5c21098d703..e3b2302656f7d77592f98d744cb959f036ef9388 100644 (file)
 
 #define S5P_PAD_RET_MAUDIO_OPTION              S5P_PMUREG(0x3028)
 #define S5P_PAD_RET_GPIO_OPTION                        S5P_PMUREG(0x3108)
+#define S5P_PAD_RET_UART_STATUS                        S5P_PMUREG(0x3124)
 #define S5P_PAD_RET_UART_OPTION                        S5P_PMUREG(0x3128)
 #define S5P_PAD_RET_MMCA_OPTION                        S5P_PMUREG(0x3148)
 #define S5P_PAD_RET_MMCB_OPTION                        S5P_PMUREG(0x3168)
 
 #define EXYNOS5_OPTION_USE_RETENTION                           (1 << 4)
 
+#define EXYNOS5_PAD_RET_UART_AUTOMATIC_WAKEUP                  (1 << 29)
+
 #define EXYNOS5_SYS_I2C_CFG                                    S5P_SYSREG(0x234)
 #define EXYNOS5_SYS_DISP1BLK_CFG               S5P_SYSREG(0x214)
 #define ENABLE_FIMDBYPASS_DISP1                        (1 << 15)
index fadaaf51b11d04d592bd9abff6d3eb957f8dd689..8c3824d846716ffebfc521b323c0fbf65e36abc6 100644 (file)
@@ -349,6 +349,18 @@ static void exynos5_power_off(void)
                ;
 }
 
+static void exynos5_debug_enable_uart_wakeup(void)
+{
+#ifdef CONFIG_SAMSUNG_PM_DEBUG
+       unsigned int tmp;
+
+       /* Enable UART automatic wakeup for resume console output */
+       tmp = __raw_readl(S5P_PAD_RET_UART_OPTION);
+       tmp |= EXYNOS5_PAD_RET_UART_AUTOMATIC_WAKEUP;
+       __raw_writel(tmp, S5P_PAD_RET_UART_OPTION);
+#endif
+}
+
 static void exynos5_init_pmu(void)
 {
        unsigned int i;
@@ -382,6 +394,8 @@ static void exynos5_init_pmu(void)
                         EXYNOS5_OPTION_USE_STANDBYWFI);
                __raw_writel(tmp, exynos5_list_diable_wfi_wfe[i]);
        }
+
+       exynos5_debug_enable_uart_wakeup();
 }
 
 void exynos4_sys_powerdown_conf(enum sys_powerdown mode)
index 2eef7e6f76758497094c1b0fe8865b0ee34cda2a..01718f4c1b1018d56227e7b150ac5f8c2bd785b1 100644 (file)
@@ -24,6 +24,15 @@ static inline void s3c_pm_debug_init_uart(void)
        udelay(10);
 }
 
+#ifdef CONFIG_SAMSUNG_PM_DEBUG
+
+static inline void s3c_pm_arch_restore_uarts(void)
+{
+       /* nothing here yet */
+}
+
+#endif
+
 static inline void s3c_pm_arch_prepare_irqs(void)
 {
        __raw_writel(s3c_irqwake_intmask, S3C2410_INTMSK);
index fcf3dcabb6944678e9dfabd5cbc67a3e490deade..307cff5256386fc57aac13d136152c41f4981862 100644 (file)
@@ -33,6 +33,15 @@ static inline void s3c_pm_debug_init_uart(void)
        udelay(10);
 }
 
+#ifdef CONFIG_SAMSUNG_PM_DEBUG
+
+static inline void s3c_pm_arch_restore_uarts(void)
+{
+       /* nothing here yet */
+}
+
+#endif
+
 static inline void s3c_pm_arch_prepare_irqs(void)
 {
        /* VIC should have already been taken care of */
index e52f7545d3aa6d4b3927f6d9e4e7ed8daddcb70a..230d451e2595e7b6e919b3a736b884993af2d827 100644 (file)
@@ -33,6 +33,15 @@ static inline void s3c_pm_debug_init_uart(void)
        udelay(10);
 }
 
+#ifdef CONFIG_SAMSUNG_PM_DEBUG
+
+static inline void s3c_pm_arch_restore_uarts(void)
+{
+       /* nothing here yet */
+}
+
+#endif
+
 static inline void s3c_pm_arch_prepare_irqs(void)
 {
        /* VIC should have already been taken care of */
index eba8aea63ed8f928b09f9d56a8486d666e31e302..457438093761dda69d5ece46244e238245ef186e 100644 (file)
@@ -20,6 +20,15 @@ static inline void s3c_pm_debug_init_uart(void)
        /* nothing here yet */
 }
 
+#ifdef CONFIG_SAMSUNG_PM_DEBUG
+
+static inline void s3c_pm_arch_restore_uarts(void)
+{
+       /* nothing here yet */
+}
+
+#endif
+
 static inline void s3c_pm_arch_prepare_irqs(void)
 {
        __raw_writel(s3c_irqwake_intmask, S5P_WAKEUP_MASK);
index a4336a5faa3b17586f0fab1dd4084eb41294bb67..76962d2a19b5052c2aae660c4d8e370fdf332f8b 100644 (file)
@@ -125,6 +125,8 @@ static void s3c_pm_restore_uarts(void)
 
        for (uart = 0; uart < CONFIG_SERIAL_SAMSUNG_UARTS; uart++, save++)
                s3c_pm_restore_uart(uart, save);
+
+       s3c_pm_arch_restore_uarts();
 }
 
 static void s3c_pm_drain_uart(int uart)