From: Chaotian Jing <chaotian.jing@mediatek.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: <linux-mediatek@lists.infradead.org>,
Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>,
Seungwon Jeon <tgih.jun@samsung.com>,
Jaehoon Chung <jh80.chung@samsung.com>,
Kukjin Kim <kgene@kernel.org>,
Krzysztof Kozlowski <k.kozlowski@samsung.com>,
Barry Song <baohua@kernel.org>,
Hans de Goede <hdegoede@redhat.com>,
Chaotian Jing <chaotian.jing@mediatek.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Javier Martinez Canillas <javier.martinez@collabora.co.uk>,
Sascha Hauer <s.hauer@pengutronix.de>,
Howard Chen <ibanezchen@gmail.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Kristina Martsenko <kristina.martsenko@gmail.com>,
Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
Stephen Boyd <sboyd@codeaurora.org>,
Minda Chen <Minda.Chen@csr.com>,
Dong Aisheng <b29396@freescale.com>,
Johan Derycke <johan.derycke@barco.com>,
Haibo Chen <haibo.chen@freescale.com>,
Fabio Estevam <fabio.estevam@freescale.com>,
Georgi Djakov <georgi.djakov@linaro.org>,
<ivan.ivanov@linaro.org>, Weijun Yang <Weijun.Yang@csr.com>,
Kevin Hao <haokexin@gmail.com>, <devicetree@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-mmc@vger.kernel.org>, <linux-samsung-soc@vger.kernel.org>,
<srv_heupstream@mediatek.com>
Subject: [PATCH v3 04/10] mmc: mediatek: change the argument "ddr" to "timing"
Date: Tue, 27 Oct 2015 14:24:24 +0800 [thread overview]
Message-ID: <1445927070-5102-5-git-send-email-chaotian.jing@mediatek.com> (raw)
In-Reply-To: <1445927070-5102-1-git-send-email-chaotian.jing@mediatek.com>
use the ios->timing directly is better
It can reflect current timing and do settings by timing
Signed-off-by: Chaotian Jing <chaotian.jing@mediatek.com>
---
drivers/mmc/host/mtk-sd.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
index 8b3e15d..c877ded 100644
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -297,7 +297,7 @@ struct msdc_host {
u32 mclk; /* mmc subsystem clock frequency */
u32 src_clk_freq; /* source clock frequency */
u32 sclk; /* SD/MS bus clock frequency */
- bool ddr;
+ unsigned char timing;
bool vqmmc_enabled;
struct msdc_save_para save_para; /* used when gate HCLK */
};
@@ -488,7 +488,7 @@ static void msdc_ungate_clock(struct msdc_host *host)
cpu_relax();
}
-static void msdc_set_mclk(struct msdc_host *host, int ddr, u32 hz)
+static void msdc_set_mclk(struct msdc_host *host, unsigned char timing, u32 hz)
{
u32 mode;
u32 flags;
@@ -504,7 +504,8 @@ static void msdc_set_mclk(struct msdc_host *host, int ddr, u32 hz)
flags = readl(host->base + MSDC_INTEN);
sdr_clr_bits(host->base + MSDC_INTEN, flags);
- if (ddr) { /* may need to modify later */
+ if (timing == MMC_TIMING_UHS_DDR50 ||
+ timing == MMC_TIMING_MMC_DDR52) {
mode = 0x2; /* ddr mode and use divisor */
if (hz >= (host->src_clk_freq >> 2)) {
div = 0; /* mean div = 1/4 */
@@ -535,12 +536,12 @@ static void msdc_set_mclk(struct msdc_host *host, int ddr, u32 hz)
cpu_relax();
host->sclk = sclk;
host->mclk = hz;
- host->ddr = ddr;
+ host->timing = timing;
/* need because clk changed. */
msdc_set_timeout(host, host->timeout_ns, host->timeout_clks);
sdr_set_bits(host->base + MSDC_INTEN, flags);
- dev_dbg(host->dev, "sclk: %d, ddr: %d\n", host->sclk, ddr);
+ dev_dbg(host->dev, "sclk: %d, timing: %d\n", host->sclk, timing);
}
static inline u32 msdc_cmd_find_resp(struct msdc_host *host,
@@ -1158,14 +1159,9 @@ static void msdc_ops_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
{
struct msdc_host *host = mmc_priv(mmc);
int ret;
- u32 ddr = 0;
pm_runtime_get_sync(host->dev);
- if (ios->timing == MMC_TIMING_UHS_DDR50 ||
- ios->timing == MMC_TIMING_MMC_DDR52)
- ddr = 1;
-
msdc_set_buswidth(host, ios->bus_width);
/* Suspend/Resume will do power off/on */
@@ -1202,8 +1198,8 @@ static void msdc_ops_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
break;
}
- if (host->mclk != ios->clock || host->ddr != ddr)
- msdc_set_mclk(host, ddr, ios->clock);
+ if (host->mclk != ios->clock || host->timing != ios->timing)
+ msdc_set_mclk(host, ios->timing, ios->clock);
end:
pm_runtime_mark_last_busy(host->dev);
--
1.8.1.1.dirty
next prev parent reply other threads:[~2015-10-27 6:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-27 6:24 [PATCH v3 00/10] Add tune support of Mediatek MMC driver Chaotian Jing
2015-10-27 6:24 ` [PATCH v3 01/10] mmc: core: Add DT bindings for eMMC hardware reset support Chaotian Jing
2015-10-27 6:24 ` [PATCH v3 02/10] mmc: dt-bindings: update Mediatek MMC bindings Chaotian Jing
2015-10-27 6:24 ` [PATCH v3 03/10] mmc: mediatek: make cmd_ints_mask to const Chaotian Jing
2015-10-27 6:24 ` Chaotian Jing [this message]
2015-10-27 6:24 ` [PATCH v3 05/10] mmc: mediatek: fix got GPD checksum error interrupt when data transfer Chaotian Jing
2015-10-27 6:24 ` [PATCH v3 06/10] mmc: mediatek: add implement of ops->hw_reset() Chaotian Jing
2015-10-27 6:24 ` [PATCH v3 07/10] arm64: dts: mediatek: add eMMC hw reset support Chaotian Jing
2015-10-27 6:24 ` [PATCH v3 08/10] mmc: mmc: extend the mmc_send_tuning() Chaotian Jing
2015-10-27 6:24 ` [PATCH v3 09/10] mmc: mediatek: add HS400 support Chaotian Jing
2015-10-27 6:24 ` [PATCH v3 10/10] arm64: dts: mediatek: add HS200/HS400/SDR50/SDR104 support Chaotian Jing
2015-10-27 9:54 ` [PATCH v3 00/10] Add tune support of Mediatek MMC driver 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=1445927070-5102-5-git-send-email-chaotian.jing@mediatek.com \
--to=chaotian.jing@mediatek.com \
--cc=Minda.Chen@csr.com \
--cc=Weijun.Yang@csr.com \
--cc=adrian.hunter@intel.com \
--cc=b29396@freescale.com \
--cc=baohua@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=devicetree@vger.kernel.org \
--cc=fabio.estevam@freescale.com \
--cc=galak@codeaurora.org \
--cc=georgi.djakov@linaro.org \
--cc=haibo.chen@freescale.com \
--cc=haokexin@gmail.com \
--cc=hdegoede@redhat.com \
--cc=ibanezchen@gmail.com \
--cc=ijc+devicetree@hellion.org.uk \
--cc=ivan.ivanov@linaro.org \
--cc=javier.martinez@collabora.co.uk \
--cc=jh80.chung@samsung.com \
--cc=johan.derycke@barco.com \
--cc=k.kozlowski@samsung.com \
--cc=kgene@kernel.org \
--cc=kristina.martsenko@gmail.com \
--cc=lars@metafoo.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=matthias.bgg@gmail.com \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=sboyd@codeaurora.org \
--cc=sergei.shtylyov@cogentembedded.com \
--cc=srv_heupstream@mediatek.com \
--cc=tgih.jun@samsung.com \
--cc=ulf.hansson@linaro.org \
--cc=will.deacon@arm.com \
/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).