[PATCH v5 0/5] nvmem: add Qualcomm eFuse Ethernet MAC address layout driver
From: Hongmei Xu
Date: Fri Dec 04 2026 - 01:22:43 EST
Qualcomm QFPROM stores Ethernet MAC address bytes contiguously, but a
given MAC address may be formed by selecting a non-consecutive subset
of bytes from a larger eFuse span — for example, bytes 0–4 and 6 of a
7-byte region, skipping byte 5 which belongs to a different MAC.
This series adds an nvmem layout driver (qcom,efuse-eth-mac) to handle
this. Each cell node in the device tree specifies its physical eFuse
offset via reg, and an optional byte-mask property selects which bytes
within the span contribute to the 6-byte output MAC address. Selected
bytes are compacted in ascending bit-index order; unset positions are
zero-filled. Without byte-mask the cell is read as a plain contiguous
6-byte block.
An example: assume a MAC address is assembled from efuse registers
0xFFFF4320[31:0] (bytes 0-3), 0xFFFF4324[7:0] (byte 4), and
0xFFFF4324[23:16] (byte 6), with 0xFFFF4324[15:8] unused (byte 5).
Map the efuse region as an 8-byte nvmem device and define the cell
skipping byte 5:
efuse: efuse@ffff4320 {
compatible = "qcom,nord-qfprom", "qcom,qfprom";
reg = <0x0 0xffff4320 0x0 0x8>;
#address-cells = <1>;
#size-cells = <1>;
nvmem-layout {
compatible = "qcom,efuse-eth-mac";
#address-cells = <1>;
#size-cells = <1>;
eth0_mac: eth0-mac@0 {
reg = <0x0 0x7>;
byte-mask = <0x5f>;
};
};
};
ethernet0: ethernet@1a00000 {
nvmem-cells = <ð0_mac>;
nvmem-cell-names = "mac-address";
}
With byte-mask = 0x5f (0101_1111), bytes 0-4 and 6 are selected
(byte 5 is skipped), forming the 6-byte MAC address output.
Patches:
1/5 dt-bindings: document the qcom,efuse-eth-mac nvmem layout
2/5 nvmem: layouts: add the Qualcomm eFuse Ethernet MAC layout driver
3/5 MAINTAINERS: add entry for the new driver and binding
4/5 arm64: defconfig: enable NVMEM_LAYOUT_QCOM_ETH_MAC
5/5 arm64: dts: qcom: add eFuse nvmem cells for Ethernet MAC addresses
Signed-off-by: Hongmei Xu <hongmei.xu@xxxxxxxxxxxxxxxx>
---
Changes in v5:
- Moved byte-mask handling out of the nvmem core and into a standalone
nvmem layout driver (qcom,efuse-eth-mac) instead.
- Dropped the nvmem core byte-mask patches; the layout driver is
self-contained and requires no core changes.
- Updated dt-binding to describe the layout node and its properties.
- Link to v4: https://patch.msgid.link/20261202-nvmem-byte-mask-for-split-macaddr-v4-0-039f1b0afeca@xxxxxxxxxxxxxxxx
Changes in v4:
- Add nvmem-layout eFuse node in Nord dtsi to expose EMAC0/EMAC1
MAC address cells using the new byte-mask property
- Update cover letter usage example to use nvmem-layout style
- Link to v3: https://patch.msgid.link/20261117-nvmem-byte-mask-for-split-macaddr-v3-0-c02177658f66@xxxxxxxxxxxxxxxx
Changes in v3:
- Align cell->raw_len to word_size in byte-mask branch to avoid false
unaligned error log
- Remove redundant nvmem_validate_byte_mask() call from
nvmem_add_cells_from_dt(); validation already happens inside
nvmem_cell_info_to_nvmem_cell_entry_nodup()
- Fix DT binding commit message: remove misleading "multiple reg
entries" comparison
- Update cover letter description for bits property limitation
- Link to v2: https://patch.msgid.link/20261116-nvmem-byte-mask-for-split-macaddr-v2-0-96f4a0c08264@xxxxxxxxxxxxxxxx
Changes in v2:
- Move nvmem_validate_byte_mask() before the nbits block so byte_mask+nbits
is rejected even when nbits is set (mutual exclusion bypass fix).
- Run nvmem_validate_byte_mask() after fixup_dt_cell_info() in the DT path
so the provider callback can adjust cell info before validation.
- Set cell->raw_len = fls(byte_mask) instead of nvmem->size - cell->offset,
limiting the physical read to only the bytes needed; avoids large
allocations and read failures on providers with protected trailing regions
(e.g. sec-qfprom).
- Tighten the device-size check to ALIGN(fls(byte_mask), word_size) so
word-alignment cannot push the read past the device end.
- Zero-fill output bytes beyond the last selected byte with memset.
- Simplify compaction loop guard from i < raw_len && i < 32 to i < raw_len
since raw_len is now bounded by fls(byte_mask) <= 32.
- Link to v1: https://patch.msgid.link/20261113-nvmem-byte-mask-for-split-macaddr-v1-0-138f715f18c1@xxxxxxxxxxxxxxxx
---
Hongmei Xu (5):
dt-bindings: nvmem: layouts: add Qualcomm eFuse Ethernet MAC layout
nvmem: layouts: add Qualcomm eFuse Ethernet MAC address layout driver
MAINTAINERS: add entry for Qualcomm Ethernet MAC nvmem layout driver
arm64: defconfig: enable NVMEM_LAYOUT_QCOM_ETH_MAC
arm64: dts: qcom: Add eFuse nvmem cells for Ethernet MAC addresses
.../bindings/nvmem/layouts/qcom,efuse-eth-mac.yaml | 87 +++++++++
.../devicetree/bindings/nvmem/qcom,qfprom.yaml | 1 +
MAINTAINERS | 6 +
arch/arm64/boot/dts/qcom/nord.dtsi | 20 ++
arch/arm64/configs/defconfig | 1 +
drivers/nvmem/layouts/Kconfig | 11 ++
drivers/nvmem/layouts/Makefile | 1 +
drivers/nvmem/layouts/qcom-eth-mac.c | 203 +++++++++++++++++++++
8 files changed, 330 insertions(+)
---
base-commit: d26955e57475434b59d43ba372b2a50d33d5e0ed
change-id: 20261110-nvmem-byte-mask-for-split-macaddr-a4698a128057
Best regards,
--
Hongmei Xu <hongmei.xu@xxxxxxxxxxxxxxxx>