From: Sascha Hauer <s.hauer@pengutronix.de>
To: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH 4/8] clk: add divider_recalc_rate helper
Date: Tue, 15 Jan 2019 07:43:27 +0100 [thread overview]
Message-ID: <20190115064327.d2ydxfuyzlkgkiil@pengutronix.de> (raw)
In-Reply-To: <CAHQ1cqEhbRQiM27vXtn4oExK4ZRVr3Cv8QooHE-=jzEH_V3zZg@mail.gmail.com>
On Mon, Jan 14, 2019 at 04:20:04PM -0800, Andrey Smirnov wrote:
> On Mon, Jan 14, 2019 at 8:42 AM Lucas Stach <l.stach@pengutronix.de> wrote:
> >
> > Closer to Linux kernel implementation and needed for imx8mq
> > composite clock.
> >
> > Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> > ---
> > drivers/clk/clk-divider.c | 30 ++++++++++++++++++++++--------
> > include/linux/clk.h | 5 +++++
> > 2 files changed, 27 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c
> > index 791e10ea99cd..7b1bdde1ce18 100644
> > --- a/drivers/clk/clk-divider.c
> > +++ b/drivers/clk/clk-divider.c
> > @@ -20,6 +20,7 @@
> > #include <linux/clk.h>
> > #include <linux/err.h>
> > #include <linux/log2.h>
> > +#include <asm-generic/div64.h>
> >
> > #define div_mask(d) ((1 << ((d)->width)) - 1)
> >
> > @@ -56,17 +57,17 @@ static unsigned int _get_table_div(const struct clk_div_table *table,
> > return 0;
> > }
> >
> > -static unsigned int _get_div(struct clk_divider *divider, unsigned int val)
> > +static unsigned int _get_div(const struct clk_div_table *table,
> > + unsigned int val, unsigned long flags, u8 width)
> > {
> > - if (divider->flags & CLK_DIVIDER_ONE_BASED)
> > + if (flags & CLK_DIVIDER_ONE_BASED)
> > return val;
> > - if (divider->flags & CLK_DIVIDER_POWER_OF_TWO)
> > + if (flags & CLK_DIVIDER_POWER_OF_TWO)
> > return 1 << val;
> > - if (divider->table)
> > - return _get_table_div(divider->table, val);
> > + if (table)
> > + return _get_table_div(table, val);
> > return val + 1;
> > }
> > -
> > static unsigned int _get_table_val(const struct clk_div_table *table,
> > unsigned int div)
> > {
> > @@ -89,6 +90,18 @@ static unsigned int _get_val(struct clk_divider *divider, unsigned int div)
> > return div - 1;
> > }
> >
> > +unsigned long divider_recalc_rate(struct clk *clk, unsigned long parent_rate,
> > + unsigned int val,
> > + const struct clk_div_table *table,
> > + unsigned long flags, unsigned long width)
> > +{
> > + unsigned int div;
> > +
> > + div = _get_div(table, val, flags, width);
> > +
> > + return DIV_ROUND_UP_ULL((u64)parent_rate, div);
>
> I just rebased on latest 'next', but I don't seem to have the
> definition for DIV_ROUND_UP_ULL(), which breaks the build. Is there a
> patch that I am missing?
It was part of "mtd: core: Fix erase area alignment for non power of 2
erasesize" from Ladis, but not in v2 anymore. I'll add it to this patch
then.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2019-01-15 6:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-14 16:42 [PATCH 1/8] clk: add missing list.h include Lucas Stach
2019-01-14 16:42 ` [PATCH 2/8] clk: move struct clk_gate into header Lucas Stach
2019-01-14 16:42 ` [PATCH 3/8] clk: move struct clk_mux " Lucas Stach
2019-01-14 16:42 ` [PATCH 4/8] clk: add divider_recalc_rate helper Lucas Stach
2019-01-15 0:20 ` Andrey Smirnov
2019-01-15 6:43 ` Sascha Hauer [this message]
2019-01-14 16:42 ` [PATCH 5/8] clk: imx: add imx8mq composite clock Lucas Stach
2019-01-14 16:42 ` [PATCH 6/8] clk: imx: sync imx8mq clock driver with upstream kernel Lucas Stach
2019-01-14 16:42 ` [PATCH 7/8] pinctrl: imx-v3: imx8mq does use the old binding Lucas Stach
2019-01-14 16:42 ` [PATCH 8/8] ARM: imx8mq: use upstream devicetree Lucas Stach
2019-01-15 0:41 ` Andrey Smirnov
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=20190115064327.d2ydxfuyzlkgkiil@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=andrew.smirnov@gmail.com \
--cc=barebox@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