This series adds an "oem spi-nor-init" fastboot command that probes
the default SPI-NOR device, so its driver's probe() can run now if
it hasn't already, without any SoC-specific call hardcoded into
generic fastboot code.

Patch 1 adds the command itself, plus a weak
fastboot_oem_spi_nor_reinit() hook that runs immediately before the
probe. The default implementation is a no-op.

Patch 2 overrides that hook in drivers/misc/qcom_geni.c to re-run
qcom_geni_fw_initialise(), the wrapper-level GENI firmware loader.
That function only runs once, at EVT_LAST_STAGE_INIT; if the
firmware partition doesn't exist yet at that point (e.g. first boot,
before fastboot has flashed it), it finds nothing to load and a
later SPI-NOR probe cannot recover on its own. Re-running it from
the hook lets the SPI-NOR device pick up firmware that has since
been flashed.

Patch 3 is a standalone bugfix found while validating this series:
qcom_geni_fw_initialise() only populates the GENI wrapper's private
data if it finds a firmware partition at EVT_LAST_STAGE_INIT. On a
board with no MMC/UFS storage and an unprovisioned SPI-NOR, that
leaves it NULL, and a later GENI peripheral probe crashes
dereferencing it. This affects qcom_geni_load_firmware() regardless
of the "oem spi-nor-init" command added by this series.

This is useful on boards where SPI-NOR is not usable until after
fastboot has flashed something it depends on, and is intended to be
used together with "oem set-block-target" (see the "fastboot: block:
add 'oem set-block-target' command and runtime override" series)
once the device has been brought up.

No existing API signatures are changed.

Signed-off-by: Vandhiadevan Karunamoorthy 
<[email protected]>
---
Depends on: [PATCH v2] fastboot: block: add 'oem set-block-target' command and 
runtime override
Link: 
https://lore.kernel.org/u-boot/20260917-series2-fastboot-block-target-v2-1-2371f8b15...@oss.qualcomm.com/

---
Vandhiadevan Karunamoorthy (3):
      fastboot: spi: add 'oem spi-nor-init' command
      misc: qcom_geni: implement fastboot_oem_spi_nor_reinit()
      misc: qcom_geni: fix NULL pointer dereference in qcom_geni_load_firmware()

 drivers/fastboot/Kconfig      | 11 +++++++++
 drivers/fastboot/fb_command.c | 55 +++++++++++++++++++++++++++++++++++++++++++
 drivers/misc/qcom_geni.c      | 19 +++++++++++++++
 include/fastboot.h            | 13 ++++++++++
 4 files changed, 98 insertions(+)
---
base-commit: 31eb181676a0d7e055a7b7309bdba8fc0c52de84
change-id: 20260824-series3-oem-spi-nor-init-2fe96d643af5

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

Reply via email to