From: Pankaj Dubey <pankaj.dubey@samsung.com> To: linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: krzk@kernel.org, arnd@arndb.de, m.szyprowski@samsung.com, kgene@kernel.org, m.reichl@fivetechno.de, a.hajda@samsung.com, cwchoi00@gmail.com, javier@osg.samsung.com, Pankaj Dubey <pankaj.dubey@samsung.com> Subject: [PATCH v9 07/12] ARM: EXYNOS: introduce soc specific pm ops Date: Thu, 30 Mar 2017 18:47:01 +0530 [thread overview] Message-ID: <1490879826-16754-8-git-send-email-pankaj.dubey@samsung.com> (raw) In-Reply-To: <1490879826-16754-1-git-send-email-pankaj.dubey@samsung.com> For s2r various Exynos SoC needs different programming sequence and data. Currently this is handled by adding lots of soc_is_exynosMMM checks in the code, in an attempt to remove the dependency of such helper functions specific to each SoC, let's separate these programming sequence by introducing a new struct exynos_s2r_data. This struct will contain different function hooks and data for differentiating these programming sequences based on SoC's soc_id and revision parameters which can be matched by using generic API "soc_device_match". Signed-off-by: Pankaj Dubey <pankaj.dubey@samsung.com> --- arch/arm/mach-exynos/pm.c | 122 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 116 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c index 4a73b02..fa24098 100644 --- a/arch/arm/mach-exynos/pm.c +++ b/arch/arm/mach-exynos/pm.c @@ -20,6 +20,7 @@ #include <linux/of.h> #include <linux/soc/samsung/exynos-regs-pmu.h> #include <linux/soc/samsung/exynos-pmu.h> +#include <linux/sys_soc.h> #include <asm/firmware.h> #include <asm/smp_scu.h> @@ -30,6 +31,12 @@ #include "common.h" +struct exynos_s2r_data { + void (*enter_aftr)(void); +}; + +static const struct exynos_s2r_data *s2r_data; + static inline void __iomem *exynos_boot_vector_addr(void) { if (samsung_rev() == EXYNOS4210_REV_1_1) @@ -160,13 +167,26 @@ static int exynos_aftr_finisher(unsigned long flags) void exynos_enter_aftr(void) { + if (s2r_data && s2r_data->enter_aftr) + s2r_data->enter_aftr(); +} + +static void exynos3_enter_aftr(void) +{ unsigned int cpuid = smp_processor_id(); cpu_pm_enter(); + exynos_set_boot_flag(cpuid, C2_STATE); + exynos_pm_central_suspend(); + cpu_suspend(0, exynos_aftr_finisher); + exynos_pm_central_resume(); + exynos_clear_boot_flag(cpuid, C2_STATE); + cpu_pm_exit(); +} - if (of_machine_is_compatible("samsung,exynos3250")) - exynos_set_boot_flag(cpuid, C2_STATE); - +static void exynos4_enter_aftr(void) +{ + cpu_pm_enter(); exynos_pm_central_suspend(); if (of_machine_is_compatible("samsung,exynos4212") || @@ -185,13 +205,103 @@ void exynos_enter_aftr(void) } exynos_pm_central_resume(); + cpu_pm_exit(); +} - if (of_machine_is_compatible("samsung,exynos3250")) - exynos_clear_boot_flag(cpuid, C2_STATE); - +static void exynos5_enter_aftr(void) +{ + cpu_pm_enter(); + exynos_pm_central_suspend(); + cpu_suspend(0, exynos_aftr_finisher); + exynos_pm_central_resume(); cpu_pm_exit(); } +static const struct exynos_s2r_data exynos_common_s2r_data = { + .enter_aftr = exynos5_enter_aftr, +}; + +static const struct exynos_s2r_data exynos3250_s2r_data = { + .enter_aftr = exynos3_enter_aftr, +}; + +static const struct exynos_s2r_data exynos4210_rev11_s2r_data = { + .enter_aftr = exynos4_enter_aftr, +}; + +static const struct exynos_s2r_data exynos4210_rev10_s2r_data = { + .enter_aftr = exynos4_enter_aftr, +}; + +static const struct exynos_s2r_data exynos4x12_s2r_data = { + .enter_aftr = exynos4_enter_aftr, +}; + +static const struct soc_device_attribute exynos_soc_revision[] __initconst = { + { + .soc_id = "EXYNOS3250", + .data = &exynos3250_s2r_data + }, + { + .soc_id = "EXYNOS4210", + .revision = "11", + .data = &exynos4210_rev11_s2r_data + }, + { + .soc_id = "EXYNOS4210", + .revision = "10", + .data = &exynos4210_rev10_s2r_data + }, + { + .soc_id = "EXYNOS4212", + .data = &exynos4x12_s2r_data + }, + { + .soc_id = "EXYNOS4412", + .data = &exynos4x12_s2r_data + }, + { + .soc_id = "EXYNOS5250", + .data = &exynos_common_s2r_data + }, + { + .soc_id = "EXYNOS5260", + .data = &exynos_common_s2r_data + }, + { + .soc_id = "EXYNOS5440", + .data = &exynos_common_s2r_data + }, + { + .soc_id = "EXYNOS5410", + .data = &exynos_common_s2r_data + }, + { + .soc_id = "EXYNOS5420", + .data = &exynos_common_s2r_data + }, + { + .soc_id = "EXYNOS5800", + .data = &exynos_common_s2r_data + }, +}; + +int __init exynos_s2r_init(void) +{ + const struct soc_device_attribute *match; + + match = soc_device_match(exynos_soc_revision); + + if (match) + s2r_data = (const struct exynos_s2r_data *) match->data; + + if (!s2r_data) + return -ENODEV; + + return 0; +} +arch_initcall(exynos_s2r_init); + #if defined(CONFIG_SMP) && defined(CONFIG_ARM_EXYNOS_CPUIDLE) static atomic_t cpu1_wakeup = ATOMIC_INIT(0); -- 2.7.4
WARNING: multiple messages have this Message-ID (diff)
From: pankaj.dubey@samsung.com (Pankaj Dubey) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v9 07/12] ARM: EXYNOS: introduce soc specific pm ops Date: Thu, 30 Mar 2017 18:47:01 +0530 [thread overview] Message-ID: <1490879826-16754-8-git-send-email-pankaj.dubey@samsung.com> (raw) In-Reply-To: <1490879826-16754-1-git-send-email-pankaj.dubey@samsung.com> For s2r various Exynos SoC needs different programming sequence and data. Currently this is handled by adding lots of soc_is_exynosMMM checks in the code, in an attempt to remove the dependency of such helper functions specific to each SoC, let's separate these programming sequence by introducing a new struct exynos_s2r_data. This struct will contain different function hooks and data for differentiating these programming sequences based on SoC's soc_id and revision parameters which can be matched by using generic API "soc_device_match". Signed-off-by: Pankaj Dubey <pankaj.dubey@samsung.com> --- arch/arm/mach-exynos/pm.c | 122 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 116 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c index 4a73b02..fa24098 100644 --- a/arch/arm/mach-exynos/pm.c +++ b/arch/arm/mach-exynos/pm.c @@ -20,6 +20,7 @@ #include <linux/of.h> #include <linux/soc/samsung/exynos-regs-pmu.h> #include <linux/soc/samsung/exynos-pmu.h> +#include <linux/sys_soc.h> #include <asm/firmware.h> #include <asm/smp_scu.h> @@ -30,6 +31,12 @@ #include "common.h" +struct exynos_s2r_data { + void (*enter_aftr)(void); +}; + +static const struct exynos_s2r_data *s2r_data; + static inline void __iomem *exynos_boot_vector_addr(void) { if (samsung_rev() == EXYNOS4210_REV_1_1) @@ -160,13 +167,26 @@ static int exynos_aftr_finisher(unsigned long flags) void exynos_enter_aftr(void) { + if (s2r_data && s2r_data->enter_aftr) + s2r_data->enter_aftr(); +} + +static void exynos3_enter_aftr(void) +{ unsigned int cpuid = smp_processor_id(); cpu_pm_enter(); + exynos_set_boot_flag(cpuid, C2_STATE); + exynos_pm_central_suspend(); + cpu_suspend(0, exynos_aftr_finisher); + exynos_pm_central_resume(); + exynos_clear_boot_flag(cpuid, C2_STATE); + cpu_pm_exit(); +} - if (of_machine_is_compatible("samsung,exynos3250")) - exynos_set_boot_flag(cpuid, C2_STATE); - +static void exynos4_enter_aftr(void) +{ + cpu_pm_enter(); exynos_pm_central_suspend(); if (of_machine_is_compatible("samsung,exynos4212") || @@ -185,13 +205,103 @@ void exynos_enter_aftr(void) } exynos_pm_central_resume(); + cpu_pm_exit(); +} - if (of_machine_is_compatible("samsung,exynos3250")) - exynos_clear_boot_flag(cpuid, C2_STATE); - +static void exynos5_enter_aftr(void) +{ + cpu_pm_enter(); + exynos_pm_central_suspend(); + cpu_suspend(0, exynos_aftr_finisher); + exynos_pm_central_resume(); cpu_pm_exit(); } +static const struct exynos_s2r_data exynos_common_s2r_data = { + .enter_aftr = exynos5_enter_aftr, +}; + +static const struct exynos_s2r_data exynos3250_s2r_data = { + .enter_aftr = exynos3_enter_aftr, +}; + +static const struct exynos_s2r_data exynos4210_rev11_s2r_data = { + .enter_aftr = exynos4_enter_aftr, +}; + +static const struct exynos_s2r_data exynos4210_rev10_s2r_data = { + .enter_aftr = exynos4_enter_aftr, +}; + +static const struct exynos_s2r_data exynos4x12_s2r_data = { + .enter_aftr = exynos4_enter_aftr, +}; + +static const struct soc_device_attribute exynos_soc_revision[] __initconst = { + { + .soc_id = "EXYNOS3250", + .data = &exynos3250_s2r_data + }, + { + .soc_id = "EXYNOS4210", + .revision = "11", + .data = &exynos4210_rev11_s2r_data + }, + { + .soc_id = "EXYNOS4210", + .revision = "10", + .data = &exynos4210_rev10_s2r_data + }, + { + .soc_id = "EXYNOS4212", + .data = &exynos4x12_s2r_data + }, + { + .soc_id = "EXYNOS4412", + .data = &exynos4x12_s2r_data + }, + { + .soc_id = "EXYNOS5250", + .data = &exynos_common_s2r_data + }, + { + .soc_id = "EXYNOS5260", + .data = &exynos_common_s2r_data + }, + { + .soc_id = "EXYNOS5440", + .data = &exynos_common_s2r_data + }, + { + .soc_id = "EXYNOS5410", + .data = &exynos_common_s2r_data + }, + { + .soc_id = "EXYNOS5420", + .data = &exynos_common_s2r_data + }, + { + .soc_id = "EXYNOS5800", + .data = &exynos_common_s2r_data + }, +}; + +int __init exynos_s2r_init(void) +{ + const struct soc_device_attribute *match; + + match = soc_device_match(exynos_soc_revision); + + if (match) + s2r_data = (const struct exynos_s2r_data *) match->data; + + if (!s2r_data) + return -ENODEV; + + return 0; +} +arch_initcall(exynos_s2r_init); + #if defined(CONFIG_SMP) && defined(CONFIG_ARM_EXYNOS_CPUIDLE) static atomic_t cpu1_wakeup = ATOMIC_INIT(0); -- 2.7.4
next prev parent reply other threads:[~2017-03-30 13:14 UTC|newest] Thread overview: 98+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <CGME20170330131417epcas1p48a7f41b90177294b7918ecf31df130d1@epcas1p4.samsung.com> 2017-03-30 13:16 ` [PATCH v9 00/12] Introducing Exynos ChipId driver Pankaj Dubey 2017-03-30 13:16 ` Pankaj Dubey [not found] ` <CGME20170330131419epcas5p4ac36250d3a9225643e327e60f47956c2@epcas5p4.samsung.com> 2017-03-30 13:16 ` [PATCH v9 01/12] ARM: EXYNOS: refactor firmware specific routines Pankaj Dubey 2017-03-30 13:16 ` Pankaj Dubey 2017-04-07 7:45 ` Krzysztof Kozlowski 2017-04-07 7:45 ` Krzysztof Kozlowski 2017-04-07 8:06 ` pankaj.dubey 2017-04-07 8:06 ` pankaj.dubey [not found] ` <CGME20170330131421epcas5p40b0ad9c1003d3ab807667ae2b05d25bc@epcas5p4.samsung.com> 2017-03-30 13:16 ` [PATCH v9 02/12] ARM: EXYNOS: remove usage of soc_is_exynosMMMM from pm.c Pankaj Dubey 2017-03-30 13:16 ` Pankaj Dubey 2017-04-07 8:24 ` Krzysztof Kozlowski 2017-04-07 8:24 ` Krzysztof Kozlowski 2017-04-07 12:12 ` pankaj.dubey 2017-04-07 12:12 ` pankaj.dubey 2017-04-07 12:24 ` Krzysztof Kozlowski 2017-04-07 12:24 ` Krzysztof Kozlowski 2017-04-07 14:13 ` pankaj.dubey 2017-04-07 14:13 ` pankaj.dubey [not found] ` <CGME20170330131424epcas5p4fccfab06e5d77d70d09c3835c3332ee5@epcas5p4.samsung.com> 2017-03-30 13:16 ` [PATCH v9 03/12] ARM: EXYNOS: remove secondary startup initialization from smp_prepare_cpus Pankaj Dubey 2017-03-30 13:16 ` Pankaj Dubey 2017-04-07 8:31 ` Krzysztof Kozlowski 2017-04-07 8:31 ` Krzysztof Kozlowski 2017-04-07 12:15 ` pankaj.dubey 2017-04-07 12:15 ` pankaj.dubey [not found] ` <CGME20170330131427epcas5p4c3d238022dc75694ad3baa8a1018ea04@epcas5p4.samsung.com> 2017-03-30 13:16 ` [PATCH v9 04/12] soc: samsung: add exynos chipid driver support Pankaj Dubey 2017-03-30 13:16 ` Pankaj Dubey 2017-03-30 13:50 ` Arnd Bergmann 2017-03-30 13:50 ` Arnd Bergmann 2017-03-31 5:36 ` pankaj.dubey 2017-03-31 5:36 ` pankaj.dubey 2017-03-31 8:09 ` Arnd Bergmann 2017-03-31 8:09 ` Arnd Bergmann 2017-04-03 9:21 ` pankaj.dubey 2017-04-03 9:21 ` pankaj.dubey 2017-04-03 7:57 ` Marek Szyprowski 2017-04-03 7:57 ` Marek Szyprowski 2017-04-03 9:35 ` pankaj.dubey 2017-04-03 9:35 ` pankaj.dubey 2017-04-07 9:13 ` Krzysztof Kozlowski 2017-04-07 9:13 ` Krzysztof Kozlowski 2017-04-07 12:18 ` pankaj.dubey 2017-04-07 12:18 ` pankaj.dubey [not found] ` <CGME20170330131429epcas5p414565c5a9f2c38f3f6660b72f9ad68a2@epcas5p4.samsung.com> 2017-03-30 13:16 ` [PATCH v9 05/12] ARM: EXYNOS: enable exynos_chipid for ARCH_EXYNOS Pankaj Dubey 2017-03-30 13:16 ` Pankaj Dubey [not found] ` <CGME20170330131431epcas5p447a730e1bb194162f262a819ae665efb@epcas5p4.samsung.com> 2017-03-30 13:17 ` [PATCH v9 06/12] ARM64: " Pankaj Dubey 2017-03-30 13:17 ` Pankaj Dubey 2017-03-30 13:51 ` Arnd Bergmann 2017-03-30 13:51 ` Arnd Bergmann [not found] ` <CGME20170330131434epcas1p4e42fe06bae3456c39e0f93a2f8ae4bc0@epcas1p4.samsung.com> 2017-03-30 13:17 ` Pankaj Dubey [this message] 2017-03-30 13:17 ` [PATCH v9 07/12] ARM: EXYNOS: introduce soc specific pm ops Pankaj Dubey 2017-03-30 14:03 ` Arnd Bergmann 2017-03-30 14:03 ` Arnd Bergmann 2017-04-07 9:24 ` Krzysztof Kozlowski 2017-04-07 9:24 ` Krzysztof Kozlowski 2017-04-07 14:11 ` pankaj.dubey 2017-04-07 14:11 ` pankaj.dubey 2017-04-07 14:57 ` Krzysztof Kozlowski 2017-04-07 14:57 ` Krzysztof Kozlowski [not found] ` <CGME20170330131436epcas1p4a4f8bf7b64b4a5ff9ee692adc4e7d001@epcas1p4.samsung.com> 2017-03-30 13:17 ` [PATCH v9 08/12] ARM: EXYNOS: move exynos_boot_vector_{addr,flag} ops to exynos_s2r_data Pankaj Dubey 2017-03-30 13:17 ` [PATCH v9 08/12] ARM: EXYNOS: move exynos_boot_vector_{addr, flag} " Pankaj Dubey 2017-04-07 10:32 ` [PATCH v9 08/12] ARM: EXYNOS: move exynos_boot_vector_{addr,flag} " Krzysztof Kozlowski 2017-04-07 10:32 ` [PATCH v9 08/12] ARM: EXYNOS: move exynos_boot_vector_{addr, flag} " Krzysztof Kozlowski 2017-04-07 13:52 ` [PATCH v9 08/12] ARM: EXYNOS: move exynos_boot_vector_{addr,flag} " pankaj.dubey 2017-04-07 13:52 ` [PATCH v9 08/12] ARM: EXYNOS: move exynos_boot_vector_{addr, flag} " pankaj.dubey [not found] ` <CGME20170330131438epcas1p459ce93da17fcd05249eddaef18d5021e@epcas1p4.samsung.com> 2017-03-30 13:17 ` [PATCH v9 09/12] ARM: EXYNOS: introduce exynos_cpu_info struct Pankaj Dubey 2017-03-30 13:17 ` Pankaj Dubey 2017-04-03 7:57 ` Marek Szyprowski 2017-04-03 7:57 ` Marek Szyprowski 2017-04-03 9:54 ` pankaj.dubey 2017-04-03 9:54 ` pankaj.dubey 2017-04-07 10:41 ` Krzysztof Kozlowski 2017-04-07 10:41 ` Krzysztof Kozlowski 2017-04-07 14:00 ` pankaj.dubey 2017-04-07 14:00 ` pankaj.dubey 2017-04-07 14:18 ` Krzysztof Kozlowski 2017-04-07 14:18 ` Krzysztof Kozlowski 2017-04-07 10:47 ` Krzysztof Kozlowski 2017-04-07 10:47 ` Krzysztof Kozlowski [not found] ` <CGME20170330131440epcas1p4f27192272761aa593b6cf083453e8adc@epcas1p4.samsung.com> 2017-03-30 13:17 ` [PATCH v9 10/12] ARM: EXYNOS: move power_{down,up} to per SoC struct exynos_cpu_info Pankaj Dubey 2017-03-30 13:17 ` [PATCH v9 10/12] ARM: EXYNOS: move power_{down, up} " Pankaj Dubey 2017-04-07 12:04 ` [PATCH v9 10/12] ARM: EXYNOS: move power_{down,up} " Krzysztof Kozlowski 2017-04-07 12:04 ` Krzysztof Kozlowski 2017-04-07 14:12 ` pankaj.dubey 2017-04-07 14:12 ` pankaj.dubey [not found] ` <CGME20170330131442epcas5p4f2be72cb3ec506847d8e832675e682c4@epcas5p4.samsung.com> 2017-03-30 13:17 ` [PATCH v9 11/12] ARM: EXYNOS: move cpu_restart as a SoC specific hook to exynos_cpu_info Pankaj Dubey 2017-03-30 13:17 ` Pankaj Dubey 2017-04-07 12:23 ` Krzysztof Kozlowski 2017-04-07 12:23 ` Krzysztof Kozlowski [not found] ` <CGME20170330131444epcas5p45051cf7e6ec7a993c2c9f84254b89a19@epcas5p4.samsung.com> 2017-03-30 13:17 ` [PATCH v9 12/12] ARM: EXYNOS: refactor of mach-exynos to use chipid information Pankaj Dubey 2017-03-30 13:17 ` Pankaj Dubey 2017-03-30 14:01 ` Arnd Bergmann 2017-03-30 14:01 ` Arnd Bergmann 2017-03-31 6:01 ` pankaj.dubey 2017-03-31 6:01 ` pankaj.dubey 2017-03-31 8:22 ` Arnd Bergmann 2017-03-31 8:22 ` Arnd Bergmann 2017-04-03 9:25 ` pankaj.dubey 2017-04-03 9:25 ` pankaj.dubey
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1490879826-16754-8-git-send-email-pankaj.dubey@samsung.com \ --to=pankaj.dubey@samsung.com \ --cc=a.hajda@samsung.com \ --cc=arnd@arndb.de \ --cc=cwchoi00@gmail.com \ --cc=javier@osg.samsung.com \ --cc=kgene@kernel.org \ --cc=krzk@kernel.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-samsung-soc@vger.kernel.org \ --cc=m.reichl@fivetechno.de \ --cc=m.szyprowski@samsung.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.