linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: linux-mmc@vger.kernel.org
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Chris Ball <chris@printf.net>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Russell King <linux@arm.linux.org.uk>,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Subject: [PATCH v3 3/3] mmc: mmci: rename sdio flag in vendor data to st_sdio
Date: Fri, 22 Aug 2014 05:55:16 +0100	[thread overview]
Message-ID: <1408683316-8074-1-git-send-email-srinivas.kandagatla@linaro.org> (raw)
In-Reply-To: <1408683219-7939-1-git-send-email-srinivas.kandagatla@linaro.org>

This patch renames sdio flag in vendor data to st_sdio, as this flag is
only used to enable ST specific sdio setup. This will also ensure that
the ST specfic setup is not done on other vendor like Qualcomm.

Originally the issue was detected while testing WLAN ath6kl on IFC6410
board with APQ8064 SOC.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/mmc/host/mmci.c | 48 ++++++++++++++++++++++++------------------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index a25759e..264c947 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -61,7 +61,7 @@ static unsigned int fmax = 515633;
  * @fifohalfsize: number of bytes that can be written when MCI_TXFIFOHALFEMPTY
  *		  is asserted (likewise for RX)
  * @data_cmd_enable: enable value for data commands.
- * @sdio: variant supports SDIO
+ * @st_sdio: enable ST specific SDIO logic
  * @st_clkdiv: true if using a ST-specific clock divider algorithm
  * @datactrl_mask_ddrmode: ddr mode mask in datactrl register.
  * @blksz_datactrl16: true if Block size is at b16..b30 position in datactrl register
@@ -91,7 +91,7 @@ struct variant_data {
 	unsigned int		data_cmd_enable;
 	unsigned int		datactrl_mask_ddrmode;
 	unsigned int		datactrl_mask_sdio;
-	bool			sdio;
+	bool			st_sdio;
 	bool			st_clkdiv;
 	bool			blksz_datactrl16;
 	bool			blksz_datactrl4;
@@ -141,7 +141,7 @@ static struct variant_data variant_u300 = {
 	.clkreg_8bit_bus_enable = MCI_ST_8BIT_BUS,
 	.datalength_bits	= 16,
 	.datactrl_mask_sdio	= MCI_ST_DPSM_SDIOEN,
-	.sdio			= true,
+	.st_sdio			= true,
 	.pwrreg_powerup		= MCI_PWR_ON,
 	.f_max			= 100000000,
 	.signal_direction	= true,
@@ -155,7 +155,7 @@ static struct variant_data variant_nomadik = {
 	.clkreg			= MCI_CLK_ENABLE,
 	.datalength_bits	= 24,
 	.datactrl_mask_sdio	= MCI_ST_DPSM_SDIOEN,
-	.sdio			= true,
+	.st_sdio		= true,
 	.st_clkdiv		= true,
 	.pwrreg_powerup		= MCI_PWR_ON,
 	.f_max			= 100000000,
@@ -173,7 +173,7 @@ static struct variant_data variant_ux500 = {
 	.clkreg_neg_edge_enable	= MCI_ST_UX500_NEG_EDGE,
 	.datalength_bits	= 24,
 	.datactrl_mask_sdio	= MCI_ST_DPSM_SDIOEN,
-	.sdio			= true,
+	.st_sdio		= true,
 	.st_clkdiv		= true,
 	.pwrreg_powerup		= MCI_PWR_ON,
 	.f_max			= 100000000,
@@ -193,7 +193,7 @@ static struct variant_data variant_ux500v2 = {
 	.datactrl_mask_ddrmode	= MCI_ST_DPSM_DDRMODE,
 	.datalength_bits	= 24,
 	.datactrl_mask_sdio	= MCI_ST_DPSM_SDIOEN,
-	.sdio			= true,
+	.st_sdio		= true,
 	.st_clkdiv		= true,
 	.blksz_datactrl16	= true,
 	.pwrreg_powerup		= MCI_PWR_ON,
@@ -818,26 +818,26 @@ static void mmci_start_data(struct mmci_host *host, struct mmc_data *data)
 	if (data->flags & MMC_DATA_READ)
 		datactrl |= MCI_DPSM_DIRECTION;
 
-	if (variant->sdio && host->mmc->card)
-		if (mmc_card_sdio(host->mmc->card)) {
-			u32 clk;
-			datactrl |= variant->datactrl_mask_sdio;
+	if (host->mmc->card && mmc_card_sdio(host->mmc->card)) {
+		u32 clk;
 
-			/*
-			 * The ST Micro variant for SDIO small write transfers
-			 * needs to have clock H/W flow control disabled,
-			 * otherwise the transfer will not start. The threshold
-			 * depends on the rate of MCLK.
-			 */
-			if (data->flags & MMC_DATA_WRITE &&
-			    (host->size < 8 ||
-			     (host->size <= 8 && host->mclk > 50000000)))
-				clk = host->clk_reg & ~variant->clkreg_enable;
-			else
-				clk = host->clk_reg | variant->clkreg_enable;
+		datactrl |= variant->datactrl_mask_sdio;
 
-			mmci_write_clkreg(host, clk);
-		}
+		/*
+		 * The ST Micro variant for SDIO small write transfers
+		 * needs to have clock H/W flow control disabled,
+		 * otherwise the transfer will not start. The threshold
+		 * depends on the rate of MCLK.
+		 */
+		if (variant->st_sdio && data->flags & MMC_DATA_WRITE &&
+		    (host->size < 8 ||
+		     (host->size <= 8 && host->mclk > 50000000)))
+			clk = host->clk_reg & ~variant->clkreg_enable;
+		else
+			clk = host->clk_reg | variant->clkreg_enable;
+
+		mmci_write_clkreg(host, clk);
+	}
 
 	if (host->mmc->ios.timing == MMC_TIMING_UHS_DDR50 ||
 	    host->mmc->ios.timing == MMC_TIMING_MMC_DDR52)
-- 
1.9.1


  parent reply	other threads:[~2014-08-22  4:55 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-12 12:02 [PATCH RFC 0/5] mmc: mmci: sdio related fixes Srinivas Kandagatla
2014-08-12 12:03 ` [PATCH RFC 1/5] mmc: mmci: Enable SDIO support for Qualcomm variant data Srinivas Kandagatla
2014-08-12 12:03 ` [PATCH RFC 2/5] mmc: mmci: move block size validation under relevant code Srinivas Kandagatla
2014-08-12 12:04 ` [PATCH RFC 3/5] mmc: mmci: relax blksz check for SDIO Srinivas Kandagatla
2014-08-12 14:12   ` Russell King - ARM Linux
2014-08-13  5:14     ` Srinivas Kandagatla
2014-08-13  8:54       ` Linus Walleij
2014-08-12 12:05 ` [PATCH RFC 4/5] mmc: mmci: Add sdio enable mask in variant data Srinivas Kandagatla
2014-08-13  8:55   ` Linus Walleij
2014-08-12 12:05 ` [PATCH RFC 5/5] mmc: mmci: move ST specific sdio setup under a condition Srinivas Kandagatla
2014-08-13  8:58   ` Linus Walleij
2014-08-13  9:45     ` Srinivas Kandagatla
2014-08-19 11:13 ` [PATCH v2 0/4] mmc: mmci: sdio related fixes Srinivas Kandagatla
2014-08-19 11:14   ` [PATCH v2 1/4] mmc: mmci: Support any block sizes for ux500v2 and qcom variant Srinivas Kandagatla
2014-08-19 12:37     ` Ulf Hansson
2014-08-19 11:14   ` [PATCH v2 2/4] mmc: mmci: move block size validation under relevant code Srinivas Kandagatla
2014-08-19 11:55     ` Ulf Hansson
2014-08-19 12:08       ` Srinivas Kandagatla
2014-08-19 11:15   ` [PATCH v2 3/4] mmc: mmci: Add sdio enable mask in variant data Srinivas Kandagatla
2014-08-19 11:15   ` [PATCH v2 4/4] mmc: mmci: rename sdio flag in vendor data to st_sdio Srinivas Kandagatla
2014-08-22  4:53   ` [PATCH v3 0/3] mmc: mmci: sdio related fixes Srinivas Kandagatla
2014-08-22  4:54     ` [PATCH v3 1/3] mmc: mmci: Support any block sizes for ux500v2 and qcom variant Srinivas Kandagatla
2014-09-10  7:58       ` Ulf Hansson
2014-09-10  9:07         ` Srinivas Kandagatla
2014-09-10 10:51           ` Ulf Hansson
2015-07-09 21:40       ` Bjorn Andersson
2019-03-05 22:25       ` Linus Walleij
2019-03-06 17:03         ` Bjorn Andersson
2014-08-22  4:54     ` [PATCH v3 2/3] mmc: mmci: Add sdio enable mask in variant data Srinivas Kandagatla
2014-09-10  7:47       ` Ulf Hansson
2014-08-22  4:55     ` Srinivas Kandagatla [this message]
2014-09-10  7:48       ` [PATCH v3 3/3] mmc: mmci: rename sdio flag in vendor data to st_sdio Ulf Hansson
2014-09-09  8:34     ` [PATCH] mmc: mmci_qcom_dml: fix is never less than zero warning Srinivas Kandagatla
2014-09-09 11:53       ` 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=1408683316-8074-1-git-send-email-srinivas.kandagatla@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=chris@printf.net \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --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).