public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: maxime.ripard@free-electrons.com (Maxime Ripard)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 3/7] clk: sunxi-ng: Implement multiplier maximum
Date: Sat, 21 Jan 2017 23:13:09 +0100	[thread overview]
Message-ID: <20170121221309.rf6tpidpipoe2tfj@lukather> (raw)
In-Reply-To: <CAGb2v65p9rQv+AQqTVs=wtJbesQNF36YNdeTSSGp=c9SSyjViw@mail.gmail.com>

On Sat, Jan 21, 2017 at 09:27:42AM +0800, Chen-Yu Tsai wrote:
> On Fri, Jan 20, 2017 at 3:29 PM, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
> > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> > ---
> >  drivers/clk/sunxi-ng/ccu_mult.c | 16 +++++++++++++---
> >  drivers/clk/sunxi-ng/ccu_mult.h | 10 ++++++----
> >  drivers/clk/sunxi-ng/ccu_nk.c   |  8 ++++----
> >  drivers/clk/sunxi-ng/ccu_nkm.c  |  8 ++++----
> >  drivers/clk/sunxi-ng/ccu_nkmp.c |  8 ++++----
> >  drivers/clk/sunxi-ng/ccu_nm.c   |  4 ++--
> >  6 files changed, 33 insertions(+), 21 deletions(-)
> >
> > diff --git a/drivers/clk/sunxi-ng/ccu_mult.c b/drivers/clk/sunxi-ng/ccu_mult.c
> > index 8b7ee7baa85b..8724c01171b1 100644
> > --- a/drivers/clk/sunxi-ng/ccu_mult.c
> > +++ b/drivers/clk/sunxi-ng/ccu_mult.c
> > @@ -40,8 +40,13 @@ static unsigned long ccu_mult_round_rate(struct ccu_mux_internal *mux,
> >         struct ccu_mult *cm = data;
> >         struct _ccu_mult _cm;
> >
> > -       _cm.min = 1;
> > -       _cm.max = 1 << cm->mult.width;
> > +       _cm.min = cm->mult.min;
> 
> This particular line should probably be in a separate patch fixing
> commit 2beaa601c849 ("clk: sunxi-ng: Implement minimum for multipliers")?
> It kind of sticks out, and doesn't match the commit message.

Indeed (also because there's no commit message, I'll fix that.)

> > +
> > +       if (cm->mult.max)
> > +               _cm.max = cm->mult.max;
> > +       else
> > +               _cm.max = (1 << cm->mult.width) + cm->mult.offset - 1;
> > +
> >         ccu_mult_find_best(parent_rate, rate, &_cm);
> >
> >         return parent_rate * _cm.mult;
> > @@ -114,7 +119,12 @@ static int ccu_mult_set_rate(struct clk_hw *hw, unsigned long rate,
> >                                                 &parent_rate);
> >
> >         _cm.min = cm->mult.min;
> > -       _cm.max = 1 << cm->mult.width;
> > +
> > +       if (cm->mult.max)
> > +               _cm.max = cm->mult.max;
> > +       else
> > +               _cm.max = (1 << cm->mult.width) + cm->mult.offset - 1;
> 
> The changes look good. Thinking about this more, you might need to
> adjust the default minimum to account for the offset as well? At
> the moment it doesn't really affect us, as the offset is either
> 1 or 0, which means a minimum of 1 is equally good. But leaving
> a potential error in there doesn't feel right.

I'm not sure we should really care, I'm not aware of any SoC that
would have such a clock, either in the "old" or "new" ones. I'm not
sure we should fix that isn't broken.

> Said change would be against patch 2, so
> 
> Acked-by: Chen-Yu Tsai <wens@csie.org>
> 
> for this patch once the first comment is addressed.

I'll do that change and respin the serie, thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170121/d293a654/attachment.sig>

  reply	other threads:[~2017-01-21 22:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-20  7:29 [PATCH v3 0/7] ARM: sun5i: Convert sun5i SoCs to sunxi-ng Maxime Ripard
2017-01-20  7:29 ` [PATCH v3 1/7] clk: sunxi-ng: multiplier: Add fractional support Maxime Ripard
2017-01-20  7:29 ` [PATCH v3 2/7] clk: sunxi-ng: Implement factors offsets Maxime Ripard
2017-01-20  7:29 ` [PATCH v3 3/7] clk: sunxi-ng: Implement multiplier maximum Maxime Ripard
2017-01-21  1:27   ` Chen-Yu Tsai
2017-01-21 22:13     ` Maxime Ripard [this message]
2017-01-23  5:24       ` Chen-Yu Tsai
2017-01-20  7:29 ` [PATCH v3 4/7] clk: sunxi-ng: Implement global pre-divider Maxime Ripard
2017-01-21  1:28   ` Chen-Yu Tsai
2017-01-20  7:29 ` [PATCH v3 5/7] clk: sunxi-ng: Add sun5i CCU driver Maxime Ripard
2017-01-21  1:34   ` Chen-Yu Tsai
2017-01-21 17:34     ` Maxime Ripard
2017-01-20  7:29 ` [PATCH v3 6/7] ARM: sun5i: Convert to CCU Maxime Ripard
2017-01-20  7:29 ` [PATCH v3 7/7] ARM: gr8: " Maxime Ripard

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=20170121221309.rf6tpidpipoe2tfj@lukather \
    --to=maxime.ripard@free-electrons.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