GitHub/moto-9609/android_kernel_motorola_exynos9610.git
7 years agoclk: renesas: mstp: ensure register writes complete
Chris Brandt [Tue, 14 Feb 2017 16:08:05 +0000 (11:08 -0500)]
clk: renesas: mstp: ensure register writes complete

When there is no status bit, it is possible for the clock enable/disable
operation to have not completed by the time the driver code resumes
execution. This is due to the fact that write operations are sometimes
queued and delayed internally. Doing a read ensures the write operations
has completed.

Fixes: b6face404f38 ("ARM: shmobile: r7s72100: add essential clock nodes to dtsi")
Signed-off-by: Chris Brandt <chris.brandt@renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: qcom: Do not drop device node twice
Guenter Roeck [Sat, 11 Feb 2017 23:04:56 +0000 (15:04 -0800)]
clk: qcom: Do not drop device node twice

of_find_node_by_name() drops the reference to a passed device node.
It is not necessary to drop it again, and doing so may result in the
device node being released prematurely.

Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Fixes: ee15faffef11 ("clk: qcom: common: Add API to register board clocks backwards compatibly")
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: mvebu: adjust clock handling for the CP110 system controller
Thomas Petazzoni [Wed, 21 Dec 2016 10:26:56 +0000 (11:26 +0100)]
clk: mvebu: adjust clock handling for the CP110 system controller

This commit:

 - makes the GOP_DP (bit 9) gatable clock a child clock of the
   SD_MMC_GOP (bit 18) clock, as it should have been. The clock for bit
   18 was just named SD_MMC, but since it also covers the GOP block, it
   is renamed SD_MMC_GOP.

 - makes the MG (bit 5) gatable clock a child clock of the MG_CORE
   clock (bit 6)

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: mvebu: Expand mv98dx3236-core-clock support
Chris Packham [Tue, 7 Feb 2017 20:28:15 +0000 (09:28 +1300)]
clk: mvebu: Expand mv98dx3236-core-clock support

The initial implementation in commit e120c17a70e5 ("clk: mvebu: support
for 98DX3236 SoC") hardcoded a fixed value for the main PLL frequency.
Port code from the Marvell supplied Linux kernel to support different
PLL frequencies and provide clock gating support.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: zte: add i2s clocks for zx296718
Baoyou Xie [Thu, 9 Feb 2017 03:12:56 +0000 (11:12 +0800)]
clk: zte: add i2s clocks for zx296718

The i2s related clock support is missing from the existing zx296718
clock driver. This patch adds it, so that the upstream ZX I2S driver
can work out.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Acked-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: sunxi-ng: sun9i-a80: Fix wrong pointer passed to PTR_ERR()
Wei Yongjun [Mon, 6 Feb 2017 16:09:26 +0000 (16:09 +0000)]
clk: sunxi-ng: sun9i-a80: Fix wrong pointer passed to PTR_ERR()

PTR_ERR should access the value just tested by IS_ERR, otherwise
the wrong error code will be returned.

Fixes: 783ab76ae553 ("clk: sunxi-ng: Add A80 Display Engine CCU")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: sunxi-ng: select SUNXI_CCU_MULT for sun5i
Arnd Bergmann [Thu, 2 Feb 2017 14:33:57 +0000 (15:33 +0100)]
clk: sunxi-ng: select SUNXI_CCU_MULT for sun5i

We get a link error when CCU_MULT is not set with the
newly added driver:

drivers/clk/sunxi-ng/ccu-sun5i.o:(.data.__compound_literal.17+0x4): undefined reference to `ccu_mult_ops'
drivers/clk/sunxi-ng/ccu-sun5i.o:(.data.__compound_literal.5+0x4): undefined reference to `ccu_mult_ops'

Fixes: 5e73761786d6 ("clk: sunxi-ng: Add sun5i CCU driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: sunxi-ng: Check kzalloc() for errors and cleanup error path
Stephen Boyd [Fri, 3 Feb 2017 20:43:11 +0000 (12:43 -0800)]
clk: sunxi-ng: Check kzalloc() for errors and cleanup error path

This kzalloc() could fail. Let's bail out with -ENOMEM here
instead of NULL dereferencing. That silences static checkers. We
should also cleanup on the error path even though this function
returning an error probably means the system won't boot.

Cc: Chen-Yu Tsai <wens@csie.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: tegra: Add BPMP clock driver
Thierry Reding [Thu, 17 Nov 2016 15:47:31 +0000 (16:47 +0100)]
clk: tegra: Add BPMP clock driver

This driver uses the services provided by the BPMP firmware driver to
implement a clock driver based on the MRQ_CLK request. This part of the
BPMP ABI provides a means to enumerate and control clocks and should
allow the driver to work on any chip that supports this ABI.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoMerge tag 'v4.11-rockchip-clk2' of git://git.kernel.org/pub/scm/linux/kernel/git...
Stephen Boyd [Fri, 3 Feb 2017 20:07:35 +0000 (12:07 -0800)]
Merge tag 'v4.11-rockchip-clk2' of git://git./linux/kernel/git/mmind/linux-rockchip into clk-next

Pull Rockchip clk updates from Heiko Stuebner:

  "Non-critical fix for the pclk_edp divider on rk3399, one new
  clock-id and making niu (interconnect) clocks critical on
  rk3288, as CLK_IGNORE_UNUSED is not enough to keep them running
  all the time when more users access particular clock subtrees."

* tag 'v4.11-rockchip-clk2' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip:
  clk: rockchip: rk3288: make all niu clocks critical
  clk: rockchip: use rk3288 vip_out clock ids
  clk: rockchip: add rk3288 vip_out clock id
  clk: rockchip: fix the incorrect pclk_edp div width for RK3399

7 years agoclk: uniphier: add eMMC clock for LD11 and LD20 SoCs
Masahiro Yamada [Sat, 28 Jan 2017 13:27:01 +0000 (22:27 +0900)]
clk: uniphier: add eMMC clock for LD11 and LD20 SoCs

Add clock for the Cadence eMMC controller on LD11/LD20.
For the other SoCs, the clock for the eMMC controller is included
in the MIO/SD control block.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: uniphier: add NAND clock for all UniPhier SoCs
Masahiro Yamada [Sat, 28 Jan 2017 13:27:00 +0000 (22:27 +0900)]
clk: uniphier: add NAND clock for all UniPhier SoCs

Add clock line for the Denali NAND controller.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoMerge tag 'sunxi-clk-for-4.11' of https://git.kernel.org/pub/scm/linux/kernel/git...
Stephen Boyd [Fri, 3 Feb 2017 19:47:47 +0000 (11:47 -0800)]
Merge tag 'sunxi-clk-for-4.11' of https://git./linux/kernel/git/mripard/linux into clk-next

Pull Allwinner clock updates from Maxime Ripard:

  - Support for one new SoC, the V3s
  - Conversion of two old SoCs to the new framework, the old sun5i family
    and the A80
  - A bunch of fixes

* tag 'sunxi-clk-for-4.11' of https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux: (25 commits)
  ARM: dts: sun9i: Switch to new clock bindings
  clk: sunxi-ng: Add A80 Display Engine CCU
  clk: sunxi-ng: Add A80 USB CCU
  clk: sunxi-ng: Add A80 CCU
  clk: sunxi-ng: Support separately grouped PLL lock status register
  clk: sunxi-ng: mux: Get closest parent rate possible with CLK_SET_RATE_PARENT
  clk: sunxi-ng: mux: honor CLK_SET_RATE_NO_REPARENT flag
  clk: sunxi-ng: mux: Fix determine_rate for mux clocks with pre-dividers
  clk: sunxi-ng: a33: Set CLK_SET_RATE_PARENT for the GPU
  clk: sunxi-ng: Call divider_round_rate if we only have a single parent
  ARM: gr8: Convert to CCU
  ARM: sun5i: Convert to CCU
  clk: sunxi-ng: Add sun5i CCU driver
  clk: sunxi-ng: Implement global pre-divider
  clk: sunxi-ng: Implement multiplier maximum
  clk: sunxi-ng: mult: Fix minimum in round rate
  clk: sunxi-ng: Implement factors offsets
  clk: sunxi-ng: multiplier: Add fractional support
  clk: sunxi-ng: add support for V3s CCU
  dt-bindings: add device binding for the CCU of Allwinner V3s
  ...

7 years agoARM: dts: sun9i: Switch to new clock bindings
Chen-Yu Tsai [Sat, 28 Jan 2017 12:22:39 +0000 (20:22 +0800)]
ARM: dts: sun9i: Switch to new clock bindings

Now that we have a full clock driver for sun9i, switch to it.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
7 years agoclk: sunxi-ng: Add A80 Display Engine CCU
Chen-Yu Tsai [Sat, 28 Jan 2017 12:22:36 +0000 (20:22 +0800)]
clk: sunxi-ng: Add A80 Display Engine CCU

With the A80 SoC, Allwinner grouped and moved some subsystem specific
clock controls to a separate address space, and possibly separate
hardware block.

One such subsystem is the display engine. The main clock control unit
now only has 1 set of bus gate, dram gate, module clock, and reset
control for the entire display subsystem. These feed into a secondary
clock control unit, which has controls for each individual module
of the display pipeline. This block is not documented in the user
manual. Allwinner's kernel was used as the reference.

Add support for the display engine clock controls found on the A80.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
7 years agoclk: sunxi-ng: Add A80 USB CCU
Chen-Yu Tsai [Sat, 28 Jan 2017 12:22:35 +0000 (20:22 +0800)]
clk: sunxi-ng: Add A80 USB CCU

Add support for the USB clock controls found on the A80.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
7 years agoclk: sunxi-ng: Add A80 CCU
Chen-Yu Tsai [Sat, 28 Jan 2017 12:22:34 +0000 (20:22 +0800)]
clk: sunxi-ng: Add A80 CCU

Add support for the main clock unit found in the A80. Some clocks were
not documented in the released user manual, but were found in the
official kernel from Allwinner. These include controls for the I2S,
SPDIF, SATA, and eDP blocks.

Note that on the A80, some subsystems have separate clock controllers
downstream of the main clock unit. These include the MMC, USB, and
display engine subsystems.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
7 years agoclk: sunxi-ng: Support separately grouped PLL lock status register
Chen-Yu Tsai [Sat, 28 Jan 2017 12:22:33 +0000 (20:22 +0800)]
clk: sunxi-ng: Support separately grouped PLL lock status register

On the Allwinner A80 SoC, the PLL lock status indicators are grouped
together in a separate register, as opposed to being scattered in each
PLL's configuration register.

Add a flag to support this.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
7 years agoclk: sunxi-ng: mux: Get closest parent rate possible with CLK_SET_RATE_PARENT
Chen-Yu Tsai [Sat, 28 Jan 2017 12:22:32 +0000 (20:22 +0800)]
clk: sunxi-ng: mux: Get closest parent rate possible with CLK_SET_RATE_PARENT

If the CLK_SET_RATE_PARENT flag is set, we want to try getting the
closest parent rate.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
7 years agoclk: sunxi-ng: mux: honor CLK_SET_RATE_NO_REPARENT flag
Chen-Yu Tsai [Sat, 28 Jan 2017 12:22:31 +0000 (20:22 +0800)]
clk: sunxi-ng: mux: honor CLK_SET_RATE_NO_REPARENT flag

This patch adds support for the CLK_SET_RATE_NO_REPARENT flag to the
mux determine_rate helper, based on examples from clk-composite and
clk-mux.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
7 years agoclk: sunxi-ng: mux: Fix determine_rate for mux clocks with pre-dividers
Chen-Yu Tsai [Sat, 28 Jan 2017 12:22:30 +0000 (20:22 +0800)]
clk: sunxi-ng: mux: Fix determine_rate for mux clocks with pre-dividers

The determine_rate helper used ccu_mux_helper_adjust_parent_for_prediv()
to adjust the parent_rate to account for pre-dividers, but then passed
the pristine parent clock rate from clk_hw_get_rate() to the round()
callback, thereby ignoring the pre-divider adjustment. In addition,
it was saving the adjusted parent rate back into struct
clk_rate_request.

This patch fixes this by saving the pristine parent clock rate, and
adding a copy that is adjusted and passed to the round() callback.
The pristine copy, if it is the best solution, would be saved back
to struct clk_rate_request.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
7 years agoclk: qcom: SDHCI enablement on Nexus 5X / 6P
Jeremy McNicoll [Fri, 27 Jan 2017 09:10:00 +0000 (01:10 -0800)]
clk: qcom: SDHCI enablement on Nexus 5X / 6P

Add missing clock branch to enable onboard storage
for msm899(2/4).

Signed-off-by: Jeremy McNicoll <jeremymc@redhat.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agodt-bindings: qcom: clk: Add missing binding for SDCHI enablement on Nexus 5X/6P
Jeremy McNicoll [Fri, 27 Jan 2017 09:10:01 +0000 (01:10 -0800)]
dt-bindings: qcom: clk: Add missing binding for SDCHI enablement on Nexus 5X/6P

AHB clock branch is needed in order to enable SDHCI
on msm899(2/4).

Signed-off-by: Jeremy McNicoll <jeremymc@redhat.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoMerge tag 'clk-v4.11-samsung-2' of git://linuxtv.org/snawrocki/samsung into clk-next
Stephen Boyd [Fri, 27 Jan 2017 19:53:06 +0000 (11:53 -0800)]
Merge tag 'clk-v4.11-samsung-2' of git://linuxtv.org/snawrocki/samsung into clk-next

Pull Samsung clk driver updates from Sylwester Nawrocki:

 - Exporting clock IDs for Exynos5433 SoC MIPI DSI DPHY
 - Exynos PLL code updates and overall minor clean-ups

* tag 'clk-v4.11-samsung-2' of git://linuxtv.org/snawrocki/samsung:
  clk: samsung: mark s3c...._clk_sleep_init() as __init
  clk: samsung: Add enable/disable support for PLL35XX clocks
  clk: samsung: exynos5433: Correct typos in SoC name
  clk: samsung: exynos5433: Add data for 250MHz and 278MHz PLL rates
  clk: samsung: exynos5433: Add IDs for PHYCLK_MIPIDPHY0_* clocks

7 years agoMerge tag 'clk-renesas-for-v4.11-tag2' of git://git.kernel.org/pub/scm/linux/kernel...
Stephen Boyd [Fri, 27 Jan 2017 19:51:37 +0000 (11:51 -0800)]
Merge tag 'clk-renesas-for-v4.11-tag2' of git://git./linux/kernel/git/geert/renesas-drivers into clk-next

Pull Renesas clk driver updates from Geert Uytterhoeven:

  - Use CLK_IS_CRITICAL to handle critical clocks,
  - Add Reset Control Support for R-Car Gen2 and Gen3, and RZ/G1,
  - Add IIC-DVFS clocks for R-Car H3 and M3-W,
  - Minor cleanups.

* tag 'clk-renesas-for-v4.11-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers:
  clk: renesas: r8a7796: Add IIC-DVFS clock
  clk: renesas: r8a7795: Add IIC-DVFS clock
  clk: renesas: cpg-mssr: Add support for reset control
  clk: renesas: cpg-mssr: Rename cpg_mssr_priv.mstp_lock
  clk: renesas: cpg-mssr: Document suitability for RZ/G1
  dt-bindings: clock: renesas: cpg-mssr: Document reset control support
  clk: renesas: mstp: Reformat cpg_mstp_clock_register() for git diff
  clk: renesas: mstp: Make INTC-SYS a critical clock
  clk: renesas: cpg-mssr: Migrate to CLK_IS_CRITICAL

7 years agoclk: mvebu: support for 98DX3236 SoC
Chris Packham [Fri, 27 Jan 2017 03:25:42 +0000 (16:25 +1300)]
clk: mvebu: support for 98DX3236 SoC

The 98DX3236, 98DX3336, 98DX4521 and variants have a different TCLK from
the Armada XP (200MHz vs 250MHz). The CPU core clock is fixed at 800MHz.

The clock gating options are a subset of those on the Armada XP.

The core clock divider is different to the Armada XP also.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: samsung: mark s3c...._clk_sleep_init() as __init
Martin Kaiser [Wed, 25 Jan 2017 21:42:25 +0000 (22:42 +0100)]
clk: samsung: mark s3c...._clk_sleep_init() as __init

These functions are referencing s3c...._clk_regs[], which are marked as
__initdata. When compiling with CONFIG_DEBUG_SECTION_MISMATCH=y, this
produces warnings like

WARNING: vmlinux.o(.text+0x198350):
Section mismatch in reference from the function s3c2410_clk_sleep_init()
to the (unknown reference) .init.data:(unknown)

Mark the s3c...._clk_sleep_init() functions as __init in
order to fix this.

Fixes: ca2e90ac1809 ("clk: samsung: add clock controller driver for s3c2412")
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
7 years agoclk: samsung: Add enable/disable support for PLL35XX clocks
Marek Szyprowski [Wed, 25 Jan 2017 11:52:32 +0000 (12:52 +0100)]
clk: samsung: Add enable/disable support for PLL35XX clocks

Some PLLs might be disabled by default after turning off and then on
a power domain which they belongs to.  To avoid configuring a disabled
PLL, add proper code for handling PLL enable/disable.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
7 years agoclk: samsung: exynos5433: Correct typos in SoC name
Marek Szyprowski [Thu, 26 Jan 2017 12:43:42 +0000 (13:43 +0100)]
clk: samsung: exynos5433: Correct typos in SoC name

This patch fixes simple typos in Exynos5433 clocks driver. The SoC name
was referred a few times as '5443' instead of '5433'.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
7 years agoclk: samsung: exynos5433: Add data for 250MHz and 278MHz PLL rates
Marek Szyprowski [Thu, 26 Jan 2017 12:37:53 +0000 (13:37 +0100)]
clk: samsung: exynos5433: Add data for 250MHz and 278MHz PLL rates

Default clock configuration applied by the bootloader for TM2 and TM2e
boards includes 250MHz and 278MHz rate for DISP PLL clock. To ensure
such configuration for those boards with 'assigned-clock-*' properties,
parameters for those two additional rates are needed.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
7 years agoclk: samsung: exynos5433: Add IDs for PHYCLK_MIPIDPHY0_* clocks
Marek Szyprowski [Thu, 26 Jan 2017 12:37:52 +0000 (13:37 +0100)]
clk: samsung: exynos5433: Add IDs for PHYCLK_MIPIDPHY0_* clocks

Add missing identifiers for phyclk_mipidphy0_bitclkdiv8_phy and
phyclk_mipidphy0_rxclkesc0_phy clocks. Access to those clocks is needed
to setup initial clock configuration for display subsystem in device tree
in order to avoid dependency on the configuration left by the bootloader.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
7 years agoclk: sunxi-ng: a33: Set CLK_SET_RATE_PARENT for the GPU
Maxime Ripard [Tue, 24 Jan 2017 09:41:19 +0000 (10:41 +0100)]
clk: sunxi-ng: a33: Set CLK_SET_RATE_PARENT for the GPU

In order to achieve all the rates asked by the GPU, we might need to change
the parent frequency.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Acked-by: Chen-Yu Tsai <wens@csie.org>
7 years agoclk: sunxi-ng: Call divider_round_rate if we only have a single parent
Maxime Ripard [Tue, 24 Jan 2017 09:41:18 +0000 (10:41 +0100)]
clk: sunxi-ng: Call divider_round_rate if we only have a single parent

The divider_get_val function that is used in our determine_rate callback
doesn't try to change the parent rate at all, while clk_divider_bestdiv,
used in divider_round_rate, does.

If we have a single parent, call divider_round_rate.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Acked-by: Chen-Yu Tsai <wens@csie.org>
7 years agoclk: renesas: r8a7796: Add IIC-DVFS clock
Khiem Nguyen [Mon, 4 Apr 2016 02:01:19 +0000 (09:01 +0700)]
clk: renesas: r8a7796: Add IIC-DVFS clock

This patch adds DVFS clock for R8A7796 SoC.

Signed-off-by: Khiem Nguyen <khiem.nguyen.xt@renesas.com>
Signed-off-by: Dien Pham <dien.pham.ry@rvc.renesas.com>
Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
7 years agoclk: renesas: r8a7795: Add IIC-DVFS clock
Keita Kobayashi [Mon, 23 May 2016 02:05:42 +0000 (11:05 +0900)]
clk: renesas: r8a7795: Add IIC-DVFS clock

This patch adds DVFS clock for R8A7795 SoC.

Signed-off-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Gaku Inami <gaku.inami.xw@bp.renesas.com>
Signed-off-by: Dien Pham <dien.pham.ry@rvc.renesas.com>
Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
7 years agoclk: renesas: cpg-mssr: Add support for reset control
Geert Uytterhoeven [Fri, 20 Jan 2017 10:03:03 +0000 (11:03 +0100)]
clk: renesas: cpg-mssr: Add support for reset control

Add optional support for the Reset Control feature of the Renesas Clock
Pulse Generator / Module Standby and Software Reset module on R-Car
Gen2, R-Car Gen3, and RZ/G1 SoCs.

This allows to reset SoC devices using the Reset Controller API.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
7 years agoclk: renesas: cpg-mssr: Rename cpg_mssr_priv.mstp_lock
Geert Uytterhoeven [Fri, 20 Jan 2017 09:58:11 +0000 (10:58 +0100)]
clk: renesas: cpg-mssr: Rename cpg_mssr_priv.mstp_lock

The spinlock is used to protect Read-Modify-Write register accesses,
which won't be limited to SMSTPCR register accesses.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: renesas: cpg-mssr: Document suitability for RZ/G1
Geert Uytterhoeven [Fri, 20 Jan 2017 09:53:11 +0000 (10:53 +0100)]
clk: renesas: cpg-mssr: Document suitability for RZ/G1

The Renesas CPG/MSSR driver is already in active use for RZ/G1 since
commits c0b2d75d2a4bf6a3 ("clk: renesas: cpg-mssr: Add R8A7743 support")
and 9127d54bb8947159 ("clk: renesas: cpg-mssr: Add R8A7745 support").

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agodt-bindings: clock: renesas: cpg-mssr: Document reset control support
Geert Uytterhoeven [Mon, 12 Oct 2015 09:35:34 +0000 (11:35 +0200)]
dt-bindings: clock: renesas: cpg-mssr: Document reset control support

Document properties needed to use the Reset Control feature of the
Renesas Clock Pulse Generator / Module Standby and Software Reset
module.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
7 years agoclk: renesas: mstp: Reformat cpg_mstp_clock_register() for git diff
Geert Uytterhoeven [Mon, 23 Jan 2017 09:48:21 +0000 (10:48 +0100)]
clk: renesas: mstp: Reformat cpg_mstp_clock_register() for git diff

As the function header of cpg_mstp_clock_register() is split in an
unusual way, "git diff" gets confused when changes to the body of
the function are made, and attributes them to the wrong function.

Reformat the function header to fix this.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoplatform/x86: fix typo in comment
Pierre-Louis Bossart [Mon, 23 Jan 2017 18:07:45 +0000 (12:07 -0600)]
platform/x86: fix typo in comment

s/Acumulate/Accumulate/

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoplatform/x86: Enable Atom PMC platform clocks
Irina Tirdea [Mon, 23 Jan 2017 18:07:44 +0000 (12:07 -0600)]
platform/x86: Enable Atom PMC platform clocks

The BayTrail and CherryTrail platforms provide platform clocks
through their Power Management Controller (PMC).

The SoC supports up to 6 clocks (PMC_PLT_CLK[0..5]) with a
frequency of either 19.2 MHz (PLL) or 25 MHz (XTAL) for BayTrail
and a frequency of 19.2 MHz (XTAL) for CherryTrail. These clocks
are available for general system use, where appropriate. For example,
the usage for platform clocks suggested in the datasheet is the
following:
  PLT_CLK[0..2] - Camera
  PLT_CLK[3] - Audio Codec
  PLT_CLK[4] -
  PLT_CLK[5] - COMMs

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoarch/x86/platform/atom: Move pmc_atom to drivers/platform/x86
Irina Tirdea [Mon, 23 Jan 2017 18:07:43 +0000 (12:07 -0600)]
arch/x86/platform/atom: Move pmc_atom to drivers/platform/x86

The pmc_atom driver does not contain any architecture specific
code. It only enables the SoC Power Management Controller driver
for BayTrail and CherryTrail platforms.

Move the pmc_atom driver from arch/x86/platform/atom to
drivers/platform/x86. Also clean-up and reorder include files by
alphabetical order in pmc_atom.h

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: x86: Add Atom PMC platform clocks
Irina Tirdea [Mon, 23 Jan 2017 18:07:42 +0000 (12:07 -0600)]
clk: x86: Add Atom PMC platform clocks

The BayTrail and CherryTrail platforms provide platform clocks
through their Power Management Controller (PMC).

The SoC supports up to 6 clocks (PMC_PLT_CLK[0..5]) with a
frequency of either 19.2 MHz (PLL) or 25 MHz (XTAL) for BayTrail
and a frequency of 19.2 MHz (XTAL) for CherryTrail. These clocks
are available for general system use, where appropriate, and each
have Control & Frequency register fields associated with them.

Port from legacy by Pierre Bossart, integration in clock framework
by Irina Tirdea

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: Make x86/ conditional on CONFIG_COMMON_CLK
Pierre-Louis Bossart [Mon, 23 Jan 2017 18:07:41 +0000 (12:07 -0600)]
clk: Make x86/ conditional on CONFIG_COMMON_CLK

Fix Makefile for x86 support, dependency on CONFIG_COMMON_CLK
was not explicit

Fixes: 701190fd7419 ('clk: x86: add support for Lynxpoint LPSS clocks')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: hisilicon: fix lock assignment
Leo Yan [Sat, 21 Jan 2017 02:26:31 +0000 (10:26 +0800)]
clk: hisilicon: fix lock assignment

In clock driver initialize phase the spinlock is missed to assignment
to struct clkgate_separated, finally there have no locking to protect
exclusive accessing for clock registers.

This bug introduces the console has no output after enable coresight
driver on 96boards Hikey; this is because console using UART3, which
has shared the same register with coresight clock enabling bit. After
applied this patch it can assign lock properly to protect exclusive
accessing, and console can work well after enabled coresight modules.

Fixes: 0aa0c95f743a ("clk: hisilicon: add common clock support")
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoMerge branch 'clk-ux500' into clk-next
Stephen Boyd [Fri, 27 Jan 2017 00:10:57 +0000 (16:10 -0800)]
Merge branch 'clk-ux500' into clk-next

* clk-ux500:
  clk: ux500: Convert ABx500 clocks to use OF probing
  clk: ux500: Add device tree bindings for ABx500 clocks
  clk: ux500: move AB8500 sysclk over to PRCMU clk driver

7 years agoclk: ux500: Convert ABx500 clocks to use OF probing
Linus Walleij [Fri, 13 Jan 2017 15:08:42 +0000 (16:08 +0100)]
clk: ux500: Convert ABx500 clocks to use OF probing

These clocks have been broken for a long time unfortunately, a
hurdle of misc problems made them stop working at some point
breaking USB and audio on Ux500.

The platform as such and all "regular" clocks are migrated to
OF/device tree, so let's migrate also this driver.

With this patch and the corresponding DTS fixes, and a bunch
of probe deferral fixes, audio starts working again on Ux500.

Cc: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: ux500: Add device tree bindings for ABx500 clocks
Linus Walleij [Fri, 20 Jan 2017 13:25:39 +0000 (14:25 +0100)]
clk: ux500: Add device tree bindings for ABx500 clocks

This adds device tree bindings for the ABx500 clocks on the
ST-Ericsson platforms.

Cc: devicetree@vger.kernel.org
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: ux500: move AB8500 sysclk over to PRCMU clk driver
Linus Walleij [Fri, 13 Jan 2017 15:07:47 +0000 (16:07 +0100)]
clk: ux500: move AB8500 sysclk over to PRCMU clk driver

The AB8500 sysclk is just another PRCMU-controlled clock, there
is no reason why it should be in the ABx500-controlled part of
the clock implementation. Doing this and the corresponding device
tree changes makes USB work on the Ux500 again.

Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: mediatek: Fix MT8135 dependencies
Jean Delvare [Tue, 24 Jan 2017 12:09:12 +0000 (13:09 +0100)]
clk: mediatek: Fix MT8135 dependencies

The MT8135 is a 32-bit SoC, so only propose it on ARM architecture,
not ARM64.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Fixes: 234d511d8c15 ("clk: mediatek: Add hardware dependency")
Cc: Andreas Färber <afaerber@suse.de>
Acked-by: James Liao <jamesjj.liao@mediatek.com>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: mediatek: Fix MT2701 dependencies
Jean Delvare [Tue, 24 Jan 2017 12:07:04 +0000 (13:07 +0100)]
clk: mediatek: Fix MT2701 dependencies

If I say "no" to "Clock driver for Mediatek MT2701", I don't want to
be asked individually about each sub-driver. No means no.

Additionally, this driver shouldn't be proposed at all on non-mediatek
builds, unless build-testing.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Fixes: e9862118272a ("clk: mediatek: Add MT2701 clock support")
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: James Liao <jamesjj.liao@mediatek.com>
Cc: Shunli Wang <shunli.wang@mediatek.com>
Cc: Erin Lo <erin.lo@mediatek.com>
Cc: Michael Turquette <mturquette@baylibre.com>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: ti: divider: Add the table parsing to get the best divider value
Keerthy [Fri, 2 Dec 2016 09:05:43 +0000 (14:35 +0530)]
clk: ti: divider: Add the table parsing to get the best divider value

Currently the divider selection logic blindly divides the parent_rate
by the clk rate and gives the divider value for the divider clocks
which do not have the CLK_SET_RATE_PARENT flag set. Add the clk divider
table parsing to get the closest divider available in the table
provided via Device tree.

The code is pretty much taken from: drivers/clk/clk-divider.c.
and used here to fix up the best divider selection logic.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Reported-by: Richard Woodruff <r-woodruff2@ti.com>
Acked-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: qcom: gdsc: Fix handling of hw control enable/disable
Rajendra Nayak [Mon, 23 Jan 2017 04:26:21 +0000 (09:56 +0530)]
clk: qcom: gdsc: Fix handling of hw control enable/disable

Once a gdsc is brought in and out of HW control, there is a
power down and up cycle which can take upto 1us. Polling on
the gdsc status immediately after the hw control enable/disable
can mislead software/firmware to belive the gdsc is already either on
or off, while its yet to complete the power cycle.
To avoid this add a 1us delay post a enable/disable of HW control
mode.

Also after the HW control mode is disabled, poll on the status to
check gdsc status reflects its 'on' before force disabling it
in software.

Reported-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Reviewed-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Tested-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
Fixes: 904bb4f5c7de ("clk: qcom: gdsc: Add support for gdscs with HW control")
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: meson8b: fix clk81 register address
Jerome Brunet [Wed, 25 Jan 2017 10:53:06 +0000 (11:53 +0100)]
clk: meson8b: fix clk81 register address

During meson8b clock probe, clk81 register address is fixed twice.
First using the meson8b_clk_gates array, then by directly changing
meson8b_clk81 register.

As a result meson8b_clk81.reg = HHI_MPEG_CLK_CNTL + clk_base + clk_base.

Fixed by just removing the second fixup.

Fixes: e31a1900c1ff ("meson: clk: Add support for clock gates")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: stm32f7: Introduce stm32f7 clocks for STM32F746 boards
Gabriel Fernandez [Fri, 6 Jan 2017 13:59:23 +0000 (14:59 +0100)]
clk: stm32f7: Introduce stm32f7 clocks for STM32F746 boards

This patch enables clocks for STM32F746 boards.

Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoMerge branch 'clk-stm32f4' into clk-next
Stephen Boyd [Thu, 26 Jan 2017 23:52:55 +0000 (15:52 -0800)]
Merge branch 'clk-stm32f4' into clk-next

* clk-stm32f4:
  clk: stm32f7: Add stm32f7 clock DT bindings for STM32F746 boards

7 years agoclk: uniphier: continue probing even if some clocks fail to register
Masahiro Yamada [Wed, 18 Jan 2017 12:31:19 +0000 (21:31 +0900)]
clk: uniphier: continue probing even if some clocks fail to register

Do not let the entire probe function fail even if some clocks fail
to register.  Let's continue with succeeded clocks.  This will give
the system more chances to boot and allow us to investigate the
cause of the failure.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoMerge branch 'clk-imx7', 'clk-bcm2835' into clk-next
Stephen Boyd [Thu, 26 Jan 2017 23:52:37 +0000 (15:52 -0800)]
Merge branch 'clk-imx7', 'clk-bcm2835' into clk-next

* clk-imx7:
  clk: imx7d: Add the OCOTP clock

* clk-bcm2835:
  clk: bcm2835: Add leaf clock measurement support, disabled by default
  clk: bcm2835: Register the DSI0/DSI1 pixel clocks.
  clk: bcm2835: Don't rate change PLLs on behalf of DSI PLL dividers.

7 years agoARM: gr8: Convert to CCU
Maxime Ripard [Sun, 16 Oct 2016 16:54:26 +0000 (18:54 +0200)]
ARM: gr8: Convert to CCU

Now that we have a driver for the GR8, we can convert our DT to it.

Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
7 years agoARM: sun5i: Convert to CCU
Maxime Ripard [Sat, 15 Oct 2016 20:36:19 +0000 (22:36 +0200)]
ARM: sun5i: Convert to CCU

Now that we have drivers for all of them, convert all the SoCs that share
the sun5i DTSI to the new CCU driver.

Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
7 years agoclk: sunxi-ng: Add sun5i CCU driver
Maxime Ripard [Tue, 4 Oct 2016 08:09:58 +0000 (10:09 +0200)]
clk: sunxi-ng: Add sun5i CCU driver

The Allwinner A10s, A13, R8 and NextThing GR8 are all based on the same
silicon, and all share the same clocks.

However, they're not packaged in the same way, and therefore not all the
controllers are actually available on all these SoCs.

Introduce a clock controller driver for all these SoCs with different
compatibles to take that into account.

Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
7 years agoclk: sunxi-ng: Implement global pre-divider
Maxime Ripard [Thu, 19 Jan 2017 21:49:26 +0000 (22:49 +0100)]
clk: sunxi-ng: Implement global pre-divider

Some clocks have a global pre-divider that applies to all their parents.

Since it might also apply to clocks that have a single parent, this is
merged in the ccu_common structure, unlike the other pre-divider settings
that are tied to a specific index, and thus a specific parent.

Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
7 years agoclk: sunxi-ng: Implement multiplier maximum
Maxime Ripard [Fri, 14 Oct 2016 10:08:19 +0000 (12:08 +0200)]
clk: sunxi-ng: Implement multiplier maximum

Some multipliers have a maximum rate that is lower than what the register
width allows to. Add a field in the multiplier structure to allow CCU
driver to set that maximum.

Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
7 years agoclk: sunxi-ng: mult: Fix minimum in round rate
Maxime Ripard [Sat, 21 Jan 2017 22:41:56 +0000 (23:41 +0100)]
clk: sunxi-ng: mult: Fix minimum in round rate

The previous code was always taking 1 as the minimum in it's round_rate
function, ignoring entirely what was set as minimum in the clock
definition.

Make sure that's not the case anymore.

Fixes: 2beaa601c849 ("clk: sunxi-ng: Implement minimum for multipliers")
Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
7 years agoclk: sunxi-ng: Implement factors offsets
Maxime Ripard [Tue, 8 Nov 2016 17:12:34 +0000 (18:12 +0100)]
clk: sunxi-ng: Implement factors offsets

The factors we've seen so far all had an offset of one. However, on the
earlier Allwinner SoCs, some factors could have no offset at all, meaning
that the value computed to reach the rate we want to use was the one we had
to program in the registers.

Implement an additional field for the factors that can have such an offset
(linears, not based on a power of two) to specify that offset.

This offset is not linked to the extremums that can be specified in those
structures too. The minimum and maximum are representing the range of
values we can use to try to compute the best rate. The offset comes later
on when we want to set the best value in the registers.

Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
7 years agoclk: sunxi-ng: multiplier: Add fractional support
Maxime Ripard [Thu, 13 Oct 2016 10:44:55 +0000 (12:44 +0200)]
clk: sunxi-ng: multiplier: Add fractional support

Some clocks on the earlier SoCs such as the video PLLs are multipliers with
fractional settings.

Support those cases.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
7 years agoclk: renesas: mstp: Make INTC-SYS a critical clock
Geert Uytterhoeven [Tue, 17 Mar 2015 16:20:52 +0000 (17:20 +0100)]
clk: renesas: mstp: Make INTC-SYS a critical clock

INTC-SYS is the module clock for the GIC.  Accessing the GIC while it is
disabled causes:

    Unhandled fault: asynchronous external abort (0x1211) at 0x00000000

Currently, the GIC-400 driver cannot enable its module clock for several
reasons:
  - It does not use a platform device, so Runtime PM is not an option,
  - gic_of_init() runs before any clocks are registered, so it cannot
    enable the clock explicitly,
  - gic_of_init() cannot return -EPROBE_DEFER, as IRQCHIP_DECLARE()
    doesn't support deferred probing.

Hence we have to keep on relying on the boot loader for enabling the
module clock.

To prevent the module clock from being disabled when the CCF core thinks
it is unused, and thus causing a system lock-up, add a check to the MSTP
clock driver and enable CLK_IS_CRITICAL. This will make sure the module
clock is never disabled.

This is a hard dependency for describing the INTC-SYS clock in DT on
R-Mobile APE6 and R-Car Gen2.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: renesas: cpg-mssr: Migrate to CLK_IS_CRITICAL
Geert Uytterhoeven [Mon, 16 Jan 2017 15:15:50 +0000 (16:15 +0100)]
clk: renesas: cpg-mssr: Migrate to CLK_IS_CRITICAL

When the Renesas CPG/MSSR driver was introduced, it was anticipated that
critical clocks would be handled through a new CLK_ENABLE_HAND_OFF flag
soon.  However, CLK_ENABLE_HAND_OFF never made it upstream.

Instead, commit 32b9b10961860860 ("clk: Allow clocks to be marked as
CRITICAL") introduced CLK_IS_CRITICAL, a flag with slightly differing
semantics.  Still, it can be used to prevent e.g. the GIC module clock
from being turned off, until the GIC-400 driver has full support for
Runtime PM.

Hence migrate the Renesas CPG/MSSR driver from CLK_ENABLE_HAND_OFF to
CLK_IS_CRITICAL.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: rockchip: rk3288: make all niu clocks critical
Jacob Chen [Wed, 18 Jan 2017 05:42:40 +0000 (13:42 +0800)]
clk: rockchip: rk3288: make all niu clocks critical

NIU clocks are related to the interconnect and it's important to other blocks.
Since we don't have a driver to handle it, we should always enable it to avoid
casually close.

Make all of them critical,so that we don't have to each clock on its own
once things break.

Signed-off-by: Jacob Chen <jacob-chen@iotwrt.com>
[dropped the matching CLK_IGNORE_UNUSED flags]
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
7 years agoclk: rockchip: use rk3288 vip_out clock ids
Jacob Chen [Wed, 18 Jan 2017 05:42:39 +0000 (13:42 +0800)]
clk: rockchip: use rk3288 vip_out clock ids

Reference the newly added vip clock-ids in the clock-tree.

Signed-off-by: Jacob Chen <jacob-chen@iotwrt.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
7 years agoMerge branch 'v4.11-shared/clkids' into v4.11-clk/next
Heiko Stuebner [Sun, 22 Jan 2017 16:07:37 +0000 (17:07 +0100)]
Merge branch 'v4.11-shared/clkids' into v4.11-clk/next

7 years agoclk: rockchip: add rk3288 vip_out clock id
Jacob Chen [Wed, 18 Jan 2017 05:42:38 +0000 (13:42 +0800)]
clk: rockchip: add rk3288 vip_out clock id

Add clock-ids for the vip block of the rk3288

Signed-off-by: Jacob Chen <jacob-chen@iotwrt.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
7 years agoclk: stm32f7: Add stm32f7 clock DT bindings for STM32F746 boards
Gabriel Fernandez [Fri, 6 Jan 2017 13:59:22 +0000 (14:59 +0100)]
clk: stm32f7: Add stm32f7 clock DT bindings for STM32F746 boards

This patch introduces the stm32f7 clock DT bindings.

Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: imx7d: Add the OCOTP clock
Fabio Estevam [Wed, 18 Jan 2017 17:53:56 +0000 (15:53 -0200)]
clk: imx7d: Add the OCOTP clock

Add the OCOTP so that this hardware block can be used.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: bcm2835: Add leaf clock measurement support, disabled by default
Eric Anholt [Tue, 17 Jan 2017 20:31:57 +0000 (07:31 +1100)]
clk: bcm2835: Add leaf clock measurement support, disabled by default

This proved incredibly useful during debugging of the DSI driver, to
see if our clocks were running at rate we requested.  Let's leave it
here for the next person interacting with clocks on the platform (and
so that hopefully we can just hook it up to debugfs some day).

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: bcm2835: Register the DSI0/DSI1 pixel clocks.
Eric Anholt [Tue, 17 Jan 2017 20:31:56 +0000 (07:31 +1100)]
clk: bcm2835: Register the DSI0/DSI1 pixel clocks.

The DSI pixel clocks are muxed from clocks generated in the analog phy
by the DSI driver.  In order to set them as parents, we need to do the
same name lookup dance on them as we do for our root oscillator.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: bcm2835: Don't rate change PLLs on behalf of DSI PLL dividers.
Eric Anholt [Tue, 17 Jan 2017 20:31:55 +0000 (07:31 +1100)]
clk: bcm2835: Don't rate change PLLs on behalf of DSI PLL dividers.

Our core PLLs are intended to be configured once and left alone.  With
the SET_RATE_PARENT, asking to set the PLLD_DSI1 clock rate would
change PLLD just to get closer to the requested DSI clock, thus
changing PLLD_PER, the UART and ethernet PHY clock rates downstream of
it, and breaking ethernet.

We *do* want PLLH to change so that PLLH_AUX can be exactly the value
we want, though.  Thus, we need to have a per-divider policy of
whether to pass rate changes up.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: cs2000: add Suspend/Resume feature
Khiem Nguyen [Tue, 10 Jan 2017 06:50:58 +0000 (06:50 +0000)]
clk: cs2000: add Suspend/Resume feature

CS2000 needs re-setup when redume, otherwise, it can't
handle correct clock rate.

Signed-off-by: Khiem Nguyen <khiem.nguyen.xt@rvc.renesas.com>
[Kuninori: cleanup original patch]
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: vc5: Add support for IDT VersaClock 5P49V5923 and 5P49V5933
Marek Vasut [Thu, 12 Jan 2017 01:03:24 +0000 (02:03 +0100)]
clk: vc5: Add support for IDT VersaClock 5P49V5923 and 5P49V5933

Add driver for IDT VersaClock 5 5P49V5923 and 5P49V5933 chips. These
chips have two clock inputs, XTAL or CLK, which are muxed into single
PLL/VCO input. In case of 5P49V5923, the XTAL in built into the chip
while the 5P49V5923 requires external XTAL.

The PLL feeds two fractional dividers. Each fractional divider feeds
output mux, which allows selecting between clock from the fractional
divider itself or from output mux on output N-1. In case of output
mux 0, the output N-1 is instead connected to the output from the mux
feeding the PLL.

The driver thus far supports only the 5P49V5923 and 5P49V5933, while
it should be easily extensible to the whole 5P49V59xx family of chips
as they are all pretty similar.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Michael Turquette <mturquette@baylibre.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-renesas-soc@vger.kernel.org
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: vc5: Add bindings for IDT VersaClock 5P49V5923 and 5P49V5933
Marek Vasut [Thu, 12 Jan 2017 01:03:23 +0000 (02:03 +0100)]
clk: vc5: Add bindings for IDT VersaClock 5P49V5923 and 5P49V5933

Add bindings for IDT VersaClock 5 5P49V5923 and 5P49V5933 chips.
These are I2C clock generators with optional clock source from
either XTal or dedicated clock generator and, depending on the
model, two or more clock outputs.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Michael Turquette <mturquette@baylibre.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: devicetree@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoMerge tag 'v4.11-rockchip-clk1' of git://git.kernel.org/pub/scm/linux/kernel/git...
Stephen Boyd [Fri, 20 Jan 2017 23:51:55 +0000 (15:51 -0800)]
Merge tag 'v4.11-rockchip-clk1' of git://git./linux/kernel/git/mmind/linux-rockchip into clk-next

Pull Rockchip clk updates from Heiko Stuebner:

A new clock-type for the 1-2 muxes per soc that are for whatever reason
controlled through the General Register Files, support for the rk3328
clock-controller (including a new pll-type) and the usual clock ids and
some fixes.

* tag 'v4.11-rockchip-clk1' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip:
  dt-bindings: clk: add rockchip,grf property for RK3399
  clk: rockchip: use clock ids for memory controller parts on rk3066/rk3188
  clk: rockchip: use rk3288 isp_in clock ids
  clk: rockchip: add clock ids for memory controller parts on rk3066/rk3188
  clk: rockchip: add rk3288 isp_in clock ids
  clk: rockchip: Remove useless init of "grf" to -EPROBE_DEFER
  clk: rockchip: add clock controller for rk3328
  dt-bindings: add bindings for rk3328 clock controller
  clk: rockchip: add dt-binding header for rk3328
  clk: rockchip: add new pll-type for rk3328
  clk: rockchip: describe aclk_vcodec using the new muxgrf type on rk3288
  clk: rockchip: add a clock-type for muxes based in the grf

7 years agoMerge tag 'clk-v4.11-samsung' of git://linuxtv.org/snawrocki/samsung into clk-next
Stephen Boyd [Fri, 20 Jan 2017 23:49:47 +0000 (15:49 -0800)]
Merge tag 'clk-v4.11-samsung' of git://linuxtv.org/snawrocki/samsung into clk-next

Pull Samsung clk updates from Sylwester Nawrocki:

 - addition of the CPU clock configuration data for Exynos4412
   Prime SoC variant,
 - removal of driver for deprecated Exynos4415 SoC,
 - switching from the syscore to regular system sleep PM ops
   in the audio subsystem clocks controller driver,
 - updates of the definitions of some "Network On Chip" related
   clocks.

* tag 'clk-v4.11-samsung' of git://linuxtv.org/snawrocki/samsung:
  clk: samsung: Remove Exynos4415 driver (SoC not supported anymore)
  clk: samsung: exynos-audss: Replace syscore PM with platform device PM
  clk: samsung: exynos5433: Set NoC (Network On Chip) clocks as critical
  clk: samsung: Add CPU clk configuration data for Exynos4412 Prime

7 years agoclk: imx6: don't restrict LDB mux changes on QuadPlus
Lucas Stach [Fri, 13 Jan 2017 17:39:43 +0000 (18:39 +0100)]
clk: imx6: don't restrict LDB mux changes on QuadPlus

The LDB mux/gate layout has been fixed on QuadPlus, so there is no need
to restrict the LDB mux changes on this hardware, as the erratum
preventing this from working properly is gone.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoMerge tag 'clk-renesas-for-v4.11-tag1' of git://git.kernel.org/pub/scm/linux/kernel...
Stephen Boyd [Fri, 20 Jan 2017 23:17:50 +0000 (15:17 -0800)]
Merge tag 'clk-renesas-for-v4.11-tag1' of git://git./linux/kernel/git/geert/renesas-drivers into clk-next

Pull renesas clk updates from Geert Uytterhoeven:

  - Add CAN and MSIOF related clocks for R-Car M3-W.

* tag 'clk-renesas-for-v4.11-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers:
  clk: renesas: r8a7796: Add MSIOF controller clocks
  clk: renesas: r8a7796: Add CAN FD peripheral clock
  clk: renesas: r8a7796: Add CANFD clock
  clk: renesas: r8a7796: Add CAN peripheral clock

7 years agoclk: sunxi-ng: add support for V3s CCU
Icenowy Zheng [Thu, 19 Jan 2017 17:54:45 +0000 (01:54 +0800)]
clk: sunxi-ng: add support for V3s CCU

V3s has a similar but cut-down CCU to H3. Some muxes, especially clocks
about CSI, are different, which makes it to need a new CCU driver.

Add such a new driver for it.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
7 years agodt-bindings: add device binding for the CCU of Allwinner V3s
Icenowy Zheng [Thu, 19 Jan 2017 17:54:46 +0000 (01:54 +0800)]
dt-bindings: add device binding for the CCU of Allwinner V3s

Allwinner V3s is now driven by sunxi-ng CCU driver.

Add devicetree binding for it.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
7 years agoclk: rockchip: fix the incorrect pclk_edp div width for RK3399
Xing Zheng [Wed, 18 Jan 2017 04:20:56 +0000 (12:20 +0800)]
clk: rockchip: fix the incorrect pclk_edp div width for RK3399

The range of the  pclk_edp_div_con is [13:8] and 6 bits, not 5.

Reported-by: Lin Huang <hl@rock-chips.com>
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Tested-by: Lin Huang <hl@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
7 years agoclk: sunxi-ng: a33: Add CLK_SET_RATE_PARENT to ac-dig
Mylène Josserand [Tue, 17 Jan 2017 14:02:22 +0000 (15:02 +0100)]
clk: sunxi-ng: a33: Add CLK_SET_RATE_PARENT to ac-dig

The audio DAI needs to set the clock rates of the ac-dig clock.
To make it possible, the parent PLL audio clock rates should
also be changed. This is possible via "CLK_SET_RATE_PARENT" flag.

Signed-off-by: Mylène Josserand <mylene.josserand@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
7 years agoclk: samsung: Remove Exynos4415 driver (SoC not supported anymore)
Krzysztof Kozlowski [Sat, 14 Jan 2017 12:36:40 +0000 (14:36 +0200)]
clk: samsung: Remove Exynos4415 driver (SoC not supported anymore)

Support for Exynos4415 is going away because there are no internal nor
external users.

Since commit 46dcf0ff0de3 ("ARM: dts: exynos: Remove exynos4415.dtsi"),
the platform cannot be instantiated so remove also the drivers.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Kukjin Kim <kgene@kernel.org>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
7 years agodt-bindings: clk: add rockchip,grf property for RK3399
Xing Zheng [Tue, 10 Jan 2017 06:15:30 +0000 (14:15 +0800)]
dt-bindings: clk: add rockchip,grf property for RK3399

Add support for rockchip,grf property which is used for GRF muxes
on RK3399.

Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
7 years agoclk: rockchip: use clock ids for memory controller parts on rk3066/rk3188
Heiko Stuebner [Fri, 13 Jan 2017 16:32:55 +0000 (17:32 +0100)]
clk: rockchip: use clock ids for memory controller parts on rk3066/rk3188

Add the newly added clock ids to the clock entries of the rk3066/rk3188
clock driver. We won't be needing them in the kernel for a bit yet
but as they're used in the new u-boot ddr setup code/dts we should make
sure the clock ids stay identical and do not differ.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
7 years agoclk: rockchip: use rk3288 isp_in clock ids
Jacob Chen [Tue, 10 Jan 2017 11:59:18 +0000 (19:59 +0800)]
clk: rockchip: use rk3288 isp_in clock ids

Reference the newly added isp clock-ids in the clock-tree.

Signed-off-by: Jacob Chen <jacob-chen@iotwrt.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
7 years agoMerge branch 'v4.11-shared/clkids' into v4.11-clk/next
Heiko Stuebner [Fri, 13 Jan 2017 16:13:33 +0000 (17:13 +0100)]
Merge branch 'v4.11-shared/clkids' into v4.11-clk/next

7 years agoclk: rockchip: add clock ids for memory controller parts on rk3066/rk3188
Heiko Stuebner [Fri, 13 Jan 2017 16:10:02 +0000 (17:10 +0100)]
clk: rockchip: add clock ids for memory controller parts on rk3066/rk3188

Add clock ids for the upctl and publ controllers used for ddr control.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
7 years agoclk: rockchip: add rk3288 isp_in clock ids
Jacob Chen [Tue, 10 Jan 2017 11:59:17 +0000 (19:59 +0800)]
clk: rockchip: add rk3288 isp_in clock ids

Add clock-ids for the isp block of the rk3288.

Signed-off-by: Jacob Chen <jacob-chen@iotwrt.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
7 years agoclk: stm32f4: avoid uninitialized variable access
Arnd Bergmann [Wed, 11 Jan 2017 13:40:52 +0000 (14:40 +0100)]
clk: stm32f4: avoid uninitialized variable access

The failure path in the newly added function tries to free an
uninitialized pointer:

drivers/clk/clk-stm32f4.c: In function 'stm32f4_rcc_init':
drivers/clk/clk-stm32f4.c:1106:4: error: 'gate' may be used uninitialized in this function [-Werror=maybe-uninitialized]

I'm adding an initialization to NULL here to make the kfree()
succeed, and I'm also rearranging the cleanup so that the
same kfree() is used for any error path, making the function
slightly more robust against newly introduced bugs in the
error handling.

Fixes: daf2d117cbca ("clk: stm32f4: Add lcd-tft clock")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Gabriel Fernandez <gabriel.fernandez@st.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoMerge branch 'clk-fixes' into clk-next
Stephen Boyd [Tue, 10 Jan 2017 00:45:06 +0000 (16:45 -0800)]
Merge branch 'clk-fixes' into clk-next

* clk-fixes:
  clk/samsung: exynos542x: mark some clocks as critical

7 years agoclk: cdce925: add support for CDCE913, CDCE937, and CDCE949
Akinobu Mita [Sat, 31 Dec 2016 18:04:36 +0000 (03:04 +0900)]
clk: cdce925: add support for CDCE913CDCE937, and CDCE949

The CDCE925 is a member of the CDCE(L)9xx programmable clock generator
family.  There are also CDCE913CDCE937CDCE949 which have different
number of PLLs and outputs.

The clk-cdce925 driver supports only CDCE925 in the family.  This adds
support for the CDCE913CDCE937CDCE949, too.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Cc: Mike Looijmans <mike.looijmans@topic.nl>
Cc: Michael Turquette <mturquette@linaro.org>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: mdm9615: Add EBI2 clock
Zoran Markovic [Fri, 23 Dec 2016 04:54:44 +0000 (20:54 -0800)]
clk: mdm9615: Add EBI2 clock

Add definition of EBI2 clock used by MDM9615 NAND controller.

Cc: Andy Gross <andy.gross@linaro.org>
Cc: David Brown <david.brown@linaro.org>
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: linux-arm-msm@vger.kernel.org
Cc: linux-soc@vger.kernel.org
Cc: linux-clk@vger.kernel.org
Cc: devicetree@vger.kernel.org
Signed-off-by: Zoran Markovic <zmarkovic@sierrawireless.com>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
[sboyd@codeaurora.org: ebi2_clk halt bit is 24 not 23]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>