From: Boris Brezillon <boris.brezillon@bootlin.com>
To: "Sverdlin, Alexander (Nokia - DE/Ulm)" <alexander.sverdlin@nokia.com>
Cc: "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
Marek Vasut <marek.vasut@gmail.com>,
David Woodhouse <dwmw2@infradead.org>,
Brian Norris <computersforpeace@gmail.com>,
Richard Weinberger <richard@nod.at>,
Tudor Ambarus <tudor.ambarus@microchip.com>
Subject: Re: [PATCH] mtd: spi-nor: Provide default address width and latency for map selection
Date: Fri, 30 Nov 2018 11:40:19 +0100 [thread overview]
Message-ID: <20181130114019.175ab7ec@bbrezillon> (raw)
In-Reply-To: <20181129181519.15681-1-alexander.sverdlin@nokia.com>
On Thu, 29 Nov 2018 18:15:34 +0000
"Sverdlin, Alexander (Nokia - DE/Ulm)" <alexander.sverdlin@nokia.com>
wrote:
> JESD216 allows "variable address length" and "variable latency" in
> Configuration Detection Command Descriptors, in other words "as-is".
> And they are still unset during Sector Map Parameter Table parsing,
> which led to "map_id" determined erroneously as 0 for, e.g. S25FS128S.
>
> Fixes: b038e8e3b ("mtd: spi-nor: parse SFDP Sector Map Parameter Table")
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
> ---
> drivers/mtd/spi-nor/spi-nor.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
> index 828d03e..5557c89 100644
> --- a/drivers/mtd/spi-nor/spi-nor.c
> +++ b/drivers/mtd/spi-nor/spi-nor.c
> @@ -2893,6 +2893,16 @@ static const u32 *spi_nor_get_map_in_use(struct spi_nor *nor, const u32 *smpt)
> nor->read_opcode = SMPT_CMD_OPCODE(smpt[i]);
> addr = smpt[i + 1];
>
> + /*
> + * JESD216 allows to omit particular address length or latency
> + * specification in the header and at this point they are still
> + * unset, so we need some heuristics. One example is S25FS128S.
> + */
> + if (!nor->addr_width)
> + nor->addr_width = 3;
> + if (!nor->read_dummy)
> + nor->read_dummy = 8;
> +
Looks like the same problem was reported by Yogesh here [1]. One more
proof that parsing SFDP is not trivial. I mean, what's the point of
defining a generic tables to describe NOR capabilities if you then
depend on vendor/chip specific init to read those tables...
Anyway, I think this sort of initialization should be placed in a
pre_sfdp() fixup hook, as getting the right values likely requires
reading some volatile/non-volatile regs.
> err = spi_nor_read_raw(nor, addr, 1, &data_byte);
> if (err)
> goto out;
[1]https://lkml.org/lkml/2018/10/22/354
next prev parent reply other threads:[~2018-11-30 10:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-29 18:15 [PATCH] mtd: spi-nor: Provide default address width and latency for map selection Sverdlin, Alexander (Nokia - DE/Ulm)
2018-11-30 10:40 ` Boris Brezillon [this message]
2018-12-03 8:03 ` Sverdlin, Alexander (Nokia - DE/Ulm)
2018-12-03 8:23 ` Boris Brezillon
2018-12-03 8:34 ` Sverdlin, Alexander (Nokia - DE/Ulm)
2018-12-03 8:37 ` Sverdlin, Alexander (Nokia - DE/Ulm)
2018-12-03 9:08 ` Boris Brezillon
2018-12-03 9:34 ` 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=20181130114019.175ab7ec@bbrezillon \
--to=boris.brezillon@bootlin.com \
--cc=alexander.sverdlin@nokia.com \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=richard@nod.at \
--cc=tudor.ambarus@microchip.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;
as well as URLs for NNTP newsgroup(s).