Skip to contentSkip to conversation

Apple PMIC NVMEM cell driver (Formerly: Generic SPMI NVMEM cell driver)

PATCH Applied Sasha Finkelstein 5 participants 8 messages Apr 23, 2025 – May 1, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v3 cover Apple PMIC NVMEM cell driver (Formerly: Generic SPMI NVMEM cell driver)

Hi.

This patch series adds a driver for exposing a set of registers as NVMEM cells on a SPMI-attached PMIC on Apple ARM platforms. Those are used to store the RTC offset and to communicate platform power state between the OS and boot firmware.

The NVMEM cell consumer drivers will be sent in a further series.

---
Changes in v3:
- No longer try to make it generic, use for the 3 relevant PMICs only
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- s/pmu/pmic/
- Sort dts in unit-order, instead of t600x-unit-order
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Hector Martin (2):
nvmem: Add apple-spmi-nvmem driver
arm64: dts: apple: Add PMIC NVMEM

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

 .../bindings/nvmem/apple,spmi-nvmem.yaml           | 54 +++++++++++++++++++
 MAINTAINERS                                        |  2 +
 arch/arm64/boot/dts/apple/t6001.dtsi               |  1 +
 arch/arm64/boot/dts/apple/t6002.dtsi               |  1 +
 arch/arm64/boot/dts/apple/t600x-die0.dtsi          | 50 +++++++++++++++++
 arch/arm64/boot/dts/apple/t8103.dtsi               | 50 +++++++++++++++++
 arch/arm64/boot/dts/apple/t8112.dtsi               | 50 +++++++++++++++++
 drivers/nvmem/Kconfig                              | 13 +++++
 drivers/nvmem/Makefile                             |  2 +
 drivers/nvmem/apple-spmi-nvmem.c                   | 62 ++++++++++++++++++++++
 10 files changed, 285 insertions(+)

---
base-commit: 2e0e70c95077172b29a5b13716c4b159d578e82c
change-id: 20250415-spmi-nvmem-e08635316175

Best regards,

Signature · 1 line
Sasha Finkelstein <[email protected]>
#1 lore raw

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

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(+)
Documentation/devicetree/bindings/nvmem/apple,spmi-nvmem.yaml new file +54 -0
new file mode 100644
index 0000000000000000000000000000000000000000..80b5a6cdcec91c8eed8b66f745e91ee07ba9683d
@@ -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 96b82704950184bd71623ff41fc4df31e4c7fe87..f462545c54c55d4bdc22651e07a4c8e155e83016 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.49.0
maintainer Reviewed-by on v3 1/3
#2 lore raw

Re: [PATCH v3 1/3] dt-bindings: spmi: Add Apple SPMI NVMEM

Quoted 9 lines · Sasha Finkelstein

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(+)
#3 lore raw

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

In reply to Sasha Finkelstein

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(+)
MAINTAINERS +1 -0
index f462545c54c55d4bdc22651e07a4c8e155e83016..c9f5ac1eb2458a0206ffe0767cc6ed129172e78f 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 8671b7c974b933e147154bb40b5d41b5730518d2..ae4afbd8293c64ea0a3a632c7172f5496545b12c 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 5b77bbb6488bf89bfb305750a1cbf4a6731a0a58..89a3c252c2c8dad9ed7bc6ac9841f63ff85c00d5 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.49.0
#4 lore raw

PATCH v3 3/3 arm64: dts: apple: Add PMIC NVMEM

In reply to Sasha Finkelstein

From: Hector Martin <[email protected]>

Add device tree entries for NVMEM cells present on the PMIC

---
 arch/arm64/boot/dts/apple/t6001.dtsi      |  1 +
 arch/arm64/boot/dts/apple/t6002.dtsi      |  1 +
 arch/arm64/boot/dts/apple/t600x-die0.dtsi | 50 +++++++++++++++++++++++++++++++
 arch/arm64/boot/dts/apple/t8103.dtsi      | 50 +++++++++++++++++++++++++++++++
 arch/arm64/boot/dts/apple/t8112.dtsi      | 50 +++++++++++++++++++++++++++++++
 5 files changed, 152 insertions(+)
arch/arm64/boot/dts/apple/t6001.dtsi +1 -0
index 620b17e4031f069874aaabadbf06b7b29ec4031e..d2cf81926f284ccf7627701cc82edff31d4d72d6 100644
@@ -11,6 +11,7 @@
 #include <dt-bindings/interrupt-controller/apple-aic.h>
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/pinctrl/apple.h>
+#include <dt-bindings/spmi/spmi.h>
 
 #include "multi-die-cpp.h"
 
arch/arm64/boot/dts/apple/t6002.dtsi +1 -0
index a963a5011799a0480f88688fb4372a31f0bbf806..e36f422d257d8fe3a62bfa6e0f0e0dc6c34608a4 100644
@@ -11,6 +11,7 @@
 #include <dt-bindings/interrupt-controller/apple-aic.h>
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/pinctrl/apple.h>
+#include <dt-bindings/spmi/spmi.h>
 
 #include "multi-die-cpp.h"
 
arch/arm64/boot/dts/apple/t600x-die0.dtsi +50 -0

56 lines not on this page · raw message

arch/arm64/boot/dts/apple/t8103.dtsi +50 -0

56 lines not on this page · raw message

arch/arm64/boot/dts/apple/t8112.dtsi +50 -0

56 lines not on this page · raw message

Signature · 1 line
2.49.0
reviewer Reviewed-by on the v3 series
#5 lore raw
In reply to Sasha Finkelstein
Quoted 40 lines · On Wed, Apr 23, 2025 at 1:55 PM Sasha Finkelstein via B4 Relay…

Hi.

This patch series adds a driver for exposing a set of registers as NVMEM cells on a SPMI-attached PMIC on Apple ARM platforms. Those are used to store the RTC offset and to communicate platform power state between the OS and boot firmware.

The NVMEM cell consumer drivers will be sent in a further series.

---
Changes in v3:
- No longer try to make it generic, use for the 3 relevant PMICs only
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- s/pmu/pmic/
- Sort dts in unit-order, instead of t600x-unit-order
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Hector Martin (2):
nvmem: Add apple-spmi-nvmem driver
arm64: dts: apple: Add PMIC NVMEM

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

 .../bindings/nvmem/apple,spmi-nvmem.yaml           | 54 +++++++++++++++++++
 MAINTAINERS                                        |  2 +
 arch/arm64/boot/dts/apple/t6001.dtsi               |  1 +
 arch/arm64/boot/dts/apple/t6002.dtsi               |  1 +
 arch/arm64/boot/dts/apple/t600x-die0.dtsi          | 50 +++++++++++++++++
 arch/arm64/boot/dts/apple/t8103.dtsi               | 50 +++++++++++++++++
 arch/arm64/boot/dts/apple/t8112.dtsi               | 50 +++++++++++++++++
 drivers/nvmem/Kconfig                              | 13 +++++
 drivers/nvmem/Makefile                             |  2 +
 drivers/nvmem/apple-spmi-nvmem.c                   | 62 ++++++++++++++++++++++
 10 files changed, 285 insertions(+)
Quoted 4 lines

---
base-commit: 2e0e70c95077172b29a5b13716c4b159d578e82c
change-id: 20250415-spmi-nvmem-e08635316175

Series LGTM.

Signature · 1 line
真実はいつも一つ!/ Always, there's only one truth!
maintainer Applied
#6 lore raw

Re: (subset) [PATCH v3 0/3] Apple PMIC NVMEM cell driver (Formerly: Generic SPMI NVMEM cell driver)

In reply to Sasha Finkelstein
Quoted 8 lines · Sasha Finkelstein

This patch series adds a driver for exposing a set of registers as NVMEM cells on a SPMI-attached PMIC on Apple ARM platforms. Those are used to store the RTC offset and to communicate platform power state between the OS and boot firmware.

The NVMEM cell consumer drivers will be sent in a further series.

[...]

Applied, thanks!

[1/3] dt-bindings: spmi: Add Apple SPMI NVMEM

      commit: 342ad99689be22776c50ab5d82064b700e516a98
[2/3] nvmem: Add apple-spmi-nvmem driver
      commit: 8d2900cc141122ad3a754d6d86cd15a9a4bf0b74

Best regards,

Signature · 1 line
Srinivas Kandagatla <[email protected]>
Applied
#7 lore raw

Re: (subset) [PATCH v3 0/3] Apple PMIC NVMEM cell driver (Formerly: Generic SPMI NVMEM cell driver)

In reply to Sasha Finkelstein
Quoted 8 lines · Sasha Finkelstein

This patch series adds a driver for exposing a set of registers as NVMEM cells on a SPMI-attached PMIC on Apple ARM platforms. Those are used to store the RTC offset and to communicate platform power state between the OS and boot firmware.

The NVMEM cell consumer drivers will be sent in a further series.

[...]

Applied to [email protected]:AsahiLinux/linux.git (asahi-soc/dt), thanks!

[3/3] arm64: dts: apple: Add PMIC NVMEM

      https://github.com/AsahiLinux/linux/commit/d8bf82081c9e

Best regards,

Signature · 1 line
Sven Peter <[email protected]>