From: Boris Brezillon <boris.brezillon@collabora.com>
To: Naga Sureshkumar Relli <nagasure@xilinx.com>
Cc: "bbrezillon@kernel.org" <bbrezillon@kernel.org>,
"helmut.grohne@intenta.de" <helmut.grohne@intenta.de>,
"richard@nod.at" <richard@nod.at>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"marek.vasut@gmail.com" <marek.vasut@gmail.com>,
"yamada.masahiro@socionext.com" <yamada.masahiro@socionext.com>,
"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
"miquel.raynal@bootlin.com" <miquel.raynal@bootlin.com>,
Michal Simek <michals@xilinx.com>,
"computersforpeace@gmail.com" <computersforpeace@gmail.com>,
"dwmw2@infradead.org" <dwmw2@infradead.org>
Subject: Re: [LINUX PATCH v17 2/2] mtd: rawnand: pl353: Add basic driver for arm pl353 smc nand interface
Date: Wed, 3 Jul 2019 13:40:38 +0200 [thread overview]
Message-ID: <20190703134038.4256bb43@collabora.com> (raw)
In-Reply-To: <DM6PR02MB47793413E233EE8ECB54BC66AFFB0@DM6PR02MB4779.namprd02.prod.outlook.com>
On Wed, 3 Jul 2019 11:29:49 +0000
Naga Sureshkumar Relli <nagasure@xilinx.com> wrote:
> Hi Boris,
>
> > -----Original Message-----
> > From: Boris Brezillon <boris.brezillon@collabora.com>
> > Sent: Wednesday, July 3, 2019 4:37 PM
> > To: Naga Sureshkumar Relli <nagasure@xilinx.com>
> > Cc: miquel.raynal@bootlin.com; helmut.grohne@intenta.de; richard@nod.at;
> > dwmw2@infradead.org; computersforpeace@gmail.com; marek.vasut@gmail.com;
> > bbrezillon@kernel.org; yamada.masahiro@socionext.com; linux-mtd@lists.infradead.org; linux-
> > kernel@vger.kernel.org; Michal Simek <michals@xilinx.com>
> > Subject: Re: [LINUX PATCH v17 2/2] mtd: rawnand: pl353: Add basic driver for arm pl353
> > smc nand interface
> >
> > On Wed, 3 Jul 2019 08:57:57 +0000
> > Naga Sureshkumar Relli <nagasure@xilinx.com> wrote:
> >
> > > Hi Boris,
> > >
> > > Thanks for the review.
> > >
> > > > -----Original Message-----
> > > > From: Boris Brezillon <boris.brezillon@collabora.com>
> > > > Sent: Wednesday, July 3, 2019 11:56 AM
> > > > To: Naga Sureshkumar Relli <nagasure@xilinx.com>
> > > > Cc: miquel.raynal@bootlin.com; helmut.grohne@intenta.de;
> > > > richard@nod.at; dwmw2@infradead.org; computersforpeace@gmail.com;
> > > > marek.vasut@gmail.com; vigneshr@ti.com; bbrezillon@kernel.org;
> > > > yamada.masahiro@socionext.com; linux- mtd@lists.infradead.org;
> > > > linux-kernel@vger.kernel.org
> > > > Subject: Re: [LINUX PATCH v17 2/2] mtd: rawnand: pl353: Add basic
> > > > driver for arm pl353 smc nand interface
> > > >
> > > > On Mon, 24 Jun 2019 22:46:30 -0600
> > > > Naga Sureshkumar Relli <naga.sureshkumar.relli@xilinx.com> wrote:
> > > >
> > > >
> > > > > +
> > > > > +/**
> > > > > + * pl353_nand_exec_op_cmd - Send command to NAND device
> > > > > + * @chip: Pointer to the NAND chip info structure
> > > > > + * @subop: Pointer to array of instructions
> > > > > + * Return: Always return zero
> > > > > + */
> > > > > +static int pl353_nand_exec_op_cmd(struct nand_chip *chip,
> > > > > + const struct nand_subop *subop) {
> > > > > + struct mtd_info *mtd = nand_to_mtd(chip);
> > > > > + const struct nand_op_instr *instr;
> > > > > + struct pl353_nfc_op nfc_op = {};
> > > > > + struct pl353_nand_controller *xnfc = to_pl353_nand(chip);
> > > > > + unsigned long cmd_phase_data = 0, end_cmd_valid = 0;
> > > > > + unsigned long end_cmd;
> > > > > + unsigned int op_id, len;
> > > > > + bool reading;
> > > > > + u32 cmdphase_addrflags;
> > > > > +
> > > > > + pl353_nfc_parse_instructions(chip, subop, &nfc_op);
> > > > > + instr = nfc_op.data_instr;
> > > > > + op_id = nfc_op.data_instr_idx;
> > > > > + pl353_smc_clr_nand_int();
> > > > > +
> > > > > + /* Get the command phase address */
> > > > > + if (nfc_op.cmnds[1] != 0) {
> > > > > + if (nfc_op.cmnds[0] == NAND_CMD_SEQIN)
> > > > > + end_cmd_valid = 0;
> > > > > + else
> > > > > + end_cmd_valid = 1;
> > > >
> > > > You're testing the opcode, again. As I said several times, the
> > > > ->exec_op() implementation should be opcode agnostic, it should just
> > > > ->try
> > > > to match sequences of <CMD>-<ADDR>-<DATA> cycles.
> > > >
> > > This driver uses common function for all patterns.
> > > There was some discussion happened on v8 series
> > > https://lore.kernel.org/patchwork/patch/933639/
> > > There the comments from Miquel was to use an optional property In the
> > > pattern Matching, so with this approach, based on the command need to
> > > update the end_cmd_valid bit in command phase cycle.
> > > So in order to follow that approach, we defined a common pattern
> > > matching function And there we are checking the commands.
> > > It significantly reduces the code repetition.
> >
> > That's not what I'm talking about. I'm talking about the explicit 'nfc_op.cmnds[0] ==
> > NAND_CMD_SEQIN' check, which AFAICT, is wrong, or at the very least, not future-proof
> > at all.
> Ok.
> >
> > Let me see if I understand what end_cmd_valid means: it's supposed to be set when the ADDR
> > cycles are followed by a CMD cycle. You don't need to check if the first CMD cycle is !SEQIN
> > (AKA start programming a page) to know that: just go through the flow of instructions in the
> > subop, and check what's coming just after the ADDR instruction.
> Ok. then let me update as per the flow of instructions.
> >
> > >
> > > I understand your concern about not to check any NAND command in the
> > > drivers under ->exec_op() implementation.
> > > But do you see any issues/impact with this?
> >
> > Yes, I do. Sorry to say that, but the whole driver is coded with specific use-cases (read/write
> > page, read param page, etc) in mind, which is exactly what we were trying to avoid when
> > designing exec_op(). The goal was to have something that's easily maintainable and does not
> > break every time one tests a previously untested chip <-> controller combination.
> >
> Ok. I understand.
>
> > > Functionality wise Helmut tested each series and we addressed all the comments in v17
> > series.
> >
> > Just because it's been tested does not mean it's ready to be merged, sorry.
> >
> Ok. I will submit next version with the above changes.
Note that I didn't bother reading the whole driver, just focused on the
exec_op() implementation. Please look at what other drivers are doing
before posting a new version and don't hesitate to ask questions if
there's something you don't understand. We are already at v17, and
unfortunately, the driver is IMO not ready to be merged :-/.
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
WARNING: multiple messages have this Message-ID (diff)
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Naga Sureshkumar Relli <nagasure@xilinx.com>
Cc: "miquel.raynal@bootlin.com" <miquel.raynal@bootlin.com>,
"helmut.grohne@intenta.de" <helmut.grohne@intenta.de>,
"richard@nod.at" <richard@nod.at>,
"dwmw2@infradead.org" <dwmw2@infradead.org>,
"computersforpeace@gmail.com" <computersforpeace@gmail.com>,
"marek.vasut@gmail.com" <marek.vasut@gmail.com>,
"bbrezillon@kernel.org" <bbrezillon@kernel.org>,
"yamada.masahiro@socionext.com" <yamada.masahiro@socionext.com>,
"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Michal Simek <michals@xilinx.com>
Subject: Re: [LINUX PATCH v17 2/2] mtd: rawnand: pl353: Add basic driver for arm pl353 smc nand interface
Date: Wed, 3 Jul 2019 13:40:38 +0200 [thread overview]
Message-ID: <20190703134038.4256bb43@collabora.com> (raw)
In-Reply-To: <DM6PR02MB47793413E233EE8ECB54BC66AFFB0@DM6PR02MB4779.namprd02.prod.outlook.com>
On Wed, 3 Jul 2019 11:29:49 +0000
Naga Sureshkumar Relli <nagasure@xilinx.com> wrote:
> Hi Boris,
>
> > -----Original Message-----
> > From: Boris Brezillon <boris.brezillon@collabora.com>
> > Sent: Wednesday, July 3, 2019 4:37 PM
> > To: Naga Sureshkumar Relli <nagasure@xilinx.com>
> > Cc: miquel.raynal@bootlin.com; helmut.grohne@intenta.de; richard@nod.at;
> > dwmw2@infradead.org; computersforpeace@gmail.com; marek.vasut@gmail.com;
> > bbrezillon@kernel.org; yamada.masahiro@socionext.com; linux-mtd@lists.infradead.org; linux-
> > kernel@vger.kernel.org; Michal Simek <michals@xilinx.com>
> > Subject: Re: [LINUX PATCH v17 2/2] mtd: rawnand: pl353: Add basic driver for arm pl353
> > smc nand interface
> >
> > On Wed, 3 Jul 2019 08:57:57 +0000
> > Naga Sureshkumar Relli <nagasure@xilinx.com> wrote:
> >
> > > Hi Boris,
> > >
> > > Thanks for the review.
> > >
> > > > -----Original Message-----
> > > > From: Boris Brezillon <boris.brezillon@collabora.com>
> > > > Sent: Wednesday, July 3, 2019 11:56 AM
> > > > To: Naga Sureshkumar Relli <nagasure@xilinx.com>
> > > > Cc: miquel.raynal@bootlin.com; helmut.grohne@intenta.de;
> > > > richard@nod.at; dwmw2@infradead.org; computersforpeace@gmail.com;
> > > > marek.vasut@gmail.com; vigneshr@ti.com; bbrezillon@kernel.org;
> > > > yamada.masahiro@socionext.com; linux- mtd@lists.infradead.org;
> > > > linux-kernel@vger.kernel.org
> > > > Subject: Re: [LINUX PATCH v17 2/2] mtd: rawnand: pl353: Add basic
> > > > driver for arm pl353 smc nand interface
> > > >
> > > > On Mon, 24 Jun 2019 22:46:30 -0600
> > > > Naga Sureshkumar Relli <naga.sureshkumar.relli@xilinx.com> wrote:
> > > >
> > > >
> > > > > +
> > > > > +/**
> > > > > + * pl353_nand_exec_op_cmd - Send command to NAND device
> > > > > + * @chip: Pointer to the NAND chip info structure
> > > > > + * @subop: Pointer to array of instructions
> > > > > + * Return: Always return zero
> > > > > + */
> > > > > +static int pl353_nand_exec_op_cmd(struct nand_chip *chip,
> > > > > + const struct nand_subop *subop) {
> > > > > + struct mtd_info *mtd = nand_to_mtd(chip);
> > > > > + const struct nand_op_instr *instr;
> > > > > + struct pl353_nfc_op nfc_op = {};
> > > > > + struct pl353_nand_controller *xnfc = to_pl353_nand(chip);
> > > > > + unsigned long cmd_phase_data = 0, end_cmd_valid = 0;
> > > > > + unsigned long end_cmd;
> > > > > + unsigned int op_id, len;
> > > > > + bool reading;
> > > > > + u32 cmdphase_addrflags;
> > > > > +
> > > > > + pl353_nfc_parse_instructions(chip, subop, &nfc_op);
> > > > > + instr = nfc_op.data_instr;
> > > > > + op_id = nfc_op.data_instr_idx;
> > > > > + pl353_smc_clr_nand_int();
> > > > > +
> > > > > + /* Get the command phase address */
> > > > > + if (nfc_op.cmnds[1] != 0) {
> > > > > + if (nfc_op.cmnds[0] == NAND_CMD_SEQIN)
> > > > > + end_cmd_valid = 0;
> > > > > + else
> > > > > + end_cmd_valid = 1;
> > > >
> > > > You're testing the opcode, again. As I said several times, the
> > > > ->exec_op() implementation should be opcode agnostic, it should just
> > > > ->try
> > > > to match sequences of <CMD>-<ADDR>-<DATA> cycles.
> > > >
> > > This driver uses common function for all patterns.
> > > There was some discussion happened on v8 series
> > > https://lore.kernel.org/patchwork/patch/933639/
> > > There the comments from Miquel was to use an optional property In the
> > > pattern Matching, so with this approach, based on the command need to
> > > update the end_cmd_valid bit in command phase cycle.
> > > So in order to follow that approach, we defined a common pattern
> > > matching function And there we are checking the commands.
> > > It significantly reduces the code repetition.
> >
> > That's not what I'm talking about. I'm talking about the explicit 'nfc_op.cmnds[0] ==
> > NAND_CMD_SEQIN' check, which AFAICT, is wrong, or at the very least, not future-proof
> > at all.
> Ok.
> >
> > Let me see if I understand what end_cmd_valid means: it's supposed to be set when the ADDR
> > cycles are followed by a CMD cycle. You don't need to check if the first CMD cycle is !SEQIN
> > (AKA start programming a page) to know that: just go through the flow of instructions in the
> > subop, and check what's coming just after the ADDR instruction.
> Ok. then let me update as per the flow of instructions.
> >
> > >
> > > I understand your concern about not to check any NAND command in the
> > > drivers under ->exec_op() implementation.
> > > But do you see any issues/impact with this?
> >
> > Yes, I do. Sorry to say that, but the whole driver is coded with specific use-cases (read/write
> > page, read param page, etc) in mind, which is exactly what we were trying to avoid when
> > designing exec_op(). The goal was to have something that's easily maintainable and does not
> > break every time one tests a previously untested chip <-> controller combination.
> >
> Ok. I understand.
>
> > > Functionality wise Helmut tested each series and we addressed all the comments in v17
> > series.
> >
> > Just because it's been tested does not mean it's ready to be merged, sorry.
> >
> Ok. I will submit next version with the above changes.
Note that I didn't bother reading the whole driver, just focused on the
exec_op() implementation. Please look at what other drivers are doing
before posting a new version and don't hesitate to ask questions if
there's something you don't understand. We are already at v17, and
unfortunately, the driver is IMO not ready to be merged :-/.
next prev parent reply other threads:[~2019-07-03 11:41 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-25 4:46 [LINUX PATCH v17 1/2] mtd: rawnand: nand_micron: Do not over write driver's read_page()/write_page() Naga Sureshkumar Relli
2019-06-25 4:46 ` Naga Sureshkumar Relli
2019-06-25 4:46 ` [LINUX PATCH v17 2/2] mtd: rawnand: pl353: Add basic driver for arm pl353 smc nand interface Naga Sureshkumar Relli
2019-06-25 4:46 ` Naga Sureshkumar Relli
2019-06-25 14:11 ` Helmut Grohne
2019-06-25 14:11 ` Helmut Grohne
2019-07-03 6:13 ` Naga Sureshkumar Relli
2019-07-03 6:13 ` Naga Sureshkumar Relli
2019-07-03 6:25 ` Boris Brezillon
2019-07-03 6:25 ` Boris Brezillon
2019-07-03 8:57 ` Naga Sureshkumar Relli
2019-07-03 8:57 ` Naga Sureshkumar Relli
2019-07-03 11:06 ` Boris Brezillon
2019-07-03 11:06 ` Boris Brezillon
2019-07-03 11:29 ` Naga Sureshkumar Relli
2019-07-03 11:29 ` Naga Sureshkumar Relli
2019-07-03 11:40 ` Boris Brezillon [this message]
2019-07-03 11:40 ` Boris Brezillon
2019-06-25 14:11 ` [LINUX PATCH v17 1/2] mtd: rawnand: nand_micron: Do not over write driver's read_page()/write_page() Helmut Grohne
2019-06-25 14:11 ` Helmut Grohne
2019-06-26 6:48 ` Boris Brezillon
2019-06-26 6:48 ` Boris Brezillon
2019-06-26 11:22 ` Naga Sureshkumar Relli
2019-06-26 11:22 ` Naga Sureshkumar Relli
2019-06-26 11:27 ` Boris Brezillon
2019-06-26 11:27 ` Boris Brezillon
2019-06-26 11:51 ` Naga Sureshkumar Relli
2019-06-26 11:51 ` Naga Sureshkumar Relli
2019-06-26 12:04 ` Boris Brezillon
2019-06-26 12:04 ` Boris Brezillon
2019-06-26 12:12 ` Naga Sureshkumar Relli
2019-06-26 12:12 ` Naga Sureshkumar Relli
2019-06-26 12:20 ` Boris Brezillon
2019-06-26 12:20 ` Boris Brezillon
2019-06-26 12:33 ` Naga Sureshkumar Relli
2019-06-26 12:33 ` Naga Sureshkumar Relli
2019-07-08 12:18 ` Naga Sureshkumar Relli
2019-07-08 12:18 ` Naga Sureshkumar Relli
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=20190703134038.4256bb43@collabora.com \
--to=boris.brezillon@collabora.com \
--cc=bbrezillon@kernel.org \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--cc=helmut.grohne@intenta.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=michals@xilinx.com \
--cc=miquel.raynal@bootlin.com \
--cc=nagasure@xilinx.com \
--cc=richard@nod.at \
--cc=yamada.masahiro@socionext.com \
/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.