]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
ARM: s5pv210: use private pm save/restore
authorArnd Bergmann <arnd@arndb.de>
Thu, 6 Aug 2020 18:20:34 +0000 (20:20 +0200)
committerKrzysztof Kozlowski <krzk@kernel.org>
Wed, 19 Aug 2020 19:33:11 +0000 (21:33 +0200)
The pm save/restore code is fairly small, so in order to
separate the s3c and s5p platforms, adding an s5p specific
copy instead of sharing it is actually easier.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20200806182059.2431-17-krzk@kernel.org
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
arch/arm/mach-s5pv210/Makefile
arch/arm/mach-s5pv210/pm.c
arch/arm/mach-s5pv210/regs-clock.h
arch/arm/mach-s5pv210/s5pv210.c
arch/arm/plat-samsung/Makefile

index e7b551e18e5c37c3c09a0c0e8723e62f3661b95c..aa0a1f091dafe0bcba53b3b94f9b07c9e2c1f9c3 100644 (file)
@@ -3,12 +3,5 @@
 # Copyright (c) 2010 Samsung Electronics Co., Ltd.
 #              http://www.samsung.com/
 
-ccflags-$(CONFIG_ARCH_MULTIPLATFORM) += -I$(srctree)/arch/arm/plat-samsung/include
-
-# Core
-
 obj-$(CONFIG_PM_SLEEP)         += pm.o sleep.o
-
-# machine support
-
 obj-y                          += s5pv210.o
index efdb5a27c060e50c64b40dfa79c82f8d23b1673a..d59c094cdea8bad55171c2fa22af5644b4aa3453 100644 (file)
 #include <linux/suspend.h>
 #include <linux/syscore_ops.h>
 #include <linux/io.h>
+#include <linux/soc/samsung/s3c-pm.h>
 
 #include <asm/cacheflush.h>
 #include <asm/suspend.h>
 
-#include <plat/pm-common.h>
-
 #include "common.h"
 #include "regs-clock.h"
 
+/* helper functions to save and restore register state */
+struct sleep_save {
+       void __iomem    *reg;
+       unsigned long   val;
+};
+
+#define SAVE_ITEM(x) \
+       { .reg = (x) }
+
+/**
+ * s3c_pm_do_save() - save a set of registers for restoration on resume.
+ * @ptr: Pointer to an array of registers.
+ * @count: Size of the ptr array.
+ *
+ * Run through the list of registers given, saving their contents in the
+ * array for later restoration when we wakeup.
+ */
+static void s3c_pm_do_save(struct sleep_save *ptr, int count)
+{
+       for (; count > 0; count--, ptr++) {
+               ptr->val = readl_relaxed(ptr->reg);
+               S3C_PMDBG("saved %p value %08lx\n", ptr->reg, ptr->val);
+       }
+}
+
+/**
+ * s3c_pm_do_restore() - restore register values from the save list.
+ * @ptr: Pointer to an array of registers.
+ * @count: Size of the ptr array.
+ *
+ * Restore the register values saved from s3c_pm_do_save().
+ *
+ * WARNING: Do not put any debug in here that may effect memory or use
+ * peripherals, as things may be changing!
+*/
+
+static void s3c_pm_do_restore_core(const struct sleep_save *ptr, int count)
+{
+       for (; count > 0; count--, ptr++)
+               writel_relaxed(ptr->val, ptr->reg);
+}
+
 static struct sleep_save s5pv210_core_save[] = {
        /* Clock ETC */
        SAVE_ITEM(S5P_MDNIE_SEL),
index 2a35c831a9b065d9b4907bcb63572a68fd283c90..9cad2306e470063cc87438ae1fc12ff6a0bdfae6 100644 (file)
@@ -9,7 +9,9 @@
 #ifndef __ASM_ARCH_REGS_CLOCK_H
 #define __ASM_ARCH_REGS_CLOCK_H __FILE__
 
-#include <plat/map-base.h>
+#define S3C_ADDR_BASE          0xF6000000
+#define S3C_ADDR(x)            ((void __iomem __force *)S3C_ADDR_BASE + (x))
+#define S3C_VA_SYS             S3C_ADDR(0x00100000)
 
 #define S5P_CLKREG(x)          (S3C_VA_SYS + (x))
 
index 868f9c20419dba3fa72d18f6eaa0f0cf503c817a..a21ed3bb992a0df68ea2d93cfbed99b0250a226a 100644 (file)
@@ -13,8 +13,6 @@
 #include <asm/mach/map.h>
 #include <asm/system_misc.h>
 
-#include <plat/map-base.h>
-
 #include "common.h"
 #include "regs-clock.h"
 
index c47f58ed83e2da1ecba0152e308380f58be67c8f..feddb42cae519a6c8f77f6ea4e267d49c575bb6d 100644 (file)
@@ -24,8 +24,7 @@ obj-$(CONFIG_GPIO_SAMSUNG)     += gpio-samsung.o
 
 # PM support
 
-obj-$(CONFIG_PM_SLEEP)         += pm-common.o
-obj-$(CONFIG_SAMSUNG_PM)       += pm.o
+obj-$(CONFIG_SAMSUNG_PM)       += pm.o pm-common.o
 obj-$(CONFIG_SAMSUNG_PM_GPIO)  += pm-gpio.o
 
 obj-$(CONFIG_SAMSUNG_WAKEMASK) += wakeup-mask.o