The spi-nor-core.c contains optional logics like SFDP and manufcaturer
specific fixups. The spi-nor-ids.c has single large ID database. There
are many #ifdef directives in those files and that negatively affects
readability and maintainability.
This series, as the first step of cleanup, move SFDP logic, IDs, and
fixups to newly source files. Reworking, renaming, and reformating
existing code is not a scope of this series and further cleanup will be
taken place in follow-up patches.
Here is the code size impact when applying this series.
Measured by my AMD Zynq-7000 (ARM32) environment with SFDP and all
manufcaturers are enabled.
SPI-NOR:
text data bss dec hex filename
BEFORE 720685 14084 0 734769 b3631 u-boot
AFTER 721827 14156 0 735983 b3aef u-boot
DELTA +1142 +72
TINY:
text data bss dec hex filename
BEFORE 77399 3128 248 80775 13b87 spl/u-boot-spl
AFTER 77589 3200 248 81037 13c8d spl/u-boot-spl
DELTA +190 +72
Changes in v3:
- Expose manufacturers table so that sandbox can look up
- Update sandbox to handle manufacturers table
- Link to v2:
https://lore.kernel.org/u-boot/[email protected]/
Changes in v2:
- Rebase on top of next
- Link to v1:
https://lore.kernel.org/u-boot/20260612-split-id-table-into-vendor-files-v1-0-dfaaa82cc...@infineon.com/
Signed-off-by: Takahiro Kuwano <[email protected]>
---
Takahiro Kuwano (4):
mtd: spi-nor: move SFDP logic out of the core
mtd: spi-nor: import manufacturer driver concept from Linux
mtd: spi-nor: move flash info entries to manufacturer drivers
mtd: spi-nor: move fixups to manufacturer drivers
drivers/mtd/spi/Makefile | 18 +
drivers/mtd/spi/atmel.c | 28 +
drivers/mtd/spi/dosilicon.c | 25 +
drivers/mtd/spi/eon.c | 23 +
drivers/mtd/spi/fujitsu.c | 27 +
drivers/mtd/spi/gigadevice.c | 140 ++
drivers/mtd/spi/issi.c | 84 ++
drivers/mtd/spi/macronix.c | 154 +++
drivers/mtd/spi/micron-st.c | 169 +++
drivers/mtd/spi/puya.c | 56 +
drivers/mtd/spi/sandbox.c | 33 +-
drivers/mtd/spi/sf_internal.h | 136 +-
drivers/mtd/spi/sfdp.c | 720 ++++++++++
drivers/mtd/spi/sfdp.h | 152 +++
drivers/mtd/spi/siliconkaiser.c | 18 +
drivers/mtd/spi/spansion.c | 700 ++++++++++
drivers/mtd/spi/spi-nor-core.c | 2751 +++++++--------------------------------
drivers/mtd/spi/spi-nor-ids.c | 753 +----------
drivers/mtd/spi/spi-nor-tiny.c | 11 +-
drivers/mtd/spi/sst.c | 34 +
drivers/mtd/spi/winbond.c | 250 ++++
drivers/mtd/spi/xmc.c | 27 +
drivers/mtd/spi/xtx.c | 54 +
drivers/mtd/spi/zbit.c | 19 +
include/linux/mtd/spi-nor.h | 2 +
25 files changed, 3404 insertions(+), 2980 deletions(-)
---
base-commit: ed869863c7e2aca50d57a05d843830dd843138c4
change-id: 20261016-split-sfdp-id-v3-f5602435a540
Best regards,
--
Takahiro Kuwano <[email protected]>