From: Felipe Balbi <balbi@ti.com>
To: Sourav Poddar <sourav.poddar@ti.com>
Cc: <balbi@ti.com>, <broonie@kernel.org>,
<spi-devel-general@lists.sourceforge.net>,
<grant.likely@linaro.org>, <rnayak@ti.com>,
<linux-omap@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCHv4 2/3] drivers: spi: Add qspi flash controller
Date: Fri, 19 Jul 2013 15:20:29 +0300 [thread overview]
Message-ID: <20130719122029.GE16115@arwen.pp.htv.fi> (raw)
In-Reply-To: <51E9279F.6010601@ti.com>
[-- Attachment #1: Type: text/plain, Size: 2440 bytes --]
Hi,
On Fri, Jul 19, 2013 at 05:18:47PM +0530, Sourav Poddar wrote:
> On Thursday 18 July 2013 04:54 PM, Felipe Balbi wrote:
> >On Thu, Jul 18, 2013 at 04:48:41PM +0530, Sourav Poddar wrote:
> >>>>+static void qspi_write_msg(struct ti_qspi *qspi, struct spi_transfer *t)
> >>>>+{
> >>>>+ const u8 *txbuf;
> >>>>+ int wlen, count;
> >>>>+
> >>>>+ count = t->len;
> >>>>+ txbuf = t->tx_buf;
> >>>>+ wlen = t->bits_per_word;
> >>>>+
> >>>>+ while (count--) {
> >>>>+ dev_dbg(qspi->dev, "tx cmd %08x dc %08x data %02x\n",
> >>>>+ qspi->cmd | QSPI_WR_SNGL, qspi->dc, *txbuf);
> >>>>+ ti_qspi_writel_data(qspi, *txbuf++, QSPI_SPI_DATA_REG, wlen);
> >>>you always increment by each byte. Here, if you used writel(), you wrote
> >>>4 bytes and should increment txbuf by 4.
> >>hmm..got this point. Yes, my mistake, here I agree if wlen is not 8 bits
> >>txbuf++ is not valid.
> >>> Same goes for read_data(),
> >>>below. Another thing. Even though your wlen might be 8 bits, if you
> >>>write 4 bytes to write, you can save a few CPU cycles by using writel().
> >>>
> >>Do you mean 4 words of 8 bits?
> >yeah. Say you have wlen = 8 but the transfer length is 8 bytes (64
> >bits). If you use writeb(), you will do 8 writes, if you use writel()
> >you'll do 2 writes.
> >
> Just some more findings on this, after wlen bits are transferred we
> need an WC interrupt.
> So, if I try to pack 4 words of 8bits and use readl/writel, there
> will be an interrupt after every
> wlen bits transferred and things will get screwd up.
they will not if you throttle the IRQs or add some knowledge about the
FIFO sizes. I mean, there are ways to get this working.
> So, for 8 bits word we need to use readb, for 16 bits word readw.
not entirely true...
I mean, you have a 32-bit FIFO, why would underutilize the FIFO by
always writing 8-bits ? Write 32 bits, when you get the first word
completion, you know you have 8-bits of space in the FIFO, then you
can fill those 8 bits with new data. (all of this is assuming word
length is 8-bits, clearly if it is more, then you need to change the
assumptions).
Another thing which might help, is checking if the HW will even access
the other DATA registers even if word length is <= 32 bits. If it does,
then you have a total of 128 bits to shift data into, which can save you
a lot of time filling up FIFOs and waiting for them to empty.
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2013-07-19 12:20 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-18 10:01 [PATCH 0/3] spi changes and ti quad spi controller Sourav Poddar
2013-07-18 10:01 ` [RFC/PATCHv2 1/3] driver: spi: Modify core to compute the message length Sourav Poddar
2013-07-18 15:22 ` Mark Brown
2013-07-18 10:01 ` [PATCHv4 2/3] drivers: spi: Add qspi flash controller Sourav Poddar
2013-07-18 10:24 ` Felipe Balbi
2013-07-18 11:18 ` Sourav Poddar
2013-07-18 11:24 ` Felipe Balbi
2013-07-18 12:24 ` Sourav Poddar
2013-07-19 11:48 ` Sourav Poddar
2013-07-19 12:20 ` Felipe Balbi [this message]
2013-07-18 10:42 ` Mark Brown
2013-07-18 11:45 ` Sourav Poddar
2013-07-18 11:56 ` Felipe Balbi
2013-07-18 13:18 ` Mark Brown
2013-07-18 13:31 ` Felipe Balbi
2013-07-18 14:42 ` Mark Brown
2013-07-18 14:55 ` Sourav Poddar
2013-07-18 15:28 ` Mark Brown
2013-07-19 11:55 ` Sourav Poddar
2013-07-18 19:08 ` Trent Piepho
2013-07-18 20:39 ` Mark Brown
2013-07-18 20:59 ` Nishanth Menon
2013-07-19 5:02 ` Sourav Poddar
2013-07-18 10:01 ` [RFC/PATCHv2 3/3] driver: spi: Add quad spi read support Sourav Poddar
2013-07-18 10:44 ` Mark Brown
2013-07-18 11:52 ` Sourav Poddar
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=20130719122029.GE16115@arwen.pp.htv.fi \
--to=balbi@ti.com \
--cc=broonie@kernel.org \
--cc=grant.likely@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=rnayak@ti.com \
--cc=sourav.poddar@ti.com \
--cc=spi-devel-general@lists.sourceforge.net \
/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
all inboxes | Powered by JetHome®