This series lets SPI-NOR flash be exposed through the existing MTD
block (UCLASS_MTD) device, so it can be partitioned with a standard
GPT/MBR table and addressed like any other block device (e.g. by
fastboot, "part", or "gpt" commands), instead of requiring the
mtdparts= command-line partitioning scheme.

Patch 1 is a standalone bugfix: mtd_blk_probe() never set
bdesc->lba, so any MTD-backed block device reported zero blocks and
could not be scanned for a partition table. This affects all MTD
block devices, not just SPI-NOR.

Patch 2 wires sf_probe.c to bind the SPI-NOR device into the MTD
block subsystem via the existing mtd_bind() (no signature change),
using a fixed 4 KB logical block size (new CONFIG_MTD_BLOCK_SIZE
Kconfig value) instead of mtd_bind()'s 512-byte default, matching the
sector size GPT images are generated with.

Patch 3 fixes blk_get_devnum_by_uclass_idname() so a block device
whose declared uclass_id (UCLASS_MTD, set by mtd_bind()) differs
from its parent's uclass (UCLASS_SPI_FLASH) can still be looked up by
interface name -- required for the "mtd" interface to work at all
via the generic block lookup helpers.

Patch 4 is a standalone bugfix found while validating this series:
part_init() takes a fast path when a block device's part_type is
already cached (e.g. PART_TYPE_MTD from a prior probe), so a GPT
written via fastboot to a previously-probed SPI-NOR block device
kept reporting the stale MTD type instead of switching to EFI. Force
re-detection after writing a new GPT so the device is recognized
correctly on the next partition lookup.

No existing API signatures are changed and no new Kconfig-gated
behavior is introduced for devices that don't opt in.

---
To: [email protected]
To: Takahiro Kuwano <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Vignesh R <[email protected]>
Cc: Javier Martinez Canillas <[email protected]>
Cc: Ilias Apalodimas <[email protected]>
Cc: Anurag Dutta <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Udit Kumar <[email protected]>
Signed-off-by: Vandhiadevan Karunamoorthy 
<[email protected]>

---
Vandhiadevan Karunamoorthy (4):
      mtd: mtdblock: fix lba not being set on MTD block devices
      mtd: spi: sf_probe: bind SPI-NOR into MTD block subsystem
      blk: uclass: dispatch UCLASS_MTD lookups by block descriptor
      disk: part_efi: force partition re-detection after GPT write

 disk/part_efi.c            |  2 ++
 drivers/block/blk-uclass.c |  3 +++
 drivers/mtd/Kconfig        |  9 +++++++++
 drivers/mtd/mtdblock.c     |  2 ++
 drivers/mtd/spi/sf_probe.c | 35 +++++++++++++++++++++++++++++++++++
 5 files changed, 51 insertions(+)
---
base-commit: a57e30ef46731309e7120d2900d294ac934f7609
change-id: 20260824-series1-spinor-mtd-gpt-c3694cb91fa7

Best regards,
--  
Vandhiadevan Karunamoorthy <[email protected]>

Reply via email to