From: Srinivas Kandagatla <srini@kernel.org>
To: "Hongmei Xu" <hongmei.xu@oss.qualcomm.com>,
"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
Subject: Re: [PATCH v4 0/3] nvmem: Add byte-mask support for non-contiguous byte selection
Date: Wed, 2 Dec 2026 16:28:46 +0000 [thread overview]
Message-ID: <7c3d76ef-3f87-478b-889a-cdc6e321d83c@kernel.org> (raw)
In-Reply-To: <20261202-nvmem-byte-mask-for-split-macaddr-v4-0-039f1b0afeca@oss.qualcomm.com>
On 12/2/26 11:36 AM, Hongmei Xu wrote:
> Some hardware stores NVMEM cell data in non-contiguous bytes. For
> example, a MAC address cell may span 7 physical bytes with one byte
> unused, requiring the driver to skip that byte during readout.
>
> The existing 'bits' property can only selects a contiguous range of
> bits within a cell's declared region. This series adds a 'byte-mask'
> property to the fixed-cell binding and implements it in the nvmem
> core, allowing consumers to describe and read cells whose bytes are
> non-contiguous within the NVMEM device.
This belongs to a custom nvmem layout driver not in the core.
For that reason NAK in the current form.
--srini
>
> 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 = "...";
> reg = <0x0 0xffff4320 0x0 0x8>;
> #address-cells = <1>;
> #size-cells = <1>;
>
> nvmem-layout {
> compatible = "fixed-layout";
> #address-cells = <1>;
> #size-cells = <1>;
>
> mac_addr: mac-addr@0 {
> reg = <0x0 0x6>;
> byte-mask = <0x5f>;
> };
> };
> };
>
> With byte-mask = 0x5f (0101_1111), bytes 0-4 and 6 are selected
> (byte 5 is skipped), forming the 6-byte MAC address output.
>
> Signed-off-by: Hongmei Xu <hongmei.xu@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 (3):
> dt-bindings: nvmem: add byte-mask property for non-contiguous byte selection
> nvmem: core: add byte-mask support for non-contiguous cell bytes
> arm64: dts: qcom: Add eFuse nvmem cells for Ethernet MAC addresses
>
> .../bindings/nvmem/layouts/fixed-cell.yaml | 21 +++++
> .../devicetree/bindings/nvmem/qcom,qfprom.yaml | 1 +
> arch/arm64/boot/dts/qcom/nord.dtsi | 22 +++++
> drivers/nvmem/core.c | 95 ++++++++++++++++++++--
> include/linux/nvmem-provider.h | 8 ++
> 5 files changed, 141 insertions(+), 6 deletions(-)
> ---
> base-commit: d26955e57475434b59d43ba372b2a50d33d5e0ed
> change-id: 20261110-nvmem-byte-mask-for-split-macaddr-a4698a128057
>
> Best regards,
> --
> Hongmei Xu <hongmei.xu@oss.qualcomm.com>
>
prev parent reply other threads:[~2026-12-02 16:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 11:36 [PATCH v4 0/3] nvmem: Add byte-mask support for non-contiguous byte selection Hongmei Xu
2026-12-02 11:36 ` [PATCH v4 1/3] dt-bindings: nvmem: add byte-mask property " Hongmei Xu
2026-12-02 11:45 ` sashiko-bot
2026-12-02 11:36 ` [PATCH v4 2/3] nvmem: core: add byte-mask support for non-contiguous cell bytes Hongmei Xu
2026-12-02 11:36 ` [PATCH v4 3/3] arm64: dts: qcom: Add eFuse nvmem cells for Ethernet MAC addresses Hongmei Xu
2026-12-02 11:55 ` sashiko-bot
2026-12-02 16:28 ` Srinivas Kandagatla [this message]
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=7c3d76ef-3f87-478b-889a-cdc6e321d83c@kernel.org \
--to=srini@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=hongmei.xu@oss.qualcomm.com \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafal@milecki.pl \
--cc=robh@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