From patchwork Wed May 29 09:29:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 13678519 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 D371BC25B7C for ; Wed, 29 May 2024 09:30:07 +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=ic7gVr/VNBFBBx9aZSqIStKEdzCeYWjBQ5ms278oVqY=; b=bRBck2hlocJm7a iw3gFdpccfvYFOVEcKnoROkA4VQF5pAsLKjwyQmWiKSQgBIDUU2hRky+PQ/EvWceqRtkxDiMVMCgH h6m3AOJE72dKedZqoVR2QoFx8CNSFilSXnw4dRpa7VPcSfRD3aXCdXSnXkqTM4hwFopYqPhQK/Ikm HALwpV8Hpooj4xoBq58PTVHaQZ0314lhhR+2hq0y6W42drn+izONo/eGBldWgIVTUN1+iuTwHHJvY MkPCVUWbqKTGIIUlqnDivHnWPXwGIiqh9UhHXSzINmgzxMl3Gf49lPkIncJ3ypsbSmvJDVG/DC//M 5MubVspBHvVfiwMB9aVw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCFd7-00000003cj1-1TsP; Wed, 29 May 2024 09:29:57 +0000 Received: from andre.telenet-ops.be ([2a02:1800:120:4::f00:15]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCFcw-00000003ceH-35oA for linux-arm-kernel@lists.infradead.org; Wed, 29 May 2024 09:29:49 +0000 Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed80:1b01:1838:131c:4de4]) by andre.telenet-ops.be with bizsmtp id UxVg2C00T3VPV9V01xVgq9; Wed, 29 May 2024 11:29:43 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1sCFbt-00GHKa-Vo; Wed, 29 May 2024 11:29:40 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1sCFcq-008wRr-Bz; Wed, 29 May 2024 11:29:40 +0200 From: Geert Uytterhoeven To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm , Linus Walleij , Yoshihiro Shimoda Cc: devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2 0/8] Add R-Car fuse support Date: Wed, 29 May 2024 11:29:29 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240529_022946_945690_B6EC68C2 X-CRM114-Status: GOOD ( 26.34 ) 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 Hi all, R-Car Gen3/Gen4 SoCs contain fuses indicating hardware support or hardware parameters. Unfortunately the various SoCs require different mechanisms to read the state of the fuses: - On R-Car Gen3, the fuse monitor registers are in the middle of the Pin Function Controller (PFC) register block, - On R-Car V3U and S4-8, the E-FUSE non-volatile memory is accessible through a separate register block in the PFC, - On R-Car V4H and V4M, the E-FUSE non-volatile memory is accessible through the second register block of OTP_MEM. This patch series adds support for all 3 variants. It provides an in-kernel API to read the fuses' states, as well as userspace access through the nvmem subsystem and sysfs: - R-Car Gen3: /sys/bus/platform/devices/rcar_fuse/fuse/nvmem - R-Car V3U/S4: /sys/bus/platform/devices/e6078800.fuse/fuse/nvmem - R-Car V4H/V4M: /sys/bus/platform/devices/e61be000.otp/fuse/nvmem This has been tested on R-Car H3 ES2.0, M3-W and M3-W+, M3-N, V3M, V3H and V3H2, D3, E3, V3U, S4-8 ES1.0 and ES1.2, V4H, and V4M. For SoCs where E-FUSE is accessed through the PFC, it is not clear from the documentation if any PFC module clock needs to be enabled for fuse access. According to experiments on R-Car S4-8, the module clock and reset only impact the GPIO functionality of the PFC, not the pinmux or fuse monitor functionalities. So perhaps the clock/power-domains/resets properties should be dropped from the DT bindings and DTS, as well as the Runtime PM handling from the driver? Changes compared to v1[1]: - Drop RFC state and broaden audience, - Fix typo in one-line summary, - Add Reviewed-by. Thanks for your comments! [1] https://lore.kernel.org/r/cover.1714642390.git.geert+renesas@glider.be Geert Uytterhoeven (8): dt-bindings: fuse: Document R-Car E-FUSE / PFC dt-bindings: fuse: Document R-Car E-FUSE / OTP_MEM soc: renesas: Add R-Car fuse driver pinctrl: renesas: Add R-Car Gen3 fuse support arm64: dts: renesas: r8a779a0: Add E-FUSE node arm64: dts: renesas: r8a779f0: Add E-FUSE node arm64: dts: renesas: r8a779g0: Add OTP_MEM node arm64: dts: renesas: r8a779h0: Add OTP_MEM node .../bindings/fuse/renesas,rcar-efuse.yaml | 55 +++++ .../bindings/fuse/renesas,rcar-otp.yaml | 38 ++++ arch/arm64/boot/dts/renesas/r8a779a0.dtsi | 8 + arch/arm64/boot/dts/renesas/r8a779f0.dtsi | 8 + arch/arm64/boot/dts/renesas/r8a779g0.dtsi | 5 + arch/arm64/boot/dts/renesas/r8a779h0.dtsi | 5 + drivers/pinctrl/renesas/core.c | 18 ++ drivers/pinctrl/renesas/pfc-r8a77951.c | 2 + drivers/pinctrl/renesas/pfc-r8a7796.c | 4 + drivers/pinctrl/renesas/pfc-r8a77965.c | 2 + drivers/pinctrl/renesas/pfc-r8a77970.c | 2 + drivers/pinctrl/renesas/pfc-r8a77980.c | 14 +- drivers/pinctrl/renesas/pfc-r8a77990.c | 2 + drivers/pinctrl/renesas/pfc-r8a77995.c | 2 + drivers/pinctrl/renesas/sh_pfc.h | 4 +- drivers/soc/renesas/Kconfig | 8 + drivers/soc/renesas/Makefile | 1 + drivers/soc/renesas/rcar-fuse.c | 201 ++++++++++++++++++ include/linux/platform_data/rcar_fuse.h | 11 + include/linux/soc/renesas/rcar-fuse.h | 41 ++++ 20 files changed, 429 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/fuse/renesas,rcar-efuse.yaml create mode 100644 Documentation/devicetree/bindings/fuse/renesas,rcar-otp.yaml create mode 100644 drivers/soc/renesas/rcar-fuse.c create mode 100644 include/linux/platform_data/rcar_fuse.h create mode 100644 include/linux/soc/renesas/rcar-fuse.h