public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: srinivas.kandagatla@linaro.org, ulf.hansson@linaro.org
Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH v3 1/2] mmc: sdhci: add sdma_boundary member to struct sdhci_host
Date: Thu, 3 Aug 2017 16:14:36 +0300	[thread overview]
Message-ID: <83271bcf-2111-3b26-c0bc-e419e79c01a1@intel.com> (raw)
In-Reply-To: <20170803124614.21788-2-srinivas.kandagatla@linaro.org>

On 03/08/17 15:46, srinivas.kandagatla@linaro.org wrote:
> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> 
> This patch adds sdma_boundary member to struct sdhci_host to give more
> flexibility to drivers to control the sdma boundary buffer value and
> also to fix issue on some sdhci controllers which are broken when
> HOST SDMA Buffer Boundary is programmed in Block Size Register (0x04)
> when using ADMA. Qualcomm sdhci controller is one of such type, writing
> to this bits is un-supported.
> 
> Default value of sdma_boundary is set to SDHCI_DEFAULT_BOUNDARY_ARG.
> 
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/sdhci.c | 13 ++++++++-----
>  drivers/mmc/host/sdhci.h |  3 +++
>  2 files changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index ecd0d43..c6a6c52 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -897,8 +897,8 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_command *cmd)
>  	sdhci_set_transfer_irqs(host);
>  
>  	/* Set the DMA boundary value and block size */
> -	sdhci_writew(host, SDHCI_MAKE_BLKSZ(SDHCI_DEFAULT_BOUNDARY_ARG,
> -		data->blksz), SDHCI_BLOCK_SIZE);
> +	sdhci_writew(host, SDHCI_MAKE_BLKSZ(host->sdma_boundary, data->blksz),
> +		     SDHCI_BLOCK_SIZE);
>  	sdhci_writew(host, data->blocks, SDHCI_BLOCK_COUNT);
>  }
>  
> @@ -2037,6 +2037,7 @@ static void sdhci_send_tuning(struct sdhci_host *host, u32 opcode)
>  	struct mmc_command cmd = {};
>  	struct mmc_request mrq = {};
>  	unsigned long flags;
> +	u32 b = host->sdma_boundary;
>  
>  	spin_lock_irqsave(&host->lock, flags);
>  
> @@ -2052,9 +2053,9 @@ static void sdhci_send_tuning(struct sdhci_host *host, u32 opcode)
>  	 */
>  	if (cmd.opcode == MMC_SEND_TUNING_BLOCK_HS200 &&
>  	    mmc->ios.bus_width == MMC_BUS_WIDTH_8)
> -		sdhci_writew(host, SDHCI_MAKE_BLKSZ(7, 128), SDHCI_BLOCK_SIZE);
> +		sdhci_writew(host, SDHCI_MAKE_BLKSZ(b, 128), SDHCI_BLOCK_SIZE);
>  	else
> -		sdhci_writew(host, SDHCI_MAKE_BLKSZ(7, 64), SDHCI_BLOCK_SIZE);
> +		sdhci_writew(host, SDHCI_MAKE_BLKSZ(b, 64), SDHCI_BLOCK_SIZE);
>  
>  	/*
>  	 * The tuning block is sent by the card to the host controller.
> @@ -2998,7 +2999,7 @@ void sdhci_cqe_enable(struct mmc_host *mmc)
>  		ctrl |= SDHCI_CTRL_ADMA32;
>  	sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
>  
> -	sdhci_writew(host, SDHCI_MAKE_BLKSZ(SDHCI_DEFAULT_BOUNDARY_ARG, 512),
> +	sdhci_writew(host, SDHCI_MAKE_BLKSZ(host->sdma_boundary, 512),
>  		     SDHCI_BLOCK_SIZE);
>  
>  	/* Set maximum timeout */
> @@ -3119,6 +3120,8 @@ struct sdhci_host *sdhci_alloc_host(struct device *dev,
>  
>  	host->tuning_delay = -1;
>  
> +	host->sdma_boundary = SDHCI_DEFAULT_BOUNDARY_ARG;
> +
>  	return host;
>  }
>  
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index 0469fa1..399edc6 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -541,6 +541,9 @@ struct sdhci_host {
>  	/* Delay (ms) between tuning commands */
>  	int			tuning_delay;
>  
> +	/* Host SDMA buffer boundary. */
> +	u32			sdma_boundary;
> +
>  	unsigned long private[0] ____cacheline_aligned;
>  };
>  
> 

  reply	other threads:[~2017-08-03 13:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-03 12:46 [PATCH v3 0/2] mmc: sdhci: Add sdma_boundary to sdhci_host srinivas.kandagatla
2017-08-03 12:46 ` [PATCH v3 1/2] mmc: sdhci: add sdma_boundary member to struct sdhci_host srinivas.kandagatla
2017-08-03 13:14   ` Adrian Hunter [this message]
2017-08-03 12:46 ` [PATCH v3 2/2] mmc: sdhci-msm: set sdma_boundary to zero srinivas.kandagatla
2017-08-03 13:14   ` Adrian Hunter
2017-08-08 10:38 ` [PATCH v3 0/2] mmc: sdhci: Add sdma_boundary to sdhci_host 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=83271bcf-2111-3b26-c0bc-e419e79c01a1@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.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