linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Manish Narani <manish.narani@xilinx.com>
To: ulf.hansson@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com,
	heiko@sntech.de, michal.simek@xilinx.com,
	adrian.hunter@intel.com,
	christoph.muellner@theobroma-systems.com,
	philipp.tomsich@theobroma-systems.com, viresh.kumar@linaro.org,
	scott.branden@broadcom.com, ayaka@soulik.info, kernel@esmil.dk,
	tony.xie@rock-chips.com, rajan.vaja@xilinx.com,
	jolly.shah@xilinx.com, nava.manne@xilinx.com, mdf@kernel.org,
	manish.narani@xilinx.com, olof@lixom.net
Cc: linux-mmc@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org
Subject: [PATCH v2 09/11] firmware: xilinx: Add SDIO Tap Delay APIs
Date: Mon,  1 Jul 2019 10:59:49 +0530	[thread overview]
Message-ID: <1561958991-21935-10-git-send-email-manish.narani@xilinx.com> (raw)
In-Reply-To: <1561958991-21935-1-git-send-email-manish.narani@xilinx.com>

Add APIs for setting SDIO Tap Delays on ZynqMP platform.

Signed-off-by: Manish Narani <manish.narani@xilinx.com>
---
 drivers/firmware/xilinx/zynqmp.c     | 48 ++++++++++++++++++++++++++++++++++++
 include/linux/firmware/xlnx-zynqmp.h | 15 ++++++++++-
 2 files changed, 62 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c
index fd3d837..b81f1be 100644
--- a/drivers/firmware/xilinx/zynqmp.c
+++ b/drivers/firmware/xilinx/zynqmp.c
@@ -664,6 +664,52 @@ static int zynqmp_pm_set_requirement(const u32 node, const u32 capabilities,
 				   qos, ack, NULL);
 }
 
+/**
+ * zynqmp_pm_sdio_out_setphase() - PM call to set clock output delays for SD
+ * @device_id:		Device ID of the SD controller
+ * @tap_delay:		Tap Delay value for output clock
+ *
+ * This API function is to be used for setting the clock output delays for SD
+ * clock.
+ *
+ * Return: Returns status, either success or error+reason
+ */
+static int zynqmp_pm_sdio_out_setphase(u32 device_id, u8 tap_delay)
+{
+	u32 node_id = (!device_id) ? NODE_SD_0 : NODE_SD_1;
+	int ret;
+
+	ret = zynqmp_pm_ioctl(node_id, IOCTL_SET_SD_TAPDELAY,
+			      PM_TAPDELAY_OUTPUT, tap_delay, NULL);
+	if (ret)
+		pr_err("Error setting Output Tap Delay\n");
+
+	return ret;
+}
+
+/**
+ * zynqmp_pm_sdio_in_setphase() - PM call to set clock input delays for SD
+ * @device_id:		Device ID of the SD controller
+ * @tap_delay:		Tap Delay value for input clock
+ *
+ * This API function is to be used for setting the clock input delays for SD
+ * clock.
+ *
+ * Return: Returns status, either success or error+reason
+ */
+static int zynqmp_pm_sdio_in_setphase(u32 device_id, u8 tap_delay)
+{
+	u32 node_id = (!device_id) ? NODE_SD_0 : NODE_SD_1;
+	int ret;
+
+	ret = zynqmp_pm_ioctl(node_id, IOCTL_SET_SD_TAPDELAY,
+			      PM_TAPDELAY_INPUT, tap_delay, NULL);
+	if (ret)
+		pr_err("Error setting Input Tap Delay\n");
+
+	return ret;
+}
+
 static const struct zynqmp_eemi_ops eemi_ops = {
 	.get_api_version = zynqmp_pm_get_api_version,
 	.get_chipid = zynqmp_pm_get_chipid,
@@ -687,6 +733,8 @@ static const struct zynqmp_eemi_ops eemi_ops = {
 	.set_requirement = zynqmp_pm_set_requirement,
 	.fpga_load = zynqmp_pm_fpga_load,
 	.fpga_get_status = zynqmp_pm_fpga_get_status,
+	.sdio_out_setphase = zynqmp_pm_sdio_out_setphase,
+	.sdio_in_setphase = zynqmp_pm_sdio_in_setphase,
 };
 
 /**
diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h
index 1262ea6..d9b53e5 100644
--- a/include/linux/firmware/xlnx-zynqmp.h
+++ b/include/linux/firmware/xlnx-zynqmp.h
@@ -92,7 +92,8 @@ enum pm_ret_status {
 };
 
 enum pm_ioctl_id {
-	IOCTL_SET_PLL_FRAC_MODE = 8,
+	IOCTL_SET_SD_TAPDELAY = 7,
+	IOCTL_SET_PLL_FRAC_MODE,
 	IOCTL_GET_PLL_FRAC_MODE,
 	IOCTL_SET_PLL_FRAC_DATA,
 	IOCTL_GET_PLL_FRAC_DATA,
@@ -251,6 +252,16 @@ enum zynqmp_pm_request_ack {
 	ZYNQMP_PM_REQUEST_ACK_NON_BLOCKING,
 };
 
+enum pm_node_id {
+	NODE_SD_0 = 39,
+	NODE_SD_1,
+};
+
+enum tap_delay_type {
+	PM_TAPDELAY_INPUT = 0,
+	PM_TAPDELAY_OUTPUT,
+};
+
 /**
  * struct zynqmp_pm_query_data - PM query data
  * @qid:	query ID
@@ -295,6 +306,8 @@ struct zynqmp_eemi_ops {
 			       const u32 capabilities,
 			       const u32 qos,
 			       const enum zynqmp_pm_request_ack ack);
+	int (*sdio_out_setphase)(u32 device_id, u8 tap_delay);
+	int (*sdio_in_setphase)(u32 device_id, u8 tap_delay);
 };
 
 int zynqmp_pm_invoke_fn(u32 pm_api_id, u32 arg0, u32 arg1,
-- 
2.1.1


  parent reply	other threads:[~2019-07-01  5:30 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-01  5:29 [PATCH v2 00/11] Arasan SDHCI enhancements and ZynqMP Tap Delays Handling Manish Narani
2019-07-01  5:29 ` [PATCH v2 01/11] dt-bindings: mmc: arasan: Update documentation for SD Card Clock Manish Narani
2019-07-22 21:54   ` Rob Herring
2019-07-23  8:23     ` Manish Narani
2019-07-25 13:00       ` Ulf Hansson
2019-08-19  9:21         ` Manish Narani
2019-08-22 13:38           ` Ulf Hansson
2019-08-22 18:23             ` Heiko Stuebner
2019-08-23 10:01               ` Manish Narani
2019-07-01  5:29 ` [PATCH v2 02/11] arm64: dts: rockchip: Add optional clock property indicating sdcard clock Manish Narani
2019-07-01  5:29 ` [PATCH v2 03/11] mmc: sdhci-of-arasan: Replace deprecated clk API calls Manish Narani
2019-07-01  5:29 ` [PATCH v2 04/11] mmc: sdhci-of-arasan: Separate out clk related data to another structure Manish Narani
2019-07-01  5:29 ` [PATCH v2 05/11] dt-bindings: mmc: arasan: Update Documentation for the input clock Manish Narani
2019-07-22 21:56   ` Rob Herring
2019-07-01  5:29 ` [PATCH v2 06/11] mmc: sdhci-of-arasan: Add sampling clock for a phy to use Manish Narani
2019-07-01  5:29 ` [PATCH v2 07/11] dt-bindings: mmc: arasan: Add optional properties for Arasan SDHCI Manish Narani
2019-07-22 22:01   ` Rob Herring
2019-07-01  5:29 ` [PATCH v2 08/11] mmc: sdhci-of-arasan: Add support to set clock phase delays for SD Manish Narani
2019-07-01  5:29 ` Manish Narani [this message]
2019-07-01 18:06   ` [PATCH v2 09/11] firmware: xilinx: Add SDIO Tap Delay APIs Jolly Shah
2019-07-02  5:03     ` Manish Narani
2019-07-01  5:29 ` [PATCH v2 10/11] dt-bindings: mmc: arasan: Document 'xlnx,zynqmp-8.9a' controller Manish Narani
2019-07-22 22:06   ` Rob Herring
2019-07-01  5:29 ` [PATCH v2 11/11] mmc: sdhci-of-arasan: Add support for ZynqMP Platform Tap Delays Setup Manish Narani
2019-07-10 11:33 ` [PATCH v2 00/11] Arasan SDHCI enhancements and ZynqMP Tap Delays Handling Adrian Hunter
2019-07-15  7:15 ` Manish Narani
2019-07-22  4:56   ` Manish Narani

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1561958991-21935-10-git-send-email-manish.narani@xilinx.com \
    --to=manish.narani@xilinx.com \
    --cc=adrian.hunter@intel.com \
    --cc=ayaka@soulik.info \
    --cc=christoph.muellner@theobroma-systems.com \
    --cc=devicetree@vger.kernel.org \
    --cc=heiko@sntech.de \
    --cc=jolly.shah@xilinx.com \
    --cc=kernel@esmil.dk \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=mdf@kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=nava.manne@xilinx.com \
    --cc=olof@lixom.net \
    --cc=philipp.tomsich@theobroma-systems.com \
    --cc=rajan.vaja@xilinx.com \
    --cc=robh+dt@kernel.org \
    --cc=scott.branden@broadcom.com \
    --cc=tony.xie@rock-chips.com \
    --cc=ulf.hansson@linaro.org \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).