aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-02-21 18:38:49 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-21 18:38:49 -0500
commita8f3740feb12928be1aad19659bf3527ea8d6d96 (patch)
treef455479d5b9edd38ed2ca2ab878d2217025960db /drivers/clk
parent6c5096e5538b455bc3bea2b02588c380f070d8c6 (diff)
parent89dfe564b5926297ee29b973fe75e25c83c5e615 (diff)
Merge tag 'dt' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC device tree conversions from Arnd Bergmann: "These are device tree conversions for a number of platforms, with the intention of turning code from board files into device tree descriptions. Notable changes are: - davinci bindings for pinctrl, MTD, RTC, watchdog and i2c - nomadik bindings for all devices, removing the board files - bcm2835 bindings for mmc and i2c - tegra bindings for hdmi, keyboard, audio, as well as some updates - at91 bindings for hardware ecc and for devices on RM9200 - mxs bindings for cfa100xx - sunxi support for Miniand Hackberry board" * tag 'dt' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (72 commits) Revert "sunxi: a10-cubieboard: Add user LEDs to the device tree" Revert "sunxi: a13-olinuxino: Add user LED to the device tree" clk: tegra: initialise parent of uart clocks ARM: tegra: remove clock-frequency properties from serial nodes clk: tegra: fix driver to match DT binding clk: tegra: local arrays should be static clk: tegra: Add missing spinlock for hclk and pclk clk: tegra: Implement locking for super clock clk: tegra: fix wrong clock index between se to sata_cold sunxi: a13-olinuxino: Add user LED to the device tree ARM: davinci: da850 DT: add support for machine reboot ARM: davinci: da850: add wdt DT node ARM: davinci: da850: add DT node for I2C0 ARM: at91: at91sam9n12: add DT parameters to enable PMECC ARM: at91: at91sam9x5: add DT parameters to enable PMECC ARM: at91: add EMAC bindings to RM9200 DT ARM: at91: add SSC bindings to RM9200 DT ARM: at91: add MMC bindings to RM9200 DT ARM: at91: Animeo IP: enable watchdog support ARM: nomadik: fix OF compilation regression ...
Diffstat (limited to 'drivers/clk')
-rw-r--r--drivers/clk/tegra/clk-super.c18
-rw-r--r--drivers/clk/tegra/clk-tegra20.c22
-rw-r--r--drivers/clk/tegra/clk-tegra30.c47
3 files changed, 56 insertions, 31 deletions
diff --git a/drivers/clk/tegra/clk-super.c b/drivers/clk/tegra/clk-super.c
index 7ad48a832334..2fd924d38606 100644
--- a/drivers/clk/tegra/clk-super.c
+++ b/drivers/clk/tegra/clk-super.c
@@ -73,7 +73,12 @@ static int clk_super_set_parent(struct clk_hw *hw, u8 index)
73{ 73{
74 struct tegra_clk_super_mux *mux = to_clk_super_mux(hw); 74 struct tegra_clk_super_mux *mux = to_clk_super_mux(hw);
75 u32 val, state; 75 u32 val, state;
76 int err = 0;
76 u8 parent_index, shift; 77 u8 parent_index, shift;
78 unsigned long flags = 0;
79
80 if (mux->lock)
81 spin_lock_irqsave(mux->lock, flags);
77 82
78 val = readl_relaxed(mux->reg); 83 val = readl_relaxed(mux->reg);
79 state = val & SUPER_STATE_MASK; 84 state = val & SUPER_STATE_MASK;
@@ -92,8 +97,10 @@ static int clk_super_set_parent(struct clk_hw *hw, u8 index)
92 (index == mux->pllx_index))) { 97 (index == mux->pllx_index))) {
93 parent_index = clk_super_get_parent(hw); 98 parent_index = clk_super_get_parent(hw);
94 if ((parent_index == mux->div2_index) || 99 if ((parent_index == mux->div2_index) ||
95 (parent_index == mux->pllx_index)) 100 (parent_index == mux->pllx_index)) {
96 return -EINVAL; 101 err = -EINVAL;
102 goto out;
103 }
97 104
98 val ^= SUPER_LP_DIV2_BYPASS; 105 val ^= SUPER_LP_DIV2_BYPASS;
99 writel_relaxed(val, mux->reg); 106 writel_relaxed(val, mux->reg);
@@ -107,7 +114,12 @@ static int clk_super_set_parent(struct clk_hw *hw, u8 index)
107 114
108 writel_relaxed(val, mux->reg); 115 writel_relaxed(val, mux->reg);
109 udelay(2); 116 udelay(2);
110 return 0; 117
118out:
119 if (mux->lock)
120 spin_unlock_irqrestore(mux->lock, flags);
121
122 return err;
111} 123}
112 124
113const struct clk_ops tegra_clk_super_ops = { 125const struct clk_ops tegra_clk_super_ops = {
diff --git a/drivers/clk/tegra/clk-tegra20.c b/drivers/clk/tegra/clk-tegra20.c
index 5d41569883a7..143ce1f899ad 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) \
@@ -239,8 +240,8 @@ enum tegra20_clk {
239 uartb = 96, vfir, spdif_in, spdif_out, vi, vi_sensor, tvo, cve, 240 uartb = 96, vfir, spdif_in, spdif_out, vi, vi_sensor, tvo, cve,
240 osc, clk_32k, clk_m, sclk, cclk, hclk, pclk, blink, pll_a, pll_a_out0, 241 osc, clk_32k, clk_m, sclk, cclk, hclk, pclk, blink, pll_a, pll_a_out0,
241 pll_c, pll_c_out1, pll_d, pll_d_out0, pll_e, pll_m, pll_m_out1, 242 pll_c, pll_c_out1, pll_d, pll_d_out0, pll_e, pll_m, pll_m_out1,
242 pll_p, pll_p_out1, pll_p_out2, pll_p_out3, pll_p_out4, pll_u, 243 pll_p, pll_p_out1, pll_p_out2, pll_p_out3, pll_p_out4, pll_s, pll_u,
243 pll_x, audio, pll_ref, twd, clk_max, 244 pll_x, cop, audio, pll_ref, twd, clk_max,
244}; 245};
245 246
246static struct clk *clks[clk_max]; 247static struct clk *clks[clk_max];
@@ -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
@@ -1251,8 +1254,11 @@ static __initdata struct tegra_clk_init_table init_table[] = {
1251 {csite, clk_max, 0, 1}, 1254 {csite, clk_max, 0, 1},
1252 {emc, clk_max, 0, 1}, 1255 {emc, clk_max, 0, 1},
1253 {cclk, clk_max, 0, 1}, 1256 {cclk, clk_max, 0, 1},
1254 {uarta, pll_p, 0, 1}, 1257 {uarta, pll_p, 0, 0},
1255 {uartd, pll_p, 0, 1}, 1258 {uartb, pll_p, 0, 0},
1259 {uartc, pll_p, 0, 0},
1260 {uartd, pll_p, 0, 0},
1261 {uarte, pll_p, 0, 0},
1256 {usbd, clk_max, 12000000, 0}, 1262 {usbd, clk_max, 12000000, 0},
1257 {usb2, clk_max, 12000000, 0}, 1263 {usb2, clk_max, 12000000, 0},
1258 {usb3, clk_max, 12000000, 0}, 1264 {usb3, clk_max, 12000000, 0},
diff --git a/drivers/clk/tegra/clk-tegra30.c b/drivers/clk/tegra/clk-tegra30.c
index a1638129eba4..32c61cb6d0bb 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) \
@@ -327,21 +328,21 @@ enum tegra30_clk {
327 kbc = 36, statmon, pmc, kfuse = 40, sbc1, nor, sbc2 = 44, sbc3 = 46, 328 kbc = 36, statmon, pmc, kfuse = 40, sbc1, nor, sbc2 = 44, sbc3 = 46,
328 i2c5, dsia, mipi = 50, hdmi, csi, tvdac, i2c2, uartc, emc = 57, usb2, 329 i2c5, dsia, mipi = 50, hdmi, csi, tvdac, i2c2, uartc, emc = 57, usb2,
329 usb3, mpe, vde, bsea, bsev, speedo, uartd, uarte, i2c3, sbc4, sdmmc3, 330 usb3, mpe, vde, bsea, bsev, speedo, uartd, uarte, i2c3, sbc4, sdmmc3,
330 pcie, owr, afi, csite, pciex, avpucq, la, dtv = 79, ndspeed, i2c_slow, 331 pcie, owr, afi, csite, pciex, avpucq, la, dtv = 79, ndspeed, i2cslow,
331 dsib, irama = 84, iramb, iramc, iramd, cram2, audio_2x = 90, csus = 92, 332 dsib, irama = 84, iramb, iramc, iramd, cram2, audio_2x = 90, csus = 92,
332 cdev1, cdev2, cpu_g = 96, cpu_lp, gr3d2, mselect, tsensor, i2s3, i2s4, 333 cdev1, cdev2, cpu_g = 96, cpu_lp, gr3d2, mselect, tsensor, i2s3, i2s4,
333 i2c4, sbc5, sbc6, d_audio, apbif, dam0, dam1, dam2, hda2codec_2x, 334 i2c4, sbc5, sbc6, d_audio, apbif, dam0, dam1, dam2, hda2codec_2x,
334 atomics, audio0_2x, audio1_2x, audio2_2x, audio3_2x, audio4_2x, 335 atomics, audio0_2x, audio1_2x, audio2_2x, audio3_2x, audio4_2x,
335 spdif_2x, actmon, extern1, extern2, extern3, sata_oob, sata, hda, se, 336 spdif_2x, actmon, extern1, extern2, extern3, sata_oob, sata, hda,
336 hda2hdmi, sata_cold, uartb = 160, vfir, spdif_out, spdif_in, vi, 337 se = 127, hda2hdmi, sata_cold, uartb = 160, vfir, spdif_in, spdif_out,
337 vi_sensor, fuse, fuse_burn, cve, tvo, clk_32k, clk_m, clk_m_div2, 338 vi, vi_sensor, fuse, fuse_burn, cve, tvo, clk_32k, clk_m, clk_m_div2,
338 clk_m_div4, pll_ref, pll_c, pll_c_out1, pll_m, pll_m_out1, pll_p, 339 clk_m_div4, pll_ref, pll_c, pll_c_out1, pll_m, pll_m_out1, pll_p,
339 pll_p_out1, pll_p_out2, pll_p_out3, pll_p_out4, pll_a, pll_a_out0, 340 pll_p_out1, pll_p_out2, pll_p_out3, pll_p_out4, pll_a, pll_a_out0,
340 pll_d, pll_d_out0, pll_d2, pll_d2_out0, pll_u, pll_x, pll_x_out0, pll_e, 341 pll_d, pll_d_out0, pll_d2, pll_d2_out0, pll_u, pll_x, pll_x_out0, pll_e,
341 spdif_in_sync, i2s0_sync, i2s1_sync, i2s2_sync, i2s3_sync, i2s4_sync, 342 spdif_in_sync, i2s0_sync, i2s1_sync, i2s2_sync, i2s3_sync, i2s4_sync,
342 vimclk_sync, audio0, audio1, audio2, audio3, audio4, spdif, clk_out_1, 343 vimclk_sync, audio0, audio1, audio2, audio3, audio4, spdif, clk_out_1,
343 clk_out_2, clk_out_3, sclk, blink, cclk_g, cclk_lp, twd, cml0, cml1, 344 clk_out_2, clk_out_3, sclk, blink, cclk_g, cclk_lp, twd, cml0, cml1,
344 i2cslow, hclk, pclk, clk_out_1_mux = 300, clk_max 345 hclk, pclk, clk_out_1_mux = 300, clk_max
345}; 346};
346 347
347static struct clk *clks[clk_max]; 348static struct clk *clks[clk_max];
@@ -1249,16 +1250,16 @@ static void __init tegra30_pmc_clk_init(void)
1249 1250
1250} 1251}
1251 1252
1252const char *cclk_g_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m", 1253static const char *cclk_g_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m",
1253 "pll_p_cclkg", "pll_p_out4_cclkg", 1254 "pll_p_cclkg", "pll_p_out4_cclkg",
1254 "pll_p_out3_cclkg", "unused", "pll_x" }; 1255 "pll_p_out3_cclkg", "unused", "pll_x" };
1255const char *cclk_lp_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m", 1256static const char *cclk_lp_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m",
1256 "pll_p_cclklp", "pll_p_out4_cclklp", 1257 "pll_p_cclklp", "pll_p_out4_cclklp",
1257 "pll_p_out3_cclklp", "unused", "pll_x", 1258 "pll_p_out3_cclklp", "unused", "pll_x",
1258 "pll_x_out0" }; 1259 "pll_x_out0" };
1259const char *sclk_parents[] = { "clk_m", "pll_c_out1", "pll_p_out4", 1260static const char *sclk_parents[] = { "clk_m", "pll_c_out1", "pll_p_out4",
1260 "pll_p_out3", "pll_p_out2", "unused", 1261 "pll_p_out3", "pll_p_out2", "unused",
1261 "clk_32k", "pll_m_out1" }; 1262 "clk_32k", "pll_m_out1" };
1262 1263
1263static void __init tegra30_super_clk_init(void) 1264static void __init tegra30_super_clk_init(void)
1264{ 1265{
@@ -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
@@ -1874,7 +1877,11 @@ static struct tegra_cpu_car_ops tegra30_cpu_car_ops = {
1874}; 1877};
1875 1878
1876static __initdata struct tegra_clk_init_table init_table[] = { 1879static __initdata struct tegra_clk_init_table init_table[] = {
1877 {uarta, pll_p, 408000000, 1}, 1880 {uarta, pll_p, 408000000, 0},
1881 {uartb, pll_p, 408000000, 0},
1882 {uartc, pll_p, 408000000, 0},
1883 {uartd, pll_p, 408000000, 0},
1884 {uarte, pll_p, 408000000, 0},
1878 {pll_a, clk_max, 564480000, 1}, 1885 {pll_a, clk_max, 564480000, 1},
1879 {pll_a_out0, clk_max, 11289600, 1}, 1886 {pll_a_out0, clk_max, 11289600, 1},
1880 {extern1, pll_a_out0, 0, 1}, 1887 {extern1, pll_a_out0, 0, 1},