Add system shutdown API interface which asks firmware to perform system shutdown/restart.
Unified · Split
| @@ -875,6 +875,19 @@ int zynqmp_pm_aes_engine(const u64 address, u32 *out) · 874 unmodified lines | |||
| 875 | } | 875 | } |
| 876 | EXPORT_SYMBOL_GPL(zynqmp_pm_aes_engine); | 876 | EXPORT_SYMBOL_GPL(zynqmp_pm_aes_engine); |
| 877 | 877 | ||
| 878 | /** | ||
| 879 | * zynqmp_pm_system_shutdown - PM call to request a system shutdown or restart | ||
| 880 | * @type: Shutdown or restart? 0 for shutdown, 1 for restart | ||
| 881 | * @subtype: Specifies which system should be restarted or shut down | ||
| 882 | * | ||
| 883 | * Return: Returns status, either success or error+reason | ||
| 884 | */ | ||
| 885 | int zynqmp_pm_system_shutdown(const u32 type, const u32 subtype) | ||
| 886 | { | ||
| 887 | return zynqmp_pm_invoke_fn(PM_SYSTEM_SHUTDOWN, type, subtype, | ||
| 888 | 0, 0, NULL); | ||
| 889 | } | ||
| 890 | |||
| 878 | static ssize_t ggs_show(struct device *device, | 891 | static ssize_t ggs_show(struct device *device, |
| 879 | struct device_attribute *attr, | 892 | struct device_attribute *attr, |
| 880 | char *buf, | 893 | char *buf, |
| @@ -64,6 +64,7 @@ · 63 unmodified lines | |||
| 64 | 64 | ||
| 65 | enum pm_api_id { | 65 | enum pm_api_id { |
| 66 | PM_GET_API_VERSION = 1, | 66 | PM_GET_API_VERSION = 1, |
| 67 | PM_SYSTEM_SHUTDOWN = 12, | ||
| 67 | PM_REQUEST_NODE = 13, | 68 | PM_REQUEST_NODE = 13, |
| 68 | PM_RELEASE_NODE, | 69 | PM_RELEASE_NODE, |
| 69 | PM_SET_REQUIREMENT, | 70 | PM_SET_REQUIREMENT, |
| @@ -340,6 +341,7 @@ int zynqmp_pm_write_ggs(u32 index, u32 value); · 270 unmodified lines | |||
| 340 | int zynqmp_pm_read_ggs(u32 index, u32 *value); | 341 | int zynqmp_pm_read_ggs(u32 index, u32 *value); |
| 341 | int zynqmp_pm_write_pggs(u32 index, u32 value); | 342 | int zynqmp_pm_write_pggs(u32 index, u32 value); |
| 342 | int zynqmp_pm_read_pggs(u32 index, u32 *value); | 343 | int zynqmp_pm_read_pggs(u32 index, u32 *value); |
| 344 | int zynqmp_pm_system_shutdown(const u32 type, const u32 subtype); | ||
| 343 | #else | 345 | #else |
| 344 | static inline struct zynqmp_eemi_ops *zynqmp_pm_get_eemi_ops(void) | 346 | static inline struct zynqmp_eemi_ops *zynqmp_pm_get_eemi_ops(void) |
| 345 | { | 347 | { |
| @@ -482,6 +484,10 @@ static inline int zynqmp_pm_read_pggs(u32 index, u32 *value) · 136 unmodified lines | |||
| 482 | { | 484 | { |
| 483 | return -ENODEV; | 485 | return -ENODEV; |
| 484 | } | 486 | } |
| 487 | static inline int zynqmp_pm_system_shutdown(const u32 type, const u32 subtype) | ||
| 488 | { | ||
| 489 | return -ENODEV; | ||
| 490 | } | ||
| 485 | #endif | 491 | #endif |
| 486 | 492 | ||
| 487 | #endif /* __FIRMWARE_ZYNQMP_H__ */ | 493 | #endif /* __FIRMWARE_ZYNQMP_H__ */ |