From: maxime.coquelin@st.com (Maxime Coquelin)
To: linux-arm-kernel@lists.infradead.org
Subject: mx6qsabresd hangs on linux-next
Date: Tue, 6 May 2014 18:04:45 +0200 [thread overview]
Message-ID: <5369081D.5030400@st.com> (raw)
In-Reply-To: <CAOMZO5Dx0JMj3dZ7BSgaYSZZ=ZKRqQHEYWj5sb6z_9jc+cpsEw@mail.gmail.com>
Hi Fabio,
On 05/06/2014 05:49 PM, Fabio Estevam wrote:
> On Tue, May 6, 2014 at 12:36 PM, Fabio Estevam <festevam@gmail.com> wrote:
>
>> Indeed, if I revert:
>>
>> commit e7489693b3a853ab6dfad52f7e6af553ae8d3f28
>> Author: Maxime COQUELIN <maxime.coquelin@st.com>
>> Date: Wed Jan 29 17:24:08 2014 +0100
>>
>> clk: divider: Optimize clk_divider_bestdiv loop
>>
>> Currently, the for-loop used to try all the different dividers to find the
>> one that best fit tries all the values from 1 to max_div,
>> incrementing by one.
>> In case of power-of-two, or table based divider, the loop isn't optimal.
>>
>> Instead of incrementing by one, this patch provides directly the
>> next divider.
>>
>> Signed-off-by: Maxime Coquelin <maxime.coquelin@st.com>
>> Signed-off-by: Mike Turquette <mturquette@linaro.org>
>>
>> Then the board does not hang.
>
> Isn't the increment of i missing?
i is incremented in _next_div():
+static int _next_div(struct clk_divider *divider, int div)
+{
+ div++;
+
+ if (divider->flags & CLK_DIVIDER_POWER_OF_TWO)
+ return __roundup_pow_of_two(div);
+ if (divider->table)
+ return _round_up_table(divider->table, div);
+
+ return div;
+}
Could you tell me which kind of divider it is? pow2, table, linear?
>
> --- a/drivers/clk/clk-divider.c
> +++ b/drivers/clk/clk-divider.c
> @@ -279,7 +279,7 @@ static int clk_divider_bestdiv(struct clk_hw *hw,
> unsigned long rate,
> */
> maxdiv = min(ULONG_MAX / rate, maxdiv);
>
> - for (i = 1; i <= maxdiv; i = _next_div(divider, i)) {
> + for (i = 1; i <= maxdiv; i +=_next_div(divider, i)) {
This would break power-of-two, and table based dividers.
> if (!_is_valid_div(divider, i))
> continue;
> if (rate * i == parent_rate_saved) {
>
Regards,
Maxime
next prev parent reply other threads:[~2014-05-06 16:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-05 22:50 mx6qsabresd hangs on linux-next Fabio Estevam
2014-05-06 14:13 ` Shawn Guo
2014-05-06 15:36 ` Fabio Estevam
2014-05-06 15:49 ` Fabio Estevam
2014-05-06 16:04 ` Maxime Coquelin [this message]
2014-05-06 16:17 ` Fabio Estevam
2014-05-06 20:00 ` Sascha Hauer
2014-05-07 2:09 ` Shawn Guo
2014-05-07 3:32 ` Shawn Guo
2014-05-07 8:32 ` Maxime Coquelin
2014-05-07 14:39 ` Fabio Estevam
2014-05-07 16:54 ` Maxime Coquelin
2014-05-07 6:15 ` Sascha Hauer
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=5369081D.5030400@st.com \
--to=maxime.coquelin@st.com \
--cc=linux-arm-kernel@lists.infradead.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).