diff options
author | Igor Opaniuk <igor.opaniuk@foundries.io> | 2024-01-31 13:49:25 +0100 |
---|---|---|
committer | Fabio Estevam <festevam@denx.de> | 2024-02-08 09:17:46 -0300 |
commit | 0bc69a1d38f4176ec5cfaba1c41be6b7e7fd46b5 (patch) | |
tree | 9ed5c3c3c2f64844553114f5e7af97ba4807c3c2 /drivers | |
parent | 7c1f8ce3956995129a8c36734ba9899ae6d0cb28 (diff) | |
download | u-boot-0bc69a1d38f4176ec5cfaba1c41be6b7e7fd46b5.zip u-boot-0bc69a1d38f4176ec5cfaba1c41be6b7e7fd46b5.tar.gz u-boot-0bc69a1d38f4176ec5cfaba1c41be6b7e7fd46b5.tar.bz2 |
imx: scu_api: add implementation of sc_pm_reset_reason
Add implementation of sc_pm_reset_reason() call for obtaining
reset reason.
Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/misc/imx8/scu_api.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/misc/imx8/scu_api.c b/drivers/misc/imx8/scu_api.c index 3e3002b..6e2c678 100644 --- a/drivers/misc/imx8/scu_api.c +++ b/drivers/misc/imx8/scu_api.c @@ -882,6 +882,28 @@ void sc_pm_reboot(sc_ipc_t ipc, sc_pm_reset_type_t type) misc_call(dev, SC_TRUE, &msg, size, &msg, size); } +int sc_pm_reset_reason(sc_ipc_t ipc, sc_pm_reset_reason_t *reason) +{ + struct udevice *dev = gd->arch.scu_dev; + struct sc_rpc_msg_s msg; + int size = sizeof(struct sc_rpc_msg_s); + int ret; + + RPC_VER(&msg) = SC_RPC_VERSION; + RPC_SVC(&msg) = (u8)SC_RPC_SVC_PM; + RPC_FUNC(&msg) = (u8)PM_FUNC_RESET_REASON; + RPC_SIZE(&msg) = 1U; + + ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size); + if (ret) + printf("%s: res:%d\n", __func__, RPC_U8(&msg, 0U)); + + if (reason) + *reason = RPC_U8(&msg, 0U); + + return ret; +} + int sc_pm_get_resource_power_mode(sc_ipc_t ipc, sc_rsrc_t resource, sc_pm_power_mode_t *mode) { |