Commit Graph

24 Commits

Author SHA1 Message Date
Guennadi Liakhovetski a028c6da34 ARM: shmobile: wait for MSTP clock status to toggle, when enabling it
On r-/sh-mobile SoCs MSTP clocks are used by the runtime PM to dynamically
enable and disable peripheral clocks. To make sure the clock has really
started we have to read back its status register until it confirms success.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
2014-02-04 10:22:39 +09:00
Kuninori Morimoto 5a799b824b sh: clkfwk: bugfix: sh_clk_div_enable() care sh_clk_div_set_rate() if div6
764f4e4e33
(sh: clkfwk: Use shared sh_clk_div_enable/disable())
shared enable/disable funcions for div4/div6.
But new sh_clk_div_enable() didn't care sh_clk_div_set_rate()
which is required on div6 clock.
This patch fixes it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2013-01-11 20:57:58 +09:00
Kuninori Morimoto 94091c6b94 sh: clkfwk: fixup unsed variable warning
This patch solves above warning

${LINUX}/drivers/sh/clk/cpg.c:404:6: warning: \
unused variable 'val' [-Wunused-variable]

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
2012-11-13 11:45:40 +09:00
Kuninori Morimoto 9d626eccb1 sh: clkfwk: add sh_clk_fsidiv_register()
This patch adds sh_clk_fsidiv_register() to share FSI-DIV clock code

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Simon Horman <horms@verge.net.au>
2012-11-08 15:21:30 +09:00
Paul Mundt 609d7558f2 sh: clkfwk: Consolidate div clk registration helper.
This consolidates the div6/4 versions of the clk registration wrapper.
The existing wrappers with their own sh_clk_ops are maintained for API
compatability, though in the future it should be possible to be rid of
them entirely.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-05-25 16:55:05 +09:00
Paul Mundt e3c8760773 sh: clkfwk: Consolidate div6/div4 clk_ops definitions.
Everything with the exception of the _reparent ops are now shared, so
switch everything over to common types.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-05-25 16:43:42 +09:00
Paul Mundt 764f4e4e33 sh: clkfwk: Use shared sh_clk_div_enable/disable().
This introduces a new flag for clocks that need to have their divisor
ratio set back to their initial mask at disable time to prevent
interactivity problems with the clock stop bit (presently div6 only).
With this in place it's possible to handle the corner case on top of the
div4 op without any particular need for leaving things split out.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-05-25 16:34:48 +09:00
Paul Mundt 0fa22168e0 sh: clkfwk: Use shared sh_clk_div_set_rate()
Follows the sh_clk_div_recalc() change.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-05-25 15:52:10 +09:00
Paul Mundt 75f5f8a56e sh: clkfwk: Use shared sh_clk_div_recalc().
This generalizes the div4 recalc routine for use by div6 and others, then
makes it the default.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-05-25 15:26:01 +09:00
Paul Mundt 1111cc1e80 sh: clkfwk: Introduce a div_mask for variable div types.
This plugs in a div_mask for the clock and sets it up for the existing
div6/4 cases. This will make it possible to support other div types, as
well as share more div6/4 infrastructure.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-05-25 15:21:43 +09:00
Paul Mundt a60977a513 sh: clkfwk: Move to common clk_div_table accessors for div4/div6.
This plugs in a generic clk_div_table, based on the div4 version. div6 is
then adopted to use it for encapsulating its div table, which permits us
to start div6/4 unification, as well as preparation for other div types.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-05-25 14:59:26 +09:00
Paul Mundt 104fa61a7d sh: clkfwk: Support variable size accesses for div4/div6 clocks.
This follows the MSTP clock change and implements variable access size
support for the rest of the CPG clocks, too. Upcoming SH-2A support has
need of this for 16-bit div4 clocks, while others will follow.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-04-12 19:50:40 +09:00
Paul Mundt 4d6ddb08ac sh: clkfwk: Support variable size accesses for MSTP clocks.
The bulk of the MSTP users require 32-bit access, but this isn't the case
for some of the SH-2A parts, so add in some basic infrastructure to let
the CPU define its required access size in preparation.

Requested-by: Phil Edworthy <phil.edworthy@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-04-11 12:05:50 +09:00
Magnus Damm a0ec360f6b sh: convert cpg code to sh_clk_ops
Convert the CPG code to use sh_clk_ops.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
2012-03-12 22:19:07 +01:00
Kuninori Morimoto 64dea57588 sh: clkfwk: bugfix: use clk_reparent() for div6 clocks
Various problems will happen if clk parent was set up directly.
it should use clk_reparent()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-01-24 10:44:49 +09:00
Kuninori Morimoto 7784f4da1a sh: clkfwk: sh_clk_init_parent() should be called after clk_register()
sh_clk_init_parent() are using clk->mapped_reg
which is mapped in clk_register()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-01-10 13:30:30 +09:00
Magnus Damm 2dacb97d92 sh: use ioread32/iowrite32 and mapped_reg for div6
Convert the CPG DIV6 helper code to use the new mapped_reg
together with ioread32() and iowrite32().

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-12-09 18:04:14 +09:00
Magnus Damm 0e027376f8 sh: use ioread32/iowrite32 and mapped_reg for div4
Convert the CPG DIV4 helper code to use the new mapped_reg
together with ioread32() and iowrite32().

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-12-09 18:01:07 +09:00
Magnus Damm b3ab82b3eb sh: use ioread32/iowrite32 and mapped_reg for mstp32
Convert the CPG MSTP32 helper code to use the new mapped_reg
together with ioread32() and iowrite32().

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-12-09 18:01:06 +09:00
Kuninori Morimoto 56242a1fc5 sh: clkfwk: setup clock parent from current register value
Some clocks can select its parent clock by CPG register.
But it might have been modified by boot-loader or something.
This patch removed fixed initial parent clock,
and setup it from their current register settings.
It works on div6 reparent clocks for now.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-11-24 17:15:23 +09:00
Kuninori Morimoto 52c10ad22b sh: clkfwk: fixup clk_rate_table_build parameter in div6 clock
div6 clock should not use arch_flags for clk_rate_table_build,
because SH_CLK_DIV6_EXT doesn't care .arch_flags.
clk->freq_table[] will be all CPUFREQ_ENTRY_INVALID without this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: stable@kernel.org
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2011-04-18 18:33:31 +09:00
Paul Mundt f278ea849e sh: clkfwk: Build fix for non-legacy CPG changes.
The disabling of the init op for non-legacy clocks neglected to do the
same in the core clock framework, resulting in a build failure. Fix it
up.

Reported-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-11-19 16:40:35 +09:00
Paul Mundt 35a96c739f sh: clkfwk: Kill off now unused algo_id in set_rate op.
Now that clk_set_rate_ex() is gone, there is also no way to get at rate
setting algo id, which is now also completely unused. Kill it off before
new clock ops start using it.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-11-15 18:25:17 +09:00
Paul Mundt de9186c257 sh: clkfwk: Shuffle around to match the intc split up.
This shuffles the clock framework code around to a drivers/sh/clk subdir,
to follow the intc split up. This will make it easier to subsequently
break things out as well as plug in different helpers for non-CPG users.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-10-18 21:32:58 +09:00