Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp234939rdb; Thu, 22 Feb 2024 01:55:55 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX1oYFARahq5rdGaVRCQIIXslROkrgsagsxuZgyMTrsTz3ZUAFgR2cs8jUCWJ0jjYfqoWS0DTu8XoyVg3j5Neg0kP7SLwAY9XMWCi8ynA== X-Google-Smtp-Source: AGHT+IGl/wPZDCo/TRO+9O4ZtEgymTX+PJaIr6EcYxti1LX2/Y7YW+FYQpV/9qdSRgSyJ58pyXaX X-Received: by 2002:a05:622a:1007:b0:42c:5d43:7e77 with SMTP id d7-20020a05622a100700b0042c5d437e77mr26388602qte.7.1708595755298; Thu, 22 Feb 2024 01:55:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708595755; cv=pass; d=google.com; s=arc-20160816; b=XMbvQ0loUNM8PVWxu3M2J0D2/PbHI1qSsxckMnNKOmt+IVRnJfiUusfcjELy9RYB0Q M0zUPOlHZyVi2WgJvtDr9w9QDFiZsWtusoT2NdkSASngS6h+ofG22aMDO1mHMp3WlTnG g6tMXwFT6dCC9SxCEvvmg3Fm9MKDrtymEGLnpfHp86UdXIcW8cwxcnU2kq9dpYZ9OdZH 3O7pPyvxXYfBtJED1HBJCx6k2QncS06tNv8bJK9jc0BZqsig9PvjwV0ULsNk4l/fAp5I 7EPgYms4CV41uMivQ7hQpMe6KPJRfTNXJ5ErhdLly2ghfIhRiOg8mxa7shTKDldS1PdJ IycQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=hDgJvn3UKnod0BBvLS1kJnkgb3lhg5PWcWYbVLzgHyU=; fh=dp0yn4H10ULieKxWW9kFlKzkKYGHkd1FmVBKYaNJzYI=; b=GmOMBTIjfowOY7ON4XF2wNeHQncyEb8Wn364EUal5NWB3m12pNPa1uhsdBJAjx3l9u Y1aEaMp5N3zD94+EBlDFtw7Qp0BTV9AZEyyOSqAlMIpI0rxaEK48F/jrr/MAfxAVDcgu JluuOZ9W2nz3R74Wgso4DGmSPhgTFmjFNgBXNqkxxvcil/5DSd//xXo7kh/vWrs631I2 fgynUz9K98oMgCBt8KXdi8yOzawD8CxCdOLUg6fT8gfl92ZJSDE440t6Ypgwu5bEvQDj 6XyBxRM+O/GvmM7KSuR+p2ukSld2MLQPYGsD1xO2fZUqCeB1wq61CT/jUsRt+MfrdFbe 6LxA==; 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-76277-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76277-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id v38-20020a05622a18a600b0042e5574056fsi319257qtc.188.2024.02.22.01.55.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 01:55:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76277-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; 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-76277-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76277-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C8B0F1C2446D for ; Thu, 22 Feb 2024 09:55:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D8DCA38FAA; Thu, 22 Feb 2024 09:55:31 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A51BD1799E; Thu, 22 Feb 2024 09:55:29 +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=1708595731; cv=none; b=MRYZnIeUgVdTqoGCjjFT0Cdzwh+L8Q8L/MRZng5KyXN5sQmUPoVe5Swd+CsaCASusbAupEU/EoTqHxiiCg48bAZWbseeG7b2fXEWjhhYJkCgdQ0vfEtOpwP+hb5t83A5PjjYdEr5RP1UCpfNQZMpGrazBD6q2W0rTevGm8/bUKo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708595731; c=relaxed/simple; bh=zUT+seqiqb4QBcPutc6UO7JPuLUYjnGX3rqt10DwDoY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hmhEbjDj/pKEWVifCjmLY5UuytXKo7bV/RNLs4bhNKXLwSOOiiBR7lD8jbHFLhmVaW7ldpdplxP5UUN0rDpqVgYuUd1qOpAl6KFq8YSVt3UI5xrNNJKXspUNREuc/6M1gkNrlF2UZpDvOJqHMHGOrSC1/rob54yjGgLj4k+NrEE= 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 33559C15; Thu, 22 Feb 2024 01:56:07 -0800 (PST) Received: from pluto (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 99F803F766; Thu, 22 Feb 2024 01:55:27 -0800 (PST) Date: Thu, 22 Feb 2024 09:55:25 +0000 From: Cristian Marussi To: Sudeep Holla Cc: "Peng Fan (OSS)" , mturquette@baylibre.com, sboyd@kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Peng Fan Subject: Re: [PATCH V4 2/2] clk: scmi: support state_ctrl_forbidden Message-ID: References: <20240121110901.1414856-1-peng.fan@oss.nxp.com> <20240121110901.1414856-2-peng.fan@oss.nxp.com> <20240222094153.2nxvefa44y5ikutm@bogus> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240222094153.2nxvefa44y5ikutm@bogus> On Thu, Feb 22, 2024 at 09:41:53AM +0000, Sudeep Holla wrote: > On Sun, Jan 21, 2024 at 07:09:01PM +0800, Peng Fan (OSS) wrote: > > From: Peng Fan > > > > Some clocks may exported to linux, while those clocks are not allowed > > to configure by Linux. For example: > > > > SYS_CLK1----- > > \ > > --MUX--->MMC1_CLK > > / > > SYS_CLK2----- > > > > MMC1 needs set parent, so SYS_CLK1 and SYS_CLK2 are exported to Linux, > > then the clk propagation will touch SYS_CLK1 or SYS_CLK2. > > So we need bypass the failure for SYS_CLK1 or SYS_CLK2 when enable > > the clock of MMC1, adding scmi_no_state_ctrl_clk_ops to use software > > enable counter, while not calling scmi api. > > > > Co-developed-by: Cristian Marussi > > Signed-off-by: Cristian Marussi > > Signed-off-by: Peng Fan > > --- > > > > V4: > > Add scmi_no_state_ctrl_clk_ops per Cristian > > Add Cristian's tag > > > > V3: > > Add check in atomic enable > > > > V2: > > New. Take Cristian's suggestion > > > > drivers/clk/clk-scmi.c | 15 +++++++++++++-- > > 1 file changed, 13 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/clk/clk-scmi.c b/drivers/clk/clk-scmi.c > > index 8cbe24789c24..5747b6d651f0 100644 > > --- a/drivers/clk/clk-scmi.c > > +++ b/drivers/clk/clk-scmi.c > > @@ -194,6 +194,15 @@ static const struct clk_ops scmi_atomic_clk_ops = { > > .determine_rate = scmi_clk_determine_rate, > > }; > > > > +static const struct clk_ops scmi_no_state_ctrl_clk_ops = { > > + .recalc_rate = scmi_clk_recalc_rate, > > + .round_rate = scmi_clk_round_rate, > > + .set_rate = scmi_clk_set_rate, > > + .set_parent = scmi_clk_set_parent, > > + .get_parent = scmi_clk_get_parent, > > + .determine_rate = scmi_clk_determine_rate, > > +}; > > + > > static int scmi_clk_ops_init(struct device *dev, struct scmi_clk *sclk, > > const struct clk_ops *scmi_ops) > > { > > @@ -290,8 +299,10 @@ static int scmi_clocks_probe(struct scmi_device *sdev) > > * specify (or support) an enable_latency associated with a > > * clock, we default to use atomic operations mode. > > */ > > - if (is_atomic && > > - sclk->info->enable_latency <= atomic_threshold) > > + if (sclk->info->state_ctrl_forbidden) > > + scmi_ops = &scmi_no_state_ctrl_clk_ops; > > With this, even if is_atomic and latency matches, we won't allow > atomic operations ? One reason why it gets tricky and as Cristian > mentioned elsewhere we need dynamic assignment of these ops IMO. > Let me know if I am getting things wrong here ? It is fine that we wont allow atomic ops either since state_ctrl_forbidden means the server will reject any enable/disable action, atomic or not...what I missed here, though, is that we lost also is_enabled indeed, which could be provided even if state_ctrl_forbidden BUT only if atomic is supported...so yes this will need an additional atomic/non_atomic split of this static ops...and so the need for dynamic allocation I was saying elsewhere....indeed the is_enabled case is handled correctly again with my pending clk dynamic allocation of ops patch. My bad, thanks for spotting this Sudeep! Cristian