]> www.infradead.org Git - users/willy/linux.git/commitdiff
ARM: samsung: move pm check code to drivers/soc
authorArnd Bergmann <arnd@arndb.de>
Thu, 6 Aug 2020 18:20:33 +0000 (20:20 +0200)
committerKrzysztof Kozlowski <krzk@kernel.org>
Wed, 19 Aug 2020 19:23:46 +0000 (21:23 +0200)
This is the only part of plat-samsung that is really
shared between the s3c and s5p ports. Moving it to
drivers/soc/ lets us make them completely independent.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20200806182059.2431-16-krzk@kernel.org
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
arch/arm/mach-s5pv210/Kconfig
arch/arm/plat-samsung/Kconfig
arch/arm/plat-samsung/Makefile
arch/arm/plat-samsung/include/plat/pm-common.h
drivers/soc/samsung/Kconfig
drivers/soc/samsung/Makefile
drivers/soc/samsung/s3c-pm-check.c [moved from arch/arm/plat-samsung/pm-check.c with 99% similarity]
drivers/soc/samsung/s3c-pm-debug.c [moved from arch/arm/plat-samsung/pm-debug.c with 97% similarity]
include/linux/soc/samsung/s3c-pm.h [new file with mode: 0644]

index b3db1191e43778eed2c1c538747c0fdc5973c00f..95d4e828486629b36cb78fe71e38deb30d559b3c 100644 (file)
@@ -17,6 +17,7 @@ config ARCH_S5PV210
        select HAVE_S3C_RTC if RTC_CLASS
        select PINCTRL
        select PINCTRL_EXYNOS
+       select SOC_SAMSUNG
        help
          Samsung S5PV210/S5PC110 series based systems
 
index 920931c3fefd2d8ff9577a80427585fff5d56203..a7cb0db1d5ccf4241848d9ce450e6c8742695c29 100644 (file)
@@ -8,6 +8,7 @@ config PLAT_SAMSUNG
        default y
        select GENERIC_IRQ_CHIP
        select NO_IOPORT_MAP
+       select SOC_SAMSUNG
        help
          Base platform code for all Samsung SoC based systems
 
@@ -234,54 +235,6 @@ config SAMSUNG_PM_GPIO
          pinctrl-samsung driver.
 endif
 
-comment "Power management"
-
-config SAMSUNG_PM_DEBUG
-       bool "Samsung PM Suspend debug"
-       depends on PM && DEBUG_KERNEL
-       depends on PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210
-       depends on DEBUG_S3C24XX_UART || DEBUG_S3C2410_UART
-       help
-         Say Y here if you want verbose debugging from the PM Suspend and
-         Resume code. See <file:Documentation/arm/samsung-s3c24xx/suspend.rst>
-         for more information.
-
-config S3C_PM_DEBUG_LED_SMDK
-       bool "SMDK LED suspend/resume debugging"
-       depends on PM && (MACH_SMDK6410)
-       help
-         Say Y here to enable the use of the SMDK LEDs on the baseboard
-        for debugging of the state of the suspend and resume process.
-
-        Note, this currently only works for S3C64XX based SMDK boards.
-
-config SAMSUNG_PM_CHECK
-       bool "S3C2410 PM Suspend Memory CRC"
-       depends on PM && (PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210)
-       select CRC32
-       help
-         Enable the PM code's memory area checksum over sleep. This option
-         will generate CRCs of all blocks of memory, and store them before
-         going to sleep. The blocks are then checked on resume for any
-         errors.
-
-         Note, this can take several seconds depending on memory size
-         and CPU speed.
-
-         See <file:Documentation/arm/samsung-s3c24xx/suspend.rst>
-
-config SAMSUNG_PM_CHECK_CHUNKSIZE
-       int "S3C2410 PM Suspend CRC Chunksize (KiB)"
-       depends on PM && SAMSUNG_PM_CHECK
-       default 64
-       help
-         Set the chunksize in Kilobytes of the CRC for checking memory
-         corruption over suspend and resume. A smaller value will mean that
-         the CRC data block will take more memory, but will identify any
-         faults with better precision.
-
-         See <file:Documentation/arm/samsung-s3c24xx/suspend.rst>
-
 config SAMSUNG_WAKEMASK
        bool
        depends on PM
index d8a80fbcebb3fd60fe8cbdf7b2a5216ffae63b26..c47f58ed83e2da1ecba0152e308380f58be67c8f 100644 (file)
@@ -27,7 +27,5 @@ obj-$(CONFIG_GPIO_SAMSUNG)     += gpio-samsung.o
 obj-$(CONFIG_PM_SLEEP)         += pm-common.o
 obj-$(CONFIG_SAMSUNG_PM)       += pm.o
 obj-$(CONFIG_SAMSUNG_PM_GPIO)  += pm-gpio.o
-obj-$(CONFIG_SAMSUNG_PM_CHECK) += pm-check.o
-obj-$(CONFIG_SAMSUNG_PM_DEBUG) += pm-debug.o
 
 obj-$(CONFIG_SAMSUNG_WAKEMASK) += wakeup-mask.o
index 87fa97fd6e8bfd957b35c5dd247f5a781999f26b..18b9607e1e39b1ce8f7973b27f03be220f8e6538 100644 (file)
@@ -11,6 +11,7 @@
 #define __PLAT_SAMSUNG_PM_COMMON_H __FILE__
 
 #include <linux/irq.h>
+#include <linux/soc/samsung/s3c-pm.h>
 
 /* sleep save info */
 
@@ -36,73 +37,4 @@ extern void s3c_pm_do_save(struct sleep_save *ptr, int count);
 extern void s3c_pm_do_restore(const struct sleep_save *ptr, int count);
 extern void s3c_pm_do_restore_core(const struct sleep_save *ptr, int count);
 
-/* PM debug functions */
-
-/**
- * struct pm_uart_save - save block for core UART
- * @ulcon: Save value for S3C2410_ULCON
- * @ucon: Save value for S3C2410_UCON
- * @ufcon: Save value for S3C2410_UFCON
- * @umcon: Save value for S3C2410_UMCON
- * @ubrdiv: Save value for S3C2410_UBRDIV
- *
- * Save block for UART registers to be held over sleep and restored if they
- * are needed (say by debug).
-*/
-struct pm_uart_save {
-       u32     ulcon;
-       u32     ucon;
-       u32     ufcon;
-       u32     umcon;
-       u32     ubrdiv;
-       u32     udivslot;
-};
-
-#ifdef CONFIG_SAMSUNG_PM_DEBUG
-/**
- * s3c_pm_dbg() - low level debug function for use in suspend/resume.
- * @msg: The message to print.
- *
- * This function is used mainly to debug the resume process before the system
- * can rely on printk/console output. It uses the low-level debugging output
- * routine printascii() to do its work.
- */
-extern void s3c_pm_dbg(const char *msg, ...);
-
-#define S3C_PMDBG(fmt...) s3c_pm_dbg(fmt)
-
-extern void s3c_pm_save_uarts(bool is_s3c24xx);
-extern void s3c_pm_restore_uarts(bool is_s3c24xx);
-
-#ifdef CONFIG_ARCH_S3C64XX
-extern void s3c_pm_arch_update_uart(void __iomem *regs,
-                                   struct pm_uart_save *save);
-#else
-static inline void
-s3c_pm_arch_update_uart(void __iomem *regs, struct pm_uart_save *save)
-{
-}
-#endif
-
-#else
-#define S3C_PMDBG(fmt...) pr_debug(fmt)
-
-static inline void s3c_pm_save_uarts(bool is_s3c24xx) { }
-static inline void s3c_pm_restore_uarts(bool is_s3c24xx) { }
-#endif
-
-/* suspend memory checking */
-
-#ifdef CONFIG_SAMSUNG_PM_CHECK
-extern void s3c_pm_check_prepare(void);
-extern void s3c_pm_check_restore(void);
-extern void s3c_pm_check_cleanup(void);
-extern void s3c_pm_check_store(void);
-#else
-#define s3c_pm_check_prepare() do { } while (0)
-#define s3c_pm_check_restore() do { } while (0)
-#define s3c_pm_check_cleanup() do { } while (0)
-#define s3c_pm_check_store()   do { } while (0)
-#endif
-
 #endif
index 264185664594717e1d6e4e9c90463a3e8600417a..5abe82079d2e0a1bbc8f7b4703a46f14e379eb1e 100644 (file)
@@ -35,7 +35,53 @@ config EXYNOS_PMU_ARM_DRIVERS
 
 config EXYNOS_PM_DOMAINS
        bool "Exynos PM domains" if COMPILE_TEST
-       depends on PM_GENERIC_DOMAINS || COMPILE_TEST
+       depends on (ARCH_EXYNOS && PM_GENERIC_DOMAINS) || COMPILE_TEST
+
+config SAMSUNG_PM_DEBUG
+       bool "Samsung PM Suspend debug"
+       depends on PM && DEBUG_KERNEL
+       depends on PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210
+       depends on DEBUG_S3C24XX_UART || DEBUG_S3C2410_UART
+       help
+         Say Y here if you want verbose debugging from the PM Suspend and
+         Resume code. See <file:Documentation/arm/samsung-s3c24xx/suspend.rst>
+         for more information.
+
+config S3C_PM_DEBUG_LED_SMDK
+       bool "SMDK LED suspend/resume debugging"
+       depends on PM && (MACH_SMDK6410)
+       help
+         Say Y here to enable the use of the SMDK LEDs on the baseboard
+        for debugging of the state of the suspend and resume process.
+
+        Note, this currently only works for S3C64XX based SMDK boards.
+
+config SAMSUNG_PM_CHECK
+       bool "S3C2410 PM Suspend Memory CRC"
+       depends on PM && (PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210)
+       select CRC32
+       help
+         Enable the PM code's memory area checksum over sleep. This option
+         will generate CRCs of all blocks of memory, and store them before
+         going to sleep. The blocks are then checked on resume for any
+         errors.
+
+         Note, this can take several seconds depending on memory size
+         and CPU speed.
+
+         See <file:Documentation/arm/samsung-s3c24xx/suspend.rst>
+
+config SAMSUNG_PM_CHECK_CHUNKSIZE
+       int "S3C2410 PM Suspend CRC Chunksize (KiB)"
+       depends on PM && SAMSUNG_PM_CHECK
+       default 64
+       help
+         Set the chunksize in Kilobytes of the CRC for checking memory
+         corruption over suspend and resume. A smaller value will mean that
+         the CRC data block will take more memory, but will identify any
+         faults with better precision.
+
+         See <file:Documentation/arm/samsung-s3c24xx/suspend.rst>
 
 config EXYNOS_REGULATOR_COUPLER
        bool "Exynos SoC Regulator Coupler" if COMPILE_TEST
index ecc3a32f640680c5b5e0e1c9eb90fef73f37a8e9..59e8e9453f27cd768106c512ce701857a606d9ee 100644 (file)
@@ -10,3 +10,6 @@ obj-$(CONFIG_EXYNOS_PMU_ARM_DRIVERS)  += exynos3250-pmu.o exynos4-pmu.o \
                                        exynos5250-pmu.o exynos5420-pmu.o
 obj-$(CONFIG_EXYNOS_PM_DOMAINS) += pm_domains.o
 obj-$(CONFIG_EXYNOS_REGULATOR_COUPLER) += exynos-regulator-coupler.o
+
+obj-$(CONFIG_SAMSUNG_PM_CHECK) += s3c-pm-check.o
+obj-$(CONFIG_SAMSUNG_PM_DEBUG) += s3c-pm-debug.o
similarity index 99%
rename from arch/arm/plat-samsung/pm-check.c
rename to drivers/soc/samsung/s3c-pm-check.c
index cd2c02c68bc3aa1ace7a584b2591886bedc81c1d..ff3e099fc2080a229d543cfa95e3dca876d367f6 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/ioport.h>
 #include <linux/slab.h>
 
-#include <plat/pm-common.h>
+#include <linux/soc/samsung/s3c-pm.h>
 
 #if CONFIG_SAMSUNG_PM_CHECK_CHUNKSIZE < 1
 #error CONFIG_SAMSUNG_PM_CHECK_CHUNKSIZE must be a positive non-zero value
similarity index 97%
rename from arch/arm/plat-samsung/pm-debug.c
rename to drivers/soc/samsung/s3c-pm-debug.c
index 482d53753e9304b01f1c21a0389fa5c14ded83bd..b5ce0e9a41e58462adebb7cee71a0057c7f7f7c6 100644 (file)
@@ -15,8 +15,7 @@
 
 #include <asm/mach/map.h>
 
-#include <plat/cpu.h>
-#include <plat/pm-common.h>
+#include <linux/soc/samsung/s3c-pm.h>
 
 static struct pm_uart_save uart_save;
 
diff --git a/include/linux/soc/samsung/s3c-pm.h b/include/linux/soc/samsung/s3c-pm.h
new file mode 100644 (file)
index 0000000..730bd1d
--- /dev/null
@@ -0,0 +1,84 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd.
+ *     Tomasz Figa <t.figa@samsung.com>
+ * Copyright (c) 2004 Simtec Electronics
+ *     http://armlinux.simtec.co.uk/
+ *     Written by Ben Dooks, <ben@simtec.co.uk>
+ */
+
+#ifndef __LINUX_SOC_SAMSUNG_S3C_PM_H
+#define __LINUX_SOC_SAMSUNG_S3C_PM_H __FILE__
+
+#include <linux/types.h>
+
+/* PM debug functions */
+
+/**
+ * struct pm_uart_save - save block for core UART
+ * @ulcon: Save value for S3C2410_ULCON
+ * @ucon: Save value for S3C2410_UCON
+ * @ufcon: Save value for S3C2410_UFCON
+ * @umcon: Save value for S3C2410_UMCON
+ * @ubrdiv: Save value for S3C2410_UBRDIV
+ *
+ * Save block for UART registers to be held over sleep and restored if they
+ * are needed (say by debug).
+*/
+struct pm_uart_save {
+       u32     ulcon;
+       u32     ucon;
+       u32     ufcon;
+       u32     umcon;
+       u32     ubrdiv;
+       u32     udivslot;
+};
+
+#ifdef CONFIG_SAMSUNG_PM_DEBUG
+/**
+ * s3c_pm_dbg() - low level debug function for use in suspend/resume.
+ * @msg: The message to print.
+ *
+ * This function is used mainly to debug the resume process before the system
+ * can rely on printk/console output. It uses the low-level debugging output
+ * routine printascii() to do its work.
+ */
+extern void s3c_pm_dbg(const char *msg, ...);
+
+#define S3C_PMDBG(fmt...) s3c_pm_dbg(fmt)
+
+extern void s3c_pm_save_uarts(bool is_s3c24xx);
+extern void s3c_pm_restore_uarts(bool is_s3c24xx);
+
+#ifdef CONFIG_ARCH_S3C64XX
+extern void s3c_pm_arch_update_uart(void __iomem *regs,
+                                   struct pm_uart_save *save);
+#else
+static inline void
+s3c_pm_arch_update_uart(void __iomem *regs, struct pm_uart_save *save)
+{
+}
+#endif
+
+#else
+#define S3C_PMDBG(fmt...) pr_debug(fmt)
+
+static inline void s3c_pm_save_uarts(bool is_s3c24xx) { }
+static inline void s3c_pm_restore_uarts(bool is_s3c24xx) { }
+#endif
+
+/* suspend memory checking */
+
+#ifdef CONFIG_SAMSUNG_PM_CHECK
+extern void s3c_pm_check_prepare(void);
+extern void s3c_pm_check_restore(void);
+extern void s3c_pm_check_cleanup(void);
+extern void s3c_pm_check_store(void);
+#else
+#define s3c_pm_check_prepare() do { } while (0)
+#define s3c_pm_check_restore() do { } while (0)
+#define s3c_pm_check_cleanup() do { } while (0)
+#define s3c_pm_check_store()   do { } while (0)
+#endif
+
+#endif