Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: samsung: move pm check code to drivers/soc

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>

authored by

Arnd Bergmann and committed by
Krzysztof Kozlowski
17132da7 cb6c0301

+139 -123
+1
arch/arm/mach-s5pv210/Kconfig
··· 17 17 select HAVE_S3C_RTC if RTC_CLASS 18 18 select PINCTRL 19 19 select PINCTRL_EXYNOS 20 + select SOC_SAMSUNG 20 21 help 21 22 Samsung S5PV210/S5PC110 series based systems 22 23
+1 -48
arch/arm/plat-samsung/Kconfig
··· 8 8 default y 9 9 select GENERIC_IRQ_CHIP 10 10 select NO_IOPORT_MAP 11 + select SOC_SAMSUNG 11 12 help 12 13 Base platform code for all Samsung SoC based systems 13 14 ··· 234 233 Include legacy GPIO power management code for platforms not using 235 234 pinctrl-samsung driver. 236 235 endif 237 - 238 - comment "Power management" 239 - 240 - config SAMSUNG_PM_DEBUG 241 - bool "Samsung PM Suspend debug" 242 - depends on PM && DEBUG_KERNEL 243 - depends on PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210 244 - depends on DEBUG_S3C24XX_UART || DEBUG_S3C2410_UART 245 - help 246 - Say Y here if you want verbose debugging from the PM Suspend and 247 - Resume code. See <file:Documentation/arm/samsung-s3c24xx/suspend.rst> 248 - for more information. 249 - 250 - config S3C_PM_DEBUG_LED_SMDK 251 - bool "SMDK LED suspend/resume debugging" 252 - depends on PM && (MACH_SMDK6410) 253 - help 254 - Say Y here to enable the use of the SMDK LEDs on the baseboard 255 - for debugging of the state of the suspend and resume process. 256 - 257 - Note, this currently only works for S3C64XX based SMDK boards. 258 - 259 - config SAMSUNG_PM_CHECK 260 - bool "S3C2410 PM Suspend Memory CRC" 261 - depends on PM && (PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210) 262 - select CRC32 263 - help 264 - Enable the PM code's memory area checksum over sleep. This option 265 - will generate CRCs of all blocks of memory, and store them before 266 - going to sleep. The blocks are then checked on resume for any 267 - errors. 268 - 269 - Note, this can take several seconds depending on memory size 270 - and CPU speed. 271 - 272 - See <file:Documentation/arm/samsung-s3c24xx/suspend.rst> 273 - 274 - config SAMSUNG_PM_CHECK_CHUNKSIZE 275 - int "S3C2410 PM Suspend CRC Chunksize (KiB)" 276 - depends on PM && SAMSUNG_PM_CHECK 277 - default 64 278 - help 279 - Set the chunksize in Kilobytes of the CRC for checking memory 280 - corruption over suspend and resume. A smaller value will mean that 281 - the CRC data block will take more memory, but will identify any 282 - faults with better precision. 283 - 284 - See <file:Documentation/arm/samsung-s3c24xx/suspend.rst> 285 236 286 237 config SAMSUNG_WAKEMASK 287 238 bool
-2
arch/arm/plat-samsung/Makefile
··· 27 27 obj-$(CONFIG_PM_SLEEP) += pm-common.o 28 28 obj-$(CONFIG_SAMSUNG_PM) += pm.o 29 29 obj-$(CONFIG_SAMSUNG_PM_GPIO) += pm-gpio.o 30 - obj-$(CONFIG_SAMSUNG_PM_CHECK) += pm-check.o 31 - obj-$(CONFIG_SAMSUNG_PM_DEBUG) += pm-debug.o 32 30 33 31 obj-$(CONFIG_SAMSUNG_WAKEMASK) += wakeup-mask.o
+1 -69
arch/arm/plat-samsung/include/plat/pm-common.h
··· 11 11 #define __PLAT_SAMSUNG_PM_COMMON_H __FILE__ 12 12 13 13 #include <linux/irq.h> 14 + #include <linux/soc/samsung/s3c-pm.h> 14 15 15 16 /* sleep save info */ 16 17 ··· 36 35 extern void s3c_pm_do_save(struct sleep_save *ptr, int count); 37 36 extern void s3c_pm_do_restore(const struct sleep_save *ptr, int count); 38 37 extern void s3c_pm_do_restore_core(const struct sleep_save *ptr, int count); 39 - 40 - /* PM debug functions */ 41 - 42 - /** 43 - * struct pm_uart_save - save block for core UART 44 - * @ulcon: Save value for S3C2410_ULCON 45 - * @ucon: Save value for S3C2410_UCON 46 - * @ufcon: Save value for S3C2410_UFCON 47 - * @umcon: Save value for S3C2410_UMCON 48 - * @ubrdiv: Save value for S3C2410_UBRDIV 49 - * 50 - * Save block for UART registers to be held over sleep and restored if they 51 - * are needed (say by debug). 52 - */ 53 - struct pm_uart_save { 54 - u32 ulcon; 55 - u32 ucon; 56 - u32 ufcon; 57 - u32 umcon; 58 - u32 ubrdiv; 59 - u32 udivslot; 60 - }; 61 - 62 - #ifdef CONFIG_SAMSUNG_PM_DEBUG 63 - /** 64 - * s3c_pm_dbg() - low level debug function for use in suspend/resume. 65 - * @msg: The message to print. 66 - * 67 - * This function is used mainly to debug the resume process before the system 68 - * can rely on printk/console output. It uses the low-level debugging output 69 - * routine printascii() to do its work. 70 - */ 71 - extern void s3c_pm_dbg(const char *msg, ...); 72 - 73 - #define S3C_PMDBG(fmt...) s3c_pm_dbg(fmt) 74 - 75 - extern void s3c_pm_save_uarts(bool is_s3c24xx); 76 - extern void s3c_pm_restore_uarts(bool is_s3c24xx); 77 - 78 - #ifdef CONFIG_ARCH_S3C64XX 79 - extern void s3c_pm_arch_update_uart(void __iomem *regs, 80 - struct pm_uart_save *save); 81 - #else 82 - static inline void 83 - s3c_pm_arch_update_uart(void __iomem *regs, struct pm_uart_save *save) 84 - { 85 - } 86 - #endif 87 - 88 - #else 89 - #define S3C_PMDBG(fmt...) pr_debug(fmt) 90 - 91 - static inline void s3c_pm_save_uarts(bool is_s3c24xx) { } 92 - static inline void s3c_pm_restore_uarts(bool is_s3c24xx) { } 93 - #endif 94 - 95 - /* suspend memory checking */ 96 - 97 - #ifdef CONFIG_SAMSUNG_PM_CHECK 98 - extern void s3c_pm_check_prepare(void); 99 - extern void s3c_pm_check_restore(void); 100 - extern void s3c_pm_check_cleanup(void); 101 - extern void s3c_pm_check_store(void); 102 - #else 103 - #define s3c_pm_check_prepare() do { } while (0) 104 - #define s3c_pm_check_restore() do { } while (0) 105 - #define s3c_pm_check_cleanup() do { } while (0) 106 - #define s3c_pm_check_store() do { } while (0) 107 - #endif 108 38 109 39 #endif
+1 -1
arch/arm/plat-samsung/pm-check.c drivers/soc/samsung/s3c-pm-check.c
··· 15 15 #include <linux/ioport.h> 16 16 #include <linux/slab.h> 17 17 18 - #include <plat/pm-common.h> 18 + #include <linux/soc/samsung/s3c-pm.h> 19 19 20 20 #if CONFIG_SAMSUNG_PM_CHECK_CHUNKSIZE < 1 21 21 #error CONFIG_SAMSUNG_PM_CHECK_CHUNKSIZE must be a positive non-zero value
+1 -2
arch/arm/plat-samsung/pm-debug.c drivers/soc/samsung/s3c-pm-debug.c
··· 15 15 16 16 #include <asm/mach/map.h> 17 17 18 - #include <plat/cpu.h> 19 - #include <plat/pm-common.h> 18 + #include <linux/soc/samsung/s3c-pm.h> 20 19 21 20 static struct pm_uart_save uart_save; 22 21
+47 -1
drivers/soc/samsung/Kconfig
··· 35 35 36 36 config EXYNOS_PM_DOMAINS 37 37 bool "Exynos PM domains" if COMPILE_TEST 38 - depends on PM_GENERIC_DOMAINS || COMPILE_TEST 38 + depends on (ARCH_EXYNOS && PM_GENERIC_DOMAINS) || COMPILE_TEST 39 + 40 + config SAMSUNG_PM_DEBUG 41 + bool "Samsung PM Suspend debug" 42 + depends on PM && DEBUG_KERNEL 43 + depends on PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210 44 + depends on DEBUG_S3C24XX_UART || DEBUG_S3C2410_UART 45 + help 46 + Say Y here if you want verbose debugging from the PM Suspend and 47 + Resume code. See <file:Documentation/arm/samsung-s3c24xx/suspend.rst> 48 + for more information. 49 + 50 + config S3C_PM_DEBUG_LED_SMDK 51 + bool "SMDK LED suspend/resume debugging" 52 + depends on PM && (MACH_SMDK6410) 53 + help 54 + Say Y here to enable the use of the SMDK LEDs on the baseboard 55 + for debugging of the state of the suspend and resume process. 56 + 57 + Note, this currently only works for S3C64XX based SMDK boards. 58 + 59 + config SAMSUNG_PM_CHECK 60 + bool "S3C2410 PM Suspend Memory CRC" 61 + depends on PM && (PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210) 62 + select CRC32 63 + help 64 + Enable the PM code's memory area checksum over sleep. This option 65 + will generate CRCs of all blocks of memory, and store them before 66 + going to sleep. The blocks are then checked on resume for any 67 + errors. 68 + 69 + Note, this can take several seconds depending on memory size 70 + and CPU speed. 71 + 72 + See <file:Documentation/arm/samsung-s3c24xx/suspend.rst> 73 + 74 + config SAMSUNG_PM_CHECK_CHUNKSIZE 75 + int "S3C2410 PM Suspend CRC Chunksize (KiB)" 76 + depends on PM && SAMSUNG_PM_CHECK 77 + default 64 78 + help 79 + Set the chunksize in Kilobytes of the CRC for checking memory 80 + corruption over suspend and resume. A smaller value will mean that 81 + the CRC data block will take more memory, but will identify any 82 + faults with better precision. 83 + 84 + See <file:Documentation/arm/samsung-s3c24xx/suspend.rst> 39 85 40 86 config EXYNOS_REGULATOR_COUPLER 41 87 bool "Exynos SoC Regulator Coupler" if COMPILE_TEST
+3
drivers/soc/samsung/Makefile
··· 10 10 exynos5250-pmu.o exynos5420-pmu.o 11 11 obj-$(CONFIG_EXYNOS_PM_DOMAINS) += pm_domains.o 12 12 obj-$(CONFIG_EXYNOS_REGULATOR_COUPLER) += exynos-regulator-coupler.o 13 + 14 + obj-$(CONFIG_SAMSUNG_PM_CHECK) += s3c-pm-check.o 15 + obj-$(CONFIG_SAMSUNG_PM_DEBUG) += s3c-pm-debug.o
+84
include/linux/soc/samsung/s3c-pm.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * Copyright (C) 2013 Samsung Electronics Co., Ltd. 4 + * Tomasz Figa <t.figa@samsung.com> 5 + * Copyright (c) 2004 Simtec Electronics 6 + * http://armlinux.simtec.co.uk/ 7 + * Written by Ben Dooks, <ben@simtec.co.uk> 8 + */ 9 + 10 + #ifndef __LINUX_SOC_SAMSUNG_S3C_PM_H 11 + #define __LINUX_SOC_SAMSUNG_S3C_PM_H __FILE__ 12 + 13 + #include <linux/types.h> 14 + 15 + /* PM debug functions */ 16 + 17 + /** 18 + * struct pm_uart_save - save block for core UART 19 + * @ulcon: Save value for S3C2410_ULCON 20 + * @ucon: Save value for S3C2410_UCON 21 + * @ufcon: Save value for S3C2410_UFCON 22 + * @umcon: Save value for S3C2410_UMCON 23 + * @ubrdiv: Save value for S3C2410_UBRDIV 24 + * 25 + * Save block for UART registers to be held over sleep and restored if they 26 + * are needed (say by debug). 27 + */ 28 + struct pm_uart_save { 29 + u32 ulcon; 30 + u32 ucon; 31 + u32 ufcon; 32 + u32 umcon; 33 + u32 ubrdiv; 34 + u32 udivslot; 35 + }; 36 + 37 + #ifdef CONFIG_SAMSUNG_PM_DEBUG 38 + /** 39 + * s3c_pm_dbg() - low level debug function for use in suspend/resume. 40 + * @msg: The message to print. 41 + * 42 + * This function is used mainly to debug the resume process before the system 43 + * can rely on printk/console output. It uses the low-level debugging output 44 + * routine printascii() to do its work. 45 + */ 46 + extern void s3c_pm_dbg(const char *msg, ...); 47 + 48 + #define S3C_PMDBG(fmt...) s3c_pm_dbg(fmt) 49 + 50 + extern void s3c_pm_save_uarts(bool is_s3c24xx); 51 + extern void s3c_pm_restore_uarts(bool is_s3c24xx); 52 + 53 + #ifdef CONFIG_ARCH_S3C64XX 54 + extern void s3c_pm_arch_update_uart(void __iomem *regs, 55 + struct pm_uart_save *save); 56 + #else 57 + static inline void 58 + s3c_pm_arch_update_uart(void __iomem *regs, struct pm_uart_save *save) 59 + { 60 + } 61 + #endif 62 + 63 + #else 64 + #define S3C_PMDBG(fmt...) pr_debug(fmt) 65 + 66 + static inline void s3c_pm_save_uarts(bool is_s3c24xx) { } 67 + static inline void s3c_pm_restore_uarts(bool is_s3c24xx) { } 68 + #endif 69 + 70 + /* suspend memory checking */ 71 + 72 + #ifdef CONFIG_SAMSUNG_PM_CHECK 73 + extern void s3c_pm_check_prepare(void); 74 + extern void s3c_pm_check_restore(void); 75 + extern void s3c_pm_check_cleanup(void); 76 + extern void s3c_pm_check_store(void); 77 + #else 78 + #define s3c_pm_check_prepare() do { } while (0) 79 + #define s3c_pm_check_restore() do { } while (0) 80 + #define s3c_pm_check_cleanup() do { } while (0) 81 + #define s3c_pm_check_store() do { } while (0) 82 + #endif 83 + 84 + #endif