Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp511389lqb; Wed, 29 May 2024 02:30:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVif0s0Whaj2B68y9aEBw7Ve3KhcIv5wLua22uNKahsS+FLpgeZNsQW3u/uh20GRJgZlAAgZTvvOrkroj6kQQi5G/AO0AO87oDnvAZhiQ== X-Google-Smtp-Source: AGHT+IEZ2JlSdFeqwVbP91yvjFT1LL1FgrJjLLj2/gjeXue3PjyDX9CbH67yT/zMek/B8pFN27Vg X-Received: by 2002:a17:90b:2317:b0:2b6:2067:dd15 with SMTP id 98e67ed59e1d1-2bf5f716a8cmr12592831a91.40.1716975006816; Wed, 29 May 2024 02:30:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716975006; cv=pass; d=google.com; s=arc-20160816; b=Hdqf/RWeCObVmDXm/DdvegB1rXS3HbUC+h7MinE0gWq+9niLlVVroRN6uayixP4Zw2 z23hdRatsgqL4WEwwnrcoiSbfkzpGVqTRFjI1tJT8EpDsBfJJCIOqvnCcsup/Fhk2Af7 R0qL4de0qlbaqMbtXe339Thjiq9zzJr3Vno9FLekXNf+S0UeVt8zBqm1hSSfH680d2kU 1ezZCNSvMZ3xcJoH8XsZCf51efe7Q08r0auZ25spD7JUom8CGBZJyhCJ+JuJvdfctVEr wyPfbkfmjUEAzifszOHloNSoAr03Om/u9bhqtXsnaMGlyO0GXt/sFvOWPAfbKDPvtdoD 67Aw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=WO9ey3CrsbD23rRQ2O4+vfIXY1HXGB/N2pxzDMAspME=; fh=msgp+xUPEz0xyigvUkGz9hDJ5AXwYawWa4rmQvkIKPA=; b=Np2fuXfJYuD75VfkmeSa+9UM7wp9wEFVT/V6ziXB4YWXpMNSENeD7FAyx2Ovhk300h 4fq6Fy0xuTRB31i45+rzfMr5uC0HPTG5zpCrIwLS5lArgejr1rBbPUe2fJNZhtRT5PMI 5p3tphkxgYgpJMaopxSXia4KRaHkGVjza468yUwy/3uL4nztPy8cAijJuNrlWftRdzRR T5VNbRyKBufkqwu88VhM5kee1KFFRfiNtmeAUbIXeD+2SN0kwqM7lkirmXGbPeqdn89g kwWgQ7LH7ALw1sJnBm0Sy+ekflDVpb4uRC5rTApCkOIbHl8CQ9R5dOy69REYK0OOvYyt W8dw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-193841-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-193841-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2bf7de86abdsi8240467a91.168.2024.05.29.02.30.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 02:30:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-193841-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-193841-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-193841-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6D62728653C for ; Wed, 29 May 2024 09:30:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 209E216D9D9; Wed, 29 May 2024 09:29:48 +0000 (UTC) Received: from andre.telenet-ops.be (andre.telenet-ops.be [195.130.132.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C160C169AD9 for ; Wed, 29 May 2024 09:29:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.130.132.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716974987; cv=none; b=t9gt65Inb3gOgpYFIj5i9sqzaduLIXPJsRsDjn44Oh8uXwvnpLL2TGZDxEmuduNn1Yt5ClAs159fvHIBNpYidWlWmiYqvyFgQJE66xw3t8gem2pe41Fsg4OxJBtv/YoF/HsPkB7TRQuyvF2SfW41bLoB+Juvj40iCaqN09QVwgk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716974987; c=relaxed/simple; bh=QyuN3vISd+DA2AWJ6hBlRZkAmE02Tdzp480T8yTS3Jc=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=DL3wXSn9s9PNwPiho28iOeSMmicvgeRG18VShs1VW3EOdsbkx0Ngb0365aXDhhMV+GWwZdxf+XxhTzaS+4Euhw59E2nDoKu1V5cUTwutZbMvRiErW64kLO6+m8UXZuuYkdtg8Ud/qUkgW9XCvK1/72U/M3vT4U7sKk7horCoGBw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be; spf=none smtp.mailfrom=linux-m68k.org; arc=none smtp.client-ip=195.130.132.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 -- 2.34.1 Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds