public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Stefan Agner <stefan@agner.ch>
Cc: miquel.raynal@free-electrons.com,
	boris.brezillon@free-electrons.com, 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: [PATCH v6 1/3] mtd: rawnand: vf610_nfc: make use of ->exec_op()
Date: Mon, 5 Mar 2018 17:28:02 +0100	[thread overview]
Message-ID: <20180305172802.5f69879a@bbrezillon> (raw)
In-Reply-To: <20180303222237.902-2-stefan@agner.ch>

On Sat,  3 Mar 2018 23:22:35 +0100
Stefan Agner <stefan@agner.ch> wrote:

>  
> @@ -564,14 +868,95 @@ static int vf610_nfc_write_page(struct mtd_info *mtd, struct nand_chip *chip,
>  				const uint8_t *buf, int oob_required, int page)
>  {
>  	struct vf610_nfc *nfc = mtd_to_nfc(mtd);
> +	int trfr_sz = mtd->writesize + mtd->oobsize;
> +	u32 row = 0, cmd1 = 0, cmd2 = 0, code = 0;
> +	int ret = 0;
>  
> -	nand_prog_page_begin_op(chip, page, 0, buf, mtd->writesize);
> -	if (oob_required)
> -		vf610_nfc_write_buf(mtd, chip->oob_poi, mtd->oobsize);
> +	cmd2 |= NAND_CMD_SEQIN << CMD_BYTE1_SHIFT;
> +	code |= COMMAND_CMD_BYTE1 | COMMAND_CAR_BYTE1 | COMMAND_CAR_BYTE2;
> +
> +	vf610_nfc_fill_row(chip, page, &code, &row);
> +
> +	cmd1 |= NAND_CMD_PAGEPROG << CMD_BYTE2_SHIFT;
> +	code |= COMMAND_CMD_BYTE2 | COMMAND_WRITE_DATA;
> +
> +	/*
> +	 * Don't fix endianness on page access for historical reasons.
> +	 * See comment in vf610_nfc_wr_to_sram
> +	 */
> +	vf610_nfc_wr_to_sram(nfc->regs + NFC_MAIN_AREA(0), buf,
> +			     mtd->writesize, false);
> +
> +	code |= COMMAND_RB_HANDSHAKE;
> +	cmd2 |= code << CMD_CODE_SHIFT;
> +
> +	vf610_nfc_ecc_mode(nfc, nfc->ecc_mode);
> +	vf610_nfc_run(nfc, 0, row, cmd1, cmd2, trfr_sz);
> +	vf610_nfc_ecc_mode(nfc, ECC_BYPASS);

I didn't notice that in my previous review, but you need to check the
status here:

	ret = nand_status_op(chip, &status);
	if (ret)
		return ret;

	if (status & NAND_STATUS_FAIL)
		return -EIO;

	return 0;
> +
> +	return ret;
> +}
> +


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

  reply	other threads:[~2018-03-05 16:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-03 22:22 [PATCH v6 0/3] mtd: rawnand: vf610_nfc: make use of ->exec_op() Stefan Agner
2018-03-03 22:22 ` [PATCH v6 1/3] " Stefan Agner
2018-03-05 16:28   ` Boris Brezillon [this message]
2018-03-03 22:22 ` [PATCH v6 2/3] mtd: rawnand: vf610_nfc: remove old hooks Stefan Agner
2018-03-03 22:22 ` [PATCH v6 3/3] mtd: rawnand: vf610_nfc: support ONFI SET/GET_FEATURES commands Stefan Agner

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=20180305172802.5f69879a@bbrezillon \
    --to=boris.brezillon@bootlin.com \
    --cc=boris.brezillon@free-electrons.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=miquel.raynal@free-electrons.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox