All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC 00/11] clk: sunxi: factors clk clean up and refactor
@ 2016-01-25 13:15 ` Chen-Yu Tsai
  0 siblings, 0 replies; 61+ messages in thread
From: Chen-Yu Tsai @ 2016-01-25 13:15 UTC (permalink / raw)
  To: Maxime Ripard, Michael Turquette, Stephen Boyd
  Cc: Chen-Yu Tsai, linux-clk, linux-arm-kernel, linux-kernel,
	Vishnu Patekar, linux-sunxi

Hi everyone,

This series cleans up and reworks parts of sunxi's factors clk. The goal
is to support non-standard formulas for clock rate calculation, such as
pre-dividers on some parents, or all power-of-2 dividers. One such clock
is the AHB1 clock on A31/A31s.

Patch 1 is Maxime's patch adding an unregister function for composite
clocks. Patches 3 and 4 use this, so it is included for completeness.

Patch 2 makes the config tables for factors clk constant. These contain
the shift and width for the factors. They are used to manipulate the
clk register values. There should be no reason to change them in-flight.

Patch 3 adds a proper error path for the factors clk register function(),
so we don't leak memory when a call fails.

Patch 4 adds an unregister function for factors clks.

Patch 5 adds an error patch to sunxi_factors_clk_setup()

Patch 6 packs the parameters passed to get_factors callbacks in a struct.
This makes it easier to extend factors clk without having to edit all
the function definitions, and also makes the lines shorter.

Patch 7 makes factors clk support custom formulas for calculating clock
rates. On the clock rounding/setting side, we only need to teach
get_factors about different parent clocks. On the recalc side, we add
support for custom .recalc callbacks for clocks that need them.

Patch 8 drops .round_rate from factors clk ops. Since only one of
.round_rate and .determine_rate is needed, and the clk core prefers the
latter, remove .round_rate.

Patch 9 rewrites sun6i-a31-ahb1-clk using factors clk with the new custom
formula support. sun6i-a31-ahb1 has a pre-divider on one of its parents.

Patch 10 rewrite sun6i-ar100 using factors clk.

Patch 11 rewrites sun8i-a23-mbus-clk using the simpler composite clk.
While this patch is doing the reverse, i.e. rewriting a factors clk into
a composite clk, it is included because some changes overlap. I'm not
sure whether this approach is worthwhile, as it actually adds more code,
though it might make it easier to understand.


Regards
ChenYu


Chen-Yu Tsai (10):
  clk: sunxi: factors: Make struct clk_factors_config table const
  clk: sunxi: factors: Add clk cleanup in sunxi_factors_register() error
    path
  clk: sunxi: factors: Add unregister function
  clk: sunxi: unmap registers in sunxi_factors_clk_setup if register
    call fails
  clk: sunxi: factors: Consolidate get_factors parameters into a struct
  clk: sunxi: factors: Support custom formulas
  clk: sunxi: factors: Drop round_rate from clk ops
  clk: sunxi: rewrite sun6i-a31-ahb1-clk using factors clk with custom
    recalc
  clk: sunxi: rewrite sun6i-ar100 using factors clk
  clk: sunxi: rewrite sun8i-a23-mbus-clk using the simpler composite clk

Maxime Ripard (1):
  clk: composite: Add unregister function

 drivers/clk/clk-composite.c         |  15 +
 drivers/clk/sunxi/clk-factors.c     | 127 ++++++---
 drivers/clk/sunxi/clk-factors.h     |  25 +-
 drivers/clk/sunxi/clk-mod0.c        |  22 +-
 drivers/clk/sunxi/clk-sun6i-ar100.c | 235 ++++------------
 drivers/clk/sunxi/clk-sun8i-mbus.c  | 126 +++++----
 drivers/clk/sunxi/clk-sun9i-core.c  |  85 ++----
 drivers/clk/sunxi/clk-sunxi.c       | 540 +++++++++++++-----------------------
 include/linux/clk-provider.h        |   1 +
 9 files changed, 492 insertions(+), 684 deletions(-)

-- 
2.7.0

^ permalink raw reply	[flat|nested] 61+ messages in thread

end of thread, other threads:[~2016-02-05 13:07 UTC | newest]

Thread overview: 61+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-25 13:15 [PATCH RFC 00/11] clk: sunxi: factors clk clean up and refactor Chen-Yu Tsai
2016-01-25 13:15 ` Chen-Yu Tsai
2016-01-25 13:15 ` [PATCH RFC 01/11] clk: composite: Add unregister function Chen-Yu Tsai
2016-01-25 13:15   ` Chen-Yu Tsai
2016-01-25 13:15 ` [PATCH RFC 02/11] clk: sunxi: factors: Make struct clk_factors_config table const Chen-Yu Tsai
2016-01-25 13:15   ` Chen-Yu Tsai
2016-01-27 15:50   ` Maxime Ripard
2016-01-27 15:50     ` Maxime Ripard
2016-01-25 13:15 ` [PATCH RFC 03/11] clk: sunxi: factors: Add clk cleanup in sunxi_factors_register() error path Chen-Yu Tsai
2016-01-25 13:15   ` Chen-Yu Tsai
2016-01-27 15:51   ` Maxime Ripard
2016-01-27 15:51     ` Maxime Ripard
2016-01-25 13:15 ` [PATCH RFC 04/11] clk: sunxi: factors: Add unregister function Chen-Yu Tsai
2016-01-25 13:15   ` Chen-Yu Tsai
2016-01-27 15:52   ` Maxime Ripard
2016-01-27 15:52     ` Maxime Ripard
2016-01-27 18:08     ` Maxime Ripard
2016-01-27 18:08       ` Maxime Ripard
2016-01-25 13:15 ` [PATCH RFC 05/11] clk: sunxi: unmap registers in sunxi_factors_clk_setup if register call fails Chen-Yu Tsai
2016-01-25 13:15   ` Chen-Yu Tsai
2016-01-27 15:52   ` Maxime Ripard
2016-01-27 15:52     ` Maxime Ripard
2016-01-25 13:15 ` [PATCH RFC 06/11] clk: sunxi: factors: Consolidate get_factors parameters into a struct Chen-Yu Tsai
2016-01-25 13:15   ` Chen-Yu Tsai
2016-01-27 17:29   ` Maxime Ripard
2016-01-27 17:29     ` Maxime Ripard
2016-01-25 13:15 ` [PATCH RFC 07/11] clk: sunxi: factors: Support custom formulas Chen-Yu Tsai
2016-01-25 13:15   ` Chen-Yu Tsai
2016-01-27 17:32   ` Maxime Ripard
2016-01-27 17:32     ` Maxime Ripard
2016-01-25 13:15 ` [PATCH RFC 08/11] clk: sunxi: factors: Drop round_rate from clk ops Chen-Yu Tsai
2016-01-25 13:15   ` Chen-Yu Tsai
2016-01-27 17:33   ` Maxime Ripard
2016-01-27 17:33     ` Maxime Ripard
2016-01-25 13:15 ` [PATCH RFC 09/11] clk: sunxi: rewrite sun6i-a31-ahb1-clk using factors clk with custom recalc Chen-Yu Tsai
2016-01-25 13:15   ` Chen-Yu Tsai
2016-01-27 17:41   ` Maxime Ripard
2016-01-27 17:41     ` Maxime Ripard
2016-01-25 13:15 ` [PATCH RFC 10/11] clk: sunxi: rewrite sun6i-ar100 using factors clk Chen-Yu Tsai
2016-01-25 13:15   ` Chen-Yu Tsai
2016-01-27 17:47   ` Maxime Ripard
2016-01-27 17:47     ` Maxime Ripard
2016-01-31 16:59   ` Paul Gortmaker
2016-01-31 16:59     ` Paul Gortmaker
2016-01-31 16:59     ` Paul Gortmaker
2016-02-05 13:03     ` Chen-Yu Tsai
2016-02-05 13:03       ` Chen-Yu Tsai
2016-02-02 15:55   ` [PATCH] clk: sunxi: don't mark sun6i_ar100_data __initconst Arnd Bergmann
2016-02-02 15:55     ` Arnd Bergmann
2016-02-02 17:33     ` Maxime Ripard
2016-02-02 17:33       ` Maxime Ripard
2016-01-25 13:15 ` [PATCH RFC 11/11] clk: sunxi: rewrite sun8i-a23-mbus-clk using the simpler composite clk Chen-Yu Tsai
2016-01-25 13:15   ` Chen-Yu Tsai
2016-01-27 17:49   ` Maxime Ripard
2016-01-27 17:49     ` Maxime Ripard
2016-01-28  2:41     ` Chen-Yu Tsai
2016-01-28  2:41       ` Chen-Yu Tsai
2016-02-01 20:24       ` Maxime Ripard
2016-02-01 20:24         ` Maxime Ripard
2016-01-27 19:13 ` [PATCH RFC 00/11] clk: sunxi: factors clk clean up and refactor Maxime Ripard
2016-01-27 19:13   ` Maxime Ripard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.