Skip to contentSkip to conversation

Driver for the Apple SPMI controller

PATCH Applied Sasha Finkelstein 4 participants 8 messages Apr 9, 2025 – Apr 15, 2025

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

v4 cover Driver for the Apple SPMI controller

Hi.

This patch series adds support for the SPMI controller persent in most Apple SoCs. The drivers for the attached PMU and subdevices will be in further patch series.

---
Changes in v4:
- Rebase on 6.14
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Inlined helpers, dropped unneccesary error prefixes
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Removed redundant error prints
- Various style fixes
- Better explanation of why the driver is needed
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Jean-Francois Bortolotti (1):
spmi: add a spmi driver for Apple SoC

Sasha Finkelstein (2):
dt-bindings: spmi: Add Apple SPMI controller
arm64: dts: apple: Add SPMI controller nodes

 .../devicetree/bindings/spmi/apple,spmi.yaml       |  49 ++++++
 MAINTAINERS                                        |   2 +
 arch/arm64/boot/dts/apple/t600x-die0.dtsi          |   7 +
 arch/arm64/boot/dts/apple/t8103.dtsi               |   8 +
 arch/arm64/boot/dts/apple/t8112.dtsi               |   7 +
 drivers/spmi/Kconfig                               |   8 +
 drivers/spmi/Makefile                              |   1 +
 drivers/spmi/spmi-apple-controller.c               | 168 +++++++++++++++++++++
 8 files changed, 250 insertions(+)

---
base-commit: a24588245776dafc227243a01bfbeb8a59bafba9
change-id: 20250304-spmi-6d3c24b9027a

Best regards,

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

PATCH v4 1/3 dt-bindings: spmi: Add Apple SPMI controller

Add bindings for the SPMI controller present on most Apple SoCs

---
 .../devicetree/bindings/spmi/apple,spmi.yaml       | 49 ++++++++++++++++++++++
 MAINTAINERS                                        |  1 +
 2 files changed, 50 insertions(+)
Documentation/devicetree/bindings/spmi/apple,spmi.yaml new file +49 -0
new file mode 100644
index 0000000000000000000000000000000000000000..16bd7eb2b7af2c0b176f0e5b1970f4670af691da
@@ -0,0 +1,49 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/spmi/apple,spmi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Apple SPMI controller
+
+maintainers:
+  - Sasha Finkelstein <[email protected]>
+
+description: A SPMI controller present on most Apple SoCs
+
+allOf:
+  - $ref: spmi.yaml#
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - apple,t8103-spmi
+          - apple,t6000-spmi
+          - apple,t8112-spmi
+      - const: apple,spmi
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/spmi/spmi.h>
+
+    spmi@920a1300 {
+        compatible = "apple,t6000-spmi", "apple,spmi";
+        reg = <0x920a1300 0x100>;
+        #address-cells = <2>;
+        #size-cells = <0>;
+
+        pmic@f {
+            reg = <0xf SPMI_USID>;
+            /* PMIC-specific properties */
+        };
+    };
MAINTAINERS +1 -0
index 96b82704950184bd71623ff41fc4df31e4c7fe87..5f348736ea0bbdb83fe541c872103ce4835de40b 100644
@@ -2282,6 +2282,7 @@ F:	Documentation/devicetree/bindings/pinctrl/apple,pinctrl.yaml
 F:	Documentation/devicetree/bindings/power/apple*
 F:	Documentation/devicetree/bindings/pwm/apple,s5l-fpwm.yaml
 F:	Documentation/devicetree/bindings/spi/apple,spi.yaml
+F:	Documentation/devicetree/bindings/spmi/apple,spmi.yaml
 F:	Documentation/devicetree/bindings/watchdog/apple,wdt.yaml
 F:	arch/arm64/boot/dts/apple/
 F:	drivers/bluetooth/hci_bcm4377.c
Signature · 1 line
2.49.0
#3 lore raw

PATCH v4 2/3 spmi: add a spmi driver for Apple SoC

In reply to Sasha Finkelstein

From: Jean-Francois Bortolotti <[email protected]>

The connected PMU contains several useful nvmem cells such as RTC offset, boot failure counters, reboot/shutdown selector, and a few others. In addition M3+ machines have their USB-PD controller connected via SPMI.

---
 MAINTAINERS                          |   1 +
 drivers/spmi/Kconfig                 |   8 ++
 drivers/spmi/Makefile                |   1 +
 drivers/spmi/spmi-apple-controller.c | 168 +++++++++++++++++++++++++++++++++++
 4 files changed, 178 insertions(+)
MAINTAINERS +1 -0
index 5f348736ea0bbdb83fe541c872103ce4835de40b..2bf1c547bd0ab366b343260a93f04d4a9df7e078 100644
@@ -2302,6 +2302,7 @@ F:	drivers/pinctrl/pinctrl-apple-gpio.c
 F:	drivers/pwm/pwm-apple.c
 F:	drivers/soc/apple/*
 F:	drivers/spi/spi-apple.c
+F:	drivers/spmi/spmi-apple-controller.c
 F:	drivers/video/backlight/apple_dwi_bl.c
 F:	drivers/watchdog/apple_wdt.c
 F:	include/dt-bindings/interrupt-controller/apple-aic.h
drivers/spmi/Kconfig +8 -0
index 73780204631463631cabcbad5bf83e8dbbee94ce..9005fa91d9f4e541403ccc7bf84e0592402ac41e 100644
@@ -11,6 +11,14 @@ menuconfig SPMI
 
 if SPMI
 
+config SPMI_APPLE
+	tristate "Apple SoC SPMI Controller platform driver"
+	depends on ARCH_APPLE || COMPILE_TEST
+	help
+	  If you say yes to this option, support will be included for the
+	  SPMI controller present on many Apple SoCs, including the
+	  t8103 (M1) and t600x (M1 Pro/Max).
+
 config SPMI_HISI3670
 	tristate "Hisilicon 3670 SPMI Controller"
 	select IRQ_DOMAIN_HIERARCHY
drivers/spmi/Makefile +1 -0
index 7f152167bb05b2c24a0f9669f60278152898eebb..38ac635645ba65aa46cb5e8a50072ed9771e229b 100644
@@ -4,6 +4,7 @@
 #
 obj-$(CONFIG_SPMI)	+= spmi.o spmi-devres.o
 
+obj-$(CONFIG_SPMI_APPLE)	+= spmi-apple-controller.o
 obj-$(CONFIG_SPMI_HISI3670)	+= hisi-spmi-controller.o
 obj-$(CONFIG_SPMI_MSM_PMIC_ARB)	+= spmi-pmic-arb.o
 obj-$(CONFIG_SPMI_MTK_PMIF)	+= spmi-mtk-pmif.o
drivers/spmi/spmi-apple-controller.c new file +168 -0

168 lines not on this page · raw message

Signature · 1 line
2.49.0
maintainer Applied
#4 lore raw

Re: [PATCH v4 2/3] spmi: add a spmi driver for Apple SoC

Quoting Sasha Finkelstein via B4 Relay (2025-04-09 14:52:13)

Quoted 6 lines

From: Jean-Francois Bortolotti <[email protected]>

The connected PMU contains several useful nvmem cells such as RTC offset, boot failure counters, reboot/shutdown selector, and a few others. In addition M3+ machines have their USB-PD controller connected via SPMI.

Quoted 6 lines

---

Applied to spmi-next

#5 lore raw

PATCH v4 3/3 arm64: dts: apple: Add SPMI controller nodes

In reply to Sasha Finkelstein

Add device tree entries for the SPMI controller

---
 arch/arm64/boot/dts/apple/t600x-die0.dtsi | 7 +++++++
 arch/arm64/boot/dts/apple/t8103.dtsi      | 8 ++++++++
 arch/arm64/boot/dts/apple/t8112.dtsi      | 7 +++++++
 3 files changed, 22 insertions(+)
arch/arm64/boot/dts/apple/t600x-die0.dtsi +7 -0
index e9b3140ba1a996eeb91b3f60470833060b632bd2..4c224e686ffe5602329f7f394d3354559c4130ab 100644
@@ -45,6 +45,13 @@ pinctrl_smc: pinctrl@290820000 {
 				<AIC_IRQ 0 749 IRQ_TYPE_LEVEL_HIGH>;
 	};
 
+	nub_spmi0: spmi@2920a1300 {
+		compatible = "apple,t6000-spmi", "apple,spmi";
+		reg = <0x2 0x920a1300 0x0 0x100>;
+		#address-cells = <2>;
+		#size-cells = <0>;
+	};
+
 	wdt: watchdog@2922b0000 {
 		compatible = "apple,t6000-wdt", "apple,wdt";
 		reg = <0x2 0x922b0000 0x0 0x4000>;
arch/arm64/boot/dts/apple/t8103.dtsi +8 -0
index 97b6a067394e311ed19392a34237c74936dbb7d7..bdb1cb9e406a441e458b1c735359b0148146e91b 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>
 
 / {
 	compatible = "apple,t8103", "apple,arm-platform";
@@ -741,6 +742,13 @@ pcie_pins: pcie-pins {
 			};
 		};
 
+		nub_spmi: spmi@23d0d9300 {
+			compatible = "apple,t8103-spmi", "apple,spmi";
+			reg = <0x2 0x3d0d9300 0x0 0x100>;
+			#address-cells = <2>;
+			#size-cells = <0>;
+		};
+
 		pinctrl_nub: pinctrl@23d1f0000 {
 			compatible = "apple,t8103-pinctrl", "apple,pinctrl";
 			reg = <0x2 0x3d1f0000 0x0 0x4000>;
arch/arm64/boot/dts/apple/t8112.dtsi +7 -0
index d9b966d68e4fae2dfb21d6fb7a97ebba81643ae8..950d1f906ba3023c1d118179207a2099345aae94 100644
@@ -782,6 +782,13 @@ wdt: watchdog@23d2b0000 {
 			interrupts = <AIC_IRQ 379 IRQ_TYPE_LEVEL_HIGH>;
 		};
 
+		nub_spmi: spmi@23d714000 {
+			compatible = "apple,t8112-spmi", "apple,spmi";
+			reg = <0x2 0x3d714000 0x0 0x100>;
+			#address-cells = <2>;
+			#size-cells = <0>;
+		};
+
 		pinctrl_smc: pinctrl@23e820000 {
 			compatible = "apple,t8112-pinctrl", "apple,pinctrl";
 			reg = <0x2 0x3e820000 0x0 0x4000>;
Signature · 1 line
2.49.0
reviewer Reviewed-by on the v4 series
#6 lore raw
In reply to Sasha Finkelstein
Quoted 40 lines · On Wed, Apr 9, 2025 at 5:52 PM Sasha Finkelstein via B4 Relay…

Hi.

This patch series adds support for the SPMI controller persent in most Apple SoCs. The drivers for the attached PMU and subdevices will be in further patch series.

---
Changes in v4:
- Rebase on 6.14
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Inlined helpers, dropped unneccesary error prefixes
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Removed redundant error prints
- Various style fixes
- Better explanation of why the driver is needed
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Jean-Francois Bortolotti (1):
spmi: add a spmi driver for Apple SoC

Sasha Finkelstein (2):
dt-bindings: spmi: Add Apple SPMI controller
arm64: dts: apple: Add SPMI controller nodes

 .../devicetree/bindings/spmi/apple,spmi.yaml       |  49 ++++++
 MAINTAINERS                                        |   2 +
 arch/arm64/boot/dts/apple/t600x-die0.dtsi          |   7 +
 arch/arm64/boot/dts/apple/t8103.dtsi               |   8 +
 arch/arm64/boot/dts/apple/t8112.dtsi               |   7 +
 drivers/spmi/Kconfig                               |   8 +
 drivers/spmi/Makefile                              |   1 +
 drivers/spmi/spmi-apple-controller.c               | 168 +++++++++++++++++++++
 8 files changed, 250 insertions(+)
Quoted 4 lines

---
base-commit: a24588245776dafc227243a01bfbeb8a59bafba9
change-id: 20250304-spmi-6d3c24b9027a

Series LGTM.

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

Re: (subset) [PATCH v4 0/3] Driver for the Apple SPMI controller

In reply to Sasha Finkelstein
Quoted 5 lines · Sasha Finkelstein

This patch series adds support for the SPMI controller persent in most Apple SoCs. The drivers for the attached PMU and subdevices will be in further patch series.

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

[3/3] arm64: dts: apple: Add SPMI controller nodes

      https://github.com/AsahiLinux/linux/commit/2e0e70c95077

Best regards,

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