alistair23-linux/drivers/clk/mvebu
Thomas Petazzoni 5f093ee76c clk: mvebu: fix sscg node lookup
Commit 15917b1602 ("clk: mvebu: Fix clk
frequency value if SSCG is enabled") introduced some logic in the
common mvebu clock code to adjust the clock frequency according to the
configuration of the SSCG.

In order to do this, it looks up for a DT node called "sscg" and maps
it before accessing the SSCG configuration register.

However, the lookup is currently done using:

	 sscg_np = of_find_node_by_name(np, "sscg");

where "np" is a pointer to the DT node of the clock for which we are
calculating the adjusted frequency. This means that if the "sscg" node
is *after* the clock node in the Device Tree, it works fine (and
that's the case for Armada 370).

However, if it turns out that the "sscg" node is *before* the clock
node in the Device Tree, it won't work because the sscg node will not
be found.

What we really want here is a search of the entire Device Tree, not
only starting from the clock node, so instead of passing "np" as first
argument of of_find_node_by_name(), we simply need to pass
NULL. Passing a non-NULL argument is typically used in a loop, so that
the search for the next matching node starts right after the node that
was matched.

This makes the "np" argument to the kirkwood_fix_sscg_deviation()
function unnecessary, which leads to further cleanups.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Fixes: 15917b1602 ("clk: mvebu: Fix clk frequency value if SSCG is enabled")
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Link: https://lkml.kernel.org/r/1410880503-2322-1-git-send-email-thomas.petazzoni@free-electrons.com
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
2014-09-16 15:39:33 +00:00
..
armada-38x.c clk: mvebu: add clock support for Armada 380/385 2014-02-17 02:34:05 +00:00
armada-370.c clk: mvebu: armada-370: Fix timer drift caused by the SSCG deviation 2014-09-09 15:15:03 +00:00
armada-375.c clk: mvebu: armada-375: Fix the description of the SAR in the comment 2014-09-09 15:15:22 +00:00
armada-xp.c clk: mvebu: armada-xp: maintain clock init order 2014-02-06 18:06:50 +00:00
clk-corediv.c clk: mvebu: Support Armada 380 SoC on the core divider clock 2014-03-13 23:24:23 +00:00
clk-cpu.c clk: mvebu: extend clk-cpu for dynamic frequency scaling 2014-07-16 12:58:38 +00:00
common.c clk: mvebu: fix sscg node lookup 2014-09-16 15:39:33 +00:00
common.h clk: mvebu: fix sscg node lookup 2014-09-16 15:39:33 +00:00
dove.c clk: mvebu: dove: maintain clock init order 2014-02-06 18:06:52 +00:00
Kconfig clk: mvebu: add Orion5x clock driver 2014-04-26 01:03:55 +00:00
kirkwood.c clk: mvebu: kirkwood: maintain clock init order 2014-02-06 18:07:01 +00:00
Makefile clk: mvebu: add Orion5x clock driver 2014-04-26 01:03:55 +00:00
orion.c clk: mvebu: add Orion5x clock driver 2014-04-26 01:03:55 +00:00