From patchwork Wed Jul 29 14:51:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 1338353 X-Patchwork-Delegate: eugen.hristev@microchip.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=AEz7OFOC; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BGxNc6pn1z9sSt for ; Thu, 30 Jul 2020 00:52:48 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0EE1A82608; Wed, 29 Jul 2020 16:52:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.b="AEz7OFOC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 60F15825F0; Wed, 29 Jul 2020 16:52:04 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from esa2.microchip.iphmx.com (esa2.microchip.iphmx.com [68.232.149.84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0A1F9825CC for ; Wed, 29 Jul 2020 16:51:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=Claudiu.Beznea@microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1596034318; x=1627570318; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=kIuloHc5Ra+t3RbYXRO0M8gXW39JydSffLbbBi+yaLQ=; b=AEz7OFOCKnS6/EeIf8+bgAz3zSkseGAM80kMs67T/TVpsq/qbra+Qk1M dfjgD5k5hoqbYnxOoySZQtGoHb8nc7zXjmtgq6oCVDeeI0LYEWnsuPyYJ L3r8NAIAsOG63ou2Vq8WL1lLb1oQoIuISu29MlRSdk9xz66n4HnM33bod MMPBQVbO/xWOopc9NxY4YnUtdZWWrc9CTW+qAjKVZS2k9CJ0AmZuNhzl2 GjUh/saYn+eU1WZFK+SOub8gQiZyE3gDdLW5AMhriuU4BVlssajK3LHFx DlAb6vZYBd29jnI4yveWWMiFE6C1T3qvZUOmnKHjPcd8gvTsN/Pl4pKq7 Q==; IronPort-SDR: JqnGoW8NS45Ov9LamMsBLWUXI6QQH8x1VIS7hfmFabNUwgrl+quTS6QnHU1fR+tByIvcc29M35 p0w4gop2Pf/YDhhqeq6i+EAkcuGnHyCJQNK1nmBob2XS76nKqXI790o27fCsjwJT6qtT86bG+q Em0fd1RRreC0g12+ZzzqoqfOnvieYMCXIPbCsbPwngxa/I6AbruS08la2l9/VbMQ1BVb/PqfZt iuxAzItFzWQxgnwwYhFXANVttASfl/hl79TPOSyJ2Dkr9zddqNWl4S3MM5IT8XG7O4LwFoFYMF aXs= X-IronPort-AV: E=Sophos;i="5.75,410,1589266800"; d="scan'208";a="83667379" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 29 Jul 2020 07:51:56 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 29 Jul 2020 07:51:08 -0700 Received: from m18063-ThinkPad-T460p.microchip.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Wed, 29 Jul 2020 07:51:53 -0700 From: Claudiu Beznea To: , CC: , Subject: [PATCH 05/22] clk: do not disable clock if it is critical Date: Wed, 29 Jul 2020 17:51:24 +0300 Message-ID: <1596034301-5428-6-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1596034301-5428-1-git-send-email-claudiu.beznea@microchip.com> References: <1596034301-5428-1-git-send-email-claudiu.beznea@microchip.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Do not disable clock if it is a critical one. Signed-off-by: Claudiu Beznea Reviewed-by: Simon Glass --- drivers/clk/clk-uclass.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index b390a6b01c06..958a9490bee2 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -605,6 +605,9 @@ int clk_disable(struct clk *clk) if (CONFIG_IS_ENABLED(CLK_CCF)) { if (clk->id && !clk_get_by_id(clk->id, &clkp)) { + if (clkp->flags & CLK_IS_CRITICAL) + return 0; + if (clkp->enable_count == 0) { printf("clk %s already disabled\n", clkp->dev->name);