firmware/qcom: add qcom_scm_restore_sec_cfg()
authorRob Clark <robdclark@gmail.com>
Tue, 14 Mar 2017 15:18:03 +0000 (11:18 -0400)
committerAndy Gross <andy.gross@linaro.org>
Tue, 28 Mar 2017 21:03:21 +0000 (16:03 -0500)
Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Andy Gross <andy.gross@linaro.org>
drivers/firmware/qcom_scm-32.c
drivers/firmware/qcom_scm-64.c
drivers/firmware/qcom_scm.c
drivers/firmware/qcom_scm.h
include/linux/qcom_scm.h

index 8ad226c60374cd9a2697268c4137212d63673f7f..722e65af588d1b6d4327d0d45c9226d6b18112fd 100644 (file)
@@ -578,3 +578,9 @@ int __qcom_scm_set_remote_state(struct device *dev, u32 state, u32 id)
 
        return ret ? : le32_to_cpu(scm_ret);
 }
+
+int __qcom_scm_restore_sec_cfg(struct device *dev, u32 device_id,
+                              u32 spare)
+{
+       return -ENODEV;
+}
index c9332590e8c662d3ed79c7986ab759fd0a0a7699..550e3a34e260e3f3d6fcf39f05a71189e19111dc 100644 (file)
@@ -381,3 +381,19 @@ int __qcom_scm_set_remote_state(struct device *dev, u32 state, u32 id)
 
        return ret ? : res.a1;
 }
+
+int __qcom_scm_restore_sec_cfg(struct device *dev, u32 device_id, u32 spare)
+{
+       struct qcom_scm_desc desc = {0};
+       struct arm_smccc_res res;
+       int ret;
+
+       desc.args[0] = device_id;
+       desc.args[1] = spare;
+       desc.arginfo = QCOM_SCM_ARGS(2);
+
+       ret = qcom_scm_call(dev, QCOM_SCM_SVC_MP, QCOM_SCM_RESTORE_SEC_CFG,
+                           &desc, &res);
+
+       return ret ? : res.a1;
+}
index d987bcc7489d981ee4b9784a6293fa6fd6ce175a..ae1f4732e060eec9c20834c5d5682b7d9cf932e6 100644 (file)
@@ -315,6 +315,12 @@ static const struct reset_control_ops qcom_scm_pas_reset_ops = {
        .deassert = qcom_scm_pas_reset_deassert,
 };
 
+int qcom_scm_restore_sec_cfg(u32 device_id, u32 spare)
+{
+       return __qcom_scm_restore_sec_cfg(__scm->dev, device_id, spare);
+}
+EXPORT_SYMBOL(qcom_scm_restore_sec_cfg);
+
 /**
  * qcom_scm_is_available() - Checks if SCM is available
  */
index 6a0f15469344e0b960747a3d06f4236467da942f..31fc732960ca2e78740d655906d3b7f694f3d11c 100644 (file)
@@ -85,4 +85,9 @@ static inline int qcom_scm_remap_error(int err)
        return -EINVAL;
 }
 
+#define QCOM_SCM_SVC_MP                        0xc
+#define QCOM_SCM_RESTORE_SEC_CFG       2
+extern int __qcom_scm_restore_sec_cfg(struct device *dev, u32 device_id,
+                                     u32 spare);
+
 #endif
index d32f6f1a5225f38de2ff8456a09b236028eb1de5..22017f5d17e03b211a507c948bc13010c9c0ddf9 100644 (file)
@@ -40,6 +40,7 @@ extern int qcom_scm_pas_shutdown(u32 peripheral);
 extern void qcom_scm_cpu_power_down(u32 flags);
 extern u32 qcom_scm_get_version(void);
 extern int qcom_scm_set_remote_state(u32 state, u32 id);
+extern int qcom_scm_restore_sec_cfg(u32 device_id, u32 spare);
 #else
 static inline
 int qcom_scm_set_cold_boot_addr(void *entry, const cpumask_t *cpus)
@@ -67,5 +68,6 @@ static inline void qcom_scm_cpu_power_down(u32 flags) {}
 static inline u32 qcom_scm_get_version(void) { return 0; }
 static inline u32
 qcom_scm_set_remote_state(u32 state,u32 id) { return -ENODEV; }
+static inline int qcom_scm_restore_sec_cfg(u32 device_id, u32 spare) { return -ENODEV; }
 #endif
 #endif