History log of /linux-master/drivers/sh/clk/core.c
Revision Date Author Comments
# ff30bd6a 02-Feb-2023 Geert Uytterhoeven <geert+renesas@glider.be>

sh: clk: Fix clk_enable() to return 0 on NULL clk

On SH, devm_clk_get_optional_enabled() fails with -EINVAL if the clock
is not found. This happens because __devm_clk_get() assumes it can pass
a NULL clock pointer (as returned by clk_get_optional()) to the init()
function (clk_prepare_enable() in this case), while the SH
implementation of clk_enable() considers that an error.

Fix this by making the SH clk_enable() implementation return zero
instead, like the Common Clock Framework does.

Reported-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Acked-by: Stephen Boyd <sboyd@kernel.org>
Link: https://lore.kernel.org/r/b53e6b557b4240579933b3359dda335ff94ed5af.1675354849.git.geert+renesas@glider.be
Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>


# 4bdc0d67 06-Jan-2020 Christoph Hellwig <hch@lst.de>

remove ioremap_nocache and devm_ioremap_nocache

ioremap has provided non-cached semantics by default since the Linux 2.6
days, so remove the additional ioremap_nocache interface.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>


# ffd81dcf 29-Jan-2018 Dominik Brodowski <linux@dominikbrodowski.net>

cpufreq: Add and use cpufreq_for_each_{valid_,}entry_idx()

Pointer subtraction is slow and tedious. Therefore, replace all instances
where cpufreq_for_each_{valid_,}entry loops contained such substractions
with an iteration macro providing an index to the frequency_table entry.

Suggested-by: Al Viro <viro@ZenIV.linux.org.uk>
Link: http://lkml.kernel.org/r/20180120020237.GM13338@ZenIV.linux.org.uk
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>


# 6575a9c6 19-Nov-2015 Geert Uytterhoeven <geert+renesas@glider.be>

drivers: sh: clk: Avoid crashes when passing NULL clocks

Several clock API functions handle NULL clocks when the Common Clock
Framework is used, while their legacy SH counterparts don't, and would
just crash when a NULL clock is passed.

Add NULL checks to clk_get_rate(), clk_set_rate(), clk_get_parent(), and
clk_round_rate(), to avoid different behavior in drivers shared between
legacy and CCF-based platforms.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>


# 90069ad1 19-Nov-2015 Geert Uytterhoeven <geert+renesas@glider.be>

drivers: sh: clk: Remove obsolete and unused clk_round_parent()

clk_round_parent() was only ever used by AP4EVB, until commit
b24bd7e97b3784af ("ARM: shmobile: Remove AP4EVB board support").

The Common Clock Framework does not provide clk_round_parent(), hence
remove it.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>


# 4229e1c6 25-Apr-2014 Stratos Karafotis <stratosk@semaphore.gr>

sh: clk: Use cpufreq_for_each_valid_entry macro for iteration

The cpufreq core now supports the cpufreq_for_each_valid_entry macro
helper for iteration over the cpufreq_frequency_table, so use it.

It should have no functional changes.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>


# 50701588 30-Mar-2013 Viresh Kumar <viresh.kumar@linaro.org>

cpufreq: rename index as driver_data in cpufreq_frequency_table

The "index" field of struct cpufreq_frequency_table was never an
index and isn't used at all by the cpufreq core. It only is useful
for cpufreq drivers for their internal purposes.

Many people nowadays blindly set it in ascending order with the
assumption that the core will use it, which is a mistake.

Rename it to "driver_data" as that's what its purpose is. All of its
users are updated accordingly.

[rjw: Changelog]
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>


# eda2030a 08-Dec-2011 Magnus Damm <damm@opensource.se>

sh: extend clock struct with mapped_reg member

Add a "mapped_reg" member to struct clk and use that
to keep the ioremapped register based on enable_reg.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 79e70664 11-Nov-2011 Paul Mundt <lethal@linux-sh.org>

sh: clkfwk: Kill off remaining debugfs cruft.

Now that all of the named string association with clocks has been
migrated to clkdev lookups there's no meaningful named topology that can
be constructed for a debugfs tree view. Get rid of the left over bits,
and shrink struct clk a bit in the process.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# dd2c0ca1 19-Sep-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

sh: clkfwk: add clk_rate_mult_range_round()

This provides a clk_rate_mult_range_round() helper for use by some of the
CPG PLL ranged multipliers, following the same approach as used by the
div ranges.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 12520c43 15-Jul-2011 Al Viro <viro@zeniv.linux.org.uk>

switch assorted clock drivers to debugfs_remove_recursive()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>


# 225ca45c 24-Jun-2011 Paul Mundt <lethal@linux-sh.org>

sh: clkfwk: Convert to IS_ERR_OR_NULL.

Trivial cleanup.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 794d78fe 21-Jun-2011 Magnus Damm <damm@opensource.se>

drivers: sh: late disabling of clocks V2

This V2 patch changes the clock disabling behavior during boot.
Two different changes are made:

1) Delay disabling of clocks until late in the boot process.
This fixes an existing issue where in-use clocks without
software reference are disabled by mistake during boot.
One example of this is the handling of the Mackerel serial
console output that shares clock with the I2C controller.

2) Write out the "disabled" state to the hardware for clocks
that not have been used by the kernel. In other words,
make sure so far unused clocks actually get turned off.

Signed-off-by: Magnus Damm <damm@opensource.se>
Acked-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 583af252 12-Jun-2011 Magnus Damm <damm@opensource.se>

drivers: sh: resume enabled clocks fix

Extend the SH / SH-Mobile ARM clock framework to only
resume clocks that have been enabled.

Without this fix divide-by-zero is triggering on sh7372
FSIDIV during system wide resume of Suspend-to-RAM.

Signed-off-by: Magnus Damm <damm@opensource.se>
Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# a696b89c 22-Mar-2011 Rafael J. Wysocki <rjw@rjwysocki.net>

sh: Use struct syscore_ops instead of sysdevs

Convert the SuperH clocks framework and shared interrupt handling
code to using struct syscore_ops instead of a sysdev classes and
sysdevs for power managment.

This reduces the code size significantly and simplifies it. The
optimizations causing things not to be restored after creating a
hibernation image are removed, but they might lead to undesirable
effects during resume from hibernation (e.g. the clocks would be left
as the boot kernel set them, which might be not the same way as the
hibernated kernel had seen them before the hibernation).

This also is necessary for removing sysdevs from the kernel entirely
in the future.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 57cc7215 09-Jan-2011 Alexey Dobriyan <adobriyan@gmail.com>

headers: kobject.h redux

Remove kobject.h from files which don't need it, notably,
sched.h and fs.h.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# f278ea84 19-Nov-2010 Paul Mundt <lethal@linux-sh.org>

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>


# 35a96c73 15-Nov-2010 Paul Mundt <lethal@linux-sh.org>

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>


# 9a1683d1 15-Nov-2010 Paul Mundt <lethal@linux-sh.org>

sh: clkfwk: Kill off unused clk_set_rate_ex().

With the refactoring of the SH7722 clock framework some time ago this
abstraction has become unecessary. Kill it off before anyone else gets
the bright idea to start using it.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# ed10b490 10-Nov-2010 Paul Mundt <lethal@linux-sh.org>

sh: clkfwk: fix up compiler warnings.

CC drivers/sh/clk/core.o
drivers/sh/clk/core.c: In function 'clk_round_parent':
drivers/sh/clk/core.c:574: warning: format '%lu' expects type 'long unsigned int', but argument 2 has type 'unsigned int'
drivers/sh/clk/core.c:594: warning: format '%lu' expects type 'long unsigned int', but argument 2 has type 'unsigned int'

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# a766b297 07-Nov-2010 Paul Mundt <lethal@linux-sh.org>

sh: clkfwk: Fix up checkpatch warnings.

The clk_round_parent() change introduced various checkpatch warnings,
tidy them up.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 6af26c6c 02-Nov-2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de>

sh: add clk_round_parent() to optimize parent clock rate

Sometimes it is possible and reasonable to adjust the parent clock rate to
improve precision of the child clock, e.g., if the child clock has no siblings.
clk_round_parent() is a new addition to the SH clock-framework API, that
implements such an optimization for child clocks with divisors, taking all
integer values in a range.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# 5aefa34f 01-Nov-2010 Paul Mundt <lethal@linux-sh.org>

sh: clkfwk: Fix up rate rounding error handling.

According to the linux/clk.h definition we should be handing back an
errno value or a valid rate. This fixes up the case where 0 can be
returned for invalid frequencies or cases where rounding has no
selectable candidate.

Reported-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>


# de9186c2 18-Oct-2010 Paul Mundt <lethal@linux-sh.org>

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>