[PATCH 2/2] mtd: spi-nor: spansion: Assign .fixups to s25fs256s1

Michael Walle mwalle at kernel.org
Mon Sep 14 02:37:00 PDT 2026


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 at 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,
 };
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 297 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20260914/1c916174/attachment.sig>


More information about the linux-mtd mailing list