linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: srinivas.kandagatla@linaro.org
To: Russell King <linux@arm.linux.org.uk>, linux-mmc@vger.kernel.org
Cc: Chris Ball <chris@printf.net>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	linux-kernel@vger.kernel.org, agross@quicinc.com,
	linux-arm-msm@vger.kernel.org,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Subject: [PATCH v1 08/11] mmc: mmci: Qcom fix MCICLK register settings.
Date: Tue, 29 Apr 2014 09:20:37 +0100	[thread overview]
Message-ID: <1398759638-13299-1-git-send-email-srinivas.kandagatla@linaro.org> (raw)
In-Reply-To: <1398759492-12970-1-git-send-email-srinivas.kandagatla@linaro.org>

From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

MCICLK register layout is bit different to the standard pl180 register layout.
Qcom SDCC controller some setup in MCICLK register to get it going. So this
patch adds new setup and makes it specific to Qcom hw designer.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/mmc/host/mmci.c |   36 ++++++++++++++++++++++++++++++------
 drivers/mmc/host/mmci.h |   21 +++++++++++++++++++++
 2 files changed, 51 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 306e0c8..35aed38 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -326,13 +326,37 @@ static void mmci_set_clkreg(struct mmci_host *host, unsigned int desired)
 	/* Set actual clock for debug */
 	host->mmc->actual_clock = host->cclk;
 
-	if (host->mmc->ios.bus_width == MMC_BUS_WIDTH_4)
-		clk |= MCI_4BIT_BUS;
-	if (host->mmc->ios.bus_width == MMC_BUS_WIDTH_8)
-		clk |= MCI_ST_8BIT_BUS;
+	if (host->hw_designer == AMBA_VENDOR_QCOM) {
+		clk |= MCI_CLK_QCOM_FLOWENA;
+		clk |= (MCI_CLK_QCOM_SEL_FEEDBACK_CLK <<
+				MCI_CLK_QCOM_SEL_IN_SHIFT); /* feedback clk */
+		if (host->mmc->ios.bus_width == MMC_BUS_WIDTH_8)
+			clk |= MCI_CLK_QCOM_WIDEBUS_8;
+		else if (host->mmc->ios.bus_width == MMC_BUS_WIDTH_4)
+			clk |= MCI_CLK_QCOM_WIDEBUS_4;
+		else
+			clk |= MCI_CLK_QCOM_WIDEBUS_1;
+
+		if (host->mmc->ios.timing == MMC_TIMING_UHS_DDR50) {
+			/* clear SELECT_IN field */
+			clk &= ~(MCI_CLK_QCOM_SEL_MASK <<
+					MCI_CLK_QCOM_SEL_IN_SHIFT);
+			/* set DDR timing mode */
+			clk |= (MCI_CLK_QCOM_SEL_DDR_MODE <<
+					MCI_CLK_QCOM_SEL_IN_SHIFT);
+		}
+		clk |= (MCI_CLK_SDC4_MCLK_SEL_MCLK <<
+				MCI_CLK_SDC4_MCLK_SEL_SHIFT);
 
-	if (host->mmc->ios.timing == MMC_TIMING_UHS_DDR50)
-		clk |= MCI_ST_UX500_NEG_EDGE;
+	} else {
+		if (host->mmc->ios.bus_width == MMC_BUS_WIDTH_4)
+			clk |= MCI_4BIT_BUS;
+		if (host->mmc->ios.bus_width == MMC_BUS_WIDTH_8)
+			clk |= MCI_ST_8BIT_BUS;
+
+		if (host->mmc->ios.timing == MMC_TIMING_UHS_DDR50)
+			clk |= MCI_ST_UX500_NEG_EDGE;
+	}
 
 	mmci_write_clkreg(host, clk);
 }
diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h
index 58b1b88..0a6de1c 100644
--- a/drivers/mmc/host/mmci.h
+++ b/drivers/mmc/host/mmci.h
@@ -31,6 +31,27 @@
 /* Modified PL180 on Versatile Express platform */
 #define MCI_ARM_HWFCEN		(1 << 12)
 
+/* Modified on Qualcomm Integrations */
+#define MCI_CLK_QCOM_WIDEBUS_1	(0 << 10)
+#define MCI_CLK_QCOM_WIDEBUS_4	(2 << 10)
+#define MCI_CLK_QCOM_WIDEBUS_8	(3 << 10)
+#define MCI_CLK_QCOM_FLOWENA	(1 << 12)
+#define MCI_CLK_QCOM_INVERTOUT	(1 << 13)
+
+/* select in latch data and command */
+#define MCI_CLK_QCOM_SEL_IN_SHIFT	(14)
+#define MCI_CLK_QCOM_SEL_MASK		(0x3)
+#define MCI_CLK_QCOM_SEL_RISING_EDGE	(1)
+#define MCI_CLK_QCOM_SEL_FEEDBACK_CLK	(2)
+#define MCI_CLK_QCOM_SEL_DDR_MODE	(3)
+
+/* mclk selection */
+#define MCI_CLK_SDC4_MCLK_SEL_SHIFT	(23)
+#define MCI_CLK_SDC4_MCLK_SEL_MASK	(0x3)
+#define MCI_CLK_SDC4_MCLK_SEL_FB_CLK	(1)
+#define MCI_CLK_SDC4_MCLK_SEL_MCLK	(2)
+
+
 #define MMCIARGUMENT		0x008
 #define MMCICOMMAND		0x00c
 #define MCI_CPSM_RESPONSE	(1 << 6)
-- 
1.7.9.5


  parent reply	other threads:[~2014-04-29  8:20 UTC|newest]

Thread overview: 96+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-21 21:43 [PATCH RFC 00/12] Add Qualcomm SD Card Controller support srinivas.kandagatla
2014-04-21 21:47 ` [PATCH RFC 01/12] ARM: amba: Add Qualcomm vendor ID srinivas.kandagatla
2014-04-21 21:47 ` [PATCH RFC 02/12] mmc: mmci: Add Qualcomm Id to amba id table srinivas.kandagatla
2014-04-21 21:47 ` [PATCH RFC 03/12] mmc: mmci: Add Qcom datactrl register variant srinivas.kandagatla
2014-04-21 21:47 ` [PATCH RFC 04/12] mmc: mmci: Add register read/write wrappers srinivas.kandagatla
2014-04-21 21:47 ` [PATCH RFC 05/12] mmc: mmci: use NSEC_PER_SEC macro srinivas.kandagatla
2014-04-21 21:48 ` [PATCH RFC 06/12] mmc: mmci: Add write delay to variant structure srinivas.kandagatla
2014-04-21 22:08   ` Felipe Balbi
2014-04-22  8:15     ` Srinivas Kandagatla
2014-04-21 21:48 ` [PATCH RFC 07/12] mmc: mmci: Qcomm: Add 3 clock cycle delay after each register write srinivas.kandagatla
2014-04-21 21:48 ` [PATCH RFC 08/12] mmc: mmci: move ST specific register extensions access under condition srinivas.kandagatla
2014-04-21 21:48 ` [PATCH RFC 09/12] mmc: mmci: Qcom fix MCICLK register settings srinivas.kandagatla
2014-04-21 21:49 ` [PATCH RFC 10/12] mmc: mmci: Add clock support for Qualcomm srinivas.kandagatla
2014-04-21 22:20   ` Stephen Boyd
2014-04-22 10:03     ` Srinivas Kandagatla
2014-04-21 21:49 ` [PATCH RFC 11/12] mmc: mmci: Add Qcom variations to MCICommand register srinivas.kandagatla
2014-04-21 21:49 ` [PATCH RFC 12/12] mmc: mmci: Add Qcom specific pio_read function srinivas.kandagatla
2014-04-22 12:58 ` [PATCH RFC 00/12] Add Qualcomm SD Card Controller support Christopher Covington
2014-04-22 14:16   ` Srinivas Kandagatla
2014-04-29  8:18 ` [PATCH v1 00/11] " srinivas.kandagatla
2014-04-29  8:19   ` [PATCH v1 01/11] ARM: amba: Add Qualcomm vendor ID srinivas.kandagatla
2014-05-13  7:16     ` Linus Walleij
2014-05-13  9:41       ` Srinivas Kandagatla
2014-05-13 22:13         ` Stephen Boyd
2014-05-14  6:45           ` Srinivas Kandagatla
2014-05-16 16:24           ` Linus Walleij
2014-05-16 16:43             ` Stephen Boyd
2014-05-22 21:54               ` Linus Walleij
2014-04-29  8:19   ` [PATCH v1 02/11] mmc: mmci: Add Qualcomm Id to amba id table srinivas.kandagatla
2014-05-13  7:17     ` Linus Walleij
2014-05-13  9:00       ` Srinivas Kandagatla
2014-04-29  8:19   ` [PATCH v1 03/11] mmc: mmci: Add Qcom datactrl register variant srinivas.kandagatla
2014-05-13  7:19     ` Linus Walleij
2014-04-29  8:19   ` [PATCH v1 04/11] mmc: mmci: Add register read/write wrappers srinivas.kandagatla
2014-04-29  8:20   ` [PATCH v1 05/11] mmc: mmci: use NSEC_PER_SEC macro srinivas.kandagatla
2014-05-13  7:20     ` Linus Walleij
2014-05-13  9:02       ` Srinivas Kandagatla
2014-04-29  8:20   ` [PATCH v1 06/11] mmc: mmci: Qcomm: Add 3 clock cycle delay after register write srinivas.kandagatla
2014-05-13  7:29     ` Linus Walleij
2014-05-13  9:14       ` Srinivas Kandagatla
2014-04-29  8:20   ` [PATCH v1 07/11] mmc: mmci: move ST specific register extensions access under condition srinivas.kandagatla
2014-05-13  8:08     ` Linus Walleij
2014-05-13  9:33       ` Srinivas Kandagatla
2014-04-29  8:20   ` srinivas.kandagatla [this message]
2014-05-13  8:19     ` [PATCH v1 08/11] mmc: mmci: Qcom fix MCICLK register settings Linus Walleij
2014-05-13  9:36       ` Srinivas Kandagatla
2014-04-29  8:20   ` [PATCH v1 09/11] mmc: mmci: Add clock support for Qualcomm srinivas.kandagatla
2014-05-13  8:28     ` Linus Walleij
2014-05-13  9:39       ` Srinivas Kandagatla
2014-04-29  8:21   ` [PATCH v1 10/11] mmc: mmci: Add Qcom variations to MCICommand register srinivas.kandagatla
2014-05-13  8:29     ` Linus Walleij
2014-04-29  8:21   ` [PATCH v1 11/11] mmc: mmci: Add Qcom specific pio_read function srinivas.kandagatla
2014-05-13  8:34     ` Linus Walleij
2014-05-13  9:42       ` Srinivas Kandagatla
2014-05-09 17:56   ` [PATCH v1 00/11] Add Qualcomm SD Card Controller support Bjorn Andersson
2014-05-09 18:32     ` Srinivas Kandagatla
2014-05-13 10:04   ` Ulf Hansson
2014-05-13 10:21     ` Srinivas Kandagatla
2014-05-15  9:34 ` [PATCH v2 00/14] " srinivas.kandagatla
2014-05-15  9:36   ` [PATCH v2 01/14] mmc: mmci: use NSEC_PER_SEC macro srinivas.kandagatla
2014-05-15  9:36   ` [PATCH v2 02/14] mmc: mmci: convert register bits to use BIT() macro srinivas.kandagatla
2014-05-15  9:36   ` [PATCH v2 03/14] mmc: mmci: Add Qualcomm Id to amba id table srinivas.kandagatla
2014-05-15  9:36   ` [PATCH v2 04/14] mmc: mmci: Add Qcom datactrl register variant srinivas.kandagatla
2014-05-15  9:36   ` [PATCH v2 05/14] mmc: mmci: Add register read/write wrappers srinivas.kandagatla
2014-05-23  9:04     ` Linus Walleij
2014-05-15  9:37   ` [PATCH v2 06/14] mmc: mmci: Qcomm: Add 3 clock cycle delay after register write srinivas.kandagatla
2014-05-23  9:03     ` Linus Walleij
2014-05-15  9:37   ` [PATCH v2 07/14] mmc: mmci: add ddrmode mask to variant data srinivas.kandagatla
2014-05-23  9:05     ` Linus Walleij
2014-05-15  9:37   ` [PATCH v2 08/14] mmc: mmci: add 8bit bus support in " srinivas.kandagatla
2014-05-23  9:05     ` Linus Walleij
2014-05-15  9:37   ` [PATCH v2 09/14] mmc: mmci: add edge support to data and command out " srinivas.kandagatla
2014-05-23  9:06     ` Linus Walleij
2014-05-15  9:37   ` [PATCH v2 10/14] mmc: mmci: add Qcom specifics of clk and datactrl registers srinivas.kandagatla
2014-05-23  9:08     ` Linus Walleij
2014-05-15  9:37   ` [PATCH v2 11/14] mmc: mmci: Add support to data commands via variant structure srinivas.kandagatla
2014-05-23  9:09     ` Linus Walleij
2014-05-23  9:10       ` Srinivas Kandagatla
2014-05-15  9:37   ` [PATCH v2 12/14] mmc: mmci: add support for fbclk to latch data and cmd srinivas.kandagatla
2014-05-23  9:12     ` Linus Walleij
2014-05-23  9:20       ` Srinivas Kandagatla
2014-05-15  9:37   ` [PATCH v2 13/14] mmc: mmci: add qcom specific clk control srinivas.kandagatla
2014-05-23  9:14     ` Linus Walleij
2014-05-15  9:38   ` [PATCH v2 14/14] mmc: mmci: Add Qcom specific pio_read function srinivas.kandagatla
2014-05-23  9:31     ` Linus Walleij
2014-05-23  9:42       ` Srinivas Kandagatla
2014-05-23 11:53       ` Srinivas Kandagatla
2014-05-23  7:13   ` [PATCH v2 00/14] Add Qualcomm SD Card Controller support Srinivas Kandagatla
2014-05-23  7:50     ` Ulf Hansson
2014-05-23  8:11       ` Srinivas Kandagatla
2014-05-23 15:20         ` Bjorn Andersson
2014-05-23 16:50           ` Srinivas Kandagatla
2014-05-23 23:26             ` Bjorn Andersson
2014-05-24  7:32               ` Srinivas Kandagatla
2014-05-19 22:08 ` [PATCH RFC 00/12] " Bjorn Andersson
2014-05-20  8:10   ` Srinivas Kandagatla

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=1398759638-13299-1-git-send-email-srinivas.kandagatla@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=agross@quicinc.com \
    --cc=chris@printf.net \
    --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).