From: <Takahiro.Kuwano@infineon.com>
To: <mwalle@kernel.org>, <pratyush@kernel.org>,
<miquel.raynal@bootlin.com>, <richard@nod.at>, <vigneshr@ti.com>,
<tudor.ambarus@linaro.org>, <alex@sverdlin.org>
Cc: <linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH 2/2] mtd: spi-nor: spansion: Assign .fixups to s25fs256s1
Date: Tue, 15 Sep 2026 06:13:57 +0000 [thread overview]
Message-ID: <e15daee278f346cd8dae030e2409445e@infineon.com> (raw)
In-Reply-To: <DLEXS5VCYB1P.1NJI7ZU6HYUHF@kernel.org>
Hi Michael,
> Hi Takahiro,
>
> On Mon Sep 14, 2026 at 9:11 AM CEST, Takahiro.Kuwano wrote:
> > Hi Michael,
> >
> >> On Mon Sep 14, 2026 at 6:50 AM CEST, Takahiro Kuwano via B4 Relay wrote:
> >> > From: Takahiro Kuwano <takahiro.kuwano@infineon.com>
> >> >
> >> > s25fs256s1 has incorrect SFDP entries, like s25fs512s and s25fs128s1.
> >> > Assign the common s25fs_s_nor_fixups to s25fs256s1 to fix its page size
> >> > and sector map.
> >>
> >> Do you have an SFDP dump by chance? I haven't found one on the list
> >> for this flash.
> >>
> >
> > Yes, but param tables are located beyond PAGE_SIZE(1000h)...
>
> Could you test the following patch if that helps?
>
> --- a/drivers/mtd/spi-nor/sysfs.c
> +++ b/drivers/mtd/spi-nor/sysfs.c
> @@ -99,10 +99,26 @@ static umode_t spi_nor_sysfs_is_bin_visible(struct kobject *kobj,
> return 0;
> }
>
> +static size_t spi_nor_sysfs_bin_size(struct kobject *kobj, const struct bin_attribute *attr, int n)
> +{
> + struct spi_device *spi = to_spi_device(kobj_to_dev(kobj));
> + struct spi_mem *spimem = spi_get_drvdata(spi);
> + struct spi_nor *nor = spi_mem_get_drvdata(spimem);
> + struct sfdp *sfdp = nor->sfdp;
> + size_t sfdp_size = sfdp->num_dwords * sizeof(*sfdp->dwords);
> +
> + if (attr == &bin_attr_sfdp)
> + return sfdp_size;
> +
> + return 0;
> +}
> +
> +
> static const struct attribute_group spi_nor_sysfs_group = {
> .name = "spi-nor",
> .is_visible = spi_nor_sysfs_is_visible,
> .is_bin_visible = spi_nor_sysfs_is_bin_visible,
> + .bin_size = spi_nor_sysfs_bin_size,
> .attrs = spi_nor_sysfs_entries,
> .bin_attrs = spi_nor_sysfs_bin_entries,
> };
This didn't help as SFDP cache size is truncated to PAGE_SIZE in sfdp.c:
/*
* Limit the total size to a reasonable value to avoid allocating too
* much memory just of because the flash returned some insane values.
*/
if (sfdp_size > PAGE_SIZE) {
dev_dbg(dev, "SFDP data (%zu) too big, truncating\n",
sfdp_size);
sfdp_size = PAGE_SIZE;
}
With skipping above part,
zynq> hexdump /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
0000000 4653 5044 0106 ff05 0000 0901 1090 ff00
0000010 0500 1001 1090 ff00 0600 1001 1090 ff00
0000020 0081 1a01 10d8 ff00 0084 0201 10d0 ff00
0000030 0101 5001 1000 0100 ffff ffff ffff ffff
0000040 ffff ffff ffff ffff ffff ffff ffff ffff
*
0001000 0201 4d19 8101 3030 ff84 ffff ffff ffff
0001010 5251 0259 4000 5300 5146 1700 0019 0900
0001020 0809 0211 0502 1903 0102 0008 0703 1000
0001030 0000 8000 fe00 0001 ff01 ffff ffff ffff
0001040 5250 3149 2133 0102 0800 0100 0003 0700
0001050 4101 544c 3032 1000 3253 4635 3253 3635
0001060 ff53 ffff ffff 3030 0180 84eb 7508 7a28
0001070 7564 7a28 8864 0a04 0001 8c01 9606 2301
0001080 2300 f000 ff09 ffff ffff ffff ffff b0a5
0001090 ffe7 ffb2 ffff 0fff eb48 ffff ffff bb88
00010a0 fffe ffff ffff ffff ffff eb48 200c d810
00010b0 d812 ff00 72e2 ff1d 2691 dd07 83ec 4418
00010c0 858a 757a bdf7 5cd5 f68c ff5d 30f0 a1f8
00010d0 8e6b ffff dc21 ffdc 65fc 08ff 0004 0000
00010e0 65fc 04ff 0002 0000 65fd 02ff 0004 0000
00010f0 00fe ff02 7ff1 0000 7ff2 0000 fff2 01fe
0001100 02fe ff02 fff2 01fe 7ff2 0000 7ff1 0000
0001110 01fe ff02 7ff1 0000 7ff4 0003 fff4 01fb
0001120 03fe ff02 fff4 01fb 7ff4 0003 7ff1 0000
0001130 04fe ff00 fff2 01ff 05ff ff00 fff4 01ff
0001140
Thanks,
Takahiro
next prev parent reply other threads:[~2026-09-15 6:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 4:50 [PATCH 0/2] mtd: spi-nor: spansion: Cleanup S25FS256S Takahiro Kuwano via B4 Relay
2026-09-14 4:50 ` [PATCH 1/2] mtd: spi-nor: spansion: Remove s25fs256s0 Takahiro Kuwano via B4 Relay
2026-09-14 4:50 ` [PATCH 2/2] mtd: spi-nor: spansion: Assign .fixups to s25fs256s1 Takahiro Kuwano via B4 Relay
2026-09-14 6:33 ` Michael Walle
2026-09-14 7:11 ` Takahiro.Kuwano
2026-09-14 9:37 ` Michael Walle
2026-09-15 6:13 ` Takahiro.Kuwano [this message]
2026-09-15 13:37 ` Miquel Raynal
2026-09-14 14:19 ` [PATCH 0/2] mtd: spi-nor: spansion: Cleanup S25FS256S Michael Walle
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=e15daee278f346cd8dae030e2409445e@infineon.com \
--to=takahiro.kuwano@infineon.com \
--cc=alex@sverdlin.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=mwalle@kernel.org \
--cc=pratyush@kernel.org \
--cc=richard@nod.at \
--cc=tudor.ambarus@linaro.org \
--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
all inboxes | Powered by JetHome®