Skip to content

Commit e60f02d

Browse files
rajanv-xilinxMichal Simek
authored andcommitted
firmware: xilinx: Add debugfs for query data API
Add debugfs file to query platform specific data from firmware using debugfs interface. Signed-off-by: Rajan Vaja <rajanv@xilinx.com> Signed-off-by: Jolly Shah <jollys@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
1 parent b321725 commit e60f02d

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

drivers/firmware/xilinx/zynqmp-debug.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ static char debugfs_buf[PAGE_SIZE];
3232
#define PM_API(id) {id, #id, strlen(#id)}
3333
static struct pm_api_info pm_api_list[] = {
3434
PM_API(PM_GET_API_VERSION),
35+
PM_API(PM_QUERY_DATA),
3536
};
3637

3738
struct dentry *firmware_debugfs_root;
@@ -87,6 +88,7 @@ static int process_api_request(u32 pm_id, u64 *pm_api_arg, u32 *pm_api_ret)
8788
const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops();
8889
u32 pm_api_version;
8990
int ret;
91+
struct zynqmp_pm_query_data qdata = {0};
9092

9193
if (!eemi_ops)
9294
return -ENXIO;
@@ -97,6 +99,32 @@ static int process_api_request(u32 pm_id, u64 *pm_api_arg, u32 *pm_api_ret)
9799
sprintf(debugfs_buf, "PM-API Version = %d.%d\n",
98100
pm_api_version >> 16, pm_api_version & 0xffff);
99101
break;
102+
case PM_QUERY_DATA:
103+
qdata.qid = pm_api_arg[0];
104+
qdata.arg1 = pm_api_arg[1];
105+
qdata.arg2 = pm_api_arg[2];
106+
qdata.arg3 = pm_api_arg[3];
107+
108+
ret = eemi_ops->query_data(qdata, pm_api_ret);
109+
if (ret)
110+
break;
111+
112+
switch (qdata.qid) {
113+
case PM_QID_CLOCK_GET_NAME:
114+
sprintf(debugfs_buf, "Clock name = %s\n",
115+
(char *)pm_api_ret);
116+
break;
117+
case PM_QID_CLOCK_GET_FIXEDFACTOR_PARAMS:
118+
sprintf(debugfs_buf, "Multiplier = %d, Divider = %d\n",
119+
pm_api_ret[1], pm_api_ret[2]);
120+
break;
121+
default:
122+
sprintf(debugfs_buf,
123+
"data[0] = 0x%08x\ndata[1] = 0x%08x\n data[2] = 0x%08x\ndata[3] = 0x%08x\n",
124+
pm_api_ret[0], pm_api_ret[1],
125+
pm_api_ret[2], pm_api_ret[3]);
126+
}
127+
break;
100128
default:
101129
sprintf(debugfs_buf, "Unsupported PM-API request\n");
102130
ret = -EINVAL;

0 commit comments

Comments
 (0)