Skip to contentSkip to conversation

nvmem: patches (set 1) for 6.16

PATCH New [email protected] 1 participant 4 messages May 9, 2025

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

cover nvmem: patches (set 1) for 6.16

From: Srinivas Kandagatla <[email protected]>

Hi Greg,

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

patche include
- cleanup of unused cell table support
- add support for apple spmi nvmem provider.

Thanks,
Srini

Geert Uytterhoeven (1):
nvmem: Remove unused nvmem cell table support

Hector Martin (1):
nvmem: Add apple-spmi-nvmem driver

Sasha Finkelstein (1):
dt-bindings: spmi: Add Apple SPMI NVMEM

 .../bindings/nvmem/apple,spmi-nvmem.yaml      | 54 +++++++++++++++
 Documentation/driver-api/nvmem.rst            | 14 ++--
 MAINTAINERS                                   |  2 +
 drivers/nvmem/Kconfig                         | 13 ++++
 drivers/nvmem/Makefile                        |  2 +
 drivers/nvmem/apple-spmi-nvmem.c              | 62 +++++++++++++++++
 drivers/nvmem/core.c                          | 68 -------------------
 include/linux/nvmem-provider.h                | 24 -------
 8 files changed, 137 insertions(+), 102 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/nvmem/apple,spmi-nvmem.yaml
 create mode 100644 drivers/nvmem/apple-spmi-nvmem.c
Signature · 1 line
2.43.0
author maintainer
#1 lore raw

PATCH 1/3 nvmem: Remove unused nvmem cell table support

From: Geert Uytterhoeven <[email protected]>

Board files are deprecated by DT, and the last user of nvmem_add_cell_table() was removed by commit 2af4fcc0d3574482 ("ARM:
davinci: remove unused board support") in v6.3. Hence remove all support for nvmem cell tables, and update the documentation.

Device drivers can still register a single cell using nvmem_add_one_cell() (which was not documented before).

---
 Documentation/driver-api/nvmem.rst | 14 ++----
 drivers/nvmem/core.c               | 68 ------------------------------
 include/linux/nvmem-provider.h     | 24 -----------
 3 files changed, 4 insertions(+), 102 deletions(-)
Documentation/driver-api/nvmem.rst +4 -10
index 5d9500d21ecc..790e2dc652c0 100644
@@ -59,10 +59,10 @@ For example, a simple nvram case::
 	devm_nvmem_register(&config);
   }
 
-Users of board files can define and register nvmem cells using the
-nvmem_cell_table struct::
+Device drivers can define and register an nvmem cell using the nvmem_cell_info
+struct::
 
-  static struct nvmem_cell_info foo_nvmem_cells[] = {
+  static const struct nvmem_cell_info foo_nvmem_cell = {
 	{
 		.name		= "macaddr",
 		.offset		= 0x7f00,
@@ -70,13 +70,7 @@ nvmem_cell_table struct::
 	}
   };
 
-  static struct nvmem_cell_table foo_nvmem_cell_table = {
-	.nvmem_name		= "i2c-eeprom",
-	.cells			= foo_nvmem_cells,
-	.ncells			= ARRAY_SIZE(foo_nvmem_cells),
-  };
-
-  nvmem_add_cell_table(&foo_nvmem_cell_table);
+  int nvmem_add_one_cell(nvmem, &foo_nvmem_cell);
 
 Additionally it is possible to create nvmem cell lookup entries and register
 them with the nvmem framework from machine code as shown in the example below::
drivers/nvmem/core.c +0 -68

92 lines not on this page · raw message

include/linux/nvmem-provider.h +0 -24
index 515676ebe598..615a560d9edb 100644
@@ -137,25 +137,6 @@ struct nvmem_config {
 	struct device		*base_dev;
 };
 
-/**
- * struct nvmem_cell_table - NVMEM cell definitions for given provider
- *
- * @nvmem_name:		Provider name.
- * @cells:		Array of cell definitions.
- * @ncells:		Number of cell definitions in the array.
- * @node:		List node.
- *
- * This structure together with related helper functions is provided for users
- * that don't can't access the nvmem provided structure but wish to register
- * cell definitions for it e.g. board files registering an EEPROM device.
- */
-struct nvmem_cell_table {
-	const char		*nvmem_name;
-	const struct nvmem_cell_info	*cells;
-	size_t			ncells;
-	struct list_head	node;
-};
-
 /**
  * struct nvmem_layout - NVMEM layout definitions
  *
@@ -190,9 +171,6 @@ void nvmem_unregister(struct nvmem_device *nvmem);
 struct nvmem_device *devm_nvmem_register(struct device *dev,
 					 const struct nvmem_config *cfg);
 
-void nvmem_add_cell_table(struct nvmem_cell_table *table);
-void nvmem_del_cell_table(struct nvmem_cell_table *table);
-
 int nvmem_add_one_cell(struct nvmem_device *nvmem,
 		       const struct nvmem_cell_info *info);
 
@@ -223,8 +201,6 @@ devm_nvmem_register(struct device *dev, const struct nvmem_config *c)
 	return nvmem_register(c);
 }
 
-static inline void nvmem_add_cell_table(struct nvmem_cell_table *table) {}
-static inline void nvmem_del_cell_table(struct nvmem_cell_table *table) {}
 static inline int nvmem_add_one_cell(struct nvmem_device *nvmem,
 				     const struct nvmem_cell_info *info)
 {
Signature · 1 line
2.43.0
author maintainer
#2 lore raw

PATCH 2/3 dt-bindings: spmi: Add Apple SPMI NVMEM

In reply to [email protected]

From: Sasha Finkelstein <[email protected]>

Add bindings for exposing SPMI registers of Apple PMICs as NVMEM cells

---
 .../bindings/nvmem/apple,spmi-nvmem.yaml      | 54 +++++++++++++++++++
 MAINTAINERS                                   |  1 +
 2 files changed, 55 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/nvmem/apple,spmi-nvmem.yaml
Documentation/devicetree/bindings/nvmem/apple,spmi-nvmem.yaml new file +54 -0
new file mode 100644
index 000000000000..80b5a6cdcec9
@@ -0,0 +1,54 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/nvmem/apple,spmi-nvmem.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Apple SPMI NVMEM
+
+description: Exports a series of SPMI registers as NVMEM cells
+
+maintainers:
+  - Sasha Finkelstein <[email protected]>
+
+allOf:
+  - $ref: nvmem.yaml#
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - apple,maverick-pmic
+          - apple,sera-pmic
+          - apple,stowe-pmic
+      - const: apple,spmi-nvmem
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/spmi/spmi.h>
+
+    pmic@f {
+        compatible = "apple,maverick-pmic", "apple,spmi-nvmem";
+        reg = <0xf SPMI_USID>;
+
+        nvmem-layout {
+            compatible = "fixed-layout";
+            #address-cells = <1>;
+            #size-cells = <1>;
+
+            boot_stage: boot-stage@6001 {
+                reg = <0x6001 0x1>;
+            };
+        };
+    };
+
+...
MAINTAINERS +1 -0
index 3cbf9ac0d83f..9936fa9fe87c 100644
@@ -2277,6 +2277,7 @@ F:	Documentation/devicetree/bindings/mailbox/apple,mailbox.yaml
 F:	Documentation/devicetree/bindings/net/bluetooth/brcm,bcm4377-bluetooth.yaml
 F:	Documentation/devicetree/bindings/nvme/apple,nvme-ans.yaml
 F:	Documentation/devicetree/bindings/nvmem/apple,efuses.yaml
+F:	Documentation/devicetree/bindings/nvmem/apple,spmi-nvmem.yaml
 F:	Documentation/devicetree/bindings/pci/apple,pcie.yaml
 F:	Documentation/devicetree/bindings/pinctrl/apple,pinctrl.yaml
 F:	Documentation/devicetree/bindings/power/apple*
Signature · 1 line
2.43.0
author maintainer
#3 lore raw

PATCH 3/3 nvmem: Add apple-spmi-nvmem driver

In reply to [email protected]

From: Hector Martin <[email protected]>

Add a driver for a series of SPMI-attached PMICs present on Apple devices

---
 MAINTAINERS                      |  1 +
 drivers/nvmem/Kconfig            | 13 +++++++
 drivers/nvmem/Makefile           |  2 ++
 drivers/nvmem/apple-spmi-nvmem.c | 62 ++++++++++++++++++++++++++++++++
 4 files changed, 78 insertions(+)
 create mode 100644 drivers/nvmem/apple-spmi-nvmem.c
MAINTAINERS +1 -0
index 9936fa9fe87c..65abe712170d 100644
@@ -2298,6 +2298,7 @@ F:	drivers/iommu/io-pgtable-dart.c
 F:	drivers/irqchip/irq-apple-aic.c
 F:	drivers/nvme/host/apple.c
 F:	drivers/nvmem/apple-efuses.c
+F:	drivers/nvmem/apple-spmi-nvmem.c
 F:	drivers/pinctrl/pinctrl-apple-gpio.c
 F:	drivers/pwm/pwm-apple.c
 F:	drivers/soc/apple/*
drivers/nvmem/Kconfig +13 -0
index 8671b7c974b9..ae4afbd8293c 100644
@@ -40,6 +40,19 @@ config NVMEM_APPLE_EFUSES
 	  This driver can also be built as a module. If so, the module will
 	  be called nvmem-apple-efuses.
 
+config NVMEM_APPLE_SPMI
+	tristate "Apple SPMI NVMEM"
+	depends on ARCH_APPLE || COMPILE_TEST
+	depends on SPMI
+	select REGMAP_SPMI
+	help
+	  Say y here to build a driver to expose NVMEM cells for a set of power
+	  and RTC-related settings on a SPMI-attached PMIC present on Apple
+	  devices, such as Apple Silicon Macs.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called apple-nvmem-spmi.
+
 config NVMEM_BCM_OCOTP
 	tristate "Broadcom On-Chip OTP Controller support"
 	depends on ARCH_BCM_IPROC || COMPILE_TEST
drivers/nvmem/Makefile +2 -0
index 5b77bbb6488b..89a3c252c2c8 100644
@@ -12,6 +12,8 @@ obj-y				+= layouts/
 # Devices
 obj-$(CONFIG_NVMEM_APPLE_EFUSES)	+= nvmem-apple-efuses.o
 nvmem-apple-efuses-y 			:= apple-efuses.o
+obj-$(CONFIG_NVMEM_APPLE_SPMI)		+= apple_nvmem_spmi.o
+apple_nvmem_spmi-y			:= apple-spmi-nvmem.o
 obj-$(CONFIG_NVMEM_BCM_OCOTP)		+= nvmem-bcm-ocotp.o
 nvmem-bcm-ocotp-y			:= bcm-ocotp.o
 obj-$(CONFIG_NVMEM_BRCM_NVRAM)		+= nvmem_brcm_nvram.o
drivers/nvmem/apple-spmi-nvmem.c new file +62 -0

62 lines not on this page · raw message

Signature · 1 line
2.43.0