Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1211901

[RESEND PATCH] clk: rockchip: disable init state before mmc card initialization

Path csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod
From Shawn Lin <shawn.lin@rock-chips.com>
Newsgroups linux.kernel
Subject [RESEND PATCH] clk: rockchip: disable init state before mmc card initialization
Date Mon, 24 Aug 2015 10:30:02 +0200
Message-ID <q0ViG-2dY-7@gated-at.bofh.it> (permalink)
X-Original-To Heiko Stuebner <heiko@sntech.de>, Stephen Boyd <sboyd@codeaurora.org>, Michael Turquette <mturquette@baylibre.com>
X-263anti-Spam KSV:0;
X-Mail-Gray 1
X-Abs-Checked 4
X-Rl-Sender shawn.lin@rock-chips.com
X-Fst-To heiko@sntech.de
X-Sender-IP 58.22.7.114
X-Login-Name shawn.lin@rock-chips.com
X-Unique-Tag <e207240447ebdcda23a0a2b81e343835>
X-Sender lintao@rock-chips.com
X-Mailer git-send-email 1.8.0
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 69
Organization linux.* mail to news gateway
X-Original-Cc linux-clk@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Shawn Lin <shawn.lin@rock-chips.com>
X-Original-Date Mon, 24 Aug 2015 16:27:43 +0800
X-Original-Message-ID <1440404863-14350-1-git-send-email-shawn.lin@rock-chips.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1211901

Show key headers only | View raw


mmc host controller's IO input/output timing is unpredictable if
bootloader execute tuning for HS200 mode. It might make kernel failed
to initialize mmc card in identification mode. The root cause is
tuning phase and degree setting for HS200 mode in bootloader aren't
applicable to that of identification mode in kernel stage. Anyway, we
can't force all bootloaders to disable tuning phase and degree setting
before into kernel. Simply disable it in rockchip_clk_register_mmc.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>

---

 drivers/clk/rockchip/clk-mmc-phase.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/clk/rockchip/clk-mmc-phase.c b/drivers/clk/rockchip/clk-mmc-phase.c
index e9f8df32..ae21592 100644
--- a/drivers/clk/rockchip/clk-mmc-phase.c
+++ b/drivers/clk/rockchip/clk-mmc-phase.c
@@ -38,6 +38,9 @@ static unsigned long rockchip_mmc_recalc(struct clk_hw *hw,
 #define ROCKCHIP_MMC_DEGREE_MASK 0x3
 #define ROCKCHIP_MMC_DELAYNUM_OFFSET 2
 #define ROCKCHIP_MMC_DELAYNUM_MASK (0xff << ROCKCHIP_MMC_DELAYNUM_OFFSET)
+#define ROCKCHIP_MMC_INIT_STATE_DISABLE (0x1)
+#define ROCKCHIP_MMC_INIT_STATE_SHIFT (1)
+#define ROCKCHIP_MMC_INIT_STATE_MASK  (0x1)
 
 #define PSECS_PER_SEC 1000000000000LL
 
@@ -119,6 +122,21 @@ static const struct clk_ops rockchip_mmc_clk_ops = {
 	.set_phase	= rockchip_mmc_set_phase,
 };
 
+static void rockchip_clk_mmc_disable_init(struct rockchip_mmc_clock *mmc_clock)
+{
+	if (mmc_clock->shift != ROCKCHIP_MMC_INIT_STATE_SHIFT)
+		return;
+
+	writel(HIWORD_UPDATE(ROCKCHIP_MMC_INIT_STATE_DISABLE,
+			     ROCKCHIP_MMC_INIT_STATE_MASK,
+			     mmc_clock->shift),
+	       mmc_clock->reg);
+
+	pr_debug("%s: clear mmc init state to %d", __func__,
+		 (readl(mmc_clock->reg) >> (mmc_clock->shift)) &
+		 ROCKCHIP_MMC_INIT_STATE_MASK);
+}
+
 struct clk *rockchip_clk_register_mmc(const char *name,
 				const char *const *parent_names, u8 num_parents,
 				void __iomem *reg, int shift)
@@ -139,6 +157,8 @@ struct clk *rockchip_clk_register_mmc(const char *name,
 	mmc_clock->reg = reg;
 	mmc_clock->shift = shift;
 
+	rockchip_clk_mmc_disable_init(mmc_clock);
+
 	if (name)
 		init.name = name;
 
-- 
2.3.7


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[RESEND PATCH] clk: rockchip: disable init state before mmc card initialization Shawn Lin <shawn.lin@rock-chips.com> - 2015-08-24 10:30 +0200
  Re: [RESEND PATCH] clk: rockchip: disable init state before mmc card initialization Heiko Stuebner <heiko@sntech.de> - 2015-08-24 12:10 +0200
    Re: [RESEND PATCH] clk: rockchip: disable init state before mmc card  initialization Shawn Lin <shawn.lin@rock-chips.com> - 2015-08-24 16:10 +0200

csiph-web