All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Chris Brandt <chris.brandt@renesas.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: Simon Horman <horms+renesas@verge.net.au>,
	linux-mmc@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH 2/3] mmc: tmio-mmc: add support for 32bit data port
Date: Fri, 9 Sep 2016 20:27:56 +0300	[thread overview]
Message-ID: <898fafe5-1257-3dab-6d85-896da7bb0291@cogentembedded.com> (raw)
In-Reply-To: <20160909155238.17852-3-chris.brandt@renesas.com>

Hello.

On 09/09/2016 06:52 PM, Chris Brandt wrote:

> For the r7s72100 SOC, the DATA_PORT register was change to be 32-bits wide.
> Therefore a new flag has been created that will allow 32-bit reads/writes
> to the DATA_PORT register instead of 16-bit (because 16-bits accesses are
> not supported).
>
> Signed-off-by: Chris Brandt <chris.brandt@renesas.com>
[...]
> diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
> index 017a4dc..c38542d 100644
> --- a/drivers/mmc/host/tmio_mmc_pio.c
> +++ b/drivers/mmc/host/tmio_mmc_pio.c
> @@ -439,10 +439,45 @@ static void tmio_mmc_transfer_data(struct tmio_mmc_host *host,
>  {
>  	int is_read = host->data->flags & MMC_DATA_READ;
>  	u8  *buf8;
> +	u32 data;
>
>  	/*
>  	 * Transfer the data
>  	 */
> +	if (host->pdata->flags & TMIO_MMC_32BIT_DATA_PORT) {
> +		if (is_read)
> +			sd_ctrl_read32_rep(host, CTL_SD_DATA_PORT, (u32 *)buf,
> +					   count >> 2);
> +		else
> +			sd_ctrl_write32_rep(host, CTL_SD_DATA_PORT, (u32 *)buf,
> +					    count >> 2);
> +
> +		/* if count was multiple of 4 */
> +		if (!(count & 0x3))
> +			return;
> +
> +		buf8 = (u8 *)(buf + (count >> 2));
> +		count %= 4;
> +
> +		if (is_read) {
> +			sd_ctrl_read32_rep(host, CTL_SD_DATA_PORT, &data, 1);
> +			while (count--) {
> +				*buf8 = data * 0xFF;

    'data & 0xFF', perhaps?

> +				data = data >> 8;
> +				buf8++;
> +			}
> +		} else {
> +			data = *buf8++;
> +			if (count > 1)
> +				data |= (*buf8++ << 8);
> +			if (count > 2)
> +				data |= (*buf8++ << 16);
> +			sd_ctrl_write32_rep(host, CTL_SD_DATA_PORT, &data, 1);
> +		}
> +
> +		return;
> +	}
> +
>  	if (is_read)
>  		sd_ctrl_read16_rep(host, CTL_SD_DATA_PORT, buf, count >> 1);
>  	else

MBR, Sergei

  reply	other threads:[~2016-09-09 17:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-09 15:52 [PATCH 0/3] mmc: sh_mobile_sdhi: Add r7s72100 support Chris Brandt
2016-09-09 15:52 ` [PATCH 1/3] mmc: sh_mobile_sdhi: add ocr_mask option Chris Brandt
2016-09-09 15:52 ` [PATCH 2/3] mmc: tmio-mmc: add support for 32bit data port Chris Brandt
2016-09-09 17:27   ` Sergei Shtylyov [this message]
2016-09-09 18:29     ` Chris Brandt
2016-09-11  8:09   ` Geert Uytterhoeven
2016-09-11 19:50     ` Chris Brandt
2016-09-12  8:09       ` Geert Uytterhoeven
2016-09-12 11:56         ` Chris Brandt
2016-09-12 12:00           ` Geert Uytterhoeven
2016-09-09 15:52 ` [PATCH 3/3] mmc: sh_mobile_sdhi: Add r7s72100 support Chris Brandt

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=898fafe5-1257-3dab-6d85-896da7bb0291@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=chris.brandt@renesas.com \
    --cc=horms+renesas@verge.net.au \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    --cc=wsa+renesas@sang-engineering.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.