All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel RAYNAL <miquel.raynal@free-electrons.com>
To: Boris Brezillon <boris.brezillon@free-electrons.com>,
	Richard Weinberger <richard@nod.at>,
	David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	Quentin Schulz <quentin.schulz@free-electrons.com>,
	linux-mtd@lists.infradead.org
Subject: Re: [PATCH 2/3] mtd: nand: add the infrastructure to retrieve the ONFI unique ID
Date: Tue, 14 Nov 2017 18:07:38 +0100	[thread overview]
Message-ID: <20171114180738.0754fcae@xps13> (raw)
In-Reply-To: <20171114154622.5493-3-miquel.raynal@free-electrons.com>

Hello,

In the cover letter I forgot to give a link to the series this work is
based on:
http://patchwork.ozlabs.org/project/linux-mtd/list/?series=12308

I also spotted a mistake there:

> +static int nand_read_unique_id(struct nand_chip *chip, char *dest)
> +{
> +	struct mtd_info *mtd = nand_to_mtd(chip);
> +	u8 id[ONFI_UNIQUEID_LEN * 2];
> +	int string_len = ONFI_FULL_UNIQUEID_STRING_LEN;
> +	int ret, i, j, pos;
> +
> +	/* ->exec_op related definitions */
> +	const struct nand_sdr_timings *sdr =
> +		nand_get_sdr_timings(&chip->data_interface);
> +	u8 addr = 0;
> +	struct nand_op_instr instrs[] = {
> +		NAND_OP_CMD(NAND_CMD_READ_UNIQUEID, 0),
> +		NAND_OP_ADDR(1, &addr, PSEC_TO_NSEC(sdr->tWB_max)),
> +		NAND_OP_WAIT_RDY(PSEC_TO_MSEC(sdr->tR_max),
> +				 PSEC_TO_NSEC(sdr->tRR_min)),
> +	};
> +	struct nand_operation op = NAND_OPERATION(instrs);
> +
> +	if (!chip->exec_op)
> +		return -ENOTSUPP;
> +
> +	if (!dest)
> +		return -EINVAL;
> +
> +	if (!(onfi_opt_cmd(chip) & ONFI_OPT_CMD_READ_UNIQUEID))
> +		return -ENOTSUPP;
> +
> +	ret = nand_exec_op(chip, &op);
> +	if (ret)
> +		return ret;
> +
> +	/* Pattern is repeated 16 times */
> +	for (i = 0; i < ONFI_UNIQUEID_REPETITIONS; i++) {
> +		/* Each pattern is 32B wide (the ID + the ID XORed)
> */
> +		if (chip->exec_op) {
> +			struct nand_op_instr instrs[] = {
> +				NAND_OP_8BIT_DATA_IN(sizeof(id), id,
> 0),
> +			};
> +			struct nand_operation op =
> NAND_OPERATION(instrs); +
> +			ret = nand_exec_op(chip, &op);
> +			if (ret)
> +				return ret;
> +		} else {
> +			chip->read_buf(mtd, id, sizeof(id));
> +		}

No need for that 'else' statement as this function will not run without
->exec_op() support.


Sorry about that, I will correct it in a later version.
Miquèl

  reply	other threads:[~2017-11-14 17:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-14 15:46 [PATCH 0/3] Convert fsmc_nand driver to ->exec_op() to retrieve a unique ID Miquel Raynal
2017-11-14 15:46 ` [PATCH 1/3] mtd: nand: fsmc: use ->exec_op() Miquel Raynal
2017-11-16  9:05   ` Boris Brezillon
2017-11-14 15:46 ` [PATCH 2/3] mtd: nand: add the infrastructure to retrieve the ONFI unique ID Miquel Raynal
2017-11-14 17:07   ` Miquel RAYNAL [this message]
2017-11-14 15:46 ` [PATCH 3/3] mtd: nand: add sysfs entry for NAND chip " Miquel Raynal
2017-11-16  9:20   ` Boris Brezillon

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=20171114180738.0754fcae@xps13 \
    --to=miquel.raynal@free-electrons.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=cyrille.pitchen@wedev4u.fr \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=quentin.schulz@free-electrons.com \
    --cc=richard@nod.at \
    --cc=thomas.petazzoni@free-electrons.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.