aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk
diff options
context:
space:
mode:
authorPeter De Schrijver <pdeschrijver@nvidia.com>2013-02-07 11:37:35 -0500
committerStephen Warren <swarren@nvidia.com>2013-02-12 12:29:13 -0500
commitd076a206b2dfa8ef7a735289fe1221e77d1fa83f (patch)
treed579f122ee8adadadf09dec5e01984e67837367a /drivers/clk
parentc64c65d494ade53fa41fb0b980381807743b5095 (diff)
clk: tegra: Add missing spinlock for hclk and pclk
The hclk and pclk clocks are controlled by the same register. Hence a lock is required to avoid corruption. Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com> Acked-by: Mike Turquette <mturquette@linaro.org> Reviewed-by: Prashant Gaikwad <pgaikwad@nvidia.com> Signed-off-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'drivers/clk')
-rw-r--r--drivers/clk/tegra/clk-tegra20.c11
-rw-r--r--drivers/clk/tegra/clk-tegra30.c11
2 files changed, 14 insertions, 8 deletions
diff --git a/drivers/clk/tegra/clk-tegra20.c b/drivers/clk/tegra/clk-tegra20.c
index 5d41569883a7..4612b2e4a5a9 100644
--- a/drivers/clk/tegra/clk-tegra20.c
+++ b/drivers/clk/tegra/clk-tegra20.c
@@ -194,6 +194,7 @@ static void __iomem *clk_base;
194static void __iomem *pmc_base; 194static void __iomem *pmc_base;
195 195
196static DEFINE_SPINLOCK(pll_div_lock); 196static DEFINE_SPINLOCK(pll_div_lock);
197static DEFINE_SPINLOCK(sysrate_lock);
197 198
198#define TEGRA_INIT_DATA_MUX(_name, _con_id, _dev_id, _parents, _offset, \ 199#define TEGRA_INIT_DATA_MUX(_name, _con_id, _dev_id, _parents, _offset, \
199 _clk_num, _regs, _gate_flags, _clk_id) \ 200 _clk_num, _regs, _gate_flags, _clk_id) \
@@ -768,19 +769,21 @@ static void tegra20_super_clk_init(void)
768 769
769 /* HCLK */ 770 /* HCLK */
770 clk = clk_register_divider(NULL, "hclk_div", "sclk", 0, 771 clk = clk_register_divider(NULL, "hclk_div", "sclk", 0,
771 clk_base + CLK_SYSTEM_RATE, 4, 2, 0, NULL); 772 clk_base + CLK_SYSTEM_RATE, 4, 2, 0,
773 &sysrate_lock);
772 clk = clk_register_gate(NULL, "hclk", "hclk_div", CLK_SET_RATE_PARENT, 774 clk = clk_register_gate(NULL, "hclk", "hclk_div", CLK_SET_RATE_PARENT,
773 clk_base + CLK_SYSTEM_RATE, 7, 775 clk_base + CLK_SYSTEM_RATE, 7,
774 CLK_GATE_SET_TO_DISABLE, NULL); 776 CLK_GATE_SET_TO_DISABLE, &sysrate_lock);
775 clk_register_clkdev(clk, "hclk", NULL); 777 clk_register_clkdev(clk, "hclk", NULL);
776 clks[hclk] = clk; 778 clks[hclk] = clk;
777 779
778 /* PCLK */ 780 /* PCLK */
779 clk = clk_register_divider(NULL, "pclk_div", "hclk", 0, 781 clk = clk_register_divider(NULL, "pclk_div", "hclk", 0,
780 clk_base + CLK_SYSTEM_RATE, 0, 2, 0, NULL); 782 clk_base + CLK_SYSTEM_RATE, 0, 2, 0,
783 &sysrate_lock);
781 clk = clk_register_gate(NULL, "pclk", "pclk_div", CLK_SET_RATE_PARENT, 784 clk = clk_register_gate(NULL, "pclk", "pclk_div", CLK_SET_RATE_PARENT,
782 clk_base + CLK_SYSTEM_RATE, 3, 785 clk_base + CLK_SYSTEM_RATE, 3,
783 CLK_GATE_SET_TO_DISABLE, NULL); 786 CLK_GATE_SET_TO_DISABLE, &sysrate_lock);
784 clk_register_clkdev(clk, "pclk", NULL); 787 clk_register_clkdev(clk, "pclk", NULL);
785 clks[pclk] = clk; 788 clks[pclk] = clk;
786 789
diff --git a/drivers/clk/tegra/clk-tegra30.c b/drivers/clk/tegra/clk-tegra30.c
index 1d41b35975bf..8a4fec443c00 100644
--- a/drivers/clk/tegra/clk-tegra30.c
+++ b/drivers/clk/tegra/clk-tegra30.c
@@ -275,6 +275,7 @@ static DEFINE_SPINLOCK(clk_out_lock);
275static DEFINE_SPINLOCK(pll_div_lock); 275static DEFINE_SPINLOCK(pll_div_lock);
276static DEFINE_SPINLOCK(cml_lock); 276static DEFINE_SPINLOCK(cml_lock);
277static DEFINE_SPINLOCK(pll_d_lock); 277static DEFINE_SPINLOCK(pll_d_lock);
278static DEFINE_SPINLOCK(sysrate_lock);
278 279
279#define TEGRA_INIT_DATA_MUX(_name, _con_id, _dev_id, _parents, _offset, \ 280#define TEGRA_INIT_DATA_MUX(_name, _con_id, _dev_id, _parents, _offset, \
280 _clk_num, _regs, _gate_flags, _clk_id) \ 281 _clk_num, _regs, _gate_flags, _clk_id) \
@@ -1348,19 +1349,21 @@ static void __init tegra30_super_clk_init(void)
1348 1349
1349 /* HCLK */ 1350 /* HCLK */
1350 clk = clk_register_divider(NULL, "hclk_div", "sclk", 0, 1351 clk = clk_register_divider(NULL, "hclk_div", "sclk", 0,
1351 clk_base + SYSTEM_CLK_RATE, 4, 2, 0, NULL); 1352 clk_base + SYSTEM_CLK_RATE, 4, 2, 0,
1353 &sysrate_lock);
1352 clk = clk_register_gate(NULL, "hclk", "hclk_div", CLK_SET_RATE_PARENT, 1354 clk = clk_register_gate(NULL, "hclk", "hclk_div", CLK_SET_RATE_PARENT,
1353 clk_base + SYSTEM_CLK_RATE, 7, 1355 clk_base + SYSTEM_CLK_RATE, 7,
1354 CLK_GATE_SET_TO_DISABLE, NULL); 1356 CLK_GATE_SET_TO_DISABLE, &sysrate_lock);
1355 clk_register_clkdev(clk, "hclk", NULL); 1357 clk_register_clkdev(clk, "hclk", NULL);
1356 clks[hclk] = clk; 1358 clks[hclk] = clk;
1357 1359
1358 /* PCLK */ 1360 /* PCLK */
1359 clk = clk_register_divider(NULL, "pclk_div", "hclk", 0, 1361 clk = clk_register_divider(NULL, "pclk_div", "hclk", 0,
1360 clk_base + SYSTEM_CLK_RATE, 0, 2, 0, NULL); 1362 clk_base + SYSTEM_CLK_RATE, 0, 2, 0,
1363 &sysrate_lock);
1361 clk = clk_register_gate(NULL, "pclk", "pclk_div", CLK_SET_RATE_PARENT, 1364 clk = clk_register_gate(NULL, "pclk", "pclk_div", CLK_SET_RATE_PARENT,
1362 clk_base + SYSTEM_CLK_RATE, 3, 1365 clk_base + SYSTEM_CLK_RATE, 3,
1363 CLK_GATE_SET_TO_DISABLE, NULL); 1366 CLK_GATE_SET_TO_DISABLE, &sysrate_lock);
1364 clk_register_clkdev(clk, "pclk", NULL); 1367 clk_register_clkdev(clk, "pclk", NULL);
1365 clks[pclk] = clk; 1368 clks[pclk] = clk;
1366 1369