SUPERH platform development
 help / color / mirror / Atom feed
From: カオ ミン ヒェップ <cm-hiep@jinso.co.jp>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>, broonie@kernel.org
Cc: devicetree@vger.kernel.org, linux-sh@vger.kernel.org,
	geert+renesas@linux-m68k.org
Subject: Re: [RFC] spi: Using Trigger number to transmit/receive data
Date: Mon, 17 Mar 2014 01:15:21 +0000	[thread overview]
Message-ID: <53264CA9.5030408@jinso.co.jp> (raw)
In-Reply-To: <53217A1A.50907@renesas.com>

Hi Morimoto

On 03/13/2014 06:27 PM, Kuninori Morimoto wrote:
> Hi Hiep
>
>> In order to transmit and receive data when have 32 bytes of data that
>> ready has prepared on Transmit/Receive Buffer to transmit or receive.
>> Instead transmits/receives a byte data using Transmit/Receive Buffer
>> Data Triggering Number will improve the speed of transfer data.
>>
>> Signed-off-by: Hiep Cao Minh <cm-hiep@jinso.co.jp>
>> ---
> (snip)
>> +static int qspi_set_send_trigger(struct rspi_data *rspi, int remain)
>> +{
>> +	int n;
>> +
>> +	n = min(remain, QSPI_BUFFER_SIZE);
>> +
>> +	if (remain >= QSPI_BUFFER_SIZE) {
>> +		/* sets triggering number to 32 bytes */
>> +		qspi_update(rspi, SPBFCR_TXTRG_MASK,
>> +			     SPBFCR_TXTRG_0B, QSPI_SPBFCR);
>> +	} else {
>> +		/* sets triggering number to 1 byte */
>> +		qspi_update(rspi, SPBFCR_TXTRG_MASK,
>> +			     SPBFCR_TXTRG_31B, QSPI_SPBFCR);
>> +	}
>> +
>> +	return n;
>> +}
> (snip)
>> +		n = qspi_set_send_trigger(rspi, remain);
>> +		if (n >= QSPI_BUFFER_SIZE) {
>> +			for (i = 0; i < n; i++)
>> +				rspi_write8(rspi, *data++, RSPI_SPDR);
>> +			if (rspi_wait_for_interrupt(rspi, SPSR_SPRF,
>> +						    SPCR_SPRIE) < 0) {
>> +				dev_err(&rspi->master->dev,
>> +					"%s: receive timeout\n", __func__);
>> +				return -ETIMEDOUT;
>> +			}
>> +			for (i = 0; i < n; i++)
>> +				rspi_read8(rspi, RSPI_SPDR);
>> +		} else {
>> +			for (i = 0; i < n; i++) {
>> +				if (rspi_wait_for_interrupt(rspi, SPSR_SPTEF,
>> +							    SPCR_SPTIE) < 0) {
>> +					dev_err(&rspi->master->dev,
>> +					   "%s: tx empty timeout\n", __func__);
>> +				return -ETIMEDOUT;
>> +				}
>> +				rspi_write8(rspi, *data++, RSPI_SPDR);
>> +
>> +				if (rspi_wait_for_interrupt(rspi, SPSR_SPRF,
>> +							    SPCR_SPRIE) < 0) {
>> +					dev_err(&rspi->master->dev,
>> +					   "%s: receive timeout\n", __func__);
>> +				return -ETIMEDOUT;
>> +				}
>> +				rspi_read8(rspi, RSPI_SPDR);
>> +			}
> I guess, this "qspi_set_send_trigger()" is mode "settings",
> and, "transfer" is done here.
>
> I think "setting" and "tranfer" in 1 function is readable.
>
Thanks for your comments, I will do so.

  reply	other threads:[~2014-03-17  1:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-13  8:29 [RFC] spi: Using Trigger number to transmit/receive data Cao Minh Hiep
2014-03-13  8:29 ` Cao Minh Hiep
2014-03-13  9:23   ` Geert Uytterhoeven
2014-03-17  1:11     ` カオ ミン ヒェップ
2014-03-17  7:54       ` Geert Uytterhoeven
2014-03-17 12:01         ` カオ ミン ヒェップ
2014-03-17 19:48           ` Geert Uytterhoeven
2014-03-17 20:32             ` Mark Brown
2014-03-19  0:50             ` カオ ミン ヒェップ
2014-03-19  1:17     ` Kuninori Morimoto
2014-03-13  9:27   ` Kuninori Morimoto
2014-03-17  1:15     ` カオ ミン ヒェップ [this message]
2014-03-13 14:17 ` Mark Brown
2014-03-17  1:16   ` カオ ミン ヒェップ

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=53264CA9.5030408@jinso.co.jp \
    --to=cm-hiep@jinso.co.jp \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=geert+renesas@linux-m68k.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=linux-sh@vger.kernel.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