From patchwork Sat May 3 10:06:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter via B4 Relay X-Patchwork-Id: 887077 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 467CC1A841C; Sat, 3 May 2025 10:07:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746266836; cv=none; b=KAJhkw7hH0Csi/3gxepkb6ZnJDNTNCVNy1/dsVak8WgwgYFaqRCIMm9eoF1H07DT5pz+sdang3SdTj53xc5s9b928ZZhsn8UwkHZU6cxipQ+NEtIz61GrOERjThCWJUVbyOIBRvmaDjeMwR4jQJsieqIFrVs7Q4cIxrEzNewnr0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746266836; c=relaxed/simple; bh=bxleu5u97OIiv0Xv9kfYVfxcAPSFPeqSvomHkN8FMOI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Nyzhk51W2gCy7Cj329uIoFdSYQ97FAOXwl/2DLFscUfKX+aQjGuYKXLAh3c1q5JEMeLJlDtUXyitUBTIK/stOyfq91CN2uuvap9hBBIeBruT7SczNnPCUiihLWwVc1m6x0jLOgCGwzPDIsQGTQRIy6s15lchCEuwcQ4pIp9ojA0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hWf2E/kH; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hWf2E/kH" Received: by smtp.kernel.org (Postfix) with ESMTPS id B8F93C4CEEB; Sat, 3 May 2025 10:07:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1746266835; bh=bxleu5u97OIiv0Xv9kfYVfxcAPSFPeqSvomHkN8FMOI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=hWf2E/kHGdRQEj9+Taj8WsRIvcNxwSu1lPELYJ742ucFbBk7K+u2KKHeoeQMwuTSa lstMEAUvJW79DJCGqQy+8N06P2wlJur3+5Y4WC+t39T5WlJ5X1NES+UnxeC+s00GK3 IGMKTxwTDAWQA31sdIelsojSNkl0sJCDNnpa0SEfSfTpbTrS0tbgsSGt9jvXbyrELq cgXo0yIIERRWELkKluUVxFmD8HUavqWNoE8SJaL0brQhsgVgEQ2tSp2p3jp1pOkv8+ FIhQsRZKvUFY9n1GrPKW9Rj/dn/MAlAkpBqP30l9i7BGb12F07Jdg5t3fcKaFo9O5r NmAVRD8+0ou1Q== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8AE8C3ABB0; Sat, 3 May 2025 10:07:15 +0000 (UTC) From: Sven Peter via B4 Relay Date: Sat, 03 May 2025 10:06:48 +0000 Subject: [PATCH v4 1/9] dt-bindings: gpio: Add Apple Mac SMC GPIO block Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250503-smc-6-15-v4-1-500b9b6546fc@svenpeter.dev> References: <20250503-smc-6-15-v4-0-500b9b6546fc@svenpeter.dev> In-Reply-To: <20250503-smc-6-15-v4-0-500b9b6546fc@svenpeter.dev> To: Sven Peter , Janne Grunau , Alyssa Rosenzweig , Neal Gompa , Hector Martin , Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Sebastian Reichel , Lee Jones , Marc Zyngier , "Russell King (Oracle)" Cc: asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2207; i=sven@svenpeter.dev; h=from:subject:message-id; bh=7EVhNhPla32kZTqn+E4bqYHzUCjdjU3KtFUCmUQI7UM=; b=owGbwMvMwCHmIlirolUq95LxtFoSQ4boqyPVVjZlh0udX7netF2fc79rZdm5M/5tNhc4u+ZmB zSZ78vsKGVhEONgkBVTZNm+3970ycM3gks3XXoPM4eVCWQIAxenAEzk5VSGX0xtEn/bj3YcOSdd s9NTLtet7q9g9Y6w19zSV3Mf27lcnMbIMKn+x0XnqqLANRdOsCY+FuZSFSqX/Hv7eueL7roP6pJ anAA= X-Developer-Key: i=sven@svenpeter.dev; a=openpgp; fpr=A1E3E34A2B3C820DBC4955E5993B08092F131F93 X-Endpoint-Received: by B4 Relay for sven@svenpeter.dev/default with auth_id=167 X-Original-From: Sven Peter Reply-To: sven@svenpeter.dev From: "Russell King (Oracle)" Add the DT binding for the Apple Mac System Management Controller GPIOs. Signed-off-by: Russell King (Oracle) Signed-off-by: Sven Peter --- .../devicetree/bindings/gpio/apple,smc-gpio.yaml | 37 ++++++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 38 insertions(+) diff --git a/Documentation/devicetree/bindings/gpio/apple,smc-gpio.yaml b/Documentation/devicetree/bindings/gpio/apple,smc-gpio.yaml new file mode 100644 index 0000000000000000000000000000000000000000..07305eeb2595f59d5c28f6e507295b828dafd4a1 --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/apple,smc-gpio.yaml @@ -0,0 +1,37 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/gpio/apple,smc-gpio.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Apple Mac System Management Controller GPIO + +maintainers: + - Sven Peter + +description: + Apple Mac System Management Controller GPIO block. + +properties: + compatible: + const: apple,smc-gpio + + gpio-controller: true + + '#gpio-cells': + const: 2 + +required: + - compatible + - gpio-controller + - '#gpio-cells' + +additionalProperties: false + +examples: + - | + gpio { + compatible = "apple,smc-gpio"; + gpio-controller; + #gpio-cells = <2>; + }; diff --git a/MAINTAINERS b/MAINTAINERS index a70d79a5f6ae98fc0055f1da20dbecc095ea5c65..7f91f0225133490607ba0d79ad4225892ef31a66 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2267,6 +2267,7 @@ F: Documentation/devicetree/bindings/arm/apple/* F: Documentation/devicetree/bindings/clock/apple,nco.yaml F: Documentation/devicetree/bindings/cpufreq/apple,cluster-cpufreq.yaml F: Documentation/devicetree/bindings/dma/apple,admac.yaml +F: Documentation/devicetree/bindings/gpio/apple,smc-gpio.yaml F: Documentation/devicetree/bindings/i2c/apple,i2c.yaml F: Documentation/devicetree/bindings/input/touchscreen/apple,z2-multitouch.yaml F: Documentation/devicetree/bindings/interrupt-controller/apple,* From patchwork Sat May 3 10:06:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter via B4 Relay X-Patchwork-Id: 887076 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4688F1B3956; Sat, 3 May 2025 10:07:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746266836; cv=none; b=h2MK9kwg0gKetgpj2UxwGrQq3XNN8+QfVBctSGf4D6AJjw0qDceHMppz5d2TvDVjAvb5OeqUdav7H9S/lVdNHj1ME2JRqVWBIp7UZM6Gs9zGobKKpSm7w9mGPNvQI2touAKYgGNIS2kqTvYJ2sLTTWJamv4BEszNyBukBiJWpTU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746266836; c=relaxed/simple; bh=lmuGJqrtlK6jtLh4M5WPn7eIxSCZjPMLV6QMWO6aX4g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VZe63uSRwl179y2YNrtV+Clon5/O1bOFiy4cI9HhBRQR9cKzHefXPDxMuoCI/zDSuHLCdvxEBBF14JKfMwCGnXm8xPbsFlU2wK7IrBvdsW5pkkAP/ENRXIo7cn7HQzOr7qGvcoezDtC0PZDUqhn4mbuD7ZsNJxl8jdCUHK0sGME= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bsuMruyn; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bsuMruyn" Received: by smtp.kernel.org (Postfix) with ESMTPS id C3FD1C4CEE9; Sat, 3 May 2025 10:07:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1746266835; bh=lmuGJqrtlK6jtLh4M5WPn7eIxSCZjPMLV6QMWO6aX4g=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=bsuMruynfVEaqUB/4MULWEq7jyzt/KNvtIjqWb8paPtYO3bPPsNm10zQ9EozwAOzI gXTUNIt49C8q8oOxf7rzTJncHJKR/fNU5In5TlcL0DaYFx7lNsS6hO7UuIQdRtmWVl ToElnwjLB5Ka1VeQrK1MLswmCoCvFULvx7Fp+KKhyOgAyFsaBJGryrO+5n7iG2RUSw miyJYaNWB57DS+xF9kRWuI5dtFlcJlEGodz+eZWmUNX7Xl7mWITI3+ogrHLA9ecwub zy9apYfuYacnCrLq2mz2BCT52t+1LxsRMa6DlwI2TWtp+RihSD6x4csSkXPXXpume2 azShGmCHOZLUA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7399C3ABB7; Sat, 3 May 2025 10:07:15 +0000 (UTC) From: Sven Peter via B4 Relay Date: Sat, 03 May 2025 10:06:49 +0000 Subject: [PATCH v4 2/9] dt-bindings: power: reboot: Add Apple Mac SMC Reboot Controller Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250503-smc-6-15-v4-2-500b9b6546fc@svenpeter.dev> References: <20250503-smc-6-15-v4-0-500b9b6546fc@svenpeter.dev> In-Reply-To: <20250503-smc-6-15-v4-0-500b9b6546fc@svenpeter.dev> To: Sven Peter , Janne Grunau , Alyssa Rosenzweig , Neal Gompa , Hector Martin , Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Sebastian Reichel , Lee Jones , Marc Zyngier , "Russell King (Oracle)" Cc: asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3055; i=sven@svenpeter.dev; h=from:subject:message-id; bh=n/dAyQF+MHbfUNhqTnwgAGNCT95q0IoVEl/pbDNHSq8=; b=owGbwMvMwCHmIlirolUq95LxtFoSQ4boq6PXxCWrKmf13G3X4Vi5a5Odl3FW+KtvXP9eBEo95 hKf/HRjRykLgxgHg6yYIsv2/famTx6+EVy66dJ7mDmsTCBDGLg4BWAiLG8Z/gou76yyWqb7+bD3 jeC35dLNHqyTFwjmlXywNM/6X9zLLsfw37lE7A/L5gkL56utnxLY0uHP+zN4Sqrnr4rjLNPf/dE sZwQA X-Developer-Key: i=sven@svenpeter.dev; a=openpgp; fpr=A1E3E34A2B3C820DBC4955E5993B08092F131F93 X-Endpoint-Received: by B4 Relay for sven@svenpeter.dev/default with auth_id=167 X-Original-From: Sven Peter Reply-To: sven@svenpeter.dev From: Sven Peter On Apple Silicon machines a clean shutdown or reboot requires talking to SMC and writing to NVMEM cells. Add a binding for this MFD sub-device. Signed-off-by: Sven Peter --- .../bindings/power/reset/apple,smc-reboot.yaml | 52 ++++++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 53 insertions(+) diff --git a/Documentation/devicetree/bindings/power/reset/apple,smc-reboot.yaml b/Documentation/devicetree/bindings/power/reset/apple,smc-reboot.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e55e524914c2f57f7acf239fdefcbdc7a993b69f --- /dev/null +++ b/Documentation/devicetree/bindings/power/reset/apple,smc-reboot.yaml @@ -0,0 +1,52 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/power/reset/apple,smc-reboot.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Apple SMC Reboot Controller + +description: | + The Apple System Management Controller (SMC) provides reboot functionality + on Apple Silicon SoCs. It uses NVMEM cells to store and track various + system state information related to boot, shutdown, and panic events. + +maintainers: + - Sven Peter + +properties: + compatible: + const: apple,smc-reboot + + nvmem-cells: + items: + - description: Flag indicating shutdown (as opposed to reboot) + - description: Stage at which the boot process stopped (0x30 for normal boot) + - description: Counter for boot errors + - description: Counter for system panics + - description: Power management settings + + nvmem-cell-names: + items: + - const: shutdown_flag + - const: boot_stage + - const: boot_error_count + - const: panic_count + - const: pm_setting + +required: + - compatible + - nvmem-cells + - nvmem-cell-names + +additionalProperties: false + +examples: + - | + reboot { + compatible = "apple,smc-reboot"; + nvmem-cells = <&shutdown_flag>, <&boot_stage>, + <&boot_error_count>, <&panic_count>, <&pm_setting>; + nvmem-cell-names = "shutdown_flag", "boot_stage", + "boot_error_count", "panic_count", "pm_setting"; + }; diff --git a/MAINTAINERS b/MAINTAINERS index 7f91f0225133490607ba0d79ad4225892ef31a66..d85d9d9065db4dc5869788f8a81d9d9a425d7ce3 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2282,6 +2282,7 @@ 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* +F: Documentation/devicetree/bindings/power/reset/apple,smc-reboot.yaml 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 From patchwork Sat May 3 10:06:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter via B4 Relay X-Patchwork-Id: 887075 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A136A1E47B0; Sat, 3 May 2025 10:07:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746266836; cv=none; b=MHrsasV9E43KVuzxqXZYH2920GTpzGG8qL8VRWYJlUq4fYDVTvy7AhvTQNzTpre56F35RjIsPbT1avEOZpKlwFeCktul/AX3av5PQK34KVGmGqyIXZSaU0yXQxKtG5Hm+joh/Mn4eDSPhJtwvuKHH6d0TvV0bfanuD0lXAxOm1Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746266836; c=relaxed/simple; bh=W5v4ILEWqwYup4TO+1wngMEiHTv2uO2HibHXWAT5/0s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=u1k99WI2/f3Na3zwLhJelbFRA6UKgUlMdFe8SLRY/uKlKlMSOA2CHP/E0mLIl8L9YnylH3ODKrHwe+a4RpLveVceoC+tUUmit8gnJPcK8HwyKOJ1Yxu6gvP+RwQl5yJFHLIN/OPzOJECy8appBtrQKgMTzBgNgodNlmzIMXNtPs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VeMXClSa; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VeMXClSa" Received: by smtp.kernel.org (Postfix) with ESMTPS id EB924C4CEFB; Sat, 3 May 2025 10:07:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1746266836; bh=W5v4ILEWqwYup4TO+1wngMEiHTv2uO2HibHXWAT5/0s=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=VeMXClSayvJbyxO5B5imez9AgCW7Vaq8ZK6aFxHvr3IgEDBEpgd31aojpp0LUWjf/ HHiMSc90vsIfZYZw6L/BABWeec53HXVuuXNzKD+o7GUhCQkPzsY9YPCirz2vDjp7RN osbys+Vc5UpLDztWUyzMzsjF9t/rdzhVAjlxdLOWJpZ55bZDQF7zaABtSJOcemXYHj Wz99oOwUcmJM3zrOUDJHlBY/LXGfsq/lQoa/s1Q4vp39ARW445tfjO0T+53d5TRcm3 obm1eIQKRuAs7T2dO+xhCpQcQ7PZcjIT6iZB7BzV8WpITS+tfySR8YNB9wnZCMMzZZ 1SMY5xzYszUHQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id E324CC3ABB0; Sat, 3 May 2025 10:07:15 +0000 (UTC) From: Sven Peter via B4 Relay Date: Sat, 03 May 2025 10:06:52 +0000 Subject: [PATCH v4 5/9] gpio: Add new gpio-macsmc driver for Apple Macs Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250503-smc-6-15-v4-5-500b9b6546fc@svenpeter.dev> References: <20250503-smc-6-15-v4-0-500b9b6546fc@svenpeter.dev> In-Reply-To: <20250503-smc-6-15-v4-0-500b9b6546fc@svenpeter.dev> To: Sven Peter , Janne Grunau , Alyssa Rosenzweig , Neal Gompa , Hector Martin , Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Sebastian Reichel , Lee Jones , Marc Zyngier , "Russell King (Oracle)" Cc: asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=9874; i=sven@svenpeter.dev; h=from:subject:message-id; bh=sBsBGWttfmg7jpQNav+7mHxAFPoaCZSWN9SXvWfj1Fo=; b=owGbwMvMwCHmIlirolUq95LxtFoSQ4boq1N3F79aP7X97GLrZqHN8h7Juhua7yzJ4uf9LeMi0 RwRcsK3o5SFQYyDQVZMkWX7fnvTJw/fCC7ddOk9zBxWJpAhDFycAjCRZyoM/z3u+mjlRfE78Sz9 dGQV33OPkuuXv4bfdZwrwGpats3xwW+Gf2aFrbrzTseVNqQWpLnf3h50wOD5oWV7tpzuFFx8/O3 bXHYA X-Developer-Key: i=sven@svenpeter.dev; a=openpgp; fpr=A1E3E34A2B3C820DBC4955E5993B08092F131F93 X-Endpoint-Received: by B4 Relay for sven@svenpeter.dev/default with auth_id=167 X-Original-From: Sven Peter Reply-To: sven@svenpeter.dev From: Hector Martin This driver implements the GPIO service on top of the SMC framework on Apple Mac machines. In particular, these are the GPIOs present in the PMU IC which are used to control power to certain on-board devices. Although the underlying hardware supports various pin config settings (input/output, open drain, etc.), this driver does not implement that functionality and leaves it up to the firmware to configure things properly. We also don't yet support interrupts/events. This is sufficient for device power control, which is the only thing we need to support at this point. More features will be implemented when needed. To our knowledge, only Apple Silicon Macs implement this SMC feature. Signed-off-by: Hector Martin Reviewed-by: Bartosz Golaszewski Reviewed-by: Linus Walleij Reviewed-by: Sven Peter Signed-off-by: Russell King (Oracle) Signed-off-by: Sven Peter --- MAINTAINERS | 1 + drivers/gpio/Kconfig | 10 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-macsmc.c | 246 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 258 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 831df43892a64c95e00c24d77b8aa2a6ec87e074..5a52d5ada993c1b339fe1bdd1cda532faeeb9749 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2293,6 +2293,7 @@ F: drivers/bluetooth/hci_bcm4377.c F: drivers/clk/clk-apple-nco.c F: drivers/cpufreq/apple-soc-cpufreq.c F: drivers/dma/apple-admac.c +F: drivers/gpio/gpio-macsmc.c F: drivers/pmdomain/apple/ F: drivers/i2c/busses/i2c-pasemi-core.c F: drivers/i2c/busses/i2c-pasemi-platform.c diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index f2c39bbff83a33dcb12b2d32aa3ebc358a0dd949..f0e25105f8ebe7356344722987333a9fc244ea1f 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -1440,6 +1440,16 @@ config GPIO_LP87565 This driver can also be built as a module. If so, the module will be called gpio-lp87565. +config GPIO_MACSMC + tristate "Apple Mac SMC GPIO" + depends on MFD_MACSMC + help + Support for GPIOs controlled by the SMC microcontroller on Apple Mac + systems. + + This driver can also be built as a module. If so, the module will be + called gpio-macsmc. + config GPIO_MADERA tristate "Cirrus Logic Madera class codecs" depends on PINCTRL_MADERA diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index af130882ffeeef8b1d518867bfe1493ec4f21b5f..c2e47f356bfae73384ace8103074f246e49fb9d6 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -97,6 +97,7 @@ obj-$(CONFIG_GPIO_LP873X) += gpio-lp873x.o obj-$(CONFIG_GPIO_LP87565) += gpio-lp87565.o obj-$(CONFIG_GPIO_LPC18XX) += gpio-lpc18xx.o obj-$(CONFIG_GPIO_LPC32XX) += gpio-lpc32xx.o +obj-$(CONFIG_GPIO_MACSMC) += gpio-macsmc.o obj-$(CONFIG_GPIO_MADERA) += gpio-madera.o obj-$(CONFIG_GPIO_MAX3191X) += gpio-max3191x.o obj-$(CONFIG_GPIO_MAX7300) += gpio-max7300.o diff --git a/drivers/gpio/gpio-macsmc.c b/drivers/gpio/gpio-macsmc.c new file mode 100644 index 0000000000000000000000000000000000000000..289be4268f63a45e5156ab54c3ee3b9ff2935556 --- /dev/null +++ b/drivers/gpio/gpio-macsmc.c @@ -0,0 +1,246 @@ +// SPDX-License-Identifier: GPL-2.0-only OR MIT +/* + * Apple SMC GPIO driver + * Copyright The Asahi Linux Contributors + * + * This driver implements basic SMC PMU GPIO support that can read inputs + * and write outputs. Mode changes and IRQ config are not yet implemented. + */ + +#include +#include +#include +#include +#include + +#define MAX_GPIO 64 + +/* + * Commands 0-6 are, presumably, the intended API. + * Command 0xff lets you get/set the pin configuration in detail directly, + * but the bit meanings seem not to be stable between devices/PMU hardware + * versions. + * + * We're going to try to make do with the low commands for now. + * We don't implement pin mode changes at this time. + */ + +#define CMD_ACTION (0 << 24) +#define CMD_OUTPUT (1 << 24) +#define CMD_INPUT (2 << 24) +#define CMD_PINMODE (3 << 24) +#define CMD_IRQ_ENABLE (4 << 24) +#define CMD_IRQ_ACK (5 << 24) +#define CMD_IRQ_MODE (6 << 24) +#define CMD_CONFIG (0xff << 24) + +#define MODE_INPUT 0 +#define MODE_OUTPUT 1 +#define MODE_VALUE_0 0 +#define MODE_VALUE_1 2 + +#define IRQ_MODE_HIGH 0 +#define IRQ_MODE_LOW 1 +#define IRQ_MODE_RISING 2 +#define IRQ_MODE_FALLING 3 +#define IRQ_MODE_BOTH 4 + +#define CONFIG_MASK GENMASK(23, 16) +#define CONFIG_VAL GENMASK(7, 0) + +#define CONFIG_OUTMODE GENMASK(7, 6) +#define CONFIG_IRQMODE GENMASK(5, 3) +#define CONFIG_PULLDOWN BIT(2) +#define CONFIG_PULLUP BIT(1) +#define CONFIG_OUTVAL BIT(0) + +/* + * Output modes seem to differ depending on the PMU in use... ? + * j274 / M1 (Sera PMU): + * 0 = input + * 1 = output + * 2 = open drain + * 3 = disable + * j314 / M1Pro (Maverick PMU): + * 0 = input + * 1 = open drain + * 2 = output + * 3 = ? + */ + +struct macsmc_gpio { + struct device *dev; + struct apple_smc *smc; + struct gpio_chip gc; + + int first_index; +}; + +static int macsmc_gpio_nr(smc_key key) +{ + int low = hex_to_bin(key & 0xff); + int high = hex_to_bin((key >> 8) & 0xff); + + if (low < 0 || high < 0) + return -1; + + return low | (high << 4); +} + +static int macsmc_gpio_key(unsigned int offset) +{ + return _SMC_KEY("gP\0\0") | hex_asc_hi(offset) << 8 | hex_asc_lo(offset); +} + +static int macsmc_gpio_get_direction(struct gpio_chip *gc, unsigned int offset) +{ + struct macsmc_gpio *smcgp = gpiochip_get_data(gc); + smc_key key = macsmc_gpio_key(offset); + u32 val; + int ret; + + /* First try reading the explicit pin mode register */ + ret = apple_smc_rw_u32(smcgp->smc, key, CMD_PINMODE, &val); + if (!ret) + return (val & MODE_OUTPUT) ? GPIO_LINE_DIRECTION_OUT : GPIO_LINE_DIRECTION_IN; + + /* + * Less common IRQ configs cause CMD_PINMODE to fail, and so does open drain mode. + * Fall back to reading IRQ mode, which will only succeed for inputs. + */ + ret = apple_smc_rw_u32(smcgp->smc, key, CMD_IRQ_MODE, &val); + return ret ? GPIO_LINE_DIRECTION_OUT : GPIO_LINE_DIRECTION_IN; +} + +static int macsmc_gpio_get(struct gpio_chip *gc, unsigned int offset) +{ + struct macsmc_gpio *smcgp = gpiochip_get_data(gc); + smc_key key = macsmc_gpio_key(offset); + u32 cmd, val; + int ret; + + ret = macsmc_gpio_get_direction(gc, offset); + if (ret < 0) + return ret; + + if (ret == GPIO_LINE_DIRECTION_OUT) + cmd = CMD_OUTPUT; + else + cmd = CMD_INPUT; + + ret = apple_smc_rw_u32(smcgp->smc, key, cmd, &val); + if (ret < 0) + return ret; + + return val ? 1 : 0; +} + +static void macsmc_gpio_set(struct gpio_chip *gc, unsigned int offset, int value) +{ + struct macsmc_gpio *smcgp = gpiochip_get_data(gc); + smc_key key = macsmc_gpio_key(offset); + int ret; + + value |= CMD_OUTPUT; + ret = apple_smc_write_u32(smcgp->smc, key, CMD_OUTPUT | value); + if (ret < 0) + dev_err(smcgp->dev, "GPIO set failed %p4ch = 0x%x\n", + &key, value); +} + +static int macsmc_gpio_init_valid_mask(struct gpio_chip *gc, + unsigned long *valid_mask, unsigned int ngpios) +{ + struct macsmc_gpio *smcgp = gpiochip_get_data(gc); + int count; + int i; + + count = smcgp->smc->key_count; + if (count > MAX_GPIO) + count = MAX_GPIO; + + bitmap_zero(valid_mask, ngpios); + + for (i = 0; i < count; i++) { + int ret, gpio_nr; + smc_key key; + + ret = apple_smc_get_key_by_index(smcgp->smc, smcgp->first_index + i, &key); + if (ret < 0) + return ret; + + if (key > SMC_KEY(gPff)) + break; + + gpio_nr = macsmc_gpio_nr(key); + if (gpio_nr < 0 || gpio_nr > MAX_GPIO) { + dev_err(smcgp->dev, "Bad GPIO key %p4ch\n", &key); + continue; + } + + set_bit(gpio_nr, valid_mask); + } + + return 0; +} + +static int macsmc_gpio_probe(struct platform_device *pdev) +{ + struct macsmc_gpio *smcgp; + struct apple_smc *smc = dev_get_drvdata(pdev->dev.parent); + smc_key key; + int ret; + + smcgp = devm_kzalloc(&pdev->dev, sizeof(*smcgp), GFP_KERNEL); + if (!smcgp) + return -ENOMEM; + + smcgp->dev = &pdev->dev; + smcgp->smc = smc; + smcgp->first_index = apple_smc_find_first_key_index(smc, SMC_KEY(gP00)); + + if (smcgp->first_index >= smc->key_count) + return -ENODEV; + + ret = apple_smc_get_key_by_index(smc, smcgp->first_index, &key); + if (ret < 0) + return ret; + + if (key > macsmc_gpio_key(MAX_GPIO - 1)) + return -ENODEV; + + dev_info(smcgp->dev, "First GPIO key: %p4ch\n", &key); + + smcgp->gc.label = "macsmc-pmu-gpio"; + smcgp->gc.owner = THIS_MODULE; + smcgp->gc.get = macsmc_gpio_get; + smcgp->gc.set = macsmc_gpio_set; + smcgp->gc.get_direction = macsmc_gpio_get_direction; + smcgp->gc.init_valid_mask = macsmc_gpio_init_valid_mask; + smcgp->gc.can_sleep = true; + smcgp->gc.ngpio = MAX_GPIO; + smcgp->gc.base = -1; + smcgp->gc.parent = &pdev->dev; + + return devm_gpiochip_add_data(&pdev->dev, &smcgp->gc, smcgp); +} + +static const struct of_device_id macsmc_gpio_of_table[] = { + { .compatible = "apple,smc-gpio", }, + {} +}; +MODULE_DEVICE_TABLE(of, macsmc_gpio_of_table); + +static struct platform_driver macsmc_gpio_driver = { + .driver = { + .name = "macsmc-gpio", + .of_match_table = macsmc_gpio_of_table, + }, + .probe = macsmc_gpio_probe, +}; +module_platform_driver(macsmc_gpio_driver); + +MODULE_AUTHOR("Hector Martin "); +MODULE_LICENSE("Dual MIT/GPL"); +MODULE_DESCRIPTION("Apple SMC GPIO driver"); +MODULE_ALIAS("platform:macsmc-gpio"); From patchwork Sat May 3 10:06:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter via B4 Relay X-Patchwork-Id: 887074 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2AA51E47BA; Sat, 3 May 2025 10:07:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746266836; cv=none; b=I8L5GURAC8ipl/qgK3moiuglhvHNkQmbzGW+I/H0NH1my+p+3fBFtP+iVUq9rFLPwHsSssZiBq1YlOZkNMcFnZMmJFLyKMvRr9T4fwUPO1ufSPszdGIEWU/hUk3jDFiERQ2MS+R/Iw9TCrORTzutADbatG0f1M5oQW7x2uEQPvE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746266836; c=relaxed/simple; bh=SeVbHk3bm1013tFt4ArF0cJJ34AgTIU3dpY3JE5P3G4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=f+cbEPz3fNp2kFl848emif/sx9iskK03stLcIJvk5iGM8M0sDXXDoMCKi7+COa4EIF7X6WYi1ovHd3/ikf7iVz+eHZwdD9O0QSk6lMGugXLm/kxIR0BeqdT0mSKLInCJg953ZX6y51QHBqXNUfSestKc7+vVMA6xQfujKGdScgA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=osOdCdGh; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="osOdCdGh" Received: by smtp.kernel.org (Postfix) with ESMTPS id 126FAC116C6; Sat, 3 May 2025 10:07:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1746266836; bh=SeVbHk3bm1013tFt4ArF0cJJ34AgTIU3dpY3JE5P3G4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=osOdCdGhQkN5wlfkS0yBTImO91xlWQ5xQmfkR0pyRsPBxxG7YmqUL2YdCeObpPJ7j ttcvsZHM9ws+ULWZkwFc9uqrpPBUcHs13aPqMjACxAEZ/Fh4wpPJL+bkU1W41GCpdF Xqozf2gIGknw2v2byG8QYiEipxVDoQN71MG9YwJVnPyw8zqyOEKFBfHen8C94cXUnC g6W+GZR6R02QidBkyDkJk9GwyjN5pokdd6AsW18HEFxXBXoJ4t0HLGwwJHOskMUGQ5 C3nZXz5d0lQfpbjopV1mBqJ8us2rGI7IckAA/nLwt90pYv59HFrKprK9/pUdu2bEuu 6QbkAFSEJoWRg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08260C3ABB2; Sat, 3 May 2025 10:07:16 +0000 (UTC) From: Sven Peter via B4 Relay Date: Sat, 03 May 2025 10:06:54 +0000 Subject: [PATCH v4 7/9] arm64: dts: apple: t8103: Add SMC node Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250503-smc-6-15-v4-7-500b9b6546fc@svenpeter.dev> References: <20250503-smc-6-15-v4-0-500b9b6546fc@svenpeter.dev> In-Reply-To: <20250503-smc-6-15-v4-0-500b9b6546fc@svenpeter.dev> To: Sven Peter , Janne Grunau , Alyssa Rosenzweig , Neal Gompa , Hector Martin , Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Sebastian Reichel , Lee Jones , Marc Zyngier , "Russell King (Oracle)" Cc: asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2037; i=sven@svenpeter.dev; h=from:subject:message-id; bh=t/YZFmmAcri76xOjcBnVdujID0Y2bH/dcODoZmGa3f0=; b=owGbwMvMwCHmIlirolUq95LxtFoSQ4boq7MeG3W3qXSEGHU7XnX4k70gfznLNR+3c65/388Q3 hyf5RbcUcrCIMbBICumyLJ9v73pk4dvBJduuvQeZg4rE8gQBi5OAZjIvrWMDCd3rNuu9u14Eo+m 5O7ptnp/dfU5RDday606aJ/uJ+ync4uRYc1k21x2/h0LWAymebWmyah7GDRP8zG+fJC38IPgkuC pnAA= X-Developer-Key: i=sven@svenpeter.dev; a=openpgp; fpr=A1E3E34A2B3C820DBC4955E5993B08092F131F93 X-Endpoint-Received: by B4 Relay for sven@svenpeter.dev/default with auth_id=167 X-Original-From: Sven Peter Reply-To: sven@svenpeter.dev From: Hector Martin Signed-off-by: Hector Martin Reviewed-by: Linus Walleij Reviewed-by: Sven Peter Signed-off-by: Russell King (Oracle) Signed-off-by: Sven Peter --- arch/arm64/boot/dts/apple/t8103.dtsi | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/arch/arm64/boot/dts/apple/t8103.dtsi b/arch/arm64/boot/dts/apple/t8103.dtsi index 20faf0c0d80927b2e18dd966a61b5507b322c72f..58270e7d79b07ee98340f140972a6f0d14c86dcb 100644 --- a/arch/arm64/boot/dts/apple/t8103.dtsi +++ b/arch/arm64/boot/dts/apple/t8103.dtsi @@ -836,6 +836,41 @@ wdt: watchdog@23d2b0000 { interrupts = ; }; + smc: smc@23e400000 { + compatible = "apple,t8103-smc", "apple,smc"; + reg = <0x2 0x3e400000 0x0 0x4000>, + <0x2 0x3fe00000 0x0 0x100000>; + reg-names = "smc", "sram"; + mboxes = <&smc_mbox>; + + smc_gpio: gpio { + compatible = "apple,smc-gpio"; + gpio-controller; + #gpio-cells = <2>; + }; + + smc_reboot: reboot { + compatible = "apple,smc-reboot"; + nvmem-cells = <&shutdown_flag>, <&boot_stage>, + <&boot_error_count>, <&panic_count>, <&pm_setting>; + nvmem-cell-names = "shutdown_flag", "boot_stage", + "boot_error_count", "panic_count", "pm_setting"; + }; + }; + + smc_mbox: mbox@23e408000 { + compatible = "apple,t8103-asc-mailbox", "apple,asc-mailbox-v4"; + reg = <0x2 0x3e408000 0x0 0x4000>; + interrupt-parent = <&aic>; + interrupts = , + , + , + ; + interrupt-names = "send-empty", "send-not-empty", + "recv-empty", "recv-not-empty"; + #mbox-cells = <0>; + }; + pinctrl_smc: pinctrl@23e820000 { compatible = "apple,t8103-pinctrl", "apple,pinctrl"; reg = <0x2 0x3e820000 0x0 0x4000>; From patchwork Sat May 3 10:06:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter via B4 Relay X-Patchwork-Id: 887073 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C7B5A1E633C; Sat, 3 May 2025 10:07:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746266836; cv=none; b=YsPeueGyRqZ3vxZz7ZtEm/sV7wnt//QUP/FczCazI1N0IiDwlEeFJNCm836BDo1yCWMgQvaN52OcDTHk7nUtoy3sCPozeCNAIO0WNmBKRXtDu1XfpWGlIPYSuCgCcicGs07DxqGuiJjKdatJ2TsKYoPqvQ1hrU+Wi69wR3rGWXE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746266836; c=relaxed/simple; bh=wtZXovpm5BhGJm95IGnSaS5EDCcED8O/F+H6LBoX7x4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=si/SG26Yj425tZHeyV8Qcoe6knxoTAM7eHwwPj8sxeQwEH9DZo0MRG3A0kjnLGoP3Js8JJm1HP9AD4aggNGP9V0b7okN8qtn8+deeMwunR594LIfAfa7H+RhEFadtmBcdOKfNiu/izKrGaUs1pvQBLRKBu/C7IiCq+2lqkFxpWQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BogwD8M7; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BogwD8M7" Received: by smtp.kernel.org (Postfix) with ESMTPS id 28433C116B1; Sat, 3 May 2025 10:07:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1746266836; bh=wtZXovpm5BhGJm95IGnSaS5EDCcED8O/F+H6LBoX7x4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=BogwD8M7HMB/x7SVFn1jYO+cavA321UBBoBa/l+GLpcW+okTS1MP+FG1YVaz0OB7Z xqqAV1XWt8j10H+ZnxybsDD3JZBB3Y7GofsiCx5KkPaLXJQXZq1atriVefLwRWMIML ytgN1yZPer4HTlm6mQjReOm1NXN7B4ehmHSyAlphGPxrG1cA8DSy4VsDEFkqXlaROy oOqn/dPQOPFM5Jc1WiWoUynpAMYQvPZR1otb3k2A4V/8Hu2gq8UqgxM1wTA+cS8XU6 76Asfd1iuyW+DoacH/d34AkjMWolnASr2M1a8D31BniwUu07z2Dl5mXVh5MvOBPVlJ To4n0O5+ZPQUw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20A6FC3ABB0; Sat, 3 May 2025 10:07:16 +0000 (UTC) From: Sven Peter via B4 Relay Date: Sat, 03 May 2025 10:06:56 +0000 Subject: [PATCH v4 9/9] arm64: dts: apple: t600x: Add SMC node Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250503-smc-6-15-v4-9-500b9b6546fc@svenpeter.dev> References: <20250503-smc-6-15-v4-0-500b9b6546fc@svenpeter.dev> In-Reply-To: <20250503-smc-6-15-v4-0-500b9b6546fc@svenpeter.dev> To: Sven Peter , Janne Grunau , Alyssa Rosenzweig , Neal Gompa , Hector Martin , Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Sebastian Reichel , Lee Jones , Marc Zyngier , "Russell King (Oracle)" Cc: asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1851; i=sven@svenpeter.dev; h=from:subject:message-id; bh=asgFHWE+Y4/VDiSrToyfl0Yn74umJgKBLDT/bgdqN0Y=; b=owGbwMvMwCHmIlirolUq95LxtFoSQ4boqwv9W1hXrXl85egORZ91dt9vt2mWbwp2t1jwcpbQo iZtZbvlHaUsDGIcDLJiiizb99ubPnn4RnDppkvvYeawMoEMYeDiFICJ7E1h+O/0KJ1lw8S3t4Sn nIqs/utTsnt9fvKpI6eui0U/2xy7WW4Kwz/lCyVLRDfu6pJbtsBpXnWb75mKshP8apu79c7MOjk 7fCoHAA== X-Developer-Key: i=sven@svenpeter.dev; a=openpgp; fpr=A1E3E34A2B3C820DBC4955E5993B08092F131F93 X-Endpoint-Received: by B4 Relay for sven@svenpeter.dev/default with auth_id=167 X-Original-From: Sven Peter Reply-To: sven@svenpeter.dev From: Hector Martin Signed-off-by: Hector Martin Signed-off-by: Sven Peter --- arch/arm64/boot/dts/apple/t600x-die0.dtsi | 35 +++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/arch/arm64/boot/dts/apple/t600x-die0.dtsi b/arch/arm64/boot/dts/apple/t600x-die0.dtsi index 110bc6719512e334e04b496fb157cb4368679957..4993a8ace87b2fc7e645b08c19fcd9b0c21896aa 100644 --- a/arch/arm64/boot/dts/apple/t600x-die0.dtsi +++ b/arch/arm64/boot/dts/apple/t600x-die0.dtsi @@ -24,6 +24,41 @@ aic: interrupt-controller@28e100000 { power-domains = <&ps_aic>; }; + smc: smc@290400000 { + compatible = "apple,t6000-smc", "apple,smc"; + reg = <0x2 0x90400000 0x0 0x4000>, + <0x2 0x91e00000 0x0 0x100000>; + reg-names = "smc", "sram"; + mboxes = <&smc_mbox>; + + smc_gpio: gpio { + compatible = "apple,smc-gpio"; + gpio-controller; + #gpio-cells = <2>; + }; + + smc_reboot: reboot { + compatible = "apple,smc-reboot"; + nvmem-cells = <&shutdown_flag>, <&boot_stage>, + <&boot_error_count>, <&panic_count>, <&pm_setting>; + nvmem-cell-names = "shutdown_flag", "boot_stage", + "boot_error_count", "panic_count", "pm_setting"; + }; + }; + + smc_mbox: mbox@290408000 { + compatible = "apple,t6000-asc-mailbox", "apple,asc-mailbox-v4"; + reg = <0x2 0x90408000 0x0 0x4000>; + interrupt-parent = <&aic>; + interrupts = , + , + , + ; + interrupt-names = "send-empty", "send-not-empty", + "recv-empty", "recv-not-empty"; + #mbox-cells = <0>; + }; + pinctrl_smc: pinctrl@290820000 { compatible = "apple,t6000-pinctrl", "apple,pinctrl"; reg = <0x2 0x90820000 0x0 0x4000>;