platform/kernel/linux-starfive.git
6 years agoclk: at91: clk-generated: remove useless divisor loop
Quentin Schulz [Thu, 10 Aug 2017 06:34:01 +0000 (08:34 +0200)]
clk: at91: clk-generated: remove useless divisor loop

The driver requests the current clk rate of each of its parent clocks to
decide whether a clock rate is suitable or not. It does not request
determine_rate from a parent clock which could request a rate change in
parent clock (i.e. there is no parent rate propagation).

We know the rate we want (passed along req argument of the function) and
the parent clock rate, thus we know the closest rounded divisor, we
don't need to iterate over the available divisors to find the best one
for a given clock.

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: mb86s7x: Drop non-building driver
Andreas Färber [Thu, 24 Aug 2017 22:52:36 +0000 (00:52 +0200)]
clk: mb86s7x: Drop non-building driver

It fails to build once we introduce the ARCH_MB86S7X Kconfig symbol:

  drivers/clk/clk-mb86s7x.c:27:10: fatal error: soc/mb86s7x/scb_mhu.h: No such file or directory
   #include <soc/mb86s7x/scb_mhu.h>
            ^~~~~~~~~~~~~~~~~~~~~~~
  compilation terminated.

And when commenting out that line, we get:

  drivers/clk/clk-mb86s7x.c: In function 'crg_gate_control':
  drivers/clk/clk-mb86s7x.c:72:8: error: implicit declaration of function 'mb86s7x_send_packet' [-Werror=implicit-function-declaration]
    ret = mb86s7x_send_packet(CMD_PERI_CLOCK_GATE_SET_REQ,
          ^~~~~~~~~~~~~~~~~~~
  drivers/clk/clk-mb86s7x.c:72:28: error: 'CMD_PERI_CLOCK_GATE_SET_REQ' undeclared (first use in this function)
    ret = mb86s7x_send_packet(CMD_PERI_CLOCK_GATE_SET_REQ,
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  drivers/clk/clk-mb86s7x.c:72:28: note: each undeclared identifier is reported only once for each function it appears in
  drivers/clk/clk-mb86s7x.c: In function 'crg_rate_control':
  drivers/clk/clk-mb86s7x.c:116:10: error: 'CMD_PERI_CLOCK_RATE_SET_REQ' undeclared (first use in this function)
     code = CMD_PERI_CLOCK_RATE_SET_REQ;
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  drivers/clk/clk-mb86s7x.c:121:10: error: 'CMD_PERI_CLOCK_RATE_GET_REQ' undeclared (first use in this function); did you mean 'CMD_PERI_CLOCK_RATE_SET_REQ'?
     code = CMD_PERI_CLOCK_RATE_GET_REQ;
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
            CMD_PERI_CLOCK_RATE_SET_REQ
  drivers/clk/clk-mb86s7x.c: In function 'mhu_cluster_rate':
  drivers/clk/clk-mb86s7x.c:276:10: error: 'CMD_CPU_CLOCK_RATE_GET_REQ' undeclared (first use in this function)
     code = CMD_CPU_CLOCK_RATE_GET_REQ;
            ^~~~~~~~~~~~~~~~~~~~~~~~~~
  drivers/clk/clk-mb86s7x.c:278:10: error: 'CMD_CPU_CLOCK_RATE_SET_REQ' undeclared (first use in this function); did you mean 'CMD_CPU_CLOCK_RATE_GET_REQ'?
     code = CMD_CPU_CLOCK_RATE_SET_REQ;
            ^~~~~~~~~~~~~~~~~~~~~~~~~~
            CMD_CPU_CLOCK_RATE_GET_REQ
  cc1: some warnings being treated as errors
  scripts/Makefile.build:302: recipe for target
  'drivers/clk/clk-mb86s7x.o' failed
  make[2]: *** [drivers/clk/clk-mb86s7x.o] Error 1

Remove the driver for now.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: ti: check for null return in strrchr to avoid null dereferencing
Colin Ian King [Wed, 26 Jul 2017 23:56:27 +0000 (00:56 +0100)]
clk: ti: check for null return in strrchr to avoid null dereferencing

strrchr can potentially return a null so the following strlen on the
null pointer can cause a null dereference. Add a check to see if
the string postfix is not null before calling strlen.

Detected by CoverityScan, CID#1452039 ("Dereference null return")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: Don't write error code into divider register
Alex Frid [Tue, 25 Jul 2017 10:18:40 +0000 (13:18 +0300)]
clk: Don't write error code into divider register

Add a check for error returned by divider value calculation to avoid
writing error code into hw register.

Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Reviewed-by: Jon Mayo <jmayo@nvidia.com>
Fixes: bca9690b9426 ("clk: divider: Make generic for usage elsewhere")
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: uniphier: add video input subsystem clock
Katsuhiro Suzuki [Thu, 10 Aug 2017 07:23:46 +0000 (16:23 +0900)]
clk: uniphier: add video input subsystem clock

Add a clock for video input subsystem (EXIV) on
UniPhier LD11/LD20 SoCs.

Signed-off-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: uniphier: add audio system clock
Katsuhiro Suzuki [Thu, 10 Aug 2017 07:23:45 +0000 (16:23 +0900)]
clk: uniphier: add audio system clock

Add clock for audio subsystem (AIO) and SoC internal audio codec
(EVEA) on UniPhier LD11/LD20 SoCs.

Signed-off-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: stm32h7: Add stm32h743 clock driver
Gabriel Fernandez [Mon, 21 Aug 2017 11:59:02 +0000 (13:59 +0200)]
clk: stm32h7: Add stm32h743 clock driver

This patch enables clocks for STM32H743 boards.

Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
for MFD changes:
Acked-by: Lee Jones <lee.jones@linaro.org>
for DT-Bindings
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: gate: expose clk_gate_ops::is_enabled
Gabriel Fernandez [Mon, 21 Aug 2017 11:59:01 +0000 (13:59 +0200)]
clk: gate: expose clk_gate_ops::is_enabled

This patch exposes clk_gate_ops::is_enabled as functions
that can be directly called and assigned in places like this so
we don't need wrapper functions that do nothing besides forward
the call.

Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
Suggested-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: nxp: clk-lpc32xx: rename clk_gate_is_enabled()
Gabriel Fernandez [Mon, 21 Aug 2017 11:59:00 +0000 (13:59 +0200)]
clk: nxp: clk-lpc32xx: rename clk_gate_is_enabled()

We need to export clk_gate_is_enabled() from clk framework, then
to avoid compilation issue we have to rename clk_gate_is_enabled()
in NXP LPC32xx clock driver.
We changed all gate op with 'lpc32xx_' prefix:
lpc32xx_clk_gate_enable(),
lpc32xx_clk_gate_disable(),
lpc32xx_clk_gate_is_enabled().

Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
Acked-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: uniphier: add PXs3 clock data
Masahiro Yamada [Thu, 31 Aug 2017 12:03:36 +0000 (21:03 +0900)]
clk: uniphier: add PXs3 clock data

Add basic clock data for Socionext's new SoC PXs3.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: hi6220: change watchdog clock source
Leo Yan [Tue, 29 Aug 2017 07:58:37 +0000 (15:58 +0800)]
clk: hi6220: change watchdog clock source

The old code uses tcxo (19.2MHz) as watchdog clock but actually the
watchdog uses 32K clock, as result the watchdog timeout cannot be set
correctly and delay long time to reset SoC.

So this patch is to use 'ref32k' as clock source for watchdog.

Fixes: 72ea48610d43 ("clk: hi6220: Clock driver support for Hisilicon hi6220 SoC")
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: Kconfig: Name RK805 in Kconfig for COMMON_CLK_RK808
Elaine Zhang [Wed, 16 Aug 2017 02:00:03 +0000 (10:00 +0800)]
clk: Kconfig: Name RK805 in Kconfig for COMMON_CLK_RK808

The RK808 and RK805 PMICs are using a similar register map.
We can reuse the clk driver for the RK805 PMIC. So let's add
the RK805 in the Kconfig description.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: cs2000: Add cs2000_set_saved_rate
Gaku Inami [Wed, 19 Apr 2017 17:46:31 +0000 (02:46 +0900)]
clk: cs2000: Add cs2000_set_saved_rate

This patch adds the common function to reset the clk rate in order to
be able to use it in other cases.

Signed-off-by: Gaku Inami <gaku.inami.xw@bp.renesas.com>
Signed-off-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: imx51: propagate rate across ipu_di*_sel
Lucas Stach [Fri, 18 Aug 2017 16:30:58 +0000 (18:30 +0200)]
clk: imx51: propagate rate across ipu_di*_sel

This propagates rate requests from the display interface to the divider
or PLL output, allowing to hit the required display rate in many more
cases.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Tested-By: Wladimir J. van der Laan <laanwj@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoMerge tag 'sunxi-clk-for-4.14-3' of https://git.kernel.org/pub/scm/linux/kernel/git...
Stephen Boyd [Thu, 31 Aug 2017 17:57:34 +0000 (10:57 -0700)]
Merge tag 'sunxi-clk-for-4.14-3' of https://git./linux/kernel/git/sunxi/linux into clk-next

Pull more Allwinner clock changes from Maxime Ripard:

 * Conversion of the last two SoCs (A10, A20) to the sunxi-ng framework

* tag 'sunxi-clk-for-4.14-3' of https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux:
  clk: sunxi-ng: Add sun4i/sun7i CCU driver
  dt-bindings: List devicetree binding for the CCU of Allwinner A10
  dt-bindings: List devicetree binding for the CCU of Allwinner A20

6 years agoclk: sunxi: fix uninitialized access
Arnd Bergmann [Wed, 23 Aug 2017 14:39:27 +0000 (16:39 +0200)]
clk: sunxi: fix uninitialized access

gcc-8 reports an uninitialized variable access in a code path
that we would see with incorrect DTB input:

drivers/clk/sunxi/clk-sun8i-bus-gates.c: In function 'sun8i_h3_bus_gates_init':
drivers/clk/sunxi/clk-sun8i-bus-gates.c:85:27: error: 'clk_parent' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This works around by skipping invalid input and printing a warning
instead if it ever happens. The problem was apparently part of the
initiali driver submission, but older compilers don't notice it.

Fixes: ab6e23a4e388 ("clk: sunxi: Add H3 clocks support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: versatile: make clk_ops const
Bhumika Goyal [Tue, 22 Aug 2017 14:06:26 +0000 (19:36 +0530)]
clk: versatile: make clk_ops const

Make this const as it is only stored in the const field of a
clk_init_data structure.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Liviu Dudau <Liviu.Dudau@arm.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoARC: clk: introduce HSDK pll driver
Eugeniy Paltsev [Fri, 25 Aug 2017 17:39:14 +0000 (20:39 +0300)]
ARC: clk: introduce HSDK pll driver

HSDK board manages its clocks using various PLLs. These PLL have same
dividers and corresponding control registers mapped to different addresses.
So we add one common driver for such PLLs.

Each PLL on HSDK board consists of three dividers: IDIV, FBDIV and
ODIV. Output clock value is managed using these dividers.

We add pre-defined tables with supported rate values and appropriate
configurations of IDIV, FBDIV and ODIV for each value.

As of today we add support for PLLs that generate clock for the
HSDK arc cpus, system, ddr, AXI tunnel and hdmi.

By this patch we add support for several plls (arc cpus pll and others),
so we had to use two different init types: CLK_OF_DECLARE for arc cpus pll
and regular probing for others plls.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Reviewed-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: zte: constify clk_div_table
Arvind Yadav [Mon, 28 Aug 2017 05:28:53 +0000 (10:58 +0530)]
clk: zte: constify clk_div_table

clk_div_table are not supposed to change at runtime. All functions
working with clk_div_table provided by <linux/clk-provider.h> work
with const clk_div_table. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Acked-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: imx: constify clk_div_table
Arvind Yadav [Mon, 28 Aug 2017 05:28:52 +0000 (10:58 +0530)]
clk: imx: constify clk_div_table

clk_div_table are not supposed to change at runtime. All functions
working with clk_div_table provided by <linux/clk-provider.h> work
with const clk_div_table. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Acked-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: uniphier: add ethernet clock control support
Kunihiko Hayashi [Mon, 28 Aug 2017 09:57:23 +0000 (18:57 +0900)]
clk: uniphier: add ethernet clock control support

Add clock control for ethernet controller on Pro4, PXs2, LD11 and LD20.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: gemini: hands off PCI OE bit
Linus Walleij [Tue, 8 Aug 2017 19:08:18 +0000 (21:08 +0200)]
clk: gemini: hands off PCI OE bit

This bit is pin control, and needs to be carefully managed by the
new pin control driver.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: ux500: prcc: constify clk_ops.
Arvind Yadav [Mon, 28 Aug 2017 07:02:41 +0000 (12:32 +0530)]
clk: ux500: prcc: constify clk_ops.

clk_ops are not supposed to change at runtime. All functions
working with clk_ops provided by <linux/clk-provider.h> work
with const clk_ops. So mark the non-const clk_ops as const.

Here, Function "clk_reg_prcc" is used to initialized clk_init_data.
clk_init_data is working with const clk_ops. So make clk_reg_prcc
non-const clk_ops argument as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: ux500: sysctrl: constify clk_ops.
Arvind Yadav [Mon, 28 Aug 2017 07:02:40 +0000 (12:32 +0530)]
clk: ux500: sysctrl: constify clk_ops.

clk_ops are not supposed to change at runtime. All functions
working with clk_ops provided by <linux/clk-provider.h> work
with const clk_ops. So mark the non-const clk_ops as const.

Here, Function "clk_reg_sysctrl" is used to initialized clk_init_data.
clk_init_data is working with const clk_ops. So make clk_reg_sysctrl
non-const clk_ops argument as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: ux500: prcmu: constify clk_ops.
Arvind Yadav [Mon, 28 Aug 2017 07:02:39 +0000 (12:32 +0530)]
clk: ux500: prcmu: constify clk_ops.

clk_ops are not supposed to change at runtime. All functions
working with clk_ops provided by <linux/clk-provider.h> work
with const clk_ops. So mark the non-const clk_ops as const.

Here, Function "clk_reg_prcmu" is used to initialized clk_init_data.
clk_init_data is working with const clk_ops. So make clk_reg_prcmu
non-const clk_ops argument as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: sunxi-ng: Add sun4i/sun7i CCU driver
Priit Laes [Wed, 23 Aug 2017 17:23:29 +0000 (20:23 +0300)]
clk: sunxi-ng: Add sun4i/sun7i CCU driver

Introduce a clock controller driver for sun4i A10 and sun7i A20
series SoCs.

Signed-off-by: Priit Laes <plaes@plaes.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
6 years agodt-bindings: List devicetree binding for the CCU of Allwinner A10
Priit Laes [Wed, 23 Aug 2017 17:23:31 +0000 (20:23 +0300)]
dt-bindings: List devicetree binding for the CCU of Allwinner A10

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

Add devicetree binding for it.

Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Priit Laes <plaes@plaes.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
6 years agodt-bindings: List devicetree binding for the CCU of Allwinner A20
Priit Laes [Wed, 23 Aug 2017 17:23:30 +0000 (20:23 +0300)]
dt-bindings: List devicetree binding for the CCU of Allwinner A20

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

Add devicetree binding for it.

Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Priit Laes <plaes@plaes.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
6 years agoclk: msm8996-gcc: add missing smmu clks
Srinivas Kandagatla [Mon, 14 Aug 2017 10:26:34 +0000 (12:26 +0200)]
clk: msm8996-gcc: add missing smmu clks

This patch adds missing LPASS smmu clks which are required by the audio driver.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: tegra: Fix Tegra210 PLLU initialization
Alex Frid [Tue, 25 Jul 2017 10:34:15 +0000 (13:34 +0300)]
clk: tegra: Fix Tegra210 PLLU initialization

- Added necessary delays in PLLU enable sequence during initialization
- Applied PLLU lock to all secondary gates (PLLU_48M and PLLU_60M were
missing).

Signed-off-by: Alex Frid <afrid@nvidia.com>
Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: tegra: Correct Tegra210 UTMIPLL poweron delay
Alex Frid [Tue, 25 Jul 2017 10:34:14 +0000 (13:34 +0300)]
clk: tegra: Correct Tegra210 UTMIPLL poweron delay

Increased Tegra210 UTMIPLL power on delay to 20us (spec maximum is 15us).
Also remove a few empty lines to make it more clear the ACTIVE_DLY_COUNT
and ENABLE_DLY_COUNT fields.

Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Reviewed-by: Jon Mayo <jmayo@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: tegra: Fix T210 PLLRE registration
Alex Frid [Tue, 25 Jul 2017 10:34:13 +0000 (13:34 +0300)]
clk: tegra: Fix T210 PLLRE registration

Switched Tegra210 PLLRE registration to common PLL ops instead of special
PLLRE ops used on previous Tegra chips. The latter ops do not follow
chip specific PLL frequency table, and do not apply chip specific rate
calculation method.

Removed unnecessary default rate setting that duplicates h/w reset
state, and is overwritten by clock initialization, anyway.

Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Reviewed-by: Jon Mayo <jmayo@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: tegra: Update T210 PLLSS (D2/DP) registration
Alex Frid [Tue, 25 Jul 2017 10:34:12 +0000 (13:34 +0300)]
clk: tegra: Update T210 PLLSS (D2/DP) registration

Remove from Tegra210 PLLSS registration code sections that
- attempt to set PLL minimum rate (unnecessary, and dangerous if PLL
  is already enabled on boot)
- apply pre-Tegra210 defaults settings
- check IDDQ setting (duplicated with Tegra210 PLLSS check defaults)

Replaced setting of reference clock with check that default oscillator
selection is not changed, and failed registration otherwise as validation
was only done with the oscillator as the reference clock.

Reordered registration, so that PLL initialization is called after
VCOmin adjustment.

Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: tegra: Re-factor T210 PLLX registration
Alex Frid [Tue, 25 Jul 2017 10:34:11 +0000 (13:34 +0300)]
clk: tegra: Re-factor T210 PLLX registration

Tegra210 PLLX uses the same sequences than then PLLC instances. So there
is no need to have a special registration function and ops struct for it.
Simplify the code by changing all references to the Tegra210 PLLX
registration function to the Tegra210 PLLC registration function and
avoid duplicate functionality.

Based on work by Alex Frid <afrid@nvidia.com>

Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: tegra: don't warn for pll_d2 defaults unnecessarily
Peter De Schrijver [Tue, 25 Jul 2017 10:34:10 +0000 (13:34 +0300)]
clk: tegra: don't warn for pll_d2 defaults unnecessarily

If the PLL is on, only warn if the defaults are not yet set. Otherwise be
silent.

Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Reviewed-by: Timo Alho <talho@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: tegra: change post IDDQ release delay to 5us
Peter De Schrijver [Tue, 25 Jul 2017 10:34:09 +0000 (13:34 +0300)]
clk: tegra: change post IDDQ release delay to 5us

Increase delay after PLL IDDQ release to 5us per PLL specifications.

based on work by Alex Frid <afrid@nvidia.com>

Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: tegra: Add TEGRA_PERIPH_ON_APB flag to I2C
Alex Frid [Tue, 25 Jul 2017 10:34:08 +0000 (13:34 +0300)]
clk: tegra: Add TEGRA_PERIPH_ON_APB flag to I2C

I2C controllers are also on the APB bus and therefor need this flag to handle
resets correctly.

Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: tegra: Fix T210 effective NDIV calculation
Alex Frid [Tue, 25 Jul 2017 10:34:07 +0000 (13:34 +0300)]
clk: tegra: Fix T210 effective NDIV calculation

Don't take the fractional part into account to calculate the effective
NDIV if fractional ndiv is not enabled.

Signed-off-by: Alex Frid <afrid@nvidia.com>
Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: tegra: Init cfg structure in _get_pll_mnp
Peter De Schrijver [Tue, 25 Jul 2017 10:34:06 +0000 (13:34 +0300)]
clk: tegra: Init cfg structure in _get_pll_mnp

Not all fields are read from the hw depending on the PLL type. Make sure
the other fields are 0 by clearing the structure beforehand to prevent
users such as the rate re-calculation code from using bogus values.

Based on work by  Alex Frid <afrid@nvidia.com>

Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: tegra210: remove non-existing VFIR clock
Peter De Schrijver [Tue, 25 Jul 2017 10:34:05 +0000 (13:34 +0300)]
clk: tegra210: remove non-existing VFIR clock

Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: tegra: disable SSC for PLL_D2
Peter De Schrijver [Tue, 25 Jul 2017 10:34:04 +0000 (13:34 +0300)]
clk: tegra: disable SSC for PLL_D2

PLLD2 is used for HDMI which does not allow Spread Spectrum clocking.

Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: tegra: Enable PLL_SS for Tegra210
Peter De Schrijver [Tue, 25 Jul 2017 10:34:03 +0000 (13:34 +0300)]
clk: tegra: Enable PLL_SS for Tegra210

Make sure the pll_ss ops are compiled even when only building for Tegra210.

Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Reviewed-by: Shreshtha Sahu <ssahu@nvidia.com>
Tested-by: Shreshtha Sahu <ssahu@nvidia.com>
Reviewed-by: Jon Mayo <jmayo@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: tegra: fix SS control on PLL enable/disable
Peter De Schrijver [Tue, 25 Jul 2017 10:34:02 +0000 (13:34 +0300)]
clk: tegra: fix SS control on PLL enable/disable

PLL SS was only controlled when setting the PLL rate, not when the PLL itself
is enabled or disabled.

Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Reviewed-by: Jon Mayo <jmayo@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: qcom: msm8916: Fix bimc gpu clock ops
Georgi Djakov [Fri, 18 Aug 2017 14:22:50 +0000 (17:22 +0300)]
clk: qcom: msm8916: Fix bimc gpu clock ops

The clock bimc_gpu_clk_src is incorrectly set to use the shared rcg2
ops, which are for RCGs with child branches controlled by different
CPUs.

The result of the incorrect ops is that the GPU's PM runtime may leave
this clock set at a very low rate. Fix this issue by using the correct
rcg2 ops.

Fixes: a2e8272f3f89 ("clk: qcom: Add MSM8916 gpu clocks")
Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: ti: make clk_ops const
Bhumika Goyal [Tue, 22 Aug 2017 13:11:15 +0000 (18:41 +0530)]
clk: ti: make clk_ops const

Make these const as they are only stored in the const field of a
clk_init_data structure.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoMerge tag 'clk-renesas-for-v4.14-tag1' of git://git.kernel.org/pub/scm/linux/kernel...
Stephen Boyd [Wed, 23 Aug 2017 22:39:58 +0000 (15:39 -0700)]
Merge tag 'clk-renesas-for-v4.14-tag1' of git://git./linux/kernel/git/geert/renesas-drivers into clk-next

Pull Renesas clk driver updates from Geert Uytterhoeven:

  * Add more module clocks for R-Car V2H and M3-W,
  * Add support for the R-Car Gen3 USB 2.0 clock selector PHY,
  * Add support for the new R-Car D3 SoC,
  * Allow compile-testing of all (sub)drivers now all dummy infrastructure
    is available,
  * Small fixes and cleanups.

* tag 'clk-renesas-for-v4.14-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers:
  clk: renesas: r8a7796: Add USB3.0 clock
  clk: renesas: rcar-usb2-clock-sel: Add R-Car USB 2.0 clock selector PHY
  clk: renesas: cpg-mssr: Add R8A77995 support
  clk: renesas: rcar-gen3: Add support for SCCG/Clean peripheral clocks
  clk: renesas: rcar-gen3: Add divider support for PLL1 and PLL3
  clk: renesas: Add r8a77995 CPG Core Clock Definitions
  clk: renesas: rcar-gen3-cpg: Refactor checks for accessing the div table
  clk: renesas: rcar-gen3-cpg: Drop superfluous variable
  clk: renesas: Allow compile-testing of all (sub)drivers
  clk: renesas: r8a7792: Add IMR-LX3/LSX3 clocks
  clk: renesas: div6: Document fields used for parent selection

6 years agoclk: rockchip: Mark rockchip_fractional_approximation static
Stephen Boyd [Wed, 23 Aug 2017 22:35:41 +0000 (15:35 -0700)]
clk: rockchip: Mark rockchip_fractional_approximation static

Silence the sparse warning

clk/rockchip/clk.c:172:6: warning: symbol 'rockchip_fractional_approximation' was not declared. Should it be static?

Cc: Elaine Zhang <zhangqing@rock-chips.com>
Cc: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoMerge tag 'v4.14-rockchip-clk1' of git://git.kernel.org/pub/scm/linux/kernel/git...
Stephen Boyd [Wed, 23 Aug 2017 22:33:45 +0000 (15:33 -0700)]
Merge tag 'v4.14-rockchip-clk1' of git://git./linux/kernel/git/mmind/linux-rockchip into clk-next

Pull Rockchip clk driver updates from Heiko Stuebner:

The biggest change is fixing the jitter on the fractional clock-type
Rockchip socs experience with the default approximation. For that we
introduce the ability to override it with a clock-specific approximation
and use that to create the needed rate settings as described in the
Rockchip soc manuals (same for all Rockchip socs).

Apart from that we have support for the rk3126 clock controller
which is similar to the rk3128 with some minimal differences
and a lot of improvements and fixes for the rv1108 clock controller
(missing clocks, some clock-ids, naming fixes, register fixes).

* tag 'v4.14-rockchip-clk1' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip:
  clk: rockchip: fix the rv1108 clk_mac sel register description
  clk: rockchip: rename rv1108 macphy clock to mac
  clk: rockchip: add rv1108 ACLK_GMAC and PCLK_GMAC clocks
  clk: rockchip: add rk3228 SCLK_SDIO_SRC clk id
  clk: rockchip: add rv1108 ACLK_GAMC and PCLK_GMAC ID
  clk: rockchip: add rk3228 sclk_sdio_src ID
  clk: rockchip: add special approximation to fix up fractional clk's jitter
  clk: fractional-divider: allow overriding of approximation
  clk: rockchip: modify rk3128 clk driver to also support rk3126
  dt-bindings: add documentation for rk3126 clock
  clk: rockchip: add some critical clocks for rv1108 SoC
  clk: rockchip: rename some of clks for rv1108 SoC
  clk: rockchip: fix up some clks describe error for rv1108 SoC
  clk: rockchip: support more clks for rv1108
  clk: rockchip: fix up the pll clks error for rv1108 SoC
  clk: rockchip: support more rates for rv1108 cpuclk
  clk: rockchip: fix up indentation of some RV1108 clock-ids
  clk: rockchip: rename the clk id for HCLK_I2S1_2CH
  clk: rockchip: add more clk ids for rv1108

6 years agoMerge tag 'sunxi-clk-for-4.14-2' of https://git.kernel.org/pub/scm/linux/kernel/git...
Stephen Boyd [Wed, 23 Aug 2017 22:31:48 +0000 (15:31 -0700)]
Merge tag 'sunxi-clk-for-4.14-2' of https://git./linux/kernel/git/sunxi/linux into clk-next

Pull Allwinner clock changes from Chen-Yu Tsai:

 * Added support for fixed post-divider on divider and NKM-style clocks
 * Added driver for R40 CCU
 * Fix sunxi-ng/ccu-sunxi-r.h header file guard macro typo
 * Make fractional clock modes really used and correctly configured
 * Make H3 cpu clock rate change correctly to be used with cpufreq

* tag 'sunxi-clk-for-4.14-2' of https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux:
  clk: sunxi-ng: support R40 SoC
  dt-bindings: add compatible string for Allwinner R40 CCU
  clk: sunxi-ng: nkm: add support for fixed post-divider
  clk: sunxi-ng: div: Add support for fixed post-divider
  dt-bindings: clock: sunxi-ccu: Add compatibles for sun5i CCU driver
  clk: sunxi-ng: allow set parent clock (PLL_CPUX) for CPUX clock on H3
  clk: sunxi-ng: h3: gate then ungate PLL CPU clk after rate change
  clk: sunxi-ng: Wait for lock when using fractional mode
  clk: sunxi-ng: Make fractional helper less chatty
  clk: sunxi-ng: multiplier: Fix fractional mode
  clk: sunxi-ng: Fix fractional mode for N-M clocks
  clk: sunxi-ng: Fix header guard of ccu-sun8i-r.h

6 years agoMerge tag 'clk-v4.14-samsung' of git://git.kernel.org/pub/scm/linux/kernel/git/snawro...
Stephen Boyd [Wed, 23 Aug 2017 22:30:29 +0000 (15:30 -0700)]
Merge tag 'clk-v4.14-samsung' of git://git./linux/kernel/git/snawrocki/clk into clk-next

Pull Samsung clk driver updates from Sylwester Nawrocki:

Changes in definitions of audio related clocks for Exynos5420/5422/5800
SoCs: a fix of mau_epll clock definition and changes enabling clock rate
setting propagation on a path from the I2S IP block up the EPLL.

* tag 'clk-v4.14-samsung' of git://git.kernel.org/pub/scm/linux/kernel/git/snawrocki/clk:
  clk: samsung: exynos542x: Enable clock rate propagation up to the EPLL
  clk: samsung: Add CLK_SET_RATE_PARENT to some AUDSS CLK CON clocks
  clk: samsung: Fix mau_epll clock definition for exynos5422

6 years agoMerge tag 'meson-clk-for-4.14' of git://github.com/baylibre/clk-meson into clk-next
Stephen Boyd [Wed, 23 Aug 2017 22:28:52 +0000 (15:28 -0700)]
Merge tag 'meson-clk-for-4.14' of git://github.com/baylibre/clk-meson into clk-next

Pull Amlogic clock driver updates from Neil Armstrong:

 * meson8b: add the reset controller to the clkc
 * meson: expose all clk ids
 * gxbb-aoclk: Add CEC 32k clock
 * gxbb: add mmc input 0 clocks
 * meson: fix protection against undefined clks
 * gxbb: fix audio divider flags

* tag 'meson-clk-for-4.14' of git://github.com/baylibre/clk-meson:
  clk: meson: gxbb-aoclk: Add CEC 32k clock
  clk: meson: gxbb-aoclk: Switch to regmap for register access
  dt-bindings: clock: amlogic, gxbb-aoclkc: Update bindings
  clk: meson: gxbb: Add sd_emmc clk0 clocks
  clk: meson: gxbb: fix clk_mclk_i958 divider flags
  clk: meson: gxbb: fix meson cts_amclk divider flags
  clk: meson: meson8b: register the built-in reset controller
  dt-bindings: clock: gxbb-aoclk: Add CEC 32k clock
  clk: meson: gxbb: Add sd_emmc clk0 clkids
  clk: meson-gxbb: expose almost every clock in the bindings
  clk: meson8b: expose every clock in the bindings
  clk: meson: gxbb: fix protection against undefined clks
  clk: meson: meson8b: fix protection against undefined clks
  dt-bindings: clock: meson8b: describe the embedded reset controller

6 years agoclk: rockchip: fix the rv1108 clk_mac sel register description
Elaine Zhang [Mon, 21 Aug 2017 08:16:07 +0000 (16:16 +0800)]
clk: rockchip: fix the rv1108 clk_mac sel register description

The source clock ordering is wrong, as shown in the TRM:
cru_sel24_con[8]
rmii_extclk_sel
clock source select control register
1'b0: from internal PLL
1'b1: from external IO

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Reviewed-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
6 years agoclk: rockchip: rename rv1108 macphy clock to mac
Elaine Zhang [Mon, 21 Aug 2017 08:16:06 +0000 (16:16 +0800)]
clk: rockchip: rename rv1108 macphy clock to mac

This MAC has no internal phy for rv1108 and the whole clock
infrastructure hasn't been used yet, so is safe to fix.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Reviewed-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
6 years agoclk: rockchip: add rv1108 ACLK_GMAC and PCLK_GMAC clocks
Elaine Zhang [Mon, 21 Aug 2017 08:16:05 +0000 (16:16 +0800)]
clk: rockchip: add rv1108 ACLK_GMAC and PCLK_GMAC clocks

Add gmac aclk and pclk clock gates.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Reviewed-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
6 years agoclk: rockchip: add rk3228 SCLK_SDIO_SRC clk id
Elaine Zhang [Fri, 18 Aug 2017 03:49:25 +0000 (11:49 +0800)]
clk: rockchip: add rk3228 SCLK_SDIO_SRC clk id

In some special circumstances, may be need to reparent clk for sclk_sdio_src.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
6 years agoMerge branch 'v4.14-shared/clkids' into v4.14-clk/next
Heiko Stuebner [Mon, 21 Aug 2017 22:39:00 +0000 (00:39 +0200)]
Merge branch 'v4.14-shared/clkids' into v4.14-clk/next

6 years agoclk: rockchip: add rv1108 ACLK_GAMC and PCLK_GMAC ID
Elaine Zhang [Mon, 21 Aug 2017 08:16:04 +0000 (16:16 +0800)]
clk: rockchip: add rv1108 ACLK_GAMC and PCLK_GMAC ID

This patch exports gmac aclk and pclk for dts reference.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Reviewed-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
6 years agoclk: rockchip: add rk3228 sclk_sdio_src ID
Elaine Zhang [Fri, 18 Aug 2017 03:49:24 +0000 (11:49 +0800)]
clk: rockchip: add rk3228 sclk_sdio_src ID

This patch exports sdio src clock for dts reference.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
6 years agoclk: sunxi-ng: support R40 SoC
Icenowy Zheng [Tue, 15 Aug 2017 05:55:29 +0000 (13:55 +0800)]
clk: sunxi-ng: support R40 SoC

Allwinner R40 SoC have a clock controller module in the style of the
SoCs beyond sun6i, however, it's more rich and complex.

Add support for it.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
6 years agodt-bindings: add compatible string for Allwinner R40 CCU
Icenowy Zheng [Sat, 27 May 2017 10:23:05 +0000 (18:23 +0800)]
dt-bindings: add compatible string for Allwinner R40 CCU

Allwinner R40 has a clock controlling unit like the ones on other
Allwinner SoCs after sun6i, and can also use a CCU-based driver.

Add a compatible string for it.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
6 years agoclk: renesas: r8a7796: Add USB3.0 clock
Hiromitsu Yamasaki [Wed, 26 Jul 2017 11:23:39 +0000 (20:23 +0900)]
clk: renesas: r8a7796: Add USB3.0 clock

This patch adds USB3.0-IF0 clock for R8A7796 SoC.

Signed-off-by: Hiromitsu Yamasaki <hiromitsu.yamasaki.ym@renesas.com>
Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
6 years agoclk: renesas: rcar-usb2-clock-sel: Add R-Car USB 2.0 clock selector PHY
Yoshihiro Shimoda [Tue, 25 Jul 2017 06:26:27 +0000 (15:26 +0900)]
clk: renesas: rcar-usb2-clock-sel: Add R-Car USB 2.0 clock selector PHY

R-Car USB 2.0 controller can change the clock source from an oscillator
to an external clock via a register. So, this patch adds support
the clock source selector as a clock driver.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
6 years agoclk: renesas: cpg-mssr: Add R8A77995 support
Geert Uytterhoeven [Wed, 12 Jul 2017 08:47:36 +0000 (10:47 +0200)]
clk: renesas: cpg-mssr: Add R8A77995 support

Add R-Car D3 (R8A77995) Clock Pulse Generator / Module Standby and
Software Reset support, using the CPG/MSSR driver core and the common
R-Car Gen3 CPG code.

Based on the R-Car Series, 3rd Generation Hardware User's Manual, Rev.
0.55, Jun. 30, 2017.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Acked-by: Rob Herring <robh@kernel.org>
6 years agoclk: renesas: rcar-gen3: Add support for SCCG/Clean peripheral clocks
Geert Uytterhoeven [Wed, 19 Jul 2017 15:39:54 +0000 (17:39 +0200)]
clk: renesas: rcar-gen3: Add support for SCCG/Clean peripheral clocks

On R-Car Gen3 SoCs with a Spread Spectrum Clock Generator (e.g. R-Car
D3), a peripheral clock divider has been added, to select between clean
and spread spectrum parents.

Add a new clock type to the R-Car Gen3 driver core to handle this.
To avoid increasing the size of struct cpg_core_clk, both parents and
dividers are stored in the existing parent resp. div fields.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: renesas: rcar-gen3: Add divider support for PLL1 and PLL3
Geert Uytterhoeven [Wed, 19 Jul 2017 14:30:45 +0000 (16:30 +0200)]
clk: renesas: rcar-gen3: Add divider support for PLL1 and PLL3

On some R-Car Gen3 SoCs (e.g. R-Car D3), PLL1 and PLL3 use a divider
value different from one.  Extend struct rcar_gen3_cpg_pll_config to handle
this.  As all multipliers and dividers are small, table size increase
can be kept limited by storing them in u8s instead of unsigned ints,
which saves ca. 0.5 KiB for a generic kernel.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: renesas: Add r8a77995 CPG Core Clock Definitions
Geert Uytterhoeven [Tue, 11 Jul 2017 14:58:42 +0000 (16:58 +0200)]
clk: renesas: Add r8a77995 CPG Core Clock Definitions

Add all R-Car D3 Clock Pulse Generator Core Clock Outputs, as listed
in Table 8.2f ("List of Clocks [R-Car D3]") of the R-Car Series, 3rd
Generation Hardware User's Manual (Rev. 0.55, Jun. 30, 2017).

Note that internal CPG clocks (S0, S1, S2, S3, S1C, S3C, SDSRC, and
SSPSRC) are not included, as they are used as internal clock sources
only, and never referenced from DT.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
6 years agoclk: sunxi-ng: nkm: add support for fixed post-divider
Icenowy Zheng [Sat, 12 Aug 2017 12:43:51 +0000 (20:43 +0800)]
clk: sunxi-ng: nkm: add support for fixed post-divider

SATA PLL on Allwinner R40 is of type (parent) * N * K / M / 6 where 6 is
the fixed post-divider.

Add post-divider support for NKM type clock.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
[wens@csie.org: Fixed application of post-divider in set_rate callback]
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
6 years agoclk: sunxi-ng: div: Add support for fixed post-divider
Priit Laes [Sat, 12 Aug 2017 12:43:50 +0000 (20:43 +0800)]
clk: sunxi-ng: div: Add support for fixed post-divider

SATA clock on sun4i/sun7i is of type (parent) / M / 6 where
6 is fixed post-divider.

Signed-off-by: Priit Laes <plaes@plaes.org>
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
6 years agodt-bindings: clock: sunxi-ccu: Add compatibles for sun5i CCU driver
Jonathan Liu [Tue, 8 Aug 2017 01:25:40 +0000 (11:25 +1000)]
dt-bindings: clock: sunxi-ccu: Add compatibles for sun5i CCU driver

The bindings were not updated when the sun5i CCU driver was added in
commit 5e73761786d6 ("clk: sunxi-ng: Add sun5i CCU driver").

Signed-off-by: Jonathan Liu <net147@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
6 years agoclk: samsung: exynos542x: Enable clock rate propagation up to the EPLL
Sylwester Nawrocki [Fri, 21 Jul 2017 14:21:02 +0000 (16:21 +0200)]
clk: samsung: exynos542x: Enable clock rate propagation up to the EPLL

The CLK_SET_RATE_PARENT flag is added to clocks between the EPLL
and the audio subsystem clock controller so that the EPLL's output
frequency can be set indirectly with clk_set_rate() on a leaf clock.
That should be safe as EPLL is normally only used to generate clock
for the audio subsystem.
With this change we can avoid passing the EPLL clock to the ASoC
machine driver.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 years agoclk: samsung: Add CLK_SET_RATE_PARENT to some AUDSS CLK CON clocks
Sylwester Nawrocki [Mon, 17 Jul 2017 12:39:21 +0000 (14:39 +0200)]
clk: samsung: Add CLK_SET_RATE_PARENT to some AUDSS CLK CON clocks

This allows clk rate propagation up to the clock tree so EPLL
can be reprogrammed indirectly when setting rate of the Audio
Subsystem clocks.
The advantage is that sound machine driver can operate only
on the leaf clocks rather than explicitly re-configuring
the root clock (EPLL).

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 years agoclk: samsung: Fix mau_epll clock definition for exynos5422
Sylwester Nawrocki [Fri, 21 Jul 2017 14:18:19 +0000 (16:18 +0200)]
clk: samsung: Fix mau_epll clock definition for exynos5422

Parent clock of the MAU_EPLL gate clock on exynos5422 is
"mout_user_mau_epll", not "mout_mau_epll_clk". This change
only affects exynos5422/5800.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 years agoclk: rockchip: add special approximation to fix up fractional clk's jitter
Elaine Zhang [Tue, 1 Aug 2017 16:22:24 +0000 (18:22 +0200)]
clk: rockchip: add special approximation to fix up fractional clk's jitter

>From Rockchips fractional divider description:
  3.1.9  Fractional divider usage
  To get specific frequency, clocks of I2S, SPDIF, UARTcan be generated by
  fractional divider. Generally you must set that denominator is 20 times
  larger than numerator to generate precise clock frequency. So the
  fractional divider applies only to generate low frequency clock like
  I2S, UART.

Therefore add a special approximation function that handles this
special requirement.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
6 years agoclk: fractional-divider: allow overriding of approximation
Elaine Zhang [Tue, 1 Aug 2017 16:21:22 +0000 (18:21 +0200)]
clk: fractional-divider: allow overriding of approximation

Fractional dividers may have special requirements concerning numerator
and denominator selection that differ from just getting the best
approximation.

For example on Rockchip socs the denominator must be at least 20 times
larger than the numerator to generate precise clock frequencies.

Therefore add the ability to provide custom approximation functions.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
6 years agoclk: rockchip: modify rk3128 clk driver to also support rk3126
Elaine Zhang [Tue, 1 Aug 2017 01:17:03 +0000 (09:17 +0800)]
clk: rockchip: modify rk3128 clk driver to also support rk3126

rk3128 and rk3126 have some gate registers describe differences.
So need to make some distinctions.
The RK3126 and RK3128 Same clock description we move it to
the common clock branches.
And the different clks description use the own clock branches.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
6 years agodt-bindings: add documentation for rk3126 clock
Elaine Zhang [Tue, 1 Aug 2017 01:17:04 +0000 (09:17 +0800)]
dt-bindings: add documentation for rk3126 clock

This add bindings documentation for rk3126 SoCs.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
6 years agoclk: rockchip: add some critical clocks for rv1108 SoC
Elaine Zhang [Tue, 8 Aug 2017 07:19:33 +0000 (15:19 +0800)]
clk: rockchip: add some critical clocks for rv1108 SoC

the bus/periph/nclk_ddrupctl/pclk_ddrmon/pclk_acodecphy/pclk_pmu
no driver to handle them,
Chip design requirements for these clock to always on.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
6 years agoclk: rockchip: rename some of clks for rv1108 SoC
Elaine Zhang [Tue, 8 Aug 2017 07:19:17 +0000 (15:19 +0800)]
clk: rockchip: rename some of clks for rv1108 SoC

Rename some of clks to keep the consistency with the TRM.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
6 years agoclk: rockchip: fix up some clks describe error for rv1108 SoC
Elaine Zhang [Tue, 8 Aug 2017 07:18:59 +0000 (15:18 +0800)]
clk: rockchip: fix up some clks describe error for rv1108 SoC

1. fix up the parent name
2. remove the CLK_IGNORE_UNUSED flag for some clk not need to always on.
3. fix up some clks regs describe error.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
6 years agoclk: rockchip: support more clks for rv1108
Elaine Zhang [Tue, 8 Aug 2017 07:18:43 +0000 (15:18 +0800)]
clk: rockchip: support more clks for rv1108

Add the description of the missing clock,
make the clock more complete.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
6 years agoMerge branch 'v4.14-shared/clkids' into v4.14-clk/next
Heiko Stuebner [Tue, 8 Aug 2017 15:21:45 +0000 (17:21 +0200)]
Merge branch 'v4.14-shared/clkids' into v4.14-clk/next

6 years agoclk: rockchip: fix up the pll clks error for rv1108 SoC
Elaine Zhang [Wed, 2 Aug 2017 08:33:04 +0000 (16:33 +0800)]
clk: rockchip: fix up the pll clks error for rv1108 SoC

fix up the lock_shift describe error.
remove the ROCKCHIP_PLL_SYNC_RATE flag for gpll.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
6 years agoclk: rockchip: support more rates for rv1108 cpuclk
Elaine Zhang [Wed, 2 Aug 2017 08:32:23 +0000 (16:32 +0800)]
clk: rockchip: support more rates for rv1108 cpuclk

fix up the cpuclk rates table for support more freqs.
fix up the mux_core_mask describe error.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
6 years agoclk: rockchip: fix up indentation of some RV1108 clock-ids
Elaine Zhang [Wed, 2 Aug 2017 08:30:33 +0000 (16:30 +0800)]
clk: rockchip: fix up indentation of some RV1108 clock-ids

Make the code look better.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
6 years agoclk: rockchip: rename the clk id for HCLK_I2S1_2CH
Elaine Zhang [Wed, 2 Aug 2017 08:29:48 +0000 (16:29 +0800)]
clk: rockchip: rename the clk id for HCLK_I2S1_2CH

i2s1 has 2 channels but not 8 channels.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
[and the clock id hasn't been used in either clock-driver nor dts,
 so is safe to rename]
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
6 years agoclk: rockchip: add more clk ids for rv1108
Elaine Zhang [Wed, 2 Aug 2017 08:28:39 +0000 (16:28 +0800)]
clk: rockchip: add more clk ids for rv1108

Add new clk ids for the peripherals on rv1108 soc.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
6 years agoclk: meson: gxbb-aoclk: Add CEC 32k clock
Neil Armstrong [Tue, 1 Aug 2017 11:56:59 +0000 (13:56 +0200)]
clk: meson: gxbb-aoclk: Add CEC 32k clock

The CEC 32K AO Clock is a dual divider with dual counter to provide a more
precise 32768Hz clock for the CEC subsystem from the external xtal.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
6 years agoclk: meson: gxbb-aoclk: Switch to regmap for register access
Neil Armstrong [Tue, 1 Aug 2017 11:56:57 +0000 (13:56 +0200)]
clk: meson: gxbb-aoclk: Switch to regmap for register access

Switch the aoclk driver to use the new bindings and switch all the
registers access to regmap only.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
6 years agodt-bindings: clock: amlogic, gxbb-aoclkc: Update bindings
Neil Armstrong [Tue, 1 Aug 2017 11:56:56 +0000 (13:56 +0200)]
dt-bindings: clock: amlogic, gxbb-aoclkc: Update bindings

On the first revision of the bindings, only the gates + resets were known
in the AO Clock HW, but more registers used to configures AO clock are known
to be spread among the AO register space.
This patch adds a parent node for the entire system control zone for the AO
domain then moves the clock controller as a subnode of the system control
node.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
6 years agoclk: meson: gxbb: Add sd_emmc clk0 clocks
Jerome Brunet [Mon, 31 Jul 2017 11:56:03 +0000 (13:56 +0200)]
clk: meson: gxbb: Add sd_emmc clk0 clocks

Input source 0 of the mmc controllers is not directly xtal, as currently
described in DT. Each controller is fed by a composite clock (the usual
mux, divider and gate). The muxes inputs are the xtal (default) and the
fclk_div clocks. These parents, along with the divider, should be able to
provide the necessary rates for mmc and nand operation.

The input muxes should also be able to take mpll2, mpll3 and gp0_pll but
these are precious clocks, needed for other usage. It is better if the
mmc does not use these them. For this reason, mpll2, mpll3 and gp0_pll is
not listed among the possible parents.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
6 years agoclk: meson: gxbb: fix clk_mclk_i958 divider flags
Jerome Brunet [Thu, 27 Jul 2017 13:09:40 +0000 (15:09 +0200)]
clk: meson: gxbb: fix clk_mclk_i958 divider flags

CLK_DIVIDER_ROUND_CLOSEST was incorrectly put in the hw.init flags
while it should have been in the divider flags

Fixes: 3c277c247eab ("clk: meson: gxbb: add cts_mclk_i958")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
6 years agoclk: meson: gxbb: fix meson cts_amclk divider flags
Jerome Brunet [Thu, 27 Jul 2017 13:09:39 +0000 (15:09 +0200)]
clk: meson: gxbb: fix meson cts_amclk divider flags

CLK_DIVIDER_ROUND_CLOSEST was incorrectly put in the hw.init flags
while it should have been in the divider flags

Fixes: 4087bd4b2170 ("clk: meson: gxbb: add cts_amclk")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
6 years agoclk: meson: meson8b: register the built-in reset controller
Martin Blumenstingl [Fri, 28 Jul 2017 21:13:12 +0000 (23:13 +0200)]
clk: meson: meson8b: register the built-in reset controller

The clock controller also includes some reset lines. This patch
implements a reset controller to assert and de-assert these resets.
The reset controller itself is registered early (through
CLK_OF_DECLARE_DRIVER) because it is needed very early in the boot
process (to start the secondary CPU cores).

According to the public S805 datasheet there are two more reset bits
in the HHI_SYS_CPU_CLK_CNTL0 register, which are not implemented by
this patch (as these seem to be unused in Amlogic's vendor Linux kernel
sources and their u-boot tree):
- bit 15: GEN_DIV_SOFT_RESET
- bit 14: SOFT_RESET

All information was taken from the public S805 Datasheet and Amlogic's
vendor GPL kernel sources. This patch is based on an earlier version
submitted by Carlo Caione.

Suggested-by: Carlo Caione <carlo@endlessm.com>
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
6 years agodt-bindings: clock: gxbb-aoclk: Add CEC 32k clock
Neil Armstrong [Tue, 1 Aug 2017 11:56:58 +0000 (13:56 +0200)]
dt-bindings: clock: gxbb-aoclk: Add CEC 32k clock

This patchadds the clock binding entry for the CEC 32K AO Clock.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
6 years agoclk: meson: gxbb: Add sd_emmc clk0 clkids
Jerome Brunet [Mon, 31 Jul 2017 11:56:02 +0000 (13:56 +0200)]
clk: meson: gxbb: Add sd_emmc clk0 clkids

Add the clkids for the clocks feeding the input0 of the mmc controllers

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
6 years agoclk: meson-gxbb: expose almost every clock in the bindings
Jerome Brunet [Mon, 31 Jul 2017 11:38:32 +0000 (13:38 +0200)]
clk: meson-gxbb: expose almost every clock in the bindings

Expose all clocks which maybe used as DT bindings
Only clock ids internal the controller remain un-exposed

Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
6 years agoclk: meson8b: expose every clock in the bindings
Jerome Brunet [Mon, 31 Jul 2017 11:38:31 +0000 (13:38 +0200)]
clk: meson8b: expose every clock in the bindings

Expose all clocks which maybe used as DT bindings
Only clock ids internal the controller remain un-exposed (none on this
particular controller at the moment)

Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
6 years agoclk: meson: gxbb: fix protection against undefined clks
Jerome Brunet [Thu, 27 Jul 2017 16:17:55 +0000 (18:17 +0200)]
clk: meson: gxbb: fix protection against undefined clks

gxbb clock driver gracefully handles case where the clkid is defined but
the clock hw pointer is not provided, as long as it is not at the end of
the hw_onecell_data array.

This patch ensure that the last entries are defined as well to handle
this particular case.

Fixes: a70c6e06ed7c ("clk: meson: gxbb: protect against holes in the onecell_data array")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
6 years agoclk: meson: meson8b: fix protection against undefined clks
Jerome Brunet [Thu, 27 Jul 2017 16:17:54 +0000 (18:17 +0200)]
clk: meson: meson8b: fix protection against undefined clks

meson8b clock driver gracefully handles case where the clkid is defined
but the clock hw pointer is not provided, as long as it is not at the end
of the hw_onecell_data array.

This patch ensure that the last entries are defined as well to handle
this particular case.

Fixes: e92f7cca446e ("clk: meson8b: clean up fixed rate clocks")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
6 years agoclk: sunxi-ng: allow set parent clock (PLL_CPUX) for CPUX clock on H3
Icenowy Zheng [Sun, 23 Jul 2017 10:27:45 +0000 (18:27 +0800)]
clk: sunxi-ng: allow set parent clock (PLL_CPUX) for CPUX clock on H3

The CPUX clock, which is the main clock of the ARM core on Allwinner H3,
can be adjusted by changing the frequency of the PLL_CPUX clock.

Allowing setting parent clock for the CPUX clock, thus the PLL_CPUX
clock can be adjusted when adjusting the CPUX clock.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Fixes: 0577e4853bfb ("clk: sunxi-ng: Add H3 clocks")
Signed-off-by: Chen-Yu Tsai <wens@csie.org>