From: Manish Narani <manish.narani@xilinx.com>
To: ulf.hansson@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com,
michal.simek@xilinx.com, adrian.hunter@intel.com,
rajan.vaja@xilinx.com, jolly.shah@xilinx.com,
nava.manne@xilinx.com, manish.narani@xilinx.com, olof@lixom.net
Cc: devicetree@vger.kernel.org, linux-mmc@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] firmware: xilinx: Add SDIO Tap Delay API
Date: Tue, 11 Jun 2019 15:26:49 +0530 [thread overview]
Message-ID: <1560247011-26369-2-git-send-email-manish.narani@xilinx.com> (raw)
In-Reply-To: <1560247011-26369-1-git-send-email-manish.narani@xilinx.com>
Add API for setting SDIO Tap Delays on ZynqMP platforms.
Signed-off-by: Manish Narani <manish.narani@xilinx.com>
---
drivers/firmware/xilinx/zynqmp.c | 32 ++++++++++++++++++++++++++++++++
include/linux/firmware/xlnx-zynqmp.h | 17 ++++++++++++++++-
2 files changed, 48 insertions(+), 1 deletion(-)
diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c
index fd3d837..c6f9e72 100644
--- a/drivers/firmware/xilinx/zynqmp.c
+++ b/drivers/firmware/xilinx/zynqmp.c
@@ -664,6 +664,37 @@ static int zynqmp_pm_set_requirement(const u32 node, const u32 capabilities,
qos, ack, NULL);
}
+/**
+ * zynqmp_pm_sdio_setphase() - PM call to set clock delays for SD clock
+ * @device_id: Device ID of the SD controller
+ * @degrees: Tap Delay value in degrees for Input/Output clocks
+ *
+ * This API function is to be used for setting the clock delays for SD
+ * clock.
+ *
+ * Return: Returns status, either success or error+reason
+ */
+static int zynqmp_pm_sdio_setphase(u32 device_id, int degrees)
+{
+ u32 node_id = (!device_id) ? NODE_SD_0 : NODE_SD_1;
+ enum tap_delay_type tap_type;
+ int ret;
+
+ if (degrees < INPUT_TAP_BOUNDARY) {
+ tap_type = PM_TAPDELAY_INPUT;
+ } else {
+ tap_type = PM_TAPDELAY_OUTPUT;
+ degrees -= INPUT_TAP_BOUNDARY;
+ }
+
+ ret = zynqmp_pm_ioctl(node_id, IOCTL_SET_SD_TAPDELAY, tap_type,
+ degrees, NULL);
+ if (ret)
+ pr_err("Error setting 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 +718,7 @@ 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_setphase = zynqmp_pm_sdio_setphase,
};
/**
diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h
index 1262ea6..0fc4bf7 100644
--- a/include/linux/firmware/xlnx-zynqmp.h
+++ b/include/linux/firmware/xlnx-zynqmp.h
@@ -56,6 +56,9 @@
#define XILINX_ZYNQMP_PM_FPGA_FULL 0x0U
#define XILINX_ZYNQMP_PM_FPGA_PARTIAL BIT(0)
+/* Input Tap Delay Boundary Value */
+#define INPUT_TAP_BOUNDARY 0x100
+
enum pm_api_id {
PM_GET_API_VERSION = 1,
PM_REQUEST_NODE = 13,
@@ -92,7 +95,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 +255,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 +309,7 @@ struct zynqmp_eemi_ops {
const u32 capabilities,
const u32 qos,
const enum zynqmp_pm_request_ack ack);
+ int (*sdio_setphase)(u32 device_id, int degrees);
};
int zynqmp_pm_invoke_fn(u32 pm_api_id, u32 arg0, u32 arg1,
--
2.1.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-06-11 9:57 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-11 9:56 [PATCH 0/3] Add ZynqMP SD Clock Tap Delays configuration support Manish Narani
2019-06-11 9:56 ` Manish Narani [this message]
2019-06-11 9:56 ` [PATCH 2/3] dt-bindings: mmc: arasan: Document 'xlnx, zynqmp-8.9a' controller Manish Narani
2019-06-11 9:56 ` [PATCH 3/3] mmc: sdhci-of-arasan: Add support for ZynqMP Platform Tap Delays Setup Manish Narani
2019-06-13 10:36 ` Adrian Hunter
2019-06-17 11:15 ` Ulf Hansson
2019-06-17 11:27 ` Michal Simek
2019-06-17 12:21 ` Ulf Hansson
2019-06-17 14:23 ` Michal Simek
2019-06-17 14:58 ` Ulf Hansson
2019-06-18 4:59 ` Manish Narani
2019-06-19 14:40 ` Ulf Hansson
2019-06-20 8:19 ` Manish Narani
2019-06-19 8:40 ` Manish Narani
2019-06-19 13:38 ` Ulf Hansson
2019-06-20 8:14 ` Manish Narani
2019-06-20 13:33 ` Ulf Hansson
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=1560247011-26369-2-git-send-email-manish.narani@xilinx.com \
--to=manish.narani@xilinx.com \
--cc=adrian.hunter@intel.com \
--cc=devicetree@vger.kernel.org \
--cc=jolly.shah@xilinx.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=michal.simek@xilinx.com \
--cc=nava.manne@xilinx.com \
--cc=olof@lixom.net \
--cc=rajan.vaja@xilinx.com \
--cc=robh+dt@kernel.org \
--cc=ulf.hansson@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).