[PATCH v4 0/7] qcom: Add NVMEM bitfield support and rebootâmode integration
Aswin Murugan
aswin.murugan at oss.qualcomm.com
Wed Apr 8 14:18:34 CEST 2026
This patch series introduces bit-level granularity to NVMEM cells and
adds complete reboot-mode support for Qualcomm platforms that store
reboot reasons in PMIC registers.
Qualcomm SoCs rely on PMIC-backed reboot reason storage to implement
features like "reboot bootloader" for entering fastboot mode. However,
these PMIC registers often pack multiple fields into a single byte,
requiring fine-grained bit access that the current NVMEM subsystem does
not support.
In addition, PMIC generations differ in how reboot-related data is
stored: older PMICs use PON (Power On) registers, while newer ones
provide SDAM regions. This series introduces a unified, NVMEM-based
approach that works seamlessly across both architectures.
This version also integrates reboot-mode handling into Qualcomm board
initialization, enabling automatic fastboot entry when the reboot reason
indicates bootloader mode.
Signed-off-by: Aswin Murugan <aswin.murugan at oss.qualcomm.com>
---
Changes in v4:
1. NVMEM Core (drivers/misc/nvmem.c, include/nvmem.h):
- Explicitly interpret hardware bytes as little-endian for bitfield operations
to ensure consistent behavior across architectures
- Removed const pointer write violation in nvmem_cell_write()
- Replaced unsafe bit shift expressions with GENMASK() macro to avoid undefined
behavior when nbits == 32
- Consolidated size validation logic for clarity
- Enhanced documentation with explicit @cell parameters (offset, size, nbits, bit_offset)
- Changed magic number 4 to sizeof(u32) for consistency
2. QCOM SPMI SDAM Driver (drivers/misc/qcom-spmi-sdam.c):
- Fixed address type mismatch using local fdt_addr_t variable to prevent silent
comparison failure on 64-bit platforms
- Removed non-standard qcom,sdam-size property and hardcoded SDAM size to 0x100
bytes per hardware specification
- Changed dev_info() to dev_dbg() to reduce boot log verbosity
3. Board Integration (arch/arm/mach-snapdragon/board.c):
- Simplified conditional compilation with runtime check instead of #ifdef wrapper
- Adopted logging subsystem (log_info/log_warning) consistent with rest of file
- Added error handling for fastboot command failures
4. Device Tree (arch/arm/dts/qcs615-ride-u-boot.dtsi):
- Changed bits property to decimal format (bits = <1 7>) for consistency with
upstream conventions
5. Test Coverage (test/dm/nvmem.c):
- Created separate test file for NVMEM bitfield tests
- Fixed test to use correct I2C EEPROM functions
- Corrected test expectation bug for 4-byte cell with 12-bit field spanning byte boundary
- Added comprehensive error validation tests
Link to v3:
https://lore.kernel.org/u-boot/20260330171419.1117817-1-aswin.murugan@oss.qualcomm.com/
Changes in v3:
1. Simplified bit field handling to maximum u32 size (32 bits).
2. Enforced strict size matching (size == cell->size) when nbits == 0.
3. Enhanced test function for NVMEM read & write
4. Updated NVMEM API documentation
Link to v2:
https://lore.kernel.org/all/20260213112717.1256823-1-aswin.murugan@oss.qualcomm.com/
Changes in v2:
1. Replaced custom reboot reason handling with the standard U-Boot
reboot-mode subsystem, per review feedback.
2. Added bit-field support to the NVMEM core using the new "bits"
property.
3. Introduced the Qualcomm SPMI SDAM driver for unified PMIC storage
access.
4. Updated the reboot-mode driver to support variable-sized NVMEM cells.
5. Added device tree configuration for the QCS615 RIDE board.
6. Enabled reboot-mode in qcom_defconfig.
7. Integrated reboot-mode detection into Snapdragon board
initialization:
- Added qcom_handle_reboot_mode() in board_late_init() to enable
automatic fastboot entry on "reboot bootloader".
Link to v1:
https://lore.kernel.org/all/20260108065533.1143179-1-aswin.murugan@oss.qualcomm.com/
---
Aswin Murugan (7):
misc: Add support for bit fields in NVMEM cells
misc: qcom: Add Qualcomm SPMI SDAM NVMEM driver
mach-snapdragon: Integrate reboot-mode handling
dts: qcs615-ride-u-boot.dtsi: Add reboot-mode support
qcom_defconfig: Enable reboot-mode support in qcom_defconfig
test: dm: add comprehensive tests for NVMEM bit field operations
misc: update API documentation for bit field support in NVMEM
arch/arm/dts/qcs615-ride-u-boot.dtsi | 26 ++++
arch/arm/mach-snapdragon/board.c | 59 ++++++--
arch/sandbox/dts/test.dts | 12 ++
configs/qcom_defconfig | 3 +
drivers/misc/Kconfig | 8 ++
drivers/misc/Makefile | 1 +
drivers/misc/nvmem.c | 166 +++++++++++++++++++---
drivers/misc/qcom-spmi-sdam.c | 202 +++++++++++++++++++++++++++
include/nvmem.h | 40 +++++-
test/dm/Makefile | 1 +
test/dm/nvmem.c | 160 +++++++++++++++++++++
11 files changed, 641 insertions(+), 37 deletions(-)
create mode 100644 drivers/misc/qcom-spmi-sdam.c
create mode 100644 test/dm/nvmem.c
--
2.34.1
More information about the U-Boot
mailing list