treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / arch / arm / mach-s3c24xx / include / mach / pm-core.h
blob5e4ce89d01582d719a68a0e4d998bca4b45ed212
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Copyright 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/
7 * S3C24xx - PM core support for arch/arm/plat-s3c/pm.c
8 */
10 #include <linux/delay.h>
11 #include <linux/io.h>
13 #include "regs-clock.h"
14 #include "regs-irq.h"
16 static inline void s3c_pm_debug_init_uart(void)
18 unsigned long tmp = __raw_readl(S3C2410_CLKCON);
20 /* re-start uart clocks */
21 tmp |= S3C2410_CLKCON_UART0;
22 tmp |= S3C2410_CLKCON_UART1;
23 tmp |= S3C2410_CLKCON_UART2;
25 __raw_writel(tmp, S3C2410_CLKCON);
26 udelay(10);
29 static inline void s3c_pm_arch_prepare_irqs(void)
31 __raw_writel(s3c_irqwake_intmask, S3C2410_INTMSK);
32 __raw_writel(s3c_irqwake_eintmask, S3C2410_EINTMASK);
34 /* ack any outstanding external interrupts before we go to sleep */
36 __raw_writel(__raw_readl(S3C2410_EINTPEND), S3C2410_EINTPEND);
37 __raw_writel(__raw_readl(S3C2410_INTPND), S3C2410_INTPND);
38 __raw_writel(__raw_readl(S3C2410_SRCPND), S3C2410_SRCPND);
42 static inline void s3c_pm_arch_stop_clocks(void)
44 __raw_writel(0x00, S3C2410_CLKCON); /* turn off clocks over sleep */
47 /* s3c2410_pm_show_resume_irqs
49 * print any IRQs asserted at resume time (ie, we woke from)
51 static inline void s3c_pm_show_resume_irqs(int start, unsigned long which,
52 unsigned long mask)
54 int i;
56 which &= ~mask;
58 for (i = 0; i <= 31; i++) {
59 if (which & (1L<<i)) {
60 S3C_PMDBG("IRQ %d asserted at resume\n", start+i);
65 static inline void s3c_pm_arch_show_resume_irqs(void)
67 S3C_PMDBG("post sleep: IRQs 0x%08x, 0x%08x\n",
68 __raw_readl(S3C2410_SRCPND),
69 __raw_readl(S3C2410_EINTPEND));
71 s3c_pm_show_resume_irqs(IRQ_EINT0, __raw_readl(S3C2410_SRCPND),
72 s3c_irqwake_intmask);
74 s3c_pm_show_resume_irqs(IRQ_EINT4-4, __raw_readl(S3C2410_EINTPEND),
75 s3c_irqwake_eintmask);
78 static inline void s3c_pm_arch_update_uart(void __iomem *regs,
79 struct pm_uart_save *save)
83 static inline void s3c_pm_restored_gpios(void) { }
84 static inline void samsung_pm_saved_gpios(void) { }
86 /* state for IRQs over sleep */
88 /* default is to allow for EINT0..EINT15, and IRQ_RTC as wakeup sources
90 * set bit to 1 in allow bitfield to enable the wakeup settings on it
92 #ifdef CONFIG_PM_SLEEP
93 #define s3c_irqwake_intallow (1L << 30 | 0xfL)
94 #define s3c_irqwake_eintallow (0x0000fff0L)
95 #else
96 #define s3c_irqwake_eintallow 0
97 #define s3c_irqwake_intallow 0
98 #endif