U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sumit Garg <sumit.garg@kernel.org>
To: Loic Poulain <loic.poulain@oss.qualcomm.com>
Cc: lukma@denx.de, casey.connolly@linaro.org,
	neil.armstrong@linaro.org, trini@konsulko.com, peng.fan@nxp.com,
	jh80.chung@samsung.com, u-boot-qcom@groups.io,
	u-boot@lists.denx.de, Sumit Garg <sumit.garg@oss.qualcomm.com>
Subject: Re: [PATCH 2/3] clk/qcom: qcm2290: Add SDCC1 apps clock frequency table
Date: Fri, 12 Dec 2025 10:00:28 +0900	[thread overview]
Message-ID: <aTtpLOP2WGkmoUQd@sumit-X1> (raw)
In-Reply-To: <20251210155454.1561611-2-loic.poulain@oss.qualcomm.com>

On Wed, Dec 10, 2025 at 04:54:53PM +0100, Loic Poulain wrote:
> Add support for configuring the SDCC1 apps clock on QCM2290 by introducing
> a frequency table and enabling dynamic rate setting. Previously, the clock
> was assumed to be fixed at 384 MHz by firmware, which limited flexibility
> and correctness when selecting optimal rates for SD/MMC operations.
> 
> Suggested-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
> Signed-off-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
> ---
>  drivers/clk/qcom/clock-qcm2290.c | 29 +++++++++++++++++++++++++++--
>  1 file changed, 27 insertions(+), 2 deletions(-)

Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>

-Sumit

> 
> diff --git a/drivers/clk/qcom/clock-qcm2290.c b/drivers/clk/qcom/clock-qcm2290.c
> index fad104fb91a..5a599085b50 100644
> --- a/drivers/clk/qcom/clock-qcm2290.c
> +++ b/drivers/clk/qcom/clock-qcm2290.c
> @@ -17,6 +17,8 @@
>  
>  #define QUPV3_WRAP0_S4_CMD_RCGR 0x1f608
>  #define SDCC2_APPS_CLK_CMD_RCGR 0x1e00c
> +#define SDCC1_APPS_CLK_CMD_RCGR 0x38028
> +
>  
>  static const struct freq_tbl ftbl_gcc_qupv3_wrap0_s0_clk_src[] = {
>  	F(7372800, CFG_CLK_SRC_GPLL0_AUX2, 1, 384, 15625),
> @@ -55,6 +57,25 @@ static const struct pll_vote_clk gpll7_clk = {
>  	.vote_bit = BIT(7),
>  };
>  
> +static const struct freq_tbl ftbl_gcc_sdcc1_apps_clk_src[] = {
> +	F(144000, CFG_CLK_SRC_CXO, 16, 3, 25),
> +	F(400000, CFG_CLK_SRC_CXO, 12, 1, 4),
> +	F(20000000, CFG_CLK_SRC_GPLL0_AUX2, 5, 1, 3),
> +	F(25000000, CFG_CLK_SRC_GPLL0_AUX2, 6, 1, 2),
> +	F(50000000, CFG_CLK_SRC_GPLL0_AUX2, 6, 0, 0),
> +	F(100000000, CFG_CLK_SRC_GPLL0_AUX2, 3, 0, 0),
> +	F(192000000, CFG_CLK_SRC_GPLL6, 2, 0, 0),
> +	F(384000000, CFG_CLK_SRC_GPLL6, 1, 0, 0),
> +	{}
> +};
> +
> +static const struct pll_vote_clk gpll6_clk = {
> +	.status = 0x6000,
> +	.status_bit = BIT(31),
> +	.ena_vote = 0x79000,
> +	.vote_bit = BIT(7),
> +};
> +
>  static const struct gate_clk qcm2290_clks[] = {
>  	GATE_CLK(GCC_AHB2PHY_USB_CLK, 0x1d008, 0x00000001),
>  	GATE_CLK(GCC_CFG_NOC_USB3_PRIM_AXI_CLK, 0x1a084, 0x00000001),
> @@ -109,8 +130,12 @@ static ulong qcm2290_set_rate(struct clk *clk, ulong rate)
>  				     8);
>  		return freq->freq;
>  	case GCC_SDCC1_APPS_CLK:
> -		/* The firmware turns this on for us and always sets it to this rate */
> -		return 384000000;
> +		clk_enable_gpll0(priv->base, &gpll6_clk);
> +		freq = qcom_find_freq(ftbl_gcc_sdcc1_apps_clk_src, rate);
> +		clk_rcg_set_rate_mnd(priv->base, SDCC1_APPS_CLK_CMD_RCGR,
> +				     freq->pre_div, freq->m, freq->n, freq->src,
> +				     8);
> +		return freq->freq;
>  	default:
>  		return 0;
>  	}
> -- 
> 2.34.1
> 

  reply	other threads:[~2025-12-12  1:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-10 15:54 [PATCH 1/3] mmc: msm_sdhci: Fix incorrect divider calculation for SDCLK Loic Poulain
2025-12-10 15:54 ` [PATCH 2/3] clk/qcom: qcm2290: Add SDCC1 apps clock frequency table Loic Poulain
2025-12-12  1:00   ` Sumit Garg [this message]
2025-12-10 15:54 ` [PATCH 3/3] mmc: msm_sdhci: Add DLL control hook to disable DLL below 100 MHz Loic Poulain
2025-12-12  0:59 ` [PATCH 1/3] mmc: msm_sdhci: Fix incorrect divider calculation for SDCLK Sumit Garg
2026-01-16 18:03 ` Casey Connolly

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aTtpLOP2WGkmoUQd@sumit-X1 \
    --to=sumit.garg@kernel.org \
    --cc=casey.connolly@linaro.org \
    --cc=jh80.chung@samsung.com \
    --cc=loic.poulain@oss.qualcomm.com \
    --cc=lukma@denx.de \
    --cc=neil.armstrong@linaro.org \
    --cc=peng.fan@nxp.com \
    --cc=sumit.garg@oss.qualcomm.com \
    --cc=trini@konsulko.com \
    --cc=u-boot-qcom@groups.io \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox