From: Adrian Hunter <adrian.hunter@intel.com>
To: Chunyan Zhang <zhang.chunyan@linaro.org>,
Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
Orson Zhai <orsonzhai@gmail.com>,
Baolin Wang <baolin.wang@linaro.org>,
Billows Wu <billows.wu@spreadtrum.com>,
Jason Wu <jason.wu@unisoc.com>,
zhang.lyra@gmail.com
Subject: Re: [PATCH V4 1/7] mmc: sdhci: add sd host v4 mode
Date: Mon, 30 Jul 2018 16:04:17 +0300 [thread overview]
Message-ID: <87ecfb68-775a-2a17-5b42-ae02b354e3d7@intel.com> (raw)
In-Reply-To: <1532340508-8749-2-git-send-email-zhang.chunyan@linaro.org>
On 23/07/18 13:08, Chunyan Zhang wrote:
> For SD host controller version 4.00 or later ones, there're two
> modes of implementation - Version 3.00 compatible mode or
> Version 4 mode. This patch introduced an interface to enable
> v4 mode.
>
> Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
> ---
> drivers/mmc/host/sdhci.c | 28 ++++++++++++++++++++++++++++
> drivers/mmc/host/sdhci.h | 5 +++++
> 2 files changed, 33 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 1c828e0..cab5350 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -123,6 +123,30 @@ EXPORT_SYMBOL_GPL(sdhci_dumpregs);
> * *
> \*****************************************************************************/
>
> +static void sdhci_do_enable_v4_mode(struct sdhci_host *host)
> +{
> + u16 ctrl2;
> +
> + ctrl2 = sdhci_readb(host, SDHCI_HOST_CONTROL2);
> + if (ctrl2 & SDHCI_CTRL_V4_MODE)
> + return;
> +
> + ctrl2 |= SDHCI_CTRL_V4_MODE;
> + sdhci_writeb(host, ctrl2, SDHCI_HOST_CONTROL);
> +}
> +
> +/*
> + * Vendor's Host Controller which supports v4 mode can call
> + * this function to enable v4 mode before calling
> + * __sdhci_add_host().
> + */
> +void sdhci_enable_v4_mode(struct sdhci_host *host)
> +{
> + host->v4_mode = true;
> + sdhci_do_enable_v4_mode(host);
> +}
> +EXPORT_SYMBOL_GPL(sdhci_enable_v4_mode);
> +
> static inline bool sdhci_data_line_cmd(struct mmc_command *cmd)
> {
> return cmd->data || cmd->flags & MMC_RSP_BUSY;
> @@ -224,6 +248,10 @@ static void sdhci_do_reset(struct sdhci_host *host, u8 mask)
>
> /* Resetting the controller clears many */
> host->preset_enabled = false;
> +
> + if (host->v4_mode)
> + sdhci_do_enable_v4_mode(host);
Instead of sdhci_do_reset() I would rather add this to sdhci_init() and
__sdhci_read_caps()
> +
> }
> }
>
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index 23966f8..519d939 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -184,6 +184,7 @@
> #define SDHCI_CTRL_DRV_TYPE_D 0x0030
> #define SDHCI_CTRL_EXEC_TUNING 0x0040
> #define SDHCI_CTRL_TUNED_CLK 0x0080
> +#define SDHCI_CTRL_V4_MODE 0x1000
> #define SDHCI_CTRL_PRESET_VAL_ENABLE 0x8000
>
> #define SDHCI_CAPABILITIES 0x40
> @@ -565,6 +566,9 @@ struct sdhci_host {
>
> u64 data_timeout;
>
> + /* Host Version 4 Enable */
> + bool v4_mode;
Let's put this with the other bools i.e. after bool irq_wake_enabled;
> +
> unsigned long private[0] ____cacheline_aligned;
> };
>
> @@ -747,5 +751,6 @@ bool sdhci_cqe_irq(struct sdhci_host *host, u32 intmask, int *cmd_error,
> int *data_error);
>
> void sdhci_dumpregs(struct sdhci_host *host);
> +void sdhci_enable_v4_mode(struct sdhci_host *host);
>
> #endif /* __SDHCI_HW_H */
>
next prev parent reply other threads:[~2018-07-30 13:04 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-23 10:08 [PATCH V4 0/7] mmc: add support for sdhci 4.0 Chunyan Zhang
2018-07-23 10:08 ` Chunyan Zhang
2018-07-23 10:08 ` [PATCH V4 1/7] mmc: sdhci: add sd host v4 mode Chunyan Zhang
2018-07-30 13:04 ` Adrian Hunter [this message]
2018-07-23 10:08 ` [PATCH V4 2/7] mmc: sdhci: Change SDMA address register for " Chunyan Zhang
2018-07-23 22:26 ` kbuild test robot
2018-07-23 22:28 ` kbuild test robot
2018-07-24 2:47 ` Chunyan Zhang
2018-07-30 13:04 ` Adrian Hunter
2018-07-23 10:08 ` [PATCH V4 3/7] mmc: sdhci: add ADMA2 64-bit addressing support for V4 mode Chunyan Zhang
2018-07-30 13:05 ` Adrian Hunter
2018-07-23 10:08 ` [PATCH V4 4/7] mmc: sdhci: add 32-bit block count support for v4 mode Chunyan Zhang
2018-07-24 2:51 ` Chunyan Zhang
2018-07-30 13:05 ` Adrian Hunter
2018-08-06 11:29 ` Chunyan Zhang
[not found] ` <598422fd0106427c85945baf1e1f1548@SHMBX02.spreadtrum.com>
2018-08-14 11:40 ` Adrian Hunter
2018-07-23 10:08 ` [PATCH V4 5/7] mmc: sdhci: add Auto CMD Auto Select support Chunyan Zhang
2018-07-30 13:06 ` Adrian Hunter
2018-07-31 7:04 ` Chunyan Zhang
2018-07-31 7:04 ` Chunyan Zhang
2018-07-31 8:05 ` Adrian Hunter
2018-07-31 8:36 ` Chunyan Zhang
2018-07-31 8:56 ` Adrian Hunter
2018-07-31 9:20 ` Chunyan Zhang
2018-07-31 9:36 ` Adrian Hunter
2018-08-01 9:26 ` Chunyan Zhang
2018-07-31 9:27 ` Chunyan Zhang
2018-07-23 10:08 ` [PATCH V4 6/7] mmc: sdhci-sprd: added Spreadtrum's initial host controller Chunyan Zhang
2018-07-23 10:08 ` [PATCH V4 7/7] dt-bindings: sdhci-sprd: Add bindings for the sdhci-sprd controller Chunyan Zhang
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=87ecfb68-775a-2a17-5b42-ae02b354e3d7@intel.com \
--to=adrian.hunter@intel.com \
--cc=baolin.wang@linaro.org \
--cc=billows.wu@spreadtrum.com \
--cc=jason.wu@unisoc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=orsonzhai@gmail.com \
--cc=ulf.hansson@linaro.org \
--cc=zhang.chunyan@linaro.org \
--cc=zhang.lyra@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.