All of lore.kernel.org
 help / color / mirror / Atom feed
From: Manish Narani <manish.narani@xilinx.com>
To: <michal.simek@xilinx.com>, <adrian.hunter@intel.com>,
	<ulf.hansson@linaro.org>
Cc: <linux-arm-kernel@lists.infradead.org>,
	<linux-mmc@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Manish Narani <manish.narani@xilinx.com>
Subject: [PATCH 1/7] mmc: sdhci-of-arasan: Modified SD default speed to 19MHz for ZynqMP
Date: Tue, 15 Jun 2021 16:13:51 +0530	[thread overview]
Message-ID: <1623753837-21035-2-git-send-email-manish.narani@xilinx.com> (raw)
In-Reply-To: <1623753837-21035-1-git-send-email-manish.narani@xilinx.com>

SD standard speed timing was met only at 19MHz and not 25 MHz, that's
why changing driver to 19MHz. The reason for this is when a level shifter
is used on the board, timing was met for standard speed only at 19MHz.
Since this level shifter is commonly required for high speed modes,
the driver is modified to use standard speed of 19Mhz.

Signed-off-by: Manish Narani <manish.narani@xilinx.com>
---
 drivers/mmc/host/sdhci-of-arasan.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
index 839965f..fc3e41c 100644
--- a/drivers/mmc/host/sdhci-of-arasan.c
+++ b/drivers/mmc/host/sdhci-of-arasan.c
@@ -159,6 +159,12 @@ struct sdhci_arasan_data {
 /* Controller immediately reports SDHCI_CLOCK_INT_STABLE after enabling the
  * internal clock even when the clock isn't stable */
 #define SDHCI_ARASAN_QUIRK_CLOCK_UNSTABLE BIT(1)
+/*
+ * Some of the Arasan variations might not have timing requirements
+ * met at 25MHz for Default Speed mode, those controllers work at
+ * 19MHz instead
+ */
+#define SDHCI_ARASAN_QUIRK_CLOCK_25_BROKEN BIT(2)
 };
 
 struct sdhci_arasan_of_data {
@@ -290,6 +296,16 @@ static void sdhci_arasan_set_clock(struct sdhci_host *host, unsigned int clock)
 		sdhci_arasan->is_phy_on = false;
 	}
 
+	if (sdhci_arasan->quirks & SDHCI_ARASAN_QUIRK_CLOCK_25_BROKEN) {
+		/*
+		 * Some of the Arasan variations might not have timing
+		 * requirements met at 25MHz for Default Speed mode,
+		 * those controllers work at 19MHz instead.
+		 */
+		if (clock == DEFAULT_SPEED_MAX_DTR)
+			clock = (DEFAULT_SPEED_MAX_DTR * 19) / 25;
+	}
+
 	/* Set the Input and Output Clock Phase Delays */
 	if (clk_data->set_clk_delays)
 		clk_data->set_clk_delays(host);
@@ -1598,6 +1614,8 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 	if (of_device_is_compatible(np, "xlnx,zynqmp-8.9a")) {
 		host->mmc_host_ops.execute_tuning =
 			arasan_zynqmp_execute_tuning;
+
+		sdhci_arasan->quirks |= SDHCI_ARASAN_QUIRK_CLOCK_25_BROKEN;
 	}
 
 	arasan_dt_parse_clk_phases(dev, &sdhci_arasan->clk_data);
-- 
2.1.1


WARNING: multiple messages have this Message-ID (diff)
From: Manish Narani <manish.narani@xilinx.com>
To: <michal.simek@xilinx.com>, <adrian.hunter@intel.com>,
	<ulf.hansson@linaro.org>
Cc: <linux-arm-kernel@lists.infradead.org>,
	<linux-mmc@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Manish Narani <manish.narani@xilinx.com>
Subject: [PATCH 1/7] mmc: sdhci-of-arasan: Modified SD default speed to 19MHz for ZynqMP
Date: Tue, 15 Jun 2021 16:13:51 +0530	[thread overview]
Message-ID: <1623753837-21035-2-git-send-email-manish.narani@xilinx.com> (raw)
In-Reply-To: <1623753837-21035-1-git-send-email-manish.narani@xilinx.com>

SD standard speed timing was met only at 19MHz and not 25 MHz, that's
why changing driver to 19MHz. The reason for this is when a level shifter
is used on the board, timing was met for standard speed only at 19MHz.
Since this level shifter is commonly required for high speed modes,
the driver is modified to use standard speed of 19Mhz.

Signed-off-by: Manish Narani <manish.narani@xilinx.com>
---
 drivers/mmc/host/sdhci-of-arasan.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
index 839965f..fc3e41c 100644
--- a/drivers/mmc/host/sdhci-of-arasan.c
+++ b/drivers/mmc/host/sdhci-of-arasan.c
@@ -159,6 +159,12 @@ struct sdhci_arasan_data {
 /* Controller immediately reports SDHCI_CLOCK_INT_STABLE after enabling the
  * internal clock even when the clock isn't stable */
 #define SDHCI_ARASAN_QUIRK_CLOCK_UNSTABLE BIT(1)
+/*
+ * Some of the Arasan variations might not have timing requirements
+ * met at 25MHz for Default Speed mode, those controllers work at
+ * 19MHz instead
+ */
+#define SDHCI_ARASAN_QUIRK_CLOCK_25_BROKEN BIT(2)
 };
 
 struct sdhci_arasan_of_data {
@@ -290,6 +296,16 @@ static void sdhci_arasan_set_clock(struct sdhci_host *host, unsigned int clock)
 		sdhci_arasan->is_phy_on = false;
 	}
 
+	if (sdhci_arasan->quirks & SDHCI_ARASAN_QUIRK_CLOCK_25_BROKEN) {
+		/*
+		 * Some of the Arasan variations might not have timing
+		 * requirements met at 25MHz for Default Speed mode,
+		 * those controllers work at 19MHz instead.
+		 */
+		if (clock == DEFAULT_SPEED_MAX_DTR)
+			clock = (DEFAULT_SPEED_MAX_DTR * 19) / 25;
+	}
+
 	/* Set the Input and Output Clock Phase Delays */
 	if (clk_data->set_clk_delays)
 		clk_data->set_clk_delays(host);
@@ -1598,6 +1614,8 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 	if (of_device_is_compatible(np, "xlnx,zynqmp-8.9a")) {
 		host->mmc_host_ops.execute_tuning =
 			arasan_zynqmp_execute_tuning;
+
+		sdhci_arasan->quirks |= SDHCI_ARASAN_QUIRK_CLOCK_25_BROKEN;
 	}
 
 	arasan_dt_parse_clk_phases(dev, &sdhci_arasan->clk_data);
-- 
2.1.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-06-15 10:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-15 10:43 [PATCH 0/7] sdhci-of-arasan driver updates for ZynqMP platform Manish Narani
2021-06-15 10:43 ` Manish Narani
2021-06-15 10:43 ` Manish Narani [this message]
2021-06-15 10:43   ` [PATCH 1/7] mmc: sdhci-of-arasan: Modified SD default speed to 19MHz for ZynqMP Manish Narani
2021-06-15 10:43 ` [PATCH 2/7] mmc: sdhci-of-arasan: Add "SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12" quirk Manish Narani
2021-06-15 10:43   ` Manish Narani
2021-06-15 10:43 ` [PATCH 3/7] mmc: sdhci-of-arasan: Skip Auto tuning for DDR50 mode in ZynqMP platform Manish Narani
2021-06-15 10:43   ` Manish Narani
2021-06-15 10:43 ` [PATCH 4/7] mmc: host: sdhci-of-arasan: Check return value of non-void funtions Manish Narani
2021-06-15 10:43   ` Manish Narani
2021-06-15 10:43 ` [PATCH 5/7] mmc: host: sdhci-of-arasan: Use appropriate type of division macro Manish Narani
2021-06-15 10:43   ` Manish Narani
2021-06-15 10:43 ` [PATCH 6/7] mmc: host: sdhci-of-arasan: Modify data type of the clk_phase array Manish Narani
2021-06-15 10:43   ` Manish Narani
2021-06-15 10:43 ` [PATCH 7/7] mmc: arasan: Fix the issue in reading tap values from DT Manish Narani
2021-06-15 10:43   ` Manish Narani
2021-06-22 15:07 ` [PATCH 0/7] sdhci-of-arasan driver updates for ZynqMP platform Adrian Hunter
2021-06-22 15:07   ` Adrian Hunter
2021-06-29 15:09 ` Ulf Hansson
2021-06-29 15:09   ` 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=1623753837-21035-2-git-send-email-manish.narani@xilinx.com \
    --to=manish.narani@xilinx.com \
    --cc=adrian.hunter@intel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.