Skip to contentSkip to conversation

Add DTs for all Apple M1 (t8103) devices

PATCH Superseded Janne Grunau 2 participants 5 messages Nov 21, 2021

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Janne Grunau

author maintainer
#0 lore raw

v2 cover Add DTs for all Apple M1 (t8103) devices

Hej All,

this series extends the device tree files and bindings to all current Apple M1 devices. Specifically it adds DTs for following devices:
- MacBook Air (M1, 2020)
- Macbook Pro (13-inch, M1, 2020)
- iMac (24-inch, M1, 2021)

It also adds i2c and cd321x devices nodes those support was merged for 5.16 without adding devices to the device tree. [PATCH 3/3] is included in this series since it depends on PATCH 2/3.

Changes since v1:
- fixed the nit pointed out in the bindings change
- add Reviewed-By
- adds [PATCH 3/3] arm64: dts: apple: t8103: Add i2c and cd321x nodes

For [PATCH 3/3] depends for functionality and dtbs verification on "[PATCH 0/3] Apple Arm patform device tree and bindings fixes".

thanks,
Janne

The series is available as branch from:

    https://github.com/jannau/linux/tree/apple_m1/dt-for-5.17

Janne Grunau (3):
dt-bindings: arm: apple: Add iMac (24-inch 2021) to Apple bindings
arm64: dts: apple: Add missing M1 (t8103) devices
arm64: dts: apple: t8103: Add i2c and cd321x nodes

 .../devicetree/bindings/arm/apple.yaml        |  6 +-
 arch/arm64/boot/dts/apple/Makefile            |  4 +
 arch/arm64/boot/dts/apple/t8103-j274.dts      | 33 ++-------
 arch/arm64/boot/dts/apple/t8103-j293.dts      | 37 ++++++++++
 arch/arm64/boot/dts/apple/t8103-j313.dts      | 33 +++++++++
 arch/arm64/boot/dts/apple/t8103-j456.dts      | 41 +++++++++++
 arch/arm64/boot/dts/apple/t8103-j457.dts      | 47 ++++++++++++
 arch/arm64/boot/dts/apple/t8103-jxxx.dtsi     | 67 +++++++++++++++++
 arch/arm64/boot/dts/apple/t8103.dtsi          | 73 +++++++++++++++++++
 9 files changed, 311 insertions(+), 30 deletions(-)
 create mode 100644 arch/arm64/boot/dts/apple/t8103-j293.dts
 create mode 100644 arch/arm64/boot/dts/apple/t8103-j313.dts
 create mode 100644 arch/arm64/boot/dts/apple/t8103-j456.dts
 create mode 100644 arch/arm64/boot/dts/apple/t8103-j457.dts
 create mode 100644 arch/arm64/boot/dts/apple/t8103-jxxx.dtsi
Signature · 1 line
2.34.0
author maintainer
#1 lore raw

PATCH v2 1/3 dt-bindings: arm: apple: Add iMac (24-inch 2021) to Apple bindings

This introduces compatible strings for both 2021 Apple iMac M1 devices:

* apple,j456 - iMac (24-inch, 4x USB-C, M1, 2021)
* apple,j457 - iMac (24-inch, 2x USB-C, M1, 2021)

---
 Documentation/devicetree/bindings/arm/apple.yaml | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/arm/apple.yaml +4 -2
index 1e772c85206c..b23c8dc5a27d 100644
@@ -12,12 +12,12 @@ maintainers:
 description: |
   ARM platforms using SoCs designed by Apple Inc., branded "Apple Silicon".
 
-  This currently includes devices based on the "M1" SoC, starting with the
-  three Mac models released in late 2020:
+  This currently includes devices based on the "M1" SoC:
 
   - Mac mini (M1, 2020)
   - MacBook Pro (13-inch, M1, 2020)
   - MacBook Air (M1, 2020)
+  - iMac (24-inch, M1, 2021)
 
   The compatible property should follow this format:
 
@@ -56,6 +56,8 @@ properties:
               - apple,j274 # Mac mini (M1, 2020)
               - apple,j293 # MacBook Pro (13-inch, M1, 2020)
               - apple,j313 # MacBook Air (M1, 2020)
+              - apple,j456 # iMac (24-inch, 4x USB-C, M1, 2021)
+              - apple,j457 # iMac (24-inch, 2x USB-C, M1, 2021)
           - const: apple,t8103
           - const: apple,arm-platform
 
Signature · 1 line
2.34.0
author maintainer
#2 lore raw

PATCH v2 2/3 arm64: dts: apple: Add missing M1 (t8103) devices

In reply to Janne Grunau

This adds support for following Apple M1 devices:
- MacBook Pro (13-inch, M1, 2020)
- MacBook Air (M1, 2020)
- iMac (24-inch 2021)

---
 arch/arm64/boot/dts/apple/Makefile        |  4 ++
 arch/arm64/boot/dts/apple/t8103-j274.dts  | 29 +-------------
 arch/arm64/boot/dts/apple/t8103-j293.dts  | 33 +++++++++++++++
 arch/arm64/boot/dts/apple/t8103-j313.dts  | 33 +++++++++++++++
 arch/arm64/boot/dts/apple/t8103-j456.dts  | 41 +++++++++++++++++++
 arch/arm64/boot/dts/apple/t8103-j457.dts  | 47 ++++++++++++++++++++++
 arch/arm64/boot/dts/apple/t8103-jxxx.dtsi | 49 +++++++++++++++++++++++
 7 files changed, 208 insertions(+), 28 deletions(-)
 create mode 100644 arch/arm64/boot/dts/apple/t8103-j293.dts
 create mode 100644 arch/arm64/boot/dts/apple/t8103-j313.dts
 create mode 100644 arch/arm64/boot/dts/apple/t8103-j456.dts
 create mode 100644 arch/arm64/boot/dts/apple/t8103-j457.dts
 create mode 100644 arch/arm64/boot/dts/apple/t8103-jxxx.dtsi
arch/arm64/boot/dts/apple/Makefile +4 -0
index cbbd701ebf05..c0510c25ca6a 100644
@@ -1,2 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 dtb-$(CONFIG_ARCH_APPLE) += t8103-j274.dtb
+dtb-$(CONFIG_ARCH_APPLE) += t8103-j293.dtb
+dtb-$(CONFIG_ARCH_APPLE) += t8103-j313.dtb
+dtb-$(CONFIG_ARCH_APPLE) += t8103-j456.dtb
+dtb-$(CONFIG_ARCH_APPLE) += t8103-j457.dtb
arch/arm64/boot/dts/apple/t8103-j274.dts +1 -28
index 02c36301e985..9e01ef70039d 100644
@@ -10,39 +10,15 @@
 /dts-v1/;
 
 #include "t8103.dtsi"
+#include "t8103-jxxx.dtsi"
 
 / {
 	compatible = "apple,j274", "apple,t8103", "apple,arm-platform";
 	model = "Apple Mac mini (M1, 2020)";
 
 	aliases {
-		serial0 = &serial0;
 		ethernet0 = &ethernet0;
 	};
-
-	chosen {
-		#address-cells = <2>;
-		#size-cells = <2>;
-		ranges;
-
-		stdout-path = "serial0";
-
-		framebuffer0: framebuffer@0 {
-			compatible = "apple,simple-framebuffer", "simple-framebuffer";
-			reg = <0 0 0 0>; /* To be filled by loader */
-			/* Format properties will be added by loader */
-			status = "disabled";
-		};
-	};
-
-	memory@800000000 {
-		device_type = "memory";
-		reg = <0x8 0 0x2 0>; /* To be filled by loader */
-	};
-};
-
-&serial0 {
-	status = "okay";
 };
 
 /*
@@ -50,9 +26,6 @@ &serial0 {
  * on-board devices and properties that are populated by the bootloader
  * (such as MAC addresses).
  */
-&port00 {
-	bus-range = <1 1>;
-};
 
 &port01 {
 	bus-range = <2 2>;
arch/arm64/boot/dts/apple/t8103-j293.dts new file +33 -0
new file mode 100644
index 000000000000..466035f00b69
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: GPL-2.0+ OR MIT
+/*
+ * Apple MacBook Pro (13-inch, M1, 2020)
+ *
+ * target-type: J293
+ *
+ * Copyright The Asahi Linux Contributors
+ */
+
+/dts-v1/;
+
+#include "t8103.dtsi"
+#include "t8103-jxxx.dtsi"
+
+/ {
+	compatible = "apple,j293", "apple,t8103", "apple,arm-platform";
+	model = "Apple MacBook Pro (13-inch, M1, 2020)";
+};
+
+/*
+ * Remove unused PCIe ports and disable the associated DARTs.
+ */
+
+&pcie0_dart_1 {
+	status = "disabled";
+};
+
+&pcie0_dart_2 {
+	status = "disabled";
+};
+
+/delete-node/ &port01;
+/delete-node/ &port02;
arch/arm64/boot/dts/apple/t8103-j313.dts new file +33 -0
new file mode 100644
index 000000000000..b0ebb45bdb6f
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: GPL-2.0+ OR MIT
+/*
+ * Apple MacBook Air (M1, 2020)
+ *
+ * target-type: J313
+ *
+ * Copyright The Asahi Linux Contributors
+ */
+
+/dts-v1/;
+
+#include "t8103.dtsi"
+#include "t8103-jxxx.dtsi"
+
+/ {
+	compatible = "apple,j313", "apple,t8103", "apple,arm-platform";
+	model = "Apple MacBook Air (M1, 2020)";
+};
+
+/*
+ * Remove unused PCIe ports and disable the associated DARTs.
+ */
+
+&pcie0_dart_1 {
+	status = "disabled";
+};
+
+&pcie0_dart_2 {
+	status = "disabled";
+};
+
+/delete-node/ &port01;
+/delete-node/ &port02;
arch/arm64/boot/dts/apple/t8103-j456.dts new file +41 -0

41 lines not on this page · raw message

arch/arm64/boot/dts/apple/t8103-j457.dts new file +47 -0

47 lines not on this page · raw message

arch/arm64/boot/dts/apple/t8103-jxxx.dtsi new file +49 -0

49 lines not on this page · raw message

Signature · 1 line
2.34.0
author maintainer
#3 lore raw

PATCH v2 3/3 arm64: dts: apple: t8103: Add i2c and cd321x nodes

In reply to Janne Grunau

i2c0, i2c1 and i2c3 are used on all M1 devices, i2c2 is only used on the 2020 Mac Mini and 13-inch MacBook Pro. All devices have identical i2c addresses for the cd321x' and use the same i2c bus.

---
 arch/arm64/boot/dts/apple/t8103-j274.dts  |  4 ++
 arch/arm64/boot/dts/apple/t8103-j293.dts  |  4 ++
 arch/arm64/boot/dts/apple/t8103-jxxx.dtsi | 18 ++++++
 arch/arm64/boot/dts/apple/t8103.dtsi      | 73 +++++++++++++++++++++++
 4 files changed, 99 insertions(+)
arch/arm64/boot/dts/apple/t8103-j274.dts +4 -0
index 9e01ef70039d..2cd429efba5b 100644
@@ -39,3 +39,7 @@ ethernet0: ethernet@0,0 {
 		local-mac-address = [00 10 18 00 00 00];
 	};
 };
+
+&i2c2 {
+	status = "okay";
+};
arch/arm64/boot/dts/apple/t8103-j293.dts +4 -0
index 466035f00b69..a3b084d50da3 100644
@@ -31,3 +31,7 @@ &pcie0_dart_2 {
 
 /delete-node/ &port01;
 /delete-node/ &port02;
+
+&i2c2 {
+	status = "okay";
+};
arch/arm64/boot/dts/apple/t8103-jxxx.dtsi +18 -0
index 53d22b434d76..5f748f3f60d2 100644
@@ -39,6 +39,24 @@ &serial0 {
 	status = "okay";
 };
 
+&i2c0 {
+	hpm0: tps6598x@38 {
+		compatible = "apple,cd321x";
+		reg = <0x38>;
+		interrupt-parent = <&pinctrl_ap>;
+		interrupts = <106 IRQ_TYPE_LEVEL_LOW>;
+		interrupt-names = "irq";
+	};
+
+	hpm1: tps6598x@3f {
+		compatible = "apple,cd321x";
+		reg = <0x3f>;
+		interrupt-parent = <&pinctrl_ap>;
+		interrupts = <106 IRQ_TYPE_LEVEL_LOW>;
+		interrupt-names = "irq";
+	};
+};
+
 /*
  * Force the bus number assignments so that we can declare some of the
  * on-board devices and properties that are populated by the bootloader
arch/arm64/boot/dts/apple/t8103.dtsi +73 -0

85 lines not on this page · raw message

Signature · 1 line
2.34.0
#4 lore raw

Re: [PATCH 3/3] arm64: dts: apple: t8103: Add i2c and cd321x nodes

Hi,

Quoted 3 lines · Janne Grunau

i2c0, i2c1 and i2c3 are used on all M1 devices, i2c2 is only used on the 2020 Mac Mini and 13-inch MacBook Pro. All devices have identical i2c addresses for the cd321x' and use the same i2c bus.

This should really be two commits: One for the i2c nodes and the other one to add the cd321x nodes.

Quoted 71 lines
---
 arch/arm64/boot/dts/apple/t8103-j274.dts  |  4 ++
 arch/arm64/boot/dts/apple/t8103-j293.dts  |  4 ++
 arch/arm64/boot/dts/apple/t8103-jxxx.dtsi | 18 ++++++
 arch/arm64/boot/dts/apple/t8103.dtsi      | 73 +++++++++++++++++++++++
 4 files changed, 99 insertions(+)
arch/arm64/boot/dts/apple/t8103-j274.dts +4 -0
index 9e01ef70039d..2cd429efba5b 100644
@@ -39,3 +39,7 @@ ethernet0: ethernet@0,0 {
 		local-mac-address = [00 10 18 00 00 00];
 	};
 };
+
+&i2c2 {
+	status = "okay";
+};
arch/arm64/boot/dts/apple/t8103-j293.dts +4 -0
index 466035f00b69..a3b084d50da3 100644
@@ -31,3 +31,7 @@ &pcie0_dart_2 {
 
 /delete-node/ &port01;
 /delete-node/ &port02;
+
+&i2c2 {
+	status = "okay";
+};
arch/arm64/boot/dts/apple/t8103-jxxx.dtsi +18 -0
index 53d22b434d76..5f748f3f60d2 100644
@@ -39,6 +39,24 @@ &serial0 {
 	status = "okay";
 };
 
+&i2c0 {
+	hpm0: tps6598x@38 {
+		compatible = "apple,cd321x";
+		reg = <0x38>;
+		interrupt-parent = <&pinctrl_ap>;
+		interrupts = <106 IRQ_TYPE_LEVEL_LOW>;
+		interrupt-names = "irq";
+	};
+
+	hpm1: tps6598x@3f {
+		compatible = "apple,cd321x";
+		reg = <0x3f>;
+		interrupt-parent = <&pinctrl_ap>;
+		interrupts = <106 IRQ_TYPE_LEVEL_LOW>;
+		interrupt-names = "irq";
+	};
+};
+
 /*
  * Force the bus number assignments so that we can declare some of the
  * on-board devices and properties that are populated by the bootloader
arch/arm64/boot/dts/apple/t8103.dtsi +0 -0
index c320c8baeb41..6c6dd988bd60 100644

arch/arm64/boot/dts/apple/t8103.dtsi serial0: serial@235200000 { · line 133

Quoted 8 lines
arch/arm64/boot/dts/apple/t8103.dtsi +5 -0
@@ -126,6 +126,59 @@ serial0: serial@235200000 {
 			status = "disabled";
 		};
 
+		i2c0: i2c@235010000 {
+			compatible = "apple,t8103-i2c", "apple,i2c";
+			reg = <0x2 0x35010000 0x0 0x4000>;
+			clocks = <&clk24>;
+			clock-names = "ref";

I don't think we need the clock name here.

Quoted 18 lines
arch/arm64/boot/dts/apple/t8103.dtsi +18 -0
+			interrupt-parent = <&aic>;
+			interrupts = <AIC_IRQ 627 IRQ_TYPE_LEVEL_HIGH>;
+			pinctrl-0 = <&i2c0_pins>;
+			pinctrl-names = "default";
+			#address-cells = <0x1>;
+			#size-cells = <0x0>;
+		};
+
+		i2c1: i2c@235014000 {
+			compatible = "apple,t8103-i2c", "apple,i2c";
+			reg = <0x2 0x35014000 0x0 0x4000>;
+			clocks = <&clk24>;
+			clock-names = "ref";
+			interrupt-parent = <&aic>;
+			interrupts = <AIC_IRQ 628 IRQ_TYPE_LEVEL_HIGH>;
+			pinctrl-0 = <&i2c1_pins>;
+			pinctrl-names = "default";
+			#address-cells = <0x1>;

arch/arm64/boot/dts/apple/t8103.dtsi serial0: serial@235200000 { · line 161

Quoted 10 lines
arch/arm64/boot/dts/apple/t8103.dtsi +10 -0
+			#size-cells = <0x0>;
+		};
+
+		i2c2: i2c@235018000 {
+			compatible = "apple,t8103-i2c", "apple,i2c";
+			reg = <0x2 0x35018000 0x0 0x4000>;
+			clocks = <&clk24>;
+			clock-names = "ref";
+			interrupt-parent = <&aic>;
+			interrupts = <AIC_IRQ 628 IRQ_TYPE_LEVEL_HIGH>;

Shouldn't this be 629? 628 is already used for i2c1.

Quoted 52 lines
arch/arm64/boot/dts/apple/t8103.dtsi +40 -0
+			pinctrl-0 = <&i2c2_pins>;
+			pinctrl-names = "default";
+			#address-cells = <0x1>;
+			#size-cells = <0x0>;
+			status = "disabled"; /* not used in all devices */
+		};
+
+		i2c3: i2c@23501c000 {
+			compatible = "apple,t8103-i2c", "apple,i2c";
+			reg = <0x2 0x3501c000 0x0 0x4000>;
+			clocks = <&clk24>;
+			clock-names = "ref";
+			interrupt-parent = <&aic>;
+			interrupts = <AIC_IRQ 630 IRQ_TYPE_LEVEL_HIGH>;
+			pinctrl-0 = <&i2c3_pins>;
+			pinctrl-names = "default";
+			#address-cells = <0x1>;
+			#size-cells = <0x0>;
+		};
+
 		aic: interrupt-controller@23b100000 {
 			compatible = "apple,t8103-aic", "apple,aic";
 			#interrupt-cells = <3>;
@@ -153,6 +206,26 @@ pinctrl_ap: pinctrl@23c100000 {
 				     <AIC_IRQ 195 IRQ_TYPE_LEVEL_HIGH>,
 				     <AIC_IRQ 196 IRQ_TYPE_LEVEL_HIGH>;
 
+			i2c0_pins: i2c0-pins {
+				pinmux = <APPLE_PINMUX(192, 1)>,
+					 <APPLE_PINMUX(188, 1)>;
+			};
+
+			i2c1_pins: i2c1-pins {
+				pinmux = <APPLE_PINMUX(201, 1)>,
+					 <APPLE_PINMUX(199, 1)>;
+			};
+
+			i2c2_pins: i2c2-pins {
+				pinmux = <APPLE_PINMUX(163, 1)>,
+					 <APPLE_PINMUX(162, 1)>;
+			};
+
+			i2c3_pins: i2c3-pins {
+				pinmux = <APPLE_PINMUX(73, 1)>,
+					 <APPLE_PINMUX(72, 1)>;
+			};
+
 			pcie_pins: pcie-pins {
 				pinmux = <APPLE_PINMUX(150, 1)>,
 					 <APPLE_PINMUX(151, 1)>,
Signature · 1 line
2.34.0