From: Hongmei Xu <hongmei.xu@oss.qualcomm.com>
To: "Srinivas Kandagatla" <srini@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Rafał Miłecki" <rafal@milecki.pl>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
Hongmei Xu <hongmei.xu@oss.qualcomm.com>
Subject: [PATCH v5 0/5] nvmem: add Qualcomm eFuse Ethernet MAC address layout driver
Date: Fri, 04 Dec 2026 14:22:24 +0800 [thread overview]
Message-ID: <20261204-nvmem-byte-mask-for-split-macaddr-v5-0-13c12a99383f@oss.qualcomm.com> (raw)
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@oss.qualcomm.com>
---
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@oss.qualcomm.com
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@oss.qualcomm.com
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@oss.qualcomm.com
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@oss.qualcomm.com
---
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@oss.qualcomm.com>
next reply other threads:[~2026-12-04 6:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 6:22 Hongmei Xu [this message]
2026-12-04 6:22 ` [PATCH v5 1/5] dt-bindings: nvmem: layouts: add Qualcomm eFuse Ethernet MAC layout Hongmei Xu
2026-12-04 13:07 ` Rob Herring (Arm)
2026-12-05 3:21 ` Krzysztof Kozlowski
2026-12-04 6:22 ` [PATCH v5 2/5] nvmem: layouts: add Qualcomm eFuse Ethernet MAC address layout driver Hongmei Xu
2026-12-04 6:22 ` [PATCH v5 3/5] MAINTAINERS: add entry for Qualcomm Ethernet MAC nvmem " Hongmei Xu
2026-12-04 6:22 ` [PATCH v5 4/5] arm64: defconfig: enable NVMEM_LAYOUT_QCOM_ETH_MAC Hongmei Xu
2026-12-05 3:19 ` Krzysztof Kozlowski
2026-12-04 6:22 ` [PATCH v5 5/5] arm64: dts: qcom: Add eFuse nvmem cells for Ethernet MAC addresses Hongmei Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261204-nvmem-byte-mask-for-split-macaddr-v5-0-13c12a99383f@oss.qualcomm.com \
--to=hongmei.xu@oss.qualcomm.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafal@milecki.pl \
--cc=robh@kernel.org \
--cc=srini@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®