GitHub/LineageOS/android_kernel_motorola_exynos9610.git
8 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

8 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

8 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

8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 years agoclk: gcc-msm8996: Fix pcie 2 pipe register offset
Srinivas Kandagatla [Thu, 25 Aug 2016 11:20:46 +0000 (12:20 +0100)]
clk: gcc-msm8996: Fix pcie 2 pipe register offset

This patch corrects the register offset for pcie2 pipe clock.
Offset according to datasheet is 0x6e018 instead of 0x6e108.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Fixes: b1e010c0730a ("clk: qcom: Add MSM8996 Global Clock Control (GCC) driver")
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: qcom: select GDSC for msm8996 gcc and mmcc
Srinivas Kandagatla [Thu, 25 Aug 2016 11:28:07 +0000 (12:28 +0100)]
clk: qcom: select GDSC for msm8996 gcc and mmcc

This patch selects QCOM_GDSC Kconfig for msm8996 GCC and MMCC clock
controllers, as these provide some of the gdscs on the SOC.

Also selecting this config will make it align with other drivers which
do the same.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Fixes: 52111672f791 ("clk: qcom: gdsc: Add GDSCs in msm8996 GCC")
Fixes: 7e824d507909 ("clk: qcom: gdsc: Add mmcc gdscs for msm8996 family")
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoMerge branch 'clk-fixes' into clk-next
Stephen Boyd [Thu, 25 Aug 2016 00:49:30 +0000 (17:49 -0700)]
Merge branch 'clk-fixes' into clk-next

* clk-fixes:
  clk: tegra: remove TEGRA_PLL_USE_LOCK for PLLD/PLLD2

8 years agoclk: h8300: Migrate to clk_hw based registration APIs
Stephen Boyd [Tue, 16 Aug 2016 22:37:57 +0000 (15:37 -0700)]
clk: h8300: Migrate to clk_hw based registration 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: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: <uclinux-h8-devel@lists.sourceforge.jp>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: qcom: Migrate to clk_hw based registration and OF APIs
Stephen Boyd [Tue, 16 Aug 2016 22:38:27 +0000 (15:38 -0700)]
clk: qcom: 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>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: wm831x: Migrate to clk_hw based registration APIs
Stephen Boyd [Wed, 1 Jun 2016 23:15:33 +0000 (16:15 -0700)]
clk: wm831x: Migrate to clk_hw based registration 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: Mark Brown <broonie@kernel.org>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: vt8500: Migrate to clk_hw based registration APIs
Stephen Boyd [Wed, 1 Jun 2016 23:15:32 +0000 (16:15 -0700)]
clk: vt8500: Migrate to clk_hw based registration 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: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Tony Prisk <linux@prisktech.co.nz>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: twl6040: Migrate to clk_hw based registration APIs
Stephen Boyd [Wed, 1 Jun 2016 23:15:30 +0000 (16:15 -0700)]
clk: twl6040: Migrate to clk_hw based registration 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: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: si570: Migrate to clk_hw based OF and registration APIs
Stephen Boyd [Wed, 1 Jun 2016 23:15:28 +0000 (16:15 -0700)]
clk: si570: Migrate to clk_hw based OF and registration 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: Guenter Roeck <linux@roeck-us.net>
Cc: Sören Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: si5351: Migrate to clk_hw based OF and registration APIs
Stephen Boyd [Wed, 1 Jun 2016 23:15:27 +0000 (16:15 -0700)]
clk: si5351: Migrate to clk_hw based OF and registration 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: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Sören Brinkmann <soren.brinkmann@xilinx.com>
Cc: Mike Looijmans <mike.looijmans@topic.nl>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: si514: Migrate to clk_hw based OF and registration APIs
Stephen Boyd [Wed, 1 Jun 2016 23:15:26 +0000 (16:15 -0700)]
clk: si514: Migrate to clk_hw based OF and registration 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: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Sören Brinkmann <soren.brinkmann@xilinx.com>
Cc: Mike Looijmans <mike.looijmans@topic.nl>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: scpi: Migrate to clk_hw based OF and registration APIs
Stephen Boyd [Wed, 1 Jun 2016 23:15:25 +0000 (16:15 -0700)]
clk: scpi: Migrate to clk_hw based OF and registration 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: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: rk808: Migrate to clk_hw based OF and registration APIs
Stephen Boyd [Wed, 1 Jun 2016 23:15:23 +0000 (16:15 -0700)]
clk: rk808: Migrate to clk_hw based OF and registration 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: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: pwm: Migrate to clk_hw based OF and registration APIs
Stephen Boyd [Wed, 1 Jun 2016 23:15:22 +0000 (16:15 -0700)]
clk: pwm: Migrate to clk_hw based OF and registration 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: Janusz Uzycki <j.uzycki@elproma.com.pl>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: palmas: Migrate to clk_hw based OF and registration APIs
Stephen Boyd [Wed, 1 Jun 2016 23:15:21 +0000 (16:15 -0700)]
clk: palmas: Migrate to clk_hw based OF and registration 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: Peter Ujfalusi <peter.ujfalusi@ti.com>
Cc: Nishanth Menon <nm@ti.com>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: nspire: Migrate to clk_hw based OF and registration APIs
Stephen Boyd [Wed, 1 Jun 2016 23:15:20 +0000 (16:15 -0700)]
clk: nspire: Migrate to clk_hw based OF and registration 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: Daniel Tang <dt.tangr@gmail.com>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: moxart: Migrate to clk_hw based OF and registration APIs
Stephen Boyd [Wed, 1 Jun 2016 23:15:18 +0000 (16:15 -0700)]
clk: moxart: Migrate to clk_hw based OF and registration 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: Jonas Jensen <jonas.jensen@gmail.com>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: mb86s7x: Migrate to clk_hw based OF and registration APIs
Stephen Boyd [Wed, 1 Jun 2016 23:15:17 +0000 (16:15 -0700)]
clk: mb86s7x: Migrate to clk_hw based OF and registration 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: Jassi Brar <jaswinder.singh@linaro.org>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: efm32gg: Migrate to clk_hw based OF and registration APIs
Stephen Boyd [Wed, 1 Jun 2016 23:15:14 +0000 (16:15 -0700)]
clk: efm32gg: Migrate to clk_hw based OF and registration 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: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: cs2000: Migrate to clk_hw based OF and registration APIs
Stephen Boyd [Wed, 1 Jun 2016 23:15:13 +0000 (16:15 -0700)]
clk: cs2000: Migrate to clk_hw based OF and registration 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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: clps711x: Migrate to clk_hw based OF and registration APIs
Stephen Boyd [Wed, 1 Jun 2016 23:15:12 +0000 (16:15 -0700)]
clk: clps711x: Migrate to clk_hw based OF and registration 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: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: cdce925: Migrate to clk_hw based OF and provider APIs
Stephen Boyd [Wed, 1 Jun 2016 23:15:11 +0000 (16:15 -0700)]
clk: cdce925: Migrate to clk_hw based OF and provider 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: Mike Looijmans <mike.looijmans@topic.nl>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: cdce: Migrate to clk_hw based OF and registration APIs
Stephen Boyd [Wed, 1 Jun 2016 23:15:10 +0000 (16:15 -0700)]
clk: cdce: Migrate to clk_hw based OF and registration 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: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: axm5516: Migrate to clk_hw based OF and registration APIs
Stephen Boyd [Wed, 1 Jun 2016 23:15:09 +0000 (16:15 -0700)]
clk: axm5516: Migrate to clk_hw based OF and registration 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. Make thing simple by using the
existing clk_hw array and implementing a custom DT clk provider
get function to map the clk spec id to a clk_hw pointer.

Cc: Anders Berg <anders.berg@lsi.com>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: axi-clkgen: Migrate to clk_hw based OF and registration APIs
Stephen Boyd [Wed, 1 Jun 2016 23:15:08 +0000 (16:15 -0700)]
clk: axi-clkgen: Migrate to clk_hw based OF and registration 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: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: asm9260: Migrate to clk_hw based registration and OF APIs
Stephen Boyd [Wed, 1 Jun 2016 23:15:07 +0000 (16:15 -0700)]
clk: asm9260: 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: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: bcm: kona: Migrate to clk_hw based registration and OF APIs
Stephen Boyd [Wed, 1 Jun 2016 23:15:05 +0000 (16:15 -0700)]
clk: bcm: kona: Migrate to clk_hw based registration and OF APIs

Now that we can use clk_hw pointers we don't need to have two
duplicate arrays holding the same mapping of clk index to clk_hw
pointer. Implement a custom clk_hw provider function to map the
OF specifier to the clk_hw instance for it.

Cc: Alex Elder <elder@linaro.org>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: microchip: Initialize SOSC clock rate for PIC32MZDA.
Purna Chandra Mandal [Tue, 17 May 2016 05:05:51 +0000 (10:35 +0530)]
clk: microchip: Initialize SOSC clock rate for PIC32MZDA.

Optional SOSC is an external fixed clock running at 32768HZ.
So Initialize SOSC rate as per PIC32MZDA datasheet.

Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: microchip: use readl_poll_timeout() in pbclk_set_rate().
Purna Chandra Mandal [Tue, 17 May 2016 05:05:50 +0000 (10:35 +0530)]
clk: microchip: use readl_poll_timeout() in pbclk_set_rate().

pbclk_set_rate() is using readl_poll_timeout_atomic() even
though spinlock is released. Fix it by replacing with
readl_poll_timeout().

Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: rockchip: mark aclk_emmc_noc as a critical clock on rk3399
Xing Zheng [Wed, 24 Aug 2016 18:29:39 +0000 (11:29 -0700)]
clk: rockchip: mark aclk_emmc_noc as a critical clock on rk3399

We don't have code to handle any of the noc clocks in rk3399 and they're
all just listed as critical clocks.  Let's do the same for
aclk_emmc_noc.

Without this clock being marked as critical we have problems around
suspend/resume after commit 20c389e656a8 ("clk: rockchip: fix incorrect
aclk_emmc source gate bits on rk3399").  Before that change we were
presumably not actually gating any of these clocks because we were
setting the wrong gate.

Fixes: 20c389e656a8 ("clk: rockchip: fix incorrect aclk_emmc source gate bits on rk3399")
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
8 years agoclk: tegra: remove TEGRA_PLL_USE_LOCK for PLLD/PLLD2
Vince Hsu [Wed, 24 Aug 2016 13:56:56 +0000 (15:56 +0200)]
clk: tegra: remove TEGRA_PLL_USE_LOCK for PLLD/PLLD2

Tegra114 has a HW bug that the PLLD/PLLD2 lock bit cannot be asserted when
the DIS power domain is during up-powergating process but the clamp to this
domain is not removed yet. That causes a timeout and aborts the power
sequence, although the PLLD/PLLD2 has already locked. To remove the false
alarm, we don't use the lock for PLLD/PLLD2. Just wait 1ms and treat the
clocks as locked.

Signed-off-by: Vince Hsu <vinceh@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoMerge branch 'clk-meson-gxbb-ao' into clk-next
Stephen Boyd [Wed, 24 Aug 2016 17:30:46 +0000 (10:30 -0700)]
Merge branch 'clk-meson-gxbb-ao' into clk-next

* clk-meson-gxbb-ao:
  clk: meson: Fix invalid use of sizeof in gxbb_aoclkc_probe()

8 years agoclk: mvebu: Remove redundant dev_err call in armada_3700_periph_clock_probe()
Wei Yongjun [Sat, 20 Aug 2016 15:31:05 +0000 (15:31 +0000)]
clk: mvebu: Remove redundant dev_err call in armada_3700_periph_clock_probe()

There is a error message within devm_ioremap_resource
already, so remove the dev_err call to avoid redundant
error message.

Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: meson: Fix invalid use of sizeof in gxbb_aoclkc_probe()
Wei Yongjun [Mon, 22 Aug 2016 16:08:21 +0000 (16:08 +0000)]
clk: meson: Fix invalid use of sizeof in gxbb_aoclkc_probe()

sizeof() when applied to a pointer typed expression gives the
size of the pointer, not that of the pointed data.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Fixes: f8c11f79912d ("clk: meson: Add GXBB AO Clock and Reset controller driver")
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: renesas: r8a7796: Add SDIF clocks
Simon Horman [Tue, 23 Aug 2016 07:49:44 +0000 (09:49 +0200)]
clk: renesas: r8a7796: Add SDIF clocks

This patch adds SDIF clocks for R8A7796 SoC.

Based on work by Ai Kyuse and Yoshihiro Shimoda for the r8a7795 SoC.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
8 years agoclk: qcom: gdsc: Add the missing BIMC gdsc for msm8996
Rajendra Nayak [Tue, 16 Aug 2016 07:25:48 +0000 (12:55 +0530)]
clk: qcom: gdsc: Add the missing BIMC gdsc for msm8996

Add BIMC gdsc data found in MMCC part of msm8996 family of devices.

Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: imx7d: Add SAI IPG clocks
Fabio Estevam [Fri, 12 Aug 2016 18:26:56 +0000 (15:26 -0300)]
clk: imx7d: Add SAI IPG clocks

The SAI_IPG clocks are enabled by the same bits that control SAI_ROOT_CLK
clocks, so represent them as shared clocks.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: imx: Introduce clk_register_gate2()
Fabio Estevam [Fri, 12 Aug 2016 18:26:55 +0000 (15:26 -0300)]
clk: imx: Introduce clk_register_gate2()

Introduce imx_clk_gate2_shared2() which is similar to the existing
imx_clk_gate2_shared() and passes CLK_OPS_PARENT_ENABLE flag, which
is useful for i.MX7 shared clocks.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: imx7d: Add the clock for SDMA
Fabio Estevam [Fri, 12 Aug 2016 18:26:54 +0000 (15:26 -0300)]
clk: imx7d: Add the clock for SDMA

Add IMX7D_SDMA_CORE_CLK clock so that SDMA can be functional.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoMerge branch 'clk-meson-gxbb-ao' into clk-next
Stephen Boyd [Fri, 19 Aug 2016 19:51:14 +0000 (12:51 -0700)]
Merge branch 'clk-meson-gxbb-ao' into clk-next

* clk-meson-gxbb-ao:
  clk: meson: Add GXBB AO Clock and Reset controller driver
  dt-bindings: clock: reset: Add GXBB AO Clock and Reset Bindings

8 years agoclk: meson: Add GXBB AO Clock and Reset controller driver
Neil Armstrong [Thu, 18 Aug 2016 10:08:46 +0000 (12:08 +0200)]
clk: meson: Add GXBB AO Clock and Reset controller driver

Adds a Clock and Reset controller driver for the Always-On part
of the Amlogic Meson GXBB SoC.

It exports paired Clocks and Resets lines that will be used by
peripherals in the Always-On subsystem.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agodt-bindings: clock: reset: Add GXBB AO Clock and Reset Bindings
Neil Armstrong [Thu, 18 Aug 2016 10:08:47 +0000 (12:08 +0200)]
dt-bindings: clock: reset: Add GXBB AO Clock and Reset Bindings

Add documentations and dt-bindings headers for the AO clock and reset
controller.

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoreset: mediatek: Add MT2701 reset controller dt-binding file
Shunli Wang [Fri, 19 Aug 2016 05:34:53 +0000 (13:34 +0800)]
reset: mediatek: Add MT2701 reset controller dt-binding file

Dt-binding file about reset controller is used to provide
kinds of definition, which is referenced by dts file and
IC-specified reset controller driver code.

Signed-off-by: Shunli Wang <shunli.wang@mediatek.com>
Signed-off-by: James Liao <jamesjj.liao@mediatek.com>
Signed-off-by: Erin Lo <erin.lo@mediatek.com>
Tested-by: John Crispin <blogic@openwrt.org>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: mediatek: Add dt-bindings for MT2701 clocks
Shunli Wang [Fri, 19 Aug 2016 05:34:51 +0000 (13:34 +0800)]
clk: mediatek: Add dt-bindings for MT2701 clocks

Add MT2701 clock dt-bindings, include topckgen, apmixedsys,
infracfg, pericfg and subsystem clocks.

Signed-off-by: Shunli Wang <shunli.wang@mediatek.com>
Signed-off-by: James Liao <jamesjj.liao@mediatek.com>
Signed-off-by: Erin Lo <erin.lo@mediatek.com>
Tested-by: John Crispin <blogic@openwrt.org>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agodt-bindings: ARM: Mediatek: Document bindings for MT2701
James Liao [Fri, 19 Aug 2016 05:34:50 +0000 (13:34 +0800)]
dt-bindings: ARM: Mediatek: Document bindings for MT2701

This patch adds the binding documentation for apmixedsys, bdpsys,
ethsys, hifsys, imgsys, infracfg, mmsys, pericfg, topckgen and
vdecsys for Mediatek MT2701.

Signed-off-by: James Liao <jamesjj.liao@mediatek.com>
Signed-off-by: Erin Lo <erin.lo@mediatek.com>
Tested-by: John Crispin <blogic@openwrt.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: mediatek: Refine the makefile to support multiple clock drivers
James Liao [Fri, 19 Aug 2016 05:34:49 +0000 (13:34 +0800)]
clk: mediatek: Refine the makefile to support multiple clock drivers

Add a Kconfig to define clock configuration for each SoC, and
modify the Makefile to build drivers that only selected in config.

Signed-off-by: Shunli Wang <shunli.wang@mediatek.com>
Signed-off-by: James Liao <jamesjj.liao@mediatek.com>
Signed-off-by: Erin Lo <erin.lo@mediatek.com>
Tested-by: John Crispin <blogic@openwrt.org>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: renesas: r8a7796: Add GPIO clocks
Takeshi Kihara [Wed, 17 Aug 2016 11:31:50 +0000 (13:31 +0200)]
clk: renesas: r8a7796: Add GPIO clocks

Add GPIO clocks for the R8A7796 SoC.

Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
8 years agoclk: mediatek: remove __init from clk registration functions
James Liao [Tue, 16 Aug 2016 07:30:21 +0000 (15:30 +0800)]
clk: mediatek: remove __init from clk registration functions

Remove __init from functions that will be used by init functions
that support probe deferral.

Signed-off-by: James Liao <jamesjj.liao@mediatek.com>
Signed-off-by: Erin Lo <erin.lo@mediatek.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: ls1x: Migrate to clk_hw based OF and registration APIs
Stephen Boyd [Wed, 1 Jun 2016 23:15:15 +0000 (16:15 -0700)]
clk: ls1x: Migrate to clk_hw based OF and registration 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: Kelvin Cheung <keguang.zhang@gmail.com>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: qoriq: fix a register offset error
Tang Yuantian [Mon, 15 Aug 2016 07:28:20 +0000 (15:28 +0800)]
clk: qoriq: fix a register offset error

The offset of Core Cluster clock control/status register
on cluster group V3 version is different from others, and
should be plus 0x70000.

Signed-off-by: Tang Yuantian <yuantian.tang@nxp.com>
Reviewed-by: Scott Wood <oss@buserror.net>
Fixes: 9e19ca2f627e ("clk: qoriq: Add ls2080a support.")
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: max77686: Migrate to clk_hw based OF and registration APIs
Stephen Boyd [Tue, 16 Aug 2016 22:38:56 +0000 (15:38 -0700)]
clk: max77686: Migrate to clk_hw based OF and registration 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.

Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Tested-by: Javier Martinez Canillas <javier@osg.samsung.com>
Cc: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoMerge tag 'clk-renesas-for-v4.9-tag1' of git://git.kernel.org/pub/scm/linux/kernel...
Stephen Boyd [Thu, 18 Aug 2016 23:41:05 +0000 (16:41 -0700)]
Merge tag 'clk-renesas-for-v4.9-tag1' of git://git./linux/kernel/git/geert/renesas-drivers into clk-next

Merge r8a7796 watchdog clk support from Geert Uytterhoeven:

Add all clocks related to the Watchdog Timer (WDT) controller on the
Renesas R-Car M3-W (r8a7796) SoC.

* tag 'clk-renesas-for-v4.9-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers:
  clk: renesas: r8a7796: Add watchdog module clock
  clk: renesas: r8a7796: Add watchdog core clocks

8 years agoclk: berlin: Migrate to clk_hw based registration and OF APIs
Stephen Boyd [Tue, 16 Aug 2016 22:40:52 +0000 (15:40 -0700)]
clk: berlin: 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. We also remove some __init
markings in header files as they're useless and we're in the
area.

Tested-by: Jisheng Zhang <jszhang@marvell.com>
Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: gcc-ipq4019: Delete unnecessary assignment for the field "owner"
Markus Elfring [Tue, 16 Aug 2016 06:53:10 +0000 (08:53 +0200)]
clk: gcc-ipq4019: Delete unnecessary assignment for the field "owner"

The field "owner" is set by the core.
Thus delete an unneeded initialisation.

Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: qcom: Sort Makefile alphabetically
Stephen Boyd [Mon, 15 Aug 2016 23:09:04 +0000 (16:09 -0700)]
clk: qcom: Sort Makefile alphabetically

We've started getting out of order, fix it.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoMerge branch 'clk-qcom-9615' into clk-next
Stephen Boyd [Mon, 15 Aug 2016 23:08:49 +0000 (16:08 -0700)]
Merge branch 'clk-qcom-9615' into clk-next

* clk-qcom-9615:
  dt-bindings: clock: Update bindings for MDM9615 GCC and LCC
  clk: mdm9615: Add support for MDM9615 Clock Controllers
  dt-bindings: Add MDM9615 DT bindings include files for GCC and LCC

8 years agodt-bindings: clock: Update bindings for MDM9615 GCC and LCC
Neil Armstrong [Thu, 11 Aug 2016 12:48:05 +0000 (14:48 +0200)]
dt-bindings: clock: Update bindings for MDM9615 GCC and LCC

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: mdm9615: Add support for MDM9615 Clock Controllers
Neil Armstrong [Thu, 11 Aug 2016 12:48:04 +0000 (14:48 +0200)]
clk: mdm9615: Add support for MDM9615 Clock Controllers

In order to support the Qualcomm MDM9615 SoC, add support for
the Global and LPASS Clock Controllers.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agodt-bindings: Add MDM9615 DT bindings include files for GCC and LCC
Neil Armstrong [Thu, 11 Aug 2016 12:48:03 +0000 (14:48 +0200)]
dt-bindings: Add MDM9615 DT bindings include files for GCC and LCC

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoMerge branch 'clk-meson-gxbb' into clk-next
Stephen Boyd [Mon, 15 Aug 2016 22:47:15 +0000 (15:47 -0700)]
Merge branch 'clk-meson-gxbb' into clk-next

* clk-meson-gxbb:
  clk: gxbb: add MMC gate clocks, and expose for DT

8 years agoclk: gxbb: add MMC gate clocks, and expose for DT
Kevin Hilman [Tue, 2 Aug 2016 21:40:11 +0000 (14:40 -0700)]
clk: gxbb: add MMC gate clocks, and expose for DT

Add the SD/eMMC gate clocks and expose them for use by DT.

While at it, also explose FCLK_DIV2 since this is one of the input
clocks to the mux internal to each of the SD/eMMC blocks.

Signed-off-by: Kevin Hilman <khilman@baylibre.com>
Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: max77686: Add support for MAX77620 clocks
Laxman Dewangan [Fri, 17 Jun 2016 10:51:07 +0000 (16:21 +0530)]
clk: max77686: Add support for MAX77620 clocks

Maxim Max77620 has one 32KHz clock output and the clock HW
IP used on this PMIC is same as what it is there in the MAX77686.

Add clock driver support for MAX77620 on the MAX77686 driver.

CC: Krzysztof Kozlowski <k.kozlowski@samsung.com>
CC: Javier Martinez Canillas <javier@dowhile0.org>
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Tested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: max77686: Add DT binding details for PMIC MAX77620
Laxman Dewangan [Fri, 17 Jun 2016 10:51:06 +0000 (16:21 +0530)]
clk: max77686: Add DT binding details for PMIC MAX77620

Maxim has used the same clock IP on multiple PMICs like MAX77686,
MAX77802, MAX77620. Only differences are the number of clocks
from these PMICs like MAX77686 has 3 clocks output, MAX776802 have
two clock output and MAX77620 has one clock output.

Add clock binding details and DT example for the MAX77620.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
CC: Krzysztof Kozlowski <k.kozlowski@samsung.com>
CC: Javier Martinez Canillas <javier@dowhile0.org>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: Combine DT binding doc for max77686 and max77802
Laxman Dewangan [Fri, 17 Jun 2016 10:51:05 +0000 (16:21 +0530)]
clk: Combine DT binding doc for max77686 and max77802

The clock IP used on the Maxim PMICs max77686 and max77802 are
same. The configuration of clock register is also same except
the number of clocks.

Define the common DT binding file for the clocks of Maxim PMICs
MAX77686 and MAX77802. For this, remove the separate DT binding
document file for maxim,max77802 and move all information to
maxim,max77686 DT binding document.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
CC: Krzysztof Kozlowski <k.kozlowski@samsung.com>
CC: Javier Martinez Canillas <javier@dowhile0.org>
Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: max77686: Combine Maxim max77686 and max77802 driver
Laxman Dewangan [Fri, 17 Jun 2016 10:51:04 +0000 (16:21 +0530)]
clk: max77686: Combine Maxim max77686 and max77802 driver

The clock IP used on the Maxim PMICs max77686 and max77802 are
same. The configuration of clock register is also same except
the number of clocks.

Part of common code utilisation, there is 3 files for these chips
clock driver, one for common and two files for driver registration.

Combine both drivers into single file and move common code into
same common file reduces the 2 files and make max77686 and max77802
clock driver in single fine. This driver does not depends on the
parent driver structure. The regmap handle is acquired through
regmap APIs for the register access.

This combination of driver helps on adding clock driver for different
Maxim PMICs which has similar clock IP like MAX77620 and MAX20024.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
CC: Krzysztof Kozlowski <k.kozlowski@samsung.com>
CC: Javier Martinez Canillas <javier@dowhile0.org>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Tested-by: Javier Martinez Canillas <javier@osg.samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Tested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: fixed-rate: Remove export symbol on setup function
Stephen Boyd [Sat, 13 Aug 2016 01:50:23 +0000 (18:50 -0700)]
clk: fixed-rate: Remove export symbol on setup function

This function is only called by builtin code, but we always
exported it and had marked it as __init before commit
e4eda8e0654c (clk: remove exported function from __init section,
2013-01-06) removed that marking. Given that it isn't used by
modules, lets unexport it and add back __init.

Cc: Denis Efremov <yefremov.denis@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: fixed-factor: Remove export symbol on setup function
Stephen Boyd [Sat, 13 Aug 2016 01:50:22 +0000 (18:50 -0700)]
clk: fixed-factor: Remove export symbol on setup function

This function is marked __init, so it can't possibly need to be
exported to modules. Remove the marking.

Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: Return errors from clk providers in __of_clk_get_from_provider()
Stephen Boyd [Mon, 15 Aug 2016 21:32:23 +0000 (14:32 -0700)]
clk: Return errors from clk providers in __of_clk_get_from_provider()

Before commit 0861e5b8cf80 (clk: Add clk_hw OF clk providers,
2016-02-05) __of_clk_get_from_provider() would return an error
pointer of the provider's choosing if there was a provider
registered and EPROBE_DEFER otherwise. After that commit, it
would return EPROBE_DEFER regardless of whether or not the
provider returned an error. This is odd and can lead to behavior
where clk consumers keep probe deferring when they should be
seeing some other error.

Let's restore the previous behavior where we only return
EPROBE_DEFER when there isn't a provider in our of_clk_providers
list. Otherwise, return the error from the last provider we find
that matches the node.

Reported-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Fixes: 0861e5b8cf80 ("clk: Add clk_hw OF clk providers")
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: gxbb: use builtin_platform_driver to simplify the code
Wei Yongjun [Mon, 8 Aug 2016 13:55:20 +0000 (13:55 +0000)]
clk: gxbb: use builtin_platform_driver to simplify the code

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

Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: mvebu: Add the peripheral clock driver for Armada 3700
Gregory CLEMENT [Tue, 19 Jul 2016 13:42:22 +0000 (15:42 +0200)]
clk: mvebu: Add the peripheral clock driver for Armada 3700

These clocks are the ones which will be used as source for the
peripherals of the Armada 3700 SoC. On this SoC there is two blocks of
clocks: the North bridge one and the South bridge one.

Most of them are gatable. Most of the time their rate are their parent
rated divided by a ratio depending of two registers. Their parent can be
choose between the TBG clocks for most of them.

However, some of them can't choose their parent or directly depend of the
xtal clocks. Other ones do not use exactly the same pattern to find the
ratio between their parent rate and their rate.

For these reason each clock is a composite clock and the operations they
use are different depending of the clock.

According to the datasheet it would be possible to select the parent
clock and the ratio, however currently the driver does not support it.

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agodt-bindings: clock: add DT binding for the peripheral clocks on Armada 3700
Gregory CLEMENT [Tue, 19 Jul 2016 13:42:21 +0000 (15:42 +0200)]
dt-bindings: clock: add DT binding for the peripheral clocks on Armada 3700

This commit adds the DT binding documentation for the peripheral clocks
used in the Marvell Armada 3700 SoCs.

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: mvebu Add the time base generator clocks for Armada 3700
Gregory CLEMENT [Tue, 19 Jul 2016 13:42:20 +0000 (15:42 +0200)]
clk: mvebu Add the time base generator clocks for Armada 3700

These clocks are children of the xtal clock and each one can be selected
as a source for the peripheral clocks.

According to the datasheet it should be possible to modify their rate,
but currently it is not supported.

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agodt-bindings: clock: add DT binding for the TBG clocks on Armada 3700
Gregory CLEMENT [Tue, 19 Jul 2016 13:42:19 +0000 (15:42 +0200)]
dt-bindings: clock: add DT binding for the TBG clocks on Armada 3700

This commit adds the DT binding documentation for the Time Base Generator
clock used in the Marvell Armada 3700 SoCs.

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: mvebu: Add the xtal clock for Armada 3700 SoC
Gregory CLEMENT [Tue, 19 Jul 2016 13:42:18 +0000 (15:42 +0200)]
clk: mvebu: Add the xtal clock for Armada 3700 SoC

This clock is the parent of all the Armada 3700 clocks. It is a fixed
rate clock which depends on the gpio configuration read when resetting
the SoC.

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agodt-bindings: clock: add DT binding for the Xtal clock on Armada 3700
Gregory CLEMENT [Tue, 19 Jul 2016 13:42:17 +0000 (15:42 +0200)]
dt-bindings: clock: add DT binding for the Xtal clock on Armada 3700

This commit adds the DT binding documentation for the the Xtal clock on
Armada 3700 used in the Marvell Armada 3700 SoCs.

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: twl6040: Rename the driver and use consistent names in the code
Peter Ujfalusi [Mon, 30 May 2016 08:55:11 +0000 (11:55 +0300)]
clk: twl6040: Rename the driver and use consistent names in the code

The driver is to provide the functional clock to OMAP4/5 McPDM. The clock
is named as pdmclk in the documentations so change the function names,
structure names and variables to align with this.
At the same time rename the driver from "twl6040-clk" to "twl6040-pdmclk".
This can be done w/o regression since the clock driver is not in use at
the moment, the MFD core driver is not even registering the device for it.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: twl6040: Register the clock as of_clk_provider
Peter Ujfalusi [Mon, 30 May 2016 08:55:10 +0000 (11:55 +0300)]
clk: twl6040: Register the clock as of_clk_provider

In order ot be able to use the pdmclk clock via DT it need to be registered
as of_clk_provide.
Since the twl6040 clock driver does not have it's own DT node, use the
parent's node for registering.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: twl6040: Correct clk_ops
Peter Ujfalusi [Mon, 30 May 2016 08:55:09 +0000 (11:55 +0300)]
clk: twl6040: Correct clk_ops

Since the drover only supports prepare callbacks, the use of is_enabled is
not correct, it should be handling is_prepared.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: mvebu: armada-39x: add clk description for supported interfaces
Grzegorz Jaszczyk [Thu, 21 Jul 2016 10:48:10 +0000 (12:48 +0200)]
clk: mvebu: armada-39x: add clk description for supported interfaces

Both SATA and second USB3.0 interface are supported in Armada-39x SoC
family. Add necessary clk description, so both xhci and sata drivers
can be correctly initialized.

The binding documentation has also been updated accordingly.

Signed-off-by: Grzegorz Jaszczyk <jaz@semihalf.com>
Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: use ERR_CAST() for __clk_create_clk()
Masahiro Yamada [Tue, 19 Jul 2016 07:28:47 +0000 (16:28 +0900)]
clk: use ERR_CAST() for __clk_create_clk()

This code is clear enough, but the intention will be even clearer
with this.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: fixed-rate: Convert into a module platform driver
Ricardo Ribalda Delgado [Tue, 5 Jul 2016 16:23:34 +0000 (18:23 +0200)]
clk: fixed-rate: Convert into a module platform driver

Adds support for fixed-rate clock providers which have not been
enabled via of_clk_init().

This is required by Device trees overlays that introduce clocks
providers.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
[sboyd@codeaurora.org: Make new private function static, don't
check clk for NULL when unregistering in driver remove]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: fixed-factor: Convert into a module platform driver
Ricardo Ribalda Delgado [Tue, 5 Jul 2016 16:23:33 +0000 (18:23 +0200)]
clk: fixed-factor: Convert into a module platform driver

Adds support for fixed-factor clock providers which have not been
enabled via of_clk_init().

This is required by Device trees overlays that introduce clocks
providers.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
[sboyd@codeaurora.org: Make new private function static, don't
check clk for NULL when unregistering in driver remove]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: core: Avoid double initialization of clocks
Ricardo Ribalda Delgado [Tue, 5 Jul 2016 16:23:32 +0000 (18:23 +0200)]
clk: core: Avoid double initialization of clocks

Some clock providers can be initialized via of_clk_init() and also via
platform device probe.

Avoid double initialization of them by setting the OF_POPULATED flag.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: sunxi: apb0: Use new macro CLK_OF_DECLARE_DRIVER
Ricardo Ribalda Delgado [Tue, 5 Jul 2016 16:23:30 +0000 (18:23 +0200)]
clk: sunxi: apb0: Use new macro CLK_OF_DECLARE_DRIVER

This driver initializes a clock provider via sun8i_a23_apb0_setup
and then continues the initialization on sun8i_a23_apb0_clk_probe.

Use the new macro to notify the clk subsystem about this behaviour.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: sunxi: mod0: Use new macro CLK_OF_DECLARE_DRIVER
Ricardo Ribalda Delgado [Tue, 5 Jul 2016 16:23:28 +0000 (18:23 +0200)]
clk: sunxi: mod0: Use new macro CLK_OF_DECLARE_DRIVER

This driver initializes a clock provider via sun4i_a10_mod0_setup
and then continues the initialization on sun4i_a10_mod0_clk_probe.

Use the new macro to notify the clk subsystem about this behaviour.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: nxp: Use new macro CLK_OF_DECLARE_DRIVER
Ricardo Ribalda Delgado [Tue, 5 Jul 2016 16:23:27 +0000 (18:23 +0200)]
clk: nxp: Use new macro CLK_OF_DECLARE_DRIVER

This driver initializes a clock provider via lpc18xx_creg_clk_init
and then continues the initialization on lpc18xx_creg_clk_probe.

Use the new macro to notify the clk subsystem about this behaviour.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
[sboyd@codeaurora.org: s/npx/nxp/ in subject]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: axis: Use new macro CLK_OF_DECLARE_DRIVER
Ricardo Ribalda Delgado [Tue, 5 Jul 2016 16:23:26 +0000 (18:23 +0200)]
clk: axis: Use new macro CLK_OF_DECLARE_DRIVER

This driver initializes a clock provider via of_artpec6_clkctrl_setup
and then continues the initialization on artpec6_clkctrl_probe.

Use the new macro to notify the clk subsystem about this behaviour.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: core: New macro CLK_OF_DECLARE_DRIVER
Ricardo Ribalda Delgado [Tue, 5 Jul 2016 16:23:25 +0000 (18:23 +0200)]
clk: core: New macro CLK_OF_DECLARE_DRIVER

This will be used by drivers that requires initialization at
of_clk_init() time and also during platform device probing.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: divider: Fix clk_divider_round_rate() to use clk_readl()
Geert Uytterhoeven [Fri, 12 Aug 2016 12:37:54 +0000 (14:37 +0200)]
clk: divider: Fix clk_divider_round_rate() to use clk_readl()

clk-divider uses clk_readl()/clk_writel() everywhere, except in
clk_divider_round_rate(), where plain readl() is used. Change this to
clk_readl(), as it makes a difference on powerpc.

Fixes: e6d5e7d90be92cee ("clk-divider: Fix READ_ONLY when divider > 1")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
8 years agoclk: rockchip: fix incorrect GATE bits for {c, g}pll_aclk_perihp_src on rk3399
Xing Zheng [Tue, 2 Aug 2016 07:19:57 +0000 (15:19 +0800)]
clk: rockchip: fix incorrect GATE bits for {c, g}pll_aclk_perihp_src on rk3399

Sorry to refer incorrect clock diagram, we double check it that the bits
configuration of the Xpll_aclk_perihp_src need to be fixed:
bit 1 - shows aclk_perihp_cpll_src_en
bit 0 - shows aclk_perihp_gpll_src_en

Through the testing that plug/unplug the USB ethernet cable on the RK3399 kevin board.

1. the hclk_host0 and hclk_host1 are endpoint clocks:
cpll --> G5[1] --> aclk_perihp_cpll_src --\              |--> hclk_host0
                                          | --> ... ---> |
gpll --> G5[0] --> aclk_perihp_gpll_src --/              |--> hclk_host1

2. there is no clock below the cpll_aclk_perihp_src,
   and the hclk_hostX are below the gpll_aclk_perihp_src:
    pll_cpll                              1            1   800000000          0 0
       cpll                               7           19   800000000          0 0
          cpll_aclk_perihp_src            0            0   800000000          0 0
...
    pll_gpll                              1            1   594000000          0 0
       gpll                              10           10   594000000          0 0
          gpll_aclk_perihp_src            2            2   594000000          0 0
                hclk_perihp               5            5    74250000          0 0
                   hclk_host1_arb         2            2    74250000          0 0
                   hclk_host1             2            2    74250000          0 0
                   hclk_host0_arb         2            2    74250000          0 0
                   hclk_host0             2            2    74250000          0 0

3. by default, G5[0] and G5[1] are enabled:
localhost ~ # mem r 0xff760314
0x000003e0

4. close the G5[1] (aclk_perihp_cpll_src), and plug/unplug USB ethernet cable,
   the DUT still works well:
localhost ~ # mem w 0xff760314 0xffff03e2
localhost ~ # mem r 0xff760314
0x000003e2
plug/unplug, the work statue is ok

5. close the G5[0] (aclk_perihp_gpll_src), , and plug/unplug USB ethernet cable,
   the DUT will be crashed:
localhost ~ # mem w 0xff760314 0xffff03e1
localhost ~ # mem r 0xff760314
0x000003e1
plug/unplug, the DUT is crashed

Summary:
bit 1 - shows aclk_perihp_cpll_src_en
bit 0 - shows aclk_perihp_gpll_src_en

Fixes: 3bd14ae9da91 ("clk: rockchip: fix incorrect parent for rk3399's {c,g}pll_aclk_perihp_src")
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
[here the clock-documentation in the manual was actually stating the wrong
bits and thus only Xing's testing above revealed the issue]
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
8 years agoclk: rockchip: fix incorrect aclk_emmc source gate bits on rk3399
Xing Zheng [Tue, 2 Aug 2016 07:19:58 +0000 (15:19 +0800)]
clk: rockchip: fix incorrect aclk_emmc source gate bits on rk3399

Dues to incorrect diagram, we need to fix incorrect bits for
(c/g)pll_aclk_emmc_src:
cpll_aclk_emmc_src --> G6[13]
gpll_aclk_emmc_src --> G6[12]

Fixes: 115510053e5e ("clk: rockchip: add clock controller for the RK3399")
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>