aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-samsung/pm.c
diff options
context:
space:
mode:
authorTomasz Figa <t.figa@samsung.com>2014-03-17 18:28:09 -0400
committerKukjin Kim <kgene.kim@samsung.com>2014-03-20 15:09:16 -0400
commit72551f6cf13e2f3a1d273b7007b5d7d7fd69c554 (patch)
treeebc79635f3b76e22d614297953608239b672fee4 /arch/arm/plat-samsung/pm.c
parentd38688a69fd88269eae3c7c66ec34fb02fb04fd1 (diff)
ARM: SAMSUNG: Move Samsung PM debug code into separate file
Not all Samsung SoC platforms are going to use the legacy Samsung PM code enabled by CONFIG_SAMSUNG_PM_DEBUG. To allow using Samsung PM debug helpers on such platforms, related code is moved to separate file and a plat/pm-common.h header is added to separate legacy and generic code. Signed-off-by: Tomasz Figa <t.figa@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch/arm/plat-samsung/pm.c')
-rw-r--r--arch/arm/plat-samsung/pm.c84
1 files changed, 0 insertions, 84 deletions
diff --git a/arch/arm/plat-samsung/pm.c b/arch/arm/plat-samsung/pm.c
index dd70337822da..3d523c90202a 100644
--- a/arch/arm/plat-samsung/pm.c
+++ b/arch/arm/plat-samsung/pm.c
@@ -17,16 +17,12 @@
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/delay.h> 18#include <linux/delay.h>
19#include <linux/of.h> 19#include <linux/of.h>
20#include <linux/serial_core.h>
21#include <linux/serial_s3c.h> 20#include <linux/serial_s3c.h>
22#include <linux/io.h> 21#include <linux/io.h>
23 22
24#include <asm/cacheflush.h> 23#include <asm/cacheflush.h>
25#include <asm/mach/map.h>
26#include <asm/suspend.h> 24#include <asm/suspend.h>
27 25
28#include <plat/cpu.h>
29
30#ifdef CONFIG_SAMSUNG_ATAGS 26#ifdef CONFIG_SAMSUNG_ATAGS
31#include <mach/hardware.h> 27#include <mach/hardware.h>
32#include <mach/map.h> 28#include <mach/map.h>
@@ -46,86 +42,6 @@
46 42
47unsigned long s3c_pm_flags; 43unsigned long s3c_pm_flags;
48 44
49/* Debug code:
50 *
51 * This code supports debug output to the low level UARTs for use on
52 * resume before the console layer is available.
53*/
54
55#ifdef CONFIG_SAMSUNG_PM_DEBUG
56extern void printascii(const char *);
57
58void s3c_pm_dbg(const char *fmt, ...)
59{
60 va_list va;
61 char buff[256];
62
63 va_start(va, fmt);
64 vsnprintf(buff, sizeof(buff), fmt, va);
65 va_end(va);
66
67 printascii(buff);
68}
69
70static inline void s3c_pm_debug_init(void)
71{
72 /* restart uart clocks so we can use them to output */
73 s3c_pm_debug_init_uart();
74}
75
76static struct pm_uart_save uart_save;
77
78static inline void __iomem *s3c_pm_uart_base(void)
79{
80 unsigned long paddr;
81 unsigned long vaddr;
82
83 debug_ll_addr(&paddr, &vaddr);
84
85 return (void __iomem *)vaddr;
86}
87
88static void s3c_pm_save_uarts(void)
89{
90 void __iomem *regs = s3c_pm_uart_base();
91 struct pm_uart_save *save = &uart_save;
92
93 save->ulcon = __raw_readl(regs + S3C2410_ULCON);
94 save->ucon = __raw_readl(regs + S3C2410_UCON);
95 save->ufcon = __raw_readl(regs + S3C2410_UFCON);
96 save->umcon = __raw_readl(regs + S3C2410_UMCON);
97 save->ubrdiv = __raw_readl(regs + S3C2410_UBRDIV);
98
99 if (!soc_is_s3c2410())
100 save->udivslot = __raw_readl(regs + S3C2443_DIVSLOT);
101
102 S3C_PMDBG("UART[%p]: ULCON=%04x, UCON=%04x, UFCON=%04x, UBRDIV=%04x\n",
103 regs, save->ulcon, save->ucon, save->ufcon, save->ubrdiv);
104}
105
106static void s3c_pm_restore_uarts(void)
107{
108 void __iomem *regs = s3c_pm_uart_base();
109 struct pm_uart_save *save = &uart_save;
110
111 s3c_pm_arch_update_uart(regs, save);
112
113 __raw_writel(save->ulcon, regs + S3C2410_ULCON);
114 __raw_writel(save->ucon, regs + S3C2410_UCON);
115 __raw_writel(save->ufcon, regs + S3C2410_UFCON);
116 __raw_writel(save->umcon, regs + S3C2410_UMCON);
117 __raw_writel(save->ubrdiv, regs + S3C2410_UBRDIV);
118
119 if (!soc_is_s3c2410())
120 __raw_writel(save->udivslot, regs + S3C2443_DIVSLOT);
121}
122#else
123#define s3c_pm_debug_init() do { } while (0)
124
125static void s3c_pm_save_uarts(void) { }
126static void s3c_pm_restore_uarts(void) { }
127#endif
128
129/* The IRQ ext-int code goes here, it is too small to currently bother 45/* The IRQ ext-int code goes here, it is too small to currently bother
130 * with its own file. */ 46 * with its own file. */
131 47