linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: marex@denx.de (Marek Vasut)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 0/4] mtd: spi-nor: add a new framework for SPI NOR
Date: Wed, 4 Dec 2013 16:36:20 +0100	[thread overview]
Message-ID: <201312041636.20875.marex@denx.de> (raw)
In-Reply-To: <529EE5F1.9080806@st.com>

On Wednesday, December 04, 2013 at 09:21:05 AM, Angus Clark wrote:
> Hi Pekon,
> 
> On 12/04/2013 07:19 AM, Gupta, Pekon wrote:
> > Unless a register is controlling a status of internal state-machine, or
> > something It should be instantaneously writable.
> 
> Yes, that is my point.  Some register writes are instant, other are not,
> particularly those that involve non-volatile status or configuration bits.
> 
> > Also polling should not be part of this particular *(write_reg), if a
> > register needs to be polled then it should be part of *(write) or
> > *(read) .. Like WIP: Write-in-progress bit of flash
> > generic_flash_write(...) {
> > 
> > 	while ((read_reg(STATUS_REG) & WIP) || ~timeout) {
> > 	
> > 		timeout--;
> > 	
> > 	};
> 
> I am in two minds about where the WTR loop should live.  On the one hand,
> moving it to the "generic_flash_write()" call offers H/W controllers the
> opportunity to optimise the polling, if they support such a feature (I
> know of some that will in the future).

I disagree we should bloat the API with features, that will be used by "possible 
future controllers" or "possible single controller", right from the start. The 
real question here is, can the API be designed in such a way, that the SR 
polling will happen in software NOW and only when a controller appears that can 
do polling in HW will the API be extended to support it ?

> However, requiring the H/W driver to perform the polling, including
> knowledge of the STATUS CMD, and the WIP bit-field, just seems like moving
> too much "intelligence" away from the spi-nor layer.  What concerns me is
> when we get on to reading/clearing error flags (as now mandated on some
> Serial Flash devices, e.g. n25p512 and n25q00a), this will also need to be
> part of the generic write.
> 
> > With this it just came to my mind, that you also need a 'timeout' field
> > in 'struct spinor-cfg'.
> 
> Yes, that is a good point.
> 
> I would propose that the spi-nor layer retains responsibility for
> determining whether or not 'WTR' is required for a particular operation,
> and a suitable timeout.  At some point, during initialisation, the H/W
> driver will need to inform the spi-nor layer about its capabilities (e.g.
> support for DUAL or QUAD mode, any warm-reset requirements, etc), and
> native support of WIP polling could be part of this set.  The spi-nor
> layer could then decide whether to add the WTR flag and timeout to the
> spinor-cfg transfer, or to take responsibility itself, and execute its own
> polling loop.  This gives greatest flexibility, which seems to be an
> important factor, while retaining the knowledge in the spi-nor layer.

Sounds good!

> Cheers,
> 
> Angus

Best regards,
Marek Vasut

  reply	other threads:[~2013-12-04 15:36 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-26  6:32 [PATCH 0/4] mtd: spi-nor: add a new framework for SPI NOR Huang Shijie
2013-11-26  6:32 ` [PATCH 1/4] mtd: spi-nor: move the SPI NOR commands to a new header file Huang Shijie
2013-11-26  7:42   ` Gupta, Pekon
2013-11-26  8:53     ` Huang Shijie
2013-11-26 14:48       ` Angus Clark
2013-11-26  6:32 ` [PATCH 2/4] mtd: spi-nor: add a new data structrue spi_nor{} Huang Shijie
2013-11-26 11:42   ` Gupta, Pekon
2013-11-27  4:35     ` Huang Shijie
2013-11-27  9:32       ` Marek Vasut
2013-11-27 10:24         ` Huang Shijie
2013-11-27 10:27           ` Marek Vasut
2013-11-26  6:32 ` [PATCH 3/4] mtd: spi-nor: add the framework for SPI NOR Huang Shijie
2013-11-26 10:03   ` Gupta, Pekon
2013-11-27  9:39   ` Marek Vasut
2013-11-26  6:32 ` [PATCH 4/4] mtd: m25p80: use the new spi-nor APIs Huang Shijie
2013-11-26 12:57 ` [PATCH 0/4] mtd: spi-nor: add a new framework for SPI NOR Angus Clark
2013-11-27  4:32 ` Brian Norris
2013-11-27  4:39   ` Huang Shijie
2013-11-29 14:52   ` Angus Clark
2013-12-02 10:06     ` Huang Shijie
2013-12-02 11:01       ` Gupta, Pekon
2013-12-02 11:19       ` Angus Clark
2013-12-03  6:20         ` Huang Shijie
2013-12-03  8:23           ` Lee Jones
2013-12-10  8:25             ` Brian Norris
2013-12-10 10:00               ` Lee Jones
2013-12-03  0:32     ` Marek Vasut
2013-12-03 10:36       ` Huang Shijie
2013-12-03 14:51     ` David Woodhouse
2013-12-04 18:44       ` Brian Norris
2013-12-05  7:12         ` Huang Shijie
2013-12-05  8:11           ` Brian Norris
2013-12-05  7:59             ` Huang Shijie
2013-12-05  9:20               ` Brian Norris
2013-12-06  3:07                 ` Huang Shijie
2013-12-05 14:35         ` Angus Clark
2013-12-06  8:18           ` Huang Shijie
2013-12-10  9:08           ` Brian Norris
2013-12-04  2:46     ` Huang Shijie
2013-12-04  6:58       ` Angus Clark
2013-12-04  7:19         ` Gupta, Pekon
2013-12-04  8:21           ` Angus Clark
2013-12-04 15:36             ` Marek Vasut [this message]
2013-12-05  2:42               ` Huang Shijie
2013-12-05  5:43                 ` Gupta, Pekon
2013-12-05  7:33                   ` Huang Shijie
2013-11-27  9:27 ` Marek Vasut
2013-11-27  9:47   ` Sourav Poddar
2013-11-27 10:06     ` Marek Vasut
2013-11-27 10:56       ` Sourav Poddar
2013-12-02 23:59         ` Marek Vasut
2013-12-03 10:01           ` Sourav Poddar
2013-12-03 13:42             ` Marek Vasut
2013-12-03 13:50               ` Sourav Poddar
2013-12-03 14:19                 ` Marek Vasut
2013-12-03 14:31                   ` Sourav Poddar
2013-12-03 15:09                     ` Marek Vasut
2013-12-03 15:16                       ` Sourav Poddar
2013-12-03 15:35                         ` Marek Vasut
2013-12-03 15:23                       ` David Woodhouse
2013-12-03 18:28                         ` Brian Norris
2013-12-03 23:41                           ` Marek Vasut
2013-11-27 10:19   ` Huang Shijie
2013-12-03  0:00     ` Marek Vasut

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=201312041636.20875.marex@denx.de \
    --to=marex@denx.de \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).