All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Stefan Agner <stefan@agner.ch>
Cc: computersforpeace@gmail.com, dwmw2@infradead.org,
	marek.vasut@gmail.com, cyrille.pitchen@wedev4u.fr,
	richard@nod.at, bpringlemeir@gmail.com,
	marcel.ziswiler@toradex.com, linux-mtd@lists.infradead.org
Subject: Re: [RFC PATCH v3 2/3] mtd: nand: vf610_nfc: make use of ->exec_op()
Date: Wed, 21 Feb 2018 10:03:08 +0100	[thread overview]
Message-ID: <20180221100308.440caee5@bbrezillon> (raw)
In-Reply-To: <e5d20aa9a17caaa79a3618367f22637f@agner.ch>

On Wed, 21 Feb 2018 09:30:32 +0100
Stefan Agner <stefan@agner.ch> wrote:

> 
> > 
> > The only exception I can think of is when you have DATA_OUT+CMD. In
> > this case, you probably want to skip CMD_BYTE1 and use CMD_BYTE2
> > directly, but that can easily be taken care of in the alternative
> > implementation I proposed:
> > 
> > 		if (instr->type == NAND_OP_DATA_OUT_INSTR) {
> > 			/*
> > 			 * If there was no CMD instruction before the
> > 			 * DATA_OUT one, we must skip CMD_BYTE1 and use
> > 			 * CMD_BYTE2 directly so that the CMD cycle is
> > 			 * really placed after the DATA_OUT one.
> > 			 */
> > 			if (!ncmds)
> > 				ncmds++;
> > 			....
> > 		}
> >  
> >   
> 
> I fully understand, I do not have to enforce order since I can rely on
> the order passed by the stack.
> 
> It is also not what I am after. I just check which operation is going to
> be next. Like your switch statement.
> 
> I just see don't see a real advantage in using a for loop. It makes it
> harder to read, since the order of operations will no more be obvious.
> It makes this ncmd work around necessary.
> 
> Using a for loop just because we can? I haven't seen a convincing
> argument so far.
> 

I still prefer the for-loop+switch approach (I find it cleaner), but
that's probably a matter of taste.

> 
> >> I think you have the same endianness problem you have for the READ
> >> path. For example, I doubt SET_FEATURES will work properly if you're
> >> in LE. So I repeat my initial suggestion: always do the byte swapping
> >> when you're transfering data to/from the SRAM from vf610_nfc_cmd()
> >> and use vf610_nfc_memcpy() only in the ->read/write_page()
> >> implementations. 
> >>  
> > 
> > Hm, but doesn't that leads to wrong order of data when using e.g. raw
> > read/write page...?  
> 
> With that last iteration I used the default implementation of the stack.
> 
> I guess I could just implement them too and use vf610_nfc_memcpy()?

Yep (see my other email).

> 
> This should be fine then for tdoay, but what if we have another data
> related access in the future? It then also will make use of
> vf610_nfc_cmd and change byte order...

I'll reply with another question: what if you need to read data that
have been programmed by the flash vendor in some OTP sections (already
had to do that to support read-retry on some NANDs)? There's clearly
no ideal solution, we just have to chose the one which is less likely
to break things in the future. Today, we have a way to overload page
accessors, so let's use it.

BTW, it's not exactly about data related accesses, but accesses to data
for which you control the read and write path (that excludes
writes/reads to/from NAND registers like the SET/GET_FEATURES, because
then, data are used by the internal NAND logic to tweak its behavior).

-- 
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com

  reply	other threads:[~2018-02-21  9:03 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-08 23:59 [RFC PATCH v3 0/3] mtd: nand: vf610_nfc: make use of ->exec_op() Stefan Agner
2018-02-08 23:59 ` [RFC PATCH v3 1/3] mtd: nand: vf610_nfc: remove unused function Stefan Agner
2018-02-12 21:32   ` Boris Brezillon
2018-02-08 23:59 ` [RFC PATCH v3 2/3] mtd: nand: vf610_nfc: make use of ->exec_op() Stefan Agner
2018-02-09  8:20   ` Miquel Raynal
2018-02-09 12:41     ` Stefan Agner
2018-02-11 10:54   ` Boris Brezillon
2018-02-20 23:15     ` Stefan Agner
2018-02-20 23:34       ` Miquel Raynal
2018-02-21  7:18       ` Boris Brezillon
2018-02-21  8:30         ` Stefan Agner
2018-02-21  9:03           ` Boris Brezillon [this message]
2018-02-21  9:39             ` Stefan Agner
2018-02-21 10:09           ` Miquel Raynal
2018-02-21 12:32             ` Stefan Agner
2018-02-21  8:28       ` Boris Brezillon
2018-02-21  8:35         ` Boris Brezillon
2018-02-21 12:24           ` Stefan Agner
2018-02-21 12:46             ` Boris Brezillon
2018-02-21 21:18               ` Stefan Agner
2018-02-21 23:23         ` Stefan Agner
2018-02-22  9:13           ` Boris Brezillon
2018-02-08 23:59 ` [RFC PATCH v3 3/3] mtd: nand: vf610_nfc: remove old hooks Stefan Agner
2018-02-11 10:55 ` [RFC PATCH v3 0/3] mtd: nand: vf610_nfc: make use of ->exec_op() 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=20180221100308.440caee5@bbrezillon \
    --to=boris.brezillon@bootlin.com \
    --cc=bpringlemeir@gmail.com \
    --cc=computersforpeace@gmail.com \
    --cc=cyrille.pitchen@wedev4u.fr \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marcel.ziswiler@toradex.com \
    --cc=marek.vasut@gmail.com \
    --cc=richard@nod.at \
    --cc=stefan@agner.ch \
    /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.