Commit graph

505691 commits

Author SHA1 Message Date
Bartlomiej Zolnierkiewicz
3a9e9cb65b clk: samsung: exynos4: Disable ARMCLK down feature on Exynos4210 SoC
Commit 42773b28e7 ("clk: samsung: exynos4: Enable ARMCLK
down feature") enabled ARMCLK down feature on all Exynos4
SoCs.  Unfortunately on Exynos4210 SoC ARMCLK down feature
causes a lockup when ondemand cpufreq governor is used.
Fix it by limiting ARMCLK down feature to Exynos4x12 SoCs.

This patch was tested on:
- Exynos4210 SoC based Trats board
- Exynos4210 SoC based Origen board
- Exynos4412 SoC based Trats2 board
- Exynos4412 SoC based Odroid-U3 board

Cc: Daniel Drake <drake@endlessm.com>
Cc: Tomasz Figa <t.figa@samsung.com>
Cc: Kukjin Kim <kgene@kernel.org>
Fixes: 42773b28e7 ("clk: samsung: exynos4: Enable ARMCLK down feature")
Cc: <stable@vger.kernel.org> # v3.17+
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
2015-04-12 20:58:54 -07:00
Uwe Kleine-König
692d8328e8 clk: don't use __initconst for non-const arrays
The statement

	static const char *name[];

defines a modifiable array of pointers to constant chars. That is

	*name[0] = 'f';

is forbidden, but

	name[0] = "f";

is not. So marking an array that is defined as above with __initconst is
wrong. Either an additional const must be added such that the whole
definition reads:

	static const char *const name[] __initconst;

or where this is not possible __initdata must be used.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
2015-04-12 17:18:27 -07:00
Ben Dooks
f6194213cb clk: at91: change to using endian agnositc IO
Change to using endian agnostic _relaxed IO accessors instead of __raw

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
--
CC: Andrew Victor <linux@maxim.org.za>
CC: Nicolas Ferre <nicolas.ferre@atmel.com>
CC: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
CC: Mike Turquette <mturquette@linaro.org> (maintainer:COMMON CLK FRAMEWORK)
CC: Stephen Boyd <sboyd@codeaurora.org> (maintainer:COMMON CLK FRAMEWORK)
CC: linux-kernel@vger.kernel.org (open list:COMMON CLK FRAMEWORK)
Signed-off-by: Michael Turquette <mturquette@linaro.org>
2015-04-11 14:38:39 -07:00
Michael Turquette
c14deee398 clk/tegra: Changes for v4.1-rc1
These are mostly cleanups that I've been carrying in my local tree for
 far too long. In addition to those, there are some preparatory patches
 for the upcoming Tegra210 support and a patch to enable clocks needed
 for HDMI audio support.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJVJ9p+AAoJEN0jrNd/PrOhXC0QAL0+R6DNrekhtdp7VBwEpABA
 kSku2EmcHs+Q+hbZY0CoifZkuRbdZEPYJOwwDDSy/cYqKhS4Hj1yHFywNe9Yq/8F
 toBVtneRPcBILwY61V5G9PRL493CZlmT3RYsZ6/WLTL45VromIYeRmVXYXYMMaRz
 AqbrKGrrROiG18tfDhfSLIethg+pJPS5abREnZPoplk822V91hP4NPXOlJLv6uIv
 gETDCUBbQ5P/VZdqyTyEutq1r5AyL+dTV16b44APY8XeoIyGzo9wM7dT3t69eTaV
 sculQoInC4GqWs/hWmCaIHLvLhKWj8vKPbmsCDRkwMT33Ssj1/Qhz6gWBDbtH+tV
 IHBwOoh0emn9pf0kdzEqpR4Xj2DY4nlsO6hjLT8yHIxaZRIoPmssy697z/x+Go0M
 xRSi+j98sr/tfOCe4936xjqiYAwXx3Hqs30ew9KO3zyd5bpR2CAGjpyV6LBTZ48e
 6T7uXmeoEBxqj/OWcG5fJOjSacAHPnA8224svFFqtg7fJlPUmCI9mpv6rEEvNIGa
 rDuFtGgPAH++wBJYlNGR7hJkUkyx23BchBtqByw3QJPIYuD/MZmHjUf1HyiS4eqj
 zS5rBhACnf4SX0TZgcpkaWB4RPLpBikVHgcVt2Q4a5SuEMqTR78XsnDrOhzjT0ZO
 i03CI2EoFSXooZq9rpZ9
 =4zxP
 -----END PGP SIGNATURE-----

Merge tag 'clk/for-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux into clk-next

clk/tegra: Changes for v4.1-rc1

These are mostly cleanups that I've been carrying in my local tree for
far too long. In addition to those, there are some preparatory patches
for the upcoming Tegra210 support and a patch to enable clocks needed
for HDMI audio support.
2015-04-10 18:06:55 -07:00
Martin Fuzzey
820ad9752c clk: clk-gpio-gate: Fix active low
The active low flag in the DT cell is currently ignored.

This occurs because of_get_named_gpio_flags() does not apply the flags
to the underlying struct gpio_desc so the test in clk_register_gpio_gate()
was bogus.

Note that this patch changes the internal kernel API for
clk_register_gpio_gate() but there are currently no other users.

Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com>
Acked-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
2015-04-10 17:45:30 -07:00
Philipp Zabel
9a74ccdbbb clk: Add PWM clock driver
Some board designers, when running out of clock output pads, decide to
(mis)use PWM output pads to provide a clock to external components.
This driver supports this practice by providing an adapter between the
PWM and clock bindings in the device tree. As the PWM bindings specify
the period in the device tree, this is a fixed clock.

Tested-by: Janusz Uzycki <j.uzycki@elproma.com.pl>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
2015-04-10 14:44:43 -07:00
Jassi Brar
1ccdd04f53 clk: Add clock driver for mb86s7x
The CRG11 clock controller is managed by remote f/w.
This driver simply maps Linux CLK ops onto mailbox api.

Signed-off-by: Andy Green <andy.green@linaro.org>
Signed-off-by: Vincent Yang <vincent.yang@socionext.com>
Signed-off-by: Tetsuya Nuriya <nuriya.tetsuya@socionext.com>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
2015-04-10 13:51:55 -07:00
Robert Jarzmik
c7739aebec clk: pxa: pxa3xx: add missing os timer clock
The pxa3xx scheduler relies on the pxa-timer, which requires a clock for
its rate. As the clock handling will be taken over by the clock
framework, add this missing clock.

The miss was discovered by attempting to run a zylonite platform in a
device-tree configuration, with the future patch to shift clocks
handling to clock framework applied.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
2015-04-10 13:35:56 -07:00
Thierry Reding
c1d676cec5 clk: tegra: Use the proper parent for plld_dsi
The current parent, plld_out0, does not exist. The proper name is
pll_d_out0. While at it, rename the plld_dsi clock to pll_d_dsi_out to
be more consistent with other clock names.

Fixes: b270491eb9 ("clk: tegra: Define PLLD_DSI and remove dsia(b)_mux")
Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-04-10 16:04:22 +02:00
Thierry Reding
a84724a1c3 clk: tegra: Use generic tegra_osc_clk_init() on Tegra114
There is no reason why Tegra114 cannot use the same generic code to set
up the oscillator, clk_m and pll_ref clocks. The only effective change
that this causes is that the CLK_SET_PARENT_RATE flag is dropped, but
since these clocks are all fixed it is not needed anyway.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-04-10 16:04:21 +02:00
Thierry Reding
63cc5a4da1 clk: tegra: Model oscillator as clock
Currently the Tegra clock driver simplifies the clock tree somewhat by
taking advantage of the fact that clk_m runs at the same frequency as
the oscillator. While that's true on all currently supported SoCs, it
does not apply to Tegra210 anymore. On Tegra210 clk_m is typically
divided down from the oscillator frequency. To support that setup, add
a separate clock for the oscillator that both clk_m and pll_ref derive
from.

Modify the tegra_osc_clk_init() function to take an additional divider
parameter for clk_m. Existing SoCs always pass in 1, whereas Tegra210
will read the divider from a register in the clock & reset controller.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-04-10 16:04:20 +02:00
Thierry Reding
699b477a0d clk: tegra: Add peripheral registers for bank Y
Tegra210 has an extra bank of peripheral clock registers. Add it to the
generic peripheral clock code.

Cc: Peter De Schrijver <pdeschrijver@nvidia.com>
Cc: Prashant Gaikwad <pgaikwad@nvidia.com>
Reviewed-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-04-10 16:04:20 +02:00
Thierry Reding
5e43e25917 clk: tegra: Register the proper number of resets
The number of resets controls is 32 times the number of peripheral
register banks rather than 32 times the number of clocks. This reduces
(drastically) the number of reset controls registered from 10080 (315
clocks * 32) to 224 (6 peripheral register banks * 32).

This also fixes a potential crash because trying to use any of the
excess reset controls (224-10079) would have caused accesses beyond
the array bounds of the peripheral register banks definition array.

Cc: Peter De Schrijver <pdeschrijver@nvidia.com>
Cc: Prashant Gaikwad <pgaikwad@nvidia.com>
Fixes: 6d5b988e7d ("clk: tegra: implement a reset driver")
Cc: stable@vger.kernel.org # 3.14+
Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-04-10 16:04:18 +02:00
Thierry Reding
44a6f3dbf1 clk: tegra: Remove needless initializations
The ret variable is often explicitly initialized to 0, but there is no
need to do so in many cases because it will immediately be overwritten
with the return value from a function.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-04-10 16:04:18 +02:00
Thierry Reding
12cf33c0eb clk: tegra: Use consistent indentation
Some of the .dev_id entries in the devclks table were oddly indented.
Make them consistent with the rest of the table.

Reviewed-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-04-10 16:04:10 +02:00
Thierry Reding
6bb18c532d clk: tegra: Various whitespace cleanups
Make usage of blank lines as separators more consistent.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-04-10 16:03:48 +02:00
Dylan Reid
04794d982e clk: tegra: Enable HDA to HDMI clocks on Tegra124
Add the clocks used for HDMI audio played through the HDA controller.
Initialize the codec clock to 48Mhz and the HDA clock to 102MHz per
the TRM.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-04-10 16:03:47 +02:00
Thierry Reding
f081c89606 clk: tegra: Fix a bunch of sparse warnings
The second to last parameter of the TEGRA_CLK_PERIPH macro denotes a
table and should therefore users should pass in NULL instead of 0.

Fixes a bunch of sparse warnings like this:

	warning: Using plain integer as NULL pointer

Reviewed-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-04-10 16:03:41 +02:00
Thierry Reding
8106462faa clk: tegra: Fix typo tabel -> table
The clock initialization structure is named struct clk_init_table.
Update the kerneldoc comment to use the correct name.

Reviewed-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2015-04-10 16:02:08 +02:00
Julia Lawall
e52786ac3c clk: versatile: test returned value
Put NULL test on the result of the previous call instead on one of its
arguments.  A simplified version of the semantic match that finds this
problem is as follows (http://coccinelle.lip6.fr/):

// <smpl>
r@
expression *e1;
expression *e2;
identifier f;
statement S1,S2;
@@

e1 = f(...,e2,...);
(
if (e1 == NULL || ...) S1 else S2
|
*if (e2 == NULL || ...) S1 else S2
)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2015-04-09 08:19:31 -07:00
Georgi Djakov
2f272e7b01 clk: qcom: Fix parent_map translations
When we introduced the parent_map tables, we missed to update
some of the functions where mapping is translated. Fix this.

Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
Tested-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2015-04-08 11:07:38 -07:00
Bartlomiej Zolnierkiewicz
3937567ded clk: qcom: fix driver dependencies
Support for Qualcomm's clock controllers should be available only
on Qualcomm platforms.

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2015-04-07 16:14:54 -07:00
Archit Taneja
4c385b25fa clk: qcom: Add EBI2 clocks for IPQ806x
The NAND controller within EBI2 requires EBI2_CLK and
EBI2_ALWAYS_ON_CLK clocks.  Create structs for these clocks so
that they can be used by the NAND controller driver. Add an entry
for EBI2_AON_CLK in the gcc-ipq806x DT binding document.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2015-04-06 14:07:49 -07:00
Fabian Frederick
f375573c96 clk: constify of_device_id array
of_device_id is always used as const.
(See driver.of_match_table and open firmware functions)

__initdata updated to __initconst for
static const struct of_device_id ti_clkdm_match_table[]

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2015-04-01 10:59:27 -07:00
Paul Walmsley
aa571b148c MAINTAINERS: clk: discuss on the linux-clk@vger.kernel.org list
Most Linux clock framework discussions take place on the
linux-kernel@vger.kernel.org or linux-arm-kernel@lists.infradead.org
mailing lists.  The volume of unrelated messages on these lists makes
it difficult for non-maintainers to follow along with discussions.
Switch the discussion list for clock framework discussions to
linux-clk@vger.kernel.org.  Also, add linux-clk@vger.kernel.org as a
mailing list for clock API discussions.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
Cc: Tomasz Figa <tomasz.figa@gmail.com>
Cc: Viresh Kumar <viresh.linux@gmail.com>
Cc: Peter De Schrijver <pdeschrijver@nvidia.com>
Cc: Prashant Gaikwad <pgaikwad@nvidia.com>
Cc: Tero Kristo <t-kristo@ti.com>
Cc: Russell King <linux@arm.linux.org.uk>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
2015-03-31 18:34:26 -07:00
Tomasz Figa
045ecad0fd clk: samsung: exynos3250: Add driver for CMU_ISP clock domain
Add clock controller for CMU ISP clock domain on Exynos3250,
providing clocks for FIMC-IS subsystem.

[b.michalska: use samsung_cmu_register_one to register
 the provider; updated DT binding documentation]

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Beata Michalska <b.michalska@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
[s.nawrocki: added __init attribute which was missing in function
 exynos3250_cmu_platform_init() in function, which has been]
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
2015-03-30 15:18:53 -07:00
Inha Song
abec147faa clk: samsung: Add CLKOUT driver support for Exynos3250 SoC
This patch add CLKOUT driver support for Exynos3250 SoC.

Exynos3250 SoC PMU_DEBUG is the same with Exynos4's PMU_DEBUG
including CLKOUT mux. So we can use the exynos4's clkout init
function for Exynos3250 without the need to add new function.

Signed-off-by: Inha Song <ideal.song@samsung.com>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
2015-03-30 15:18:52 -07:00
Krzysztof Kozlowski
0d7ef4a6c0 clk: cdce706: Constify struct regmap_config
The regmap_config struct may be const because it is not modified by the
driver and regmap_init() accepts pointer to const.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2015-03-27 00:23:27 -07:00
Krzysztof Kozlowski
217c8df6c9 clk: si570: Constify struct regmap_config
The regmap_config struct may be const because it is not modified by the
driver and regmap_init() accepts pointer to const.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2015-03-27 00:22:49 -07:00
Krzysztof Kozlowski
8234caed27 clk: si5351: Constify clock names and struct regmap_config
The regmap_config struct may be const because it is not modified by the
driver and regmap_init() accepts pointer to const.

Replace doubled const in the arrays of clock names with proper const
pointer to const data. This fixes the warnings:

drivers/clk/clk-si5351.c:71:25: warning: duplicate const
drivers/clk/clk-si5351.c:74:25: warning: duplicate const
drivers/clk/clk-si5351.c:77:25: warning: duplicate const
drivers/clk/clk-si5351.c:80:25: warning: duplicate const

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2015-03-27 00:21:39 -07:00
Fengguang Wu
d41bd923d3 clk: qcom: fix simple_return.cocci warnings
drivers/clk/qcom/clk-pll.c:74:1-4: WARNING: end returns can be simpified

 Simplify a trivial if-return sequence.  Possibly combine with a
 preceding function call.
Generated by: scripts/coccinelle/misc/simple_return.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2015-03-26 22:43:47 -07:00
Stephen Boyd
b3261d768b clk: qcom: Fix ipq806x LCC frequency tables
These frequency tables list the wrong rates. Either they don't
have the correct frequency at all, or they're specified in kHz
instead of Hz. Fix it.

Fixes: c99e515a92 "clk: qcom: Add IPQ806X LPASS clock controller (LCC) driver"
Tested-by: Kenneth Westfield <kwestfie@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2015-03-26 22:43:30 -07:00
Michael Turquette
fe15dedc02 Allwinner clocks changes for 4.1
The usual round of clock changes for the Allwinner SoCs.
 
 There is nothing really standing out here, but a few changes and fixes, most
 notably to allow the AHB clock to be parented to a PLL, instead of the CPU
 clock to avoid any AHB rate change due to cpufreq.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJVEyS7AAoJEBx+YmzsjxAgKRIP/3cn2AYWL25NGB2vd61hYQuK
 zHMHqqGyybr+8nxCd2ue4ztBLUTMZz3BA+siaYG7KzOUmSCpHZb6ic2RlqWGZMbX
 CmBW09YNiMtXvIaViYXH8ltVy/Ug8abwpRVkPjWf8jcbN9beGb34mrYstUBa4Cmh
 9clMaMTAvhD0KqmrlHGd/tgyXdZXZPriRLLbUbumF5gatXFpHK2EzJBQMqAzhPE+
 Qrn5xoDJMBziJ21cX/4MRnGWILgOy9EioW7TMhUvj7reZniHhkTBiSo/gu6qImTM
 izkO1GP5rAhVjfEbltvVPIKaFP2cFnxwVwq9sDkhE4cMwb9CWOXhM6vdEFRm9PAG
 nC/VVjLFaJ3lCyI+jYB5917d+U/F+RwrI07Zwx9+QLzNiyCh9y2DL+kKT6iyzYbY
 as4Jg4J2MrOk+WesGH49PAT/ciUqnViTMKMMcbu/0chMHIsN7L80h+gH9ktnAkN4
 1JmQfL2A85i2NORsb7SFM4P5Gc8c5cxnqbZ4honS4TxLW5CmXI9zISG53j/miBy9
 SRutVT6IGseMNhIrWgHxRVVQBpG3QasYZSVOVutK9IDrUJ8L0pgymb7VjtMaAKDK
 1dxfl6gdkUIJ1jfjD3ly57eMkikLDWc/ea3VgIUCQoBU8IVJuJuc/miWi0i3qnJo
 zkLzG1fR0OH+LHtFO42K
 =k3yP
 -----END PGP SIGNATURE-----

Merge tag 'sunxi-clocks-for-4.1' of https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux into clk-next

Allwinner clocks changes for 4.1

The usual round of clock changes for the Allwinner SoCs.

There is nothing really standing out here, but a few changes and fixes, most
notably to allow the AHB clock to be parented to a PLL, instead of the CPU
clock to avoid any AHB rate change due to cpufreq.
2015-03-25 14:51:40 -07:00
Chen-Yu Tsai
f101796966 clk: sunxi: Add pll6 / 4 clock output to sun4i-a10-pll6
The pll6 has a /4 output that is used as an input to the ahb mux clock.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2015-03-25 11:46:41 -07:00
Chen-Yu Tsai
934fe5f48a clk: sunxi: Make divs clocks specify which output is the base factor clock
The current sunxi clock driver has the base factor clock of divs clocks
as the last clock output of the clock node. This makes it rather difficult
to add new outputs, such as fixed dividers, which were previously unknown.

This patch makes the divs clocks data structure specify which output is
the factor clock, and updates all current divs clocks accordingly.

We can then add new outputs after the factor clocks, at least not breaking
backward compatibility with regards to the devicetree bindings.

Also replace kzalloc with kcalloc in sunxi_divs_clk_setup().

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2015-03-25 11:46:32 -07:00
Michael Turquette
c77662a4df Merge branch 'for-4.1-clk-ti' of github.com:t-kristo/linux-pm into clk-next 2015-03-24 16:47:43 -07:00
Tony Lindgren
9089848d9a clk: ti: Implement FAPLL set_rate for the PLL
Since we have a fractional divider for the synthesizer, just implement
a simple multiply logic for the PLL.

It seems the PLL divider needs to have also the multiplier set for the PLL
to lock. At least I have not yet figured out if divided rates are doable.

So let's just ignore the PLL divider for now as the synthesizer has both
integer and fractional dividers so we don't even need to use the PLL
divider for the rates we know work with PLL locking.

Cc: Brian Hutchinson <b.hutchman@gmail.com>
Cc: Matthijs van Duin <matthijsvanduin@gmail.com>
Cc: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
2015-03-24 20:26:14 +02:00
Tony Lindgren
cafeb002cf clk: ti: Implement FAPLL set_rate for the synthesizer
We can pretty much get any rate out of the FAPLL because of the fractional
divider. Let's first try just adjusting the post divider, and if that is
not enough, then reprogram both the fractional divider and the post divider.

Let's also add a define for the fixed SYNTH_PHASE_K instead of using 8.

Cc: Brian Hutchinson <b.hutchman@gmail.com>
Cc: Matthijs van Duin <matthijsvanduin@gmail.com>
Cc: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
2015-03-24 20:26:05 +02:00
Tony Lindgren
33ca29c99e clk: ti: Fix FAPLL recalc_rate for rounding errors
We need to round the calculated value to have it match the requested rate.

While at it, let's fix a typo and use a define for SYNTH_MAX_DIV_M as we
will need it in later patches for set_rate.

And let's remove two unused includes.

Cc: Brian Hutchinson <b.hutchman@gmail.com>
Cc: Matthijs van Duin <matthijsvanduin@gmail.com>
Cc: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
2015-03-24 20:26:05 +02:00
Suman Anna
712f7d64f0 clk: ti: DRA7: Add timer_sys_ck aliases for Timers 13 through 16
The OMAP DMTimer API, omap_dm_timer_set_source(), uses the clock name
timer_sys_ck for setting a timer's clock source for the source index
OMAP_TIMER_SRC_SYS_CLK. There is currently no clock alias data for
the Timers 13 through 16 for this clock name, so add the same.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
2015-03-24 20:23:51 +02:00
Suman Anna
d4295be387 clk: ti: DRA7: Correct timer_sys_ck clock aliases for Timers
The OMAP DMTimer API, omap_dm_timer_set_source(), can set the parent
of a timer node using 3 different values that use fixed parent names
for the clocks. The parent name, timer_sys_ck, is used for setting the
parent when used with the source index OMAP_TIMER_SRC_SYS_CLK. This
should point to the TIMER_SYS_CLK and not the SYSCLKIN2, so correct
the clock aliases appropriately. SYSCLKIN2 is not a mandatory clock
input.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
2015-03-24 20:23:50 +02:00
Suman Anna
03ff41a938 clk: ti: OMAP5: Correct the DT clock aliases for timers
The DT clock aliases for Timers use the legacy (non-DT) device
names and a source clock named sys_ck. OMAP5 is DT-boot only,
so correct the DT clock aliases to use the DT device names
instead. Also, the source clock name is corrected from 'sys_ck'
to 'timer_sys_ck', the name used by the OMAP dmtimer driver.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
2015-03-24 20:23:50 +02:00
Suman Anna
2ff8d75c23 clk: ti: OMAP4: Remove the legacy timer DT clock aliases
The DT clock aliases for timers using the legacy OMAP timer
device names have been cleaned up. These device names reflect
the names used in legacy boot, and are no longer applicable
as OMAP4 is DT boot only now.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
2015-03-24 20:23:50 +02:00
Peter Ujfalusi
c8d3829212 clk: ti: clk-3xxx-legacy: Correct McBSP related clock aliases
Correct the McBSP2/4 ick mapping (they were 2->4 and 4->2).
Add missing mcbsp clock aliases.
Collect the McBSP clock definition in one location at the same time.

Fixes the following warning on boot:
[    0.307739] omap_hwmod: mcbsp2: _wait_target_ready failed: -16
[    0.307769] omap_hwmod: mcbsp2: cannot be enabled for reset (3)

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
2015-03-24 20:23:50 +02:00
Peter Ujfalusi
f757d1b047 clk: ti: clk-3xxx: Correct McBSP related DT clock definitions
In DT boot we do not have devices named as omap-mcbsp.X.
Correct the McBSP2/4 ick mapping (they were 2->4 and 4->2).
Collect the McBSP clock definition in one location at the same time.

Fixes the following warning on boot:
[    0.307739] omap_hwmod: mcbsp2: _wait_target_ready failed: -16
[    0.307769] omap_hwmod: mcbsp2: cannot be enabled for reset (3)

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
2015-03-24 20:23:50 +02:00
Tero Kristo
c807dbedb5 clk: ti: fix ti_clk_get_reg_addr error handling
There is a case where NULL can be a valid return value for
ti_clk_get_reg_addr, specifically the case where both the provider index
and register offsets are zero. In this case, the current error checking
against a NULL pointer will fail. Thus, change the API to return a
ERR_PTR value in an error case, and change all the users of this API to
check against IS_ERR instead.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Acked-by: Michael Turquette <mturquette@linaro.org>
2015-03-24 20:23:36 +02:00
Georgi Djakov
3966fab8b6 clk: qcom: Add MSM8916 Global Clock Controller support
This patch adds support for the global clock controller found on the MSM8916
based devices. It allows the various device drivers to probe and control
their clocks and resets.

Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
[sboyd@codeaurora.org: Removed NULL entry from parent_maps]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2015-03-23 16:09:22 -07:00
Georgi Djakov
a5408ec605 dt-bindings: Add #defines for MSM8916 clocks and resets
Add clocks/resets defines for the global clock controller
found on Qualcomm MSM8916 SoCs.

Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2015-03-23 16:09:20 -07:00
Georgi Djakov
293d2e97b3 clk: qcom: Introduce parent_map tables
In the current parent mapping code, we can get duplicate or inconsistent
indexes, which leads to discrepancy between the number of elements in the
array and the number of parents. Until now, this was solved with some
reordering but this is not always possible.

This patch introduces index tables that are used to define the relations
between the PLL source and the hardware mux configuration value.
To accomplish this, here we do the following:
 - Define a parent_map struct to map the relations between PLL source index
 and register configuration value.
 - Add a qcom_find_src_index() function for finding the index of a clock
 matching the specific PLL configuration.
 - Update the {set,get}_parent RCG functions use the newly introduced
 parent_map struct.
 - Convert all existing drivers to the new parent_map tables.

Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2015-03-23 16:09:19 -07:00
Georgi Djakov
fae507afbd clk: qcom: Do some error handling in configure_bank()
Currently configure_bank() returns void. Add some error
checking on the regmap calls and propagate if there is
any error.

Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2015-03-23 16:09:18 -07:00