[v9,07/10] firmware: xilinx: Add debugfs for IOCTL API
diff mbox

Message ID 1529516435-7315-8-git-send-email-jollys@xilinx.com
State New, archived
Headers show

Commit Message

Jolly Shah June 20, 2018, 5:40 p.m. UTC
From: Rajan Vaja <rajanv@xilinx.com>

Add debugfs file to set/get IOCTL using debugfs interface.

Signed-off-by: Rajan Vaja <rajanv@xilinx.com>
Signed-off-by: Jolly Shah <jollys@xilinx.com>
---
 drivers/firmware/xilinx/zynqmp-debug.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Stephen Boyd July 9, 2018, 5:29 a.m. UTC | #1
Quoting Jolly Shah (2018-06-20 10:40:32)
> From: Rajan Vaja <rajanv@xilinx.com>
> 
> Add debugfs file to set/get IOCTL using debugfs interface.

IOCTLs and debugfs aren't the same thing. Why are the two being mixed
together? Is some sort of userspace ABI being created here to control
clks with usermode drivers?
Jolly Shah July 17, 2018, 8:01 p.m. UTC | #2
Hi Stephen,

Thanks for the review,

> -----Original Message-----
> From: Stephen Boyd [mailto:sboyd@kernel.org]
> Sent: Sunday, July 08, 2018 10:29 PM
> To: Jolly Shah <JOLLYS@xilinx.com>; ard.biesheuvel@linaro.org;
> dmitry.torokhov@gmail.com; gregkh@linuxfoundation.org;
> hkallweit1@gmail.com; keescook@chromium.org; linux-clk@vger.kernel.org;
> mark.rutland@arm.com; matt@codeblueprint.co.uk; Michal Simek
> <michals@xilinx.com>; mingo@kernel.org; mturquette@baylibre.com;
> robh+dt@kernel.org; sboyd@codeaurora.org; sudeep.holla@arm.com
> Cc: Rajan Vaja <RAJANV@xilinx.com>; linux-arm-kernel@lists.infradead.org;
> linux-kernel@vger.kernel.org; devicetree@vger.kernel.org; Jolly Shah
> <JOLLYS@xilinx.com>
> Subject: Re: [PATCH v9 07/10] firmware: xilinx: Add debugfs for IOCTL API
> 
> Quoting Jolly Shah (2018-06-20 10:40:32)
> > From: Rajan Vaja <rajanv@xilinx.com>
> >
> > Add debugfs file to set/get IOCTL using debugfs interface.
> 
> IOCTLs and debugfs aren't the same thing. Why are the two being mixed
> together? Is some sort of userspace ABI being created here to control clks with
> usermode drivers?

This is not standard ioctl. This is type of ZynqMP API just like other APIs. This debugfs is created to debug ZynqMP IOCTL API.

Thanks,
Jolly Shah

Patch
diff mbox

diff --git a/drivers/firmware/xilinx/zynqmp-debug.c b/drivers/firmware/xilinx/zynqmp-debug.c
index 4800366..148dbff 100644
--- a/drivers/firmware/xilinx/zynqmp-debug.c
+++ b/drivers/firmware/xilinx/zynqmp-debug.c
@@ -32,6 +32,7 @@  static char debugfs_buf[PAGE_SIZE];
 #define PM_API(id)		 {id, #id, strlen(#id)}
 static struct pm_api_info pm_api_list[] = {
 	PM_API(PM_GET_API_VERSION),
+	PM_API(PM_IOCTL),
 };
 
 /**
@@ -95,6 +96,15 @@  static int process_api_request(u32 pm_id, u64 *pm_api_arg, u32 *pm_api_ret)
 		sprintf(debugfs_buf, "PM-API Version = %d.%d\n",
 			pm_api_version >> 16, pm_api_version & 0xffff);
 		break;
+	case PM_IOCTL:
+		ret = eemi_ops->ioctl(pm_api_arg[0], pm_api_arg[1],
+				      pm_api_arg[2], pm_api_arg[3],
+				      &pm_api_ret[0]);
+		if (!ret && (pm_api_arg[1] == IOCTL_GET_PLL_FRAC_MODE ||
+			     pm_api_arg[1] == IOCTL_GET_PLL_FRAC_DATA))
+			sprintf(debugfs_buf, "IOCTL return value: %u\n",
+				pm_api_ret[1]);
+		break;
 	default:
 		sprintf(debugfs_buf, "Unsupported PM-API request\n");
 		ret = -EINVAL;