Skip to content

Commit fdd2ed8

Browse files
rajanv-xilinxgregkh
authored andcommitted
firmware: xilinx: Add system shutdown API interface
Add system shutdown API interface which asks firmware to perform system shutdown/restart. Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Jolly Shah <jolly.shah@xilinx.com> Link: https://lore.kernel.org/r/1587761887-4279-24-git-send-email-jolly.shah@xilinx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ae5c961 commit fdd2ed8

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

‎drivers/firmware/xilinx/zynqmp.c‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,19 @@ int zynqmp_pm_aes_engine(const u64 address, u32 *out)
875875
}
876876
EXPORT_SYMBOL_GPL(zynqmp_pm_aes_engine);
877877

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+
878891
static ssize_t ggs_show(struct device *device,
879892
struct device_attribute *attr,
880893
char *buf,

‎include/linux/firmware/xlnx-zynqmp.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464

6565
enum pm_api_id {
6666
PM_GET_API_VERSION = 1,
67+
PM_SYSTEM_SHUTDOWN = 12,
6768
PM_REQUEST_NODE = 13,
6869
PM_RELEASE_NODE,
6970
PM_SET_REQUIREMENT,
@@ -340,6 +341,7 @@ int zynqmp_pm_write_ggs(u32 index, u32 value);
340341
int zynqmp_pm_read_ggs(u32 index, u32 *value);
341342
int zynqmp_pm_write_pggs(u32 index, u32 value);
342343
int zynqmp_pm_read_pggs(u32 index, u32 *value);
344+
int zynqmp_pm_system_shutdown(const u32 type, const u32 subtype);
343345
#else
344346
static inline struct zynqmp_eemi_ops *zynqmp_pm_get_eemi_ops(void)
345347
{
@@ -482,6 +484,10 @@ static inline int zynqmp_pm_read_pggs(u32 index, u32 *value)
482484
{
483485
return -ENODEV;
484486
}
487+
static inline int zynqmp_pm_system_shutdown(const u32 type, const u32 subtype)
488+
{
489+
return -ENODEV;
490+
}
485491
#endif
486492

487493
#endif /* __FIRMWARE_ZYNQMP_H__ */

0 commit comments

Comments
 (0)