firefly-linux-kernel-4.4.55.git
9 years agoclk: Add stubs for of_clk_*() APIs when CONFIG_OF=n
Stephen Boyd [Mon, 26 Oct 2015 18:55:34 +0000 (11:55 -0700)]
clk: Add stubs for of_clk_*() APIs when CONFIG_OF=n

Compiling the versatile clock driver with COMPILE_TEST=y and CONFIG_OF=n
leads to the following error:

   drivers/clk/versatile/clk-sp810.c: In function 'clk_sp810_of_setup':
   drivers/clk/versatile/clk-sp810.c:103:6: error: implicit declaration of
function 'of_clk_parent_fill' [-Werror=implicit-function-declaration]

Silence it by providing stubs APIs for of_clk_parent_fill().
Throw in a stub for of_clk_get_parent_count() too because we're
in the area.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Cc: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: versatile-icst: fix memory leak
Linus Walleij [Fri, 23 Oct 2015 09:36:01 +0000 (11:36 +0200)]
clk: versatile-icst: fix memory leak

A static code checker found a memory leak in the Versatile
ICST code. Fix it.

Fixes: a183da637c52 "clk: versatile: respect parent rate in ICST clock"
Reported-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: Remove clk_{register,unregister}_multiplier()
Stephen Boyd [Wed, 21 Oct 2015 23:26:44 +0000 (16:26 -0700)]
clk: Remove clk_{register,unregister}_multiplier()

These APIs aren't used, so remove them. This can be reverted if
we get a user at some point.

Reviewed-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Suggested-by: Michael Turquette <mturquette@baylibre.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoMerge branch 'clk-iproc' into clk-next
Stephen Boyd [Thu, 22 Oct 2015 00:28:19 +0000 (17:28 -0700)]
Merge branch 'clk-iproc' into clk-next

* clk-iproc:
  clk: iproc: define Broadcom NS2 iProc clock binding
  clk: iproc: define Broadcom NSP iProc clock binding
  clk: ns2: add clock support for Broadcom Northstar 2 SoC
  clk: iproc: Separate status and control variables
  clk: iproc: Split off dig_filter
  clk: iproc: Add PLL base write function
  clk: nsp: add clock support for Broadcom Northstar Plus SoC
  clk: iproc: Add PWRCTRL support
  clk: cygnus: Convert all macros to all caps
  ARM: cygnus: fix link failures when CONFIG_COMMON_CLK_IPROC is disabled

9 years agoclk: iproc: define Broadcom NS2 iProc clock binding
Jon Mason [Thu, 15 Oct 2015 19:48:33 +0000 (15:48 -0400)]
clk: iproc: define Broadcom NS2 iProc clock binding

Document the device tree bindings for Broadcom Northstar 2 architecture
based clock controller

Signed-off-by: Jon Mason <jonmason@broadcom.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: iproc: define Broadcom NSP iProc clock binding
Jon Mason [Thu, 15 Oct 2015 19:48:32 +0000 (15:48 -0400)]
clk: iproc: define Broadcom NSP iProc clock binding

Document the device tree bindings for Broadcom Northstar Plus
architecture based clock controller

Signed-off-by: Jon Mason <jonmason@broadcom.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: ns2: add clock support for Broadcom Northstar 2 SoC
Jon Mason [Thu, 15 Oct 2015 19:48:31 +0000 (15:48 -0400)]
clk: ns2: add clock support for Broadcom Northstar 2 SoC

The Broadcom Northstar 2 SoC is architected under the iProc
architecture. It has the following PLLs: GENPLL SCR, GENPLL SW,
LCPLL DDR, LCPLL Ports, all derived from an onboard crystal.

Signed-off-by: Jon Mason <jonmason@broadcom.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: iproc: Separate status and control variables
Jon Mason [Thu, 15 Oct 2015 19:48:30 +0000 (15:48 -0400)]
clk: iproc: Separate status and control variables

Some PLLs have separate registers for Status and Control.  The means the
pll_base needs to be split into 2 new variables, so that those PLLs can
specify device tree registers for those independently.  Also, add a new
driver flag to identify this presence of the split, and let the driver
know that additional registers need to be used.

Signed-off-by: Jon Mason <jonmason@broadcom.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: iproc: Split off dig_filter
Jon Mason [Thu, 15 Oct 2015 19:48:29 +0000 (15:48 -0400)]
clk: iproc: Split off dig_filter

The PLL loop filter/gain can be located in a separate register on some
SoCs.  Split these off into a separate variable, so that an offset can
be added if necessary.  Also, make the necessary modifications to the
Cygnus and NSP drivers for this change.

Signed-off-by: Jon Mason <jonmason@broadcom.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: iproc: Add PLL base write function
Jon Mason [Thu, 15 Oct 2015 19:48:28 +0000 (15:48 -0400)]
clk: iproc: Add PLL base write function

All writes to the PLL base address must be flushed if the
IPROC_CLK_NEEDS_READ_BACK flag is set.  If we add a function to make the
necessary write and reads, we can make sure that any future code which
makes PLL base writes will do the correct thing.

Signed-off-by: Jon Mason <jonmason@broadcom.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: nsp: add clock support for Broadcom Northstar Plus SoC
Jon Mason [Thu, 15 Oct 2015 19:48:27 +0000 (15:48 -0400)]
clk: nsp: add clock support for Broadcom Northstar Plus SoC

The Broadcom Northstar Plus SoC is architected under the iProc
architecture. It has the following PLLs: ARMPLL, GENPLL, LCPLL0, all
derived from an onboard crystal.

Signed-off-by: Jon Mason <jonmason@broadcom.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: iproc: Add PWRCTRL support
Jon Mason [Thu, 15 Oct 2015 19:48:26 +0000 (15:48 -0400)]
clk: iproc: Add PWRCTRL support

Some iProc SoC clocks use a different way to control clock power, via
the PWRDWN bit in the PLL control register.  Since the PLL control
register is used to access the PWRDWN bit, there is no need for the
pwr_base when this is being used.  A new flag, IPROC_CLK_EMBED_PWRCTRL,
has been added to identify this usage.  We can use the AON interface to
write the values to enable/disable PWRDOWN.

Signed-off-by: Jon Mason <jonmason@broadcom.com>
[sboyd@codeaurora.org: Remove useless parentheses]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: cygnus: Convert all macros to all caps
Jon Mason [Thu, 15 Oct 2015 19:48:25 +0000 (15:48 -0400)]
clk: cygnus: Convert all macros to all caps

The macros that are being used to initialize the values of the clk
structures should be all caps.  Find and replace all of them with their
relevant counterparts.

Signed-off-by: Jon Mason <jonmason@broadcom.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoARM: cygnus: fix link failures when CONFIG_COMMON_CLK_IPROC is disabled
Arnd Bergmann [Thu, 15 Oct 2015 19:48:24 +0000 (15:48 -0400)]
ARM: cygnus: fix link failures when CONFIG_COMMON_CLK_IPROC is disabled

When CONFIG_CYGNUS is set but CONFIG_COMMON_CLK_IPROC is disabled, the
following link failures are caused:

drivers/built-in.o: In function `cygnus_armpll_init':
:(.init.text+0x1d290): undefined reference to `iproc_armpll_setup'
drivers/built-in.o: In function `cygnus_genpll_clk_init':
:(.init.text+0x1d2c4): undefined reference to `iproc_pll_clk_setup'
drivers/built-in.o: In function `cygnus_lcpll0_clk_init':
:(.init.text+0x1d304): undefined reference to `iproc_pll_clk_setup'
drivers/built-in.o: In function `cygnus_mipipll_clk_init':
:(.init.text+0x1d344): undefined reference to `iproc_pll_clk_setup'
drivers/built-in.o: In function `cygnus_asiu_init':
:(.init.text+0x1d370): undefined reference to `iproc_asiu_setup'

It is fixed it by always selecting COMMON_CLK_IPROC from
ARCH_BCM_IPROC, and making COMMON_CLK_IPROC a silent option (thus
preventing it from being erroneously disabled by a user).

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jon Mason <jonmason@broadcom.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoMerge tag 'sunxi-clocks-for-4.4' of https://git.kernel.org/pub/scm/linux/kernel/git...
Stephen Boyd [Wed, 21 Oct 2015 23:29:03 +0000 (16:29 -0700)]
Merge tag 'sunxi-clocks-for-4.4' of https://git./linux/kernel/git/mripard/linux into clk-next

Pull Allwinner clock additions for 4.4 from Maxime Ripard:

  - Support for the Audio PLL and child clocks
  - Support for the A33 AHB gates
  - New clk-multiplier generic driver

* tag 'sunxi-clocks-for-4.4' of https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux:
  clk: sunxi: mod1 clock support
  clk: sunxi: codec clock support
  clk: sunxi: pll2: Add A13 support
  clk: sunxi: Add a driver for the PLL2
  clk: Add a basic multiplier clock
  clk: sunxi: Add A33 gates support

9 years agoclk: imx31: add missing of_node_put
Julia Lawall [Wed, 21 Oct 2015 20:41:39 +0000 (22:41 +0200)]
clk: imx31: add missing of_node_put

for_each_compatible_node performs an of_node_get on each iteration, so a
break out of the loop requires an of_node_put.

The semantic patch that fixes this problem is as follows
(http://coccinelle.lip6.fr):

// <smpl>
@@
local idexpression n;
expression e;
@@

 for_each_compatible_node(n,...) {
   ...
(
   of_node_put(n);
|
   e = n
|
+  of_node_put(n);
?  break;
)
   ...
 }
... when != n
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: imx27: add missing of_node_put
Julia Lawall [Wed, 21 Oct 2015 20:41:38 +0000 (22:41 +0200)]
clk: imx27: add missing of_node_put

for_each_compatible_node performs an of_node_get on each iteration, so a
break out of the loop requires an of_node_put.

The semantic patch that fixes this problem is as follows
(http://coccinelle.lip6.fr):

// <smpl>
@@
local idexpression n;
expression e;
@@

 for_each_compatible_node(n,...) {
   ...
(
   of_node_put(n);
|
   e = n
|
+  of_node_put(n);
?  break;
)
   ...
 }
... when != n
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: si5351: add missing of_node_put
Julia Lawall [Wed, 21 Oct 2015 20:41:37 +0000 (22:41 +0200)]
clk: si5351: add missing of_node_put

for_each_child_of_node performs an of_node_get on each iteration, so
a break out of the loop requires an of_node_put.

A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):

// <smpl>
@@
expression root,e;
local idexpression child;
@@

 for_each_child_of_node(root, child) {
   ... when != of_node_put(child)
       when != e = child
(
   return child;
|
+  of_node_put(child);
?  return ...;
)
   ...
 }
// </smpl>

The resulting puts were manually moved to the end of the function for
conciseness.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: add missing of_node_put
Julia Lawall [Wed, 21 Oct 2015 20:41:36 +0000 (22:41 +0200)]
clk: add missing of_node_put

for_each_matching_node_and_match performs an of_node_get on each iteration,
so a break out of the loop requires an of_node_put.

A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):

// <smpl>
@@
expression e1,e2,e;
local idexpression np;
@@

 for_each_matching_node_and_match(np, e1, e2) {
   ... when != of_node_put(np)
       when != e = np
(
   return np;
|
+  of_node_put(np);
?  return ...;
)
   ...
 }
// </smpl>

Besides the problem identified by the semantic patch, this patch adds an
of_node_get in front of saving np in a field of parent, to account for the
fact that this value will be put on going on to the next element in the
iteration, and then adds of_node_puts in the two loops where the parent
pointer can be freed.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: sunxi: mod1 clock support
Emilio López [Fri, 18 Jul 2014 18:28:02 +0000 (15:28 -0300)]
clk: sunxi: mod1 clock support

The module 1 type of clocks consist of a gate and a mux and are used on
the audio blocks to mux and gate the PLL2 outputs for AC97, IIS or
SPDIF. This commit adds support for them on the sunxi clock driver.

Signed-off-by: Emilio López <emilio@elopez.com.ar>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
9 years agoclk: sunxi: codec clock support
Emilio López [Fri, 18 Jul 2014 18:49:37 +0000 (15:49 -0300)]
clk: sunxi: codec clock support

The codec clock on sun4i, sun5i and sun7i is a simple gate with PLL2 as
parent. Add a driver for such a clock.

Signed-off-by: Emilio López <emilio@elopez.com.ar>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
9 years agoclk: sunxi: pll2: Add A13 support
Maxime Ripard [Mon, 21 Sep 2015 11:32:43 +0000 (13:32 +0200)]
clk: sunxi: pll2: Add A13 support

The A13, unlike the A10 and A20, doesn't use a pass-through exception for
the 0 value in the pre and post dividers, but increments all the values
written in the register by one.

Add an exception for both these cases to handle them nicely.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
9 years agoclk: sunxi: Add a driver for the PLL2
Maxime Ripard [Fri, 18 Jul 2014 18:48:35 +0000 (15:48 -0300)]
clk: sunxi: Add a driver for the PLL2

The PLL2 on the A10 and later SoCs is the clock used for all the audio
related operations.

This clock has a somewhat complex output tree, with three outputs (2X, 4X
and 8X) with a fixed divider from the base clock, and an output (1X) with a
post divider.

However, we can simplify things since the 1X divider can be fixed, and we
end up by having a base clock not exposed to any device (or at least
directly, since the 4X output doesn't have any divider), and 4 fixed
divider clocks that will be exposed.

This clock seems to have been introduced, at least in this form, in the
revision B of the A10, but we don't have any information on the clock used
on the revision A.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
9 years agoclk: Add a basic multiplier clock
Maxime Ripard [Tue, 19 May 2015 20:19:33 +0000 (22:19 +0200)]
clk: Add a basic multiplier clock

Some clocks are using a multiplier component, however, unlike their mux,
gate or divider counterpart, these factors don't have a basic clock
implementation.

This leads to code duplication across platforms that want to use that kind
of clocks, and the impossibility to use the composite clocks with such a
clock without defining your own rate operations.

Create such a driver in order to remove these issues, and hopefully factor
the implementations, reducing code size across platforms and consolidating
the various implementations.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
9 years agoclk: iproc: Fix PLL output frequency calculation
Simran Rai [Mon, 19 Oct 2015 22:27:19 +0000 (15:27 -0700)]
clk: iproc: Fix PLL output frequency calculation

This patch affects the clocks that use fractional ndivider in their
PLL output frequency calculation. Instead of 2^20 divide factor, the
clock's ndiv integer shift was used. Fixed the bug by replacing ndiv
integer shift with 2^20 factor.

Signed-off-by: Simran Rai <ssimran@broadcom.com>
Signed-off-by: Ray Jui <rjui@broadcom.com>
Reviewed-by: Scott Branden <sbranden@broadcom.com>
Fixes: 5fe225c105fd ("clk: iproc: add initial common clock support")
Cc: <stable@vger.kernel.org> # v4.1+
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
9 years agoclk: berlin: bg2: remove CLK_IGNORE_UNUSED flag for sdio clk
Jisheng Zhang [Tue, 20 Oct 2015 11:16:47 +0000 (19:16 +0800)]
clk: berlin: bg2: remove CLK_IGNORE_UNUSED flag for sdio clk

The clocks' properties have been already properly set, so there's no
need to set this flag for sdio0 and sdio1 clk any more.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
9 years agoclk: berlin: bg2q: remove CLK_IGNORE_UNUSED flag for sdio clk
Jisheng Zhang [Tue, 20 Oct 2015 11:16:46 +0000 (19:16 +0800)]
clk: berlin: bg2q: remove CLK_IGNORE_UNUSED flag for sdio clk

Since we have added the necessary two clks' properties in dts, we can
remove the "sdio" clk's CLK_IGNORE_UNUSED flag now.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
9 years agoMerge branch 'clk-shmobile-for-v4.4' of git://git.kernel.org/pub/scm/linux/kernel...
Michael Turquette [Wed, 21 Oct 2015 09:26:51 +0000 (02:26 -0700)]
Merge branch 'clk-shmobile-for-v4.4' of git://git./linux/kernel/git/geert/renesas-drivers into clk-next

9 years agoclk: shmobile: Add r8a7795 CPG Core Clock Definitions
Geert Uytterhoeven [Mon, 12 Oct 2015 09:25:44 +0000 (11:25 +0200)]
clk: shmobile: Add r8a7795 CPG Core Clock Definitions

Add all R-Car H3 Clock Pulse Generator Core Clock Outputs, as listed in
Table 8.2a ("List of Clocks [R-Car H3]") of the R-Car Gen3 datasheet
(rev. 0.5E).

Note that internal CPG clocks (S0, S1, S2, S3, SDSRC, SSPSRC, and
RPCSRC) are not included, as they're used as internal clock sources
only.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Michael Turquette <mturquette@baylibre.com>
Reviewed-by: Magnus Damm <damm+renesas@opensource.se>
9 years agoclk: shmobile: Add new Renesas CPG/MSSR DT bindings
Geert Uytterhoeven [Mon, 12 Oct 2015 09:05:24 +0000 (11:05 +0200)]
clk: shmobile: Add new Renesas CPG/MSSR DT bindings

On Renesas ARM SoCs (SH/R-Mobile, R-Car, RZ), the CPG (Clock Pulse
Generator) and MSSR (Module Standby and Software Reset) blocks are
intimately connected, and share the same register block.

Hence it makes sense to describe these two blocks using a
single device node in DT, instead of using a hierarchical structure with
multiple nodes, using a mix of generic and SoC-specific bindings.

These new DT bindings are intended to replace the existing DT bindings
for CPG core clocks ("renesas,*-cpg-clocks", "renesas,cpg-div6-clock")
and module clocks ("renesas,*-mstp-clocks"), at least for new SoCs.

This will make it easier to add module reset support later, which is
currently not implemented, and difficult to achieve using the existing
bindings due to the intertwined register layout.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Michael Turquette <mturquette@baylibre.com>
Reviewed-by: Magnus Damm <damm+renesas@opensource.se>
9 years agoMerge tag 'tegra-for-4.4-clk' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra...
Michael Turquette [Tue, 20 Oct 2015 15:49:11 +0000 (08:49 -0700)]
Merge tag 'tegra-for-4.4-clk' of git://git./linux/kernel/git/tegra/linux into clk-next

clk: tegra: Changes for v4.4-rc1

This contains a patch that allows the DFLL to use clock rates higher
than 2^31-1 Hz by using the ->determine_rate() operation instead of the
->round_rate() operation. Other than that there's a couple of cleanups
in preparation for Tegra210 support.

9 years agoclk: tegra: Modify tegra_audio_clk_init to accept more plls
Rhyland Klein [Thu, 18 Jun 2015 21:28:17 +0000 (17:28 -0400)]
clk: tegra: Modify tegra_audio_clk_init to accept more plls

tegra_audio_clk_init was written expecting a single PLL to be
passed in directly. Change this to accept an array which will
allow for supporting multiple plls and specifying specific data
about them, like their parent, which may change over time.

Reviewed-by: Benson Leung <bleung@chromium.org>
Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agoclk: tegra: Update struct tegra_clk_pll_params kerneldoc
Thierry Reding [Thu, 18 Jun 2015 21:28:16 +0000 (17:28 -0400)]
clk: tegra: Update struct tegra_clk_pll_params kerneldoc

Benson Leung pointed out that the kerneldoc for this structure has
become stale. Update the field descriptions to match the structure
content.

Reported-by: Benson Leung <bleung@chromium.org>
Acked-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Benson Leung <bleung@chromium.org>
Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agoclk: tegra: Fix comments for structure definitions
Rhyland Klein [Mon, 13 Apr 2015 16:38:17 +0000 (12:38 -0400)]
clk: tegra: Fix comments for structure definitions

Some fields moved from the tegra_clk_pll struct to the tegra_pll_params
struct. Update the struct comments to reflect where the fields really
are.

Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Acked-By: Peter De Schrijver <pdeschrijver@nvidia.com>
Reviewed-by: Benson Leung <bleung@chromium.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agoclk: tegra: dfll: Monitor code is DEBUG_FS only
Thierry Reding [Fri, 14 Aug 2015 10:40:09 +0000 (12:40 +0200)]
clk: tegra: dfll: Monitor code is DEBUG_FS only

The monitor code is used with DEBUG_FS only, so move it into the
corresponding #ifdef block to avoid potential compiler warnings.

Signed-off-by: Thierry Reding <treding@nvidia.com>
9 years agoclk: keystone: fix a trivial typo
Geliang Tang [Sun, 18 Oct 2015 15:31:12 +0000 (23:31 +0800)]
clk: keystone: fix a trivial typo

s/regsiter/register/

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: mvebu: Use of_clk_get_parent_name()
Stephen Boyd [Fri, 16 Oct 2015 23:35:11 +0000 (16:35 -0700)]
clk: mvebu: Use of_clk_get_parent_name()

This reverts commit e79b202c632f24f49f2eb9459b88b5fd9e332263.

Now that we use of_clk_get() inside of_clk_get_parent_name() we
can safely use it here.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: qcom: mmcc-8960: Add DSI related clocks
Archit Taneja [Wed, 14 Oct 2015 12:54:45 +0000 (18:24 +0530)]
clk: qcom: mmcc-8960: Add DSI related clocks

Add rcg and branch clk structs for DSI1 and DSI2 blocks found in MSM8960
and APQ8064. Each DSI instance has 4 pairs of rcg and branch clocks.
Populate arrays mmcc_msm8960_clks and mmcc_apq8064_clks with these clocks.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: qcom: clk-rcg: Add customized clk_ops for DSI RCGs
Archit Taneja [Wed, 14 Oct 2015 12:54:44 +0000 (18:24 +0530)]
clk: qcom: clk-rcg: Add customized clk_ops for DSI RCGs

DSI specific RCG clocks required customized clk_ops. There are
a total of 4 RCGs per DSI block: DSI, BYTE, ESC and PIXEL.

There are a total of 2 clocks coming from the DSI PLL, which serve as
inputs to these RCGs. The BYTE and ESC RCGs are fed by one of the
post dividers of DSI1 or DSI2 PLLs, and the DSI and PIXEL RCGs are fed by
another divider of the PLL.

In each of the 2 groups above, only one of the clocks sets its parent.
These are BYTE RCG and DSI RCG for each of the groups respectively, as
shown in the diagram below.

The DSI and BYTE RCGs serve as bypass clocks. We create a new set of ops
clk_rcg_bypass2_ops, which are like the regular bypass ops, but don't
take in a freq table, since the DSI driver using these clocks is
parent-able.

The PIXEL RCG needs to derive the required pixel clock using dsixpll.
It parses a m/n frac table to retrieve the correct clock.

The ESC RCG doesn't have a frac M/N block, it can just apply a pre-
divider. Its ops simply check if the required clock rate can be
achieved by the pre-divider.

      +-------------------+
      |                   |---dsixpllbyte---o---> To byte RCG
      |                   |                 | (sets parent rate)
      |                   |                 |
      |                   |                 |
      |    DSI 1/2 PLL    |                 |
      |                   |                 o---> To esc RCG
      |                   |                 (doesn't set parent rate)
      |                   |
      |                   |----dsixpll-----o---> To dsi RCG
      +-------------------+                | (sets parent rate)
                             ( x = 1, 2 )  |
                                           |
                                           o---> To pixel rcg
                                           (doesn't set parent rate)

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: xgene: Remove unused setup.h include
Stephen Boyd [Fri, 16 Oct 2015 19:05:07 +0000 (12:05 -0700)]
clk: xgene: Remove unused setup.h include

This include doesn't look to be used, and compiling this file on
arm64 still works, so remove it.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: Allow drivers to build if COMPILE_TEST is enabled
Javier Martinez Canillas [Tue, 13 Oct 2015 14:18:18 +0000 (16:18 +0200)]
clk: Allow drivers to build if COMPILE_TEST is enabled

These drivers only have runtime but no build time dependencies so can be
built for testing purposes if the Kconfig COMPILE_TEST option is enabled.

This is useful to have more build coverage and make sure that drivers are
not affected by changes that could cause build regressions.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Scott Branden <sbranden@broadcom.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: Make clk input parameter of __clk_get_name() const
Geert Uytterhoeven [Fri, 16 Oct 2015 12:35:21 +0000 (14:35 +0200)]
clk: Make clk input parameter of __clk_get_name() const

When calling __clk_get_name() on a const clock:

    warning: passing argument 1 of '__clk_get_name' discards 'const' qualifier from pointer target type
    include/linux/clk-provider.h:613:13: note: expected 'struct clk *' but argument is of type 'const struct clk *'

__clk_get_name() does not modify the passed clock, hence make it const.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: shmobile: mstp: Drop bogus closing parenthesis in error message
Geert Uytterhoeven [Fri, 16 Oct 2015 15:18:27 +0000 (17:18 +0200)]
clk: shmobile: mstp: Drop bogus closing parenthesis in error message

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: shmobile: r8a7778: Make r8a7778_rates[] and r8a7778_divs[] static const
Geert Uytterhoeven [Fri, 16 Oct 2015 15:14:55 +0000 (17:14 +0200)]
clk: shmobile: r8a7778: Make r8a7778_rates[] and r8a7778_divs[] static const

r8a7778_rates[] and r8a7778_divs[] are only used in clk-r8a7778.c, and
never modified.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: Use %u to format unsigned int in of_clk_src_onecell_get()
Geert Uytterhoeven [Fri, 16 Oct 2015 15:12:32 +0000 (17:12 +0200)]
clk: Use %u to format unsigned int in of_clk_src_onecell_get()

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoMerge tag 'imx-clk-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo...
Stephen Boyd [Fri, 16 Oct 2015 18:35:19 +0000 (11:35 -0700)]
Merge tag 'imx-clk-4.4' of git://git./linux/kernel/git/shawnguo/linux into clk-next

Pull i.MX updates from Shawn Guo:

"The i.MX clock updates for 4.4:
 - A couple of fixes on i.MX31 and i.MX35 clock initialization functions
   which makes mxc_timer_init() currently be called twice for DT boot.
 - Increase i.MX6UL AXI bus clock rate to 264MHz which is the optimal
   design target.
 - Add a few missing clocks, ADC clock for i.MX7D, OCOTP clock for
   Vybrid, and SPDIF_GCLK for i.MX6.
 - A series from Lucas to fix early debug UART clock setup.  This is
   currently a one-off fix for i.MX platform, and can be extended to
   become a generic solution later."

* tag 'imx-clk-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux:
  clk: imx6: Add SPDIF_GCLK clock in clock tree
  clk: imx7d: add ADC root clock
  clk: imx31: Do not call mxc_timer_init twice when booting with DT
  clk: imx7d: retain early UART clocks during kernel init
  clk: imx6: retain early UART clocks during kernel init
  clk: imx5: retain early UART clocks during kernel init
  clk: imx35: retain early UART clocks during kernel init
  clk: imx31: retain early UART clocks during kernel init
  clk: imx27: retain early UART clocks during kernel init
  clk: imx25: retain early UART clocks during kernel init
  clk: imx: add common logic to detect early UART usage
  clk: imx35: Do not call mxc_timer_init twice when booting with DT
  clk: clk-vf610: Add clock for Vybrid OCOTP controller
  clk: imx: increase AXI clock rate to 264MHz for i.MX6UL

9 years agoclk: Make of_clk_get_parent_name() robust with #clock-cells = 1
Stephen Boyd [Wed, 14 Oct 2015 21:03:07 +0000 (14:03 -0700)]
clk: Make of_clk_get_parent_name() robust with #clock-cells = 1

If a clock provider has #clock-cells = 1 and we call
of_clk_get_parent_name() on it we may end up returning the name
of the provider node if the provider doesn't have a
clock-output-names property. This doesn't make sense, especially
when you consider that calling of_clk_get_parent_name() on such a
node with different indices will return the same name each time.

Let's try getting the clock from the framework via of_clk_get()
instead, and only fallback to the node name if we have a provider
with #clock-cells = 0. This way, we can't hand out the same name
for different clocks when we don't actually know their names.

Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoMerge branch 'clk-fixes' into clk-next
Stephen Boyd [Thu, 15 Oct 2015 23:13:50 +0000 (16:13 -0700)]
Merge branch 'clk-fixes' into clk-next

* clk-fixes:
  Partially revert "clk: mvebu: Convert to clk_hw based provider APIs"

9 years agoclk: max77802: Update MODULE_AUTHOR() email address
Javier Martinez Canillas [Wed, 14 Oct 2015 11:18:55 +0000 (13:18 +0200)]
clk: max77802: Update MODULE_AUTHOR() email address

The email address listed in MODULE_AUTHOR() no longer exist so to prevent
people to send emails to the old address, replace it with my current one.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoPartially revert "clk: mvebu: Convert to clk_hw based provider APIs"
Stephen Boyd [Wed, 14 Oct 2015 18:23:09 +0000 (11:23 -0700)]
Partially revert "clk: mvebu: Convert to clk_hw based provider APIs"

This partially reverts commit eca61c9ff2588e1df373e61078e1874976315839.

Thomas reports that it causes regressions on Armada XP devices.
This is because of_clk_get_parent_name() relies on the property
'clock-output-names' to resolve the name of a clock's parent,
without trying to get the clock from the framework and call
__clk_get_name(). Given that Armada XP devices don't have the
'clock-output-names' property, of_clk_get_parent_name() returns
the name of the node which doesn't match the actual parent
clock's name at all, causing CPU clocks to never link up with
their parents.

Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: tegra: delete unneeded of_node_put
Julia Lawall [Fri, 9 Oct 2015 17:47:41 +0000 (19:47 +0200)]
clk: tegra: delete unneeded of_node_put

for_each_child_of_node performs an of_node_put on each iteration, so
putting an of_node_put before a continue results in a double put.

The semantic match that finds this problem is as follows
(http://coccinelle.lip6.fr):

// <smpl>
@@
expression root,e;
local idexpression child;
iterator name for_each_child_of_node;
@@

 for_each_child_of_node(root, child) {
   ... when != of_node_get(child)
*  of_node_put(child);
   ...
*  continue;
}
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoMerge branch 'clk-bcm2835' into clk-next
Stephen Boyd [Mon, 12 Oct 2015 18:44:49 +0000 (11:44 -0700)]
Merge branch 'clk-bcm2835' into clk-next

* clk-bcm2835:
  clk: bcm2835: Add support for programming the audio domain clocks
  clk: bcm2835: Add binding docs for the new platform clock driver.
  clk: bcm2835: Move under bcm/ with other Broadcom SoC clk drivers.

9 years agoclk: bcm2835: Add support for programming the audio domain clocks
Eric Anholt [Fri, 9 Oct 2015 01:37:24 +0000 (18:37 -0700)]
clk: bcm2835: Add support for programming the audio domain clocks

This adds support for enabling, disabling, and setting the rate of the
audio domain clocks.  It will be necessary for setting the pixel clock
for HDMI in the VC4 driver and let us write a cpufreq driver.  It will
also improve compatibility with user changes to the firmware's
config.txt, since our previous fixed clocks are unaware of it.

The firmware also has support for configuring the clocks through the
mailbox channel, but the pixel clock setup by the firmware doesn't
work, and it's Raspberry Pi specific anyway.  The only conflicts we
should have with the firmware would be if we made firmware calls that
result in clock management (like opening firmware V3D or ISP access,
which we don't support in upstream), or on hardware over-thermal or
under-voltage (when the firmware would rewrite PLLB to take the ARM
out of overclock).  If that happens, our cached .recalc_rate() results
would be incorrect, but that's no worse than our current state where
we used fixed clocks.

The existing fixed clocks in the code are left in place to provide
backwards compatibility with old device tree files.

Signed-off-by: Eric Anholt <eric@anholt.net>
Tested-by: Martin Sperl <kernel@martin.sperl.org>
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: imx6: Add SPDIF_GCLK clock in clock tree
Shengjiu Wang [Sat, 10 Oct 2015 10:15:06 +0000 (18:15 +0800)]
clk: imx6: Add SPDIF_GCLK clock in clock tree

Correct SPDIF clock setting issue in clock tree, the SPDIF_GCLK is also
one clock of SPDIF, which is missed before.

We found an issue that imx can't enter low power mode with spdif
if IMX6x_CLK_SPDIF is used as the core clock of spdif. Because
spdif driver will register IMX6x_CLK_SPDIF clock to regmap, regmap will do
clk_prepare in init function, then IMX6x_CLK_SPDIF clock is prepared in probe,
so its parent clock (PLL clock) is prepared, the prepare operation of
PLL clock is to enable the clock. But I.MX needs all PLL clock is disabled,
then it can enter low power mode.

So we can't use IMX6x_CLK_SPDIF as the core clock of spdif, the correct spdif
core clock is SPDIF_GCLK, which share same gate bit with IMX6x_CLK_SPDIF clock.
SPDIF_GCLK's parent clock is ipg clock.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
9 years agoclk: qcom: create virtual child device for TSENS
Rajendra Nayak [Thu, 8 Oct 2015 05:01:03 +0000 (10:31 +0530)]
clk: qcom: create virtual child device for TSENS

8960 family of devices have TSENS as part of GCC in hardware.
Hence DT would represent a GCC node with GCC properties as well
as TSENS. Create a virtual platform child device here for TSENS
so the driver can probe it and use the parent (GCC) to extract DT
properties.

Suggested-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
[sboyd@codeaurora.org: Massaged to work with devm friendly
qcom_cc_probe()]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: qcom: Move gdsc config outside COMMON_CLK_QCOM config
Stephen Boyd [Thu, 8 Oct 2015 17:59:32 +0000 (10:59 -0700)]
clk: qcom: Move gdsc config outside COMMON_CLK_QCOM config

Having this hidden config below the COMMON_CLK_QCOM config causes
menuconfig to stop indenting config items after it.

        <*> Support for Qualcomm's clock controllers
        {M}   APQ8084 Global Clock Controller
        <M>   APQ8084 Multimedia Clock Controller
        {M}   IPQ806x Global Clock Controller
        <M>   IPQ806x LPASS Clock Controller
        <M> MSM8660 Global Clock Controller
        <M> MSM8916 Global Clock Controller
        {M} APQ8064/MSM8960 Global Clock Controller
        <M> APQ8064/MSM8960 LPASS Clock Controller
        <M> MSM8960 Multimedia Clock Controller
        {M} MSM8974 Global Clock Controller
        <M> MSM8974 Multimedia Clock Controller

Move it up above anything else so that we don't get odd
indenting.

Cc: Rajendra Nayak <rnayak@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: qcom: Drop calls to qcom_cc_remove()
Stephen Boyd [Thu, 8 Oct 2015 07:11:49 +0000 (00:11 -0700)]
clk: qcom: Drop calls to qcom_cc_remove()

Now that qcom_cc_remove() is a nop, drop calls to
qcom_cc_remove() and any empty driver remove functions.

Cc: Rajendra Nayak <rnayak@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoqcom: clk: Make qcom_cc_probe() fully devm safe
Stephen Boyd [Thu, 8 Oct 2015 06:59:57 +0000 (23:59 -0700)]
qcom: clk: Make qcom_cc_probe() fully devm safe

Some APIs in qcom_cc_probe() don't have a devm counterpart, so we
have to use the calling device's platform data to pass pointers
to the remove path. Let's use devm_add_action() instead, so that
the remove path doesn't need to do anything, allowing us to
remove qcom_cc_remove() entirely.

Cc: Rajendra Nayak <rnayak@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agodrivers: clk: st: Correct the pll-type for A9 for stih418
Gabriel Fernandez [Wed, 7 Oct 2015 09:08:58 +0000 (11:08 +0200)]
drivers: clk: st: Correct the pll-type for A9 for stih418

Add support for new PLL-type for stih418 A9-PLL.
Currently the 407_A9_PLL type being used, it is corrected with this patch
4600c28 PLL allows to reach higher frequencies
so its programming algorithm is extended.

Signed-off-by: Pankaj Dev <pankaj.dev@st.com>
Signed-off-by: Gabriel Fernandez <gabriel.fernandez@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agodrivers: clk: st: PLL rate change implementation for DVFS
Gabriel Fernandez [Wed, 7 Oct 2015 09:08:57 +0000 (11:08 +0200)]
drivers: clk: st: PLL rate change implementation for DVFS

Change A9 PLL rate, as per requirement from the cpufreq framework,
for DVFS. For rate change, the A9 clock needs to be temporarily sourced
from PLL external to A9 and then sourced back to A9-PLL

Signed-off-by: Pankaj Dev <pankaj.dev@st.com>
Signed-off-by: Gabriel Fernandez <gabriel.fernandez@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agodrivers: clk: st: Support for enable/disable in Clockgen PLLs
Gabriel Fernandez [Wed, 7 Oct 2015 09:08:56 +0000 (11:08 +0200)]
drivers: clk: st: Support for enable/disable in Clockgen PLLs

The patch adds support for enable/disable of the Clockgen PLLs.
clkgen_pll_enable/clkgen_pll_disable added as generic function for all PLLs.

Signed-off-by: Pankaj Dev <pankaj.dev@st.com>
Signed-off-by: Gabriel Fernandez <gabriel.fernandez@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: qcom: Make oxili GDSC parent of oxili_cx GDSC
Stephen Boyd [Thu, 1 Oct 2015 19:22:54 +0000 (12:22 -0700)]
clk: qcom: Make oxili GDSC parent of oxili_cx GDSC

The oxili_cx GDSC is inside the power domain of the oxili GDSC.
Add the dependency so that the CX domain can properly power up.

Reported-by: Rob Clark <robdclark@gmail.com>
Cc: Rajendra Nayak <rnayak@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoPM / Domains: Make pm_genpd_{add,remove}_subdomain() available to modules
Stephen Boyd [Thu, 1 Oct 2015 19:22:53 +0000 (12:22 -0700)]
PM / Domains: Make pm_genpd_{add,remove}_subdomain() available to modules

Export these symbols so they can be used in loadable kernel
modules.

Cc: Rob Clark <robdclark@gmail.com>
Cc: Rajendra Nayak <rnayak@codeaurora.org>
Cc: Kevin Hilman <khilman@kernel.org>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Rafael J. Wysocki <rjw@rjwysocki.net>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoAdd driver for the si514 clock generator chip
Mike Looijmans [Fri, 2 Oct 2015 07:15:29 +0000 (09:15 +0200)]
Add driver for the si514 clock generator chip

This patch adds the driver and devicetree documentation for the
Silicon Labs SI514 clock generator chip. This is an I2C controlled
oscillator capable of generating clock signals ranging from 100kHz
to 250MHz.

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
[sboyd@codeaurora.org: Drop clk.h include, remove some casts]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: imx7d: add ADC root clock
Haibo Chen [Thu, 8 Oct 2015 10:59:06 +0000 (18:59 +0800)]
clk: imx7d: add ADC root clock

Add ADC root clock support in imx7d clock tree.

Signed-off-by: Haibo Chen <haibo.chen@freescale.com>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
9 years agoMerge branch 'v4.3-rc3-clk' of https://github.com/jamesjjliao/linux into clk-next
Stephen Boyd [Fri, 2 Oct 2015 18:38:20 +0000 (11:38 -0700)]
Merge branch 'v4.3-rc3-clk' of https://github.com/jamesjjliao/linux into clk-next

Pull mediatek clock support and fixes from James Liao:

"This is a collection of new Mediatek clocks support and fixes.
These patches come from Joe and me, including clock support for
subsystems, GPT and some minor fixes."

* 'v4.3-rc3-clk' of https://github.com/jamesjjliao/linux:
  clk: mediatek: Add USB clock support in MT8173 APMIXEDSYS
  clk: mediatek: Add subsystem clocks of MT8173
  dt-bindings: ARM: Mediatek: Document devicetree bindings for clock controllers
  clk: mediatek: Fix rate and dependency of MT8173 clocks
  clk: mediatek: Add fixed clocks support for Mediatek SoC.
  clk: mediatek: Add __initdata and __init for data and functions
  clk: mediatek: Remove unused code from MT8173.
  clk: mediatek: Removed unused dpi_ck clock from MT8173
  clk: mediatek: add 13mhz clock for MT8173

9 years agoclk: samsung: exynos7: Staticize file scope symbols
Stephen Boyd [Fri, 2 Oct 2015 18:34:34 +0000 (11:34 -0700)]
clk: samsung: exynos7: Staticize file scope symbols

drivers/clk/samsung/clk-exynos7.c:896:33:
warning: symbol 'fixed_rate_clks_fsys0' was not declared. Should
it be static?
drivers/clk/samsung/clk-exynos7.c:1010:33:
warning: symbol 'fixed_rate_clks_fsys1' was not declared. Should
it be static?

Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoMerge tag 'clk-samsung-4.4' of git://linuxtv.org/snawrocki/samsung into clk-next
Stephen Boyd [Fri, 2 Oct 2015 18:31:43 +0000 (11:31 -0700)]
Merge tag 'clk-samsung-4.4' of git://linuxtv.org/snawrocki/samsung into clk-next

Pull updates from Sylwester Nawrocki:

"Fixes, improvements and addition of some missing features
of the exynos7 clock controller driver."

* tag 'clk-samsung-4.4' of git://linuxtv.org/snawrocki/samsung:
  clk: samsung: exynos7: Add required clock tree for UFS
  clk: samsung: exynos7: Add missing fixed_clks to cmu_info
  clk: samsung: exynos7: Correct CMU_FSYS1 clocks names
  clk: samsung: exynos7: Correct CMU_FSYS0 clocks names
  clk: samsung: exynos7: Correct CMU_PERIS clocks names
  clk: samsung: exynos7: Correct CMU_PERIC1 clocks names
  clk: samsung: exynos7: Correct CMU_PERIC0 clocks names
  clk: samsung: exynos7: Correct CMU_CCORE clocks names
  clk: samsung: exynos7: Correct CMU_TOP1 clocks names
  clk: samsung: exynos7: Correct CMU_TOP0 clocks names
  clk: samsung: exynos7: Adds missing clocks gates of CMU_TOPC
  clk: samsung: exynos7: Change the CMU_TOPC block clock names
  clk: samsung: exynos7: Correct nr_clk_ids for fsys1
  clk: samsung: exynos7: Correct nr_clk_ids for fsys0
  clk: samsung: exynos7: Fix CMU TOP1 block
  clk: samsung: exynos7: Fix CMU TOPC block clock

9 years agoMerge branch 'clk-fixes' into clk-next
Stephen Boyd [Fri, 2 Oct 2015 18:29:54 +0000 (11:29 -0700)]
Merge branch 'clk-fixes' into clk-next

* clk-fixes: (3 commits)
  clk: ti: dflt: fix enable_reg validity check
  clk: ti: fix dual-registration of uart4_ick
  clk: ti: clk-7xx: Remove hardwired ABE clock configuration

9 years agoserial: 8250_dw: allow lower reference frequencies
Andy Shevchenko [Tue, 22 Sep 2015 15:54:12 +0000 (18:54 +0300)]
serial: 8250_dw: allow lower reference frequencies

We have couple of standard but rare used baudrates which are not supported by
1,8432MHz reference frequency. Besides that user can potentially ask for any
baudrate (via BOTHER flag) and we currently don't fully support that. Since
clk-fractional-divider is moved to use rational best approximation for
reference frequency we may amend the driver to support whatever user wants.

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: fractional-divider: switch to rational best approximation
Andy Shevchenko [Tue, 22 Sep 2015 15:54:11 +0000 (18:54 +0300)]
clk: fractional-divider: switch to rational best approximation

This patch converts the code to use rational best approximation algorithm which
is much more precise.

Suggested-by: Stephen Boyd <sboyd@codeaurora.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: rockchip: save width in struct clk_fractional_divider
Andy Shevchenko [Tue, 22 Sep 2015 15:54:10 +0000 (18:54 +0300)]
clk: rockchip: save width in struct clk_fractional_divider

The ->mwidth and ->nwidth fields will be used by clk-fractional-divider when it
will be switched to rational base approximation algorithm.

Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: fractional-divider: keep mwidth and nwidth internally
Andy Shevchenko [Tue, 22 Sep 2015 15:54:09 +0000 (18:54 +0300)]
clk: fractional-divider: keep mwidth and nwidth internally

The patch adds mwidth and nwidth fields to the struct clk_fractional_divider
for further usage. While here, use GENMASK() instead of open coding this
functionality.

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: fractional-divider: rename prate -> parent_rate
Andy Shevchenko [Tue, 22 Sep 2015 15:54:08 +0000 (18:54 +0300)]
clk: fractional-divider: rename prate -> parent_rate

Rename function parameter to be more explicit what it is for. This also makes
it in align with struct clk_ops.

There is no functional change.

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoMerge branch 'for-4.3-rc/ti-clk-fixes' of https://github.com/t-kristo/linux-pm into...
Stephen Boyd [Fri, 2 Oct 2015 18:15:13 +0000 (11:15 -0700)]
Merge branch 'for-4.3-rc/ti-clk-fixes' of https://github.com/t-kristo/linux-pm into clk-fixes

Pull fixes from Tero Kristo:

"A few TI clock driver fixes to pull against 4.3-rc"

* 'for-4.3-rc/ti-clk-fixes' of https://github.com/t-kristo/linux-pm: (3 commits)
  clk: ti: dflt: fix enable_reg validity check
  clk: ti: fix dual-registration of uart4_ick
  clk: ti: clk-7xx: Remove hardwired ABE clock configuration

9 years agoclk: ti: dflt: fix enable_reg validity check
Suman Anna [Tue, 29 Sep 2015 22:37:47 +0000 (17:37 -0500)]
clk: ti: dflt: fix enable_reg validity check

The default clock enabling functions for TI clocks -
omap2_dflt_clk_enable() and omap2_dflt_clk_disable() perform a
NULL check for the enable_reg field of the clk_hw_omap structure.
This enable_reg field however is merely a combination of the index
of the master IP module, and the offset from the master IP module's
base address. A value of 0 is perfectly valid, and the current error
checking will fail in these cases. The issue was found when trying
to enable the iva2_ck clock on OMAP3 platforms.

So, switch the check to use IS_ERR. This correction is similar to the
logic used in commit c807dbedb5e5 ("clk: ti: fix ti_clk_get_reg_addr
error handling").

Fixes: 9f37e90efaf0 ("clk: ti: dflt: move support for default gate clock..")
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
9 years agoclk: ti: fix dual-registration of uart4_ick
Ben Dooks [Tue, 29 Sep 2015 14:01:08 +0000 (15:01 +0100)]
clk: ti: fix dual-registration of uart4_ick

On the OMAP AM3517 platform the uart4_ick gets registered
twice, causing any power management to /dev/ttyO3 to fail
when trying to wake the device up.

This solves the following oops:

[] Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa09e008
[] PC is at serial_omap_pm+0x48/0x15c
[] LR is at _raw_spin_unlock_irqrestore+0x30/0x5c

Fixes: aafd900cab87 ("CLK: TI: add omap3 clock init file")
Cc: stable@vger.kernel.org
Cc: mturquette@baylibre.com
Cc: sboyd@codeaurora.org
Cc: linux-clk@vger.kernel.org
Cc: linux-omap@vger.kernel.org
Cc: linux-kernel@lists.codethink.co.uk
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
9 years agoclk: ti: clk-7xx: Remove hardwired ABE clock configuration
Peter Ujfalusi [Mon, 24 Aug 2015 07:35:02 +0000 (10:35 +0300)]
clk: ti: clk-7xx: Remove hardwired ABE clock configuration

The ABE related clocks should be configured via DT and not have it wired
inside of the kernel.

Fixes: a74c52def9ab ("clk: ti: clk-7xx: Correct ABE DPLL configuration")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
9 years agoclk: bcm2835: Add binding docs for the new platform clock driver.
Eric Anholt [Mon, 28 Sep 2015 21:22:03 +0000 (14:22 -0700)]
clk: bcm2835: Add binding docs for the new platform clock driver.

Previously we've only supported a few fixed clocks based on
assumptions about how the firmware sets up the clocks, but this
binding will let us control the actual (audio power domain) clock
manager.

Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
Acked-by: Lee Jones <lee@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: bcm2835: Move under bcm/ with other Broadcom SoC clk drivers.
Eric Anholt [Mon, 28 Sep 2015 21:22:02 +0000 (14:22 -0700)]
clk: bcm2835: Move under bcm/ with other Broadcom SoC clk drivers.

clk-bcm2835.c predates the drivers under bcm/, but all the new BCM
drivers are going in there so let's follow them.

Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: imx: use sign_extend32() and abs()
Martin Kepplinger [Tue, 29 Sep 2015 11:32:27 +0000 (13:32 +0200)]
clk: imx: use sign_extend32() and abs()

This simplifies the given function by getting rid of the manual
sign extension as well as saving an absolute value in an extra
variable.

Signed-off-by: Martin Kepplinger <martink@posteo.de>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: rockchip: reset init state before mmc card initialization
Shawn Lin [Fri, 4 Sep 2015 00:15:33 +0000 (08:15 +0800)]
clk: rockchip: reset init state before mmc card initialization

mmc host controller's IO input/output timing is unpredictable if
bootloader execute tuning for HS200 mode. It might make kernel failed
to initialize mmc card in identification mode. The root cause is
tuning phase and degree setting for HS200 mode in bootloader aren't
applicable to that of identification mode in kernel stage. Anyway, we
can't force all bootloaders to reset tuning phase and degree setting
before into kernel. Simply reset it in rockchip_clk_register_mmc.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: shmobile: div6: Grammar s/They/Their/
Geert Uytterhoeven [Wed, 9 Sep 2015 12:57:11 +0000 (14:57 +0200)]
clk: shmobile: div6: Grammar s/They/Their/

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk:mxs: Fix bug on frequency divider
Victorien Vedrine [Mon, 31 Aug 2015 08:45:07 +0000 (10:45 +0200)]
clk:mxs: Fix bug on frequency divider

On drivers/clk/mxs/clk-frac.c, the function clk_frac_round_rate returned a bad
result. The division before multiplication computes a wrong value ; the
calculation is inverted to fix the problem. The second issue is that the exact
rate have decimals and they are truncate. The consequence is that the function
clk_frac_set_rate (which use the result of clk_frac_round_rate) computes a
wrong value for the register (the rate generated can be closer to the desired
rate). The correction is : if there is decimal to the result, it is rounded to
the next larger integer.
On drivers/clk/mxs/clk-frac.c, the function clk_frac_recalc_rate returned
a bad result. The multiplication is made before the division to compute a
correct value.

Signed-off-by: Victorien Vedrine <victorien.vedrine@ophrys.net>
Acked-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: st: fix handling result of of_property_count_strings
Andrzej Hajda [Thu, 24 Sep 2015 14:00:16 +0000 (16:00 +0200)]
clk: st: fix handling result of of_property_count_strings

The function can return negative value.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: rockchip: don't use clk_ APIs in the pll init-callback
Heiko Stübner [Thu, 1 Oct 2015 09:38:35 +0000 (11:38 +0200)]
clk: rockchip: don't use clk_ APIs in the pll init-callback

Separate the update of pll registers from the actual set_rate function
so that the init callback does not need to access clk-API functions.

As we now have separated the getting and setting of the pll parameters
we can also directly use these new functions in other places too.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: at91: add generated clock driver
Nicolas Ferre [Fri, 31 Jul 2015 09:43:12 +0000 (11:43 +0200)]
clk: at91: add generated clock driver

Add a new type of clocks that can be provided to a peripheral.
In addition to the peripheral clock, this new clock that can use several
input clocks as parents can generate divided rates.
This would allow a peripheral to have finer grained clocks for generating
a baud rate, clocking an asynchronous part or having more
options in frequency.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[sboyd@codeaurora.org: Transition to new clk_hw provider APIs]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: at91: add PMC sama5d2 support
Nicolas Ferre [Thu, 18 Jun 2015 12:43:29 +0000 (14:43 +0200)]
clk: at91: add PMC sama5d2 support

Add support for the new sama5d2 SoC and adapt capabilities.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: at91: modify PMC peripheral clock to deal with newer register layout
Nicolas Ferre [Wed, 17 Jun 2015 12:40:39 +0000 (14:40 +0200)]
clk: at91: modify PMC peripheral clock to deal with newer register layout

As some more information is added to the PCR register, we'd better use
a copy of its content and modify just the peripheral-related bits.
Implement a read-modify-write for the enable() and disable() callbacks.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: at91: cleanup PMC header file for PCR register fields
Nicolas Ferre [Wed, 17 Jun 2015 12:40:38 +0000 (14:40 +0200)]
clk: at91: cleanup PMC header file for PCR register fields

Add _MASK and _OFFSET values and cleanup register fields layout.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
9 years agoclk: mediatek: Add USB clock support in MT8173 APMIXEDSYS
James Liao [Wed, 20 May 2015 07:59:21 +0000 (15:59 +0800)]
clk: mediatek: Add USB clock support in MT8173 APMIXEDSYS

Add REF2USB_TX clock support into MT8173 APMIXEDSYS. This clock
is needed by USB 3.0.

Signed-off-by: James Liao <jamesjj.liao@mediatek.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
9 years agoclk: mediatek: Add subsystem clocks of MT8173
James Liao [Wed, 20 May 2015 06:45:54 +0000 (14:45 +0800)]
clk: mediatek: Add subsystem clocks of MT8173

Most multimedia subsystem clocks will be accessed by multiple
drivers, so it's a better way to manage these clocks in CCF.
This patch adds clock support for MM, IMG, VDEC, VENC and VENC_LT
subsystems.

Signed-off-by: James Liao <jamesjj.liao@mediatek.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
9 years agodt-bindings: ARM: Mediatek: Document devicetree bindings for clock controllers
James Liao [Wed, 20 May 2015 08:45:08 +0000 (16:45 +0800)]
dt-bindings: ARM: Mediatek: Document devicetree bindings for clock controllers

This adds the binding documentation for the mmsys, imgsys, vdecsys,
vencsys and vencltsys controllers found on Mediatek SoCs.

Signed-off-by: James Liao <jamesjj.liao@mediatek.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
9 years agoclk: mediatek: Fix rate and dependency of MT8173 clocks
James Liao [Fri, 10 Jul 2015 03:41:15 +0000 (11:41 +0800)]
clk: mediatek: Fix rate and dependency of MT8173 clocks

Remove the dependency from clk_null, and give all root clocks a
typical rate, include clkph_mck_o, usb_syspll_125m and hdmitx_dig_cts.

dpi_ck was removed due to no clock reference to it.

Replace parent clock of infra_cpum with cpum_ck, which is an external
clock and can be defined in the device tree.

Signed-off-by: James Liao <jamesjj.liao@mediatek.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
9 years agoclk: mediatek: Add fixed clocks support for Mediatek SoC.
James Liao [Fri, 10 Jul 2015 03:39:15 +0000 (11:39 +0800)]
clk: mediatek: Add fixed clocks support for Mediatek SoC.

This patch adds fixed clocks support by using CCF fixed-rate
clock implementation.

Signed-off-by: James Liao <jamesjj.liao@mediatek.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
9 years agoclk: mediatek: Add __initdata and __init for data and functions
James Liao [Tue, 28 Jul 2015 07:37:34 +0000 (15:37 +0800)]
clk: mediatek: Add __initdata and __init for data and functions

Add __init for clock registration functions, and add __initdata for
mtk_gate_regs initial structures.

Signed-off-by: James Liao <jamesjj.liao@mediatek.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
9 years agoclk: mediatek: Remove unused code from MT8173.
James Liao [Tue, 28 Jul 2015 06:53:29 +0000 (14:53 +0800)]
clk: mediatek: Remove unused code from MT8173.

Remove unused header files from MT8173, and remove unused
keywords from function declaration.

Signed-off-by: James Liao <jamesjj.liao@mediatek.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
9 years agoclk: mediatek: Removed unused dpi_ck clock from MT8173
James Liao [Tue, 28 Jul 2015 06:30:03 +0000 (14:30 +0800)]
clk: mediatek: Removed unused dpi_ck clock from MT8173

The dpi_ck clock can be removed because it not actually used
in topckgen and subsystems.

Signed-off-by: James Liao <jamesjj.liao@mediatek.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
9 years agoclk: mediatek: add 13mhz clock for MT8173
Joe.C [Mon, 13 Jul 2015 09:32:48 +0000 (17:32 +0800)]
clk: mediatek: add 13mhz clock for MT8173

Add 13mhz clock used by GPT timer in infracfg.

Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: James Liao <jamesjj.liao@mediatek.com>
9 years agoclk: imx31: Do not call mxc_timer_init twice when booting with DT
Alexander Stein [Wed, 30 Sep 2015 06:23:40 +0000 (08:23 +0200)]
clk: imx31: Do not call mxc_timer_init twice when booting with DT

mxc_timer_init must not be called from within mx31_clocks_init_dt. It will
eventually be called by imx31_timer_init_dt
(drivers/clocksource/timer-imx-gpt.c).
This arranges the initialization code similar to clk-imx27.c

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>