All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sourav Poddar <sourav.poddar-l0cyMroinI0@public.gmane.org>
To: Trent Piepho <tpiepho-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: rnayak-l0cyMroinI0@public.gmane.org,
	balbi-l0cyMroinI0@public.gmane.org,
	broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCHv7 1/2] drivers: spi: Add qspi flash controller
Date: Thu, 1 Aug 2013 09:45:17 +0530	[thread overview]
Message-ID: <51F9E0D5.4050707@ti.com> (raw)
In-Reply-To: <CA+7tXijn2V7LMCKuOKxcda6r6a=JFBeSFNqGqNtYZuTF=irF1g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Thursday 01 August 2013 12:09 AM, Trent Piepho wrote:
> On Tue, Jul 30, 2013 at 10:47 PM, Sourav Poddar<sourav.poddar-l0cyMroinI0@public.gmane.org>  wrote:
>> Test details:
>> -------------
>> Tested this on dra7 board.
>> Test1: Ran mtd_stesstest for 40000 iterations.
>>     - All iterations went through without failure.
>> Test2: Use mtd utilities:
>>    - flash_erase to erase the flash device
>>    - nanddump to read data back.
>>    - nandwrite to write to the data flash.
>>   diff between the write and read data shows zero.
> You've obviously never tested word lengths other than 8, because...
>
>> +static inline void ti_qspi_read_data(struct ti_qspi *qspi,
>> +               unsigned long reg, int wlen, u8 **rxbuf)
>> +{
>> +       switch (wlen) {
>> +       case 8:
>> +               **rxbuf = readb(qspi->base + reg);
>> +               dev_vdbg(qspi->dev, "rx done, read %02x\n", *(*rxbuf));
>> +               *rxbuf += 1;
>> +               break;
>> +       case 16:
>> +               **rxbuf = readw(qspi->base + reg);
> *rxbuf is a u8*.  This means when you assign to **rxbuf the type of
> the lvalue is u8.  8 bits.  It does not matter what type the rvalue
> is, u8, u16, or u32, the result will always be truncated to 8 bits.
>
May be, I can typecast the lvalue correspondingly before assigning.
> IMHO, I toss the design of ti_qspi_read/write_data().  They look like
> a function to read a generic register, yet it only makes sense with
> QSPI_SPI_DATA_REG.  Passing the pointer by address so it can be
> incremented is ugly.  And doesn't work at all, since the type of the
> pointer isn't going to be the same for different word lengths.  The
> case statement inside the inner loop is inefficient.  Each case is
> largely duplicated code.
Yes, type of word length is not going to be the same. Hence, I kept it
as u8, then increment the pointer accordingly according to the case to
which it belongs.
Due to the different kind of variants used(read(b/w/l), each case has to
be replicated.

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk

  parent reply	other threads:[~2013-08-01  4:15 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-31  5:47 [PATCHv7 0/2] Add ti qspi controller Sourav Poddar
2013-07-31  5:47 ` Sourav Poddar
     [not found] ` <1375249673-2585-1-git-send-email-sourav.poddar-l0cyMroinI0@public.gmane.org>
2013-07-31  5:47   ` [PATCHv7 1/2] drivers: spi: Add qspi flash controller Sourav Poddar
2013-07-31  5:47     ` Sourav Poddar
2013-07-31  7:49     ` Felipe Balbi
2013-07-31  7:49       ` Felipe Balbi
2013-07-31  9:10       ` Sourav Poddar
2013-07-31  9:10         ` Sourav Poddar
2013-07-31  9:20         ` Felipe Balbi
2013-07-31  9:20           ` Felipe Balbi
2013-07-31  9:40           ` Sourav Poddar
2013-07-31  9:40             ` Sourav Poddar
2013-07-31  9:48             ` Felipe Balbi
2013-07-31  9:48               ` Felipe Balbi
2013-07-31  9:53               ` Sourav Poddar
2013-07-31  9:53                 ` Sourav Poddar
2013-07-31 18:39     ` Trent Piepho
     [not found]       ` <CA+7tXijn2V7LMCKuOKxcda6r6a=JFBeSFNqGqNtYZuTF=irF1g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-08-01  4:15         ` Sourav Poddar [this message]
2013-07-31  5:47 ` [RFC/PATCH 2/2] driver: spi: Add quad spi read support Sourav Poddar
2013-07-31  5:47   ` 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=51F9E0D5.4050707@ti.com \
    --to=sourav.poddar-l0cymroini0@public.gmane.org \
    --cc=balbi-l0cyMroinI0@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=rnayak-l0cyMroinI0@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=tpiepho-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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 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.