Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (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.subspace.kernel.org (Postfix) with ESMTPS id 63031606A31A for ; Wed, 2 Dec 2026 10:27:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=lists.u-boot-project.org header.i=@lists.u-boot-project.org header.a=rsa-sha256 header.s=default header.b=aIX+4jH4; dkim=pass (1024-bit key, unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.a=rsa-sha256 header.s=google header.b=Htjo9123 Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id AEF366078E; Wed, 2 Dec 2026 10:27:31 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id bkqtKv1P6Skq; Wed, 2 Dec 2026 10:27:31 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp3.osuosl.org 5E416606F0 Authentication-Results: smtp3.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1796207250; b=Uui9XpNSr28ccgtOiztx+iPyXV1/kehYIsgHri92XAEk0Z0MCiYmuJ96/Y7n4IzcQuTC Yg3CplE+qaIj7ND0gVdzNKryPktTabJYf+I8CBeeh2KMDabHlFIzMWmcK1s/VGM9g3mJr xI3vcl5uzrz6GVb8QZxLJovOUGv0gC832j8neDTzfiaGGKSllYzYzBdVFHLfGezVhZfkn pNT17xUL3fJTZUVRV4S2W5BEz3H6B7rKEo15BVwzE8nIMrXFtldKPkMUFQbdW4W9CB5qP t2h4jLeGjT7ELNPAPZcfn9H5HsjcvUogRC23ijaWFLqQgrfJ3Aa1FHBK32e9i9sf1Ew== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1796207250; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg: X-Received:Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding: X-BeenThere:X-Mailman-Version:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:Errors-To; bh=U1NESYJ312wMPFtqirzQCIaVGKA9K71amOjg5mZwHsw=; b=rW1qW52CK3EiTgJb1E5QK/AXf6C6e52eSBDKDUz/WGIXF99J4y05DAm7AoujlVeY2A2o IYSJhYBa2PaXlkd+9NfT61M29Z6WB1aaOnpPMsj4e8oa7Uvbkg6CUVhMAVtVeU2uP00++ QQmniNJKYuseEx9yRcxbAfrQdSMUoRyQj9QP+YA1SsRuzmhdhF06VnnfPu+ljemcnBs// u33sTqMQSFhHZaDUQr3XUYY5fXEPJyR9+Llfk0mvO2vtFNPxhws7kdo6Jdt+6CZgCUveU d06KE7xkfw2+3UApFlUx1oEpQg4E4dBYMTCo2XpeyPXAZSmSOUOfXvzcUR5x5Q2xMrg== ARC-Authentication-Results: i=1; smtp3.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.u-boot-project.org; s=default; t=1796207250; bh=U1NESYJ312wMPFtqirzQCIaVGKA9K71amOjg5mZwHsw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=aIX+4jH4TXUz34MWWbYTzI9wCHiJeLHbqh/XahwB9vk/2fj8Sne61RAv1WeFuAiMo OL6BSbj27EO8rVJv5TkIsr5FIAKHEtNSZ2RXHeOr748JgcPVgfjnGlL+w1BNGe+ql9 6DG/yNHvpMTyXg918LFjfrQ4/TZ4/Lo8VshWgOuQaJCy+8eqlpl+HAXz3R7Zl52l5n eQMvm9YHZBHn4TINswlkThlcNzb8eKWSklTFunswPRZYHTQP4PtNFYKuHnLSdqSd09 LEVnO+s+yTMcQvIWabaO04NYqSf2S+B2dVYALQ3sbaA8TXyaizRu/r4H/PwEdTmuhg 6mfzZjQeNP2hA== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id 5E416606F0; Wed, 2 Dec 2026 10:27:30 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists1.osuosl.org (Postfix) with ESMTP id 73DE34C2 for ; Wed, 2 Dec 2026 10:27:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 65A4940466 for ; Wed, 2 Dec 2026 10:27:29 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id c7_32UbGFzsd for ; Wed, 2 Dec 2026 10:27:28 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp2.osuosl.org 614BA40179 Authentication-Results: smtp2.osuosl.org; arc=none smtp.remote-ip="2a00:1450:4864:20::32e" Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:20::32e; helo=mail-wm1-x32e.google.com; envelope-from=dario.binacchi@amarulasolutions.com; receiver= Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.a=rsa-sha256 header.s=google header.b=Htjo9123 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by smtp2.osuosl.org (Postfix) with ESMTPS id 614BA40179 for ; Wed, 2 Dec 2026 10:27:27 +0000 (UTC) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4bb61185057so81132695e9.1 for ; Wed, 02 Dec 2026 02:27:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1796207246; x=1796812046; darn=lists.u-boot-project.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=U1NESYJ312wMPFtqirzQCIaVGKA9K71amOjg5mZwHsw=; b=Htjo9123XlzvGFjkx1M3uBUbvnZL53B4CWBaPn/tVO0xjTDF+HVjH5qUd/CBYK0keA deBbjymFUUJUlt8K2YzzOMBw261jkYRDSQYeXggTMIiIucvSmI8uKzjoAEcrahHgbOLE r9c4SuKso9vyw+mzixRWfsVxBKkE8GJD6JPlI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796207246; x=1796812046; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=U1NESYJ312wMPFtqirzQCIaVGKA9K71amOjg5mZwHsw=; b=MlICtSh/Pa/AF6xx8XJBH35Xz6K8f2DIWUZan3Z2WvpWvIPl+hZB6y2VdmE53+7o1e 2KkiEaViJePQxk+m51cFaj82AfeA/2s/YxBvB2otIq7GUb8VILTW88H+paATXmfugmru /Bs5JH3LOermaer681SxPYaVgg5NPbS7GpbiIIaE5XH+TPw/mkXnIsipoi6qZX86GMjx iA7GCOLtAzfR/2t5ifHfxgc0cgHHj6Xf8qTpy5d58CBMaA5W2gcLKO9MPeXctFmAUXu3 WonxaZjys9Mm/FhSv7PKZaHLMoTDzcQVCD1vTxdEe3P3YX1dK5ToD+QZn1TztZp2SCWp D5Uw== X-Gm-Message-State: APuU4Z9G1SDxMD/0PTo2Ls/CJ8fcxtTWGb8FNhUquTwm7oScdvTHTWha YUNU1S0iJOLyROmwzqQ7zInvuF9bWKc2MP4dju17FkOPJY9jlvisIjmdypE/z4q+0wPLMITXO4j S8NI8 X-Gm-Gg: AZFdTZfkM5r2fGvRQkDQKnSk9UWMSynohyEopFua8upDzB2koiIFHwqqnNNiZjxDJHl QUaczNZPURfdRQN9C7MXmVw18A+ZqyRKujEzsHuM5qtiwiMkBnNSsqaojPNRp1qtw9bzvjudQrz /I1vujlL5WNkUv8i0CgAeQm7td4KRxqZjtXgvcQW1pi/xsCHgFWFouK8I9DvgxJjNKxgre0qiYa TW5arHx3iAzqljHMe8OqB3LroZz3X8ocwKfiKSaYmcvmTDDaz5Q5qhZI27GtpPvSNiOHeuQUh0v 07klcmaueZnixnGSIjJ/dzH4jmsjJW2jMX8DXwjGQTyaSry0ox5Nf7ZSdW0zUQIPfPybOqi3LFW KuGzhocyCion77UF7E069ti2utXvoRXBc5x+3FhuZSmaslYeZCdGogGtTUDOFZB9X+E18NKszSz wV/nZPZJyEi6g8S5kwPUFlkdDLwUd3NRsLSmZ3cYOzJowf33NE/ww3WVWcN8JzuyEaM3jdSkBYo OeIMdcWeTEA6YSZgXww98nkF0+ypNBqzn8XaX9b4ms1NDfWUM7BdvzVebv9CMcJMd0mzrJWA4dO D1PkhJJZIZ/IfbZ1cFc8Skx4cMM1OpXAOHUQoQREBu6xrpNta3N04Gg4zIOOMNyOlXztQAMUX/d 9yuzV9Rs2DaOc7wu+HvxhPSXFSq2OJeDW8qtvD85lUg== X-Received: by 2002:a05:600c:3b99:b0:4a1:777b:8a12 with SMTP id 5b1f17b1804b1-4bb8880b984mr906083755e9.14.1796207246134; Wed, 02 Dec 2026 02:27:26 -0800 (PST) Received: from localhost.localdomain ([2001:b07:6474:ebbf:6962:3ebc:7df:e6bf]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbbaeb1e4csm366823865e9.13.2026.12.02.02.27.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 02:27:25 -0800 (PST) From: Dario Binacchi To: u-boot@lists.u-boot-project.org Cc: Heiko Schocher , linux-amarula@amarulasolutions.com, Peng Fan , simon.holesch@bshg.com, Marek Vasut , Valeriy.Yatsenko@bshg.com, Leonhard Hesse , michael@amarulasolutions.com, Miquel Raynal , Dario Binacchi , Brian Ruley , Lukasz Majewski , Tom Rini Subject: [PATCH v3 01/26] clk: ccf: enable the critical clocks when they are registered Date: Wed, 2 Dec 2026 11:26:12 +0100 Message-ID: <20261202102716.572884-2-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261202102716.572884-1-dario.binacchi@amarulasolutions.com> References: <20261202102716.572884-1-dario.binacchi@amarulasolutions.com> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.u-boot-project.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: U-Boot discussion List-Archive: List-Post: List-Help: List-Subscribe: , X-Spam-Status: No, score=-18.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 CLK_IS_CRITICAL only prevents clk_disable() from gating a clock. Since nobody enables a critical clock, its parents don't account for it, and a parent shared with other clocks is disabled as soon as its last non-critical user goes away, e.g. on reparenting. On the i.MX8MN this turns SYS_PLL2 off while the display clocks are set up, and the system hangs. Enable the critical clocks as soon as they get an ID, as Linux does at registration, so that their whole parent chain is accounted for. Signed-off-by: Dario Binacchi --- (no changes since v2) Changes in v2: - Add patch, replacing "clk: imx8mn: Mark IMX8MN_SYS_PLL2 and IMX8MN_SYS_PLL3 as enabled" with a generic solution drivers/clk/clk.c | 15 +++++++++++++++ include/linux/clk-provider.h | 12 ++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index b8c2e8d531b9..1e735c8fb2b4 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -13,6 +13,21 @@ #include #include #include +#include + +/* Let the parents of a critical clock account for it, as Linux does */ +void clk_enable_critical(struct clk *clk) +{ + int ret; + + if (!(clk->flags & CLK_IS_CRITICAL)) + return; + + ret = clk_enable(clk); + if (ret) + log_warning("%s: failed to enable critical clock %s (%d)\n", + __func__, clk->dev->name, ret); +} int clk_register(struct clk *clk, const char *drv_name, const char *name, const char *parent_name) diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 366f2d968a33..c09f56b2b57d 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -15,17 +15,25 @@ struct udevice; +void clk_enable_critical(struct clk *clk); + /* update clock ID for the dev = clock provider, compatible with CLK_AUTO_ID */ static inline void dev_clk_dm(const struct udevice *dev, ulong id, struct clk *clk) { - if (!IS_ERR(clk)) + if (!IS_ERR(clk)) { clk->id = CLK_ID(dev, id); + if (CONFIG_IS_ENABLED(CLK_CCF)) + clk_enable_critical(clk); + } } static inline void clk_dm(ulong id, struct clk *clk) { - if (!IS_ERR(clk)) + if (!IS_ERR(clk)) { clk->id = CLK_ID(clk->dev, id); + if (CONFIG_IS_ENABLED(CLK_CCF)) + clk_enable_critical(clk); + } } /* -- 2.43.0