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 v4 5/9] clk: sunxi-ng: Implement minimum for multipliers
Date: Thu, 20 Oct 2016 19:30:53 +0200	[thread overview]
Message-ID: <20161020173053.bz2jgy6jgy43own5@lukather> (raw)
In-Reply-To: <CAGb2v67Mo41RHiWd=9+ggcDDmWJ2Miyo17Nni3p3mmAzoJng3w@mail.gmail.com>

On Thu, Oct 20, 2016 at 11:06:21PM +0800, Chen-Yu Tsai wrote:
> On Tue, Oct 11, 2016 at 10:28 PM, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
> > Allow the CCU drivers to specify a multiplier for their clocks.
> >
> > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> > ---
> >  drivers/clk/sunxi-ng/ccu_mult.c |  2 +-
> >  drivers/clk/sunxi-ng/ccu_mult.h | 13 +++++++++----
> >  drivers/clk/sunxi-ng/ccu_nk.c   |  8 ++++----
> >  drivers/clk/sunxi-ng/ccu_nkm.c  |  8 ++++----
> >  drivers/clk/sunxi-ng/ccu_nkmp.c |  4 ++--
> >  drivers/clk/sunxi-ng/ccu_nm.c   |  2 +-
> >  6 files changed, 21 insertions(+), 16 deletions(-)
> >
> > diff --git a/drivers/clk/sunxi-ng/ccu_mult.c b/drivers/clk/sunxi-ng/ccu_mult.c
> > index 6a02ffee5386..678b6cb49f01 100644
> > --- a/drivers/clk/sunxi-ng/ccu_mult.c
> > +++ b/drivers/clk/sunxi-ng/ccu_mult.c
> > @@ -105,7 +105,7 @@ static int ccu_mult_set_rate(struct clk_hw *hw, unsigned long rate,
> >         ccu_mux_helper_adjust_parent_for_prediv(&cm->common, &cm->mux, -1,
> >                                                 &parent_rate);
> >
> > -       _cm.min = 1;
> > +       _cm.min = cm->mult.min;
> >         _cm.max = 1 << cm->mult.width;
> >         ccu_mult_find_best(parent_rate, rate, &_cm);
> >
> > diff --git a/drivers/clk/sunxi-ng/ccu_mult.h b/drivers/clk/sunxi-ng/ccu_mult.h
> > index 113780b7558e..c1a2134bdc71 100644
> > --- a/drivers/clk/sunxi-ng/ccu_mult.h
> > +++ b/drivers/clk/sunxi-ng/ccu_mult.h
> > @@ -7,14 +7,19 @@
> >  struct ccu_mult_internal {
> >         u8      shift;
> >         u8      width;
> > +       u8      min;
> >  };
> >
> > -#define _SUNXI_CCU_MULT(_shift, _width)                \
> > -       {                                       \
> > -               .shift  = _shift,               \
> > -               .width  = _width,               \
> > +#define _SUNXI_CCU_MULT_MIN(_shift, _width, _min)      \
> > +       {                                               \
> > +               .shift  = _shift,                       \
> > +               .width  = _width,                       \
> > +               .min    = _min,                         \
> >         }
> >
> > +#define _SUNXI_CCU_MULT(_shift, _width)                \
> > +       _SUNXI_CCU_MULT_MIN(_shift, _width, 1)
> > +
> >  struct ccu_mult {
> >         u32                     enable;
> >
> > diff --git a/drivers/clk/sunxi-ng/ccu_nk.c b/drivers/clk/sunxi-ng/ccu_nk.c
> > index a42d870ba0ef..eaf0fdf78d2b 100644
> > --- a/drivers/clk/sunxi-ng/ccu_nk.c
> > +++ b/drivers/clk/sunxi-ng/ccu_nk.c
> > @@ -97,9 +97,9 @@ static long ccu_nk_round_rate(struct clk_hw *hw, unsigned long rate,
> >         if (nk->common.features & CCU_FEATURE_FIXED_POSTDIV)
> >                 rate *= nk->fixed_post_div;
> >
> > -       _nk.min_n = 1;
> > +       _nk.min_n = nk->n.min;
> >         _nk.max_n = 1 << nk->n.width;
> > -       _nk.min_k = 1;
> > +       _nk.min_k = nk->k.min;
> >         _nk.max_k = 1 << nk->k.width;
> >
> >         ccu_nk_find_best(*parent_rate, rate, &_nk);
> > @@ -122,9 +122,9 @@ static int ccu_nk_set_rate(struct clk_hw *hw, unsigned long rate,
> >         if (nk->common.features & CCU_FEATURE_FIXED_POSTDIV)
> >                 rate = rate * nk->fixed_post_div;
> >
> > -       _nk.min_n = 1;
> > +       _nk.min_n = nk->n.min;
> >         _nk.max_n = 1 << nk->n.width;
> > -       _nk.min_k = 1;
> > +       _nk.min_k = nk->k.min;
> >         _nk.max_k = 1 << nk->k.width;
> >
> >         ccu_nk_find_best(parent_rate, rate, &_nk);
> > diff --git a/drivers/clk/sunxi-ng/ccu_nkm.c b/drivers/clk/sunxi-ng/ccu_nkm.c
> > index b2a5fccf2f8c..715b49211ddb 100644
> > --- a/drivers/clk/sunxi-ng/ccu_nkm.c
> > +++ b/drivers/clk/sunxi-ng/ccu_nkm.c
> > @@ -100,9 +100,9 @@ static unsigned long ccu_nkm_round_rate(struct ccu_mux_internal *mux,
> >         struct ccu_nkm *nkm = data;
> >         struct _ccu_nkm _nkm;
> >
> > -       _nkm.min_n = 1;
> > +       _nkm.min_n = nkm->n.min;
> >         _nkm.max_n = 1 << nkm->n.width;
> > -       _nkm.min_k = 1;
> > +       _nkm.min_n = nkm->k.min;
> 
> Typo here.
> 
> >         _nkm.max_k = 1 << nkm->k.width;
> >         _nkm.min_m = 1;
> >         _nkm.max_m = nkm->m.max ?: 1 << nkm->m.width;
> > @@ -129,9 +129,9 @@ static int ccu_nkm_set_rate(struct clk_hw *hw, unsigned long rate,
> >         unsigned long flags;
> >         u32 reg;
> >
> > -       _nkm.min_n = 1;
> > +       _nkm.min_n = nkm->n.min;
> >         _nkm.max_n = 1 << nkm->n.width;
> > -       _nkm.min_k = 1;
> > +       _nkm.min_n = nkm->k.min;
> 
> And here.
> 
> >         _nkm.max_k = 1 << nkm->k.width;
> >         _nkm.min_m = 1;
> >         _nkm.max_m = nkm->m.max ?: 1 << nkm->m.width;
> > diff --git a/drivers/clk/sunxi-ng/ccu_nkmp.c b/drivers/clk/sunxi-ng/ccu_nkmp.c
> > index 2c1398192e48..7968e0bac5db 100644
> > --- a/drivers/clk/sunxi-ng/ccu_nkmp.c
> > +++ b/drivers/clk/sunxi-ng/ccu_nkmp.c
> > @@ -107,9 +107,9 @@ static long ccu_nkmp_round_rate(struct clk_hw *hw, unsigned long rate,
> >         struct ccu_nkmp *nkmp = hw_to_ccu_nkmp(hw);
> >         struct _ccu_nkmp _nkmp;
> >
> > -       _nkmp.min_n = 1;
> > +       _nkmp.min_n = nkmp->n.min;
> >         _nkmp.max_n = 1 << nkmp->n.width;
> > -       _nkmp.min_k = 1;
> > +       _nkmp.min_n = nkmp->k.min;
> 
> And here.
> 
> >         _nkmp.max_k = 1 << nkmp->k.width;
> >         _nkmp.min_m = 1;
> >         _nkmp.max_m = nkmp->m.max ?: 1 << nkmp->m.width;
> > diff --git a/drivers/clk/sunxi-ng/ccu_nm.c b/drivers/clk/sunxi-ng/ccu_nm.c
> > index 2a190bc032a9..b1f3f0e8899d 100644
> > --- a/drivers/clk/sunxi-ng/ccu_nm.c
> > +++ b/drivers/clk/sunxi-ng/ccu_nm.c
> > @@ -93,7 +93,7 @@ static long ccu_nm_round_rate(struct clk_hw *hw, unsigned long rate,
> >         struct ccu_nm *nm = hw_to_ccu_nm(hw);
> >         struct _ccu_nm _nm;
> >
> > -       _nm.min_n = 1;
> > +       _nm.min_n = nm->n.min;
> >         _nm.max_n = 1 << nm->n.width;
> >         _nm.min_m = 1;
> >         _nm.max_m = nm->m.max ?: 1 << nm->m.width;
> > --
> > git-series 0.8.10
> 
> Otherwise,
> 
> Acked-by: Chen-Yu Tsai <wens@csie.org>

Fixed and applied, 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/20161020/f586f2e1/attachment.sig>

  reply	other threads:[~2016-10-20 17:30 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-11 14:28 [PATCH v4 0/9] arm64: Allwinner A64 support based on sunxi-ng Maxime Ripard
2016-10-11 14:28 ` [PATCH v4 1/9] clk: sunxi-ng: Rename the internal structures Maxime Ripard
2016-10-20 14:27   ` [linux-sunxi] " Chen-Yu Tsai
2016-10-20 17:24     ` Maxime Ripard
2016-10-11 14:28 ` [PATCH v4 2/9] clk: sunxi-ng: Remove the use of rational computations Maxime Ripard
2016-10-20 14:30   ` Chen-Yu Tsai
2016-10-20 17:26     ` Maxime Ripard
2016-10-11 14:28 ` [PATCH v4 3/9] clk: sunxi-ng: Finish to convert to structures for arguments Maxime Ripard
2016-10-20 14:35   ` Chen-Yu Tsai
2016-10-20 17:26     ` Maxime Ripard
2016-10-11 14:28 ` [PATCH v4 4/9] clk: sunxi-ng: Add minimums for all the relevant structures and clocks Maxime Ripard
2016-10-20 15:04   ` Chen-Yu Tsai
2016-10-20 17:27     ` Maxime Ripard
2016-10-21 22:57   ` André Przywara
2016-10-24 16:03     ` Maxime Ripard
2016-10-11 14:28 ` [PATCH v4 5/9] clk: sunxi-ng: Implement minimum for multipliers Maxime Ripard
2016-10-20 15:06   ` Chen-Yu Tsai
2016-10-20 17:30     ` Maxime Ripard [this message]
2016-10-11 14:28 ` [PATCH v4 6/9] clk: sunxi-ng: Add A64 clocks Maxime Ripard
2016-10-20 15:50   ` [linux-sunxi] " Chen-Yu Tsai
2016-10-20 17:47     ` Maxime Ripard
2016-10-20 18:46   ` Stephen Boyd
2016-10-24 15:05     ` Maxime Ripard
2016-10-11 14:28 ` [PATCH v4 7/9] arm64: dts: add Allwinner A64 SoC .dtsi Maxime Ripard
2016-10-20 15:14   ` [linux-sunxi] " Chen-Yu Tsai
2016-10-20 17:49     ` Maxime Ripard
2016-10-11 14:28 ` [PATCH v4 8/9] Documentation: devicetree: add vendor prefix for Pine64 Maxime Ripard
2016-10-11 14:28 ` [PATCH v4 9/9] arm64: dts: add Pine64 support Maxime Ripard
2016-10-20 15:17   ` [linux-sunxi] " Chen-Yu Tsai

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=20161020173053.bz2jgy6jgy43own5@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