[RFC PATCH v2] mtd: nand: vf610_nfc: make use of ->exec_op()

Stefan Agner stefan at agner.ch
Thu Feb 8 13:45:55 PST 2018

On 08.02.2018 19:23, Miquel Raynal wrote:
>> > +}
>> >
>> > -	switch (command) {
>> > -	case NAND_CMD_SEQIN:
>> > -		/* Use valid column/page from preread... */
>> > -		vf610_nfc_addr_cycle(nfc, column, page);
>> > -		nfc->buf_offset = 0;
>> > +static int vf610_nfc_exec_op(struct nand_chip *chip,
>> > +			     const struct nand_operation *op,
>> > +			     bool check_only)
>> The soul of ->exec_op() is here :) However this implementation looks
>> very specific to the kind of tasks you are used to do with one specific
>> chip. What if someone wants to support a new command that implies
>> several command/address/data cycles interleaved? Maybe one solution
>> would be to rework a bit by using a case statement in a for loop. If
>> the indentation level is too high, you may use helpers to do small
>> tasks like sending a command or addresse cycle. What do you think?

The controller mandates the sequence. If another sequence is required,
then multiple controller level command executions need to be issues.

> Actually, instead of writing your own implementation, maybe you should
> just write the helpers I mentioned above and fill a parser patterns
> array to give to the NAND core's parser, simplifying again the
> implementation.

I actually worked on a v3 just yesterday which implements Boris
suggetion. It also should be easier to review due two independent
patches for adding exec_op and removing the old callbacks. I hope we can
carry on the discussion there.


More information about the linux-mtd mailing list