Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp652391rwi; Thu, 27 Oct 2022 06:09:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Sxo4TqvpVsBT05ur8alshxd3qlRsJnS9hg80tTt568wy5rA6lpzBpDd6Zp84FdxLlc9Em X-Received: by 2002:a17:90a:1c02:b0:1e0:df7:31f2 with SMTP id s2-20020a17090a1c0200b001e00df731f2mr9855837pjs.222.1666876175590; Thu, 27 Oct 2022 06:09:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666876175; cv=none; d=google.com; s=arc-20160816; b=Juy6+ZmnIFehMhl9lsWK+bOauG3c3x22uBFI1VXtSMEluv6VobOAk17eWk9Qfq7ziK ybfXsU0aU4JsxDo2d2FQbw8+jB7vWdYiQCr1on3OOkP+uagx3hZ2SpvOBllOAYo94UZ3 hHDBTceAH2Jiyl4u9DZhMDF3lf4Tw8FoKuTCD4DmqU5jD5jTXKz6n0XQzhDuNsFJfkp8 T/qL9vbucju/Zyx1AAK8EgS81Q80qm4Kpa8RFks7QfcF2hFfkAQmnos0HM9a4SZ1xMn4 n5/B6vnnr2nuLJBHyqMUvE3x5ShYFk3KSCOanf5dTJxQv0psYdGdN3rUMiMDwJLpaQeB Qqaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:cc:to:subject:from:date :dkim-signature; bh=YOr1T8oUsQJZkpF+Sk2DjoRqQo5I98igHbDnsfrbCqo=; b=0RkJyWxKu9XUvWP7tehe9IFOMMnV2WXWUChjAfFQYzLd0L8DinK7+C094MhvSmTUGe juOVCRsOkzHxDNCZYXdekc3HzsqNhsCDwsR07uUyWrcrNrXgHI1F5PQstm02S9kU8TCX uiW9oteZNuuGUZOJLtic+kRYENMsZawkIweN6J/oPy2Vrg0gT6LFFqcBXzz6aZneF9mm HQooJ5rc8TJ4fF/EQbyhE8r4gQjERD+LoU4qznGITp71doBXzTdHQnOTELZ10FVvpBzG DOPcckHVbgqLp0QgJeY2GY2DnifFfBSJxzoQk0axOtymgj+iHxLJFfaKeXGa2+QPDUxf hhMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=nR+TbAS6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jh1-20020a170903328100b00178a33faa42si1533464plb.66.2022.10.27.06.09.23; Thu, 27 Oct 2022 06:09:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=nR+TbAS6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235736AbiJ0Mks (ORCPT + 99 others); Thu, 27 Oct 2022 08:40:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235732AbiJ0Mkh (ORCPT ); Thu, 27 Oct 2022 08:40:37 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B427E4054A; Thu, 27 Oct 2022 05:40:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666874428; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YOr1T8oUsQJZkpF+Sk2DjoRqQo5I98igHbDnsfrbCqo=; b=nR+TbAS6AHbixwsYdua78ljTgzQOFLJ8e15C2xlmY68dyuW7WWYWy25XNK2jU2/j2wAvEC cknQK9IcRfhbYjYunFKr6me4iMmzLPIUcFjTo9vMnowF3flgDTnQPQfHsFxMWz51BBhNR7 QK6mlOmrohS0wIqYTiXqz+7NS4ntwRI= Date: Thu, 27 Oct 2022 13:40:17 +0100 From: Paul Cercueil Subject: Re: [PATCH v2 3/6] clk: ingenic: Add .set_rate_hook() for PLL clocks To: Aidan MacDonald Cc: mturquette@baylibre.com, sboyd@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, zhouyu@wanyeetech.com, linux-mips@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Message-Id: <5JWEKR.5UVVAJI6C2MK@crapouillou.net> In-Reply-To: <20221026194345.243007-4-aidanmacdonald.0x0@gmail.com> References: <20221026194345.243007-1-aidanmacdonald.0x0@gmail.com> <20221026194345.243007-4-aidanmacdonald.0x0@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Aidan, Le mer. 26 oct. 2022 =E0 20:43:42 +0100, Aidan MacDonald=20 a =E9crit : > The set rate hook is called immediately after updating the clock > register but before the spinlock is released. This allows another > register to be updated alongside the main one, which is needed to > handle the I2S divider on some SoCs. >=20 > Signed-off-by: Aidan MacDonald Reviewed-by: Paul Cercueil Cheers, -Paul > --- > drivers/clk/ingenic/cgu.c | 3 +++ > drivers/clk/ingenic/cgu.h | 4 ++++ > 2 files changed, 7 insertions(+) >=20 > diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c > index aea01b6b2764..b6a4d4236c16 100644 > --- a/drivers/clk/ingenic/cgu.c > +++ b/drivers/clk/ingenic/cgu.c > @@ -232,6 +232,9 @@ ingenic_pll_set_rate(struct clk_hw *hw, unsigned=20 > long req_rate, >=20 > writel(ctl, cgu->base + pll_info->reg); >=20 > + if (pll_info->set_rate_hook) > + pll_info->set_rate_hook(pll_info, rate, parent_rate); > + > /* If the PLL is enabled, verify that it's stable */ > if (pll_info->enable_bit >=3D 0 && (ctl & BIT(pll_info->enable_bit))) > ret =3D ingenic_pll_check_stable(cgu, pll_info); > diff --git a/drivers/clk/ingenic/cgu.h b/drivers/clk/ingenic/cgu.h > index a5e44ca7f969..99da9bd86e63 100644 > --- a/drivers/clk/ingenic/cgu.h > +++ b/drivers/clk/ingenic/cgu.h > @@ -46,6 +46,8 @@ > * -1 if there is no enable bit (ie, the PLL is always on) > * @stable_bit: the index of the stable bit in the PLL control=20 > register, or > * -1 if there is no stable bit > + * @set_rate_hook: hook called immediately after updating the CGU=20 > register, > + * before releasing the spinlock > */ > struct ingenic_cgu_pll_info { > unsigned reg; > @@ -61,6 +63,8 @@ struct ingenic_cgu_pll_info { > void (*calc_m_n_od)(const struct ingenic_cgu_pll_info *pll_info, > unsigned long rate, unsigned long parent_rate, > unsigned int *m, unsigned int *n, unsigned int *od); > + void (*set_rate_hook)(const struct ingenic_cgu_pll_info *pll_info, > + unsigned long rate, unsigned long parent_rate); > }; >=20 > /** > -- > 2.38.1 >=20