Skip to content

Commit fe6f42c

Browse files
Nava kishore ManneMichal Simek
authored andcommitted
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>
1 parent 62f0d7d commit fe6f42c

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

‎drivers/firmware/xilinx/zynqmp.c‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,29 @@ static int zynqmp_pm_get_api_version(u32 *version)
186186
return ret;
187187
}
188188

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+
*/
197+
static 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+
189212
/**
190213
* zynqmp_pm_get_trustzone_version() - Get secure trustzone firmware version
191214
* @version: Returned version value
@@ -509,6 +532,7 @@ static int zynqmp_pm_reset_get_status(const enum zynqmp_pm_reset reset,
509532

510533
static const struct zynqmp_eemi_ops eemi_ops = {
511534
.get_api_version = zynqmp_pm_get_api_version,
535+
.get_chipid = zynqmp_pm_get_chipid,
512536
.query_data = zynqmp_pm_query_data,
513537
.clock_enable = zynqmp_pm_clock_enable,
514538
.clock_disable = zynqmp_pm_clock_disable,

‎include/linux/firmware/xlnx-zynqmp.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ enum pm_api_id {
3636
PM_GET_API_VERSION = 1,
3737
PM_RESET_ASSERT = 17,
3838
PM_RESET_GET_STATUS,
39+
PM_GET_CHIPID = 24,
3940
PM_IOCTL = 34,
4041
PM_QUERY_DATA,
4142
PM_CLOCK_ENABLE,
@@ -224,6 +225,7 @@ struct zynqmp_pm_query_data {
224225

225226
struct zynqmp_eemi_ops {
226227
int (*get_api_version)(u32 *version);
228+
int (*get_chipid)(u32 *idcode, u32 *version);
227229
int (*query_data)(struct zynqmp_pm_query_data qdata, u32 *out);
228230
int (*clock_enable)(u32 clock_id);
229231
int (*clock_disable)(u32 clock_id);

0 commit comments

Comments
 (0)