Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1555079lqp; Mon, 15 Apr 2024 09:38:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUEgaBAuB7BkkPEWSgzTo5VVfQlV8AVaesmq36VVmepWmUk5C/uo/reFxPABPkJXuX6xYXgNiIksSjfhGMmPnr6eKJlnttsyU3+r1UC1g== X-Google-Smtp-Source: AGHT+IGDvOh0J5TuxLtXfzFowN9SLmKUJWA1DvqG8Iak17UwXxoEf7pptuo2uDy3wDl3WGBy6pqo X-Received: by 2002:a17:906:a013:b0:a52:6535:d788 with SMTP id p19-20020a170906a01300b00a526535d788mr2867942ejy.54.1713199125012; Mon, 15 Apr 2024 09:38:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713199125; cv=pass; d=google.com; s=arc-20160816; b=c5RAXZ7Ci3OQuBD+cUaPGdNGG+oJ0GGtD2DA6jkwNifuIUuXWnBXxulC22qF1mKq1G g/UBsaUPtBaswjkVRcJAo9R0tCr5UdqqRMzC9cYqjIVybXYEe40kgNpPzv4MMEzGTPPH vqIRJNxGlxLe2HdEDabz47fUBfpmv/cMG/1IqNQ9/3JbkgT0ePzXRXGq9Nx1JnQnNK9o JW7Bafm0lLV3tWLtOFwT95IummN0mgDs+tJxpFwLtzEy2Qa/rMkBJ4kK3RlvAf9vTiCM s0wkn+/SZrAV7HKoj2QRmejI0w3mFWRUKIMRjWfMeSpAx9zE3e7mFM12xw/zJtoa5ci3 lE2g== 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:references:in-reply-to:message-id :date:subject:cc:to:from; bh=yfoOZ9b3hXCO+RIpdwL+LPYHXHUGkpiDcpgkfffrmm4=; fh=mWEa8kD57fMXkUdPHBEJD6cIWPe6iYGLhbK4K2UH3fw=; b=G86IBnB/Fts3aMjmtWYfMZQq1Np3v0nbRDONUQkZ3gH7FE38Da2EnijbBkDfp3CBSm VfERgFu9B2HobwyLtkr4id2K3OvJSTXgw41Obbkt6r+IQkCfRq6gi30p7RMciRvEGVBU Hlw62sGHOBmme8XrQRTQ/EsVByC31aWCJHOf3ReceDY6Hsx5g9Q7HZxMtuBDcunwqVG3 gIohPmXch2WEOf0ADDUTWAA7VaioMTUAW8BUtT27vexEkO3fH0e6A9Z85TCt1gpC990p SWQMcj9DUegERxweMrGawfQPoXhe7NMAXCglcgyLFUriCTmJGDeHXm4dE9FBIxZKAyra MgaA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-145571-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145571-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id n20-20020a170906089400b00a52043a25casi4730694eje.955.2024.04.15.09.38.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 09:38:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-145571-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-145571-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145571-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id BA5491F20FFE for ; Mon, 15 Apr 2024 16:38:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9FFD785283; Mon, 15 Apr 2024 16:37:16 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC68A84D0F; Mon, 15 Apr 2024 16:37:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713199036; cv=none; b=Nm7RLVSwR5zT6ipuF6ternHLSJgZmk2E5ppou9/djpkYb1gzZiBLC8e/h+n18kenCZN6SCeHa9xT4N6/1OoIxQfNmx8/k1uOU9IC8JBvXZG2tIHrSWOkBcI6IeUOsfigvGRXzT6S1XgmUj2mMa3x4eEksSSJhcpetem5YgIUKXY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713199036; c=relaxed/simple; bh=f6rYvbpMRk0zMKV+IFoHYzZ1EY90ZTkLFXL72ExvXuQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a9M9zUGUkBILSIq00MktTRKBNtbWA4tVIUjN17pJ75GhaTrW4JUvel6qFVy7ewH8E8ZxiVOA+vkSNojCN0Gn7up+P189KGHrjluQ7i/8vKtQTiM93NwIKsjwByz+xJzynX9/rA/aXLw+2P1Uym5ssLiI5uqmkuRWT6kZ0lsYsQ4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CEF331476; Mon, 15 Apr 2024 09:37:42 -0700 (PDT) Received: from pluto.fritz.box (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1FB493F64C; Mon, 15 Apr 2024 09:37:12 -0700 (PDT) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org Cc: sudeep.holla@arm.com, james.quinlan@broadcom.com, f.fainelli@gmail.com, vincent.guittot@linaro.org, peng.fan@oss.nxp.com, michal.simek@amd.com, quic_sibis@quicinc.com, quic_nkela@quicinc.com, souvik.chakravarty@arm.com, mturquette@baylibre.com, sboyd@kernel.org, Cristian Marussi Subject: [PATCH v3 4/5] clk: scmi: Add support for re-parenting restricted clocks Date: Mon, 15 Apr 2024 17:36:48 +0100 Message-ID: <20240415163649.895268-5-cristian.marussi@arm.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240415163649.895268-1-cristian.marussi@arm.com> References: <20240415163649.895268-1-cristian.marussi@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Some exposed SCMI Clocks could be marked as non-supporting re-parenting changes. Configure a clk_ops descriptor which does not provide the re-parenting callbacks for such clocks when registering with CLK framework. CC: Michael Turquette CC: Stephen Boyd CC: linux-clk@vger.kernel.org Signed-off-by: Cristian Marussi --- v2 --> v3 - using SCMI_CLK_PARENT_CTRL_SUPPORTED instead of _FORBIDDEN --- drivers/clk/clk-scmi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/clk/clk-scmi.c b/drivers/clk/clk-scmi.c index ba234b56f742..ce0f26ee632f 100644 --- a/drivers/clk/clk-scmi.c +++ b/drivers/clk/clk-scmi.c @@ -21,6 +21,7 @@ enum scmi_clk_feats { SCMI_CLK_ATOMIC_SUPPORTED, SCMI_CLK_STATE_CTRL_SUPPORTED, SCMI_CLK_RATE_CTRL_SUPPORTED, + SCMI_CLK_PARENT_CTRL_SUPPORTED, SCMI_CLK_FEATS_COUNT }; @@ -254,7 +255,8 @@ scmi_clk_ops_alloc(struct device *dev, unsigned long feats_key) /* Parent ops */ ops->get_parent = scmi_clk_get_parent; - ops->set_parent = scmi_clk_set_parent; + if (feats_key & BIT(SCMI_CLK_PARENT_CTRL_SUPPORTED)) + ops->set_parent = scmi_clk_set_parent; return ops; } @@ -307,6 +309,9 @@ scmi_clk_ops_select(struct scmi_clk *sclk, bool atomic_capable, if (!ci->rate_ctrl_forbidden) feats_key |= BIT(SCMI_CLK_RATE_CTRL_SUPPORTED); + if (!ci->parent_ctrl_forbidden) + feats_key |= BIT(SCMI_CLK_PARENT_CTRL_SUPPORTED); + if (WARN_ON(feats_key >= db_size)) return NULL; -- 2.44.0