From: Takahiro Kuwano <tkuw584924@gmail.com>
To: Michael Walle <michael@walle.cc>,
Tudor Ambarus <tudor.ambarus@microchip.com>,
Pratyush Yadav <p.yadav@ti.com>,
Miquel Raynal <miquel.raynal@bootlin.com>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>
Cc: linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org
Subject: Re: [PATCH 3/6] mtd: spi-nor: remember full JEDEC flash ID
Date: Fri, 29 Jul 2022 10:00:08 +0900 [thread overview]
Message-ID: <9db2f4c2-cc41-9c06-e0ec-7480529cad13@gmail.com> (raw)
In-Reply-To: <20220513133520.3945820-4-michael@walle.cc>
On 5/13/2022 10:35 PM, Michael Walle wrote:
> At the moment, we print the JEDEC ID that is stored in our database. The
> generic flash support won't have such an entry in our database. To find
> out the JEDEC ID later we will have to cache it. There is also another
> advantage: If the flash is found in the database, the ID could be
> truncated because the ID of the entry is used which can be shorter. Some
> flashes still holds valuable information in the bytes after the JEDEC ID
> and come in handy during debugging of when coping with INFO6() entries.
> These are not accessible for now.
>
> Save a copy of the ID bytes after reading and display it via debugfs.
>
> Signed-off-by: Michael Walle <michael@walle.cc>
> ---
> drivers/mtd/spi-nor/core.c | 5 +++++
> drivers/mtd/spi-nor/debugfs.c | 2 +-
> include/linux/mtd/spi-nor.h | 3 +++
> 3 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index ce5d69317d46..65cd8e668579 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -1664,6 +1664,11 @@ static const struct flash_info *spi_nor_detect(struct spi_nor *nor)
> return ERR_PTR(ret);
> }
>
> + /* Cache the complete flash ID. */
> + nor->id = devm_kmemdup(nor->dev, id, SPI_NOR_MAX_ID_LEN, GFP_KERNEL);
> + if (!nor->id)
> + return ERR_PTR(-ENOMEM);
> +
> info = spi_nor_match_id(nor, id);
> if (!info) {
> dev_err(nor->dev, "unrecognized JEDEC id bytes: %*ph\n",
> diff --git a/drivers/mtd/spi-nor/debugfs.c b/drivers/mtd/spi-nor/debugfs.c
> index eaf84f7a0676..23d51e7ba0a7 100644
> --- a/drivers/mtd/spi-nor/debugfs.c
> +++ b/drivers/mtd/spi-nor/debugfs.c
> @@ -81,7 +81,7 @@ static int spi_nor_params_show(struct seq_file *s, void *data)
> int i;
>
> seq_printf(s, "name\t\t%s\n", info->name);
> - seq_printf(s, "id\t\t%*ph\n", info->id_len, info->id);
> + seq_printf(s, "id\t\t%*ph\n", SPI_NOR_MAX_ID_LEN, nor->id);
> string_get_size(params->size, 1, STRING_UNITS_2, buf, sizeof(buf));
> seq_printf(s, "size\t\t%s\n", buf);
> seq_printf(s, "write size\t%u\n", params->writesize);
> diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
> index 1ede4c89805a..4dd6cd7389ca 100644
> --- a/include/linux/mtd/spi-nor.h
> +++ b/include/linux/mtd/spi-nor.h
> @@ -349,6 +349,8 @@ struct spi_nor_flash_parameter;
> * @bouncebuf: bounce buffer used when the buffer passed by the MTD
> * layer is not DMA-able
> * @bouncebuf_size: size of the bounce buffer
> + * @id: The flash's ID bytes. Always contains
> + * SPI_NOR_MAX_ID_LEN bytes.
> * @info: SPI NOR part JEDEC MFR ID and other info
> * @manufacturer: SPI NOR manufacturer
> * @addr_width: number of address bytes
> @@ -379,6 +381,7 @@ struct spi_nor {
> struct spi_mem *spimem;
> u8 *bouncebuf;
> size_t bouncebuf_size;
> + u8 *id;
> const struct flash_info *info;
> const struct spi_nor_manufacturer *manufacturer;
> u8 addr_width;
Reviewed-by: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
Thanks,
Takahiro
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2022-07-29 1:01 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-13 13:35 [PATCH 0/6] mtd: spi-nor: generic flash driver Michael Walle
2022-05-13 13:35 ` [PATCH 1/6] mtd: spi-nor: hide jedec_id sysfs attribute if not present Michael Walle
2022-07-26 10:00 ` Takahiro Kuwano
2022-05-13 13:35 ` [PATCH 2/6] mtd: spi-nor: sysfs: hide manufacturer if it is not set Michael Walle
2022-07-26 10:04 ` Takahiro Kuwano
2022-05-13 13:35 ` [PATCH 3/6] mtd: spi-nor: remember full JEDEC flash ID Michael Walle
2022-07-29 1:00 ` Takahiro Kuwano [this message]
2022-05-13 13:35 ` [PATCH 4/6] mtd: spi-nor: move function declaration out of sfdp.h Michael Walle
2022-07-26 23:41 ` Takahiro Kuwano
2022-05-13 13:35 ` [PATCH 5/6] mtd: spi-nor: add generic flash driver Michael Walle
2022-05-13 14:47 ` kernel test robot
2022-07-21 9:32 ` Biju Das
2022-07-21 9:48 ` Michael Walle
2022-07-21 9:52 ` Biju Das
2022-10-28 18:00 ` Biju Das
2022-07-28 3:28 ` Tudor.Ambarus
2022-07-29 1:40 ` Takahiro Kuwano
2022-05-13 13:35 ` [PATCH 6/6] mtd: spi-nor: sysfs: print JEDEC ID for " Michael Walle
2022-07-29 1:25 ` Takahiro Kuwano
2022-07-26 8:06 ` [PATCH 0/6] mtd: spi-nor: " Tudor.Ambarus
2022-07-29 1:52 ` Takahiro Kuwano
2022-07-29 5:34 ` Tudor.Ambarus
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=9db2f4c2-cc41-9c06-e0ec-7480529cad13@gmail.com \
--to=tkuw584924@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=michael@walle.cc \
--cc=miquel.raynal@bootlin.com \
--cc=p.yadav@ti.com \
--cc=richard@nod.at \
--cc=tudor.ambarus@microchip.com \
--cc=vigneshr@ti.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).