From: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
To: Biju <biju.das.au@gmail.com>
Cc: "Uwe Kleine-König" <ukleinek@kernel.org>,
"Geert Uytterhoeven" <geert+renesas@glider.be>,
"Magnus Damm" <magnus.damm@gmail.com>,
"Biju Das" <biju.das.jz@bp.renesas.com>,
linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-renesas-soc@vger.kernel.org,
"Prabhakar Mahadev Lad" <prabhakar.mahadev-lad.rj@bp.renesas.com>
Subject: Re: [PATCH 5/7] pwm: rzg2l-gpt: Add RZ/G3E support
Date: Tue, 19 Aug 2025 18:23:14 +0200 [thread overview]
Message-ID: <aKSk8ozFw8wHbSIH@tom-desktop> (raw)
In-Reply-To: <20250814184115.192930-6-biju.das.jz@bp.renesas.com>
Hi Biju,
Thank you for your patch.
On Thu, Aug 14, 2025 at 07:41:09PM +0100, Biju wrote:
> From: Biju Das <biju.das.jz@bp.renesas.com>
>
> Add RZ/G3E GPT support. It has multiple clocks and resets compared to
> RZ/G2L. Also prescale field width and factor for calculating prescale
> are different.
>
Reviewed-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> drivers/pwm/pwm-rzg2l-gpt.c | 36 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 36 insertions(+)
>
> diff --git a/drivers/pwm/pwm-rzg2l-gpt.c b/drivers/pwm/pwm-rzg2l-gpt.c
> index b247a6c181d5..7047359cac63 100644
> --- a/drivers/pwm/pwm-rzg2l-gpt.c
> +++ b/drivers/pwm/pwm-rzg2l-gpt.c
> @@ -153,6 +153,27 @@ static u8 rzg2l_gpt_calculate_prescale(u64 period_ticks)
> return prescale;
> }
>
> +static u8 rzg3e_gpt_calculate_prescale(u64 period_ticks)
> +{
> + u32 prescaled_period_ticks;
> + u8 prescale;
> +
> + prescaled_period_ticks = period_ticks >> 32;
> + if (prescaled_period_ticks >= 64 && prescaled_period_ticks < 256) {
> + prescale = 6;
> + } else if (prescaled_period_ticks >= 256 && prescaled_period_ticks < 1024) {
> + prescale = 8;
> + } else if (prescaled_period_ticks >= 1024) {
> + prescale = 10;
> + } else {
> + prescale = fls(prescaled_period_ticks);
> + if (prescale > 1)
> + prescale -= 1;
> + }
> +
> + return prescale;
> +}
> +
> static int rzg2l_gpt_request(struct pwm_chip *chip, struct pwm_device *pwm)
> {
> struct rzg2l_gpt_chip *rzg2l_gpt = to_rzg2l_gpt_chip(chip);
> @@ -443,6 +464,14 @@ static int rzg2l_gpt_probe(struct platform_device *pdev)
> if (IS_ERR(rstc))
> return dev_err_probe(dev, PTR_ERR(rstc), "Cannot deassert reset control\n");
>
> + rstc = devm_reset_control_get_optional_exclusive_deasserted(dev, "rst_s");
> + if (IS_ERR(rstc))
> + return dev_err_probe(dev, PTR_ERR(rstc), "Cannot deassert rst_s reset\n");
> +
> + clk = devm_clk_get_optional_enabled(dev, "bus");
> + if (IS_ERR(clk))
> + return dev_err_probe(dev, PTR_ERR(clk), "Cannot get bus clock\n");
> +
> clk = devm_clk_get_enabled(dev, NULL);
> if (IS_ERR(clk))
> return dev_err_probe(dev, PTR_ERR(clk), "Cannot get clock\n");
> @@ -481,6 +510,12 @@ static int rzg2l_gpt_probe(struct platform_device *pdev)
> return 0;
> }
>
> +static const struct rzg2l_gpt_info rzg3e_data = {
> + .calculate_prescale = rzg3e_gpt_calculate_prescale,
> + .gtcr_tpcs_mask = GENMASK(26, 23),
> + .prescale_pow_of_two_mult_factor = 1,
> +};
> +
> static const struct rzg2l_gpt_info rzg2l_data = {
> .calculate_prescale = rzg2l_gpt_calculate_prescale,
> .gtcr_tpcs_mask = GENMASK(26, 24),
> @@ -488,6 +523,7 @@ static const struct rzg2l_gpt_info rzg2l_data = {
> };
>
> static const struct of_device_id rzg2l_gpt_of_table[] = {
> + { .compatible = "renesas,r9a09g047-gpt", .data = &rzg3e_data },
> { .compatible = "renesas,rzg2l-gpt", .data = &rzg2l_data },
> { /* Sentinel */ }
> };
> --
> 2.43.0
>
Thanks & Regards,
Tommaso
prev parent reply other threads:[~2025-08-19 16:23 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-14 18:41 [PATCH 0/7] Add RZ/G3E support Biju
2025-08-14 18:41 ` [PATCH 1/7] dt-bindings: pwm: renesas,rzg2l-gpt: Document " Biju
2025-08-19 16:18 ` Tommaso Merciai
2025-08-20 20:29 ` Rob Herring
2025-08-21 7:04 ` Biju Das
2025-08-14 18:41 ` [PATCH 2/7] pwm: rzg2l-gpt: Add info variable to struct rzg2l_gpt_chip Biju
2025-08-19 16:20 ` Tommaso Merciai
2025-08-14 18:41 ` [PATCH 3/7] pwm: rzg2l-gpt: Add prescale_pow_of_two_mult_factor variable to struct rzg2l_gpt_info Biju
2025-08-19 16:21 ` Tommaso Merciai
2025-08-14 18:41 ` [PATCH 4/7] pwm: rzg2l-gpt: Add calculate_prescale() callback " Biju
2025-08-19 16:22 ` Tommaso Merciai
2025-08-14 18:41 ` [PATCH 5/7] pwm: rzg2l-gpt: Add RZ/G3E support Biju
2025-08-19 16:23 ` Tommaso Merciai [this message]
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=aKSk8ozFw8wHbSIH@tom-desktop \
--to=tommaso.merciai.xr@bp.renesas.com \
--cc=biju.das.au@gmail.com \
--cc=biju.das.jz@bp.renesas.com \
--cc=geert+renesas@glider.be \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=ukleinek@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).