From: Maxime Ripard <maxime.ripard@free-electrons.com>
To: Michael Turquette <mturquette@baylibre.com>
Cc: Chen-Yu Tsai <wens@csie.org>, Jim Quinlan <jim2101024@gmail.com>,
"Stephen Boyd <sboyd@codeaurora.org>,
Emilio Lopez <emilio@elopez.com.ar>,
Hans de Goede <hdegoede@redhat.com>,
linux-clk <linux-clk@vger.kernel.org>,
linux-arm-kernel" <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2 1/7] clk: Add a basic factor clock
Date: Sat, 25 Jul 2015 09:39:25 +0200 [thread overview]
Message-ID: <20150725073925.GK2564@lukather> (raw)
In-Reply-To: <20150724182619.642.11590@quantum>
[-- Attachment #1.1: Type: text/plain, Size: 3151 bytes --]
Hi Mike,
On Fri, Jul 24, 2015 at 11:26:19AM -0700, Michael Turquette wrote:
> > What are the issues with maintaining them? The only drawback I'm
> > seeing with introducing such a driver is that you can't really have a
> > clock that is both a divider and a multiplier, but that can be solved
> > by splitting it into two sub-clocks.
>
> There are a bunch of problems with the basic clock types. First is that
> there is some feature creep every merge window that subtly breaks an
> existing user (e.g. the round_rate stuff in clk-divider.c), and then
> there are the growing number of flags to handle corner cases that are
> one-off quirks for a single chip.
>
> These make it harder to maintain, but it is possible.
Ok. It's the downside of having common code I guess, everyone wants to
use it, and the clocks are just more subject to it than other drivers :/
> The real problem with these basic clock types is that they are an
> abstraction layer at the wrong level. Each clock type implements both
> the policy of a given clock, as well as the machine-specific details.
> For example clk-divider.c has made some assumptions in the past about
> rounding the rate, or how to calculate the best divider; this is a
> matter of policy and is useful on its own. But additionally that same
> policy is glued to a specific implementation: memory-mapped register
> controls for a clock divider.
>
> The I/O accessor stuff needs to be addressed at some point. Currently
> the basic clock types assume specific patterns of access to
> memory-mapped clock registers. There are lots of other clock controls
> out there that talk to firmware, or over i2c, or whatever. The amount of
> code that has to be copy/pasted for each different type of access is
> 100%; i.e. we do not have abstractions at the right level such as
> .get_best_div(struct clk_hw *hw, unsigned long rate).
>
> What I would like to see in time is a re-usable layer for clock policy
> (e.g. common rules for how dividers or multipliers should behave), and
> then have that sit on top of the machine-specific callbacks that
> directly touch the hardware, such as the .get_best_div callback above.
Can't that be solved by moving to regmap using Matthias' patches, or
at least the IO method abstraction?
We would then have to only provide an additional callback then for
providers that have specific requirements about the divider
calculation.
So far, I haven't had any usecase where I needed anything but having
the as-close-as-possible rate, so I would expect to not provide
anything beside whether I'd like to round down or round up, but I do
understand that some other might have different requirements.
> For this reason I like to limit the number of new basic clock types. If
> there is a single user then I'm inclined to have the author put it with
> the machine-specific code. But in this case since there are two users, I
> see the value in making a new basic clock type.
That makes sense.
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2015-07-25 7:39 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-21 20:53 [PATCH v2 0/7] clk: sunxi: Add support for the Audio PLL Maxime Ripard
2015-05-21 20:54 ` [PATCH v2 1/7] clk: Add a basic factor clock Maxime Ripard
2015-05-22 4:35 ` Chen-Yu Tsai
2015-05-23 7:49 ` Maxime Ripard
2015-07-24 0:00 ` Michael Turquette
2015-07-24 6:50 ` Maxime Ripard
2015-07-24 18:26 ` Michael Turquette
2015-07-25 7:39 ` Maxime Ripard [this message]
2015-08-11 21:30 ` Michael Turquette
2015-08-19 9:13 ` Maxime Ripard
2015-09-19 8:19 ` Maxime Ripard
2015-05-21 20:54 ` [PATCH v2 2/7] clk: sunxi: Add a driver for the PLL2 Maxime Ripard
2015-05-21 20:54 ` [PATCH v2 3/7] clk: sunxi: codec clock support Maxime Ripard
2015-05-21 20:54 ` [PATCH v2 4/7] clk: sunxi: mod1 " Maxime Ripard
2015-05-21 20:54 ` [PATCH v2 5/7] ARM: sunxi: Add PLL2 support Maxime Ripard
2015-05-21 20:54 ` [PATCH v2 6/7] ARM: sunxi: Add codec clock support Maxime Ripard
2015-05-21 20:54 ` [PATCH v2 7/7] ARM: sun7i: Add mod1 clock nodes Maxime Ripard
2015-06-04 13:27 ` [PATCH v2 0/7] clk: sunxi: Add support for the Audio PLL 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=20150725073925.GK2564@lukather \
--to=maxime.ripard@free-electrons.com \
--cc=jim2101024@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mturquette@baylibre.com \
--cc=wens@csie.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).