aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNava kishore Manne <nava.manne@xilinx.com>2019-02-06 06:07:19 -0500
committerMichal Simek <michal.simek@xilinx.com>2019-02-05 07:22:58 -0500
commitfe6f42cf6eb3183ebd6ab6b0b7dcbee2600c2baa (patch)
tree3e9094480e5d3a6308400f378de48048353a501f
parent62f0d7dc3bae9f7ce2701d6c8cfd3d93130017af (diff)
firmware: xilinx: Add zynqmp_pm_get_chipid() API
This patch adds a new API to provide access to the hardware related data like soc revision, IDCODE... etc. Signed-off-by: Nava kishore Manne <nava.manne@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
-rw-r--r--drivers/firmware/xilinx/zynqmp.c24
-rw-r--r--include/linux/firmware/xlnx-zynqmp.h2
2 files changed, 26 insertions, 0 deletions
diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c
index 70b50377ae5f..16a23bc4c2c3 100644
--- a/drivers/firmware/xilinx/zynqmp.c
+++ b/drivers/firmware/xilinx/zynqmp.c
@@ -187,6 +187,29 @@ static int zynqmp_pm_get_api_version(u32 *version)
187} 187}
188 188
189/** 189/**
190 * zynqmp_pm_get_chipid - Get silicon ID registers
191 * @idcode: IDCODE register
192 * @version: version register
193 *
194 * Return: Returns the status of the operation and the idcode and version
195 * registers in @idcode and @version.
196 */
197static int zynqmp_pm_get_chipid(u32 *idcode, u32 *version)
198{
199 u32 ret_payload[PAYLOAD_ARG_CNT];
200 int ret;
201
202 if (!idcode || !version)
203 return -EINVAL;
204
205 ret = zynqmp_pm_invoke_fn(PM_GET_CHIPID, 0, 0, 0, 0, ret_payload);
206 *idcode = ret_payload[1];
207 *version = ret_payload[2];
208
209 return ret;
210}
211
212/**
190 * zynqmp_pm_get_trustzone_version() - Get secure trustzone firmware version 213 * zynqmp_pm_get_trustzone_version() - Get secure trustzone firmware version
191 * @version: Returned version value 214 * @version: Returned version value
192 * 215 *
@@ -509,6 +532,7 @@ static int zynqmp_pm_reset_get_status(const enum zynqmp_pm_reset reset,
509 532
510static const struct zynqmp_eemi_ops eemi_ops = { 533static const struct zynqmp_eemi_ops eemi_ops = {
511 .get_api_version = zynqmp_pm_get_api_version, 534 .get_api_version = zynqmp_pm_get_api_version,
535 .get_chipid = zynqmp_pm_get_chipid,
512 .query_data = zynqmp_pm_query_data, 536 .query_data = zynqmp_pm_query_data,
513 .clock_enable = zynqmp_pm_clock_enable, 537 .clock_enable = zynqmp_pm_clock_enable,
514 .clock_disable = zynqmp_pm_clock_disable, 538 .clock_disable = zynqmp_pm_clock_disable,
diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h
index 07c587a0b06e..5a1f19848100 100644
--- a/include/linux/firmware/xlnx-zynqmp.h
+++ b/include/linux/firmware/xlnx-zynqmp.h
@@ -36,6 +36,7 @@ enum pm_api_id {
36 PM_GET_API_VERSION = 1, 36 PM_GET_API_VERSION = 1,
37 PM_RESET_ASSERT = 17, 37 PM_RESET_ASSERT = 17,
38 PM_RESET_GET_STATUS, 38 PM_RESET_GET_STATUS,
39 PM_GET_CHIPID = 24,
39 PM_IOCTL = 34, 40 PM_IOCTL = 34,
40 PM_QUERY_DATA, 41 PM_QUERY_DATA,
41 PM_CLOCK_ENABLE, 42 PM_CLOCK_ENABLE,
@@ -224,6 +225,7 @@ struct zynqmp_pm_query_data {
224 225
225struct zynqmp_eemi_ops { 226struct zynqmp_eemi_ops {
226 int (*get_api_version)(u32 *version); 227 int (*get_api_version)(u32 *version);
228 int (*get_chipid)(u32 *idcode, u32 *version);
227 int (*query_data)(struct zynqmp_pm_query_data qdata, u32 *out); 229 int (*query_data)(struct zynqmp_pm_query_data qdata, u32 *out);
228 int (*clock_enable)(u32 clock_id); 230 int (*clock_enable)(u32 clock_id);
229 int (*clock_disable)(u32 clock_id); 231 int (*clock_disable)(u32 clock_id);