All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: linux-mtd@lists.infradead.org, kernel@pengutronix.de,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 3/7] mtd: nand: automate NAND timings selection
Date: Thu, 8 Sep 2016 10:12:43 +0200	[thread overview]
Message-ID: <20160908101243.60db3eaa@bbrezillon> (raw)
In-Reply-To: <20160908075530.e4o2gecxxlmedtlx@pengutronix.de>

On Thu, 8 Sep 2016 09:55:30 +0200
Sascha Hauer <s.hauer@pengutronix.de> wrote:

> On Wed, Sep 07, 2016 at 05:59:17PM +0200, Boris Brezillon wrote:
> > On Wed, 7 Sep 2016 16:59:51 +0200
> > Boris Brezillon <boris.brezillon@free-electrons.com> wrote:
> >   
> > > On Wed, 7 Sep 2016 16:36:15 +0200
> > > Sascha Hauer <s.hauer@pengutronix.de> wrote:
> > >   
> > > > Ok, I think now we are understanding each other. So I keep two timing
> > > > instances in struct nand_chip, one for initialization and one optimized
> > > > timing. They both get initialized once during chip detection and can be
> > > > reused when needed.    
> > > 
> > > Hm, not sure we need to keep 2 instances around, all we need to save is
> > > the 'best_onfi_timing_mode', or we can just update  
> > > ->default_onfi_timing_mode based on the result of the timing mode    
> > > detection, so that, when nand_setup_data_interface() is called, all we
> > > have to do is:
> > > 
> > > 	conf = chip->data_iface_conf;
> > > 	conf->type = NAND_SDR_IFACE,
> > > 	conf->timings.sdr = *onfi_async_timing_mode_to_sdr_timings(chip->default_onfi_timing_mode);
> > > 	chip->setup_data_interface(mtd, conf, false);
> > >   
> > 
> > After the discussion we had on IRC, I want to reconsider what I said.
> > How about having a global nand_default_data_iface_config that would
> > work will all chips (probably exposing mode 0 timings and an SDR
> > interface).
> > This one will be used even for DDR NANDs, because after a reset they
> > return back to SDR mode, timing mode 0.
> > 
> > Now, I keep thinking that other timing modes should not be directly
> > exposed.  
> 
> sounds good. How do you think the default iface_config should be
> exposed? Should I turn the onfi_sdr_timings array to struct
> nand_data_interface like done before and add a accessor function for the
> first element, something like:
> 
> const struct nand_data_interface *nand_default_data_interface(void);

Sounds goods. Sorry if I changed my mind to finally get back to
something close to your initial proposal, but I must admit I didn't
know what I wanted exactly, and only realized when seeing your
implementation.

Thanks for your patience ;-).

WARNING: multiple messages have this Message-ID (diff)
From: boris.brezillon@free-electrons.com (Boris Brezillon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/7] mtd: nand: automate NAND timings selection
Date: Thu, 8 Sep 2016 10:12:43 +0200	[thread overview]
Message-ID: <20160908101243.60db3eaa@bbrezillon> (raw)
In-Reply-To: <20160908075530.e4o2gecxxlmedtlx@pengutronix.de>

On Thu, 8 Sep 2016 09:55:30 +0200
Sascha Hauer <s.hauer@pengutronix.de> wrote:

> On Wed, Sep 07, 2016 at 05:59:17PM +0200, Boris Brezillon wrote:
> > On Wed, 7 Sep 2016 16:59:51 +0200
> > Boris Brezillon <boris.brezillon@free-electrons.com> wrote:
> >   
> > > On Wed, 7 Sep 2016 16:36:15 +0200
> > > Sascha Hauer <s.hauer@pengutronix.de> wrote:
> > >   
> > > > Ok, I think now we are understanding each other. So I keep two timing
> > > > instances in struct nand_chip, one for initialization and one optimized
> > > > timing. They both get initialized once during chip detection and can be
> > > > reused when needed.    
> > > 
> > > Hm, not sure we need to keep 2 instances around, all we need to save is
> > > the 'best_onfi_timing_mode', or we can just update  
> > > ->default_onfi_timing_mode based on the result of the timing mode    
> > > detection, so that, when nand_setup_data_interface() is called, all we
> > > have to do is:
> > > 
> > > 	conf = chip->data_iface_conf;
> > > 	conf->type = NAND_SDR_IFACE,
> > > 	conf->timings.sdr = *onfi_async_timing_mode_to_sdr_timings(chip->default_onfi_timing_mode);
> > > 	chip->setup_data_interface(mtd, conf, false);
> > >   
> > 
> > After the discussion we had on IRC, I want to reconsider what I said.
> > How about having a global nand_default_data_iface_config that would
> > work will all chips (probably exposing mode 0 timings and an SDR
> > interface).
> > This one will be used even for DDR NANDs, because after a reset they
> > return back to SDR mode, timing mode 0.
> > 
> > Now, I keep thinking that other timing modes should not be directly
> > exposed.  
> 
> sounds good. How do you think the default iface_config should be
> exposed? Should I turn the onfi_sdr_timings array to struct
> nand_data_interface like done before and add a accessor function for the
> first element, something like:
> 
> const struct nand_data_interface *nand_default_data_interface(void);

Sounds goods. Sorry if I changed my mind to finally get back to
something close to your initial proposal, but I must admit I didn't
know what I wanted exactly, and only realized when seeing your
implementation.

Thanks for your patience ;-).

  reply	other threads:[~2016-09-08  8:12 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-07 12:21 [PATCH v3] mtd: nand: automate NAND timings selection Sascha Hauer
2016-09-07 12:21 ` Sascha Hauer
2016-09-07 12:21 ` [PATCH 1/7] mtd: nand: Create a NAND reset function Sascha Hauer
2016-09-07 12:21   ` Sascha Hauer
2016-09-07 12:31   ` Boris Brezillon
2016-09-07 12:31     ` Boris Brezillon
2016-09-07 12:21 ` [PATCH 2/7] mtd: nand: Introduce nand_data_interface Sascha Hauer
2016-09-07 12:21   ` Sascha Hauer
2016-09-07 12:21 ` [PATCH 3/7] mtd: nand: automate NAND timings selection Sascha Hauer
2016-09-07 12:21   ` Sascha Hauer
2016-09-07 13:41   ` Boris Brezillon
2016-09-07 13:41     ` Boris Brezillon
2016-09-07 14:36     ` Sascha Hauer
2016-09-07 14:36       ` Sascha Hauer
2016-09-07 14:59       ` Boris Brezillon
2016-09-07 14:59         ` Boris Brezillon
2016-09-07 15:59         ` Boris Brezillon
2016-09-07 15:59           ` Boris Brezillon
2016-09-08  7:55           ` Sascha Hauer
2016-09-08  7:55             ` Sascha Hauer
2016-09-08  8:12             ` Boris Brezillon [this message]
2016-09-08  8:12               ` Boris Brezillon
2016-09-07 12:21 ` [PATCH 4/7] mtd: nand: sunxi: switch from manual to automated timing config Sascha Hauer
2016-09-07 12:21   ` Sascha Hauer
2016-09-07 12:21 ` [PATCH 5/7] mtd: nand: mxc: implement onfi get/set features Sascha Hauer
2016-09-07 12:21   ` Sascha Hauer
2016-09-07 12:21 ` [PATCH 6/7] mtd: nand: mxc: Add timing setup for v2 controllers Sascha Hauer
2016-09-07 12:21   ` Sascha Hauer
2016-09-07 12:21 ` [PATCH 7/7] mtd: nand: remove unnecessary 'extern' from function declarations Sascha Hauer
2016-09-07 12:21   ` Sascha Hauer
2016-09-07 19:29   ` Boris Brezillon
2016-09-07 19:29     ` Boris Brezillon

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=20160908101243.60db3eaa@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /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.