cascardo/linux.git
7 years agoclk: zx: fix pointer case warnings
Arnd Bergmann [Thu, 15 Sep 2016 15:45:57 +0000 (17:45 +0200)]
clk: zx: fix pointer case warnings

The zx296718 clock driver has a creative way of assigning the register
values for each clock, by initializing an __iomem pointer to an
offset and then later adding the base (from ioremap) on top
with a cast to u64. This fail on all 32-bit architectures during
compile testing:

drivers/clk/zte/clk-zx296718.c: In function 'top_clocks_init':
drivers/clk/zte/clk-zx296718.c:554:35: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
   zx296718_pll_clk[i].reg_base += (u64)reg_base;
drivers/clk/zte/clk-zx296718.c:579:29: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
drivers/clk/zte/clk-zx296718.c:592:31: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]

It would be nice to avoid all the casts, but I decided to simply
shut up the warnings by changing the type from u64 to uintptr_t,
which does the right thing in practice.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: ca0233285a93 ("clk: zx: register ZX296718 clocks")
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk/Renesas-MSTP: Use kmalloc_array() in cpg_mstp_clocks_init()
Markus Elfring [Wed, 14 Sep 2016 19:10:47 +0000 (21:10 +0200)]
clk/Renesas-MSTP: Use kmalloc_array() in cpg_mstp_clocks_init()

A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: zx296718: use builtin_platform_driver to simplify the code
Wei Yongjun [Fri, 16 Sep 2016 13:03:31 +0000 (13:03 +0000)]
clk: zx296718: use builtin_platform_driver to simplify the code

Use the builtin_platform_driver() macro to make the code simpler.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: sunxi-ng: sun6i-a31: Fix register offset for mipi-csi clk
Chen-Yu Tsai [Thu, 15 Sep 2016 06:57:40 +0000 (14:57 +0800)]
clk: sunxi-ng: sun6i-a31: Fix register offset for mipi-csi clk

The register offset for the mipi-csi clk is off by 4, a copy paste
error from the mipi-dsi clk.

Fixes: c6e6c96d8fa6 ("clk: sunxi-ng: Add A31/A31s clocks")
Signed-off-by: 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: sunxi-ng: sun6i-a31: set CLK_SET_RATE_UNGATE for all PLLs
Chen-Yu Tsai [Thu, 15 Sep 2016 06:57:39 +0000 (14:57 +0800)]
clk: sunxi-ng: sun6i-a31: set CLK_SET_RATE_UNGATE for all PLLs

The PLLs have a "lock" bit in their configuration registers which
indicate if the PLL has locked on to the requested clock rate. We
check this bit in the .set_rate op. The PLL cannot lock on if it's
not running, which might be a false positive (warning).

Set the CLK_SET_RATE_UNGATE flag for all PLLs so whenever clk_set_rate
is called on them, they get enabled and the "lock" check is really
checking the PLL.

Fixes: c6e6c96d8fa6 ("clk: sunxi-ng: Add A31/A31s clocks")
Signed-off-by: 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: sunxi-ng: sun6i-a31: Set CLK_SET_RATE_PARENT for display output clocks
Chen-Yu Tsai [Thu, 15 Sep 2016 06:57:38 +0000 (14:57 +0800)]
clk: sunxi-ng: sun6i-a31: Set CLK_SET_RATE_PARENT for display output clocks

The LCD controller and HDMI controller use the LCDx-CHy and HDMI clocks
to generate their dot clocks. To be able to generate a full range of
possible clock rates, the parent PLL clock rates should also be changed.

Fixes: c6e6c96d8fa6 ("clk: sunxi-ng: Add A31/A31s clocks")
Signed-off-by: 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 agodrivers: clk: st: Handle clk synchronous mode for video clocks
Gabriel Fernandez [Mon, 29 Aug 2016 12:26:58 +0000 (14:26 +0200)]
drivers: clk: st: Handle clk synchronous mode for video clocks

This patch configures the semi-synchronous mode of the video clocks
of clkgenD2.

Signed-off-by: Olivier Bideau <olivier.bideau@st.com>
Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agodrivers: clk: st: Add clock propagation for audio clocks
Gabriel Fernandez [Mon, 29 Aug 2016 12:26:57 +0000 (14:26 +0200)]
drivers: clk: st: Add clock propagation for audio clocks

This patch allows fine tuning of the quads FS for audio clocks
accuracy.

Signed-off-by: Olivier Bideau <olivier.bideau@st.com>
Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agodrivers: clk: st: Add fs660c32 synthesizer algorithm
Gabriel Fernandez [Mon, 29 Aug 2016 12:26:56 +0000 (14:26 +0200)]
drivers: clk: st: Add fs660c32 synthesizer algorithm

Use an algorithm instead of a table to compute clocks for fs660c32
synthesizer.
During a video playback we need to adjust audio & video frequencies.
A table can't cover all HDMI resolutions and audio adjustment.

Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agodrivers: clk: st: Simplify clock binding of STiH4xx platforms
Gabriel Fernandez [Mon, 29 Aug 2016 12:26:54 +0000 (14:26 +0200)]
drivers: clk: st: Simplify clock binding of STiH4xx platforms

This patch reworks the clock binding to avoid too much detail in DT.
Now we have only compatible string per type of clock
(remark from Rob https://lkml.org/lkml/2016/5/25/492)

Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agodrivers: clk: st: Remove stih415-416 clock support
Gabriel Fernandez [Mon, 29 Aug 2016 12:26:53 +0000 (14:26 +0200)]
drivers: clk: st: Remove stih415-416 clock support

STiH415 and STiH416 platforms are no longer used.
these platforms will be deprecated for the next kernel.

Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
Acked-by: Rob Herring <robh@kernel.org>
Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: at91: Migrate to clk_hw based registration and OF APIs
Stephen Boyd [Wed, 1 Jun 2016 21:31:22 +0000 (14:31 -0700)]
clk: at91: Migrate to clk_hw based registration and OF APIs

Now that we have clk_hw based provider APIs to register clks, we
can get rid of struct clk pointers in this driver, allowing us to
move closer to a clear split of consumer and provider clk APIs.

Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Tested-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: bcm2835: Migrate to clk_hw based registration and OF APIs
Stephen Boyd [Wed, 1 Jun 2016 23:15:03 +0000 (16:15 -0700)]
clk: bcm2835: Migrate to clk_hw based registration and OF APIs

Now that we have clk_hw based provider APIs to register clks, we
can get rid of struct clk pointers while registering clks in
these drivers, allowing us to move closer to a clear split of
consumer and provider clk APIs.

Cc: Eric Anholt <eric@anholt.net>
Cc: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
7 years agoclk: iproc: Make clocks visible options
Jon Mason [Thu, 29 Oct 2015 20:44:10 +0000 (16:44 -0400)]
clk: iproc: Make clocks visible options

Make the clocks visible options that can be selected by anyone.  This
avoids the problems of:
 1) Select is a reverse dependency and is hard for people to understand
    and can sometimes be a pain to track down
 2) Build coverage goes down because configs are hidden
 3) Code bloat

Patch suggested by Stephen Boyd

Signed-off-by: Jon Mason <jonmason@broadcom.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: xgene: Add PMD clock
Hoan Tran [Mon, 12 Sep 2016 18:23:24 +0000 (11:23 -0700)]
clk: xgene: Add PMD clock

Add X-Gene PMD clock support.

PMD clock is implemented for a single register field.
  Output rate = parent_rate * (denominator - scale) / denominator
with
  - denominator = bitmask of register field + 1
  - scale = values of register field

For example, for bitmask is 0x7, denominator will be 8 and scale
will be computed and programmed accordingly.

Signed-off-by: Hoan Tran <hotran@apm.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoDocumentation: dt: xgene: Add PMD clock binding
Hoan Tran [Mon, 12 Sep 2016 18:23:23 +0000 (11:23 -0700)]
Documentation: dt: xgene: Add PMD clock binding

Add APM X-Gene clock binding documentation for PMD clock.

Signed-off-by: Hoan Tran <hotran@apm.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoMerge branch 'clk-zte' into clk-next
Stephen Boyd [Wed, 14 Sep 2016 20:52:55 +0000 (13:52 -0700)]
Merge branch 'clk-zte' into clk-next

* clk-zte:
  clk: zx: register ZX296718 clocks
  clk: zx: reform pll config info to ease code extension

7 years agoclk: zx: register ZX296718 clocks
Jun Nie [Tue, 6 Sep 2016 06:02:42 +0000 (14:02 +0800)]
clk: zx: register ZX296718 clocks

The ZX296718 clocks are statically listed and registered. More
clock will be added later.

Signed-off-by: Jun Nie <jun.nie@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: zx: reform pll config info to ease code extension
Jun Nie [Tue, 6 Sep 2016 06:02:41 +0000 (14:02 +0800)]
clk: zx: reform pll config info to ease code extension

Add power down bit and pll lock bit in pll config structure
to ease new SoC support.

Signed-off-by: Jun Nie <jun.nie@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: zx: register ZX296718 clocks
Jun Nie [Tue, 6 Sep 2016 06:02:42 +0000 (14:02 +0800)]
clk: zx: register ZX296718 clocks

The ZX296718 clocks are statically listed and registered. More
clock will be added later.

Signed-off-by: Jun Nie <jun.nie@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: zx: reform pll config info to ease code extension
Jun Nie [Tue, 6 Sep 2016 06:02:41 +0000 (14:02 +0800)]
clk: zx: reform pll config info to ease code extension

Add power down bit and pll lock bit in pll config structure
to ease new SoC support.

Signed-off-by: Jun Nie <jun.nie@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk-kona-setup: Use kmalloc_array() in parent_process()
Markus Elfring [Wed, 14 Sep 2016 18:26:05 +0000 (20:26 +0200)]
clk-kona-setup: Use kmalloc_array() in parent_process()

A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Alex Elder <elder@linaro.org>
[sboyd@codeaurora.org: Save a line]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoARM: clk-imx35: annotate clk enum with number values
Uwe Kleine-König [Thu, 8 Sep 2016 09:30:22 +0000 (11:30 +0200)]
ARM: clk-imx35: annotate clk enum with number values

This helps to decode error messages like:

[    0.000000] i.MX clk 82: register failed with -17

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoARM: clk-imx35: fix name for ckil clk
Uwe Kleine-König [Thu, 8 Sep 2016 09:30:21 +0000 (11:30 +0200)]
ARM: clk-imx35: fix name for ckil clk

This fixes
[    0.000000] i.MX clk 82: register failed with -17
because the name is duplicated.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Fixes: 3713e3f5e927 ("clk: imx35: define two clocks for rtc")
Acked-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: meson: fix CLKID_GCLK_VENCI_INT typo
Arnd Bergmann [Tue, 6 Sep 2016 13:01:10 +0000 (15:01 +0200)]
clk: meson: fix CLKID_GCLK_VENCI_INT typo

The addition of many gate clocks added two entries in an array for
the same value:

drivers/clk/meson/meson8b.c:479:10: error: initialized field overwritten [-Werror=override-init]
   [CLKID_GCLK_VENCI_INT]     = &meson8b_gclk_venci_int.hw,
   [CLKID_GCLK_VENCI_INT]     = &meson8b_gclk_vencp_int.hw,

This was clearly an accident, and since all other identifiers are
listed in the order in which they are defined, I'm changing the
first one to CLKID_GCLK_VENCI_INT0, making it all consistent again.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: e31a1900c1ff ("meson: clk: Add support for clock gates")
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: mmp: add missing header dependencies
Baoyou Xie [Wed, 14 Sep 2016 06:23:28 +0000 (14:23 +0800)]
clk: mmp: add missing header dependencies

We get 1 warning when building kernel with W=1:
drivers/clk/mmp/clk-mmp2.c:75:13: warning: no previous prototype for 'mmp2_clk_init' [-Wmissing-prototypes]

In fact, this function is declared in linux/clk/mmp.h,
so this patch add missing header dependencies.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoMerge tag 'clk-renesas-for-v4.9-tag3' of git://git.kernel.org/pub/scm/linux/kernel...
Stephen Boyd [Wed, 14 Sep 2016 18:15:03 +0000 (11:15 -0700)]
Merge tag 'clk-renesas-for-v4.9-tag3' of git://git./linux/kernel/git/geert/renesas-drivers into clk-next

Pull renesas clk driver updates from Geert Uytterhoeven:

  - External crystal selection for RZ/A1,
  - CMT clocks for R-Car H3 and M3-W,
  - RAVB and Thermal clocks for R-Car M3-W.

* tag 'clk-renesas-for-v4.9-tag3' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers:
  clk: renesas: r8a7796: Add CMT clocks
  clk: renesas: r8a7795: Add CMT clocks
  clk: renesas: r8a7796: Add RAVB clock
  clk: renesas: r8a7796: Add THS/TSC clock
  clk: renesas: rz: Select EXTAL vs USB clock

7 years agomeson: clk: Use builtin_platform_driver to simplify the code
Wei Yongjun [Sat, 10 Sep 2016 12:02:49 +0000 (12:02 +0000)]
meson: clk: Use builtin_platform_driver to simplify the code

Use the builtin_platform_driver() macro to make the code simpler.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoMerge tag 'sunxi-clk-for-4.9' of https://git.kernel.org/pub/scm/linux/kernel/git...
Stephen Boyd [Wed, 14 Sep 2016 18:10:15 +0000 (11:10 -0700)]
Merge tag 'sunxi-clk-for-4.9' of https://git./linux/kernel/git/mripard/linux into clk-next

Pull Allwinner clock driver changes from Maxime Ripard:

Four more SoCs converted to the new clock framework (A31, A31s, A23 and
A33).

* tag 'sunxi-clk-for-4.9' of https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux:
  clk: sunxi-ng: Add hardware dependency
  clk: sunxi-ng: Add A23 CCU
  clk: sunxi-ng: Add A33 CCU support
  clk: sunxi-ng: Add N-class clocks support
  clk: sunxi-ng: mux: Add mux table macro
  clk: sunxi-ng: div: Allow to set a maximum
  clk: sunxi-ng: div: Add kerneldoc for the _ccu_div structure
  clk: sunxi-ng: div: Add mux table macros
  clk: sunxi-ng: Add A31/A31s clocks
  clk: sunxi-ng: mux: Add clk notifier functions
  clk: sunxi-ng: mux: support fixed pre-dividers on multiple parents
  clk: sunxi-ng: mux: Add support for mux tables
  clk: sunxi-ng: mux: Rename mux macro to be consistent
  clk: sunxi-ng: nkm: Add mux to support multiple parents
  clk: sunxi-ng: mux: Increase fixed pre-divider div size

7 years agoMerge tag 'clk-v4.9-samsung' of git://linuxtv.org/snawrocki/samsung into clk-next
Stephen Boyd [Wed, 14 Sep 2016 18:06:47 +0000 (11:06 -0700)]
Merge tag 'clk-v4.9-samsung' of git://linuxtv.org/snawrocki/samsung into clk-next

Pull samsung clk driver updates from Sylwester Nawrocki:

In addition to a few clean up and code consolidation patches this
includes:
- addition of sound subsystem related clocks for Exynos5410 SoC
  (EPLL, PDMA) and support for "samsung,exynos5410-audss-clock"
  compatible in the clk-exynos-audss driver,
- addition of DRAM controller related clocks for exynos5420,
- MAINTAINERS update adding Chanwoo Choi as the Samsung SoC
  clock drivers co-maintainer.

* tag 'clk-v4.9-samsung' of git://linuxtv.org/snawrocki/samsung:
  clk: samsung: Add support for EPLL on exynos5410
  clk: samsung: clk-exynos-audss: Whitespace and debug trace cleanup
  clk: samsung: clk-exynos-audss: Add exynos5410 compatible
  clk: samsung: clk-exynos-audss: controller variant handling rework
  clk: samsung: Use common registration function for pll2550x
  clk: samsung: exynos5410: Expose the peripheral DMA gate clocks
  clk: samsung: exynos5420: Add clocks for CMU_CDREX domain
  clk: samsung: exynos5410: Use samsung_cmu_register_one() to simplify code
  clk: samsung: exynos5260: Move struct samsung_cmu_info to init section
  MAINTAINERS: Add myself as Samsung SoC clock drivers co-maintainer
  clk: samsung: exynos5410: Add clock IDs for PDMA and EPLL clocks
  clk: samsung: Add clock IDs for the CMU_CDREX (DRAM Express Controller)

7 years agoclk: renesas: r8a7796: Add CMT clocks
Bui Duc Phuc [Fri, 9 Sep 2016 11:43:11 +0000 (20:43 +0900)]
clk: renesas: r8a7796: Add CMT clocks

This patch adds CMT module clocks for r8a7796 SoC.

Signed-off-by: Bui Duc Phuc <bd-phuc@jinso.co.jp>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
7 years agoclk: renesas: r8a7795: Add CMT clocks
Bui Duc Phuc [Fri, 9 Sep 2016 11:43:10 +0000 (20:43 +0900)]
clk: renesas: r8a7795: Add CMT clocks

This patch adds CMT module clocks for r8a7795 SoC.

Signed-off-by: Bui Duc Phuc <bd-phuc@jinso.co.jp>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
7 years agoclk: renesas: r8a7796: Add RAVB clock
Laurent Pinchart [Tue, 6 Sep 2016 13:57:30 +0000 (16:57 +0300)]
clk: renesas: r8a7796: Add RAVB clock

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
7 years agoclk: sunxi-ng: Add hardware dependency
Jean Delvare [Thu, 8 Sep 2016 21:28:29 +0000 (23:28 +0200)]
clk: sunxi-ng: Add hardware dependency

The sunxi-ng clock driver is useless for other architectures.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
7 years agoclk: sunxi-ng: Add A23 CCU
Maxime Ripard [Wed, 31 Aug 2016 14:55:00 +0000 (16:55 +0200)]
clk: sunxi-ng: Add A23 CCU

Add support for the clock unit found in the A23. Due to the similarities
with the A33, it also shares its clock IDs to allow sharing the DTSI.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
7 years agoclk: sunxi-ng: Add A33 CCU support
Maxime Ripard [Wed, 24 Aug 2016 12:10:15 +0000 (14:10 +0200)]
clk: sunxi-ng: Add A33 CCU support

This commit introduces the clocks found in the Allwinner A33 CCU.

Since this SoC is very similar to the A23, and we share a significant share
of the DTSI, the clock IDs that are going to be used will also be shared
with the A23, hence the name of the various header files.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
7 years agoclk: sunxi-ng: Add N-class clocks support
Maxime Ripard [Tue, 30 Aug 2016 08:38:07 +0000 (10:38 +0200)]
clk: sunxi-ng: Add N-class clocks support

Add support for the class with a single factor, N, being a multiplier.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
7 years agoclk: sunxi-ng: mux: Add mux table macro
Maxime Ripard [Tue, 30 Aug 2016 08:38:51 +0000 (10:38 +0200)]
clk: sunxi-ng: mux: Add mux table macro

Add a new macro to declare muxes based on a table and a gate.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
7 years agoclk: sunxi-ng: div: Allow to set a maximum
Maxime Ripard [Tue, 6 Sep 2016 10:29:04 +0000 (12:29 +0200)]
clk: sunxi-ng: div: Allow to set a maximum

Some dividers might have a maximum value that is lower than the width of
the register.

Add a field to _ccu_div to handle those case properly. If the field is set
to 0, the code will assume that the maximum value is the maximum one that
can be used with the field register width.

Otherwise, we'll use whatever value has been set.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
7 years agoclk: sunxi-ng: div: Add kerneldoc for the _ccu_div structure
Maxime Ripard [Thu, 8 Sep 2016 09:29:13 +0000 (11:29 +0200)]
clk: sunxi-ng: div: Add kerneldoc for the _ccu_div structure

The internal _ccu_div structure is meant to be embedded into other
structures to combine the various dividers and to form the clock classes
support.

Start to document those structures by using kerneldoc.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
7 years agoclk: sunxi-ng: div: Add mux table macros
Maxime Ripard [Tue, 30 Aug 2016 08:38:41 +0000 (10:38 +0200)]
clk: sunxi-ng: div: Add mux table macros

Add some macros to ease the declaration of clocks that are using them.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
7 years agoclk: rk808: Pass the right pointer as the get_hw context
Tomeu Vizoso [Fri, 9 Sep 2016 13:25:06 +0000 (15:25 +0200)]
clk: rk808: Pass the right pointer as the get_hw context

Right now we are passing a pointer to a pointer to the structure that
will be used to fetch the clk hw, which gets casted later to a pointer
to the structure, thus getting garbage in the hw structs.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Fixes: a8b6e85db6a6 ("clk: rk808: Migrate to clk_hw based OF and
registration APIs")
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: samsung: Add support for EPLL on exynos5410
Sylwester Nawrocki [Fri, 9 Sep 2016 08:09:05 +0000 (10:09 +0200)]
clk: samsung: Add support for EPLL on exynos5410

This patch adds code instantiating the EPLL, which is used as the
audio subsystem's root clock.
The requirement to specify the external root clock in clocks property
is documented.  Having the consumer 'clocks' property ensures proper
initialization order by explicitly specifying dependencies in DT.
It prevents situations when the SoC's clock controller driver has
initialized, the external oscillator clock is not yet registered
and setting clock frequencies through assigned-clock-rates property
doesn't work properly due to unknown external oscillator frequency.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agoclk: samsung: clk-exynos-audss: Whitespace and debug trace cleanup
Sylwester Nawrocki [Fri, 2 Sep 2016 16:47:54 +0000 (18:47 +0200)]
clk: samsung: clk-exynos-audss: Whitespace and debug trace cleanup

There is no need to log probe() completion in normal conditions
so the "setup completed" log is removed.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
7 years agoclk: samsung: clk-exynos-audss: Add exynos5410 compatible
Sylwester Nawrocki [Fri, 2 Sep 2016 16:47:45 +0000 (18:47 +0200)]
clk: samsung: clk-exynos-audss: Add exynos5410 compatible

Exynos5410 Audio Subsystem Clock Controller, comparing to the already
supported IP block revisions, has additionally an I2S_MST divider
so a new compatible string is added.
It is not clear from the Exynos5410 User's Manual released on 2012.03.09
where in the clock tree the I2S_MST clock divider can be found exactly
so this clock is left unimplemented for now.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
7 years agoclk: samsung: clk-exynos-audss: controller variant handling rework
Sylwester Nawrocki [Fri, 2 Sep 2016 16:23:47 +0000 (18:23 +0200)]
clk: samsung: clk-exynos-audss: controller variant handling rework

Then variant handling is reworked to make the code simpler when
more variants are added.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
7 years agoclk: samsung: Use common registration function for pll2550x
Sylwester Nawrocki [Thu, 18 Aug 2016 15:01:20 +0000 (17:01 +0200)]
clk: samsung: Use common registration function for pll2550x

There is no such significant differences in pll2550x PLL type
to justify a separate registration function.  This patch adapts
exynos5440 driver to use the common function and removes
samsung_clk_register_pll2550x().

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agoclk: samsung: exynos5410: Expose the peripheral DMA gate clocks
Sylwester Nawrocki [Mon, 22 Aug 2016 09:14:49 +0000 (11:14 +0200)]
clk: samsung: exynos5410: Expose the peripheral DMA gate clocks

These clocks are needed in order to use the PL330 peripheral
DMA controllers.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
7 years agoclk: samsung: exynos5420: Add clocks for CMU_CDREX domain
Chanwoo Choi [Thu, 25 Aug 2016 06:57:17 +0000 (15:57 +0900)]
clk: samsung: exynos5420: Add clocks for CMU_CDREX domain

This patch adds the mux/divider clocks for CMU_CDREX (DRAM Express
Controller) which generates the clocks for DRAM and NoC (Network on Chip)
bus.  There is differnet source of MUX_MX_MSPLL_CCORE between exynos5420
and exynos5422, so each MUX_MX_MSPLL_CCORE uses the different parent source
group.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
7 years agoclk: samsung: exynos5410: Use samsung_cmu_register_one() to simplify code
Chanwoo Choi [Mon, 22 Aug 2016 02:49:45 +0000 (11:49 +0900)]
clk: samsung: exynos5410: Use samsung_cmu_register_one() to simplify code

This patch uses the samsung_cmu_register_one() to simplify code
and move the pll/mux/div/gate data to initconst section.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
7 years agoclk: samsung: exynos5260: Move struct samsung_cmu_info to init section
Chanwoo Choi [Mon, 22 Aug 2016 02:49:44 +0000 (11:49 +0900)]
clk: samsung: exynos5260: Move struct samsung_cmu_info to init section

This patch moves the samsung_cmu_info struct instances to initconst
section, this decreases the kernel image size by 784 bytes, which makes
zImage smaller by 480 bytes.

The patch increases .init.rodata section size by 780 bytes but decreases
.init.text section size by 1564 bytes.

Size of the drivers/clk/samsung/clk-exynos5260.o object file is 29100
bytes without the patch and 28316 after applying the patch.

The section size differences are as below:
15c15
<   3 .init.text    000006b8  00000000  00000000  00000034  2**2
---
>   3 .init.text    0000009c  00000000  00000000  00000034  2**2
25c25
<   8 .init.rodata  00003f6c  00000000  00000000  00002f20  2**2
---
>   8 .init.rodata  00004278  00000000  00000000  00002904  2**2

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
7 years agoMAINTAINERS: Add myself as Samsung SoC clock drivers co-maintainer
Chanwoo Choi [Thu, 18 Aug 2016 12:47:19 +0000 (21:47 +0900)]
MAINTAINERS: Add myself as Samsung SoC clock drivers co-maintainer

Add myself to the SAMSUNG SOC CLOCK DRIVERS entry, I'm going to review
and test related patches as supporter.  I can access all the datasheet
of Exynos SoC series and can do tests on Exynos based boards.  I have
implemented the exynos4415/5433 clock drivers and co-authored the
exynos3250 clock driver.  While at it, add missing paths of the exynos
clock driver files.

Cc: Tomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
7 years agoclk: samsung: exynos5410: Add clock IDs for PDMA and EPLL clocks
Sylwester Nawrocki [Mon, 22 Aug 2016 09:15:39 +0000 (11:15 +0200)]
clk: samsung: exynos5410: Add clock IDs for PDMA and EPLL clocks

The PDMA{0,1} and EPLL clock IDs are added separately in this
patch so the patch can be merged to the arm-soc tree as dependency.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agoclk: samsung: Add clock IDs for the CMU_CDREX (DRAM Express Controller)
Chanwoo Choi [Thu, 25 Aug 2016 06:57:16 +0000 (15:57 +0900)]
clk: samsung: Add clock IDs for the CMU_CDREX (DRAM Express Controller)

This patch adds missing clock IDs for CMU_CDREX (DRAM Express Controller)
which generates clocks for DRAM and NoC (Network on Chip) busses.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
7 years agoMerge branch 'clk-fixes' into clk-next
Stephen Boyd [Thu, 8 Sep 2016 19:57:10 +0000 (12:57 -0700)]
Merge branch 'clk-fixes' into clk-next

* clk-fixes:
  clk: sunxi-ng: Fix wrong reset register offsets
  clk: sunxi-ng: nk: Make ccu_nk_find_best static
  clk: sunxi-ng: Fix inverted test condition in ccu_helper_wait_for_lock
  clk: sunxi: Fix return value check in sun8i_a23_mbus_setup()
  clk: sunxi: pll2: Fix return value check in sun4i_pll2_setup()

7 years agoMerge tag 'sunxi-clk-fixes-for-4.8' of https://git.kernel.org/pub/scm/linux/kernel...
Stephen Boyd [Thu, 8 Sep 2016 19:54:24 +0000 (12:54 -0700)]
Merge tag 'sunxi-clk-fixes-for-4.8' of https://git./linux/kernel/git/mripard/linux into clk-fixes

Clock Fixes for the Allwinner SoCs, 4.8 Edition

The usual bunch of fixes to the our clock drivers, mostly targetted to the
brand new sunxi-ng drivers.

* tag 'sunxi-clk-fixes-for-4.8' of https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux:
  clk: sunxi-ng: Fix wrong reset register offsets
  clk: sunxi-ng: nk: Make ccu_nk_find_best static
  clk: sunxi-ng: Fix inverted test condition in ccu_helper_wait_for_lock
  clk: sunxi: Fix return value check in sun8i_a23_mbus_setup()
  clk: sunxi: pll2: Fix return value check in sun4i_pll2_setup()

7 years agoclk: bcm2835: Skip PLLC clocks when deciding on a new clock parent
Eric Anholt [Wed, 1 Jun 2016 19:05:36 +0000 (12:05 -0700)]
clk: bcm2835: Skip PLLC clocks when deciding on a new clock parent

If the firmware had set up a clock to source from PLLC, go along with
it.  But if we're looking for a new parent, we don't want to switch it
to PLLC because the firmware will force PLLC (and thus the AXI bus
clock) to different frequencies during over-temp/under-voltage,
without notification to Linux.

On my system, this moves the Linux-enabled HDMI state machine and DSI1
escape clock over to plld_per from pllc_per.  EMMC still ends up on
pllc_per, because the firmware had set it up to use that.

Signed-off-by: Eric Anholt <eric@anholt.net>
Fixes: 41691b8862e2 ("clk: bcm2835: Add support for programming the audio domain clocks")
Acked-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: bcm2835: Mark the CM SDRAM clock's parent as critical
Eric Anholt [Wed, 1 Jun 2016 19:05:35 +0000 (12:05 -0700)]
clk: bcm2835: Mark the CM SDRAM clock's parent as critical

While the SDRAM is being driven by its dedicated PLL most of the time,
there is a little loop running in the firmware that periodically turns
on the CM SDRAM clock (using its pre-initialized parent) and switches
SDRAM to using the CM clock to do PVT recalibration.

This avoids system hangs if we choose SDRAM's parent for some other
clock, then disable that clock.

Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: bcm2835: Mark GPIO clocks enabled at boot as critical
Eric Anholt [Wed, 1 Jun 2016 19:05:34 +0000 (12:05 -0700)]
clk: bcm2835: Mark GPIO clocks enabled at boot as critical

These divide off of PLLD_PER and are used for the ethernet and wifi
PHYs source PLLs.  Neither of them is currently represented by a phy
device that would grab the clock for us.

This keeps other drivers from killing the networking PHYs when they
disable their own clocks and trigger PLLD_PER's refcount going to 0.

Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: bcm2835: Mark the VPU clock as critical
Eric Anholt [Wed, 1 Jun 2016 19:05:33 +0000 (12:05 -0700)]
clk: bcm2835: Mark the VPU clock as critical

The VPU clock is also the clock for our AXI bus, so we really can't
disable it.  This might have happened during boot if, for example,
uart1 (aux_uart clock) probed and was then disabled before the other
consumers of the VPU clock had probed.

Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoMerge tag 'v4.9-rockchip-clk1' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind...
Stephen Boyd [Wed, 7 Sep 2016 01:12:24 +0000 (18:12 -0700)]
Merge tag 'v4.9-rockchip-clk1' of git://git./linux/kernel/git/mmind/linux-rockchip into clk-next

Pull rockchip clk driver updates from Heiko Stuebner:

The biggest addition is probably the special clock-type for ddr clock
control. While reading that clock is done the normal way from the
registers, setting it always requires some sort of special handling
to let the system survive this addition.

As the commit message explains, there are currently 3 handling-types
known. General SRAM-based code on rk3288 and before (which is waiting
essentially for the PIE support that is currently being worked on),
SCPI-based clk setting on the rk3368 through a coprocessor, which we
might support once the support for legacy scpi-variants has matured
and now on the rk3399 (and probably later) using a dcf controller that
is controlled from the arm-trusted-firmware and gets accessed through
firmware calls from the kernel. This is the variant we currently
support, but the clock type is made to support the other variants in
the future as well.

Apart from that slightly bigger chunk, we have a mix of PLL rates,
clock-ids and flags mainly for the rk3399.

And interestingly an iomap fix for the legacy gate driver, where I
hopefully could deter the submitter from actually using that in any
new works.

* tag 'v4.9-rockchip-clk1' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip:
  clk: rockchip: use the dclk_vop_frac clock ids on rk3399
  clk: rockchip: drop CLK_SET_RATE_PARENT from rk3399 fractional dividers
  clk: rockchip: add 2016M to big cpu clk rate table on rk3399
  clk: rockchip: add rk3399 ddr clock support
  clk: rockchip: add dclk_vop_frac ids for rk3399 vop
  clk: rockchip: add new clock-type for the ddrclk
  soc: rockchip: add header for ddr rate SIP interface
  clk: rockchip: add SCLK_DDRC id for rk3399 ddrc
  clk: rockchip: handle of_iomap failures in legacy clock driver
  clk: rockchip: mark rk3399 hdcp_noc and vio_noc as critical
  clk: rockchip: use general clock flag when registering pll
  clk: rockchip: delete the CLK_IGNORE_UNUSED from aclk_pcie on rk3399
  clk: rockchip: add 65MHz and 106.5MHz rates to rk3399 plls used for HDMI

7 years agoMAINTAINERS: Add section for Renesas clock drivers
Geert Uytterhoeven [Wed, 31 Aug 2016 09:49:30 +0000 (11:49 +0200)]
MAINTAINERS: Add section for Renesas clock drivers

Add a section for Renesas clock drivers, as found on Renesas ARM SoCs,
and list myself as the maintainer.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: renesas: r8a7796: Add THS/TSC clock
Khiem Nguyen [Sat, 3 Sep 2016 06:06:49 +0000 (06:06 +0000)]
clk: renesas: r8a7796: Add THS/TSC clock

Signed-off-by: Khiem Nguyen <khiem.nguyen.xt@renesas.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
7 years agoclk: renesas: rz: Select EXTAL vs USB clock
Chris Brandt [Fri, 2 Sep 2016 02:32:25 +0000 (22:32 -0400)]
clk: renesas: rz: Select EXTAL vs USB clock

Check the MD_CLK pin to determine the current clock mode in order to set
the pll clock parent correctly.

Signed-off-by: Chris Brandt <chris.brandt@renesas.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
7 years agoclk: rockchip: use the dclk_vop_frac clock ids on rk3399
Yakir Yang [Fri, 2 Sep 2016 03:26:25 +0000 (20:26 -0700)]
clk: rockchip: use the dclk_vop_frac clock ids on rk3399

Export the dclk_vop_frac out, so we can set the dclk_vop as the
child of dclk_vop_frac, and then we can start to take use of
the fractional dividers.

Signed-off-by: Yakir Yang <ykk@rock-chips.com>
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
7 years agoclk: rockchip: drop CLK_SET_RATE_PARENT from rk3399 fractional dividers
Douglas Anderson [Fri, 2 Sep 2016 03:26:23 +0000 (20:26 -0700)]
clk: rockchip: drop CLK_SET_RATE_PARENT from rk3399 fractional dividers

Currently the fractional divider clock time can't handle the
CLK_SET_RATE_PARENT flag. This is because, unlike normal dividers,
there is no clk_divider_bestdiv() function to try speeding up the parent
to see if it helps things.

Eventually someone could try to figure out how to make fractional
dividers able to use CLK_SET_RATE_PARENT, but until they do let's not
confuse the common clock framework (and anyone using it) by setting the
flag.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
7 years agoclk: rockchip: add 2016M to big cpu clk rate table on rk3399
Shunqian Zheng [Wed, 31 Aug 2016 23:06:22 +0000 (07:06 +0800)]
clk: rockchip: add 2016M to big cpu clk rate table on rk3399

We would prefer the 2016M as 2.0G than 1992M which seems odd, adding
it to big cpu clk rate table then we can set 2016M in dts.

Signed-off-by: Shunqian Zheng <zhengsq@rock-chips.com>
Reviewed-by: Xing Zheng <zhengxing@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
7 years agoclk: rockchip: add rk3399 ddr clock support
Lin Huang [Mon, 22 Aug 2016 03:36:19 +0000 (11:36 +0800)]
clk: rockchip: add rk3399 ddr clock support

add ddrc clock setting, so we can do ddr frequency
scaling on rk3399 platform in future.

Signed-off-by: Lin Huang <hl@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
7 years agoMerge branch 'v4.9-shared/clkids' into v4.9-clk/next
Heiko Stuebner [Sun, 4 Sep 2016 20:57:55 +0000 (22:57 +0200)]
Merge branch 'v4.9-shared/clkids' into v4.9-clk/next

7 years agoclk: rockchip: add dclk_vop_frac ids for rk3399 vop
Yakir Yang [Fri, 2 Sep 2016 03:26:24 +0000 (20:26 -0700)]
clk: rockchip: add dclk_vop_frac ids for rk3399 vop

Export the dclk_vop_frac out, so we can set the dclk_vop as the
child of dclk_vop_frac, and then we can start to take use of
the fractional dividers.

Signed-off-by: Yakir Yang <ykk@rock-chips.com>
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
7 years agoMerge branch 'clk-meson-gxbb' into clk-next
Michael Turquette [Sat, 3 Sep 2016 01:13:40 +0000 (18:13 -0700)]
Merge branch 'clk-meson-gxbb' into clk-next

7 years agoclk: meson-gxbb: Export PWM related clocks for DT
Neil Armstrong [Mon, 22 Aug 2016 12:49:37 +0000 (14:49 +0200)]
clk: meson-gxbb: Export PWM related clocks for DT

Add the PWM related clocks in order to be referenced as PWM source
clocks.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
Link: lkml.kernel.org/r/1471870177-10609-1-git-send-email-narmstrong@baylibre.com

7 years agomeson: clk: Add support for clock gates
Alexander Müller [Sat, 27 Aug 2016 17:40:54 +0000 (19:40 +0200)]
meson: clk: Add support for clock gates

This patch adds support for the meson8b clock gates. Most of
them are disabled by Amlogic U-Boot, but need to be enabled
for ethernet, USB and many other components.

Signed-off-by: Alexander Müller <serveralex@gmail.com>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
Link: lkml.kernel.org/r/1472319654-59048-7-git-send-email-serveralex@gmail.com

7 years agogxbb: clk: Adjust MESON_GATE macro to be shared with meson8b
Alexander Müller [Sat, 27 Aug 2016 17:40:53 +0000 (19:40 +0200)]
gxbb: clk: Adjust MESON_GATE macro to be shared with meson8b

The macro used gxbb_ prefix for clock definitions. In order
to share the macro between gxbb and meson8b, the prefix must
be moved to gxbb.c.

Signed-off-by: Alexander Müller <serveralex@gmail.com>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
Link: lkml.kernel.org/r/1472319654-59048-6-git-send-email-serveralex@gmail.com

7 years agoclk: meson: Copy meson8b CLKID defines to private header file
Alexander Müller [Sat, 27 Aug 2016 17:40:52 +0000 (19:40 +0200)]
clk: meson: Copy meson8b CLKID defines to private header file

Only expose future CLKID constants if necessary. This patch
removes CLK_NR_CLKS from the DT bindings but leaves all previously
defined CLKIDs there to keep backward compatibility.

Signed-off-by: Alexander Müller <serveralex@gmail.com>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
Link: lkml.kernel.org/r/1472319654-59048-5-git-send-email-serveralex@gmail.com

7 years agomeson: clk: Rename register names according to Amlogic datasheet
Alexander Müller [Sat, 27 Aug 2016 17:40:51 +0000 (19:40 +0200)]
meson: clk: Rename register names according to Amlogic datasheet

Signed-off-by: Alexander Müller <serveralex@gmail.com>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
Link: lkml.kernel.org/r/1472319654-59048-4-git-send-email-serveralex@gmail.com

7 years agomeson: clk: Move register definitions to meson8b.h
Alexander Müller [Sat, 27 Aug 2016 17:40:50 +0000 (19:40 +0200)]
meson: clk: Move register definitions to meson8b.h

Move the register definitions into a separate header file
to reflect the gxbb implementation.

Signed-off-by: Alexander Müller <serveralex@gmail.com>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
Link: lkml.kernel.org/r/1472319654-59048-3-git-send-email-serveralex@gmail.com

7 years agoclk: meson: Rename meson8b-clkc.c to reflect gxbb naming convention
Alexander Müller [Sat, 27 Aug 2016 17:40:49 +0000 (19:40 +0200)]
clk: meson: Rename meson8b-clkc.c to reflect gxbb naming convention

Signed-off-by: Alexander Müller <serveralex@gmail.com>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
Link: lkml.kernel.org/r/1472319654-59048-2-git-send-email-serveralex@gmail.com

7 years agoMerge remote-tracking branch 'clk/clk-meson-gxbb-ao' into clk-meson-gxbb
Michael Turquette [Fri, 2 Sep 2016 00:31:33 +0000 (17:31 -0700)]
Merge remote-tracking branch 'clk/clk-meson-gxbb-ao' into clk-meson-gxbb

7 years agoclk: rockchip: add new clock-type for the ddrclk
Lin Huang [Mon, 22 Aug 2016 03:36:17 +0000 (11:36 +0800)]
clk: rockchip: add new clock-type for the ddrclk

Changing the rate of the DDR clock needs special care, as the DDR
is of course in use and will react badly if the rate changes under it.

Over time different approaches to handle that were used.

Past SoCs like the rk3288 and before would store some code in SRAM
while the rk3368 used a SCPI variant and let a coprocessor handle that.

New rockchip platforms like the rk3399 have a dcf controller to do ddr
frequency scaling, and support for this controller will be implemented
in the arm-trusted-firmware.

This new clock-type should over time handle all these methods for
handling DDR rate changes, but right now it will concentrate on the
SIP interface used to talk to ARM trusted firmware.

The SIP interface counterpart was merged from pull-request #684 [0]
into the upstream arm-trusted-firmware codebase.

[0] https://github.com/ARM-software/arm-trusted-firmware/pull/684

Signed-off-by: Lin Huang <hl@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
7 years agoMerge branch 'v4.9-shared/sip-hdr' into v4.9-clk/next
Heiko Stuebner [Thu, 1 Sep 2016 09:14:36 +0000 (11:14 +0200)]
Merge branch 'v4.9-shared/sip-hdr' into v4.9-clk/next

7 years agosoc: rockchip: add header for ddr rate SIP interface
Lin Huang [Mon, 22 Aug 2016 03:36:17 +0000 (11:36 +0800)]
soc: rockchip: add header for ddr rate SIP interface

Add a header for the SIP interface defined to access the dcf controller
handling ddr rate changes on rk3399 (and most likely later socs).

This interface is shared between the clock driver as well as the
devfreq driver.

The SIP interface counterpart was merged from pull-request #684 [0]
into the upstream arm-trusted-firmware codebase.

[0] https://github.com/ARM-software/arm-trusted-firmware/pull/684

Signed-off-by: Lin Huang <hl@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
7 years agoclk: rockchip: add SCLK_DDRC id for rk3399 ddrc
Lin Huang [Mon, 22 Aug 2016 03:36:18 +0000 (11:36 +0800)]
clk: rockchip: add SCLK_DDRC id for rk3399 ddrc

Add the needed id for the ddr clock.

Signed-off-by: Lin Huang <hl@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
7 years agoclk: imx7d: Add PLL_AUDIO_TEST_DIV/POST_DIV clocks
Fabio Estevam [Tue, 30 Aug 2016 17:34:01 +0000 (14:34 -0300)]
clk: imx7d: Add PLL_AUDIO_TEST_DIV/POST_DIV clocks

Currently we see the following error when using the SAI audio
driver on mx7:

Division by zero in kernel.
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.8.0-rc3-next-20160823
Hardware name: Freescale i.MX7 Dual (Device Tree)
Backtrace:
[<c010b70c>] (dump_backtrace) from [<c010b8a8>] (show_stack+0x18)
r6:60000013 r5:ffffffff r4:00000000 r3:00000000
[<c010b890>] (show_stack) from [<c03e9324>] (dump_stack+0xb0/0xe)
[<c03e9274>] (dump_stack) from [<c010b578>] (__div0+0x18/0x20)
r8:00000000 r7:ffffffff r6:ffffffff r5:00000000 r4:00000000 r3:0
[<c010b560>] (__div0) from [<c03e795c>] (Ldiv0_64+0x8/0x18)
[<c06cd860>] (divider_get_val) from [<c06cda28>] (clk_divider_se)

This error happens due to the lack of definition of the
IMX7D_PLL_AUDIO_TEST_DIV/IMX7D_PLL_AUDIO_POST_DIV clocks.

Add support for them.

Tested on a imx7s-warp board.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: core: Force setting the phase delay when no change
Jean-Francois Moine [Wed, 24 Aug 2016 06:32:51 +0000 (08:32 +0200)]
clk: core: Force setting the phase delay when no change

This patch reverts commit 023bd7166be0 ("clk: skip unnecessary
set_phase if nothing to do"), fixing two problems:

* in some SoCs, the hardware phase delay depends on the rate ratio of
  the clock and its parent. So, changing this ratio may imply to set
  new hardware values, even if the logical delay is the same.

* when the delay was the same as previously, an error was returned.

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Fixes: 023bd7166be0 ("clk: skip unnecessary set_phase if nothing to do")
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoMerge tag 'clk-renesas-for-v4.9-tag2' of git://git.kernel.org/pub/scm/linux/kernel...
Stephen Boyd [Tue, 30 Aug 2016 18:49:02 +0000 (11:49 -0700)]
Merge tag 'clk-renesas-for-v4.9-tag2' of git://git./linux/kernel/git/geert/renesas-drivers into clk-next

Pull renesas r8a7796 SDHI clock support from Geert Uytterhoeven:

Add all clocks needed to use the SDHI interfaces on the Renesas R-Car M3-W
(r8a7796) SoC.

* tag 'clk-renesas-for-v4.9-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers:
  clk: renesas: r8a7796: Add SDIF clocks
  clk: renesas: r8a7796: Add GPIO clocks

7 years agoMerge branch 'clk-fixes' into clk-next
Stephen Boyd [Tue, 30 Aug 2016 00:09:43 +0000 (17:09 -0700)]
Merge branch 'clk-fixes' into clk-next

* clk-fixes:
  clk: rockchip: mark aclk_emmc_noc as a critical clock on rk3399
  clk: rockchip: fix incorrect GATE bits for {c, g}pll_aclk_perihp_src on rk3399
  clk: rockchip: fix incorrect aclk_emmc source gate bits on rk3399
  clk: rockchip: fix rk3399 aclk_vio gate bit

7 years agoMerge tag 'v4.8-rockchip-clk-fixes1' of git://git.kernel.org/pub/scm/linux/kernel...
Stephen Boyd [Tue, 30 Aug 2016 00:08:35 +0000 (17:08 -0700)]
Merge tag 'v4.8-rockchip-clk-fixes1' of git://git./linux/kernel/git/mmind/linux-rockchip into clk-fixes

Some fixes for rk3399 register errors that revealed themself
during actual use.

* tag 'v4.8-rockchip-clk-fixes1' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip:
  clk: rockchip: mark aclk_emmc_noc as a critical clock on rk3399
  clk: rockchip: fix incorrect GATE bits for {c, g}pll_aclk_perihp_src on rk3399
  clk: rockchip: fix incorrect aclk_emmc source gate bits on rk3399
  clk: rockchip: fix rk3399 aclk_vio gate bit

7 years agoclk: versatile/icst: support for AP baseboard clocks
Linus Walleij [Sat, 27 Aug 2016 12:01:19 +0000 (14:01 +0200)]
clk: versatile/icst: support for AP baseboard clocks

This adds support for the two ICST525-based clocks on the
Integrator/AP baseboard, as documented in the board manual
"Integrator/AP ASIC Development Motherboard", ARM DUI0098 B,
pages 3-15 thru 3-18.

Cc: Russell King <linux@armlinux.org.uk>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
[sboyd@codeaurora.org: fixed uninitialized val warning]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: sunxi-ng: Fix wrong reset register offsets
Jorik Jonker [Sat, 27 Aug 2016 19:04:33 +0000 (21:04 +0200)]
clk: sunxi-ng: Fix wrong reset register offsets

The reset register offsets for UART*, I2C* and SCR were off by a few bytes.

Signed-off-by: Jorik Jonker <jorik@kippendief.biz>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
7 years agoclk: Simplify __of_clk_get_hw_from_provider()
Stephen Boyd [Thu, 25 Aug 2016 20:35:36 +0000 (13:35 -0700)]
clk: Simplify __of_clk_get_hw_from_provider()

__of_clk_get_hw_from_provider() is confusing because it will
return EPROBE_DEFER if there isn't a ->get() or ->get_hw()
function pointer in a provider. That's just a bug though, and we
used to NULL pointer exception when ->get() was missing anyway,
so let's make this more obvious that they're not optional. The
assumption is that most providers will implement ->get_hw() so we
only fallback to the ->get() function if necessary. This
clarifies the intent and removes any possibility of probe defer
happening if clk providers are buggy.

Reported-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: return unsigned int in dummy non-OF of_clk_get_parent_count()
Rafał Miłecki [Fri, 26 Aug 2016 12:58:07 +0000 (14:58 +0200)]
clk: return unsigned int in dummy non-OF of_clk_get_parent_count()

In the commit 929e7f3bc7b82 ("clk: Make of_clk_get_parent_count() return
unsigned ints") of_clk_get_parent_count has been modified to return
unsigned int. There is also a dummy implementation of the same function
for configs without CONFIG_OF. For the consistency it should be updated
as well.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: sunxi-ng: Add A31/A31s clocks
Chen-Yu Tsai [Thu, 25 Aug 2016 06:21:59 +0000 (14:21 +0800)]
clk: sunxi-ng: Add A31/A31s clocks

Add a new style driver for the clock control unit in Allwinner A31/A31s.

A few clocks are still missing:

    - MIPI PLL's HDMI mode support
    - EMAC clock

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: mux: Add clk notifier functions
Chen-Yu Tsai [Thu, 25 Aug 2016 06:21:58 +0000 (14:21 +0800)]
clk: sunxi-ng: mux: Add clk notifier functions

On sunxi we support cpufreq by changing the clock rate of PLL-CPU.
It's possible the clock output of the PLL goes out of the CPU's
operational limits when the PLL's multipliers / dividers are changed
and it hasn't stabilized yet. This would result in the CPU hanging.

To circumvent this, we temporarily switch the CPU mux clock to another
stable clock before the rate change, and switch it back after the PLL
stabilizes. This is done with clk notifiers registered on the PLL.

This patch adds common functions for notifiers to reparent mux clocks.

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: support fixed pre-dividers on multiple parents
Chen-Yu Tsai [Thu, 25 Aug 2016 06:21:57 +0000 (14:21 +0800)]
clk: sunxi-ng: mux: support fixed pre-dividers on multiple parents

Some clocks on the A31 have fixed pre-dividers on multiple parents.
Add support for them.

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: Add support for mux tables
Chen-Yu Tsai [Thu, 25 Aug 2016 06:21:56 +0000 (14:21 +0800)]
clk: sunxi-ng: mux: Add support for mux tables

Some clock muxes have holes, i.e. invalid or unconnected inputs,
between parent mux values.

Add support for specifying a mux table to map clock parents to
mux values.

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: Rename mux macro to be consistent
Maxime Ripard [Wed, 20 Jul 2016 21:45:35 +0000 (23:45 +0200)]
clk: sunxi-ng: mux: Rename mux macro to be consistent

Rename the internal mux macro to be consistent with the other internal
structure macros.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
7 years agoclk: versatile/icst: add Integrator core module clocks
Linus Walleij [Mon, 22 Aug 2016 09:19:33 +0000 (11:19 +0200)]
clk: versatile/icst: add Integrator core module clocks

The Integrator/AP and Integrator/CP have special derivatives
of the ICST525 control registers, where some bits have been
hardwired but others are possible to adjust, resulting in a
control register that makes it possible to set an even,
desired megahertz value.

The Integrator/AP and Integrator/CP have slightly different
layout so we support them using different compatible
strings.

After adding these clocks, the Integrator-specific cpufreq
driver can be switched over to use the generic operating
point device tree cpufreq driver.

Instead of simply writing a value to the oscillator control
register we switch to the more elaborate method of providing
a bitmask and use regmap_update_bits() to poke the right bits
for the desired frequency, this is needed since these control
registers sometimes control more than one clock.

Cc: Russell King <linux@armlinux.org.uk>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: versatile add DT bindings for the ICST CM variants
Linus Walleij [Mon, 22 Aug 2016 09:19:32 +0000 (11:19 +0200)]
clk: versatile add DT bindings for the ICST CM variants

The Integrator/AP and Integrator/CP core modules have special
versions of the ICST525 interface hardcoding some bits. Create
special compatible strings to identify these variants, also
explain a bit what is going on.

Cc: devicetree@vger.kernel.org
Cc: Russell King <linux@armlinux.org.uk>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
7 years agoclk: gcc-msm8996: add missing pcie phy reset lines
Srinivas Kandagatla [Thu, 25 Aug 2016 11:20:47 +0000 (12:20 +0100)]
clk: gcc-msm8996: add missing pcie phy reset lines

This patch adds missing 2 PCIE common reset lines.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>