From nobody Sat Jun 13 00:40:54 2026 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 623F53FBB66 for ; Tue, 9 Jun 2026 10:59:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781002775; cv=none; b=THRsuSqnwieD20q4NQDcudTVHs+tBrrgQm3p8W/Jwa74FtUDfUIsZaOSgeKYsk3+6zgo4YJoZiGumxOoGZcoaTsknpwCuFFEMNG5p/CtsQKwAOgi4AE1Y8MI3V2Ukqpz3pdw6KBos0/vTsLEmnZAaA2hhMyfYznOXUweTWWk7x4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781002775; c=relaxed/simple; bh=b12c6iLXA4awrYB8q5Y8WnRZMEHvy5W3/61wkBqgDSE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rdlhCXH32cPP5Gs5S9VNNq38k3V1a3t+nmBiyUvWrumJyyoeAoHANtLjg4oVi7Hmx3u4Ukq2ahl+MYuMc38i27w9eoFWw5zClhhhhe7mSa8l2cr/JZKCiwLZdxUU5I7IWdZ/tSrPiZM6jaJwdypqOpuRLd7eqA2lQVLNpqqSxWI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=jvO46vda; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jvO46vda" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-490b64c8311so60241975e9.3 for ; Tue, 09 Jun 2026 03:59:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781002772; x=1781607572; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2ft0f5hArd103x4WKKQghd8evqBTe2UKtulu4qdVwWY=; b=jvO46vdaY+XxZ/k+EPYwtNeYo3jqPTvnjRcGOyHT09aqHAYz9hw9vPMguZH1Sm5cj9 sAQWuPY2ryMrHAiaENoJXLOZn5UT0/JBuESXn+sH7sEBG9HEpVCGU/K/CI2CoH4eYLDZ 8LbKQ/2U/tq3cqxTSAUCcqKYVCnffq2wVb64vpJ1N+M97uaA1+DcyCEbdO0sM0KqHq3n /gbvMLx0KtldwnHKCt3NmH+9rKbJlhmGck7l87sUj5W57sVjNefvYBSLCYvuOqpSw61y 9xQaU4URoySjJwqFm2T1Ucv9YQ9LhsAEyn288d9xAyUsXW68WvK8Uwcqr3QNFb4ldcHm zTyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781002772; x=1781607572; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=2ft0f5hArd103x4WKKQghd8evqBTe2UKtulu4qdVwWY=; b=WgbAM/xosx7DYtwNgF/AcJnv7jZsDzvtI5pZKiaxE7fkffERgnwt/8Amgt9rfTwRNh fXnfkT4OAVtsMLZKL1Ccqzn4zDyyg05kcl7uw8vOaocXTKCd093ALFiwZtGkH7CbpZpV cM8Z2C0R4hocVsGJvk85nEfWBijzCRFJkMtY+4IK6qNNhn965MYh7V3VmyiaEiIL80FZ 4bVSkuO3uXjofoJ/37IkUR5ottg/KOOPfujvXN0GtdBF8abrOzRftMzSi3zalAXB34it ZfE/uNu/yohz70u9zzGGPJxyaLMnJF2EGqvZpeDaJnJQHc9hBRLp7GuJ8DVa/drwhjk2 XNGQ== X-Gm-Message-State: AOJu0YwpCDkKsaTCddBbxE2O3eyVlH8i9rl9kBoj/uWIR/AiTNosrZKV EyjMxhptO1DwFIw4424QJ1CVxp4n1xbeldFdVDZQCewScGBH/ZMI97iz X-Gm-Gg: Acq92OEaGTi34Pid/yUaeTXGcE06xCCjo05OygxDSijSqyrlZrOvCCRxfI7R33RC4pO kkxD7Avwgx2Yvzd3FaElTNsMZhPT1hJeNB0Iqqe9J/OPbXzlzry+Z1kS38UAxmlJ625WIsvUhzE SxdiFfGfqTChf0Vx66KJGAt9HTxMC1C4V33kZRlIA0J8eBeQi7ZoJ2+fYthcu/JkY+sCIFKT0V6 6FvtpMhGev6WVkpfbiWAxElj5nnouNKlXuMEBj9pFp4arsxn1BA8dJIFA+RiN6WedkDfYe6Dwet +OHhI1yNmdBnOIJkIXQNemxJUgKAIMGGsIrEgPRpxU52kdHMLcH5vCcwPViu6/jYfd9irZhT6Fp jeCGyADeSdO9vvU0+ppi5YpKWskXxTiMqz9G3YJDKOaxgC2P8OKT/DYpRtyTuyIQi/+T2AdUV3K f3B1uOdoLps4j+pnYHGl0opmytSj1cCuwbm2xkvlMXQexqdY4IkRUDjyiajnF/8Ap3ok7Iq27xn XfygR/vEFCmZxSjfgAnKBND+M3X7zldRlYJ8E+SSPUVPt4ANS36yPKDmQ== X-Received: by 2002:a05:600c:82c3:b0:490:9782:3eb8 with SMTP id 5b1f17b1804b1-490c25f4963mr307728995e9.25.1781002771771; Tue, 09 Jun 2026 03:59:31 -0700 (PDT) Received: from iku.example.org ([2a06:5906:61b:2d00:2b2d:6009:3bbe:fb84]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490bc3d663csm524250635e9.11.2026.06.09.03.59.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2026 03:59:30 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Michael Turquette , Stephen Boyd , Brian Masney , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm Cc: linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v2 1/5] clk: renesas: rzv2h-cpg: Use per-SoC PLL reference frequency for calculations Date: Tue, 9 Jun 2026 11:59:20 +0100 Message-ID: <20260609105924.962573-2-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260609105924.962573-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20260609105924.962573-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Lad Prabhakar Introduce a per-SoC PLL reference input frequency parameter to avoid relying on a hardcoded 24MHz constant during PLL configuration math. Add an input_fref member to struct rzv2h_pll_limits. In the core calculation helper rzv2h_get_pll_pars(), derive the base input clock rate from limits->input_fref, utilizing the conditional ternary operator to fall back to 24MHz if the struct field is left uninitialized (0), and drop the obsolete macro RZ_V2H_OSC_CLK_IN_MEGA. This abstraction permits the reuse of the common PLL divider logic on newer SoC platforms like the RZ/T2H, which feature a 48 MHz PLL reference clock input instead of the 24 MHz signal used by RZ/V2H(P), without disrupting existing platforms. Signed-off-by: Lad Prabhakar --- v1->v2: - Dropped RZ_V2H_OSC_CLK_IN_MEGA macro in favor of direct use of the input_fref field with a fallback. - Updated the doc to specify the default value of input_freq when it is 0. - Updated commit message --- drivers/clk/renesas/rzv2h-cpg.c | 8 ++++---- include/linux/clk/renesas.h | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/clk/renesas/rzv2h-cpg.c b/drivers/clk/renesas/rzv2h-cp= g.c index e271c04cee34..fff89f2bdc0b 100644 --- a/drivers/clk/renesas/rzv2h-cpg.c +++ b/drivers/clk/renesas/rzv2h-cpg.c @@ -218,7 +218,6 @@ struct rzv2h_plldsi_div_clk { #define to_plldsi_div_clk(_hw) \ container_of(_hw, struct rzv2h_plldsi_div_clk, hw) =20 -#define RZ_V2H_OSC_CLK_IN_MEGA (24 * MEGA) #define RZV2H_MAX_DIV_TABLES (16) =20 /** @@ -242,6 +241,7 @@ struct rzv2h_plldsi_div_clk { bool rzv2h_get_pll_pars(const struct rzv2h_pll_limits *limits, struct rzv2h_pll_pars *pars, u64 freq_millihz) { + unsigned long input_fref =3D limits->input_fref ?: (24 * MEGA); u64 fout_min_millihz =3D mul_u32_u32(limits->fout.min, MILLI); u64 fout_max_millihz =3D mul_u32_u32(limits->fout.max, MILLI); struct rzv2h_pll_pars p, best; @@ -254,7 +254,7 @@ bool rzv2h_get_pll_pars(const struct rzv2h_pll_limits *= limits, best.error_millihz =3D S64_MAX; =20 for (p.p =3D limits->p.min; p.p <=3D limits->p.max; p.p++) { - u32 fref =3D RZ_V2H_OSC_CLK_IN_MEGA / p.p; + u32 fref =3D input_fref / p.p; u16 divider; =20 for (divider =3D 1 << limits->s.min, p.s =3D limits->s.min; @@ -335,9 +335,9 @@ bool rzv2h_get_pll_pars(const struct rzv2h_pll_limits *= limits, continue; =20 /* PLL_M component of (output * 65536 * PLL_P) */ - output =3D mul_u32_u32(p.m * 65536, RZ_V2H_OSC_CLK_IN_MEGA); + output =3D mul_u32_u32(p.m * 65536, input_fref); /* PLL_K component of (output * 65536 * PLL_P) */ - output +=3D p.k * RZ_V2H_OSC_CLK_IN_MEGA; + output +=3D p.k * input_fref; /* Make it in mHz */ output *=3D MILLI; output =3D DIV_U64_ROUND_CLOSEST(output, 65536 * p.p * divider); diff --git a/include/linux/clk/renesas.h b/include/linux/clk/renesas.h index 0949400f44de..2aeff01150c3 100644 --- a/include/linux/clk/renesas.h +++ b/include/linux/clk/renesas.h @@ -53,6 +53,9 @@ static inline void rzg2l_cpg_dsi_div_set_divider(u8 divid= er, int target) { } * various parameters used to configure a PLL. These limits ensure * the PLL operates within valid and stable ranges. * + * @input_fref: Reference input frequency to the PLL (in MHz). If set + * to 0, a default value of 24MHz is used. + * * @fout: Output frequency range (in MHz) * @fout.min: Minimum allowed output frequency * @fout.max: Maximum allowed output frequency @@ -78,6 +81,8 @@ static inline void rzg2l_cpg_dsi_div_set_divider(u8 divid= er, int target) { } * @k.max: Maximum delta-sigma value */ struct rzv2h_pll_limits { + u32 input_fref; + struct { u32 min; u32 max; --=20 2.54.0 From nobody Sat Jun 13 00:40:54 2026 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 172CC3F5BCF for ; Tue, 9 Jun 2026 10:59:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781002775; cv=none; b=YrtoDLv0SOSx0pdyKIcFJ7h/Yx2mVMu+GmEG0lwqE5ut6fR04aGEo1PnfV+w8DWL9He56HU9ND2f/ZSafyFWeXfdER4PHdRazu0s3Pp2eCmv+1eWdKt8bYOO2ewUKajXrvvqajN/kt4YUFSE1Z5tZR+qBnyuXjZJ/QSd0jX71tU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781002775; c=relaxed/simple; bh=U7gFYCZBHlMfedCTieRMzQlrxSP71kZGI/WHZLC1yjg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HmeVFCXahgbwzKSSEy1bukk2RbAji1+OjRYmJ817Ak8dEwiozxfTA+E2D2xZiS5M86I5Ck4BmtldzodxPhZbnDp6ic1eaMIfqw0l8XGeIP8b6QGoOEjhfNLBD3wPmTumv+LDltMTlSAK65br/j/rws31yWFOT4ybBeSw7fP/y1E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ll2rxxqF; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ll2rxxqF" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-490b2b037d2so47269475e9.3 for ; Tue, 09 Jun 2026 03:59:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781002772; x=1781607572; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XwC0/BmrWqLN7wfExQfGq6TF8V6hWtX93QQJcQuLNxk=; b=ll2rxxqFGxt/rxdU6+n3LAvlW0lpWoawx9qSNeepSbw8I78aZ8QtGBbZDd/ykQe4Ky Qm1DM/kGhUE3RYzhaBJ/zz+lXf1TxFLEdGFy5QbIOD3rn7krz+gqiz5P+af+ZePbY+yb zlKTOj8xWyflfqkH4YdNQvxlTROhk99rF/5lv4IpPuA1MZNCUyLPATfX+h7DA+NcbXmU UeNSGx80LP11EApntHjNiVu0XBUgKrzGiVpGE0VyecbO5oo8PrQQYYLE2zIyvXxwfny1 K8UdGE0d9MKjegaLTIVpdpAEPF2+r6UxccOmocPSihlLzhvsKIMEDV6CA9LIF50r4GO+ W0+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781002772; x=1781607572; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=XwC0/BmrWqLN7wfExQfGq6TF8V6hWtX93QQJcQuLNxk=; b=kygF94xGeQOb78X+XQyNfUBJiSjSgjX9r2QdyOtkNtq10jPe+hru6YwdtGi+SF/Bmt nqgZiiDNweRFbu6reqjBMbHKbSTnDHFKQir00FH3aJ8J23a/Ggs9Bvv0bmxysLvvZs4I Ef3SqI5Q7IbGI+cNR5m9RoN0ywmsOuIUdpR1EM7843udeC5aIuYUHc5pOEuRn3qy0IGY oXmnzfAIKpuTle20omk1ZAUv7AvBxstv+ubh1OIGkzOT+XO/PYCf6qOYlV+Ri1agWDRy xANouTUkE5ZXYbgJj3sItKEFP7nWRY68qOJ4PpWhgjvLZFqsclCp6MPrb+iYstxInf+6 37gQ== X-Gm-Message-State: AOJu0YzRg9mRM8dqJ00MnqOsU3fpWHPt5MB05JPztmu/ZXOofZQVWhMq f5c+nrth9PW+/vYNxd+BwJYGS8Pe9CBLYeqqTZva7DHuxKNARVAqEOC4OXHznCT/ X-Gm-Gg: Acq92OGv2xH77L7abFVJJA24PLa5EXL9zVx8nDTst4QMR8xq8LHAViNImbJer6zJ9QU xAk/hoAAU6KDAQBQWUNG8OGHEA3YcNkzr1u0deHH0pvMBni40sYmRzzK9p069fKCyBceaT51qo7 risaJ5F75Mi/ZJR0X4WYbqAksiUW9GXIHJmFC6jZjlkjrYPuMkOs4ODQO7sIF1uJQBez/V2R4ou hqWRikqVNBLvw2/NKxU8HOyare2mD6OT3roIvgWCuLWo9K5FZqn0NvfwRnElTK4BUIb7VOMMEUX 6wAIuSGMYIGrSa1QoDcyLEo2oHI+zhdy3r+9FHlWzOfBv7MdBNLwDffV7JGzESILNGCQwDRLqk+ alO/w6x8430hG0JZAj0VLYo3p4x2/+lzCWCNf4DjDn2XO1XfnvEMq7+i82j9nq2+2h+BrPZ7K44 o4D4w7XOyy5aKzslcss+cRuyiLLwNOjOL+Iot1w/rjvJyKTdL1eK8AjitaX4F2MQnV86Y+8GVAh JpTfRjiqkl3RvG32cKS8wR8jGEg5zfG8u6ozGRqZrlOyll8ddBSuYHq3A== X-Received: by 2002:a05:600c:34cb:b0:490:4b89:5361 with SMTP id 5b1f17b1804b1-490c25afa03mr312956635e9.7.1781002772434; Tue, 09 Jun 2026 03:59:32 -0700 (PDT) Received: from iku.example.org ([2a06:5906:61b:2d00:2b2d:6009:3bbe:fb84]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490bc3d663csm524250635e9.11.2026.06.09.03.59.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2026 03:59:32 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Michael Turquette , Stephen Boyd , Brian Masney , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm Cc: linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v2 2/5] clk: renesas: cpg-mssr: Implement dedicated MSTP delay logic for RZ/T2H LCDC and RTC Date: Tue, 9 Jun 2026 11:59:21 +0100 Message-ID: <20260609105924.962573-3-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260609105924.962573-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20260609105924.962573-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Lad Prabhakar Introduce a dedicated clock delay mechanism, cpg_rzt2h_mstp_delay(), to satisfy the module-stop (MSTP) state release requirements specified in the RZ/T2H hardware manual. Per the hardware manual, while a standard 10 us delay (satisfying 7 dummy reads) is sufficient for most IP blocks, the LCDC requires 100 dummy reads (142 us) and the RTC requires 300 dummy reads (428 us) to stabilize after being released from a module-stop state. Implement a conditional bitmask filter helper that switches wait intervals based on the packaged module clock index. In cpg_mstp_clock_endisable(), the clock index and individual target bits are known, allowing an exact match. In the resume path cpg_mssr_resume_noirq(), where individual bits are not tracked, pass a fallback register index base (`reg * 32`) with bit verification masked out to match on the peripheral's register group block instead. Signed-off-by: Lad Prabhakar --- v1->v2: - Dropped using table based approach in favor of direct conditional checks = on the clock index. - Updated commit message to reflect the new approach. --- drivers/clk/renesas/renesas-cpg-mssr.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/clk/renesas/renesas-cpg-mssr.c b/drivers/clk/renesas/r= enesas-cpg-mssr.c index 5b84cbee030b..4ed056b18d31 100644 --- a/drivers/clk/renesas/renesas-cpg-mssr.c +++ b/drivers/clk/renesas/renesas-cpg-mssr.c @@ -253,6 +253,22 @@ static void cpg_rzt2h_mstp_write(struct cpg_mssr_priv = *priv, u16 offset, u32 val writel(value, base + RZT2H_MSTPCR_OFFSET(offset)); } =20 +static void cpg_rzt2h_mstp_delay(u32 idx, bool bit_valid) +{ + unsigned int mask =3D bit_valid ? GENMASK(31, 0) : GENMASK(31, 5); + + if (idx =3D=3D (MOD_CLK_PACK(1204) & mask)) { + /* LCDC needs 100 dummy reads, or 142us */ + udelay(142); + } else if (idx =3D=3D (MOD_CLK_PACK(605) & mask)) { + /* RTC needs 300 dummy reads, or 428us */ + udelay(428); + } else { + /* default 7 dummy reads, or 10us */ + udelay(10); + } +} + static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable) { struct mstp_clock *clock =3D to_mstp_clock(hw); @@ -312,7 +328,7 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, = bool enable) * register, we simply add a delay after the read operation. */ cpg_rzt2h_mstp_read(priv, priv->control_regs[reg]); - udelay(10); + cpg_rzt2h_mstp_delay(clock->index, true); return 0; } =20 @@ -1142,7 +1158,7 @@ static int cpg_mssr_resume_noirq(struct device *dev) cpg_rzt2h_mstp_write(priv, priv->control_regs[reg], newval); /* See cpg_mstp_clock_endisable() on why this is necessary. */ cpg_rzt2h_mstp_read(priv, priv->control_regs[reg]); - udelay(10); + cpg_rzt2h_mstp_delay(reg * 32, false); continue; } else writel(newval, priv->pub.base0 + priv->control_regs[reg]); --=20 2.54.0 From nobody Sat Jun 13 00:40:54 2026 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 397443FADF6 for ; Tue, 9 Jun 2026 10:59:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781002776; cv=none; b=qbn0qs7dM1GOiia+VgydegG/xofHlcRODCklls/sW/l7LJVMt3npwLAiWdCl9bOmwgWiuNyMtqZyotbCv0/ROHKvjKYDsTVXPslY5y5jAz7IZIvGRRiCTbPnNkrQxAMN3L54vdICbCyzHZNPk0K04s09+lHCPK8rSC9cUI0BLtY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781002776; c=relaxed/simple; bh=ZvmNBM0dEycs0ZSV4pUzv9neHna2gcQfukCmjf+ujfI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=US9Ij/hVmv2f9TLsyEN5H3Kax69CQRr4A2v7fFK9q0kWqkJuz5l7Av7MCfKG1/AEPIsamfZtTIk7jG4x2wCj3xcgjgVVrAhMEBAZq2hu6RjbhftNDxRZmByB0DpwrpoacUlSAsjATWOT9NPMI10TsnQDW0z/fN0n8Oj/N9K9ImE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JDlkAepP; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JDlkAepP" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-490aebf33e9so30307365e9.3 for ; Tue, 09 Jun 2026 03:59:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781002774; x=1781607574; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZlQ7E/EZea6BzD4lH08QBVmk0H9Rm37lQbjREjZTGMs=; b=JDlkAepPL6igXebSuZNnSCed6C97w9eP9LvgJm4sRlpSaLy8A8Cult3HhCTSc8lpAM NO6zZHYtz58v0YuwKqYHUI5TuGZ5sRNw7wrZNyreeva/rAAbibeUq+SFSal5wPvW5980 +t9uUgsj/vhQ/vq5EIcGtKTME7eB8Vq+R18pLiUlBe74wGRGfEz0L4YjwM2GtBIsNQAf OaxzdfIvYC+148CdKlycwDDRiYwzR8S/kwhgEFI7oT4mMyi2qQw4zpeTWQpod0Opmcr4 lFiU5LuFTxWjIO/jz6+AMhXXErCKvQLlFNhjM8S1AWqvET/I0sQBH6M2GFtk2YN1nNJg AnOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781002774; x=1781607574; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ZlQ7E/EZea6BzD4lH08QBVmk0H9Rm37lQbjREjZTGMs=; b=Krkmg2dYxIWZhy7kVLyWjBGicwezMYEOKio1QcDduME9NnLwMbjFAoMv2QXoaFqM2j 2iOSqU7WHKFo/VfEJPwR28NEkSyMlzJBCNaI1VfqNxNZaYWIK0KbzVA0smBUJkjhGSL6 csaMAU5RjnmCPt3cu1Lwqy0Y5ELatGadQ4rhbuEL5c0+Vsw1VvpnswsV/q8z+JfMO0e7 7Ktj00qIWW1/I8wlRIca/IQnHt0H4zNJ/7wqUNIrMg2Cj19FuZtYtEk31FPYq1cPOTB9 +ATS8y5LqcuqE5vwfmOZUuHKN44XXx7FZ5Wm9n2zqJBmUaXTJkKCEjyHVQN+TrWgK9Xi CsKA== X-Gm-Message-State: AOJu0Yz/xNEnmVrvOMTzYLYBHfOVsGpi0ImV+S6iWTzLM7gZFLZoXc2e fVh4kbOxIKZfM9khStA7bIOo2Xc7K+KObfNdQKqoIa4pUdTVir3q4wyR X-Gm-Gg: Acq92OElakymm7Uqvj9G8jXCZ5fR9dXXYbTc6tG+yAdRHAR8GoaThll3qqSeCVJcQ6k 7ZRT8Kh0wtSucX4diCw1CQ5+cPEpTJ8GeHAGLehNhIEqlVKBQmIssE1KKQjqPlOIHK4BwJhtpkJ G0YPZM/LgrJZoXic6N6TDhFWVs1R4j+TZDVLUoW2i/p86thGMgl81/oq/UAzGDTMzwDRpTm8xPB qxGXG/ZdRBoP/VZjP9dsuT5YBpfu1GvJ/Y1jPyq9aWKWcvAgUgFoH/EAv4jj5lZWxL/KqIJovjF boc5BoE1LF23TOk9eGwwntpmiSuIcMpbPpTYcjnsliRjWToEHt/MrCuo7eckfwyiW0takgmdTym 7S1f/gmTJeU3udkZwSnv76ALcGxbshVkupjC9HXuRGsW2PX6r+YrdFmP/AQdPhg3vkV6iU3GL5I qgocyShgBfDab/n5a1t8cSFE7LGIYf8fxdKOyk03qKVLKGy0ukI4G6O4NLUJAP3kCBFqG0Jzjsj nL7TTxQrnpeIkhr44mFWwJls+v2xk5fMebw9lIiBFVwG70deMOYhUFypg== X-Received: by 2002:a05:600c:4e4b:b0:490:bfda:7d7e with SMTP id 5b1f17b1804b1-490c258999amr335438365e9.3.1781002773647; Tue, 09 Jun 2026 03:59:33 -0700 (PDT) Received: from iku.example.org ([2a06:5906:61b:2d00:2b2d:6009:3bbe:fb84]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490bc3d663csm524250635e9.11.2026.06.09.03.59.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2026 03:59:32 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Michael Turquette , Stephen Boyd , Brian Masney , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm Cc: linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar , Conor Dooley Subject: [PATCH v2 3/5] dt-bindings: clock: renesas,r9a09g077/87: Add LCDC_CLKD clock ID Date: Tue, 9 Jun 2026 11:59:22 +0100 Message-ID: <20260609105924.962573-4-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260609105924.962573-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20260609105924.962573-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Lad Prabhakar Add the LCDC clockd (LCDC_CLKD) definition for the Renesas RZ/T2H (R9A09G077) and RZ/N2H (R9A09G087) SoCs. LCDC_CLKD is used as the operating clock for LCDC. Signed-off-by: Lad Prabhakar Acked-by: Conor Dooley Reviewed-by: Geert Uytterhoeven --- v1->v2: - Added Acked-by and Reviewed-by tags. --- include/dt-bindings/clock/renesas,r9a09g077-cpg-mssr.h | 1 + include/dt-bindings/clock/renesas,r9a09g087-cpg-mssr.h | 1 + 2 files changed, 2 insertions(+) diff --git a/include/dt-bindings/clock/renesas,r9a09g077-cpg-mssr.h b/inclu= de/dt-bindings/clock/renesas,r9a09g077-cpg-mssr.h index c4863e444458..f6cb8d649a46 100644 --- a/include/dt-bindings/clock/renesas,r9a09g077-cpg-mssr.h +++ b/include/dt-bindings/clock/renesas,r9a09g077-cpg-mssr.h @@ -34,5 +34,6 @@ #define R9A09G077_XSPI_CLK0 22 #define R9A09G077_XSPI_CLK1 23 #define R9A09G077_PCLKCAN 24 +#define R9A09G077_LCDC_CLKD 25 =20 #endif /* __DT_BINDINGS_CLOCK_RENESAS_R9A09G077_CPG_H__ */ diff --git a/include/dt-bindings/clock/renesas,r9a09g087-cpg-mssr.h b/inclu= de/dt-bindings/clock/renesas,r9a09g087-cpg-mssr.h index 0d53f1e65077..312e563b322e 100644 --- a/include/dt-bindings/clock/renesas,r9a09g087-cpg-mssr.h +++ b/include/dt-bindings/clock/renesas,r9a09g087-cpg-mssr.h @@ -34,5 +34,6 @@ #define R9A09G087_XSPI_CLK0 22 #define R9A09G087_XSPI_CLK1 23 #define R9A09G087_PCLKCAN 24 +#define R9A09G087_LCDC_CLKD 25 =20 #endif /* __DT_BINDINGS_CLOCK_RENESAS_R9A09G087_CPG_H__ */ --=20 2.54.0 From nobody Sat Jun 13 00:40:54 2026 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D11863FE64E for ; Tue, 9 Jun 2026 10:59:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781002779; cv=none; b=LVxC4XFY2ysdM4xICWW2oc6oF3T3tfElSvec3mO9uKZ0AdjF024qNCAi1ZiKT78frzbMG/kgVR9GPpwyroiVq5EI9yTQ5Sh1zQ7VFwAsqoOfnzygspvTLhI+POZBpdvx54LHpv0kAFZj1FVNUWxmLeQnvlLE538kaaZziOgiwVo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781002779; c=relaxed/simple; bh=R9DIIQ1qLxF8W794z9jlN5sGRZrlOa4iNeyrroAHCUs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iVftDoW2GQGynxEuqrNDtk8Rvde35cBw7kydGH/woxqhTVe6J5Pw8zAP6YEtgnELA/tc/OBjKbdL8uR0IcI94b9WQxyc2VHJvbVz/r5eEgS6kFCjixXro03h70Ov6EIHR69Xz7vXsXyHBHezvPxsYWqVCy8AUnuHycBeLq2+R/o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FCghCd+l; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FCghCd+l" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-490be29c1c5so68920815e9.2 for ; Tue, 09 Jun 2026 03:59:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781002775; x=1781607575; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Vu/3p2N53nRfdoRyXkgiVNzw/DhaQXtjUEE28Cccb0o=; b=FCghCd+lLYizzNs0vgAG0FYrgWRFif8m5NvlDk9OMfnicC2IgQvyZ6xpU/r3cMwGs6 s/okitSillqkP9vm1BDOYxzjsv050Vh6LYNIfAPi1QT2opAsWFUYwkNoe1ghf5vxV3fr 7mycRW6jKm6Dqw71T4y4n52EcM2LTYqccpTjsBE2R1HdSIXNulAW4XNZ2nxrDofeeRm3 zVZayPnptdm4U00Z6O8RbmuHjx6oQXCZQ47XRq/QUc/k5ivBrWRGAD+ThKGqjd6jTUHS UcZBS8JNVMNt4+8ZEc5/qahHLTjfke8C1eM5qT0jGiBRoN0IOM1r1ahR6vZ2JTvuoC9v yqjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781002775; x=1781607575; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Vu/3p2N53nRfdoRyXkgiVNzw/DhaQXtjUEE28Cccb0o=; b=nAzrB/WE2z4jYhktDKnPu1CR4vsCDGKI9fFKQBuOqz6xUCgkHQH+I0tv/qoMQshJil rIIqWHO3V52eyFjH0TDtMHL5SuUaKHdOezbDb9xraw+KmrhU0XMEQ1VyHPdiKsnA7NXn mnsfrruFWMGObQeTCE+aB3R8mBhA7567roOkdyvE6XXjvKInv3v27CoxauRNl369C2ij GVx8WKrcky9ZpWrPhym9gUTdq/S92VhBBzApmvrJyVdefAnaQ+tmZE6bYn50rsucNm+a g/vu1S/X0MHPQOsB7N9dHCn4VGDE7M2G57uoNPVwrQISTUM9KTMmKOLug7w7t11j6D69 HZpQ== X-Gm-Message-State: AOJu0YyZ1Jrf55Sax9ZPLBr5MNBDX69I27aXfZlPfO4tRh7n1ecoVfBh x/NIIBB2P6VKsCTEmG1Z4VG8Ud8erYufe2WA84cbpFUVOHk74nEGU43Z X-Gm-Gg: Acq92OEd24s6orKMK/OY0peS9fBApfcTxNHk2DSfJ4cYt9AJ0H2GOaNanhfxU9on++2 7wWtosVVA37axHjblwANU0xjppps8EZ8TBpFqN3leuzYNQ9Kzw0ADVZoH81F3lvN1SFoSPjYG7J sKqGDbc5vO75p/ROfs4y47b2qiMi21sI0FR2tRDExmO/7fmlZykq0IW9qWDyh3J6pPK5S1J3k3U 2IoJdgNMLwdf8X2LvX0w4W1wIvnm74uaLePy1yUubYbmDkmfh3rYzaigIJ22jHtdwkDXB+vU4FU SEPbpSb/SwclJk7tion2wgTXl/m7JQZyV9y62I0qmXtVM/DL3943eO/gmY9f1w+81sJDsx0H6nu xLuxR4tTHCNCRWMl+CE93hGVkQVDZ4uyXZKpnry2XWmygP9+siD42RoPd15XAhp3J/LV4KaZ/AW h091LevtCW7WNNqACyhkiywITZ0f/I2uy50xqoVQDCr/cWo2t+cFOt42Z9EyMyeXx6HoEUgw2fL KcM6+Pum9H6NY+BGbC3mRd/5bo3WWXOObyfrsLD1ewm5ka1XnzWTKQZiA== X-Received: by 2002:a05:600c:3e0d:b0:490:4663:691b with SMTP id 5b1f17b1804b1-490c256049emr325377445e9.7.1781002774919; Tue, 09 Jun 2026 03:59:34 -0700 (PDT) Received: from iku.example.org ([2a06:5906:61b:2d00:2b2d:6009:3bbe:fb84]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490bc3d663csm524250635e9.11.2026.06.09.03.59.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2026 03:59:34 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Michael Turquette , Stephen Boyd , Brian Masney , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm Cc: linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v2 4/5] clk: renesas: rzv2h-cpg: Extract PLL calculation math into a library Date: Tue, 9 Jun 2026 11:59:23 +0100 Message-ID: <20260609105924.962573-5-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260609105924.962573-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20260609105924.962573-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Lad Prabhakar Move the common PLL and divider parameter calculation logic from the core rzv2h-cpg driver into a standalone library file. Introduce the CLK_RZV2H_CPG_LIB Kconfig configuration symbol and create rzv2h-cpg-lib.c to house rzv2h_cpg_get_pll_pars() and rzv2h_cpg_get_pll_divs_pars(). Keep rzv2h_get_pll_pars() and rzv2h_get_pll_divs_pars() in the original driver as wrappers that call into the new library helper endpoints. These wrappers are maintained for this cycle because they are actively referenced by the DSI driver; they will be safely removed in a subsequent cycle once the DSI driver is updated to use the new APIs from the library, preventing cross-subsystem build breakages. This restructuring allows other Renesas SoC clock drivers, such as the upcoming RZ/T2H and RZ/N2H platforms that utilize similar LCDC clock divider mathematical logic, to share the iterative calculation helper infrastructure without duplication. Signed-off-by: Lad Prabhakar --- v1->v2: - New patch --- drivers/clk/renesas/Kconfig | 4 + drivers/clk/renesas/Makefile | 1 + drivers/clk/renesas/rzv2h-cpg-lib.c | 216 ++++++++++++++++++++++++++++ drivers/clk/renesas/rzv2h-cpg.c | 186 +----------------------- include/linux/clk/renesas.h | 23 +++ 5 files changed, 250 insertions(+), 180 deletions(-) create mode 100644 drivers/clk/renesas/rzv2h-cpg-lib.c diff --git a/drivers/clk/renesas/Kconfig b/drivers/clk/renesas/Kconfig index 0203ecbb3882..7659550b8566 100644 --- a/drivers/clk/renesas/Kconfig +++ b/drivers/clk/renesas/Kconfig @@ -260,8 +260,12 @@ config CLK_RZG2L =20 config CLK_RZV2H bool "RZ/{G3E,V2H(P)} family clock support" if COMPILE_TEST + select CLK_RZV2H_CPG_LIB select RESET_CONTROLLER =20 +config CLK_RZV2H_CPG_LIB + bool "RZV2H CPG library functions" if COMPILE_TEST + config CLK_RENESAS_VBATTB tristate "Renesas VBATTB clock controller" depends on ARCH_RZG2L || COMPILE_TEST diff --git a/drivers/clk/renesas/Makefile b/drivers/clk/renesas/Makefile index bd2bed91ab29..ac790e56034b 100644 --- a/drivers/clk/renesas/Makefile +++ b/drivers/clk/renesas/Makefile @@ -52,6 +52,7 @@ obj-$(CONFIG_CLK_RCAR_GEN3_CPG) +=3D rcar-gen3-cpg.o obj-$(CONFIG_CLK_RCAR_GEN4_CPG) +=3D rcar-gen4-cpg.o obj-$(CONFIG_CLK_RCAR_USB2_CLOCK_SEL) +=3D rcar-usb2-clock-sel.o obj-$(CONFIG_CLK_RZG2L) +=3D rzg2l-cpg.o +obj-$(CONFIG_CLK_RZV2H_CPG_LIB) +=3D rzv2h-cpg-lib.o obj-$(CONFIG_CLK_RZV2H) +=3D rzv2h-cpg.o =20 # Generic diff --git a/drivers/clk/renesas/rzv2h-cpg-lib.c b/drivers/clk/renesas/rzv2= h-cpg-lib.c new file mode 100644 index 000000000000..98e789df5d7f --- /dev/null +++ b/drivers/clk/renesas/rzv2h-cpg-lib.c @@ -0,0 +1,216 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * RZV2H CPG Library. This library provides common functions to calculate + * PLL parameters for the RZV2H SoC. + * + * Copyright (C) 2026 Renesas Electronics Corp. + * + */ + +#include +#include +#include +#include + +/** + * rzv2h_cpg_get_pll_pars - Finds the best combination of PLL parameters + * for a given frequency. + * + * @limits: Pointer to the structure containing the limits for the PLL par= ameters + * @pars: Pointer to the structure where the best calculated PLL parameter= s values + * will be stored + * @freq_millihz: Target output frequency in millihertz + * + * This function calculates the best set of PLL parameters (M, K, P, S) to= achieve + * the desired frequency. + * There is no direct formula to calculate the PLL parameters, as it's an = open + * system of equations, therefore this function uses an iterative approach= to + * determine the best solution. The best solution is one that minimizes th= e error + * (desired frequency - actual frequency). + * + * Return: true if a valid set of parameters values is found, false otherw= ise. + */ +bool rzv2h_cpg_get_pll_pars(const struct rzv2h_pll_limits *limits, + struct rzv2h_pll_pars *pars, u64 freq_millihz) +{ + unsigned long input_fref =3D limits->input_fref ?: (24 * MEGA); + u64 fout_min_millihz =3D mul_u32_u32(limits->fout.min, MILLI); + u64 fout_max_millihz =3D mul_u32_u32(limits->fout.max, MILLI); + struct rzv2h_pll_pars p, best; + + if (freq_millihz > fout_max_millihz || + freq_millihz < fout_min_millihz) + return false; + + /* Initialize best error to maximum possible value */ + best.error_millihz =3D S64_MAX; + + for (p.p =3D limits->p.min; p.p <=3D limits->p.max; p.p++) { + u32 fref =3D input_fref / p.p; + u16 divider; + + for (divider =3D 1 << limits->s.min, p.s =3D limits->s.min; + p.s <=3D limits->s.max; p.s++, divider <<=3D 1) { + for (p.m =3D limits->m.min; p.m <=3D limits->m.max; p.m++) { + u64 output_m, output_k_range; + s64 pll_k, output_k; + u64 fvco, output; + + /* + * The frequency generated by the PLL + divider + * is calculated as follows: + * + * With: + * Freq =3D Ffout =3D Ffvco / 2^(pll_s) + * Ffvco =3D (pll_m + (pll_k / 65536)) * Ffref + * Ffref =3D 24MHz / pll_p + * + * Freq can also be rewritten as: + * Freq =3D Ffvco / 2^(pll_s) + * =3D ((pll_m + (pll_k / 65536)) * Ffref) / 2^(pll_s) + * =3D (pll_m * Ffref) / 2^(pll_s) + ((pll_k / 65536) * Ffref) / = 2^(pll_s) + * =3D output_m + output_k + * + * Every parameter has been determined at this + * point, but pll_k. + * + * Considering that: + * limits->k.min <=3D pll_k <=3D limits->k.max + * Then: + * -0.5 <=3D (pll_k / 65536) < 0.5 + * Therefore: + * -Ffref / (2 * 2^(pll_s)) <=3D output_k < Ffref / (2 * 2^(pll_s)) + */ + + /* Compute output M component (in mHz) */ + output_m =3D DIV_ROUND_CLOSEST_ULL(mul_u32_u32(p.m, fref) * MILLI, + divider); + /* Compute range for output K (in mHz) */ + output_k_range =3D DIV_ROUND_CLOSEST_ULL(mul_u32_u32(fref, MILLI), + 2 * divider); + /* + * No point in continuing if we can't achieve + * the desired frequency + */ + if (freq_millihz < (output_m - output_k_range) || + freq_millihz >=3D (output_m + output_k_range)) { + continue; + } + + /* + * Compute the K component + * + * Since: + * Freq =3D output_m + output_k + * Then: + * output_k =3D Freq - output_m + * =3D ((pll_k / 65536) * Ffref) / 2^(pll_s) + * Therefore: + * pll_k =3D (output_k * 65536 * 2^(pll_s)) / Ffref + */ + output_k =3D freq_millihz - output_m; + pll_k =3D div_s64(output_k * 65536ULL * divider, + fref); + pll_k =3D DIV_S64_ROUND_CLOSEST(pll_k, MILLI); + + /* Validate K value within allowed limits */ + if (pll_k < limits->k.min || + pll_k > limits->k.max) + continue; + + p.k =3D pll_k; + + /* Compute (Ffvco * 65536) */ + fvco =3D mul_u32_u32(p.m * 65536 + p.k, fref); + if (fvco < mul_u32_u32(limits->fvco.min, 65536) || + fvco > mul_u32_u32(limits->fvco.max, 65536)) + continue; + + /* PLL_M component of (output * 65536 * PLL_P) */ + output =3D mul_u32_u32(p.m * 65536, input_fref); + /* PLL_K component of (output * 65536 * PLL_P) */ + output +=3D p.k * input_fref; + /* Make it in mHz */ + output *=3D MILLI; + output =3D DIV_U64_ROUND_CLOSEST(output, 65536 * p.p * divider); + + /* Check output frequency against limits */ + if (output < fout_min_millihz || + output > fout_max_millihz) + continue; + + p.error_millihz =3D freq_millihz - output; + p.freq_millihz =3D output; + + /* If an exact match is found, return immediately */ + if (p.error_millihz =3D=3D 0) { + *pars =3D p; + return true; + } + + /* Update best match if error is smaller */ + if (abs(best.error_millihz) > abs(p.error_millihz)) + best =3D p; + } + } + } + + /* If no valid parameters were found, return false */ + if (best.error_millihz =3D=3D S64_MAX) + return false; + + *pars =3D best; + return true; +} +EXPORT_SYMBOL_NS_GPL(rzv2h_cpg_get_pll_pars, "RZV2H_CPG"); + +/* + * rzv2h_cpg_get_pll_divs_pars - Finds the best combination of PLL paramet= ers + * and divider value for a given frequency. + * + * @limits: Pointer to the structure containing the limits for the PLL par= ameters + * @pars: Pointer to the structure where the best calculated PLL parameter= s and + * divider values will be stored + * @table: Pointer to the array of valid divider values + * @table_size: Size of the divider values array + * @freq_millihz: Target output frequency in millihertz + * + * This function calculates the best set of PLL parameters (M, K, P, S) an= d divider + * value to achieve the desired frequency. See rzv2h_cpg_get_pll_pars() fo= r more + * details on how the PLL parameters are calculated. + * + * freq_millihz is the desired frequency generated by the PLL followed by a + * a gear. + */ +bool rzv2h_cpg_get_pll_divs_pars(const struct rzv2h_pll_limits *limits, + struct rzv2h_pll_div_pars *pars, + const u8 *table, u8 table_size, u64 freq_millihz) +{ + struct rzv2h_pll_div_pars p, best; + + best.div.error_millihz =3D S64_MAX; + p.div.error_millihz =3D S64_MAX; + for (unsigned int i =3D 0; i < table_size; i++) { + if (!rzv2h_cpg_get_pll_pars(limits, &p.pll, freq_millihz * table[i])) + continue; + + p.div.divider_value =3D table[i]; + p.div.freq_millihz =3D DIV_U64_ROUND_CLOSEST(p.pll.freq_millihz, table[i= ]); + p.div.error_millihz =3D freq_millihz - p.div.freq_millihz; + + if (p.div.error_millihz =3D=3D 0) { + *pars =3D p; + return true; + } + + if (abs(best.div.error_millihz) > abs(p.div.error_millihz)) + best =3D p; + } + + if (best.div.error_millihz =3D=3D S64_MAX) + return false; + + *pars =3D best; + return true; +} +EXPORT_SYMBOL_NS_GPL(rzv2h_cpg_get_pll_divs_pars, "RZV2H_CPG"); diff --git a/drivers/clk/renesas/rzv2h-cpg.c b/drivers/clk/renesas/rzv2h-cp= g.c index fff89f2bdc0b..c2f018e27521 100644 --- a/drivers/clk/renesas/rzv2h-cpg.c +++ b/drivers/clk/renesas/rzv2h-cpg.c @@ -224,151 +224,13 @@ struct rzv2h_plldsi_div_clk { * rzv2h_get_pll_pars - Finds the best combination of PLL parameters * for a given frequency. * - * @limits: Pointer to the structure containing the limits for the PLL par= ameters - * @pars: Pointer to the structure where the best calculated PLL parameter= s values - * will be stored - * @freq_millihz: Target output frequency in millihertz - * - * This function calculates the best set of PLL parameters (M, K, P, S) to= achieve - * the desired frequency. - * There is no direct formula to calculate the PLL parameters, as it's an = open - * system of equations, therefore this function uses an iterative approach= to - * determine the best solution. The best solution is one that minimizes th= e error - * (desired frequency - actual frequency). - * - * Return: true if a valid set of parameters values is found, false otherw= ise. + * Refer to rzv2h_cpg_get_pll_pars() for more details on how the PLL + * parameters are calculated. */ bool rzv2h_get_pll_pars(const struct rzv2h_pll_limits *limits, struct rzv2h_pll_pars *pars, u64 freq_millihz) { - unsigned long input_fref =3D limits->input_fref ?: (24 * MEGA); - u64 fout_min_millihz =3D mul_u32_u32(limits->fout.min, MILLI); - u64 fout_max_millihz =3D mul_u32_u32(limits->fout.max, MILLI); - struct rzv2h_pll_pars p, best; - - if (freq_millihz > fout_max_millihz || - freq_millihz < fout_min_millihz) - return false; - - /* Initialize best error to maximum possible value */ - best.error_millihz =3D S64_MAX; - - for (p.p =3D limits->p.min; p.p <=3D limits->p.max; p.p++) { - u32 fref =3D input_fref / p.p; - u16 divider; - - for (divider =3D 1 << limits->s.min, p.s =3D limits->s.min; - p.s <=3D limits->s.max; p.s++, divider <<=3D 1) { - for (p.m =3D limits->m.min; p.m <=3D limits->m.max; p.m++) { - u64 output_m, output_k_range; - s64 pll_k, output_k; - u64 fvco, output; - - /* - * The frequency generated by the PLL + divider - * is calculated as follows: - * - * With: - * Freq =3D Ffout =3D Ffvco / 2^(pll_s) - * Ffvco =3D (pll_m + (pll_k / 65536)) * Ffref - * Ffref =3D 24MHz / pll_p - * - * Freq can also be rewritten as: - * Freq =3D Ffvco / 2^(pll_s) - * =3D ((pll_m + (pll_k / 65536)) * Ffref) / 2^(pll_s) - * =3D (pll_m * Ffref) / 2^(pll_s) + ((pll_k / 65536) * Ffref) / = 2^(pll_s) - * =3D output_m + output_k - * - * Every parameter has been determined at this - * point, but pll_k. - * - * Considering that: - * limits->k.min <=3D pll_k <=3D limits->k.max - * Then: - * -0.5 <=3D (pll_k / 65536) < 0.5 - * Therefore: - * -Ffref / (2 * 2^(pll_s)) <=3D output_k < Ffref / (2 * 2^(pll_s)) - */ - - /* Compute output M component (in mHz) */ - output_m =3D DIV_ROUND_CLOSEST_ULL(mul_u32_u32(p.m, fref) * MILLI, - divider); - /* Compute range for output K (in mHz) */ - output_k_range =3D DIV_ROUND_CLOSEST_ULL(mul_u32_u32(fref, MILLI), - 2 * divider); - /* - * No point in continuing if we can't achieve - * the desired frequency - */ - if (freq_millihz < (output_m - output_k_range) || - freq_millihz >=3D (output_m + output_k_range)) { - continue; - } - - /* - * Compute the K component - * - * Since: - * Freq =3D output_m + output_k - * Then: - * output_k =3D Freq - output_m - * =3D ((pll_k / 65536) * Ffref) / 2^(pll_s) - * Therefore: - * pll_k =3D (output_k * 65536 * 2^(pll_s)) / Ffref - */ - output_k =3D freq_millihz - output_m; - pll_k =3D div_s64(output_k * 65536ULL * divider, - fref); - pll_k =3D DIV_S64_ROUND_CLOSEST(pll_k, MILLI); - - /* Validate K value within allowed limits */ - if (pll_k < limits->k.min || - pll_k > limits->k.max) - continue; - - p.k =3D pll_k; - - /* Compute (Ffvco * 65536) */ - fvco =3D mul_u32_u32(p.m * 65536 + p.k, fref); - if (fvco < mul_u32_u32(limits->fvco.min, 65536) || - fvco > mul_u32_u32(limits->fvco.max, 65536)) - continue; - - /* PLL_M component of (output * 65536 * PLL_P) */ - output =3D mul_u32_u32(p.m * 65536, input_fref); - /* PLL_K component of (output * 65536 * PLL_P) */ - output +=3D p.k * input_fref; - /* Make it in mHz */ - output *=3D MILLI; - output =3D DIV_U64_ROUND_CLOSEST(output, 65536 * p.p * divider); - - /* Check output frequency against limits */ - if (output < fout_min_millihz || - output > fout_max_millihz) - continue; - - p.error_millihz =3D freq_millihz - output; - p.freq_millihz =3D output; - - /* If an exact match is found, return immediately */ - if (p.error_millihz =3D=3D 0) { - *pars =3D p; - return true; - } - - /* Update best match if error is smaller */ - if (abs(best.error_millihz) > abs(p.error_millihz)) - best =3D p; - } - } - } - - /* If no valid parameters were found, return false */ - if (best.error_millihz =3D=3D S64_MAX) - return false; - - *pars =3D best; - return true; + return rzv2h_cpg_get_pll_pars(limits, pars, freq_millihz); } EXPORT_SYMBOL_NS_GPL(rzv2h_get_pll_pars, "RZV2H_CPG"); =20 @@ -376,50 +238,14 @@ EXPORT_SYMBOL_NS_GPL(rzv2h_get_pll_pars, "RZV2H_CPG"); * rzv2h_get_pll_divs_pars - Finds the best combination of PLL parameters * and divider value for a given frequency. * - * @limits: Pointer to the structure containing the limits for the PLL par= ameters - * @pars: Pointer to the structure where the best calculated PLL parameter= s and - * divider values will be stored - * @table: Pointer to the array of valid divider values - * @table_size: Size of the divider values array - * @freq_millihz: Target output frequency in millihertz - * - * This function calculates the best set of PLL parameters (M, K, P, S) an= d divider - * value to achieve the desired frequency. See rzv2h_get_pll_pars() for mo= re details - * on how the PLL parameters are calculated. - * - * freq_millihz is the desired frequency generated by the PLL followed by a - * a gear. + * Refer to rzv2h_cpg_get_pll_divs_pars() for more details on how the PLL + * parameters and divider value are calculated. */ bool rzv2h_get_pll_divs_pars(const struct rzv2h_pll_limits *limits, struct rzv2h_pll_div_pars *pars, const u8 *table, u8 table_size, u64 freq_millihz) { - struct rzv2h_pll_div_pars p, best; - - best.div.error_millihz =3D S64_MAX; - p.div.error_millihz =3D S64_MAX; - for (unsigned int i =3D 0; i < table_size; i++) { - if (!rzv2h_get_pll_pars(limits, &p.pll, freq_millihz * table[i])) - continue; - - p.div.divider_value =3D table[i]; - p.div.freq_millihz =3D DIV_U64_ROUND_CLOSEST(p.pll.freq_millihz, table[i= ]); - p.div.error_millihz =3D freq_millihz - p.div.freq_millihz; - - if (p.div.error_millihz =3D=3D 0) { - *pars =3D p; - return true; - } - - if (abs(best.div.error_millihz) > abs(p.div.error_millihz)) - best =3D p; - } - - if (best.div.error_millihz =3D=3D S64_MAX) - return false; - - *pars =3D best; - return true; + return rzv2h_cpg_get_pll_divs_pars(limits, pars, table, table_size, freq_= millihz); } EXPORT_SYMBOL_NS_GPL(rzv2h_get_pll_divs_pars, "RZV2H_CPG"); =20 diff --git a/include/linux/clk/renesas.h b/include/linux/clk/renesas.h index 2aeff01150c3..98d9ab38e027 100644 --- a/include/linux/clk/renesas.h +++ b/include/linux/clk/renesas.h @@ -213,4 +213,27 @@ static inline bool rzv2h_get_pll_divs_pars(const struc= t rzv2h_pll_limits *limits } #endif =20 +#ifdef CONFIG_CLK_RZV2H_CPG_LIB +bool rzv2h_cpg_get_pll_pars(const struct rzv2h_pll_limits *limits, + struct rzv2h_pll_pars *pars, u64 freq_millihz); + +bool rzv2h_cpg_get_pll_divs_pars(const struct rzv2h_pll_limits *limits, + struct rzv2h_pll_div_pars *pars, + const u8 *table, u8 table_size, u64 freq_millihz); +#else +static inline bool rzv2h_cpg_get_pll_pars(const struct rzv2h_pll_limits *l= imits, + struct rzv2h_pll_pars *pars, + u64 freq_millihz) +{ + return false; +} + +static inline bool rzv2h_cpg_get_pll_divs_pars(const struct rzv2h_pll_limi= ts *limits, + struct rzv2h_pll_div_pars *pars, + const u8 *table, u8 table_size, + u64 freq_millihz) +{ + return false; +} +#endif #endif --=20 2.54.0 From nobody Sat Jun 13 00:40:54 2026 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D86BE3FC5B2 for ; Tue, 9 Jun 2026 10:59:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781002780; cv=none; b=cA7nCj87PwvNP7n2zeWhSFOW/ItuTKCpXSZTzGmnZM8fEwAmkgAoA8Vr4gpwmiWVM0Mgmghg87BIcILQCvQ6mrfpXOgvXk46fPo9jk1yMA1jKfrSvukqkQu+A2eWxTpH+9jA3v4dNIQeUQFf3D/LHHfWqatjylq5bq/cD1SAT/g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781002780; c=relaxed/simple; bh=HgihmDlKr2QK/mcPnPCL8YjKGQ/ZiI8kjepFcybdaIA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jBBFoAEmPrK+U0N6lWZhiN8kscoOjWcHIDCDtskJy4AHplIbHwwXSp6SGEaWy2YqSLXRoJ51BOHhThK0zmNHEF6rK0+PGR9elB1guX8ODM7eb+ac99oPF3F1zyix9/ffBQtXrQorIHx+JZgblAvGl9+r0vQIR8ozuLKHx/eXUZs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=SuRrv1Zb; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SuRrv1Zb" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-490ae94a89eso45619075e9.1 for ; Tue, 09 Jun 2026 03:59:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781002776; x=1781607576; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PmgiihUZ6uoCNDtqz9w4h1EIfJ0KMoxHrsdIwToPLvM=; b=SuRrv1ZbESdpB7MkrZaYu28s6Qa4repjIx6ydmsGKOuZ+gRZ5Cyl3FwbMLI7IhkYkE SozjV/QY2WlGNiUYswC2VWpPuPzFpMHCRmX3ZO4Smcm3295BUPiHoZRw60Hl4GWqRajR c4SSeahCtiitVj3YCyb7F14mafqokwxvJEPDkTIp4RbNVEHr7+hstbXVpPAHHlGAJgM/ DcB+aHxNmtUWEGaMK1SqLFdxch4KFYBXrSo8/n6JNufbPB+EB0+zkGI0+pQ+S+0tIBnA PDMi4nUgpuzXGR2Ll8rstAiG7utkreV6W4PtbaSegoaPz74DZthaPXiW6EOTILSgOwpw NWaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781002776; x=1781607576; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=PmgiihUZ6uoCNDtqz9w4h1EIfJ0KMoxHrsdIwToPLvM=; b=QlZyHn5nLfD0rU55HWAMJRwZ8TGXI9RAElmoAr1uaBzQxC5nfaR0fKmzWVpDozhcYN 0zRtPYwk7AyMSZnxdt60rtjcbA1o8YupPOdnP/iGHEVkWhxlKtnZnikZt7sTJ1uvp5iZ iGp8VYieIqIDqmsmTtw+r69IMgTrWEsZOcOVqU4BxdY81ngSWHAH0tF30N+lpQSATsDC 7sBlSMczw8/E65YDnbXOIulXd2g8IjwF9iTwWOe90u3Ph4x+hQDE8+tiBTY0gqDjDCyx eEM/PPNP0IabY8M0E2LazTX9QvyMMo2ZBxwpAWdNlg/Ae3rWOG38qRE2lbcdOWLeW2fG q8+A== X-Gm-Message-State: AOJu0YzZe40bhcNWvjUrzRWIbK8b1XYQPU1xN3zp8JfId31AkgFvGtP5 8N78w/+bfgASjjhLNqAhH0Xu+tNtiDHWxDP24B0WGeK6V71RxESd6U8Q X-Gm-Gg: Acq92OGWisDxbu+bm1NyCjRRwUaFiFcau5EkI1T86fzSCce3XM5VH87pTjTg7zEri6B O8bj7/t0iKidyz/i+IdpRiGa5nQcVXcJNlGHUUlfsLlGQaCRKYNN7EMuOe6W/u832VBqWtJPM5E prE4QGpZhNM7Wvd5LOWZFyyWWZDssYVybcJTjK1wDvq/Lbea0Q+XxZ21Yg98Woar5Z6fUq3vkkN sOCrFhyGLd6IN55nArjkCkYQNbWod/GWdGu72CEyapINy2DAh0JI9aQq4TWkS6+RHJAhnPeR8g0 a1n8KL9Su3SFxCIoBJ05YM2ur5Bji42/XQLD/ZPK2C0ytf+1NeQ0VKIQ9cDA4WnDDwFvtKPaZKq pT09Z4ZgGq3IS7poK/Me6Y7v/gjdpG2LgA5SQmrUXr7oOtVjopqtvrS7WxQyIZ6mcrpZmk7KTP9 4r5vxkXJuNqSF22a6+MoLuDN0vbGMCgPn0zvhWVf/+tPU3N2ZGqSSvj1v62MATW47gO4FMwSPZ8 nAB7I4g19EYuSerRzfiwROfiyga9qmdQCkIaZ/d/UCwhgdCwqbYr7SzPQ== X-Received: by 2002:a05:600c:5248:b0:490:c024:2ec8 with SMTP id 5b1f17b1804b1-490c2522657mr319373935e9.0.1781002775725; Tue, 09 Jun 2026 03:59:35 -0700 (PDT) Received: from iku.example.org ([2a06:5906:61b:2d00:2b2d:6009:3bbe:fb84]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490bc3d663csm524250635e9.11.2026.06.09.03.59.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2026 03:59:35 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Michael Turquette , Stephen Boyd , Brian Masney , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm Cc: linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, Prabhakar , Biju Das , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v2 5/5] clk: renesas: r9a09g077: Add LCDC and PLL3 clock support for RZ/T2H display pipeline Date: Tue, 9 Jun 2026 11:59:24 +0100 Message-ID: <20260609105924.962573-6-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260609105924.962573-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20260609105924.962573-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Lad Prabhakar Add the clock definitions and PLL logic required to supply the LCDC (VSPD/FCPVD/DU) blocks on the RZ/T2H (R9A09G077) SoC. The RZ/T2H display subsystem depends on a dedicated PLL (PLL3) and a set of new derived clocks. Introduce a new PLL clock type and implement rate recalculation, programming and locking sequences for PLL3 using the RZ/T2H specific divider and VCO limits. Add the corresponding muxes and divider entries, expose the LCDC core clock, and register the LCDC module clock using the correct PCLK parent. This enables the RZ/T2H clock driver to generate the display pipeline clocking tree needed by the DU and VSP-based composition engines, allowing upcoming display support to be integrated without duplicating CPG logic. Signed-off-by: Lad Prabhakar --- v1->v2: - Switched to use the new library - Kconfig now selects CLK_RZV2H_CPG_LIB - Renamed CPG_PLLEN to CPG_PLL_EN_EN - Renamed LCDCDIV to LCDC_CLKD - Changed ctr0/1 in r9a09g077_cpg_pll3_clk_recalc_rate() to use u32 --- drivers/clk/renesas/Kconfig | 2 + drivers/clk/renesas/r9a09g077-cpg.c | 369 +++++++++++++++++++++++++++- 2 files changed, 370 insertions(+), 1 deletion(-) diff --git a/drivers/clk/renesas/Kconfig b/drivers/clk/renesas/Kconfig index 7659550b8566..5c0238e878b7 100644 --- a/drivers/clk/renesas/Kconfig +++ b/drivers/clk/renesas/Kconfig @@ -218,10 +218,12 @@ config CLK_R9A09G057 config CLK_R9A09G077 bool "RZ/T2H clock support" if COMPILE_TEST select CLK_RENESAS_CPG_MSSR + select CLK_RZV2H_CPG_LIB =20 config CLK_R9A09G087 bool "RZ/N2H clock support" if COMPILE_TEST select CLK_RENESAS_CPG_MSSR + select CLK_RZV2H_CPG_LIB =20 config CLK_SH73A0 bool "SH-Mobile AG5 clock support" if COMPILE_TEST diff --git a/drivers/clk/renesas/r9a09g077-cpg.c b/drivers/clk/renesas/r9a0= 9g077-cpg.c index f777601a23b9..975578efd4cf 100644 --- a/drivers/clk/renesas/r9a09g077-cpg.c +++ b/drivers/clk/renesas/r9a09g077-cpg.c @@ -8,16 +8,23 @@ =20 #include #include +#include #include #include +#include +#include #include #include +#include #include +#include =20 #include #include #include "renesas-cpg-mssr.h" =20 +MODULE_IMPORT_NS("RZV2H_CPG"); + #define RZT2H_REG_BLOCK_SHIFT 11 #define RZT2H_REG_OFFSET_MASK GENMASK(10, 0) #define RZT2H_REG_CONF(block, offset) (((block) << RZT2H_REG_BLOCK_SHIFT) = | \ @@ -66,11 +73,26 @@ #define DIVSCI2ASYNC CONF_PACK(SCKCR3, 10, 2) #define DIVSCI3ASYNC CONF_PACK(SCKCR3, 12, 2) #define DIVSCI4ASYNC CONF_PACK(SCKCR3, 14, 2) +#define LCDCDIVSEL CONF_PACK(SCKCR3, 20, 4) + +#define PLL3EN FIELD_PREP_CONST(OFFSET_MASK, (0xc0)) + +#define CPG_PLL_EN_EN BIT(0) +#define CPG_PLL3_VCO_CTR0(x) ((x) + 0x4) +#define CPG_PLL3_VCO_CTR0_PDIV GENMASK(21, 16) +#define CPG_PLL3_VCO_CTR0_MDIV GENMASK(9, 0) +#define CPG_PLL3_VCO_CTR1(x) ((x) + 0x8) +#define CPG_PLL3_VCO_CTR1_KDIV GENMASK(31, 16) +#define CPG_PLL3_VCO_CTR1_SDIV GENMASK(2, 0) +#define CPG_PLL_MON(x) ((x) - 0x10) +#define CPG_PLL_MON_LOCK BIT(0) =20 enum rzt2h_clk_types { CLK_TYPE_RZT2H_DIV =3D CLK_TYPE_CUSTOM, /* Clock with divider */ CLK_TYPE_RZT2H_MUX, /* Clock with clock source selector */ CLK_TYPE_RZT2H_FSELXSPI, /* Clock with FSELXSPIn source selector */ + CLK_TYPE_RZT2H_PLL3, /* PLL3 Clock */ + CLK_TYPE_RZT2H_LCDCDIV, /* LCDC divider clock */ }; =20 #define DEF_DIV(_name, _id, _parent, _conf, _dtable) \ @@ -83,10 +105,51 @@ enum rzt2h_clk_types { #define DEF_DIV_FSELXSPI(_name, _id, _parent, _conf, _dtable) \ DEF_TYPE(_name, _id, CLK_TYPE_RZT2H_FSELXSPI, .conf =3D _conf, \ .parent =3D _parent, .dtable =3D _dtable, .flag =3D 0) +#define DEF_PLL3(_name, _id, _parent, _conf) \ + DEF_TYPE(_name, _id, CLK_TYPE_RZT2H_PLL3, .conf =3D _conf, \ + .parent =3D _parent) +#define DEF_DIV_LCDC(_name, _id, _parent, _conf, _dtable) \ + DEF_TYPE(_name, _id, CLK_TYPE_RZT2H_LCDCDIV, .conf =3D _conf, \ + .parent =3D _parent, .dtable =3D _dtable, .flag =3D CLK_SET_RATE_PARENT) + +struct pll_clk { + void __iomem *reg; + const struct rzv2h_pll_limits *limits; + struct device *dev; + struct rzv2h_pll_pars pll_parameters; + struct clk_hw hw; + unsigned long cur_rate; +}; + +#define to_pll(_hw) container_of(_hw, struct pll_clk, hw) + +struct r9a09g077_lcdc_div_clk { + const struct clk_div_table *dtable; + void __iomem *reg; + struct device *dev; + struct clk_hw hw; + u32 conf; + u8 divider; +}; + +#define to_lcdc_div_clk(_hw) \ + container_of(_hw, struct r9a09g077_lcdc_div_clk, hw) + +#define RZT2H_MAX_LCDC_DIV_TABLES 16 + +static const struct rzv2h_pll_limits r9a09g077_cpg_pll3_limits =3D { + .input_fref =3D 48 * MEGA, + .fout =3D { .min =3D 25 * MEGA, .max =3D 430 * MEGA }, + .fvco =3D { .min =3D 1600 * MEGA, .max =3D 3200 * MEGA }, + .m =3D { .min =3D 0x40, .max =3D 0x3ff }, + .p =3D { .min =3D 0x2, .max =3D 0x8 }, + .s =3D { .min =3D 0x0, .max =3D 0x6 }, + .k =3D { .min =3D -32768, .max =3D 32767 }, +}; =20 enum clk_ids { /* Core Clock Outputs exported to DT */ - LAST_DT_CORE_CLK =3D R9A09G077_PCLKCAN, + LAST_DT_CORE_CLK =3D R9A09G077_LCDC_CLKD, =20 /* External Input Clocks */ CLK_EXTAL, @@ -96,10 +159,12 @@ enum clk_ids { CLK_PLL0, CLK_PLL1, CLK_PLL2, + CLK_PLL3, CLK_PLL4, CLK_SEL_CLK_PLL0, CLK_SEL_CLK_PLL1, CLK_SEL_CLK_PLL2, + CLK_SEL_CLK_PLL3, CLK_SEL_CLK_PLL4, CLK_PLL4D1, CLK_PLL4D1_DIV3, @@ -107,6 +172,7 @@ enum clk_ids { CLK_PLL4D3, CLK_PLL4D3_DIV10, CLK_PLL4D3_DIV20, + CLK_PLL4D50, CLK_SCI0ASYNC, CLK_SCI1ASYNC, CLK_SCI2ASYNC, @@ -119,6 +185,7 @@ enum clk_ids { CLK_SPI3ASYNC, CLK_DIVSELXSPI0_SCKCR, CLK_DIVSELXSPI1_SCKCR, + CLK_LCDDIVSEL, =20 /* Module Clocks */ MOD_CLK_BASE, @@ -130,6 +197,26 @@ static const struct clk_div_table dtable_1_2[] =3D { {0, 0}, }; =20 +static const struct clk_div_table dtable_2_32[] =3D { + {0, 2}, + {1, 4}, + {2, 6}, + {3, 8}, + {4, 10}, + {5, 12}, + {6, 14}, + {7, 16}, + {8, 18}, + {9, 20}, + {10, 22}, + {11, 24}, + {12, 26}, + {13, 28}, + {14, 30}, + {15, 32}, + {0, 0}, +}; + static const struct clk_div_table dtable_6_8_16_32_64[] =3D { {6, 64}, {5, 32}, @@ -152,6 +239,7 @@ static const struct clk_div_table dtable_24_25_30_32[] = =3D { static const char * const sel_clk_pll0[] =3D { ".loco", ".pll0" }; static const char * const sel_clk_pll1[] =3D { ".loco", ".pll1" }; static const char * const sel_clk_pll2[] =3D { ".loco", ".pll2" }; +static const char * const sel_clk_pll3[] =3D { ".loco", ".pll3" }; static const char * const sel_clk_pll4[] =3D { ".loco", ".pll4" }; static const char * const sel_clk_pll4d1_div3_div4[] =3D { ".pll4d1_div3",= ".pll4d1_div4" }; static const char * const sel_clk_pll4d3_div10_div20[] =3D { ".pll4d3_div1= 0", ".pll4d3_div20" }; @@ -173,10 +261,14 @@ static const struct cpg_core_clk r9a09g077_core_clks[= ] __initconst =3D { sel_clk_pll1, ARRAY_SIZE(sel_clk_pll1), CLK_MUX_READ_ONLY), DEF_MUX(".sel_clk_pll2", CLK_SEL_CLK_PLL2, SEL_PLL, sel_clk_pll2, ARRAY_SIZE(sel_clk_pll2), CLK_MUX_READ_ONLY), + DEF_MUX(".sel_clk_pll3", CLK_SEL_CLK_PLL3, SEL_PLL, + sel_clk_pll3, ARRAY_SIZE(sel_clk_pll3), CLK_MUX_READ_ONLY), DEF_MUX(".sel_clk_pll4", CLK_SEL_CLK_PLL4, SEL_PLL, sel_clk_pll4, ARRAY_SIZE(sel_clk_pll4), CLK_MUX_READ_ONLY), =20 DEF_FIXED(".pll4d1", CLK_PLL4D1, CLK_SEL_CLK_PLL4, 1, 1), + DEF_FIXED(".pll4d50", CLK_PLL4D50, CLK_SEL_CLK_PLL4, 50, 1), + DEF_PLL3(".pll3", CLK_PLL3, CLK_PLL4D50, PLL3EN), DEF_FIXED(".pll4d1_div3", CLK_PLL4D1_DIV3, CLK_PLL4D1, 3, 1), DEF_FIXED(".pll4d1_div4", CLK_PLL4D1_DIV4, CLK_PLL4D1, 4, 1), DEF_FIXED(".pll4d3", CLK_PLL4D3, CLK_SEL_CLK_PLL4, 3, 1), @@ -229,6 +321,7 @@ static const struct cpg_core_clk r9a09g077_core_clks[] = __initconst =3D { DEF_FIXED("PCLKL", R9A09G077_CLK_PCLKL, CLK_SEL_CLK_PLL1, 16, 1), DEF_FIXED("PCLKAH", R9A09G077_CLK_PCLKAH, CLK_PLL4D1, 6, 1), DEF_FIXED("PCLKAM", R9A09G077_CLK_PCLKAM, CLK_PLL4D1, 12, 1), + DEF_FIXED("PCLKAL", R9A09G077_CLK_PCLKAL, CLK_PLL4D1, 24, 1), DEF_FIXED("SDHI_CLKHS", R9A09G077_SDHI_CLKHS, CLK_SEL_CLK_PLL2, 1, 1), DEF_FIXED("USB_CLK", R9A09G077_USB_CLK, CLK_PLL4D1, 48, 1), DEF_FIXED("ETCLKA", R9A09G077_ETCLKA, CLK_SEL_CLK_PLL1, 5, 1), @@ -242,6 +335,8 @@ static const struct cpg_core_clk r9a09g077_core_clks[] = __initconst =3D { FSELXSPI1, dtable_6_8_16_32_64), DEF_MUX("PCLKCAN", R9A09G077_PCLKCAN, FSELCANFD, sel_clk_pll4d3_div10_div20, ARRAY_SIZE(sel_clk_pll4d3_div10_div20), 0), + DEF_DIV_LCDC("LCDC_CLKD", R9A09G077_LCDC_CLKD, CLK_SEL_CLK_PLL3, LCDCDIVS= EL, + dtable_2_32), }; =20 static const struct mssr_mod_clk r9a09g077_mod_clks[] __initconst =3D { @@ -272,6 +367,7 @@ static const struct mssr_mod_clk r9a09g077_mod_clks[] _= _initconst =3D { DEF_MOD("sci5fck", 600, CLK_SCI5ASYNC), DEF_MOD("iic2", 601, R9A09G077_CLK_PCLKL), DEF_MOD("spi3", 602, CLK_SPI3ASYNC), + DEF_MOD("lcdc", 1204, R9A09G077_CLK_PCLKAL), DEF_MOD("sdhi0", 1212, R9A09G077_CLK_PCLKAM), DEF_MOD("sdhi1", 1213, R9A09G077_CLK_PCLKAM), }; @@ -481,6 +577,272 @@ r9a09g077_cpg_fselxspi_div_clk_register(struct device= *dev, return hw->clk; } =20 +static unsigned long r9a09g077_cpg_pll3_clk_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) +{ + struct pll_clk *pll_clk =3D to_pll(hw); + u32 ctr0, ctr1; + u8 pdiv, sdiv; + u64 rate; + u16 mdiv; + s16 kdiv; + + ctr0 =3D readl(CPG_PLL3_VCO_CTR0(pll_clk->reg)); + ctr1 =3D readl(CPG_PLL3_VCO_CTR1(pll_clk->reg)); + + pdiv =3D FIELD_GET(CPG_PLL3_VCO_CTR0_PDIV, ctr0); + mdiv =3D FIELD_GET(CPG_PLL3_VCO_CTR0_MDIV, ctr0); + kdiv =3D (s16)FIELD_GET(CPG_PLL3_VCO_CTR1_KDIV, ctr1); + sdiv =3D FIELD_GET(CPG_PLL3_VCO_CTR1_SDIV, ctr1); + + rate =3D mul_u64_u32_shr(parent_rate, (mdiv << 16) + kdiv, 16 + sdiv); + + return DIV_ROUND_CLOSEST_ULL(rate, pdiv); +} + +static int r9a09g077_cpg_pll3_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) +{ + struct pll_clk *pll_clk =3D to_pll(hw); + u64 rate_millihz; + + if (req->rate =3D=3D pll_clk->cur_rate) + return 0; + + rate_millihz =3D mul_u32_u32(req->rate, MILLI); + if (!rzv2h_cpg_get_pll_pars(pll_clk->limits, &pll_clk->pll_parameters, + rate_millihz)) { + dev_dbg(pll_clk->dev, + "failed to determine rate for req->rate: %lu\n", + req->rate); + return -EINVAL; + } + req->rate =3D DIV_ROUND_CLOSEST_ULL(pll_clk->pll_parameters.freq_millihz,= MILLI); + pll_clk->cur_rate =3D req->rate; + + return 0; +} + +static int r9a09g077_cpg_pll3_set_rate(struct clk_hw *hw, unsigned long ra= te, + unsigned long parent_rate) +{ + struct pll_clk *pll_clk =3D to_pll(hw); + struct rzv2h_pll_pars *params =3D &pll_clk->pll_parameters; + void __iomem *offset =3D pll_clk->reg; + u32 val; + int ret; + + /* Put PLL into standby mode */ + writel(0, offset); + ret =3D readl_poll_timeout_atomic(CPG_PLL_MON(offset), + val, !(val & CPG_PLL_MON_LOCK), + 100, 2000); + if (ret) { + dev_err(pll_clk->dev, "Failed to put PLL into standby mode"); + return ret; + } + + /* Output clock setting 1 */ + val =3D readl(CPG_PLL3_VCO_CTR0(offset)); + FIELD_MODIFY(CPG_PLL3_VCO_CTR0_MDIV, &val, params->m); + FIELD_MODIFY(CPG_PLL3_VCO_CTR0_PDIV, &val, params->p); + writel(val, CPG_PLL3_VCO_CTR0(offset)); + + /* Output clock setting 2 */ + val =3D readl(CPG_PLL3_VCO_CTR1(offset)); + FIELD_MODIFY(CPG_PLL3_VCO_CTR1_KDIV, &val, params->k); + FIELD_MODIFY(CPG_PLL3_VCO_CTR1_SDIV, &val, params->s); + writel(val, CPG_PLL3_VCO_CTR1(offset)); + + writel(CPG_PLL_EN_EN, offset); + + /* PLL normal mode transition, output clock stability check */ + ret =3D readl_poll_timeout_atomic(CPG_PLL_MON(offset), + val, (val & CPG_PLL_MON_LOCK), + 100, 2000); + if (ret) { + writel(0, offset); + dev_err(pll_clk->dev, "Failed to put PLL into normal mode"); + return ret; + } + + return 0; +} + +static const struct clk_ops r9a09g077_cpg_pll3_ops =3D { + .recalc_rate =3D r9a09g077_cpg_pll3_clk_recalc_rate, + .determine_rate =3D r9a09g077_cpg_pll3_determine_rate, + .set_rate =3D r9a09g077_cpg_pll3_set_rate, +}; + +static struct clk * __init +r9a09g077_cpg_pll3_clk_register(struct device *dev, + const struct cpg_core_clk *core, + void __iomem *addr, + struct cpg_mssr_pub *pub, + const struct rzv2h_pll_limits *limits) +{ + struct clk_init_data init =3D {}; + const struct clk *parent; + const char *parent_name; + struct pll_clk *pll_clk; + int ret; + + parent =3D pub->clks[core->parent]; + if (IS_ERR(parent)) + return ERR_CAST(parent); + + pll_clk =3D devm_kzalloc(dev, sizeof(*pll_clk), GFP_KERNEL); + if (!pll_clk) + return ERR_PTR(-ENOMEM); + + parent_name =3D __clk_get_name(parent); + init.name =3D core->name; + init.ops =3D &r9a09g077_cpg_pll3_ops; + init.parent_names =3D &parent_name; + init.num_parents =3D 1; + + pll_clk->dev =3D dev; + pll_clk->hw.init =3D &init; + pll_clk->reg =3D addr; + pll_clk->limits =3D limits; + + ret =3D devm_clk_hw_register(dev, &pll_clk->hw); + if (ret) + return ERR_PTR(ret); + + return pll_clk->hw.clk; +} + +static int r9a09g077_cpg_lcdc_div_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) +{ + struct r9a09g077_lcdc_div_clk *dsi_div =3D to_lcdc_div_clk(hw); + struct pll_clk *pll_clk =3D to_pll(clk_hw_get_parent(clk_hw_get_parent(hw= ))); + u8 table[RZT2H_MAX_LCDC_DIV_TABLES] =3D { 0 }; + struct rzv2h_pll_div_pars dsi_params; + const struct clk_div_table *div; + unsigned int i =3D 0; + u64 freq_millihz; + + for (div =3D dsi_div->dtable; div->div; div++) { + if (i >=3D RZT2H_MAX_LCDC_DIV_TABLES) + return -EINVAL; + table[i++] =3D div->div; + } + + freq_millihz =3D mul_u32_u32(req->rate, MILLI); + + if (!rzv2h_cpg_get_pll_divs_pars(pll_clk->limits, &dsi_params, table, + i, freq_millihz)) { + dev_err(dsi_div->dev, + "LCDC divider failed to determine rate for req->rate: %lu\n", + req->rate); + return -EINVAL; + } + + req->rate =3D DIV_ROUND_CLOSEST_ULL(dsi_params.div.freq_millihz, MILLI); + req->best_parent_rate =3D req->rate * dsi_params.div.divider_value; + dsi_div->divider =3D dsi_params.div.divider_value; + pll_clk->cur_rate =3D req->best_parent_rate; + pll_clk->pll_parameters =3D dsi_params.pll; + + return 0; +} + +static int r9a09g077_cpg_lcdc_div_set_rate(struct clk_hw *hw, + unsigned long rate, + unsigned long parent_rate) +{ + struct r9a09g077_lcdc_div_clk *dsi_div =3D to_lcdc_div_clk(hw); + const struct clk_div_table *clkt; + bool divider_found =3D false; + u32 val, shift; + + for (clkt =3D dsi_div->dtable; clkt->div; clkt++) { + if (clkt->div =3D=3D dsi_div->divider) { + divider_found =3D true; + break; + } + } + + if (!divider_found) + return -EINVAL; + + shift =3D GET_SHIFT(dsi_div->conf); + val =3D readl(dsi_div->reg); + val &=3D ~(clk_div_mask(GET_WIDTH(dsi_div->conf)) << shift); + val |=3D clkt->val << shift; + writel(val, dsi_div->reg); + + return 0; +} + +static unsigned long +r9a09g077_cpg_lcdc_div_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) +{ + struct r9a09g077_lcdc_div_clk *dsi_div =3D to_lcdc_div_clk(hw); + u32 div; + + div =3D readl(dsi_div->reg); + div >>=3D GET_SHIFT(dsi_div->conf); + div &=3D clk_div_mask(GET_WIDTH(dsi_div->conf)); + div =3D dsi_div->dtable[div].div; + + return DIV_ROUND_CLOSEST_ULL(parent_rate, div); +} + +static const struct clk_ops r9a09g077_cpg_lcdc_div_ops =3D { + .recalc_rate =3D r9a09g077_cpg_lcdc_div_recalc_rate, + .determine_rate =3D r9a09g077_cpg_lcdc_div_determine_rate, + .set_rate =3D r9a09g077_cpg_lcdc_div_set_rate, +}; + +static struct clk * __init +r9a09g077_cpg_lcdc_div_clk_register(struct device *dev, + const struct cpg_core_clk *core, + void __iomem *addr, + struct cpg_mssr_pub *pub) +{ + struct r9a09g077_lcdc_div_clk *clk_hw_data; + struct clk **clks =3D pub->clks; + struct clk_init_data init; + const struct clk *parent; + const char *parent_name; + struct clk_hw *hw; + int ret; + + parent =3D clks[core->parent]; + if (IS_ERR(parent)) + return ERR_CAST(parent); + + clk_hw_data =3D devm_kzalloc(dev, sizeof(*clk_hw_data), GFP_KERNEL); + if (!clk_hw_data) + return ERR_PTR(-ENOMEM); + + clk_hw_data->dtable =3D core->dtable; + clk_hw_data->reg =3D addr; + clk_hw_data->conf =3D core->conf; + clk_hw_data->dev =3D dev; + clk_hw_data->divider =3D 32; /* Initialize divider for LCDC */ + + parent_name =3D __clk_get_name(parent); + init.name =3D core->name; + init.ops =3D &r9a09g077_cpg_lcdc_div_ops; + init.flags =3D core->flag; + init.parent_names =3D &parent_name; + init.num_parents =3D 1; + + hw =3D &clk_hw_data->hw; + hw->init =3D &init; + ret =3D devm_clk_hw_register(dev, hw); + if (ret) + return ERR_PTR(ret); + + return hw->clk; +} + static struct clk * __init r9a09g077_cpg_clk_register(struct device *dev, const struct cpg_core_clk *= core, const struct cpg_mssr_info *info, @@ -497,6 +859,11 @@ r9a09g077_cpg_clk_register(struct device *dev, const s= truct cpg_core_clk *core, return r9a09g077_cpg_mux_clk_register(dev, core, addr, pub); case CLK_TYPE_RZT2H_FSELXSPI: return r9a09g077_cpg_fselxspi_div_clk_register(dev, core, addr, pub); + case CLK_TYPE_RZT2H_PLL3: + return r9a09g077_cpg_pll3_clk_register(dev, core, pub->base1 + offset, + pub, &r9a09g077_cpg_pll3_limits); + case CLK_TYPE_RZT2H_LCDCDIV: + return r9a09g077_cpg_lcdc_div_clk_register(dev, core, addr, pub); default: return ERR_PTR(-EINVAL); } --=20 2.54.0