From: Ludovic Barre <ludovic.Barre@st.com>
To: Ulf Hansson <ulf.hansson@linaro.org>, Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org,
Alexandre Torgue <alexandre.torgue@st.com>,
linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
srinivas.kandagatla@linaro.org,
Ludovic Barre <ludovic.barre@st.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH V2 2/6] mmc: mmci: add helper functions to define datactrl value for variants
Date: Thu, 7 Mar 2019 17:38:58 +0100 [thread overview]
Message-ID: <1551976742-4358-3-git-send-email-ludovic.Barre@st.com> (raw)
In-Reply-To: <1551976742-4358-1-git-send-email-ludovic.Barre@st.com>
From: Ludovic Barre <ludovic.barre@st.com>
This patch adds default helper functions to define datactrl value.
Each variant could use these helpers to define datactrl and adds
their specific field.
Signed-off-by: Ludovic Barre <ludovic.barre@st.com>
---
drivers/mmc/host/mmci.c | 25 +++++++++++++++++++++++++
drivers/mmc/host/mmci.h | 5 +++++
2 files changed, 30 insertions(+)
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 9e6a2c1..28b76c5 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -983,6 +983,31 @@ static void mmci_post_request(struct mmc_host *mmc, struct mmc_request *mrq,
mmci_unprep_data(host, data, err);
}
+u32 mmci_dctrl_blksz(struct mmci_host *host)
+{
+ return (ffs(host->data->blksz) - 1) << 4;
+}
+
+u32 mmci_dctrl_dir(struct mmci_host *host)
+{
+ return host->data->flags & MMC_DATA_READ ? MCI_DPSM_DIRECTION : 0;
+}
+
+u32 mmci_dctrl_ddr(struct mmci_host *host)
+{
+ if (host->mmc->ios.timing == MMC_TIMING_UHS_DDR50 ||
+ host->mmc->ios.timing == MMC_TIMING_MMC_DDR52)
+ return host->variant->datactrl_mask_ddrmode;
+ return 0;
+}
+
+u32 mmci_dctrl_sdio(struct mmci_host *host)
+{
+ if (host->mmc->card && mmc_card_sdio(host->mmc->card))
+ return host->variant->datactrl_mask_sdio;
+ return 0;
+}
+
static void mmci_start_data(struct mmci_host *host, struct mmc_data *data)
{
struct variant_data *variant = host->variant;
diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h
index a59049b..32ae41d 100644
--- a/drivers/mmc/host/mmci.h
+++ b/drivers/mmc/host/mmci.h
@@ -430,6 +430,11 @@ struct mmci_host {
void mmci_write_clkreg(struct mmci_host *host, u32 clk);
void mmci_write_pwrreg(struct mmci_host *host, u32 pwr);
+u32 mmci_dctrl_blksz(struct mmci_host *host);
+u32 mmci_dctrl_dir(struct mmci_host *host);
+u32 mmci_dctrl_ddr(struct mmci_host *host);
+u32 mmci_dctrl_sdio(struct mmci_host *host);
+
#ifdef CONFIG_DMA_ENGINE
int mmci_dmae_prep_data(struct mmci_host *host, struct mmc_data *data,
bool next);
--
2.7.4
next prev parent reply other threads:[~2019-03-07 16:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-07 16:38 [PATCH V2 0/6] mmc: mmci: add get_datactrl_cfg callback Ludovic Barre
2019-03-07 16:38 ` [PATCH V2 1/6] " Ludovic Barre
2019-03-21 16:57 ` Ulf Hansson
2019-03-07 16:38 ` Ludovic Barre [this message]
2019-03-21 16:43 ` [PATCH V2 2/6] mmc: mmci: add helper functions to define datactrl value for variants Ulf Hansson
2019-03-07 16:38 ` [PATCH V2 3/6] mmc: mmci: define get_dctrl_cfg for legacy variant Ludovic Barre
2019-03-21 16:55 ` Ulf Hansson
2019-03-07 16:39 ` [PATCH V2 4/6] mmc: mmci: qcom: define get_dctrl_cfg Ludovic Barre
2019-03-07 16:39 ` [PATCH V2 5/6] mmc: mmci: stm32: " Ludovic Barre
2019-03-07 16:39 ` [PATCH V2 6/6] mmc: mmci: replace blksz_datactrlXX by get_datactrl_cfg callback Ludovic Barre
2019-03-07 16:46 ` Russell King - ARM Linux admin
2019-03-08 8:44 ` Ludovic BARRE
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=1551976742-4358-3-git-send-email-ludovic.Barre@st.com \
--to=ludovic.barre@st.com \
--cc=alexandre.torgue@st.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=robh+dt@kernel.org \
--cc=srinivas.kandagatla@linaro.org \
--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