Skip to contentSkip to conversation

nvmem: patches for 7.2

PATCH In review [email protected] 3 participants 18 messages May 30 – Jul 17

Subsystems (5)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

cover nvmem: patches for 7.2

From: Srinivas Kandagatla <[email protected]>

Hi Greg,

Here are few nvmem patches for 7.2, Could you please queue these for 7.2.

Patches include
- Device tree bindings for Milos, airoha, lan9662, Shikra,
Hawi, glymur providers.
- some code cleanup in Kconfig, rockchip, nintendo providers.
- clarify default read-only behaviour for wp-gpios
- airoha new nvmem provider driver

Thanks,
Srini

*** BLURB HERE ***

Alexander Koskovich (1):
dt-bindings: nvmem: qfprom: Add Milos compatible

Christian Marangi (2):
dt-bindings: nvmem: airoha: add SMC eFuses schema
nvmem: airoha: Add support for SMC eFUSE

Horatiu Vultur (1):
nvmem: lan9662-otp: add support for LAN969x

Julian Braha (1):
nvmem: cleanup dead code in Kconfig

Komal Bajaj (1):
dt-bindings: nvmem: qcom,qfprom: Add Shikra compatible

Krzysztof Kozlowski (1):
nvmem: qcom: Unify user-visible "Qualcomm" name

Marek Vasut (1):
nvmem: core: Default to read-only if wp-gpios present

Mukesh Ojha (1):
dt-bindings: nvmem: qfprom: qcom: Add Hawi compatible

Pankaj Patil (1):
dt-bindings: nvmem: qfprom: Add glymur compatible

Robert Marko (1):
dt-bindings: nvmem: lan9662-otpc: Add LAN969x series

Rosen Penev (2):
nvmem: rockchip-otp: alloc clks with main struct
nvmem: nintendo-otp: Use of_device_get_match_data()

Tomasz Maciej Nowak (1):
nvmem: layouts: u-boot-env: check earlier for ethaddr length

 .../bindings/nvmem/airoha,smc-efuses.yaml     |  67 ++++++++++
 .../nvmem/microchip,lan9662-otpc.yaml         |   1 +
 .../bindings/nvmem/qcom,qfprom.yaml           |   4 +
 drivers/nvmem/Kconfig                         |  22 ++-
 drivers/nvmem/Makefile                        |   2 +
 drivers/nvmem/airoha-smc-efuses.c             | 125 ++++++++++++++++++
 drivers/nvmem/core.c                          |   4 +
 drivers/nvmem/lan9662-otpc.c                  |  12 +-
 drivers/nvmem/layouts/u-boot-env.c            |   5 +-
 drivers/nvmem/nintendo-otp.c                  |   9 +-
 drivers/nvmem/rockchip-otp.c                  |   9 +-
 11 files changed, 236 insertions(+), 24 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/nvmem/airoha,smc-efuses.yaml
 create mode 100644 drivers/nvmem/airoha-smc-efuses.c
Signature · 1 line
2.53.0
author maintainer
#1 lore raw

PATCH 1/14 dt-bindings: nvmem: qfprom: Add glymur compatible

From: Pankaj Patil <[email protected]>

Document compatible string for the QFPROM on Glymur platform.

---
 Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml +1 -0
index 2ab047f2bb69..aad8f5ea6fff 100644
@@ -19,6 +19,7 @@ properties:
       - enum:
           - qcom,apq8064-qfprom
           - qcom,apq8084-qfprom
+          - qcom,glymur-qfprom
           - qcom,ipq5018-qfprom
           - qcom,ipq5332-qfprom
           - qcom,ipq5424-qfprom
Signature · 1 line
2.53.0
author maintainer
#2 lore raw

PATCH 2/14 nvmem: rockchip-otp: alloc clks with main struct

In reply to [email protected]

From: Rosen Penev <[email protected]>

Use a flexible array member to simplify allocation slightly. No need for a separate calloc.

---
 drivers/nvmem/rockchip-otp.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/nvmem/rockchip-otp.c +2 -7
index 0ec78b5e19e7..2c0feb036f3f 100644
@@ -78,9 +78,9 @@ struct rockchip_data {
 struct rockchip_otp {
 	struct device *dev;
 	void __iomem *base;
-	struct clk_bulk_data *clks;
 	struct reset_control *rst;
 	const struct rockchip_data *data;
+	struct clk_bulk_data clks[];
 };
 
 static int rockchip_otp_reset(struct rockchip_otp *otp)
@@ -424,7 +424,7 @@ static int rockchip_otp_probe(struct platform_device *pdev)
 	if (!data)
 		return dev_err_probe(dev, -EINVAL, "failed to get match data\n");
 
-	otp = devm_kzalloc(&pdev->dev, sizeof(struct rockchip_otp),
+	otp = devm_kzalloc(&pdev->dev, struct_size(otp, clks, data->num_clks),
 			   GFP_KERNEL);
 	if (!otp)
 		return -ENOMEM;
@@ -436,11 +436,6 @@ static int rockchip_otp_probe(struct platform_device *pdev)
 		return dev_err_probe(dev, PTR_ERR(otp->base),
 				     "failed to ioremap resource\n");
 
-	otp->clks = devm_kcalloc(dev, data->num_clks, sizeof(*otp->clks),
-				 GFP_KERNEL);
-	if (!otp->clks)
-		return -ENOMEM;
-
 	for (i = 0; i < data->num_clks; ++i)
 		otp->clks[i].id = data->clks[i];
 
Signature · 1 line
2.53.0
author maintainer
#3 lore raw

PATCH 3/14 nvmem: core: Default to read-only if wp-gpios present

In reply to [email protected]

From: Marek Vasut <[email protected]>

In case the nvmem DT node contains "wp-gpios" DT property, the device currently defaults to read-write and the force_ro sysfs attribute reads
0. Switch to the default read-only, which is both safer, and aligned with eMMC HW BOOT partition force_ro sysfs attribute behavior, which also defaults to read-only.

The adjustment of nvmem->read_only value to read-only in case wp-gpios DT property is present must be done only after the device_add() got called because device_add() does internally call nvmem_bin_attr_get_umode(), which configures the permissions of 'nvmem' bin attr based on the value of nvmem->read_only that is only parsed from DT property 'read-only', without any adjustment. This way, if DT property 'read-only' is present, the 'nvmem' attribute is always read-only. Otherwise, if the device is writeable, then 'nvmem' attribute is writeable, and nvmem->read_only defaults to read-only, but can be switched to read-write at runtime via the 'force_ro' attribute.

The updated behavior can be tested as follows:

Current content:
"

$ cat /sys/bus/nvmem/devices/logging7/force_ro
1
$ hexdump -C /sys/bus/nvmem/devices/logging7/nvmem
00000000  66 6f 6f 0a ff ff ff ff
"

Write into default-read-only device:
"

$ echo bar > /sys/bus/nvmem/devices/logging7/nvmem
bash: echo: write error: Operation not permitted
$ cat /sys/bus/nvmem/devices/logging7/force_ro
1
"

Unlock and write into device:
"

$ echo 0 > /sys/bus/nvmem/devices/logging7/force_ro
$ cat /sys/bus/nvmem/devices/logging7/force_ro
0
$ echo bar > /sys/bus/nvmem/devices/logging7/nvmem
$ hexdump -C /sys/bus/nvmem/devices/logging7/nvmem
00000000  62 61 72 0a ff ff ff ff
"

Relock and write into device, fails because device is read-only again:
"

$ echo 1 > /sys/bus/nvmem/devices/logging7/force_ro
$ echo baz > /sys/bus/nvmem/devices/logging7/nvmem
bash: echo: write error: Operation not permitted
$ hexdump -C /sys/bus/nvmem/devices/logging7/nvmem
00000000  62 61 72 0a ff ff ff ff
"
---
 drivers/nvmem/core.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/nvmem/core.c +4 -0
index 311cb2e5a5c0..be28a366f603 100644
@@ -1019,6 +1019,10 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
 	if (rval)
 		goto err_remove_dev;
 
+	/* If the device has WP GPIO, default to read-only */
+	if (nvmem->wp_gpio)
+		nvmem->read_only = true;
+
 #ifdef CONFIG_NVMEM_SYSFS
 	rval = nvmem_populate_sysfs_cells(nvmem);
 	if (rval)
Signature · 1 line
2.53.0
author maintainer
#4 lore raw

PATCH 4/14 dt-bindings: nvmem: qfprom: qcom: Add Hawi compatible

In reply to [email protected]

From: Mukesh Ojha <[email protected]>

Document compatible string for the QFPROM on Hawi platform.

---
 Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml +1 -0
index aad8f5ea6fff..721c34388746 100644
@@ -20,6 +20,7 @@ properties:
           - qcom,apq8064-qfprom
           - qcom,apq8084-qfprom
           - qcom,glymur-qfprom
+          - qcom,hawi-qfprom
           - qcom,ipq5018-qfprom
           - qcom,ipq5332-qfprom
           - qcom,ipq5424-qfprom
Signature · 1 line
2.53.0
author maintainer
#5 lore raw

PATCH 5/14 nvmem: nintendo-otp: Use of_device_get_match_data()

In reply to [email protected]

From: Rosen Penev <[email protected]>

Use of_device_get_match_data() to retrieve the devtype data instead of open-coding the OF match lookup and dereferencing match->data.

This also replaces the deprecated of_device.h include with of.h.

Assisted-by Codex:GPT-5.5
---
 drivers/nvmem/nintendo-otp.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/nvmem/nintendo-otp.c +4 -5
index 355e7f1fc6d5..e45a8a3a9774 100644
@@ -17,7 +17,7 @@
 #include <linux/module.h>
 #include <linux/mod_devicetable.h>
 #include <linux/nvmem-provider.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 
 #define HW_OTPCMD  0
@@ -74,8 +74,7 @@ MODULE_DEVICE_TABLE(of, nintendo_otp_of_table);
 static int nintendo_otp_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-	const struct of_device_id *of_id =
-		of_match_device(nintendo_otp_of_table, dev);
+	const struct nintendo_otp_devtype_data *data;
 	struct nvmem_device *nvmem;
 	struct nintendo_otp_priv *priv;
 
@@ -95,8 +94,8 @@ static int nintendo_otp_probe(struct platform_device *pdev)
 	if (IS_ERR(priv->regs))
 		return PTR_ERR(priv->regs);
 
-	if (of_id->data) {
-		const struct nintendo_otp_devtype_data *data = of_id->data;
+	data = of_device_get_match_data(dev);
+	if (data) {
 		config.name = data->name;
 		config.size = data->num_banks * BANK_SIZE;
 	}
Signature · 1 line
2.53.0
author maintainer
#6 lore raw

PATCH 6/14 dt-bindings: nvmem: qfprom: Add Milos compatible

In reply to [email protected]

From: Alexander Koskovich <[email protected]>

Document compatible string for the QFPROM on Milos platform.

---
 Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml +1 -0
index 721c34388746..646a0da7e839 100644
@@ -29,6 +29,7 @@ properties:
           - qcom,ipq8074-qfprom
           - qcom,ipq9574-qfprom
           - qcom,kaanapali-qfprom
+          - qcom,milos-qfprom
           - qcom,msm8226-qfprom
           - qcom,msm8916-qfprom
           - qcom,msm8917-qfprom
Signature · 1 line
2.53.0
author maintainer
#7 lore raw

PATCH 7/14 dt-bindings: nvmem: lan9662-otpc: Add LAN969x series

In reply to [email protected]

From: Robert Marko <[email protected]>

Unlike LAN966x series which has 8K of OTP space, LAN969x series has 16K of OTP space, so document the compatible.

---
 .../devicetree/bindings/nvmem/microchip,lan9662-otpc.yaml        | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/nvmem/microchip,lan9662-otpc.yaml +1 -0
index f97c6beb4766..c03e96afe564 100644
@@ -25,6 +25,7 @@ properties:
           - const: microchip,lan9662-otpc
       - enum:
           - microchip,lan9662-otpc
+          - microchip,lan9691-otpc
 
   reg:
     maxItems: 1
Signature · 1 line
2.53.0
author maintainer
#8 lore raw

PATCH 8/14 nvmem: lan9662-otp: add support for LAN969x

In reply to [email protected]

From: Horatiu Vultur <[email protected]>

Microchip LAN969x provides OTP with the same control logic, only the size differs as LAN969x has 16KB of OTP instead of 8KB like on LAN966x.

---
 drivers/nvmem/Kconfig        |  2 +-
 drivers/nvmem/lan9662-otpc.c | 12 +++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)
drivers/nvmem/Kconfig +1 -1
index 74ddbd0f79b0..78b648e14727 100644
@@ -138,7 +138,7 @@ config NVMEM_JZ4780_EFUSE
 
 config NVMEM_LAN9662_OTPC
 	tristate "Microchip LAN9662 OTP controller support"
-	depends on SOC_LAN966 || COMPILE_TEST
+	depends on SOC_LAN966 || ARCH_LAN969X || COMPILE_TEST
 	depends on HAS_IOMEM
 	help
 	  This driver enables the OTP controller available on Microchip LAN9662
drivers/nvmem/lan9662-otpc.c +9 -3
index 56fc19f092a7..62d1d6381bf8 100644
@@ -27,7 +27,6 @@
 #define OTP_OTP_STATUS_OTP_CPUMPEN		BIT(1)
 #define OTP_OTP_STATUS_OTP_BUSY			BIT(0)
 
-#define OTP_MEM_SIZE 8192
 #define OTP_SLEEP_US 10
 #define OTP_TIMEOUT_US 500000
 
@@ -176,7 +175,6 @@ static struct nvmem_config otp_config = {
 	.word_size = 1,
 	.reg_read = lan9662_otp_read,
 	.reg_write = lan9662_otp_write,
-	.size = OTP_MEM_SIZE,
 };
 
 static int lan9662_otp_probe(struct platform_device *pdev)
@@ -196,6 +194,7 @@ static int lan9662_otp_probe(struct platform_device *pdev)
 
 	otp_config.priv = otp;
 	otp_config.dev = dev;
+	otp_config.size = (uintptr_t) device_get_match_data(dev);
 
 	nvmem = devm_nvmem_register(dev, &otp_config);
 
@@ -203,7 +202,14 @@ static int lan9662_otp_probe(struct platform_device *pdev)
 }
 
 static const struct of_device_id lan9662_otp_match[] = {
-	{ .compatible = "microchip,lan9662-otpc", },
+	{
+		.compatible = "microchip,lan9662-otpc",
+		.data = (const void *) SZ_8K,
+	},
+	{
+		.compatible = "microchip,lan9691-otpc",
+		.data = (const void *) SZ_16K,
+	},
 	{ },
 };
 MODULE_DEVICE_TABLE(of, lan9662_otp_match);
Signature · 1 line
2.53.0
author maintainer
#9 lore raw

PATCH 9/14 dt-bindings: nvmem: qcom,qfprom: Add Shikra compatible

In reply to [email protected]

From: Komal Bajaj <[email protected]>

Document compatible string for the QFPROM on Qualcomm Shikra SoC.

---
 Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml +1 -0
index 646a0da7e839..8134ddb54e13 100644
@@ -51,6 +51,7 @@ properties:
           - qcom,sdm630-qfprom
           - qcom,sdm670-qfprom
           - qcom,sdm845-qfprom
+          - qcom,shikra-qfprom
           - qcom,sm6115-qfprom
           - qcom,sm6350-qfprom
           - qcom,sm6375-qfprom
Signature · 1 line
2.53.0
author maintainer
#10 lore raw

PATCH 10/14 dt-bindings: nvmem: airoha: add SMC eFuses schema

In reply to [email protected]

From: Christian Marangi <[email protected]>

Add Airoha SMC eFuses schema to document new Airoha SoC AN7581/AN7583 way of accessing the 2 eFuse bank via the SMC command.

Each eFuse bank expose 64 eFuse cells of 32 bit used to give information on HW Revision, PHY Calibration, Device Model, Private Key and all kind of other info specific to the SoC or the running system.

---
 .../bindings/nvmem/airoha,smc-efuses.yaml     | 67 +++++++++++++++++++
 1 file changed, 67 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/nvmem/airoha,smc-efuses.yaml
Documentation/devicetree/bindings/nvmem/airoha,smc-efuses.yaml new file +67 -0
new file mode 100644
index 000000000000..c52f8d4bec39
@@ -0,0 +1,67 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/nvmem/airoha,smc-efuses.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Airoha SMC eFuses
+
+description: |
+  Airoha new SoC AN7581 expose banks of eFuse accessible
+  via specific SMC commands.
+
+  2 different bank of eFuse or 64 cells of 32 bit are exposed
+  read-only used to give information on HW Revision, PHY Calibration,
+  Device Model, Private Key...
+
+maintainers:
+  - Christian Marangi <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - airoha,an7581-efuses
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+patternProperties:
+  '^efuse-bank@[0-1]$':
+    type: object
+
+    allOf:
+      - $ref: nvmem.yaml#
+
+    properties:
+      reg:
+        description: Identify the eFuse bank.
+        enum: [0, 1]
+
+    required:
+      - reg
+
+    unevaluatedProperties: false
+
+required:
+  - compatible
+  - '#address-cells'
+  - '#size-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    efuse {
+        compatible = "airoha,an7581-efuses";
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        efuse-bank@0 {
+           reg = <0>;
+        };
+    };
+
+...
Signature · 1 line
2.53.0
author maintainer
#11 lore raw

PATCH 11/14 nvmem: airoha: Add support for SMC eFUSE

In reply to [email protected]

From: Christian Marangi <[email protected]>

Add support for SMC eFUSE on AN7581 SoC. The SoC have 2 set of 2048 bits of eFUSE that are used to read calibration value for PCIe, Thermal, USB and other specific info of the SoC like revision and HW device present.

eFuse value are taken by sending SMC command. ATF is responsible of validaing the data and rejecting reading protected data (like Private Key). In such case the SMC command will return non-zero value on a0 register.

---
 drivers/nvmem/Kconfig             |  13 ++++
 drivers/nvmem/Makefile            |   2 +
 drivers/nvmem/airoha-smc-efuses.c | 125 ++++++++++++++++++++++++++++++
 3 files changed, 140 insertions(+)
 create mode 100644 drivers/nvmem/airoha-smc-efuses.c
drivers/nvmem/Kconfig +13 -0
index 78b648e14727..77ff62d1cd01 100644
@@ -28,6 +28,19 @@ source "drivers/nvmem/layouts/Kconfig"
 
 # Devices
 
+config NVMEM_AIROHA_SMC_EFUSES
+	tristate "Airoha SMC eFuse support"
+	depends on ARCH_AIROHA || COMPILE_TEST
+	depends on HAVE_ARM_SMCCC
+	default ARCH_AIROHA
+	help
+	  Say y here to enable support for reading eFuses on Airoha AN7581
+	  SoCs. These are e.g. used to store factory programmed
+	  calibration data required for the PCIe or the USB-C PHY or Thermal.
+
+	  This driver can also be built as a module. If so, the module will
+	  be called nvmem-airoha-smc-efuses.
+
 config NVMEM_AN8855_EFUSE
 	tristate "Airoha AN8855 eFuse support"
 	depends on COMPILE_TEST
drivers/nvmem/Makefile +2 -0
index 7252b8ec88d4..f6f2bc51dee1 100644
@@ -10,6 +10,8 @@ nvmem_layouts-y			:= layouts.o
 obj-y				+= layouts/
 
 # Devices
+obj-$(CONFIG_NVMEM_AIROHA_SMC_EFUSES)	+= nvmem-airoha-smc-efuses.o
+nvmem-airoha-smc-efuses-y 		:= airoha-smc-efuses.o
 obj-$(CONFIG_NVMEM_AN8855_EFUSE)	+= nvmem-an8855-efuse.o
 nvmem-an8855-efuse-y 			:= an8855-efuse.o
 obj-$(CONFIG_NVMEM_APPLE_EFUSES)	+= nvmem-apple-efuses.o
drivers/nvmem/airoha-smc-efuses.c new file +125 -0

125 lines not on this page · raw message

Signature · 1 line
2.53.0
author maintainer
#12 lore raw

PATCH 12/14 nvmem: qcom: Unify user-visible "Qualcomm" name

In reply to [email protected]

From: Krzysztof Kozlowski <[email protected]>

Various names for Qualcomm as a company are used in user-visible config
options: QCOM, Qualcomm and Qualcomm Technologies. Switch to unified "Qualcomm" so it will be easier for users to identify the options when for example running menuconfig.

---
 drivers/nvmem/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nvmem/Kconfig +2 -2
index 77ff62d1cd01..730d71642214 100644
@@ -275,7 +275,7 @@ config NVMEM_S32G_OCOTP
 	  Programmable memory pages.
 
 config NVMEM_QCOM_QFPROM
-	tristate "QCOM QFPROM Support"
+	tristate "Qualcomm QFPROM Support"
 	depends on ARCH_QCOM || COMPILE_TEST
 	depends on HAS_IOMEM
 	help
@@ -286,7 +286,7 @@ config NVMEM_QCOM_QFPROM
 	  will be called nvmem_qfprom.
 
 config NVMEM_QCOM_SEC_QFPROM
-        tristate "QCOM SECURE QFPROM Support"
+        tristate "Qualcomm SECURE QFPROM Support"
         depends on ARCH_QCOM || COMPILE_TEST
         depends on HAS_IOMEM
         depends on OF
Signature · 1 line
2.53.0
author maintainer
#13 lore raw

PATCH 13/14 nvmem: cleanup dead code in Kconfig

In reply to [email protected]

From: Julian Braha <[email protected]>

There is already an 'if NVMEM' condition wrapping NVMEM_RCAR_EFUSE, making the 'depends on' statement a duplicate dependency (dead code).

I propose leaving the outer 'if NVMEM...endif' and removing the individual 'depends on' statement.

This dead code was found by kconfirm, a static analysis tool for Kconfig.

---
 drivers/nvmem/Kconfig | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/nvmem/Kconfig +1 -2
index 730d71642214..e10f7ff725ff 100644
@@ -316,7 +316,6 @@ config NVMEM_RAVE_SP_EEPROM
 config NVMEM_RCAR_EFUSE
 	tristate "Renesas R-Car Gen4 E-FUSE support"
 	depends on (ARCH_RENESAS && ARM64) || COMPILE_TEST
-	depends on NVMEM
 	help
 	  Enable support for reading the fuses in the E-FUSE or OTP
 	  non-volatile memory block on Renesas R-Car Gen4 SoCs.
@@ -496,4 +495,4 @@ config NVMEM_QORIQ_EFUSE
 	  This driver can also be built as a module. If so, the module
 	  will be called nvmem_qoriq_efuse.
 
-endif
+endif # NVMEM
Signature · 1 line
2.53.0
author maintainer
#14 lore raw

PATCH 14/14 nvmem: layouts: u-boot-env: check earlier for ethaddr length

In reply to [email protected]

From: Tomasz Maciej Nowak <[email protected]>

Unfortunately the ethaddr value in U-Boot environment might be enclosed in single/double quotes or be something completely different. This can make it different than MAC_ADDR_STR_LEN, which results in EINVAL returned by ethaddr post process. Move the check for length earlier, to skip post processing, so nvmem could still present ethaddr value as a string if the value doesn't match MAC_ADDR_STR_LEN.

---
 drivers/nvmem/layouts/u-boot-env.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/nvmem/layouts/u-boot-env.c +1 -4
index f27f387bb52a..33ec2350386f 100644
@@ -38,9 +38,6 @@ static int u_boot_env_read_post_process_ethaddr(void *context, const char *id, i
 {
 	u8 mac[ETH_ALEN];
 
-	if (bytes != MAC_ADDR_STR_LEN)
-		return -EINVAL;
-
 	if (!mac_pton(buf, mac))
 		return -EINVAL;
 
@@ -75,7 +72,7 @@ static int u_boot_env_parse_cells(struct device *dev, struct nvmem_device *nvmem
 		info.offset = data_offset + value - data;
 		info.bytes = strlen(value);
 		info.np = of_get_child_by_name(dev->of_node, info.name);
-		if (!strcmp(var, "ethaddr")) {
+		if (!strcmp(var, "ethaddr") && info.bytes == MAC_ADDR_STR_LEN) {
 			info.raw_len = strlen(value);
 			info.bytes = ETH_ALEN;
 			info.read_post_process = u_boot_env_read_post_process_ethaddr;
Signature · 1 line
2.53.0
maintainer
#15 lore raw
In reply to [email protected]
Quoted 14 lines · On Sat, May 30, 2026 at 09:53:19PM +0100, [email protected] wrote:

From: Srinivas Kandagatla <[email protected]>

Hi Greg,

Here are few nvmem patches for 7.2, Could you please queue these for 7.2.

Patches include
- Device tree bindings for Milos, airoha, lan9662, Shikra,
Hawi, glymur providers.
- some code cleanup in Kconfig, rockchip, nintendo providers.
- clarify default read-only behaviour for wp-gpios
- airoha new nvmem provider driver

Quoted 2 lines

Thanks,
Srini

Some reason this didn't go into 7.2? The .dts side did and now we have warnings because the bindings are missing.

Rob

author maintainer
#16 lore raw
Quoted 15 lines · Rob Herring
Quoted 14 lines · On Sat, May 30, 2026 at 09:53:19PM +0100, [email protected] wrote:

From: Srinivas Kandagatla <[email protected]>

Hi Greg,

Here are few nvmem patches for 7.2, Could you please queue these for 7.2.

Patches include
- Device tree bindings for Milos, airoha, lan9662, Shikra,
Hawi, glymur providers.
- some code cleanup in Kconfig, rockchip, nintendo providers.
- clarify default read-only behaviour for wp-gpios
- airoha new nvmem provider driver

Quoted 5 lines
Quoted 2 lines

Thanks,
Srini

Some reason this didn't go into 7.2? The .dts side did and now we have warnings because the bindings are missing.

Yes, looks like it got missed for some reason.

Greg, these patches cleanly apply on 7.2-rc1 too, could you please pick these up.

thanks,
Srini

Quoted 2 lines

Rob

#17 lore raw
Quoted 21 lines · Srinivas Kandagatla
Quoted 18 lines · Rob Herring
Quoted 16 lines · On Sat, May 30, 2026 at 09:53:19PM +0100, [email protected] wrote:

From: Srinivas Kandagatla <[email protected]>

Hi Greg,

Here are few nvmem patches for 7.2, Could you please queue these for 7.2.

Patches include
- Device tree bindings for Milos, airoha, lan9662, Shikra,
Hawi, glymur providers.
- some code cleanup in Kconfig, rockchip, nintendo providers.
- clarify default read-only behaviour for wp-gpios
- airoha new nvmem provider driver

Thanks,
Srini

Quoted 7 lines
Quoted 2 lines

Some reason this didn't go into 7.2? The .dts side did and now we have warnings because the bindings are missing.

Yes, looks like it got missed for some reason.

Greg, these patches cleanly apply on 7.2-rc1 too, could you please pick these up.

Now applied, sorry for the delay.

greg k-h