From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 19271C77B61 for ; Sun, 9 Apr 2023 14:10:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=sEnc6LwXudQKqTIrAtF0sOJVTP653qUsQm4vtRIUhNQ=; b=bofCtOKKbettcb deWzXh/z7AHOGse5fDwLhilq1J45ZmfPMmrgOxi6oaJPy/mjqhdogjfLdqudQMWzRrRo8eMkO/lAb ibWxrwuymqV+FyDGyDhZGpCRN7uMLV24axmZH+zOal/BCmfTinVUV3jSDvdxFyVt/1dQ5XiGMATUP 6AGGyVHODw/S9Q++aVbwMKDnhd4q9SAtUwrwDntlvB1veW4Dvx+8b5OhCbd9DHydUPq1rRiEIykIY Enqcn381CZpMT8RUe6hdJSNDCuaU+jquBfzheKIse1QOgpVbF1KUfRyaNlzahosKVRMToQG1c70qp ZKj/hr428uEo2r2ahUSQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1plVjo-00DpDf-0y; Sun, 09 Apr 2023 14:09:48 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1plVjl-00DpCl-2Z for linux-arm-kernel@lists.infradead.org; Sun, 09 Apr 2023 14:09:47 +0000 Received: by mail-ej1-x630.google.com with SMTP id sb12so6917518ejc.11 for ; Sun, 09 Apr 2023 07:09:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681049384; x=1683641384; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=4P0D+ScmQTPhvDnEDUsDphPhJjBRKDj6P8P9ohmPrI0=; b=AD9rYZ/KadMf6kAAub38x25eqLTe5RwUrsrys1QDk4QYZ7QxdSspUENnKOEmmeefVO llBuXunPAiHV3mnb30gmn+GcnQN7+0n6QpOPAnIWelG6kRPJ/b1yVPFBFUbdlgsqTw5E k3AnCz4WPo4boeo+MoePQXsRu/meqcGR/4jW1Nkw/znNgfzG1Bwb8/fYC4696RSmCJo7 kEIvJ1jOHBU1v+9LCDMy0Fw7mxm+C2jcpAXV4hMU8J5OpXzp+BiG32cPxrgw4+iRQYmZ XiAg6jh02Wzk1tD0i6DpFjVCT5v/hJ/twDmivWipd53wj2GFgXa1EVFaQyu303o9hJv7 5WVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681049384; x=1683641384; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=4P0D+ScmQTPhvDnEDUsDphPhJjBRKDj6P8P9ohmPrI0=; b=yHEAQh/3zJcbf1VgmJB+9O2pbBzZmJDxILOt7vBr01f74iCopGk1SsLrmN/8YiPYX1 0E/+lp5bbmmXiG4cxrueh4zP5FetvWdqdF7wTF/R2koPNTDXTSPMmmW22SuCYyV/TfaE 5ZE4WNq6zgsjK0pSPnERCYm3wnvOJhvbgTh/e6PCnRSXe15Pf8/H+s/u05st7/LtCGf3 5PKGFm7px1u8KTkeNjOFj7ippX3cOJqRXEsJhmNHfVMKrPtoIyuvgMo6tQ/OmXZuMLYl QFbnmpAMCqgrsPa9KlgdGhl6600bn4dBc48JQyVqxE5qxAapRPWlhv45bxekgkCxytMc OFtg== X-Gm-Message-State: AAQBX9eI+pPz1WJvy+x2e78fpDqqpXDjX62HQ7rKCUSWN57E7OIWWawz Lwy2F8M1a2gxkaVpkYwSqy4+AA== X-Google-Smtp-Source: AKy350aaizqAMP1B8a+hkDvgDqZaifKY+dXQs8AVYmo/kdTvIYuUfSOzHLYFxX5t0Ru57sefPMNYzg== X-Received: by 2002:a17:906:da87:b0:932:3ca:e228 with SMTP id xh7-20020a170906da8700b0093203cae228mr6593363ejb.0.1681049384229; Sun, 09 Apr 2023 07:09:44 -0700 (PDT) Received: from linaro.org ([188.25.26.161]) by smtp.gmail.com with ESMTPSA id dx5-20020a170906a84500b0094a6cf3b642sm640241ejb.142.2023.04.09.07.09.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Apr 2023 07:09:43 -0700 (PDT) Date: Sun, 9 Apr 2023 17:09:42 +0300 From: Abel Vesa To: "Peng Fan (OSS)" Cc: abelvesa@kernel.org, mturquette@baylibre.com, sboyd@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jacky Bai , Peng Fan Subject: Re: [PATCH 2/5] clk: imx: imx8ulp: Add divider closest support to get more accurate clock rate Message-ID: References: <20230331063814.2462059-1-peng.fan@oss.nxp.com> <20230331063814.2462059-3-peng.fan@oss.nxp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230331063814.2462059-3-peng.fan@oss.nxp.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230409_070945_835075_4B1B6FAE X-CRM114-Status: GOOD ( 17.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 23-03-31 14:38:11, Peng Fan (OSS) wrote: > From: Jacky Bai > > If a divider's parent clock has fractional part, it will hard to round out a > more accurate clock rate for this divider, add the 'CLK_DIVIDER_ROUND_CLOSEST' flags > for such divider to get a more accurate clock rate. > > Reviewed-by: Peng Fan > Signed-off-by: Jacky Bai > Signed-off-by: Peng Fan Reviewed-by: Abel Vesa > --- > drivers/clk/imx/clk-imx8ulp.c | 16 ++++++++-------- > drivers/clk/imx/clk.h | 9 +++++++++ > 2 files changed, 17 insertions(+), 8 deletions(-) > > diff --git a/drivers/clk/imx/clk-imx8ulp.c b/drivers/clk/imx/clk-imx8ulp.c > index 89121037a8f0..3cf4b094dfff 100644 > --- a/drivers/clk/imx/clk-imx8ulp.c > +++ b/drivers/clk/imx/clk-imx8ulp.c > @@ -275,14 +275,14 @@ static int imx8ulp_clk_cgc2_init(struct platform_device *pdev) > clks[IMX8ULP_CLK_PLL4_PFD2_DIV2_GATE] = imx_clk_hw_gate_dis("pll4_pfd2_div2_gate", "pll4_pfd2", base + 0x60c, 15); > clks[IMX8ULP_CLK_PLL4_PFD3_DIV1_GATE] = imx_clk_hw_gate_dis("pll4_pfd3_div1_gate", "pll4_pfd3", base + 0x60c, 23); > clks[IMX8ULP_CLK_PLL4_PFD3_DIV2_GATE] = imx_clk_hw_gate_dis("pll4_pfd3_div2_gate", "pll4_pfd3", base + 0x60c, 31); > - clks[IMX8ULP_CLK_PLL4_PFD0_DIV1] = imx_clk_hw_divider("pll4_pfd0_div1", "pll4_pfd0_div1_gate", base + 0x608, 0, 6); > - clks[IMX8ULP_CLK_PLL4_PFD0_DIV2] = imx_clk_hw_divider("pll4_pfd0_div2", "pll4_pfd0_div2_gate", base + 0x608, 8, 6); > - clks[IMX8ULP_CLK_PLL4_PFD1_DIV1] = imx_clk_hw_divider("pll4_pfd1_div1", "pll4_pfd1_div1_gate", base + 0x608, 16, 6); > - clks[IMX8ULP_CLK_PLL4_PFD1_DIV2] = imx_clk_hw_divider("pll4_pfd1_div2", "pll4_pfd1_div2_gate", base + 0x608, 24, 6); > - clks[IMX8ULP_CLK_PLL4_PFD2_DIV1] = imx_clk_hw_divider("pll4_pfd2_div1", "pll4_pfd2_div1_gate", base + 0x60c, 0, 6); > - clks[IMX8ULP_CLK_PLL4_PFD2_DIV2] = imx_clk_hw_divider("pll4_pfd2_div2", "pll4_pfd2_div2_gate", base + 0x60c, 8, 6); > - clks[IMX8ULP_CLK_PLL4_PFD3_DIV1] = imx_clk_hw_divider("pll4_pfd3_div1", "pll4_pfd3_div1_gate", base + 0x60c, 16, 6); > - clks[IMX8ULP_CLK_PLL4_PFD3_DIV2] = imx_clk_hw_divider("pll4_pfd3_div2", "pll4_pfd3_div2_gate", base + 0x60c, 24, 6); > + clks[IMX8ULP_CLK_PLL4_PFD0_DIV1] = imx_clk_hw_divider_closest("pll4_pfd0_div1", "pll4_pfd0_div1_gate", base + 0x608, 0, 6); > + clks[IMX8ULP_CLK_PLL4_PFD0_DIV2] = imx_clk_hw_divider_closest("pll4_pfd0_div2", "pll4_pfd0_div2_gate", base + 0x608, 8, 6); > + clks[IMX8ULP_CLK_PLL4_PFD1_DIV1] = imx_clk_hw_divider_closest("pll4_pfd1_div1", "pll4_pfd1_div1_gate", base + 0x608, 16, 6); > + clks[IMX8ULP_CLK_PLL4_PFD1_DIV2] = imx_clk_hw_divider_closest("pll4_pfd1_div2", "pll4_pfd1_div2_gate", base + 0x608, 24, 6); > + clks[IMX8ULP_CLK_PLL4_PFD2_DIV1] = imx_clk_hw_divider_closest("pll4_pfd2_div1", "pll4_pfd2_div1_gate", base + 0x60c, 0, 6); > + clks[IMX8ULP_CLK_PLL4_PFD2_DIV2] = imx_clk_hw_divider_closest("pll4_pfd2_div2", "pll4_pfd2_div2_gate", base + 0x60c, 8, 6); > + clks[IMX8ULP_CLK_PLL4_PFD3_DIV1] = imx_clk_hw_divider_closest("pll4_pfd3_div1", "pll4_pfd3_div1_gate", base + 0x60c, 16, 6); > + clks[IMX8ULP_CLK_PLL4_PFD3_DIV2] = imx_clk_hw_divider_closest("pll4_pfd3_div2", "pll4_pfd3_div2_gate", base + 0x60c, 24, 6); > > clks[IMX8ULP_CLK_CGC2_SOSC_DIV1_GATE] = imx_clk_hw_gate_dis("cgc2_sosc_div1_gate", "sosc", base + 0x108, 7); > clks[IMX8ULP_CLK_CGC2_SOSC_DIV2_GATE] = imx_clk_hw_gate_dis("cgc2_sosc_div2_gate", "sosc", base + 0x108, 15); > diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h > index bb105d6e5b39..ca1f75eb3197 100644 > --- a/drivers/clk/imx/clk.h > +++ b/drivers/clk/imx/clk.h > @@ -356,6 +356,15 @@ static inline struct clk_hw *imx_clk_hw_fixed_factor(const char *name, > CLK_SET_RATE_PARENT, mult, div); > } > > +static inline struct clk_hw *imx_clk_hw_divider_closest(const char *name, > + const char *parent, > + void __iomem *reg, u8 shift, > + u8 width) > +{ > + return clk_hw_register_divider(NULL, name, parent, 0, > + reg, shift, width, CLK_DIVIDER_ROUND_CLOSEST, &imx_ccm_lock); > +} > + > static inline struct clk_hw *__imx_clk_hw_divider(const char *name, > const char *parent, > void __iomem *reg, u8 shift, > -- > 2.37.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel