summaryrefslogtreecommitdiff
path: root/plat
diff options
context:
space:
mode:
authorAnson Huang <Anson.Huang@nxp.com>2017-10-16 23:40:31 +0800
committerAbel Vesa <abel.vesa@nxp.com>2018-06-11 10:08:39 +0300
commit1ca2c3e540431f41dda3b809779e1da08d3a8375 (patch)
treea3ace1f563961a0c54c5a47ec45a683dc6c0f7d4 /plat
parent1b324bd02d34f2b0868bd43fbe9a3b8c529d7c37 (diff)
Add SCFW APIs to support suspend/resume
Add SCFW APIs to support suspend/resume with all CPUs power down. Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Diffstat (limited to 'plat')
-rw-r--r--[-rwxr-xr-x]plat/imx/common/include/sci/svc/pm/api.h41
-rw-r--r--[-rwxr-xr-x]plat/imx/common/include/sci/types.h5
-rw-r--r--plat/imx/common/sci/svc/pm/pm_rpc_clnt.c39
-rw-r--r--[-rwxr-xr-x]plat/imx/common/sci/svc/pm/rpc.h2
4 files changed, 85 insertions, 2 deletions
diff --git a/plat/imx/common/include/sci/svc/pm/api.h b/plat/imx/common/include/sci/svc/pm/api.h
index ec70010d..30a35a0c 100755..100644
--- a/plat/imx/common/include/sci/svc/pm/api.h
+++ b/plat/imx/common/include/sci/svc/pm/api.h
@@ -222,8 +222,7 @@ sc_err_t sc_pm_get_sys_power_mode(sc_ipc_t ipc, sc_rm_pt_t pt,
* - SC_ERR_NOACCESS if caller's partition is not the resource owner
* or parent of the owner
*
- * Note only SC_PM_PW_MODE_OFF and SC_PM_PW_MODE_ON are valid. Other modes
- * will return an error. Resources set to SC_PM_PW_MODE_ON will reflect the
+ * Resources set to SC_PM_PW_MODE_ON will reflect the
* power mode of the partition and will change as that changes.
*
* Note some resources are still not accessible even when powered up if bus
@@ -251,6 +250,44 @@ sc_err_t sc_pm_set_resource_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
sc_err_t sc_pm_get_resource_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
sc_pm_power_mode_t *mode);
+/*!
+ * This function requests the low power mode some of the resources
+ * can enter based on their state. This API is only valid for the
+ * following resources : SC_R_A53, SC_R_A53_0, SC_R_A53_1, SC_A53_2,
+ * SC_A53_3, SC_R_A72, SC_R_A72_0, SC_R_A72_1, SC_R_CC1, SC_R_A35,
+ * SC_R_A35_0, SC_R_A35_1, SC_R_A35_2, SC_R_A35_3.
+ * For all other resources it will return SC_ERR_PARAM.
+ * This function will set the low power mode the cores, cluster
+ * and cluster associated resources will enter when all the cores
+ * in a given cluster execute WFI
+ *
+ * @param[in] ipc IPC handle
+ * @param[in] resource ID of the resource
+ * @param[out] mode pointer to return power mode
+ *
+ * @return Returns an error code (SC_ERR_NONE = success).
+ *
+ */
+sc_err_t sc_pm_req_low_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
+ sc_pm_power_mode_t mode);
+
+/*!
+ * This function is used to set the resume address of a CPU.
+ *
+ * @param[in] ipc IPC handle
+ * @param[in] resource ID of the CPU resource
+ * @param[in] address 64-bit resume address
+ *
+ * @return Returns an error code (SC_ERR_NONE = success).
+ *
+ * Return errors:
+ * - SC_ERR_PARM if invalid resource or address,
+ * - SC_ERR_NOACCESS if caller's partition is not the parent of the
+ * resource (CPU) owner
+ */
+sc_err_t sc_pm_set_cpu_resume_addr(sc_ipc_t ipc, sc_rsrc_t resource,
+ sc_faddr_t address);
+
/* @} */
/*!
diff --git a/plat/imx/common/include/sci/types.h b/plat/imx/common/include/sci/types.h
index a35058dc..f07e0a4f 100755..100644
--- a/plat/imx/common/include/sci/types.h
+++ b/plat/imx/common/include/sci/types.h
@@ -27,6 +27,7 @@
#define SC_10MHZ 10000000 /* 10MHz */
#define SC_20MHZ 20000000 /* 20MHz */
#define SC_25MHZ 25000000 /* 25MHz */
+#define SC_27MHZ 27000000 /* 27MHz */
#define SC_40MHZ 40000000 /* 40MHz */
#define SC_45MHZ 45000000 /* 45MHz */
#define SC_50MHZ 50000000 /* 50MHz */
@@ -90,6 +91,7 @@
#define SC_24MHZ 24000000 /* 24MHz */
#define SC_120MHZ 120000000 /* 120MHz */
#define SC_132MHZ 132000000 /* 132MHz */
+#define SC_144MHZ 144000000 /* 144MHz */
#define SC_192MHZ 192000000 /* 192MHz */
#define SC_211MHZ 211200000 /* 211.2MHz */
#define SC_240MHZ 240000000 /* 240MHz */
@@ -102,6 +104,7 @@
#define SC_600MHZ 600000000 /* 600MHz */
#define SC_744MHZ 744000000 /* 744MHz */
#define SC_792MHZ 792000000 /* 792MHz */
+#define SC_864MHZ 864000000 /* 864MHz */
#define SC_960MHZ 960000000 /* 960MHz */
#define SC_1056MHZ 1056000000 /* 1056MHz */
#define SC_1200MHZ 1200000000 /* 1.2GHz */
@@ -693,6 +696,8 @@ typedef enum sc_rsrc_e {
SC_R_BOARD_R5 = 529,
SC_R_BOARD_R6 = 530,
SC_R_BOARD_R7 = 531,
+ SC_R_MJPEG_DEC_MP = 532,
+ SC_R_MJPEG_ENC_MP = 533,
SC_R_LAST
} sc_rsrc_t;
diff --git a/plat/imx/common/sci/svc/pm/pm_rpc_clnt.c b/plat/imx/common/sci/svc/pm/pm_rpc_clnt.c
index 59878d3c..1acc5089 100644
--- a/plat/imx/common/sci/svc/pm/pm_rpc_clnt.c
+++ b/plat/imx/common/sci/svc/pm/pm_rpc_clnt.c
@@ -106,6 +106,45 @@ sc_err_t sc_pm_get_resource_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
return (sc_err_t) result;
}
+sc_err_t sc_pm_req_low_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
+ sc_pm_power_mode_t mode)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = SC_RPC_SVC_PM;
+ RPC_FUNC(&msg) = PM_FUNC_REQ_LOW_POWER_MODE;
+ RPC_U16(&msg, 0) = resource;
+ RPC_U8(&msg, 2) = mode;
+ RPC_SIZE(&msg) = 2;
+
+ sc_call_rpc(ipc, &msg, false);
+
+ result = RPC_R8(&msg);
+ return (sc_err_t)result;
+}
+
+sc_err_t sc_pm_set_cpu_resume_addr(sc_ipc_t ipc, sc_rsrc_t resource,
+ sc_faddr_t address)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = SC_RPC_SVC_PM;
+ RPC_FUNC(&msg) = PM_FUNC_SET_CPU_RESUME_ADDR;
+ RPC_U32(&msg, 0) = address >> 32;
+ RPC_U32(&msg, 4) = address;
+ RPC_U16(&msg, 8) = resource;
+ RPC_SIZE(&msg) = 4;
+
+ sc_call_rpc(ipc, &msg, false);
+
+ result = RPC_R8(&msg);
+ return (sc_err_t)result;
+}
+
sc_err_t sc_pm_set_clock_rate(sc_ipc_t ipc, sc_rsrc_t resource,
sc_pm_clk_t clk, sc_pm_clock_rate_t *rate)
{
diff --git a/plat/imx/common/sci/svc/pm/rpc.h b/plat/imx/common/sci/svc/pm/rpc.h
index 36ffe76e..6f40c0dc 100755..100644
--- a/plat/imx/common/sci/svc/pm/rpc.h
+++ b/plat/imx/common/sci/svc/pm/rpc.h
@@ -30,6 +30,8 @@ typedef enum pm_func_e {
PM_FUNC_GET_SYS_POWER_MODE = 2, /* Index for pm_get_sys_power_mode() RPC call */
PM_FUNC_SET_RESOURCE_POWER_MODE = 3, /* Index for pm_set_resource_power_mode() RPC call */
PM_FUNC_GET_RESOURCE_POWER_MODE = 4, /* Index for pm_get_resource_power_mode() RPC call */
+ PM_FUNC_REQ_LOW_POWER_MODE = 16, /* Index for pm_req_low_power_mode() RPC call */
+ PM_FUNC_SET_CPU_RESUME_ADDR = 17, /* Index for pm_set_cpu_resume_addr() RPC call */
PM_FUNC_SET_CLOCK_RATE = 5, /* Index for pm_set_clock_rate() RPC call */
PM_FUNC_GET_CLOCK_RATE = 6, /* Index for pm_get_clock_rate() RPC call */
PM_FUNC_CLOCK_ENABLE = 7, /* Index for pm_clock_enable() RPC call */