[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240514121602.273f788e@xps-13>
Date: Tue, 14 May 2024 12:16:02 +0200
From: Miquel Raynal <miquel.raynal@...tlin.com>
To: Sascha Hauer <s.hauer@...gutronix.de>
Cc: Richard Weinberger <richard@....at>, Vignesh Raghavendra
<vigneshr@...com>, linux-mtd@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/3] mtd: nand: mxc_nand: implement exec_op
Hi Sascha,
> > > > + case NAND_OP_WAITRDY_INSTR:
> > > > + /*
> > > > + * NFC handles R/B internally. Therefore, this function
> > > > + * always returns status as ready.
> > >
> > > This is no longer a standalone function, maybe:
> > >
> > > "The controller handles the R/B pin internally, therefore there is
> > > nothing to do here."
>
> Ok.
>
> >
> > And this is actually very wrong.
> >
> > You should call wait_op_done() instead.
>
> No, I don't think so. wait_op_done() is called to wait for the interrupt
> of the controller indicating a basic operation is done. A basic operation
> can be that a command is being sent or an address byte has been sent to
> the chip during an address cycle.
>
> With this arbitrary example:
>
> struct nand_op_instr instrs[] = {
> NAND_OP_CMD(NAND_CMD_READ0, 0),
> NAND_OP_ADDR(4, addrs, 0),
> NAND_OP_CMD(NAND_CMD_READSTART, NAND_COMMON_TIMING_NS(conf, tWB_max)),
> NAND_OP_WAIT_RDY(NAND_COMMON_TIMING_MS(conf, tR_max),
> NAND_COMMON_TIMING_NS(conf, tRR_min)),
> NAND_OP_DATA_IN(len, buf, 0),
> };
>
> I'll call wait_op_done() once for NAND_CMD_READ0, four times for the NAND_OP_ADDR,
> then once again for the NAND_CMD_READSTART command and four times (on i.MX27, once
> per subpage) for the NAND_OP_DATA_IN operation. Calling wait_op_done() for the
> NAND_OP_WAIT_RDY operation woul only timeout because there is no operation in flight
> currently.
Ah, ok, makes sense as well. If you want (this is not mandatory) you
may want to rename the function wait_instr_done() to fit the core's
naming: an operation being an aggregate of instructions/cycles.
Thanks,
Miquèl
Powered by blists - more mailing lists