From: Mike Turquette <mturquette@linaro.org>
To: "Heiko Stübner" <heiko@sntech.de>, linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org, devicetree-discuss@lists.ozlabs.org
Subject: Re: [PATCH RFC 3/3] clk: dt: binding for basic divider clock
Date: Wed, 12 Jun 2013 19:41:38 -0700 [thread overview]
Message-ID: <20130613024138.26381.96286@quantum> (raw)
In-Reply-To: <201306040018.33236.heiko@sntech.de>
Quoting Heiko Stübner (2013-06-03 15:18:32)
> Am Montag, 3. Juni 2013, 19:53:10 schrieb Mike Turquette:
> > Devicetree binding for the basic clock divider, plus the setup function
> > to register the clock. Based on the existing fixed-clock binding.
> >
> > Signed-off-by: Mike Turquette <mturquette@linaro.org>
> > ---
>
> [...]
>
> > +/**
> > + * of_div_clk_setup() - Setup function for simple div rate clock
> > + */
> > +void of_divider_clk_setup(struct device_node *node)
> > +{
> > + struct clk *clk;
> > + const char *clk_name = node->name;
> > + void __iomem *reg;
> > + const char *parent_name;
> > + u8 clk_divider_flags = 0;
> > + u8 mask = 0;
> > + u8 shift = 0;
>
> in the mux-clock these 3 are unsigned long and u32 types ... what is correct?
>
Good catch. Shifts should be u8, masks should be u32. I've left the
flags as u8. The binding doesn't dictate this and if we end up having
more flags (hopefully not!) then this value can be embiggened.
>
> > + struct clk_div_table *table;
> > +
> > + of_property_read_string(node, "clock-output-names", &clk_name);
> > +
> > + parent_name = of_clk_get_parent_name(node, 0);
> > +
> > + reg = of_iomap(node, 0);
> > +
> > + if (of_property_read_u8(node, "mask", &mask)) {
> > + pr_err("%s: missing mask property for %s\n", __func__, node->name);
> > + return;
> > + }
> > +
> > + if (of_property_read_u8(node, "shift", &shift))
> > + pr_debug("%s: missing shift property defaults to zero for %s\n",
> > + __func__, node->name);
>
> same here ... mux reads u32
>
> > + if (of_property_read_bool(node, "index_one"))
> > + clk_divider_flags |= CLK_DIVIDER_ONE_BASED;
> > +
> > + if (of_property_read_bool(node, "index_power_of_two"))
> > + clk_divider_flags |= CLK_DIVIDER_POWER_OF_TWO;
> > +
> > + if (of_property_read_bool(node, "index_allow_zero"))
> > + clk_divider_flags |= CLK_DIVIDER_ALLOW_ZERO;
> > +
> > + table = of_clk_get_div_table(node);
> > + if (IS_ERR(table))
> > + return;
> > +
> > + clk = clk_register_divider_table(NULL, clk_name,
> > + parent_name, 0,
> > + reg, shift, mask,
> > + clk_divider_flags, table,
> > + NULL);
>
> this causes trouble, as the divider clock code above still requires a width
> instead of a mask. I remember talk about this going to change separately, but
> couldn't find anything of the sort in linux-next.
Right. I viewed creation of the DT bindings a bit separately from the
CCF code, which I think is the right approach. A mask is definitely a
more useful structure than a width value, and the DT bindings need to be
at least a little future-proof, so I chose a mask.
I'll update the divider code to use a mask and post that as part of the
v2 series.
Regards,
Mike
>
>
>
> > +
> > + if (!IS_ERR(clk))
> > + of_clk_add_provider(node, of_clk_src_simple_get, clk);
> > +}
> > +EXPORT_SYMBOL_GPL(of_divider_clk_setup);
> > +CLK_OF_DECLARE(divider_clk, "divider-clock", of_divider_clk_setup);
> > +#endif
next prev parent reply other threads:[~2013-06-13 2:41 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-03 17:53 [PATCH RFC 0/3] clk: dt: bindings for mux & divider clocks Mike Turquette
[not found] ` <1370281990-15090-1-git-send-email-mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-06-03 17:53 ` [PATCH RFC 1/3] clk: of: helper for determining number of parent clocks Mike Turquette
2013-06-03 22:31 ` [PATCH RFC 0/3] clk: dt: bindings for mux & divider clocks Heiko Stübner
2013-06-03 17:53 ` [PATCH RFC 2/3] clk: dt: binding for basic multiplexor clock Mike Turquette
2013-06-03 19:33 ` Heiko Stübner
2013-06-03 20:07 ` Mike Turquette
2013-06-03 20:15 ` Heiko Stübner
[not found] ` <201306032215.45983.heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
2013-06-03 21:39 ` Heiko Stübner
2013-06-04 6:14 ` Mike Turquette
2013-06-03 17:53 ` [PATCH RFC 3/3] clk: dt: binding for basic divider clock Mike Turquette
[not found] ` <1370281990-15090-4-git-send-email-mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-06-03 22:18 ` Heiko Stübner
2013-06-13 2:41 ` Mike Turquette [this message]
2013-06-04 17:11 ` Stephen Boyd
2013-06-04 17:39 ` Matt Sealey
2013-06-04 19:22 ` Mike Turquette
2013-06-04 20:13 ` Matt Sealey
2013-06-06 0:09 ` Heiko Stübner
2013-06-07 5:51 ` [PATCH RFC 0/3] clk: dt: bindings for mux & divider clocks Shawn Guo
[not found] ` <20130607055128.GA20780-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2013-06-07 17:52 ` Mike Turquette
2013-06-08 3:02 ` Shawn Guo
[not found] ` <20130608030240.GB22134-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2013-06-08 18:25 ` Mike Turquette
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=20130613024138.26381.96286@quantum \
--to=mturquette@linaro.org \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=heiko@sntech.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.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;
as well as URLs for NNTP newsgroup(s).