]> rtime.felk.cvut.cz Git - zynq/linux.git/blobdiff - drivers/firmware/xilinx/zynqmp.c
firmware: xilinx: Add reset API's
[zynq/linux.git] / drivers / firmware / xilinx / zynqmp.c
index 9a1c72a9280f1bce66ee5544e39b8b8abf86638c..70b50377ae5fd014790ebb56c34fdc2701b5896c 100644 (file)
@@ -469,6 +469,44 @@ static int zynqmp_pm_ioctl(u32 node_id, u32 ioctl_id, u32 arg1, u32 arg2,
                                   arg1, arg2, out);
 }
 
+/**
+ * zynqmp_pm_reset_assert - Request setting of reset (1 - assert, 0 - release)
+ * @reset:             Reset to be configured
+ * @assert_flag:       Flag stating should reset be asserted (1) or
+ *                     released (0)
+ *
+ * Return: Returns status, either success or error+reason
+ */
+static int zynqmp_pm_reset_assert(const enum zynqmp_pm_reset reset,
+                                 const enum zynqmp_pm_reset_action assert_flag)
+{
+       return zynqmp_pm_invoke_fn(PM_RESET_ASSERT, reset, assert_flag,
+                                  0, 0, NULL);
+}
+
+/**
+ * zynqmp_pm_reset_get_status - Get status of the reset
+ * @reset:      Reset whose status should be returned
+ * @status:     Returned status
+ *
+ * Return: Returns status, either success or error+reason
+ */
+static int zynqmp_pm_reset_get_status(const enum zynqmp_pm_reset reset,
+                                     u32 *status)
+{
+       u32 ret_payload[PAYLOAD_ARG_CNT];
+       int ret;
+
+       if (!status)
+               return -EINVAL;
+
+       ret = zynqmp_pm_invoke_fn(PM_RESET_GET_STATUS, reset, 0,
+                                 0, 0, ret_payload);
+       *status = ret_payload[1];
+
+       return ret;
+}
+
 static const struct zynqmp_eemi_ops eemi_ops = {
        .get_api_version = zynqmp_pm_get_api_version,
        .query_data = zynqmp_pm_query_data,
@@ -482,6 +520,8 @@ static const struct zynqmp_eemi_ops eemi_ops = {
        .clock_setparent = zynqmp_pm_clock_setparent,
        .clock_getparent = zynqmp_pm_clock_getparent,
        .ioctl = zynqmp_pm_ioctl,
+       .reset_assert = zynqmp_pm_reset_assert,
+       .reset_get_status = zynqmp_pm_reset_get_status,
 };
 
 /**