From 5d1646d90e1f2cceb9f0828f4b28318cd0ec7744 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 12:05:51 +0200 Subject: Adding upstream version 5.10.209. Signed-off-by: Daniel Baumann --- arch/arm/mach-s3c/pm-s3c24xx.c | 121 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 arch/arm/mach-s3c/pm-s3c24xx.c (limited to 'arch/arm/mach-s3c/pm-s3c24xx.c') diff --git a/arch/arm/mach-s3c/pm-s3c24xx.c b/arch/arm/mach-s3c/pm-s3c24xx.c new file mode 100644 index 000000000..3a8f5c388 --- /dev/null +++ b/arch/arm/mach-s3c/pm-s3c24xx.c @@ -0,0 +1,121 @@ +// SPDX-License-Identifier: GPL-2.0+ +// +// Copyright (c) 2004-2006 Simtec Electronics +// Ben Dooks +// +// S3C24XX Power Manager (Suspend-To-RAM) support +// +// See Documentation/arm/samsung-s3c24xx/suspend.rst for more information +// +// Parts based on arch/arm/mach-pxa/pm.c +// +// Thanks to Dimitry Andric for debugging + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "regs-clock.h" +#include "regs-gpio.h" +#include "regs-irq.h" +#include "gpio-samsung.h" + +#include + +#include "gpio-cfg.h" +#include "pm.h" + +#include "regs-mem-s3c24xx.h" + +#define PFX "s3c24xx-pm: " + +#ifdef CONFIG_PM_SLEEP +static struct sleep_save core_save[] = { + /* we restore the timings here, with the proviso that the board + * brings the system up in an slower, or equal frequency setting + * to the original system. + * + * if we cannot guarantee this, then things are going to go very + * wrong here, as we modify the refresh and both pll settings. + */ + + SAVE_ITEM(S3C2410_BWSCON), + SAVE_ITEM(S3C2410_BANKCON0), + SAVE_ITEM(S3C2410_BANKCON1), + SAVE_ITEM(S3C2410_BANKCON2), + SAVE_ITEM(S3C2410_BANKCON3), + SAVE_ITEM(S3C2410_BANKCON4), + SAVE_ITEM(S3C2410_BANKCON5), +}; +#endif + +/* s3c_pm_check_resume_pin + * + * check to see if the pin is configured correctly for sleep mode, and + * make any necessary adjustments if it is not +*/ + +static void s3c_pm_check_resume_pin(unsigned int pin, unsigned int irqoffs) +{ + unsigned long irqstate; + unsigned long pinstate; + int irq = gpio_to_irq(pin); + + if (irqoffs < 4) + irqstate = s3c_irqwake_intmask & (1L<