]> git.karo-electronics.de Git - linux-beck.git/log
linux-beck.git
8 years agoclk: fix critical clock locking
Maxime Ripard [Fri, 13 May 2016 08:00:31 +0000 (10:00 +0200)]
clk: fix critical clock locking

The critical clock handling in __clk_core_init isn't taking the enable lock
before calling clk_core_enable, which in turns triggers the warning in the
lockdep_assert_held call in that function when lockep is enabled.

Add the calls to clk_enable_lock/unlock to make sure it doesn't happen.

Fixes: 32b9b1096186 ("clk: Allow clocks to be marked as CRITICAL")
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: qcom: mmcc-8996: Remove clocks that should be controlled by RPM
Archit Taneja [Wed, 11 May 2016 09:37:32 +0000 (15:07 +0530)]
clk: qcom: mmcc-8996: Remove clocks that should be controlled by RPM

The branch clocks MMSS_MMAGIC_AXI_CLK and MMAGIC_BIMC_AXI_CLK are
controlled by RPM when the APPs processor enable or disable the
RPM_MMAXI_CLK.

During the boot sequence, someone can enable the RPM_MMAXI_CLK, resulting
in register status bits showing that these clocks are enabled, our
clock driver may look at the enabled status of these clocks and try to
disable them since it thinks they are unused.

Don't make the clock driver touch these clocks.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoMerge tag 'imx-clk-fixes-4.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git...
Stephen Boyd [Wed, 11 May 2016 18:39:17 +0000 (11:39 -0700)]
Merge tag 'imx-clk-fixes-4.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux into clk-next

Pull some non-critical i.MX clk fixes from Shawn Guo:

 * Fix the commit 3713e3f5e927 ("clk: imx35: define two clocks for rtc")
   which messed up the clock enumeration when adding new clock.

* tag 'imx-clk-fixes-4.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux:
  ARM: dts: imx35: restore existing used clock enumeration
  clk: imx6q: fix typo in CAN clock definition

8 years agoclk: ingenic: Allow divider value to be divided
Harvey Hunt [Mon, 9 May 2016 16:29:52 +0000 (17:29 +0100)]
clk: ingenic: Allow divider value to be divided

The JZ4780's MSC clock divider registers multiply the clock divider by 2.
This means that MMC devices run at half their expected speed. Add the
ability to divide the clock divider in order to solve this.

Signed-off-by: Harvey Hunt <harvey.hunt@imgtec.com>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-clk@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoMerge tag 'v4.7-rockchip-clk4' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind...
Stephen Boyd [Mon, 9 May 2016 23:04:37 +0000 (16:04 -0700)]
Merge tag 'v4.7-rockchip-clk4' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip into clk-next

Pull rockchip clk updates from Heiko Stuebner:

Another small rk3399 fixup as well as simplifications around
our handling of the General-Register-Files syscon.

* tag 'v4.7-rockchip-clk4' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip:
  clk: rockchip: drop old_rate calculation on pll rate changes
  clk: rockchip: simplify GRF handling in pll clocks
  clk: rockchip: lookup General Register Files in rockchip_clk_init
  clk: rockchip: fix the rk3399 sdmmc sample / drv name

8 years agoclk: sunxi: Add display and TCON0 clocks driver
Maxime Ripard [Mon, 25 Apr 2016 13:22:42 +0000 (15:22 +0200)]
clk: sunxi: Add display and TCON0 clocks driver

The A10 SoCs and its relatives has a special clock controller to drive the
display engines (both frontend and backend), that have a lot in common with
the clock to drive the first TCON channel.

Add a driver to support both.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Rob Herring <robh@kernel.org>
[sboyd@codeaurora.org: Silence variable sized array warning]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: rockchip: drop old_rate calculation on pll rate changes
Heiko Stuebner [Tue, 15 Mar 2016 16:34:56 +0000 (17:34 +0100)]
clk: rockchip: drop old_rate calculation on pll rate changes

Previously when everything happened in the set_rate callbacks itself we
needed the old_rate value for the possible rate rollback, so that made
it easy to also use it in the debug output.

Now with the param-handling being done in separate functions, reading and
recalculating the current pll rate only to use it in a debug message that
won't get displayed in regular cases anyway is quite a waste.

Therefore drop that value from the debug output. In the worst case that
previous rate will have been displayed on the rate change before.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
8 years agoclk: rockchip: simplify GRF handling in pll clocks
Heiko Stuebner [Tue, 15 Mar 2016 15:55:41 +0000 (16:55 +0100)]
clk: rockchip: simplify GRF handling in pll clocks

With the previous commit, the clock drivers now know at init time if the
GRF regmap is available. That means if it isn't available then, it also
won't become available later and we can therefore switch PLLs, that need
the GRF for the lock-status, to read-only mode - similar behaviour as the
aborting of rate changes we did before.

This saves some conditionals on every rate change and we can also drop
the rockchip_clk_get_grf function completely.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
8 years agoclk: rockchip: lookup General Register Files in rockchip_clk_init
Heiko Stuebner [Tue, 15 Mar 2016 15:40:32 +0000 (16:40 +0100)]
clk: rockchip: lookup General Register Files in rockchip_clk_init

In the distant past syscons were initialized pretty late and weren't
available at the time the clock init ran. As the GRF is mainly needed
for PLL lock-status checking, we had this lazy init that tried to grab
the syscon on PLL rate changes and denied these changes if it was not
available.

These days syscons are available very early and recent addition to
rockchip clocks, like the PLL clk_init actually also rely on them
being available at that time, so there is no need to keep that lazy
init around, as it will also result in some more simplifications in
other parts of the clock-code.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
8 years agoclk: rockchip: fix the rk3399 sdmmc sample / drv name
Douglas Anderson [Wed, 4 May 2016 23:36:25 +0000 (16:36 -0700)]
clk: rockchip: fix the rk3399 sdmmc sample / drv name

The rk3399 clock table had a simple typo in it, calling the SDMMC sample
and drive clocks by the wrong name.  Fix this minor typo.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>
Acked-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
8 years agoclk: mvebu: new driver for Armada CP110 system controller
Thomas Petazzoni [Thu, 14 Apr 2016 15:33:33 +0000 (17:33 +0200)]
clk: mvebu: new driver for Armada CP110 system controller

The Armada CP110 system controller provides, amongst other things, a
number of clocks for the platform: a small number of core clocks, and
then a number of gatable clocks, derived from some of the core
clocks. Those clocks are configured via registers of the CP110 System
Controller.

The CP110 is the other core HW block (next to the AP806) used in the
Marvel Armada 7K and 8K SoCs.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
[sboyd@codeaurora.org: Silence some checkpatch noise]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agodt-bindings: arm: add DT binding for Marvell CP110 system controller
Thomas Petazzoni [Thu, 14 Apr 2016 15:33:32 +0000 (17:33 +0200)]
dt-bindings: arm: add DT binding for Marvell CP110 system controller

This commit adds the DT binding documentation for the Marvell CP110
system controller, which is part of the CP110 HW block, itself used in
the Marvell Armada 7K and 8K SoCs.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Rob Herring <rob@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: mvebu: new driver for Armada AP806 system controller
Thomas Petazzoni [Thu, 14 Apr 2016 15:33:31 +0000 (17:33 +0200)]
clk: mvebu: new driver for Armada AP806 system controller

The Armada AP806 system controller, amongst other things, provides a
number of clocks for the platform: the CPU cluster clocks, whose
frequencies are found by reading the Sample At Reset register, one
fixed clock, and another clock derived from the fixed clock, which is
the one used by most peripherals in AP806.

The AP806 is one of the two core HW blocks used in the Marvell 7K/8K
SoCs.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
[sboyd@codeaurora.org: Silence some checkpatch noise]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoMerge branch 'clk-hi3519' into clk-next
Stephen Boyd [Fri, 6 May 2016 18:21:23 +0000 (11:21 -0700)]
Merge branch 'clk-hi3519' into clk-next

* clk-hi3519:
  clk: hisilicon: add CRG driver for hi3519 soc
  clk: hisilicon: export some hisilicon APIs to modules
  reset: hisilicon: add reset controller driver for hisilicon SOCs

8 years agoclk: hisilicon: add CRG driver for hi3519 soc
Jiancheng Xue [Sat, 23 Apr 2016 07:40:30 +0000 (15:40 +0800)]
clk: hisilicon: add CRG driver for hi3519 soc

The CRG(Clock and Reset Generator) block provides clock
and reset signals for other modules in hi3519 soc.

Signed-off-by: Jiancheng Xue <xuejiancheng@hisilicon.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: hisilicon: export some hisilicon APIs to modules
Jiancheng Xue [Sat, 23 Apr 2016 07:40:29 +0000 (15:40 +0800)]
clk: hisilicon: export some hisilicon APIs to modules

Change some arguments to constant type.
Export some hisilicon APIs to modules.

Signed-off-by: Jiancheng Xue <xuejiancheng@huawei.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoreset: hisilicon: add reset controller driver for hisilicon SOCs
Jiancheng Xue [Sat, 23 Apr 2016 07:40:28 +0000 (15:40 +0800)]
reset: hisilicon: add reset controller driver for hisilicon SOCs

In most of hisilicon SOCs, reset controller and clock provider are
combined together as a block named CRG (Clock and Reset Generator).
This patch mainly implements the reset function.

Signed-off-by: Jiancheng Xue <xuejiancheng@hisilicon.com>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: bcm/kona: Do not use sizeof on pointer type
Vaishali Thakkar [Thu, 28 Apr 2016 13:50:33 +0000 (19:20 +0530)]
clk: bcm/kona: Do not use sizeof on pointer type

When sizeof is applied to a pointer typed expression, it gives
the size of the pointer. So, here do not use sizeof on pointer
type. Also, silent checkpatch.pl by using kmalloc_array over
kmalloc.

Note that this has no effect on runtime because 'parent_names'
is a pointer to a pointer.

Problem found using Coccinelle.

Signed-off-by: Vaishali Thakkar <vaishali.thakkar@oracle.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: qcom: msm8916: Fix crypto clock flags
Andy Gross [Tue, 3 May 2016 20:24:11 +0000 (15:24 -0500)]
clk: qcom: msm8916: Fix crypto clock flags

This patch adds the CLK_SET_RATE_PARENT flag for the crypto core and
ahb blocks.  Without this flag, clk_set_rate can fail for certain
frequency requests.

Signed-off-by: Andy Gross <andy.gross@linaro.org>
Fixes: 3966fab8b6ab ("clk: qcom: Add MSM8916 Global Clock Controller support")
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoMerge tag 'imx-clk-4.7-2' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo...
Stephen Boyd [Fri, 6 May 2016 18:02:35 +0000 (11:02 -0700)]
Merge tag 'imx-clk-4.7-2' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux into clk-next

Pull i.MX clk updates from Shawn Guo:

 - Update clk-pllv3 driver to get it return correct frequency for
   Ethernet PLL on i.MX7D.
 - Correct ahb clock mux settings for i.MX7D per latest hardware
   document.

* tag 'imx-clk-4.7-2' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux:
  clk: imx7d: fix ahb clock mux 1
  clk: imx: return correct frequency for Ethernet PLL

8 years agoclk: nxp: lpc18xx: Initialize clk_init_data::flags to 0
Stephen Boyd [Fri, 6 May 2016 17:55:11 +0000 (10:55 -0700)]
clk: nxp: lpc18xx: Initialize clk_init_data::flags to 0

Failure to initialize this flag to 0 by default can result in
stack junk filling the clk_init_data structure and weird things
happen. Joachim noticed that the critical clk feature started
triggering for these clks causing boot failures, when it really
shouldn't have happened:

BUG: scheduling while atomic: swapper/0/0x00000002
CPU: 0 PID: 0 Comm: swapper Not tainted
4.6.0-rc6-next-20160505-00001-g5c8320450d1c #826
Hardware name: NXP LPC18xx/43xx (Device Tree)
[<2800be81>] (unwind_backtrace) from [<2800b22f>] (show_stack+0xb/0xc)
[<2800b22f>] (show_stack) from [<2801ea21>] (__schedule_bug+0x2d/0x44)
[<2801ea21>] (__schedule_bug) from [<281dc937>] (__schedule+0x3b/0x268)
[<281dc937>] (__schedule) from [<281dcbbb>] (schedule+0x57/0x64)
[<281dcbbb>] (schedule) from [<281de8ef>] (schedule_timeout+0xfb/0x120)
[<281de8ef>] (schedule_timeout) from [<28030fcd>] (msleep+0xf/0x12)
[<28030fcd>] (msleep) from [<28165a6d>] (clk_creg_32k_prepare+0x1f/0x24)
[<28165a6d>] (clk_creg_32k_prepare) from [<281620d5>]
(clk_core_prepare+0x1d/0x36)
[<281620d5>] (clk_core_prepare) from [<2816340b>] (clk_register+0x22f/0x318)
[<2816340b>] (clk_register) from [<282b06c9>] (lpc18xx_creg_clk_init+0x55/0x84)
[<282b06c9>] (lpc18xx_creg_clk_init) from [<282b0149>] (of_clk_init+0xc1/0x12c)
[<282b0149>] (of_clk_init) from [<282a665d>] (time_init+0x15/0x20)
[<282a665d>] (time_init) from [<282a457d>] (start_kernel+0x169/0x274)
[<282a457d>] (start_kernel) from [<28008025>] (0x28008025)
bad: scheduling from the idle thread!
CPU: 0 PID: 0 Comm: swapper Tainted: G W
4.6.0-rc6-next-20160505-00001-g5c8320450d1c #826

Fix this by initializing the flags member to 0.

Acked-by: Joachim Eastwood <manabian@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk/axs10x: Add I2S PLL clock driver
Jose Abreu [Mon, 2 May 2016 09:39:05 +0000 (10:39 +0100)]
clk/axs10x: Add I2S PLL clock driver

The ARC SDP I2S clock can be programmed using a
specific PLL.

This patch has the goal of adding a clock driver
that programs this PLL.

At this moment the rate values are hardcoded in
a table but in the future it would be ideal to
use a function which determines the PLL values
given the desired rate.

Signed-off-by: Jose Abreu <joabreu@synopsys.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: imx7d: fix ahb clock mux 1
Stefan Agner [Thu, 28 Apr 2016 21:07:03 +0000 (14:07 -0700)]
clk: imx7d: fix ahb clock mux 1

The clock parent of the AHB root clock when using mux option 1
is the SYS PLL 270MHz clock. This is specified in  Table 5-11
Clock Root Table of the i.MX 7Dual Applications Processor
Reference Manual.

While it could be a documentation error, the 270MHz parent is
also mentioned in the boot ROM configuration in Table 6-28: The
clock is by default at 135MHz due to a POST_PODF value of 1
(=> divider of 2).

Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
8 years agoclk: fix comment of devm_clk_hw_register()
Masahiro Yamada [Sun, 1 May 2016 10:56:08 +0000 (19:56 +0900)]
clk: fix comment of devm_clk_hw_register()

Unlike devm_clk_register(), devm_clk_hw_register() returns integer.
So, the statement "Clocks returned from this function ..." sounds
odd.  Adjust the comment for this new API.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoMerge tag 'clk-renesas-for-v4.7-tag3' of git://git.kernel.org/pub/scm/linux/kernel...
Stephen Boyd [Tue, 3 May 2016 00:05:23 +0000 (17:05 -0700)]
Merge tag 'clk-renesas-for-v4.7-tag3' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers into clk-next

Pull Renesas clk driver updates from Geert Uytterhoeven:

  - Support for CSI2 and VIN module clocks on R-Car H3,
  - Renesas CPG/MSTP and CPG/MSSR Clock Domain fixes.

* tag 'clk-renesas-for-v4.7-tag3' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers:
  clk: renesas: cpg-mssr: Use always-on governor for Clock Domain
  clk: renesas: cpg-mssr: Postpone call to pm_genpd_init()
  clk: renesas: mstp: Use always-on governor for Clock Domain
  clk: renesas: mstp: Postpone call to pm_genpd_init()
  clk: renesas: r8a7795: Add VIN clocks
  clk: renesas: r8a7795: Add CSI2 clocks

8 years agoMerge tag 'sunxi-clocks-for-4.7' of https://git.kernel.org/pub/scm/linux/kernel/git...
Stephen Boyd [Tue, 3 May 2016 00:03:08 +0000 (17:03 -0700)]
Merge tag 'sunxi-clocks-for-4.7' of https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux into clk-next

Pull Allwinner clock driver updates from Maxime Ripard:

As usual, a bunch of clocks patches for 4.7, mostly fixes and cleanups, and
display-related clocks.

* tag 'sunxi-clocks-for-4.7' of https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux:
  clk: sunxi: Let divs clocks read the base factor clock name from devicetree
  clk: sunxi: Add TCON channel1 clock
  clk: sunxi: Add PLL3 clock
  dt-bindings: clk: sun5i: add DRAM gates compatible
  clk: sunxi: Use resource_size
  clk: sunxi: Add sun6i/8i display support
  clk: sunxi: mod1 clock should modify it's parent

8 years agoMerge tag 'tegra-for-4.7-clk' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra...
Stephen Boyd [Mon, 2 May 2016 23:53:02 +0000 (16:53 -0700)]
Merge tag 'tegra-for-4.7-clk' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux into clk-next

Pull tegra clk driver changes from Thierry Reding:

This set of changes contains a bunch of cleanups and minor fixes along
with some new clocks, mainly on Tegra210, in preparation for supporting
DisplayPort and HDMI 2.0.

* tag 'tegra-for-4.7-clk' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux:
  clk: tegra: dfll: Reformat CVB frequency table
  clk: tegra: dfll: Properly clean up on failure and removal
  clk: tegra: dfll: Make code more comprehensible
  clk: tegra: dfll: Reference CVB table instead of copying data
  clk: tegra: dfll: Update kerneldoc
  clk: tegra: Fix PLL_U post divider and initial rate on Tegra30
  clk: tegra: Initialize PLL_C to sane rate on Tegra30
  clk: tegra: Fix pllre Tegra210 and add pll_re_out1
  clk: tegra: Add sor_safe clock
  clk: tegra: dpaux and dpaux1 are fixed factor clocks
  clk: tegra: Add dpaux1 clock
  clk: tegra: Use correct parent for dpaux clock
  clk: tegra: Add fixed factor peripheral clock type
  clk: tegra: Special-case mipi-cal parent on Tegra114
  clk: tegra: Remove trailing blank line
  clk: tegra: Constify peripheral clock registers
  clk: tegra: Add interface to enable hardware control of SATA/XUSB PLLs

8 years agoMerge tag 'v4.7-rockchip-clk3' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind...
Stephen Boyd [Mon, 2 May 2016 23:43:03 +0000 (16:43 -0700)]
Merge tag 'v4.7-rockchip-clk3' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip into clk-next

Pull rockchip clk updates from Heiko Stuebner:

A spelling fix and a bunch of rk3399 clock fixes.

* tag 'v4.7-rockchip-clk3' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip:
  clk: rockchip: fix the rk3399 cifout clock
  clk: rockchip: drop unnecessary CLK_IGNORE_UNUSED flags from rk3399
  clk: rockchip: add some frequencies on the rk3399 PLL table
  clk: rockchip: assign more necessary rk3399 clock ids
  clk: rockchip: export some necessary rk3399 clock ids
  clk: rockchip: rename rga clock-id on rk3399
  clk: rockchip: add general gpu soft-reset on rk3399
  clk: rockchip: fix the gate bit for i2c4 and i2c8 on rk3399
  clk: rockchip: fix of spelling mistake on unsuccessful in pll clock type

8 years agoclk: tegra: dfll: Reformat CVB frequency table
Thierry Reding [Fri, 8 Apr 2016 13:17:27 +0000 (15:17 +0200)]
clk: tegra: dfll: Reformat CVB frequency table

Increase the readability of the CVB frequency table by reformatting it a
little.

Signed-off-by: Thierry Reding <treding@nvidia.com>
8 years agoclk: tegra: dfll: Properly clean up on failure and removal
Thierry Reding [Fri, 8 Apr 2016 13:16:28 +0000 (15:16 +0200)]
clk: tegra: dfll: Properly clean up on failure and removal

Upon failure to probe the DFLL, the OPP table will not be cleaned up
properly. Fix this and while at it make sure the OPP table will also be
cleared upon driver removal.

Signed-off-by: Thierry Reding <treding@nvidia.com>
8 years agoclk: tegra: dfll: Make code more comprehensible
Thierry Reding [Fri, 8 Apr 2016 13:09:56 +0000 (15:09 +0200)]
clk: tegra: dfll: Make code more comprehensible

Rename some variables and structure fields to make the code more
comprehensible. Also change the prototype of internal functions to be
more in line with the OPP core functions.

Signed-off-by: Thierry Reding <treding@nvidia.com>
8 years agoclk: tegra: dfll: Reference CVB table instead of copying data
Thierry Reding [Fri, 8 Apr 2016 13:02:06 +0000 (15:02 +0200)]
clk: tegra: dfll: Reference CVB table instead of copying data

Instead of copying parts of the CVB table into a separate structure,
keep track of the selected CVB table and directly reference data from
it.

Signed-off-by: Thierry Reding <treding@nvidia.com>
8 years agoclk: tegra: dfll: Update kerneldoc
Thierry Reding [Fri, 8 Apr 2016 12:57:09 +0000 (14:57 +0200)]
clk: tegra: dfll: Update kerneldoc

The kerneldoc for struct tegra_dfll_soc_data is stale. Update it to
match the current structure definition.

Signed-off-by: Thierry Reding <treding@nvidia.com>
8 years agoclk: tegra: Fix PLL_U post divider and initial rate on Tegra30
Lucas Stach [Mon, 29 Feb 2016 20:46:07 +0000 (21:46 +0100)]
clk: tegra: Fix PLL_U post divider and initial rate on Tegra30

The post divider value in the frequency table is wrong as it would lead
to the PLL producing an output rate of 960 MHz instead of the desired
480 MHz. This wasn't a problem as nothing used the table to actually
initialize the PLL rate, but the bootloader configuration was used
unaltered.

If the bootloader does not set up the PLL it will fail to come when used
under Linux. To fix this don't rely on the bootloader, but set the
correct rate in the clock driver.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Thierry Reding <treding@nvidia.com>
8 years agoclk: tegra: Initialize PLL_C to sane rate on Tegra30
Lucas Stach [Mon, 29 Feb 2016 20:46:06 +0000 (21:46 +0100)]
clk: tegra: Initialize PLL_C to sane rate on Tegra30

If the bootloader does not touch PLL_C it will stay in its reset state,
failing to lock when enabled. This leads to consumers of this clock to
fail probing. Fix this by always programming the PLL with a sane rate,
which allows it to lock, at startup.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Thierry Reding <treding@nvidia.com>
8 years agoclk: tegra: Fix pllre Tegra210 and add pll_re_out1
Rhyland Klein [Mon, 21 Mar 2016 19:58:52 +0000 (15:58 -0400)]
clk: tegra: Fix pllre Tegra210 and add pll_re_out1

Use a new Tegra210 version of the pll_register_pllre function to
allow setting the proper settings for the m and n div fields.

Additionally define PLL_RE_OUT1 on Tegra210.

Signed-off-by: Rhyland Klein <rklein@nvidia.com>
[treding@nvidia.com: define PLLRE_OUT1 register offset]
Signed-off-by: Thierry Reding <treding@nvidia.com>
8 years agoclk: tegra: Add sor_safe clock
Thierry Reding [Mon, 20 Apr 2015 13:13:36 +0000 (15:13 +0200)]
clk: tegra: Add sor_safe clock

The sor_safe clock is a fixed factor (1:17) clock derived from pll_p. It
has a gate bit in the peripheral clock registers. While the SOR is being
powered up, sor_safe can be used as the source until the SOR brick can
generate its own clock.

Signed-off-by: Thierry Reding <treding@nvidia.com>
8 years agoclk: tegra: dpaux and dpaux1 are fixed factor clocks
Thierry Reding [Mon, 20 Apr 2015 13:10:43 +0000 (15:10 +0200)]
clk: tegra: dpaux and dpaux1 are fixed factor clocks

The dpaux (on Tegra124 and Tegra210) and dpaux1 (on Tegra210) are fixed
factor clocks (1:17) and derived from pll_p_out0 (pll_p). They also have
a gate bit in the peripheral clock registers.

Signed-off-by: Thierry Reding <treding@nvidia.com>
8 years agoclk: tegra: Add dpaux1 clock
Thierry Reding [Mon, 20 Apr 2015 13:05:33 +0000 (15:05 +0200)]
clk: tegra: Add dpaux1 clock

This clock is of the same type as dpaux and is added to feed into the
second DPAUX block used in conjunction with SOR1.

Signed-off-by: Thierry Reding <treding@nvidia.com>
8 years agoclk: tegra: Use correct parent for dpaux clock
Thierry Reding [Mon, 20 Apr 2015 12:47:25 +0000 (14:47 +0200)]
clk: tegra: Use correct parent for dpaux clock

The dpaux clock is derived from pll_p_out0 (pll_p), not clk_m.

Signed-off-by: Thierry Reding <treding@nvidia.com>
8 years agoclk: tegra: Add fixed factor peripheral clock type
Thierry Reding [Mon, 20 Apr 2015 12:34:57 +0000 (14:34 +0200)]
clk: tegra: Add fixed factor peripheral clock type

Some of the peripheral clocks on Tegra are derived from one of the top-
level PLLs with a fixed factor. Support these clocks by implementing the
->enable() and ->disable() callbacks using the peripheral clock register
banks and the ->recalc_rate() by dividing the parent rate by the fixed
factor.

Signed-off-by: Thierry Reding <treding@nvidia.com>
8 years agoclk: tegra: Special-case mipi-cal parent on Tegra114
Thierry Reding [Wed, 8 Apr 2015 14:48:26 +0000 (16:48 +0200)]
clk: tegra: Special-case mipi-cal parent on Tegra114

Starting with Tegra124, the mipi-cal clock uses the 72 MHz clock as its
source. On Tegra114 this clock's parent was clk_m, so it is the one-off
chip.

Signed-off-by: Thierry Reding <treding@nvidia.com>
8 years agoclk: tegra: Remove trailing blank line
Thierry Reding [Mon, 20 Apr 2015 13:26:42 +0000 (15:26 +0200)]
clk: tegra: Remove trailing blank line

Trailing blank lines are undesirable (several tools, such as git,
complain about them), so remove it.

Signed-off-by: Thierry Reding <treding@nvidia.com>
8 years agoclk: tegra: Constify peripheral clock registers
Thierry Reding [Mon, 20 Apr 2015 12:38:39 +0000 (14:38 +0200)]
clk: tegra: Constify peripheral clock registers

The peripheral clock registers are defined in static tables. These
tables never need to be modified at runtime, so they can reside in
read-only memory.

Signed-off-by: Thierry Reding <treding@nvidia.com>
8 years agoclk: tegra: Add interface to enable hardware control of SATA/XUSB PLLs
Andrew Bresticker [Thu, 18 Jun 2015 21:28:40 +0000 (17:28 -0400)]
clk: tegra: Add interface to enable hardware control of SATA/XUSB PLLs

On Tegra210, hardware control of the SATA and XUSB pad PLLs must be
done during the UPHY enable sequence rather than the PLLE enable
sequence.  Export functions to do this so that hardware control can
be enabled from the XUSB padctl driver.

Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
8 years agoclk: renesas: cpg-mssr: Use always-on governor for Clock Domain
Geert Uytterhoeven [Fri, 22 Apr 2016 12:59:10 +0000 (14:59 +0200)]
clk: renesas: cpg-mssr: Use always-on governor for Clock Domain

As a pure Clock Domain does not have the concept of powering the domain
itself, the CPG/MSTP driver does not provide power_off() and power_on()
callbacks.
However, the genpd core may still perform a dummy power down, causing
/sys/kernel/debug/pm_genpd/pm_genpd_summary to report the domain's
status being "off-0".

Use the always-on governor to make sure the domain is never powered
down, and always shows up as "on" in pm_genpd_summary.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agoclk: renesas: cpg-mssr: Postpone call to pm_genpd_init()
Geert Uytterhoeven [Fri, 22 Apr 2016 12:46:51 +0000 (14:46 +0200)]
clk: renesas: cpg-mssr: Postpone call to pm_genpd_init()

All local setup of the generic_pm_domain structure should have been
completed before calling pm_genpd_init().

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agoclk: renesas: mstp: Use always-on governor for Clock Domain
Geert Uytterhoeven [Fri, 22 Apr 2016 12:57:29 +0000 (14:57 +0200)]
clk: renesas: mstp: Use always-on governor for Clock Domain

As a pure Clock Domain does not have the concept of powering the domain
itself, the CPG/MSTP driver does not provide power_off() and power_on()
callbacks.
However, the genpd core may still perform a dummy power down, causing
/sys/kernel/debug/pm_genpd/pm_genpd_summary to report the domain's
status being "off-0".

Use the always-on governor to make sure the domain is never powered
down, and always shows up as "on" in pm_genpd_summary.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agoclk: renesas: mstp: Postpone call to pm_genpd_init()
Geert Uytterhoeven [Fri, 22 Apr 2016 12:45:45 +0000 (14:45 +0200)]
clk: renesas: mstp: Postpone call to pm_genpd_init()

All local setup of the generic_pm_domain structure should have been
completed before calling pm_genpd_init().

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agoclk: imx: return correct frequency for Ethernet PLL
Stefan Agner [Fri, 29 Jan 2016 22:49:24 +0000 (14:49 -0800)]
clk: imx: return correct frequency for Ethernet PLL

The i.MX 7 designs Ethernet PLL provides a 1000MHz reference clock.
Store the reference clock in the clk_pllv3 structure according to
the PLL type.

Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
8 years agoclk: renesas: r8a7795: Add VIN clocks
Niklas Söderlund [Mon, 25 Apr 2016 11:39:20 +0000 (13:39 +0200)]
clk: renesas: r8a7795: Add VIN clocks

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
8 years agoclk: renesas: r8a7795: Add CSI2 clocks
Niklas Söderlund [Mon, 25 Apr 2016 11:39:19 +0000 (13:39 +0200)]
clk: renesas: r8a7795: Add CSI2 clocks

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
8 years agoclk: rockchip: fix the rk3399 cifout clock
Xing Zheng [Wed, 20 Apr 2016 11:11:32 +0000 (19:11 +0800)]
clk: rockchip: fix the rk3399 cifout clock

The cifout clock is incorrect due to the manual error, we need to
fix it.

Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
8 years agoclk: rockchip: drop unnecessary CLK_IGNORE_UNUSED flags from rk3399
Xing Zheng [Wed, 20 Apr 2016 11:06:51 +0000 (19:06 +0800)]
clk: rockchip: drop unnecessary CLK_IGNORE_UNUSED flags from rk3399

We don't need to many clocks enable after startup, to reduce some
power consumption.

Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
8 years agoclk: rockchip: add some frequencies on the rk3399 PLL table
Xing Zheng [Wed, 20 Apr 2016 11:06:50 +0000 (19:06 +0800)]
clk: rockchip: add some frequencies on the rk3399 PLL table

This patch add some necessary frequencies for the RK3399 clock.

Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
8 years agoclk: rockchip: assign more necessary rk3399 clock ids
Xing Zheng [Wed, 20 Apr 2016 11:06:49 +0000 (19:06 +0800)]
clk: rockchip: assign more necessary rk3399 clock ids

Assign newly added clock ids.

Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
8 years agoMerge branch 'v4.7-shared/clkids' into v4.7-clk/next
Heiko Stuebner [Mon, 25 Apr 2016 20:48:19 +0000 (22:48 +0200)]
Merge branch 'v4.7-shared/clkids' into v4.7-clk/next

8 years agoclk: rockchip: export some necessary rk3399 clock ids
Xing Zheng [Wed, 20 Apr 2016 11:06:49 +0000 (19:06 +0800)]
clk: rockchip: export some necessary rk3399 clock ids

We export some clock IDs for the reference drivers need them.

Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
8 years agoclk: rockchip: rename rga clock-id on rk3399
Xing Zheng [Wed, 20 Apr 2016 11:06:49 +0000 (19:06 +0800)]
clk: rockchip: rename rga clock-id on rk3399

The rga clock supplying the working clock on the rk3399 is actually
called rga-core in the manual. As the clock id has neither been
assigned nor released with a full kernel release, we can still change
the id to the more appropriate naming.

Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
8 years agoclk: rockchip: add general gpu soft-reset on rk3399
Xing Zheng [Wed, 20 Apr 2016 11:06:49 +0000 (19:06 +0800)]
clk: rockchip: add general gpu soft-reset on rk3399

Add the id for the general gpu soft-reset, that got documented only in
newer TRM versions.

Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
8 years agoclk: rockchip: fix the gate bit for i2c4 and i2c8 on rk3399
Xing Zheng [Wed, 20 Apr 2016 11:12:10 +0000 (19:12 +0800)]
clk: rockchip: fix the gate bit for i2c4 and i2c8 on rk3399

The gate bits of the i2c4 and i2c8 are incorrect due to the manual
error, we need to fix them.

Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
8 years agoclk: sunxi: Let divs clocks read the base factor clock name from devicetree
Jens Kuske [Fri, 18 Mar 2016 09:44:15 +0000 (09:44 +0000)]
clk: sunxi: Let divs clocks read the base factor clock name from devicetree

Currently, the sunxi clock driver gets the name for the base factor clock
of divs clocks from the name field in factors_data. This prevents reusing
of the factor clock for clocks with same properties, but different name.

This commit makes the divs setup function try to get a name from
clock-output-names in the devicetree. It also removes the name field where
possible and merges the sun4i PLL5 and PLL6 clocks.

[Andre: Make temporary name allocation dynamic.]

Signed-off-by: Jens Kuske <jenskuske@gmail.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
8 years agoclk: rockchip: fix of spelling mistake on unsuccessful in pll clock type
Colin Ian King [Sun, 24 Apr 2016 22:44:13 +0000 (23:44 +0100)]
clk: rockchip: fix of spelling mistake on unsuccessful in pll clock type

fix spelling mistake, unsucessful -> unsuccessful

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
8 years agoclk: sunxi: Add TCON channel1 clock
Maxime Ripard [Wed, 1 Jul 2015 13:48:37 +0000 (15:48 +0200)]
clk: sunxi: Add TCON channel1 clock

The TCON is a controller generating the timings to output videos signals,
acting like both a CRTC and an encoder.

It has two channels depending on the output, each channel being driven by
its own clock (and own clock controller).

Add a driver for the channel 1 clock.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Rob Herring <robh@kernel.org>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: sunxi: Add PLL3 clock
Maxime Ripard [Wed, 23 Mar 2016 16:38:26 +0000 (17:38 +0100)]
clk: sunxi: Add PLL3 clock

The A10 SoCs and relatives have a PLL controller to drive the PLL3 and
PLL7, clocked from a 3MHz oscillator, that drives the display related
clocks (GPU, display engine, TCON, etc.)

Add a driver for it.

Acked-by: Rob Herring <robh@kernel.org>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
8 years agodt-bindings: clk: sun5i: add DRAM gates compatible
Maxime Ripard [Wed, 23 Mar 2016 16:38:28 +0000 (17:38 +0100)]
dt-bindings: clk: sun5i: add DRAM gates compatible

The Allwinner SoCs have a gate controller to gate the access to the DRAM
clock to the some devices that need to access the DRAM directly (mostly
display / image related IPs).

Use a simple gates driver to support the one found in the A13 / R8 SoCs.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Rob Herring <robh@kernel.org>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
8 years agoclk: sunxi: Use resource_size
Vaishali Thakkar [Mon, 11 Apr 2016 04:53:03 +0000 (10:23 +0530)]
clk: sunxi: Use resource_size

Use the function resource_size instaed of explicit computation.

Problem found using Coccinelle.

Signed-off-by: Vaishali Thakkar <vaishali.thakkar@oracle.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
8 years agoclk: sunxi: Add sun6i/8i display support
Jean-Francois Moine [Wed, 30 Mar 2016 16:43:29 +0000 (18:43 +0200)]
clk: sunxi: Add sun6i/8i display support

Add the clock type which is used by the sun6i/8i families for video display.

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
8 years agoclk: sunxi: mod1 clock should modify it's parent
Andrea Venturi [Mon, 21 Mar 2016 16:10:38 +0000 (17:10 +0100)]
clk: sunxi: mod1 clock should modify it's parent

add CLK_SET_RATE_PARENT to modify the rate on clk upstream

Signed-off-by: Marcus Cooper <codekipper@gmail.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
8 years agoMerge branch 'clk-hw-register' (early part) into clk-next
Stephen Boyd [Thu, 21 Apr 2016 21:47:18 +0000 (14:47 -0700)]
Merge branch 'clk-hw-register' (early part) into clk-next

* 'clk-hw-register' (early part):
  clk: fixed-rate: Add hw based registration APIs
  clk: gpio: Add hw based registration APIs
  clk: composite: Add hw based registration APIs
  clk: fractional-divider: Add hw based registration APIs
  clk: fixed-factor: Add hw based registration APIs
  clk: mux: Add hw based registration APIs
  clk: gate: Add hw based registration APIs
  clk: divider: Add hw based registration APIs
  clkdev: Add clk_hw based registration APIs
  clk: Add clk_hw OF clk providers
  clk: Add {devm_}clk_hw_{register,unregister}() APIs
  clkdev: Remove clk_register_clkdevs()

8 years agoMerge branch 'clk-composite-unregister' into clk-next
Stephen Boyd [Thu, 21 Apr 2016 21:43:56 +0000 (14:43 -0700)]
Merge branch 'clk-composite-unregister' into clk-next

* clk-composite-unregister:
  clk: composite: Add unregister function

8 years agoclk: composite: Add unregister function
Maxime Ripard [Wed, 23 Mar 2016 16:38:24 +0000 (17:38 +0100)]
clk: composite: Add unregister function

The composite clock didn't have any unregistration function, which forced
us to use clk_unregister directly on it.

While it was already not great from an API point of view, it also meant
that we were leaking the clk_composite structure allocated in
clk_register_composite.

Add a clk_unregister_composite function to fix this.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agodt-bindings: Add Oxford Semiconductor OXNAS Standard Clocks bindings
Neil Armstrong [Mon, 18 Apr 2016 10:01:36 +0000 (12:01 +0200)]
dt-bindings: Add Oxford Semiconductor OXNAS Standard Clocks bindings

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: Add Oxford Semiconductor OXNAS Standard Clocks
Neil Armstrong [Mon, 18 Apr 2016 10:01:35 +0000 (12:01 +0200)]
clk: Add Oxford Semiconductor OXNAS Standard Clocks

Add Oxford Semiconductor OXNAS SoC Family Standard Clocks support.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
[sboyd@codeaurora.org: Drop NULL/continue check in registration
loop]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoMerge tag 'clk-renesas-for-v4.7-tag2' of git://git.kernel.org/pub/scm/linux/kernel...
Stephen Boyd [Wed, 20 Apr 2016 18:44:03 +0000 (11:44 -0700)]
Merge tag 'clk-renesas-for-v4.7-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers into clk-next

clk: renesas: R-Car SYSC PM Domain Preparation

  - Export the CPG/MSSR and CPG/MSTP attach/detach_dev callbacks, so
    they can be called by the R-Car SYSC PM Domain driver.

* tag 'clk-renesas-for-v4.7-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers:
  clk: renesas: cpg-mssr: Export cpg_mssr_{at,de}tach_dev()
  clk: renesas: mstp: Provide dummy attach/detach_dev callbacks
  clk: renesas: Provide Kconfig symbols for CPG/MSSR and CPG/MSTP support

8 years agoMerge tag 'v4.7-rockchip-clk2' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind...
Stephen Boyd [Wed, 20 Apr 2016 18:41:37 +0000 (11:41 -0700)]
Merge tag 'v4.7-rockchip-clk2' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip into clk-next

Pull some checkpatch silencers from Heiko Stuebner:

Fix quite some checkpatch warnings in the newly added
rk3399 header and also in the clock code itself.

* tag 'v4.7-rockchip-clk2' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip:
  clk: rockchip: fix checkpatch warning in core code
  clk: rockchip: drop unnecessary header comment
  clk: rockchip: reign in some overly long lines in the rk3399 controller
  clk: rockchip: fix checkpatch errors in rk3399 dt-binding header

8 years agoclk: rockchip: fix checkpatch warning in core code
Heiko Stuebner [Tue, 19 Apr 2016 19:29:27 +0000 (21:29 +0200)]
clk: rockchip: fix checkpatch warning in core code

We seem to have accumulated a bunch of checkpatch warnings, with mainly
overlong lines and two unnecessary allocation error messages.
Most were introduced with the recent multi-controller-support but some
were quite a bit older.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
8 years agoclk: renesas: cpg-mssr: Export cpg_mssr_{at,de}tach_dev()
Geert Uytterhoeven [Fri, 4 Mar 2016 16:03:46 +0000 (17:03 +0100)]
clk: renesas: cpg-mssr: Export cpg_mssr_{at,de}tach_dev()

The R-Car SYSC PM Domain driver has to power manage devices in power
areas using clocks. To reuse code and to share knowledge of clocks
suitable for power management, this is ideally done through the existing
cpg_mssr_attach_dev() and cpg_mssr_detach_dev() callbacks.

Hence these callbacks can no longer rely on their "domain" parameter
pointing to the CPG/MSSR Clock Domain. To handle this, keep a pointer to
the clock domain in a static variable. cpg_mssr_attach_dev() has to
support probe deferral, as the R-Car SYSC PM Domain may be initialized,
and devices may be added to it, before the CPG/MSSR Clock Domain is
initialized.

Dummy callbacks are provided for the case where CPG/MSTP support is not
included, so the rcar-sysc driver won't have to care about this.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
8 years agoclk: renesas: mstp: Provide dummy attach/detach_dev callbacks
Geert Uytterhoeven [Wed, 13 Apr 2016 09:18:06 +0000 (11:18 +0200)]
clk: renesas: mstp: Provide dummy attach/detach_dev callbacks

Provide dummy cpg_mstp_{at,de}tach_dev() PM Domain callbacks if CPG/MSTP
support is not included, so the rcar-sysc driver won't have to care
about this.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
8 years agoclk: renesas: Provide Kconfig symbols for CPG/MSSR and CPG/MSTP support
Geert Uytterhoeven [Wed, 13 Apr 2016 09:08:42 +0000 (11:08 +0200)]
clk: renesas: Provide Kconfig symbols for CPG/MSSR and CPG/MSTP support

Currently the decision whether to build the renesas-cpg-mssr and
clk-mstp drivers is handled by Makefile logic.  However, the rcar-sysc
driver will need to know whether CPG/MSSR and/or CPG/MSTP support are
available or not.

To avoid having to duplicate this logic, move it to Kconfig. Provide
non-visible CLK_RENESAS_CPG_MSSR and CLK_RENESAS_CPG_MSTP Kconfig
symbols, which can be used by both Makefiles and C code.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
8 years agoclk: bcm2835: Fix PLL poweron
Eric Anholt [Wed, 13 Apr 2016 20:05:03 +0000 (13:05 -0700)]
clk: bcm2835: Fix PLL poweron

In poweroff, we set the reset bit and the power down bit, but only
managed to unset the reset bit for poweron.  This meant that if HDMI
did -EPROBE_DEFER after it had grabbed its clocks, we'd power down the
PLLH (that had been on at boot time) and never recover.

Signed-off-by: Eric Anholt <eric@anholt.net>
Fixes: 41691b8862e2 ("clk: bcm2835: Add support for programming the audio domain clocks")
Cc: stable@vger.kernel.org
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: bcm2835: Fix compiler warnings on 64-bit builds
Eric Anholt [Wed, 13 Apr 2016 20:05:02 +0000 (13:05 -0700)]
clk: bcm2835: Fix compiler warnings on 64-bit builds

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: qoriq: add __init attribute
Julia Lawall [Mon, 18 Apr 2016 14:55:34 +0000 (16:55 +0200)]
clk: qoriq: add __init attribute

Add __init attribute on a function that is only called from other __init
functions and that is not inlined, at least with gcc version 4.8.4 on an
x86 machine with allyesconfig.  Currently, the function is put in the
.text.unlikely segment.  Declaring it as __init will cause it to be put in
the .init.text and to disappear after initialization.

The result of objdump -x on the function before the change is as follows:

0000000000000000 l     F .text.unlikely 0000000000000071 sysclk_from_fixed.constprop.5

And after the change it is as follows:

0000000000000480 l     F .init.text 000000000000006c sysclk_from_fixed.constprop.5

Done with the help of Coccinelle.  The semantic patch checks for local
static non-init functions that are called from an __init function and are
not called from any other function.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: ti: dra7-atl-clock: Fix of_node reference counting
Peter Ujfalusi [Fri, 11 Mar 2016 14:13:32 +0000 (16:13 +0200)]
clk: ti: dra7-atl-clock: Fix of_node reference counting

of_find_node_by_name() will call of_node_put() on the node so we need to
get it first to avoid warnings.
The cfg_node needs to be put after we have finished processing the
properties.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Tested-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: fixed-rate: Add hw based registration APIs
Stephen Boyd [Sun, 7 Feb 2016 08:34:13 +0000 (00:34 -0800)]
clk: fixed-rate: Add hw based registration APIs

Add registration APIs in the clk fixed-rate code to return struct
clk_hw pointers instead of struct clk pointers. This way we hide
the struct clk pointer from providers unless they need to use
consumer facing APIs.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: gpio: Add hw based registration APIs
Stephen Boyd [Sun, 7 Feb 2016 08:27:55 +0000 (00:27 -0800)]
clk: gpio: Add hw based registration APIs

Add registration APIs in the clk gpio code to return struct
clk_hw pointers instead of struct clk pointers. This way we hide
the struct clk pointer from providers unless they need to use
consumer facing APIs.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: composite: Add hw based registration APIs
Stephen Boyd [Sun, 7 Feb 2016 08:20:31 +0000 (00:20 -0800)]
clk: composite: Add hw based registration APIs

Add registration APIs in the clk composite code to return struct
clk_hw pointers instead of struct clk pointers. This way we hide
the struct clk pointer from providers unless they need to use
consumer facing APIs.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: fractional-divider: Add hw based registration APIs
Stephen Boyd [Sun, 7 Feb 2016 08:15:09 +0000 (00:15 -0800)]
clk: fractional-divider: Add hw based registration APIs

Add registration APIs in the clk fractional divider code to
return struct clk_hw pointers instead of struct clk pointers.
This way we hide the struct clk pointer from providers unless
they need to use consumer facing APIs.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: fixed-factor: Add hw based registration APIs
Stephen Boyd [Sun, 7 Feb 2016 08:11:06 +0000 (00:11 -0800)]
clk: fixed-factor: Add hw based registration APIs

Add registration APIs in the clk fixed-factor code to return
struct clk_hw pointers instead of struct clk pointers. This way
we hide the struct clk pointer from providers unless they need to
use consumer facing APIs.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: mux: Add hw based registration APIs
Stephen Boyd [Sun, 7 Feb 2016 08:05:48 +0000 (00:05 -0800)]
clk: mux: Add hw based registration APIs

Add registration APIs in the clk mux code to return struct clk_hw
pointers instead of struct clk pointers. This way we hide the
struct clk pointer from providers unless they need to use
consumer facing APIs.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: gate: Add hw based registration APIs
Stephen Boyd [Sun, 7 Feb 2016 07:54:45 +0000 (23:54 -0800)]
clk: gate: Add hw based registration APIs

Add registration APIs in the clk gate code to return struct
clk_hw pointers instead of struct clk pointers. This way we hide
the struct clk pointer from providers unless they need to use
consumer facing APIs.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: divider: Add hw based registration APIs
Stephen Boyd [Sun, 7 Feb 2016 07:26:37 +0000 (23:26 -0800)]
clk: divider: Add hw based registration APIs

Add registration APIs in the clk divider code to return struct
clk_hw pointers instead of struct clk pointers. This way we hide
the struct clk pointer from providers unless they need to use
consumer facing APIs.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclkdev: Add clk_hw based registration APIs
Stephen Boyd [Mon, 8 Feb 2016 22:59:49 +0000 (14:59 -0800)]
clkdev: Add clk_hw based registration APIs

Now that we have a clk registration API that doesn't return
struct clks, we need to have some way to hand out struct clks via
the clk_get() APIs that doesn't involve associating struct clk
pointers with a struct clk_lookup. Luckily, clkdev already
operates on struct clk_hw pointers, except for the registration
facing APIs where it converts struct clk pointers into struct
clk_hw pointers almost immediately.

Let's add clk_hw based registration APIs so that we can skip the
conversion step and provide a way for clk provider drivers to
operate exclusively on clk_hw structs. This way we clearly
split the API between consumers and providers.

Cc: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: Add clk_hw OF clk providers
Stephen Boyd [Sat, 6 Feb 2016 01:38:26 +0000 (17:38 -0800)]
clk: Add clk_hw OF clk providers

Now that we have a clk registration API that doesn't return
struct clks, we need to have some way to hand out struct clks via
the clk_get() APIs that doesn't involve associating struct clk
pointers with an OF node. Currently we ask the OF provider to
give us a struct clk pointer for some clkspec, turn that struct
clk into a struct clk_hw and then allocate a new struct clk to
return to the caller.

Let's add a clk_hw based OF provider hook that returns a struct
clk_hw directly, so that we skip the intermediate step of
converting from struct clk to struct clk_hw. Eventually when
we've converted all OF clk providers to struct clk_hw based APIs
we can remove the struct clk based ones.

It should also be noted that we change the onecell provider to
have a flex array instead of a pointer for the array of clk_hw
pointers. This allows providers to allocate one structure of the
correct length in one step instead of two.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: Add {devm_}clk_hw_{register,unregister}() APIs
Stephen Boyd [Sat, 6 Feb 2016 01:02:52 +0000 (17:02 -0800)]
clk: Add {devm_}clk_hw_{register,unregister}() APIs

We've largely split the clk consumer and provider APIs along
struct clk and struct clk_hw, but clk_register() still returns a
struct clk pointer for each struct clk_hw that's registered.
Eventually we'd like to only allocate struct clks when there's a
user, because struct clk is per-user now, so clk_register() needs
to change.

Let's add new APIs to register struct clk_hws, but this time
we'll hide the struct clk from the caller by returning an int
error code. Also add an unregistration API that takes the clk_hw
structure that was passed to the registration API. This way
provider drivers never have to deal with a struct clk pointer
unless they're using the clk consumer APIs.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclkdev: Remove clk_register_clkdevs()
Stephen Boyd [Sat, 6 Feb 2016 00:40:47 +0000 (16:40 -0800)]
clkdev: Remove clk_register_clkdevs()

Now that we've converted the only caller over to another clkdev
API, remove this one.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: rockchip: drop unnecessary header comment
Heiko Stuebner [Tue, 19 Apr 2016 19:17:55 +0000 (21:17 +0200)]
clk: rockchip: drop unnecessary header comment

The internal clk header did contain a comment indicating that some of the
defined registers were shared over multiple clock controller variants.
In recent times, it was simply extended all the time and stopped providing
any meaningful information, so drop it and it's overlong line.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
8 years agoclk: rockchip: reign in some overly long lines in the rk3399 controller
Heiko Stuebner [Tue, 19 Apr 2016 19:07:01 +0000 (21:07 +0200)]
clk: rockchip: reign in some overly long lines in the rk3399 controller

We allow overlong lines in the array portitions describing the clock
trees to ease readability by having each element always at the same
position. But the rest of the code should honor the 80 char limit.

Fix the newly added rk3399 clock code to respect that.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
8 years agoARM: dts: imx35: restore existing used clock enumeration
Alexander Kurz [Thu, 14 Apr 2016 21:30:49 +0000 (23:30 +0200)]
ARM: dts: imx35: restore existing used clock enumeration

A new element got inserted into enum mx35_clks with commit 3713e3f5e927
("clk: imx35: define two clocks for rtc"). This insertion shifted most
nummerical clock assignments to a new nummerical value which in turn
rendered most hardcoded nummeric values in imx35.dtsi incorrect.

Restore the existing order by moving the newly introduced clock to the
end of the enum. Update the dts documentation accordingly.

Signed-off-by: Alexander Kurz <akurz@blala.de>
Fixes: 3713e3f5e927 ("clk: imx35: define two clocks for rtc")
Cc: <stable@vger.kernel.org>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
8 years agoMerge branch 'v4.7-shared/clkids' into v4.7-clk/next
Heiko Stuebner [Sat, 16 Apr 2016 01:04:15 +0000 (03:04 +0200)]
Merge branch 'v4.7-shared/clkids' into v4.7-clk/next