aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/cpu/clock.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2016-08-05sh: use common clock framework with device tree boardsRich Felker1-0/+4
Enable common clk framework for DT-based boards and disable code that depends on the legacy sh clk framework when common clk is enabled. Once legacy drivers are converted over, the old code can be removed entirely. Signed-off-by: Rich Felker <dalias@libc.org>
2010-11-26ARM: 6483/1: arm & sh: factorised duplicated clkdev.cJean-Christop PLAGNIOL-VILLARD1-16/+0
factorise some generic infrastructure to assist looking up struct clks for the ARM & SH architecture. as the code is identical at 99% put the arch specific code for allocation as example in asm/clkdev.h Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Acked-by: Paul Mundt <lethal@linux-sh.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-05-13sh: move sh clock.c contents to drivers/sh/clk.Magnus Damm1-535/+8
This patch is V2 of the SH clock framework move from arch/sh/kernel/cpu/clock.c to drivers/sh/clk.c. All code except the following functions are moved: clk_init(), clk_get() and clk_put(). The init function is still kept in clock.c since it depends on the SH-specific machvec implementation. The symbols clk_get() and clk_put() already exist in the common ARM clkdev code, those symbols are left in the SH tree to avoid duplicating them for SH-Mobile ARM. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-05-13sh: remove unused clock lookupMagnus Damm1-35/+2
Now when all clocks are registered using clkdev, get rid of the special SH-specific clock lookup. Also ditch the unused module ref counting code. This patch syncs the SH behaviour with ARM. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-05-11sh: clkfwk: Use debugfs_remove_recursive() for rewindingHiroshi DOYU1-1/+1
Rewinding each debugfs entries to unregister if an error happens. Based on the commit ca4caa4e1d45f9542fa54263974d0ef637157b4a Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-05-11sh: allow registering clocks without nameMagnus Damm1-3/+4
Modify the SuperH clock code to support struct clk with NULL as name. Such clocks will not be hooked up to debugfs. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-03-09sh: Merge clkdev API updates.Paul Mundt1-54/+1
This rolls in the remainder of the clkdev API bits from the ARM tree. This can more or less be used verbatim, so we just copy it over and nuke our local version. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-02sh: Fix access to released memory in clk_debugfs_register_one()Marek Skuczynski1-2/+2
Signed-off-by: Marek Skuczynski <mareksk7@gmail.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-06-11sh: add enable()/disable()/set_rate() to div6 codeMagnus Damm1-0/+19
This patch updates the div6 clock helper code to add support for enable(), disable() and set_rate() callbacks. Needed by the camera clock enabling board code on Migo-R. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-26sh: remove clk_ops->build_rate_table()Magnus Damm1-2/+0
This patch removes the ->build_rate_table() callback, ->recalc() may instead be used for this purpose. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-26sh: add shared clock framework frequency table codeMagnus Damm1-0/+75
Add SuperH-specific clock framework helper functions: - clk_rate_table_build() - build cpufreq table from divisors/multipliers - clk_rate_table_round() - use cpufreq table to find matching frequency Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-14sh: clkfwk: Add MSTP bits to SH7785 clock framework.Paul Mundt1-2/+2
This plugs in all of the MSTP functions in to the clock framework, and hands them off to the platform devices that want them. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-13sh: clkfwk: Map tree hierarchy in debugfs.Paul Mundt1-26/+84
This adopts the OMAP clock framework debugfs bits and replaces the aging procfs bits. The procfs clocks entry was primarily a debugging aid, and used to be tied in to cpuinfo before the clock list grew too unweildly. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-13sh: clkfwk: rate table construction and rounding for SH7785.Paul Mundt1-0/+3
This adds support for constructing a rate table by looking at potential divisors for a specified clock. Each FQRMR clock is given its own table. Presently each table is rebuilt when the parent propagates down a new rate, so some more logic needs to be added to do this more intelligently. Additionally, a fairly generic round_rate() implementation is then layered on top of it, which subsequently provides us with cpufreq support. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-13sh: clkfwk: Rework legacy CPG clock handling.Paul Mundt1-56/+14
This moves out the old legacy CPG clocks to their own file, and converts over the existing users. With these clocks going away and each CPU dealing with them on their own, CPUs can gradually move over to the new interface. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-13sh: clkfwk: Provide a generic clk_set_rate_ex() path for root clocks.Paul Mundt1-9/+16
In the case of root clocks (such as clkin oscillators, extal, etc.), the rate information is entirely platform dependent and needs to be lazily set and propagated from the platform code. This provides a method for establishing the rate update on these types of clocks that define no set_rate() op of their own. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-13sh: clkfwk: Handle NULL clkops for root clocks.Paul Mundt1-3/+3
root clocks may simply be placeholders for rate and ancestry information, and have no real associated operations of their own. Account for this, so we are still able to use these sorts of clocks for rate propagation. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-13sh: clkfwk: module_clk -> peripheral_clk rename.Paul Mundt1-3/+3
For consistenct naming, and to allow us to fix up some confusion in the SH-Mobile clock framework, amongst other places. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-12Merge branch 'master' into sh/clkfwkPaul Mundt1-1/+0
2009-05-12sh: Kill off the remnants of the old timer code.Paul Mundt1-1/+0
Now with all of the TMU users moved over to the new TMU driver, and the old TMU driver killed off, the left-over infrastructure can go along with it. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-12sh: clkfwk: Use arch_clk_init() for on-chip clock registration.Paul Mundt1-7/+1
CPUs registering on-chip clocks should be using arch_clk_init() with the new scheme so that the CPUs have the opportunity to establish the topology prior to the initial root clock rate propagation. This ensures that CPUs with on-chip clocks that use CLK_ENABLE_ON_INIT are properly enabled at the initial propagation time, without having to further poke the root clocks. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-12sh: clkfwk: Handle clk_get_sys() returning an ERR_PTR.Paul Mundt1-1/+1
clk_get() needs to also perform an IS_ERR() check to see whether clk_get_sys() failed or not. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-12sh: clkfwk: Wire up clk_get_sys() support.Paul Mundt1-0/+59
This stubs in clk_get_sys() from the ARM clkdev implementation. Tentatively conver the clk_get() lookup code to use this, and once the rest of the in-tree users are happy with this, it can replace the fallback lookups. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-12sh: clkfwk: Kill off clk_recalc_rate().Paul Mundt1-14/+0
The only user for this is the SH-Mobile r_clk, which is now added as a root clock and can be kicked via propagate_rate() as usual. Given that, there is no longer any need for the special clk_recalc_rate(), so we kill it off. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-12sh: clkfwk: Improve the generic clk_set_parent() implementation.Paul Mundt1-0/+20
This causes the generic clk_set_parent() implementation to be a bit more intelligent. A clk_reparent() is added to move the clock over to the new parent's sibling list, which then allows the generic rate propagation code to succeed. This also becomes a nop if the new and old parents are unchanged. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-12sh: clkfwk: Fix up the clk_enable() error path.Paul Mundt1-25/+46
There are a couple of instances where a clk_enable() can fail, which the SH-Mobile code presently handles, but doesn't get reported all the way back up. This fixes up the return type so the errors make it all the way down to the drivers. Additionally, we now also error out properly if the parent enable fails. Prep work for aggressively turning off unused clocks on boot. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-12sh: clkfwk: Consolidate the ALWAYS_ENABLED / NEEDS_INIT mess.Paul Mundt1-62/+32
There is no real distinction here in behaviour, either a clock needs to be enabled on initialiation or not. The ALWAYS_ENABLED flag was always intended to only apply to clocks that were physically always on and could simply not be disabled at all from software. Unfortunately over time this was abused and the meaning became a bit blurry. So, we kill off both of all of those paths now, as well as the newer NEEDS_INIT flag, and consolidate on a CLK_ENABLE_ON_INIT. Clocks that need to be enabled on initialization can set this, and it will purposely enable them and bump the refcount up. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-12sh: clkfwk: refactor rate propagation.Paul Mundt1-42/+78
This resyncs the rate propagation strategy with the scheme used by the OMAP clock framework. Child clocks are tracked on a list under each parent and propagation happens there specifically rather than constantly iterating over the global clock list. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-12sh: clkfwk: Add a followparent_recalc() helper.Paul Mundt1-0/+6
This adds a followparent_recalc() helper for clocks that just follow the parent's rate. Switch over the few CPUs that use this scheme for some of their clocks. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-12sh: clkfwk: Make recalc return an unsigned long.Paul Mundt1-16/+19
This is prep work for cleaning up some of the rate propagation bits. Trivial conversion. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-08sh: clock framework update, fix count and kill off krefMagnus Damm1-32/+37
This patch updates the clock framework use count code. With this patch the enable() and disable() callbacks only get called when counting from and to zero. While at it the kref stuff gets replaced with an int. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-05-08sh: call clock framework init() callback onceMagnus Damm1-3/+6
Make sure that clk->ops->init() only gets called once in the case of CLK_ALWAYS_ENABLED. Without this patch the init() callback may be called multiple times. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-03-16sh: clkfwk: Safer resume from hibernation.Francesco VIRLINZI1-1/+3
This patch fixes a possible problem in the resume from hibenration. It temporaneally saves the clk->rate on the stack to avoid any possible change during the clk->set_parent(..) call. Signed-off-by: Francesco Virlinzi <francesco.virlinzi@st.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-03-11sh: clkfwk: Add resume from hibernation support.Francesco VIRLINZI1-0/+64
This patch adds PM support to the clock framework. With this, resume from hibernation is properly supported. Signed-off-by: Francesco Virlinzi <francesco.virlinzi@st.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2009-03-11sh: clkfwk: add clk_set_parent/clk_get_parentFrancesco VIRLINZI1-0/+29
This patch adds the clk_set_parent/clk_get_parent routines to the sh clock framework. Signed-off-by: Francesco Virlinzi <francesco.virlinzi@st.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22sh: Fix clock framework compiler warnings.Paul Mundt1-1/+1
CC arch/sh/kernel/cpu/clock.o arch/sh/kernel/cpu/clock.c: In function 'clk_disable': arch/sh/kernel/cpu/clock.c:156: warning: 'return' with a value, in function returning void Introduced by ("sh: enable and disable clocks recursively"). Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-12-22sh: enable and disable clocks recursivelyMagnus Damm1-0/+10
Recurse and make sure parent clocks get enabled/disabled. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-09-08sh: fixup many sparse errors.Paul Mundt1-2/+3
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-07-28sh: Show all clocks and their state in /proc/clocksMagnus Damm1-9/+5
Show all clocks in /proc/clocks, and also show if they are enabled or disabled. This is useful to show MSTPCR bits on SuperH Mobile processors. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-07-28sh/kernel/ cleanupsAdrian Bunk1-4/+2
This patch contains the following cleanups: - make the following needlessly global code static: - cf-enabler.c: cf_init() - cpu/clock.c: __clk_enable() - cpu/clock.c: __clk_disable() - process_32.c: default_idle() - time_32.c: struct clocksource_sh - timers/timer-tmu.c: struct tmu_timer_ops - remove the following unused functions (no CONFIG_BLK_DEV_FD on sh): - process_{32,64}.c: disable_hlt() - process_{32,64}.c: enable_hlt() Signed-off-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2007-09-28sh: clkfwk: Support multi-level clock propagation.Stuart Menefy1-0/+2
Currently clock propagation only works for one level, but we have some clocks which need to propagate multiple levels, so make this recursive. Signed-off-by: Stuart Menefy <stuart.menefy@st.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2007-07-20sh: Implement clk_round_rate() in the clock framework.Paul Mundt1-0/+16
This is an optional component of the clock framework. However, as we're going to be using this in the cpufreq drivers, add support for it to the framework. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2007-05-21sh: Fix clock multiplier on SH7722.dmitry pervushin1-0/+7
This fixes up the master clock multiplier and initial rate propagation for the SH7722 clocks. Signed-off-by: dmitry pervushin <dimka@nomadgs.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2007-05-07sh: Move clock reporting to its own proc entry.Paul Mundt1-31/+45
Previously this was done in cpuinfo, but with the number of clocks growing, it makes more sense to place this in a different proc entry. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2007-05-07sh: SH7722 clock framework support.dmitry pervushin1-4/+24
This adds support for the SH7722 (MobileR) to the clock framework. Signed-off-by: dmitry pervushin <dimka@nomadgs.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-12-06sh: Clock framework tidying.Paul Mundt1-2/+25
This syncs up the SH clock framework with the linux/clk.h API, for which there were only some minor changes required, namely the clk_get() dev_id and subsequent callsites. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27sh: sem2mutex conversion for clock framework.Paul Mundt1-8/+9
Simple sem2mutex conversion. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27sh: Various cosmetic cleanups.Paul Mundt1-1/+1
We had quite a bit of whitespace damage, clean most of it up.. Signed-off-by: Stuart Menefy <stuart.menefy@st.com> Signed-off-by: Arthur Othieno <a.othieno@bluewin.ch> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-02-01[PATCH] sh: Make peripheral clock frequency setting mandatoryPaul Mundt1-12/+1
Pretty much every subtype does this now anyways, and as we depend on it in a few places being set to something sensible quite early on, it's better for a new subtype to simply set a sensible default. Signed-off-by: Paul Mundt <lethal@linux-sh.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-16[PATCH] sh: Simplistic clock frameworkPaul Mundt1-0/+287
This adds a relatively simplistic clock framework for sh. The initial goal behind this is to clean up the arch/sh/kernel/time.c mess and to get the CPU subtype-specific frequency setting and calculation code moved somewhere more sensible. This only deals with the core clocks at the moment, though it's trivial for other drivers to define their own clocks as desired. Signed-off-by: Paul Mundt <lethal@linux-sh.org> Cc: john stultz <johnstul@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>