public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@baylibre.com>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	linux-amlogic@lists.infradead.org
Subject: Re: [PATCH 2/2] mmc: meson-gx: factor out setting response configuration bits
Date: Tue, 28 Mar 2017 08:05:04 -0700	[thread overview]
Message-ID: <m2y3vpa1cv.fsf@baylibre.com> (raw)
In-Reply-To: <aeb1c108-59c9-664d-ad5d-c28d95176f36@gmail.com> (Heiner Kallweit's message of "Mon, 27 Mar 2017 22:02:32 +0200")

Heiner Kallweit <hkallweit1@gmail.com> writes:

> Factor out setting the response configuration bits thus further reducing
> complexity of function meson_mmc_start_cmd.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Reviewed-by: Kevin Hilman <khilman@baylibre.com>

> ---
>  drivers/mmc/host/meson-gx-mmc.c | 32 ++++++++++++++++++--------------
>  1 file changed, 18 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
> index 0de32008..0036680b 100644
> --- a/drivers/mmc/host/meson-gx-mmc.c
> +++ b/drivers/mmc/host/meson-gx-mmc.c
> @@ -456,6 +456,23 @@ static void meson_mmc_set_blksz(struct mmc_host *mmc, unsigned int blksz)
>  	writel(cfg, host->regs + SD_EMMC_CFG);
>  }
>  
> +static void meson_mmc_set_response_bits(struct mmc_command *cmd, u32 *cmd_cfg)
> +{
> +	if (cmd->flags & MMC_RSP_PRESENT) {
> +		if (cmd->flags & MMC_RSP_136)
> +			*cmd_cfg |= CMD_CFG_RESP_128;
> +		*cmd_cfg |= CMD_CFG_RESP_NUM;
> +
> +		if (!(cmd->flags & MMC_RSP_CRC))
> +			*cmd_cfg |= CMD_CFG_RESP_NOCRC;
> +
> +		if (cmd->flags & MMC_RSP_BUSY)
> +			*cmd_cfg |= CMD_CFG_R1B;
> +	} else {
> +		*cmd_cfg |= CMD_CFG_NO_RESP;
> +	}
> +}
> +
>  static void meson_mmc_start_cmd(struct mmc_host *mmc, struct mmc_command *cmd)
>  {
>  	struct meson_host *host = mmc_priv(mmc);
> @@ -469,20 +486,7 @@ static void meson_mmc_start_cmd(struct mmc_host *mmc, struct mmc_command *cmd)
>  	cmd_cfg |= FIELD_PREP(CMD_CFG_CMD_INDEX_MASK, cmd->opcode);
>  	cmd_cfg |= CMD_CFG_OWNER;  /* owned by CPU */
>  
> -	/* Response */
> -	if (cmd->flags & MMC_RSP_PRESENT) {
> -		if (cmd->flags & MMC_RSP_136)
> -			cmd_cfg |= CMD_CFG_RESP_128;
> -		cmd_cfg |= CMD_CFG_RESP_NUM;
> -
> -		if (!(cmd->flags & MMC_RSP_CRC))
> -			cmd_cfg |= CMD_CFG_RESP_NOCRC;
> -
> -		if (cmd->flags & MMC_RSP_BUSY)
> -			cmd_cfg |= CMD_CFG_R1B;
> -	} else {
> -		cmd_cfg |= CMD_CFG_NO_RESP;
> -	}
> +	meson_mmc_set_response_bits(cmd, &cmd_cfg);
>  
>  	/* data? */
>  	if (data) {

  reply	other threads:[~2017-03-28 15:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-27 19:57 [PATCH 1/2] mmc: meson-gx: factor out setting block size Heiner Kallweit
2017-03-27 20:02 ` [PATCH 2/2] mmc: meson-gx: factor out setting response configuration bits Heiner Kallweit
2017-03-28 15:05   ` Kevin Hilman [this message]
2017-03-30 19:31   ` Ulf Hansson
2017-03-28 15:04 ` [PATCH 1/2] mmc: meson-gx: factor out setting block size Kevin Hilman
2017-03-30 19:31 ` 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=m2y3vpa1cv.fsf@baylibre.com \
    --to=khilman@baylibre.com \
    --cc=hkallweit1@gmail.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-mmc@vger.kernel.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