public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Ronak Desai <ronak.desai@rockwellcollins.com>
Cc: "linux-mtd @ lists . infradead . org"
	<linux-mtd@lists.infradead.org>,
	Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Subject: Re: [PATCH] Added set feature command in FSL IFC nand controller driver for ONFI nand
Date: Tue, 24 Apr 2018 11:56:18 +0200	[thread overview]
Message-ID: <20180424115618.70438e41@xps13> (raw)
In-Reply-To: <CADFuHZ4i52AxD6G3xf_RyWD7Z5bs-2-zXddMevBsKYkT=JTWCg@mail.gmail.com>

Hi Ronak,

> >> +/**
> >> + * fsl_ifc_onfi_set_features- set features for ONFI nand
> >> + * @mtd: MTD device structure
> >> + * @chip: nand chip info structure
> >> + * @addr: feature address.
> >> + * @subfeature_param: the subfeature parameters, a four bytes array.
> >> + */
> >> +static int fsl_ifc_onfi_set_features(struct mtd_info *mtd, struct nand_chip *chip,
> >> +                     int addr, uint8_t *subfeature_param)
> >> +{
> >> +     int status;
> >> +     int i;
> >> +
> >> +#ifdef CONFIG_SYS_NAND_ONFI_DETECTION
> >> +     if (!chip->onfi_version ||
> >> +         !(le16_to_cpu(chip->onfi_params.opt_cmd)
> >> +           & ONFI_OPT_CMD_SET_GET_FEATURES))
> >> +             return -EINVAL;
> >> +#endif  
> >
> > No need to do that, the core will take care of it, see [1].  
> 
> Agree, I will remove this.
> >  
> >> +
> >> +     /* Want data from start of the buffer */
> >> +     set_addr(mtd, 0, 0, 0);  
> >
> > This is the only thing that differs from the core's implementation. I
> > see most of the time it is called from ->cmdfunc(), could you move it
> > there? If yes you could get rid of this entire hook and rely on the
> > core's function.
> >  
> NAND_CMD_SET_FEATURES command sends the sub-feature param from flash
> buffer on the provided address and I added this here because I wanted
> to make sure
> that the data is set from start of the buffer. I looked at the core's
> implementation
> and I see that the NAND_CMD_SET_FEATURES  command is called first and then
> the data is filled into the buffer which will not work in case of my
> implementation.
> So, I will have to keep this here and the function, please suggest. I
> will wait for your
> feedback before submitting V2.  Moreover, I would suggest to check
> sequence in core's
> implementation as the command should run after setting the data and not before.

Not sure what you mean exactly by "NAND_CMD_SET_FEATURES is called first
and the data is filled into the buffer", could you please point out the
faulty section in the core so I can have a look?

Thanks,
Miquèl

> >> +
> >> +     for (i = 0; i < ONFI_SUBFEATURE_PARAM_LEN; ++i)
> >> +             chip->write_byte(mtd, subfeature_param[i]);
> >> +
> >> +     chip->cmdfunc(mtd, NAND_CMD_SET_FEATURES, addr, 0);
> >> +
> >> +     status = chip->waitfunc(mtd, chip);
> >> +     if (status & NAND_STATUS_FAIL)
> >> +             return -EIO;
> >> +     return 0;
> >> +}


-- 
Miquel Raynal, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2018-04-24  9:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-17 19:10 [PATCH] Added set feature command in FSL IFC nand controller driver for ONFI nand Ronak Desai
2018-04-22 17:07 ` Miquel Raynal
2018-04-23 19:55   ` Ronak Desai
2018-04-24  9:56     ` Miquel Raynal [this message]
2018-04-24 13:51       ` Ronak Desai
2018-04-24 14:00         ` Miquel Raynal
2018-04-24 17:10           ` Ronak Desai
2018-04-24 17:37             ` Boris Brezillon
2018-04-25 13:56               ` Ronak Desai

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=20180424115618.70438e41@xps13 \
    --to=miquel.raynal@bootlin.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=prabhakar.kushwaha@nxp.com \
    --cc=ronak.desai@rockwellcollins.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox