From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796026546; b=obVs9f5IYhMpHveEcdJu8TzrfsLub3gJrCK7Y9ZjP/BVhwdekEzb1D0ELf98N07Y15Ur 6n5l4w/N/4YlwQnsbN6sXA41evkSo7e7COjQzq21xE7B3ydSDtYxdlYnZYRL0Dn1QqraS P6xiTLi0/jsKX5VsZTEFF0MiPkwhCtQr2xFQ7OMz6Fk6zEBy7ZrzxZv5PZZ6BVJQe/GqL HsqzbNaUZuVZ0A5cLihhWTMjB0Ft0xTss3QJHiNcZlehLoVbWw4Nj4o4PyLAJeddz7XPe fLweaH7Uhp4JFMkuwQbkWKEpNS2ebHUTr52MM4z98IfAiDGAV1PUq+CWe1mr7FKVdWw== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796026546; h=Received:DKIM-Signature:Received:From:Subject:Date:Message-Id: MIME-Version:Content-Type:Content-Transfer-Encoding:X-B4-Tracking: X-Change-ID:To:Cc:X-Mailer:X-Developer-Signature:X-Developer-Key: X-Endpoint-Received:X-Original-From:Reply-To; bh=5vXXts52izZofCmnJVq4aCp4fxn9vC4zJ5a1WHfO/H0=; b=VBWCzaDzvC/rNmDTa98+czccX9piNVZSHKIu6n5J1rcBq1ZcpTShj1pVp/9bf/Bt2NJH 0+m0Jjx8jxtFUEpnyjphma1TZYmxEdyIcQy4IRMeXtpLysK9INk8LOZfPu+Nl0tAJNxCu X/sLng4L7Lm2F8rWDxgXmXey4q4PpGtHEzPfdIWJO4ebQEir5In9lKZx57AqoykiLkek8 WQYKASRkyBVNhIeIGM6zd3qL4PcWmfra+JQnPmBdfFVD9d7q+yBZh17qZ4WT0hQbuWOir BHSt3FLu7MEMXxdXdEO+JBBCM/APD46FW01ivqkCz+dfQWJIECvy/VBBf0yFNtBHJjg== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=KiE4rsqV; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 64CF7606A332; Mon, 30 Nov 2026 08:15:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=KiE4rsqV Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none; t=1796026545; b=rydG+7FEPDK5YHn7UBWSSzpJF2aQoUlsaqjW+LHp6t6XrjoGiz1ZjI3cibl9yuOYSdZr 0hGaunyPZc+bkd+KLNWqX4V0wfuTp5Us1hKQKPtI0gKLYS7o5/XzXIA5enBvTldYn+SGb wG51037zep64X98zNI8C05EIrJCT1yWHDJumn5b2k1FH52IJvCG6RTou37mg5MzzNbPSe dIVs044Fpu52upwxMDULOGSfZNGgLZuZhGSLzxlz2lWK7ZoxurQsihJOQsDtOQKVj+x+/ a0sxyvh004pKU8EP9rqRe+2J4kOFpzW3JquiB9b66nsmwO+J712ygZIluST39EOzZ4w== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1796026545; h=DKIM-Signature:Received:From:Subject:Date:Message-Id:MIME-Version: Content-Type:Content-Transfer-Encoding:X-B4-Tracking:X-Change-ID:To: Cc:X-Mailer:X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To; bh=5vXXts52izZofCmnJVq4aCp4fxn9vC4zJ5a1WHfO/H0=; b=rc2N+RrIqeBluXPKnqiTPrwc+oH/3R1yZUtO8+s2q5EEMUgmu420IxGyp0/tsgbEAFMB 2o3t5a0MMvTYQE7Dx3VGg3CTpyBrK95Zb0BorRlaonUKXlft2ei1AeBn8VIHiOvvl6rxU zUfj7/ovpCJX+GXP4/Sz8tM70VlmlHTBcp+JQzmVCY5i3xm/KxiPICOcMCe69Ws2GvMJX g9yx++7oeSBzgyCxSqojiLQ8BmNeH1gYc8K29g4bcziNsA6IkrroEfxG8yxsqCKY4spLu 5iauVf+uibttWFKk8KAq6ZAKHAhiokPRwYaE/OyGLr+O3YFgHTrYwZE+EuWVOkYvdag== ARC-Authentication-Results: i=1; smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 754FE1F00897; Mon, 30 Nov 2026 08:15:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796026545; bh=5vXXts52izZofCmnJVq4aCp4fxn9vC4zJ5a1WHfO/H0=; h=From:Subject:Date:To:Cc:Reply-To; b=KiE4rsqVmw7V6YNf2QCefGJ5ubErZDUHjb/xaFJdnOBfss9JKQq7JwoLUPK/Jy/pl JtzSBPvTPBxSClEdjZzTceANl1ryr0l2Rged5zAqvdzsbHVEKFpAa2o2704P5H6ZN2 Fy+jlZbkymtmy3Jq6YI+zMtJfTax938qJsMFXK8Mr6bPoWoszDFQYwqhltw36xPrug ADuOpbRV4sKbuvwb3wGo5YmbwsstjHpg9yADBN9HoE0TdkqzZWMiZWf4YLH8cpB7Nx I2/IZ6ZDHY8ksk1FOJIzXrJmG3OlnpECQqzSi7XDl/72fRDUgFx7itczBYqbNivtpb LdpZNIwDMZ70Q== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id C5FB14E767; Mon, 30 Nov 2026 08:15:30 +0000 (UTC) From: Vyacheslav Yurkov via B4 Relay Subject: [PATCH v12 0/2] A proposal to add a gpio-enabled clock driver. Date: Mon, 30 Nov 2026 08:15:26 +0000 Message-Id: <20261130-feature-clock-guard-v12-0-d0978ad15207@bruker.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAJ4wDWsC/43SzU7DMAwH8FeZeibIznc48R6Ig+NkWzVYUbpNo GnvTroDRaRDO9pSfnH+zrkbc+nz2D2tzl3Jp37sh30tUD6sOt7SfpNFn2qjkyAtKPRinelwLFn w28A7sTlSSWItgSQrE4M1XT35UfK6/7yyL6+13vbjYShf11tOOHX/904oQFhUjqMGr6N7juW4y +WRh/duAk9yRgzCMiInhKXRxiejNDSImpE6yzKiKgLITEAEmkyD6Blx0i4juiI5sI/KyeiQG8T MSECzjJiKaEnRJFZkiRrE/kKkW0bs9BxwwauIKrNsEHcH4iriU8JgrE+BWsTfgfhpOwqC8lmBJ GyQ8IMg3MokVISRwZAO0ygNgjArKPHGb6uZCJO0Dk6FGH27H8R7GLyGy1bV/Vj3J5fL5fINYQZ dUG4DAAA= X-Change-ID: 20260318-feature-clock-guard-f20a2c35b965 To: Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Brian Masney , Brian Masney , Jerome Brunet , Jyri Sarha Cc: linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, Vyacheslav Yurkov , Vyacheslav Yurkov X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796026529; l=4177; i=V.Yurkov.EXT@bruker.com; s=20260318; h=from:subject:message-id; bh=OnZ7/88u823RZz/mqcZUkBRK7g0+NSehhTms/efgNT0=; b=l4k0WfdtD81T7LwM6da1q0dPi7fvSu5P/ji2ST1MbIndqmAiQg1pcXDjNswPNN4t8KivRzz+P lm2UEhDgmWpC4dfLo8TN02w+ZImeJmpaN0h6N6TEODLZsQ+3uZDWanl X-Developer-Key: i=V.Yurkov.EXT@bruker.com; a=ed25519; pk=snJmgYVOKlp7aQtK9tWnEI7QTYxpPpJJvxdVsnxA7Fk= X-Endpoint-Received: by B4 Relay for V.Yurkov.EXT@bruker.com/20260318 with auth_id=686 X-Original-From: Vyacheslav Yurkov Reply-To: V.Yurkov.EXT@bruker.com A gpio-enabled clock represents an input clock, which state is determined by a GPIO signal. It's similar to a gated-fixed-clock, but GPIO direction is inverted. Consumers can use the output clock to wait until the clock is ready and only then initialize / access dependent peripherals. The usage example for such a driver is when peripherals depend on PLLs in a FPGA, which can't be directly accessed by the CPU, but need a GPIO pin to check whether clock is actually usable. E.g. some of the IPs might not have a proper split between registers and IP core, which means that if an external clock and/or PLL lock is missing and one tries to access the registers, the response never comes, thus the CPU stalls. Signed-off-by: Vyacheslav Yurkov Signed-off-by: Vyacheslav Yurkov --- Changes in v12: - Use new devm_kzalloc_obj() API - Make poll-timeout-us mandatory, use polling inteval as a max of 1/10 of the specified timeout or 10us. - Remove range check from the driver - Link to v11: https://lore.kernel.org/r/20261121-feature-clock-guard-v11-0-00c633a667a2@bruker.com Changes in v11: - Address sashiko feedback - Link to v10: https://lore.kernel.org/r/20261121-feature-clock-guard-v10-0-5d449739bb8c@bruker.com Changes in v10: - Use only sleep capable ops - Make commit messages more generic - Improve error handling for clock_prepare - Link to v9: https://lore.kernel.org/r/20261015-feature-clock-guard-v9-0-c1c05a498d9a@bruker.com Changes in v9: - Changed wordking from "locked" to "enabled" to be more generic - Use a separate DT schema file similar to other clock drivers - Add a timeout for polling in enable()/prepare() - Depending on whether GPIO can sleep or not use prepare() or enable() set of ops respectively. - Decouple the implementation from exisiting drivers - Link to v8: https://lore.kernel.org/r/20260927-feature-clock-guard-v8-0-630938e302a1@bruker.com Changes in v8: - Fix return value of clk_gpio_locked_prepare() - Link to v7: https://lore.kernel.org/r/20260927-feature-clock-guard-v7-0-8dd19568d9a2@bruker.com Changes in v7: - Fix compatibility strings and schema errors. - Update GPIO pin name - Link to v6: https://lore.kernel.org/r/20260927-feature-clock-guard-v6-0-007983b13ec2@bruker.com Changes in v6: - Debug messages dropped. - The new driver is now an extension of exising clk-gpio drivers. - The controller doesn't enable the parent clock, the consumer is supposed to do that instead. - Link to v5: https://lore.kernel.org/r/20260915-feature-clock-guard-v5-0-42ab5dc3a6aa@bruker.com Changes in v5: - Use existing DT binding with an additional property instead of adding a new one - The driver is simplified in a way that it represents the actual HW desgin without additional unrelated constructs - Aggregation is removed, now it's one clock input, one clock output - Link to v4: https://lore.kernel.org/r/20260726-feature-clock-guard-v4-0-e9c8b372b71c@bruker.com Changes in v4: - Removed driver specifics from DT binding - Link to v3: https://lore.kernel.org/r/20260603-feature-clock-guard-v3-0-01cca0aa04a5@bruker.com Changes in v3: - Removed unnecessary dt bindings - Improved HW description and commit messages - Link to v2: https://lore.kernel.org/r/20260510-feature-clock-guard-v2-0-6c25458d5340@bruker.com Changes in v2: - Renamed to clk-gpio-locked to express intent. - Provide enable() / is_enabled() operations so the clock behaves as expected - Fixed DTS errors / warnings - Link to v1: https://lore.kernel.org/r/20260318-feature-clock-guard-v1-0-6137cb4084b7@bruker.com --- Vyacheslav Yurkov (2): dt-bindings: clock: Add gpio-enabled-clock clk: gpio: Add driver for GPIO-signalled clocks .../bindings/clock/gpio-enabled-clock.yaml | 53 ++++++++++++ drivers/clk/clk-gpio.c | 99 ++++++++++++++++++++++ 2 files changed, 152 insertions(+) --- base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244 change-id: 20260318-feature-clock-guard-f20a2c35b965 Best regards, -- Vyacheslav Yurkov