From patchwork Sun Apr 10 13:54:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 12808158 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BBBC7C433FE for ; Sun, 10 Apr 2022 13:56:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=eoruN/Uw0SexjLcSA3knQrQ9W6j9NYl9/V3X1LiT8FE=; b=vozyCKFJBHUa0E 6J6bcEESF2rIpo5qfc4kZbl8GsPkBWzhe99u2dS0FUsNxfrRnr+HCLDvXDPAeAapsrDd2VxU5TU5Y H0iB1D6KBornseoDaeaJDRNKdleVbrkiO+0HeDZ0ogBjrm1cRTTMdCIXEpLplcJINEWRcM5J/dEUX goPIg143kpnBnUuD1rugJkEq/dLZTaDvL/qsY+XhIg2sLch3Vq0VcGDBpH1DQsGeJA1iXZP4kr8Ll IgyUdru6fX0wJn2aYem1wGFjqs+K9+1Ixj8M3Fi7yB0rNXZzrIEUN406r/MvAm/xUOBQRXkkMegMC y6xosF0fpB9KnBvh/P/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ndY1P-004uEK-UL; Sun, 10 Apr 2022 13:54:32 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ndY1M-004uCn-UK for linux-arm-kernel@lists.infradead.org; Sun, 10 Apr 2022 13:54:30 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id C64DB5C00F0; Sun, 10 Apr 2022 09:54:22 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sun, 10 Apr 2022 09:54:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=cc:cc:content-transfer-encoding:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to; s=fm1; bh=Yuv1GmIDy+5OCJAJ3kdoGsDEnFsZtnCcD0X/Tf eNxDw=; b=UpIIVGnsZ+oJNshkqylAhqq+ABP9zjNcfnvj3XQUCGJkT+3GEpavc4 D34M5Ovi3h7vSc7A725bpBgo/rl49OWNiWcDrgSAGGGW5KAQZpqgEf3EgkiAIvJE FsaaO4YGRGEAXt1QrAkGH+mDX7lNNqJADoj6/d1KPr2qadi+vTmKaPsuPbUk6tKF tIwpC9zl7rSDRQLofNHYvFtu+YczDIJ6D0jSX8v8tUIH9VaU4mpoigP1GW15t9Ws sFCf13ZGZ1SYHF+X6RH4+FW0zMmhneXlVrmVdAU76OnuQSUwDjn6N9WGLQhiY2eI mNXDNkMoNR+ORmZYAg6l+8MWPbX3+P2A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :from:from:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; bh=Yuv1GmIDy+5OCJAJ3kdoGsDEnFsZt nCcD0X/TfeNxDw=; b=EnrCQcj6/T5nNgG5hzmD+WJnzueKwaupGdSuVu86q9h9w 7lye4lC7O8t3L0p2BZe9cAUpe0hlwW+0MQZtnLCAyhiKtsWs6VqJk2f+JwFOtkRf Eyjs8W88GlYxggkvM+S7Uceq8lkQVp18YdFNkle6l2MXvRFngF856YLjMEItD/2q srj5Mzl12WpwZsHxim8gmS/o8lGd+o1Hyyoq6Ai9XObRrIIf9mV8qXuGAXy9UoLj y9eS5exlwQOM7m04JcI7wxhbqAFv03LO0VHjSw2y9VWE93yZsji12MRLeWyT5Rqb O9CtgULcrYANghuK+3PesRVsRChDY7J0VR6BrY/Ug== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudekgedgieejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefuvhgvnhcurfgv thgvrhcuoehsvhgvnhesshhvvghnphgvthgvrhdruggvvheqnecuggftrfgrthhtvghrnh epuefgleekvddtjefffeejheevleefveekgfduudfhgefhfeegtdehveejfefffffgnecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshhvvghnse hsvhgvnhhpvghtvghrrdguvghv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 10 Apr 2022 09:54:20 -0400 (EDT) From: Sven Peter To: Srinivas Kandagatla Cc: Sven Peter , Rob Herring , Krzysztof Kozlowsk , Joey Gouly , Hector Martin , Alyssa Rosenzweig , Mark Kettenis , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 1/3] MAINTAINERS: Add apple efuses nvmem files to ARM/APPLE MACHINE Date: Sun, 10 Apr 2022 15:54:12 +0200 Message-Id: <20220410135414.20606-1-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220410_065429_343133_866A63C2 X-CRM114-Status: UNSURE ( 6.96 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Signed-off-by: Sven Peter --- v4: - new commit to split off MAINTAINER changes requested by Srinivas Kandagatla MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index fd768d43e048..1bf57fd937b5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1837,6 +1837,7 @@ F: Documentation/devicetree/bindings/clock/apple,nco.yaml F: Documentation/devicetree/bindings/i2c/apple,i2c.yaml F: Documentation/devicetree/bindings/interrupt-controller/apple,* F: Documentation/devicetree/bindings/mailbox/apple,mailbox.yaml +F: Documentation/devicetree/bindings/nvmem/apple,efuses.yaml F: Documentation/devicetree/bindings/pci/apple,pcie.yaml F: Documentation/devicetree/bindings/pinctrl/apple,pinctrl.yaml F: Documentation/devicetree/bindings/power/apple* @@ -1847,6 +1848,7 @@ F: drivers/i2c/busses/i2c-pasemi-core.c F: drivers/i2c/busses/i2c-pasemi-platform.c F: drivers/irqchip/irq-apple-aic.c F: drivers/mailbox/apple-mailbox.c +F: drivers/nvmem/apple-efuses.c F: drivers/pinctrl/pinctrl-apple-gpio.c F: drivers/soc/apple/* F: drivers/watchdog/apple_wdt.c From patchwork Sun Apr 10 13:54:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 12808159 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C67C1C4332F for ; Sun, 10 Apr 2022 13:56:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OUH/fyUg1zZmwozId4F2l9/WAETkYcIE5KpfuERbjdM=; b=P4xLHMS1M794aT 0XMfFxLV/ISHurJ6RQjZGty2sLhn9wt/A1G6PQtgtID2kYh252KAx2blIjqFzHtO8EFKaLx1ntgPx rI9VwoPLlpw7DpRh6nSWABQBYaG0k/3JdZyBoj+sB8pLH5ky2VeoFsGM+ZROW+pKWCIUSghbmeHYr rcg2x5bUQX00JeWojpZHPmNESSGoj4ADzvjv2otmHx3jz4G5d4k+q7FGzhQBu/S6+MPtl1I+3npd7 P8I4CYGhrIzjGTw0j7J9hfD21gymvB7qj2/pltKcso3qA45bGh44DRZbM/6kWzOHtS0v2tHrO6cwx 8DYqiLWYcim6HJqy/6Xw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ndY1Y-004uGm-Ke; Sun, 10 Apr 2022 13:54:40 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ndY1M-004uCo-Rx for linux-arm-kernel@lists.infradead.org; Sun, 10 Apr 2022 13:54:30 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id B8B485C00F4; Sun, 10 Apr 2022 09:54:24 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Sun, 10 Apr 2022 09:54:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=cc:cc:content-transfer-encoding:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; bh=872TStTIZWE7QK oVNxz3eKsUGk00QbR/SRkqv3FSeiE=; b=UlOJgyl4n0XgXqaXpX/M9cwHgSB/Ly vZTUo76I6eAuPYrTmPVL1gIRn+YqgxY1l586rCSZJtsJ2Sfclo1656cLlGPKPiAp 4htAv3DQmjjNawywxVOWMapQ2fEITZzka1Qc5U7ZrlMC/W9fhECSU40xM3nWcVs0 q8fJGDjYVsZDut+WLRUnMQlVNKWnSk2B80PatUG1g9WBsYpIDU22A41NmEJHCeop 2JEQ2aoGDkDvPbgIO73C7YQMpWgovyBCpgLfkmaODYffyzlz9GwaEuX/rob1xqBf +ixKndNzA3RqvwKBlAp2vRSbydySPw0KUg3IQSo15Y9eG+DWTQJVy2ww== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=872TSt TIZWE7QKoVNxz3eKsUGk00QbR/SRkqv3FSeiE=; b=C2sdfE02sbUaX7OHX6AG6k v2NbrqbhtQN9GHGSff8XJmPv2F4OYLh8WOrscpoM4scMOHSx914HL0vCjgP80KSx RyGBPYgApdq3a8XjXFXqG18RwSbfXZ2f2mvAy5Nbf6WJkyPVysAoxOiSyGUUtOlr vsNvN0k1Q2Pmv7D1gktwhluq2flm+14U2FG3E2a0Xe6ZLGh9JGP7KY11nYOIpvXt VIwxTJccreTWAVhaXmcx3afP7vuGfgk/wJ+wnMxeK/dMQxlv2SO93QmUs8sN9mE6 H280IvSiS9cBeGQMCm7CXP4TlvVwAbp/efM6n3jNqnxYqF4lTZpp9lqGkFcbu0Tg == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudekgedgieejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuvhgvnhcu rfgvthgvrhcuoehsvhgvnhesshhvvghnphgvthgvrhdruggvvheqnecuggftrfgrthhtvg hrnhephfefffejvdekleeitdffiefhhfffveffieejteefhedutdfgffeftdejhedtteeh necuffhomhgrihhnpeguvghvihgtvghtrhgvvgdrohhrghenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsvhgvnhesshhvvghnphgvthgvrhdr uggvvh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 10 Apr 2022 09:54:22 -0400 (EDT) From: Sven Peter To: Srinivas Kandagatla , Rob Herring Cc: Sven Peter , Krzysztof Kozlowsk , Joey Gouly , Hector Martin , Alyssa Rosenzweig , Mark Kettenis , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Herring Subject: [PATCH v4 2/3] dt-bindings: nvmem: Add apple,efuses Date: Sun, 10 Apr 2022 15:54:13 +0200 Message-Id: <20220410135414.20606-2-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20220410135414.20606-1-sven@svenpeter.dev> References: <20220410135414.20606-1-sven@svenpeter.dev> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220410_065429_327950_92441B5B X-CRM114-Status: GOOD ( 10.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Apple SoCs come with eFuses used to store factory-programmed data such as calibration settings for the PCIe and Type-C PHY. Reviewed-by: Krzysztof Kozlowski Acked-by: Rob Herring Signed-off-by: Sven Peter --- v3 -> v4: - added rob's ack - rebased on 5.18-rc1 and split off MAINTAINER changes as requested by Srinivas Kandagatla v2 -> v3: - added r-b tag v1 -> v2: - fixed indentation issue pointed out by Krzysztof Kozlowski .../bindings/nvmem/apple,efuses.yaml | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Documentation/devicetree/bindings/nvmem/apple,efuses.yaml diff --git a/Documentation/devicetree/bindings/nvmem/apple,efuses.yaml b/Documentation/devicetree/bindings/nvmem/apple,efuses.yaml new file mode 100644 index 000000000000..5ec8f2bdb3a5 --- /dev/null +++ b/Documentation/devicetree/bindings/nvmem/apple,efuses.yaml @@ -0,0 +1,50 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/nvmem/apple,efuses.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Apple SoC eFuse-based NVMEM + +description: | + Apple SoCs such as the M1 contain factory-programmed eFuses used to e.g. store + calibration data for the PCIe and the Type-C PHY or unique chip identifiers + such as the ECID. + +maintainers: + - Sven Peter + +allOf: + - $ref: "nvmem.yaml#" + +properties: + compatible: + items: + - enum: + - apple,t8103-efuses + - apple,t6000-efuses + - const: apple,efuses + + reg: + maxItems: 1 + +required: + - compatible + - reg + +unevaluatedProperties: false + +examples: + - | + efuse@3d2bc000 { + compatible = "apple,t8103-efuses", "apple,efuses"; + reg = <0x3d2bc000 0x1000>; + #address-cells = <1>; + #size-cells = <1>; + + ecid: efuse@500 { + reg = <0x500 0x8>; + }; + }; + +... From patchwork Sun Apr 10 13:54:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 12808157 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E7745C433EF for ; Sun, 10 Apr 2022 13:56:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CAjyoopPO/i9aQqVZHuZDe8e1R9JN0iiZo+a/UjSqXg=; b=29fTWm8tarRg8M V6sUN7i9GV2/MUYBfXabVRuaJ8kxwUiIGQOHrCbPG/Gt8sUTrX9AB4lP4Nm3y+VsnTdjYob4PTa7T 5ftYEBKyTNFLFefTz9YZw9zYjzOvklQx9zrlOyd4h7dMGXIorNmD52CF1p9gpIgniLivcwY8HlxAt z2qWjUlHPBGsBjWDZbln2UvC6PPPwOC40w92UxbfaLot5w4C/KYoT+2jfBdW6ymQZvqObnqiOZvVK U5mndkEvFVwDkb2Ewtfxmbwy/CdZZ7cJfqXFhxjX3o/k/9zES8ezpe2fqm+C//XaaFGfV1WuYNYjy Ov13+MoGL75H4dFlr+BA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ndY1h-004uJ1-KH; Sun, 10 Apr 2022 13:54:49 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ndY1N-004uCr-42 for linux-arm-kernel@lists.infradead.org; Sun, 10 Apr 2022 13:54:32 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 8345A5C00F9; Sun, 10 Apr 2022 09:54:26 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Sun, 10 Apr 2022 09:54:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=cc:cc:content-transfer-encoding:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; bh=Ra2f5OVvum6qyC ydfuFWdYT4SYyCGdf7Q2RUJs0cQhY=; b=FSdu5GymRcPlnjOkH4jXL+KBZVD9Ot ZkAeLxgjSMlRDTVUVK7o2UKWoySzFROYPDYPb9XGV+pTGeY7CbC2biPO2INsDeIT J/49tu2KfeNnZwzVkPvYJsqZc53FJ7fZiz7+TE5Q96qgEszQkvAuLzRN//0upvUh 2VMumYNdpRJ70gyDc24nJbKZauHKkVGhmvcd1PWbCyZGO4pWCZ1T9G9t/pVLEGzC S0rmJSFRO9nc54+zpKKKBXbNFWM87aRl+qAavUy2MybUdtYY4jRCcghyhFpvugJC Py4nYyIEYnl+29QnyHUw+CGtX7o6uU+6bQoy9vxOmqmCjVkU2ab2NmMg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=Ra2f5O Vvum6qyCydfuFWdYT4SYyCGdf7Q2RUJs0cQhY=; b=nys6of3i69rmu2dpmwQ4eO iqI7CqFlToo0BAcAMluwurS3c4UHgotzxI47SIIw/1BdMNyzGxzInye75pzXXJjU LiZNKxXM+CcGLo5AxT7tUQhIATIVjAT/2di14HT7OUiuNcvsNvMd1ln9PefK8jYy 4+4/N5N6DOyNTGD6WFH9aGuuIeYJPMCjydnBWdj5Tk6a2cWoD3a+pDzVzZbiQ8oT JZfXATF0qMl6qxEUyWnsA5xkSHKUCyjWAQZCrdLOQ8GRNZl8Md0luM5Zm159Q3Tz HU0qXz1HoWbjJwzl/NzQv/fAxBHFcImkETx02OC67fUwxYPhlQOHXCmnRbFzx/JQ == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudekgedgieejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuvhgvnhcu rfgvthgvrhcuoehsvhgvnhesshhvvghnphgvthgvrhdruggvvheqnecuggftrfgrthhtvg hrnheptedvkeetleeuffffhfekteetffeggffgveehieelueefvddtueffveevlefhfeej necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshhvvg hnsehsvhgvnhhpvghtvghrrdguvghv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 10 Apr 2022 09:54:24 -0400 (EDT) From: Sven Peter To: Srinivas Kandagatla Cc: Sven Peter , Rob Herring , Krzysztof Kozlowsk , Joey Gouly , Hector Martin , Alyssa Rosenzweig , Mark Kettenis , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 3/3] nvmem: Add Apple eFuse driver Date: Sun, 10 Apr 2022 15:54:14 +0200 Message-Id: <20220410135414.20606-3-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20220410135414.20606-1-sven@svenpeter.dev> References: <20220410135414.20606-1-sven@svenpeter.dev> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220410_065429_332032_EDF9F555 X-CRM114-Status: GOOD ( 20.86 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Apple SoCs contain eFuses used to store factory-programmed data such as calibration values for the PCIe or the Type-C PHY. They are organized as 32bit values exposed as MMIO. Signed-off-by: Sven Peter --- v3 -> v4: - rebased on 5.18-rc1 and split off MAINTAINER changes as requested by Srinivas Kandagatla v2 -> v3: - removed .owner = THIS_MODULE again since it's already done by the core as pointed out by Krzysztof Kozlowski v1 -> v2: - fixed sparse warning about __iomem by introducing struct apple_efuses_priv as done in other nvmem drivers - make sure the driver actually works as a module by setting .owner to THIS_MODULE and adding MODULE_DEVICE_TABLE pointed out by Joey Gouly drivers/nvmem/Kconfig | 12 ++++++ drivers/nvmem/Makefile | 2 + drivers/nvmem/apple-efuses.c | 80 ++++++++++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 drivers/nvmem/apple-efuses.c diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig index 555aa77a574d..6283e09cc1e9 100644 --- a/drivers/nvmem/Kconfig +++ b/drivers/nvmem/Kconfig @@ -324,4 +324,16 @@ config NVMEM_SUNPLUS_OCOTP This driver can also be built as a module. If so, the module will be called nvmem-sunplus-ocotp. +config NVMEM_APPLE_EFUSES + tristate "Apple eFuse support" + depends on ARCH_APPLE || COMPILE_TEST + default ARCH_APPLE + help + Say y here to enable support for reading eFuses on Apple SoCs + such as the M1. These are e.g. used to store factory programmed + calibration data required for the PCIe or the USB-C PHY. + + This driver can also be built as a module. If so, the module will + be called nvmem-apple-efuses. + endif diff --git a/drivers/nvmem/Makefile b/drivers/nvmem/Makefile index 891958e29d25..00e136a0a123 100644 --- a/drivers/nvmem/Makefile +++ b/drivers/nvmem/Makefile @@ -65,3 +65,5 @@ obj-$(CONFIG_NVMEM_LAYERSCAPE_SFP) += nvmem-layerscape-sfp.o nvmem-layerscape-sfp-y := layerscape-sfp.o obj-$(CONFIG_NVMEM_SUNPLUS_OCOTP) += nvmem_sunplus_ocotp.o nvmem_sunplus_ocotp-y := sunplus-ocotp.o +obj-$(CONFIG_NVMEM_APPLE_EFUSES) += nvmem-apple-efuses.o +nvmem-apple-efuses-y := apple-efuses.o diff --git a/drivers/nvmem/apple-efuses.c b/drivers/nvmem/apple-efuses.c new file mode 100644 index 000000000000..9b7c87102104 --- /dev/null +++ b/drivers/nvmem/apple-efuses.c @@ -0,0 +1,80 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Apple SoC eFuse driver + * + * Copyright (C) The Asahi Linux Contributors + */ + +#include +#include +#include +#include +#include + +struct apple_efuses_priv { + void __iomem *fuses; +}; + +static int apple_efuses_read(void *context, unsigned int offset, void *val, + size_t bytes) +{ + struct apple_efuses_priv *priv = context; + u32 *dst = val; + + while (bytes >= sizeof(u32)) { + *dst++ = readl_relaxed(priv->fuses + offset); + bytes -= sizeof(u32); + offset += sizeof(u32); + } + + return 0; +} + +static int apple_efuses_probe(struct platform_device *pdev) +{ + struct apple_efuses_priv *priv; + struct resource *res; + struct nvmem_config config = { + .dev = &pdev->dev, + .read_only = true, + .reg_read = apple_efuses_read, + .stride = sizeof(u32), + .word_size = sizeof(u32), + .name = "apple_efuses_nvmem", + .id = NVMEM_DEVID_AUTO, + .root_only = true, + }; + + priv = devm_kzalloc(config.dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + priv->fuses = devm_platform_get_and_ioremap_resource(pdev, 0, &res); + if (IS_ERR(priv->fuses)) + return PTR_ERR(priv->fuses); + + config.priv = priv; + config.size = resource_size(res); + + return PTR_ERR_OR_ZERO(devm_nvmem_register(config.dev, &config)); +} + +static const struct of_device_id apple_efuses_of_match[] = { + { .compatible = "apple,efuses", }, + {} +}; + +MODULE_DEVICE_TABLE(of, apple_efuses_of_match); + +static struct platform_driver apple_efuses_driver = { + .driver = { + .name = "apple_efuses", + .of_match_table = apple_efuses_of_match, + }, + .probe = apple_efuses_probe, +}; + +module_platform_driver(apple_efuses_driver); + +MODULE_AUTHOR("Sven Peter "); +MODULE_LICENSE("GPL");