mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v5 0/5] nvmem: add Qualcomm eFuse Ethernet MAC address layout driver
@ 2026-12-04  6:22 Hongmei Xu
  2026-12-04  6:22 ` [PATCH v5 1/5] dt-bindings: nvmem: layouts: add Qualcomm eFuse Ethernet MAC layout Hongmei Xu
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Hongmei Xu @ 2026-12-04  6:22 UTC (permalink / raw)
  To: Srinivas Kandagatla, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Rafał Miłecki
  Cc: devicetree, linux-kernel, Hongmei Xu

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 = <&eth0_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>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v5 1/5] dt-bindings: nvmem: layouts: add Qualcomm eFuse Ethernet MAC layout
  2026-12-04  6:22 [PATCH v5 0/5] nvmem: add Qualcomm eFuse Ethernet MAC address layout driver Hongmei Xu
@ 2026-12-04  6:22 ` Hongmei Xu
  2026-12-04  6:22 ` [PATCH v5 2/5] nvmem: layouts: add Qualcomm eFuse Ethernet MAC address layout driver Hongmei Xu
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Hongmei Xu @ 2026-12-04  6:22 UTC (permalink / raw)
  To: Srinivas Kandagatla, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Rafał Miłecki
  Cc: devicetree, linux-kernel, Hongmei Xu

Add a device tree binding for the Qualcomm eFuse Ethernet MAC address
NVMEM layout driver. The layout handles cells whose bytes in the QFPROM
may not be contiguous.

Each cell node specifies the physical eFuse offset and size via reg.
An optional byte-mask property selects which physical bytes contribute
to the 6-byte output MAC address; selected bytes are compacted in
ascending bit-index order. Without byte-mask the cell is read as a
plain contiguous 6-byte block.

Also add qcom,nord-qfprom to the QFPROM compatible list; this SoC uses
the layout and its compatible is referenced in the binding example.

Signed-off-by: Hongmei Xu <hongmei.xu@oss.qualcomm.com>
---
 .../bindings/nvmem/layouts/qcom,efuse-eth-mac.yaml | 87 ++++++++++++++++++++++
 .../devicetree/bindings/nvmem/qcom,qfprom.yaml     |  1 +
 2 files changed, 88 insertions(+)

diff --git a/Documentation/devicetree/bindings/nvmem/layouts/qcom,efuse-eth-mac.yaml b/Documentation/devicetree/bindings/nvmem/layouts/qcom,efuse-eth-mac.yaml
new file mode 100644
index 000000000000..545aeb1741ce
--- /dev/null
+++ b/Documentation/devicetree/bindings/nvmem/layouts/qcom,efuse-eth-mac.yaml
@@ -0,0 +1,87 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/nvmem/layouts/qcom,efuse-eth-mac.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Ethernet MAC address NVMEM layout
+
+maintainers:
+  - Hongmei Xu <hongmei.xu@oss.qualcomm.com>
+
+description:
+  Layout for reading Ethernet MAC addresses from Qualcomm eFuse (QFPROM).
+  Each cell node declares the physical eFuse offset via reg. An optional
+  byte-mask property selects which physical bytes contribute to the 6-byte
+  output MAC; selected bytes are compacted in ascending bit-index order and
+  unset positions are zero-filled. Without byte-mask the cell is read as a
+  plain contiguous 6-byte block.
+
+select: false
+
+properties:
+  compatible:
+    const: qcom,efuse-eth-mac
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 1
+
+patternProperties:
+  "^eth[0-9]+-mac@[0-9a-f]+$":
+    type: object
+    description: Ethernet MAC address cell
+
+    properties:
+      reg:
+        maxItems: 1
+        description:
+          Physical span within the NVMEM device as <offset size>. The
+          driver uses byte-mask to determine the actual read length;
+          size is informational and conventionally set to the physical
+          span of the MAC bytes in the eFuse.
+
+      byte-mask:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        description:
+          Bitmask where bit i means physical byte i in the eFuse span
+          contributes to the output MAC address. Valid bytes are compacted
+          in ascending bit-index order; output positions beyond
+          hweight(byte-mask) are zero-filled. The number of set bits must
+          not exceed ETH_ALEN (6). Absent when all 6 bytes are contiguous.
+
+    required:
+      - reg
+
+    additionalProperties: false
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    efuse: efuse@360d4320 {
+        compatible = "qcom,nord-qfprom", "qcom,qfprom";
+        reg = <0x0 0x360d4320 0x0 0x8>;
+
+        nvmem-layout {
+            compatible = "qcom,efuse-eth-mac";
+            #address-cells = <1>;
+            #size-cells = <1>;
+
+            eth0_mac: eth0-mac@0 {
+                reg = <0x0 0x6>;
+            };
+
+            eth1_mac: eth1-mac@0 {
+                reg = <0x0 0x7>;
+                byte-mask = <0x5f>;
+            };
+        };
+    };
+
+...
diff --git a/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml b/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml
index 566304ed4c78..d7f48d4ed1ba 100644
--- a/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml
+++ b/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml
@@ -42,6 +42,7 @@ properties:
           - qcom,msm8976-qfprom
           - qcom,msm8996-qfprom
           - qcom,msm8998-qfprom
+          - qcom,nord-qfprom
           - qcom,qcm2290-qfprom
           - qcom,qcs404-qfprom
           - qcom,qcs615-qfprom

-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v5 2/5] nvmem: layouts: add Qualcomm eFuse Ethernet MAC address layout driver
  2026-12-04  6:22 [PATCH v5 0/5] nvmem: add Qualcomm eFuse Ethernet MAC address layout driver Hongmei Xu
  2026-12-04  6:22 ` [PATCH v5 1/5] dt-bindings: nvmem: layouts: add Qualcomm eFuse Ethernet MAC layout Hongmei Xu
@ 2026-12-04  6:22 ` Hongmei Xu
  2026-12-04  6:22 ` [PATCH v5 3/5] MAINTAINERS: add entry for Qualcomm Ethernet MAC nvmem " Hongmei Xu
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Hongmei Xu @ 2026-12-04  6:22 UTC (permalink / raw)
  To: Srinivas Kandagatla, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Rafał Miłecki
  Cc: devicetree, linux-kernel, Hongmei Xu

Add an NVMEM layout driver for reading Ethernet MAC addresses from
Qualcomm eFuse (QFPROM). The driver supports two cell layouts:

- Contiguous: six consecutive eFuse bytes form the MAC directly.
- Non-contiguous: a byte-mask device tree property selects which
  physical bytes within the eFuse span contribute to the output MAC.
  Bit i set means byte i is included; selected bytes are compacted
  in ascending bit-index order into a 6-byte output.

QFPROM hardware requires 4-byte word-aligned reads. For non-contiguous
cells the actual read length is ALIGN(fls(byte_mask), 4); for
contiguous cells it is ALIGN(ETH_ALEN, 4). Both paths are validated
against the eFuse device size at layout probe time to prevent
out-of-bounds hardware accesses.

Signed-off-by: Hongmei Xu <hongmei.xu@oss.qualcomm.com>
---
 drivers/nvmem/layouts/Kconfig        |  11 ++
 drivers/nvmem/layouts/Makefile       |   1 +
 drivers/nvmem/layouts/qcom-eth-mac.c | 203 +++++++++++++++++++++++++++++++++++
 3 files changed, 215 insertions(+)

diff --git a/drivers/nvmem/layouts/Kconfig b/drivers/nvmem/layouts/Kconfig
index 5e586dfebe47..d60bce199b8e 100644
--- a/drivers/nvmem/layouts/Kconfig
+++ b/drivers/nvmem/layouts/Kconfig
@@ -37,6 +37,17 @@ config NVMEM_LAYOUT_U_BOOT_ENV
 
 	  If unsure, say N.
 
+config NVMEM_LAYOUT_QCOM_ETH_MAC
+	tristate "Qualcomm Ethernet MAC address layout"
+	depends on OF
+	help
+	  Reads Ethernet MAC addresses from Qualcomm eFuse (QFPROM).
+	  Supports cells with non-contiguous byte layouts via an optional
+	  byte-mask property that selects and compacts physical eFuse bytes
+	  into the 6-byte output MAC address.
+
+	  Say Y if your Qualcomm SoC stores Ethernet MAC addresses in eFuse.
+
 endmenu
 
 endif
diff --git a/drivers/nvmem/layouts/Makefile b/drivers/nvmem/layouts/Makefile
index dd6c6c70b1a9..127a4aae420d 100644
--- a/drivers/nvmem/layouts/Makefile
+++ b/drivers/nvmem/layouts/Makefile
@@ -7,3 +7,4 @@ obj-$(CONFIG_NVMEM_LAYOUTS) += fixed-layout.o
 obj-$(CONFIG_NVMEM_LAYOUT_SL28_VPD) += sl28vpd.o
 obj-$(CONFIG_NVMEM_LAYOUT_ONIE_TLV) += onie-tlv.o
 obj-$(CONFIG_NVMEM_LAYOUT_U_BOOT_ENV) += u-boot-env.o
+obj-$(CONFIG_NVMEM_LAYOUT_QCOM_ETH_MAC) += qcom-eth-mac.o
diff --git a/drivers/nvmem/layouts/qcom-eth-mac.c b/drivers/nvmem/layouts/qcom-eth-mac.c
new file mode 100644
index 000000000000..990b096a0a5f
--- /dev/null
+++ b/drivers/nvmem/layouts/qcom-eth-mac.c
@@ -0,0 +1,203 @@
+// SPDX-License-Identifier: GPL-2.0-only
+// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+/*
+ * Qualcomm Ethernet MAC address nvmem layout driver
+ *
+ * Each cell node carries an optional "byte-mask" — a bitmask where bit i
+ * means physical byte i in the eFuse span contributes to the output MAC.
+ * Valid bytes are compacted in ascending bit-index order into output
+ * positions 0..hweight(byte-mask)-1; remaining output bytes are zeroed.
+ * Without "byte-mask" the cell is read as a plain contiguous ETH_ALEN block.
+ *
+ * Example (SA8797P eth1 — physical bytes 0-4,6 are the MAC, byte 5 belongs
+ * to eth0 and must be skipped):
+ *   reg       = <0x0 0x7>;   // physical span: bytes 0-6
+ *   byte-mask = <0x5f>;      // bits 0,1,2,3,4,6 → output[0..5]
+ *
+ * QFPROM reads are 4-byte word-aligned; raw_len is rounded up accordingly.
+ */
+#include <linux/bitops.h>
+#include <linux/etherdevice.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/nvmem-consumer.h>
+#include <linux/nvmem-provider.h>
+#include <linux/of.h>
+#include <linux/slab.h>
+
+/* QFPROM register reads are 4-byte word aligned */
+#define QCOM_QFPROM_WORD_SIZE    4U
+
+struct qcom_eth_mac_priv {
+	u32 byte_mask;
+	u32 raw_len;
+	struct device *dev;
+};
+
+static int qcom_eth_mac_post_process(void *priv, const char *id, int index,
+				     unsigned int offset, void *buf, size_t bytes)
+{
+	struct qcom_eth_mac_priv *p = priv;
+	u8 *out = buf;
+	u32 out_idx = 0;
+	u8 *raw;
+	u32 i;
+
+	raw = kmemdup(buf, p->raw_len, GFP_KERNEL);
+	if (!raw)
+		return -ENOMEM;
+
+	memset(out, 0, bytes);
+
+	for (i = 0; i < p->raw_len && out_idx < bytes; i++) {
+		if (p->byte_mask & BIT(i))
+			out[out_idx++] = raw[i];
+	}
+
+	kfree(raw);
+	dev_dbg(p->dev, "post_process %s: mask=0x%02x out=%pM\n",
+		id, p->byte_mask, out);
+	return 0;
+}
+
+static int qcom_eth_mac_add_cells(struct nvmem_layout *layout)
+{
+	struct nvmem_device *nvmem = layout->nvmem;
+	struct device *dev = &layout->dev;
+	struct device_node *layout_node;
+	struct device_node *child;
+	int ret = 0;
+
+	layout_node = of_nvmem_layout_get_container(nvmem);
+	if (!layout_node) {
+		dev_err(dev, "add_cells: no nvmem-layout container node\n");
+		return -ENOENT;
+	}
+
+	for_each_child_of_node(layout_node, child) {
+		struct nvmem_cell_info info = {};
+		u32 reg[2];
+		u32 byte_mask = 0;
+
+		if (of_property_read_u32_array(child, "reg", reg, 2)) {
+			dev_err(dev, "missing reg in %pOF\n", child);
+			ret = -EINVAL;
+			goto out;
+		}
+
+		info.name   = child->name;
+		info.offset = reg[0];
+		info.bytes  = ETH_ALEN;
+		info.np     = of_node_get(child);
+
+		of_property_read_u32(child, "byte-mask", &byte_mask);
+
+		if (byte_mask) {
+			struct qcom_eth_mac_priv *priv;
+			u32 raw_len;
+
+			if (hweight32(byte_mask) > ETH_ALEN) {
+				dev_err(dev, "%pOF: byte-mask 0x%x has more than %d bits set\n",
+					child, byte_mask, ETH_ALEN);
+				of_node_put(info.np);
+				ret = -EINVAL;
+				goto out;
+			}
+
+			raw_len = ALIGN((u32)fls(byte_mask), QCOM_QFPROM_WORD_SIZE);
+
+			dev_dbg(dev, "%pOF: byte_mask=0x%x hweight=%d raw_len=%u\n",
+				 child, byte_mask, hweight32(byte_mask), raw_len);
+
+			if (info.offset + raw_len > nvmem_dev_size(nvmem)) {
+				dev_err(dev, "%pOF: offset %u + raw_len %u exceeds device size %zu\n",
+					child, info.offset, raw_len,
+					nvmem_dev_size(nvmem));
+				of_node_put(info.np);
+				ret = -EINVAL;
+				goto out;
+			}
+
+			priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+			if (!priv) {
+				of_node_put(info.np);
+				ret = -ENOMEM;
+				goto out;
+			}
+
+			priv->byte_mask        = byte_mask;
+			priv->raw_len          = raw_len;
+			priv->dev              = dev;
+			info.raw_len           = raw_len;
+			info.read_post_process = qcom_eth_mac_post_process;
+			info.priv              = priv;
+		} else {
+			/* contiguous cell: word-align the read to avoid read overlap */
+			info.raw_len = ALIGN(ETH_ALEN, QCOM_QFPROM_WORD_SIZE);
+
+			if (info.offset + info.raw_len > nvmem_dev_size(nvmem)) {
+				dev_err(dev, "%pOF: offset %u + %zu exceeds device size %zu\n",
+					child, info.offset, info.raw_len,
+					nvmem_dev_size(nvmem));
+				of_node_put(info.np);
+				ret = -EINVAL;
+				goto out;
+			}
+		}
+
+		ret = nvmem_add_one_cell(nvmem, &info);
+		if (ret) {
+			of_node_put(info.np);
+			dev_err(dev, "failed to add cell %s: %d\n", info.name, ret);
+			goto out;
+		}
+
+		dev_dbg(dev, "%pOF: added cell '%s' offset=%u bytes=%u raw_len=%zu\n",
+			 child, info.name, info.offset, info.bytes, info.raw_len);
+
+		/*
+		 * Mark the cell fwnode as not-a-device so fw_devlink stops
+		 * blocking ethernet on this supplier link.  Must be called
+		 * after nvmem_add_one_cell() so the fwnode exists.
+		 * fw_devlink_refresh_fwnode() cannot be used here because the
+		 * efuse device is still in probe and not yet DL_DEV_DRIVER_BOUND.
+		 */
+		fw_devlink_purge_absent_suppliers(of_fwnode_handle(child));
+	}
+
+out:
+	of_node_put(child);
+	of_node_put(layout_node);
+	return ret;
+}
+
+static int qcom_eth_mac_probe(struct nvmem_layout *layout)
+{
+	layout->add_cells = qcom_eth_mac_add_cells;
+
+	return nvmem_layout_register(layout);
+}
+
+static void qcom_eth_mac_remove(struct nvmem_layout *layout)
+{
+	nvmem_layout_unregister(layout);
+}
+
+static const struct of_device_id qcom_eth_mac_of_match[] = {
+	{ .compatible = "qcom,efuse-eth-mac" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, qcom_eth_mac_of_match);
+
+static struct nvmem_layout_driver qcom_eth_mac_layout = {
+	.driver = {
+		.name           = "qcom-eth-mac-layout",
+		.of_match_table = qcom_eth_mac_of_match,
+	},
+	.probe  = qcom_eth_mac_probe,
+	.remove = qcom_eth_mac_remove,
+};
+module_nvmem_layout_driver(qcom_eth_mac_layout);
+
+MODULE_DESCRIPTION("Qualcomm Ethernet MAC nvmem layout driver");
+MODULE_LICENSE("GPL");

-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v5 3/5] MAINTAINERS: add entry for Qualcomm Ethernet MAC nvmem layout driver
  2026-12-04  6:22 [PATCH v5 0/5] nvmem: add Qualcomm eFuse Ethernet MAC address layout driver Hongmei Xu
  2026-12-04  6:22 ` [PATCH v5 1/5] dt-bindings: nvmem: layouts: add Qualcomm eFuse Ethernet MAC layout Hongmei Xu
  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 ` Hongmei Xu
  2026-12-04  6:22 ` [PATCH v5 4/5] arm64: defconfig: enable NVMEM_LAYOUT_QCOM_ETH_MAC Hongmei Xu
  2026-12-04  6:22 ` [PATCH v5 5/5] arm64: dts: qcom: Add eFuse nvmem cells for Ethernet MAC addresses Hongmei Xu
  4 siblings, 0 replies; 6+ messages in thread
From: Hongmei Xu @ 2026-12-04  6:22 UTC (permalink / raw)
  To: Srinivas Kandagatla, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Rafał Miłecki
  Cc: devicetree, linux-kernel, Hongmei Xu

Add a MAINTAINERS entry for the new Qualcomm Ethernet MAC nvmem layout
driver and its DT binding.

Signed-off-by: Hongmei Xu <hongmei.xu@oss.qualcomm.com>
---
 MAINTAINERS | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index fe23913b1e43..dfc53bb0bf7e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -23032,6 +23032,12 @@ L:	netdev@vger.kernel.org
 S:	Maintained
 F:	drivers/net/ethernet/qualcomm/emac/
 
+QUALCOMM ETHERNET MAC NVMEM LAYOUT DRIVER
+M:      Hongmei Xu <hongmei.xu@oss.qualcomm.com>
+S:      Maintained
+F:      Documentation/devicetree/bindings/nvmem/layouts/qcom,efuse-eth-mac.yaml
+F:      drivers/nvmem/layouts/qcom-eth-mac.c
+
 QUALCOMM ETHQOS ETHERNET DRIVER
 M:	Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com>
 L:	netdev@vger.kernel.org

-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v5 4/5] arm64: defconfig: enable NVMEM_LAYOUT_QCOM_ETH_MAC
  2026-12-04  6:22 [PATCH v5 0/5] nvmem: add Qualcomm eFuse Ethernet MAC address layout driver Hongmei Xu
                   ` (2 preceding siblings ...)
  2026-12-04  6:22 ` [PATCH v5 3/5] MAINTAINERS: add entry for Qualcomm Ethernet MAC nvmem " Hongmei Xu
@ 2026-12-04  6:22 ` Hongmei Xu
  2026-12-04  6:22 ` [PATCH v5 5/5] arm64: dts: qcom: Add eFuse nvmem cells for Ethernet MAC addresses Hongmei Xu
  4 siblings, 0 replies; 6+ messages in thread
From: Hongmei Xu @ 2026-12-04  6:22 UTC (permalink / raw)
  To: Srinivas Kandagatla, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Rafał Miłecki
  Cc: devicetree, linux-kernel, Hongmei Xu

Enable the Qualcomm eFuse Ethernet MAC address NVMEM layout driver for
arm64 builds.

Signed-off-by: Hongmei Xu <hongmei.xu@oss.qualcomm.com>
---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 7b4985b29b21..f7355450f22e 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -1728,6 +1728,7 @@ CONFIG_NVMEM_IMX_OCOTP=y
 CONFIG_NVMEM_IMX_OCOTP_ELE=m
 CONFIG_NVMEM_IMX_OCOTP_SCU=y
 CONFIG_NVMEM_LAYERSCAPE_SFP=m
+CONFIG_NVMEM_LAYOUT_QCOM_ETH_MAC=y
 CONFIG_NVMEM_MESON_EFUSE=m
 CONFIG_NVMEM_MTK_EFUSE=y
 CONFIG_NVMEM_QCOM_QFPROM=y

-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v5 5/5] arm64: dts: qcom: Add eFuse nvmem cells for Ethernet MAC addresses
  2026-12-04  6:22 [PATCH v5 0/5] nvmem: add Qualcomm eFuse Ethernet MAC address layout driver Hongmei Xu
                   ` (3 preceding siblings ...)
  2026-12-04  6:22 ` [PATCH v5 4/5] arm64: defconfig: enable NVMEM_LAYOUT_QCOM_ETH_MAC Hongmei Xu
@ 2026-12-04  6:22 ` Hongmei Xu
  4 siblings, 0 replies; 6+ messages in thread
From: Hongmei Xu @ 2026-12-04  6:22 UTC (permalink / raw)
  To: Srinivas Kandagatla, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Rafał Miłecki
  Cc: devicetree, linux-kernel, Hongmei Xu

Add a QFPROM eFuse node to expose the Ethernet MAC addresses for
EMAC0 and EMAC1 as nvmem cells.

The MAC addresses are stored in OEM_CONFIG8/9 registers starting at
0x360d4320:
  bytes 0-4  shared by both EMACs
  byte  5    last octet of EMAC0 MAC address
  byte  6    last octet of EMAC1 MAC address

EMAC0 reads six consecutive bytes (0-5), requiring no byte selection.
EMAC1 shares bytes 0-4 but takes byte 6 as its last octet, skipping
byte 5. A byte-mask of 0x5F (0b01011111) is used to select bytes
0,1,2,3,4,6 and compact them into the six-byte output buffer.

Only 8 bytes are mapped to avoid overlapping with adjacent QFPROM
devices in the register space.

Signed-off-by: Hongmei Xu <hongmei.xu@oss.qualcomm.com>
---
 arch/arm64/boot/dts/qcom/nord.dtsi | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/nord.dtsi b/arch/arm64/boot/dts/qcom/nord.dtsi
index fdbe290350dd..185db2e19c39 100644
--- a/arch/arm64/boot/dts/qcom/nord.dtsi
+++ b/arch/arm64/boot/dts/qcom/nord.dtsi
@@ -2116,6 +2116,26 @@ llcc: system-cache-controller@21800000 {
 				    "llcc_broadcast_base",
 				    "llcc_broadcast_and_base";
 		};
+
+		efuse: efuse@360d4320 {
+			compatible = "qcom,nord-qfprom", "qcom,qfprom";
+			reg = <0x0 0x360d4320 0x0 0x8>;
+
+			nvmem-layout {
+				compatible = "qcom,efuse-eth-mac";
+				#address-cells = <1>;
+				#size-cells = <1>;
+
+				eth0_mac: eth0-mac@0 {
+					reg = <0x0 0x6>;
+				};
+
+				eth1_mac: eth1-mac@0 {
+					reg = <0x0 0x7>;
+					byte-mask = <0x5f>;
+				};
+			};
+		};
 	};
 
 	arch_timer: timer {

-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-12-04  6:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-04  6:22 [PATCH v5 0/5] nvmem: add Qualcomm eFuse Ethernet MAC address layout driver Hongmei Xu
2026-12-04  6:22 ` [PATCH v5 1/5] dt-bindings: nvmem: layouts: add Qualcomm eFuse Ethernet MAC layout Hongmei Xu
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-04  6:22 ` [PATCH v5 5/5] arm64: dts: qcom: Add eFuse nvmem cells for Ethernet MAC addresses Hongmei Xu

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®