From: Benedikt Spranger <b.spranger@linutronix.de>
To: Maxime Ripard <mripard@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org,
Stephen Boyd <sboyd@kernel.org>,
Michael Turquette <mturquette@baylibre.com>,
Dinh Nguyen <dinguyen@kernel.org>
Subject: Re: [PATCH 1/1] clk: socfpga: gate: Fix of by factor 2 for serial console
Date: Wed, 11 Oct 2023 16:03:47 +0200 [thread overview]
Message-ID: <20231011160339.51e3ff1e@mitra> (raw)
In-Reply-To: <xcq3wiayrfa67pn4thepgewrcif4fdhplykvb4nkwgmxd3i7yo@vcimkuy32qd4>
On Wed, 11 Oct 2023 11:17:22 +0200
Maxime Ripard <mripard@kernel.org> wrote:
Hi,
> Could you test that patch?
The system booted fine. Serial console is working as expected
> ----8<----
>
> diff --git a/drivers/clk/socfpga/clk-gate.c b/drivers/clk/socfpga/clk-gate.c
> index 8dd601bd8538..486a4d84e418 100644
> --- a/drivers/clk/socfpga/clk-gate.c
> +++ b/drivers/clk/socfpga/clk-gate.c
> @@ -87,10 +87,8 @@ static int socfpga_clk_set_parent(struct clk_hw *hwclk, u8 parent)
> return 0;
> }
>
> -static unsigned long socfpga_clk_recalc_rate(struct clk_hw *hwclk,
> - unsigned long parent_rate)
> +static u32 socfpga_clk_get_div(struct socfpga_gate_clk *socfpgaclk)
> {
> - struct socfpga_gate_clk *socfpgaclk = to_socfpga_gate_clk(hwclk);
> u32 div = 1, val;
>
> if (socfpgaclk->fixed_div)
> @@ -105,12 +103,33 @@ static unsigned long socfpga_clk_recalc_rate(struct clk_hw *hwclk,
> div = (1 << val);
> }
>
> + return div;
> +}
> +
> +static unsigned long socfpga_clk_recalc_rate(struct clk_hw *hwclk,
> + unsigned long parent_rate)
> +{
> + struct socfpga_gate_clk *socfpgaclk = to_socfpga_gate_clk(hwclk);
> + u32 div = socfpga_clk_get_div(socfpgaclk);
> +
> return parent_rate / div;
> }
>
> +
> +static int socfpga_clk_determine_rate(struct clk_hw *hw,
*hwclk,
> + struct clk_rate_request *req)
> +{
> + struct socfpga_gate_clk *socfpgaclk = to_socfpga_gate_clk(hwclk);
> + u32 div = socfpga_clk_get_div(socfpgaclk);
> +
> + req->rate = req->best_parent_rate / div;
> +
> + return 0;
> +}
> +
> static struct clk_ops gateclk_ops = {
> .recalc_rate = socfpga_clk_recalc_rate,
> - .determine_rate = clk_hw_determine_rate_no_reparent,
> + .determine_rate = socfpga_clk_determine_rate,
> .get_parent = socfpga_clk_get_parent,
> .set_parent = socfpga_clk_set_parent,
> };
Regards
Benedikt Spranger
prev parent reply other threads:[~2023-10-11 14:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-05 9:59 [PATCH 0/1] Broken serial console on Altera Cyclon V board Benedikt Spranger
2023-10-05 9:59 ` [PATCH 1/1] clk: socfpga: gate: Fix of by factor 2 for serial console Benedikt Spranger
2023-10-05 11:34 ` Maxime Ripard
2023-10-05 18:32 ` Benedikt Spranger
2023-10-05 21:03 ` Stephen Boyd
2023-10-06 3:39 ` Benedikt Spranger
2023-10-06 14:53 ` Maxime Ripard
2023-10-06 15:01 ` Maxime Ripard
2023-10-06 16:40 ` Benedikt Spranger
2023-10-11 9:17 ` Maxime Ripard
2023-10-11 14:03 ` Benedikt Spranger [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=20231011160339.51e3ff1e@mitra \
--to=b.spranger@linutronix.de \
--cc=dinguyen@kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mripard@kernel.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@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