diff options
author | Ulf Hansson <ulf.hansson@linaro.org> | 2019-04-10 04:20:25 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2019-04-12 04:59:37 -0400 |
commit | 60dd1ead65e83268af9ccd19b97c7011cb50186b (patch) | |
tree | 359597d1b83227b0d019dd3fc4e3ebbac8aae589 | |
parent | d036b5cfef6360808117abd0c53775b7a8981a2e (diff) |
drivers: firmware: psci: Announce support for OS initiated suspend mode
PSCI firmware v1.0+, supports two different modes for CPU_SUSPEND.
The Platform Coordinated mode, which is the default and mandatory
mode, while support for the OS initiated (OSI) mode is optional.
In some cases it's interesting for the user/developer to know if
the OSI mode is supported by the PSCI FW, so print a message to
the log if that is the case.
Co-developed-by: Lina Iyer <lina.iyer@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/firmware/psci/psci.c | 21 | ||||
-rw-r--r-- | include/uapi/linux/psci.h | 5 |
2 files changed, 25 insertions, 1 deletions
diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index e480e0af632c..eabd01383cd6 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c | |||
@@ -95,6 +95,11 @@ static inline bool psci_has_ext_power_state(void) | |||
95 | PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK; | 95 | PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK; |
96 | } | 96 | } |
97 | 97 | ||
98 | static inline bool psci_has_osi_support(void) | ||
99 | { | ||
100 | return psci_cpu_suspend_feature & PSCI_1_0_OS_INITIATED; | ||
101 | } | ||
102 | |||
98 | static inline bool psci_power_state_loses_context(u32 state) | 103 | static inline bool psci_power_state_loses_context(u32 state) |
99 | { | 104 | { |
100 | const u32 mask = psci_has_ext_power_state() ? | 105 | const u32 mask = psci_has_ext_power_state() ? |
@@ -659,10 +664,24 @@ static int __init psci_0_1_init(struct device_node *np) | |||
659 | return 0; | 664 | return 0; |
660 | } | 665 | } |
661 | 666 | ||
667 | static int __init psci_1_0_init(struct device_node *np) | ||
668 | { | ||
669 | int err; | ||
670 | |||
671 | err = psci_0_2_init(np); | ||
672 | if (err) | ||
673 | return err; | ||
674 | |||
675 | if (psci_has_osi_support()) | ||
676 | pr_info("OSI mode supported.\n"); | ||
677 | |||
678 | return 0; | ||
679 | } | ||
680 | |||
662 | static const struct of_device_id psci_of_match[] __initconst = { | 681 | static const struct of_device_id psci_of_match[] __initconst = { |
663 | { .compatible = "arm,psci", .data = psci_0_1_init}, | 682 | { .compatible = "arm,psci", .data = psci_0_1_init}, |
664 | { .compatible = "arm,psci-0.2", .data = psci_0_2_init}, | 683 | { .compatible = "arm,psci-0.2", .data = psci_0_2_init}, |
665 | { .compatible = "arm,psci-1.0", .data = psci_0_2_init}, | 684 | { .compatible = "arm,psci-1.0", .data = psci_1_0_init}, |
666 | {}, | 685 | {}, |
667 | }; | 686 | }; |
668 | 687 | ||
diff --git a/include/uapi/linux/psci.h b/include/uapi/linux/psci.h index b3bcabe380da..581f72085c33 100644 --- a/include/uapi/linux/psci.h +++ b/include/uapi/linux/psci.h | |||
@@ -49,6 +49,7 @@ | |||
49 | 49 | ||
50 | #define PSCI_1_0_FN_PSCI_FEATURES PSCI_0_2_FN(10) | 50 | #define PSCI_1_0_FN_PSCI_FEATURES PSCI_0_2_FN(10) |
51 | #define PSCI_1_0_FN_SYSTEM_SUSPEND PSCI_0_2_FN(14) | 51 | #define PSCI_1_0_FN_SYSTEM_SUSPEND PSCI_0_2_FN(14) |
52 | #define PSCI_1_0_FN_SET_SUSPEND_MODE PSCI_0_2_FN(15) | ||
52 | 53 | ||
53 | #define PSCI_1_0_FN64_SYSTEM_SUSPEND PSCI_0_2_FN64(14) | 54 | #define PSCI_1_0_FN64_SYSTEM_SUSPEND PSCI_0_2_FN64(14) |
54 | 55 | ||
@@ -97,6 +98,10 @@ | |||
97 | #define PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK \ | 98 | #define PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK \ |
98 | (0x1 << PSCI_1_0_FEATURES_CPU_SUSPEND_PF_SHIFT) | 99 | (0x1 << PSCI_1_0_FEATURES_CPU_SUSPEND_PF_SHIFT) |
99 | 100 | ||
101 | #define PSCI_1_0_OS_INITIATED BIT(0) | ||
102 | #define PSCI_1_0_SUSPEND_MODE_PC 0 | ||
103 | #define PSCI_1_0_SUSPEND_MODE_OSI 1 | ||
104 | |||
100 | /* PSCI return values (inclusive of all PSCI versions) */ | 105 | /* PSCI return values (inclusive of all PSCI versions) */ |
101 | #define PSCI_RET_SUCCESS 0 | 106 | #define PSCI_RET_SUCCESS 0 |
102 | #define PSCI_RET_NOT_SUPPORTED -1 | 107 | #define PSCI_RET_NOT_SUPPORTED -1 |