aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2010-09-16 17:59:49 -0400
committerColin Cross <ccross@android.com>2011-02-21 02:36:50 -0500
commit35c47c3bbaa82b046d645aed2b709ce12ef0e25e (patch)
treeb28d9d554bbf2e16b3c16ae41d64c950a442e2a5 /arch
parentbd41ef55e88ae03381569e51ad6ff3bab35e7b0e (diff)
ARM: tegra: clock: Don't use PLL lock bits
The PLL lock bits are not reliable, use per-PLL timeouts instead. Acked-by: Olof Johansson <olof@lixom.net> Signed-off-by: Colin Cross <ccross@android.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-tegra/clock.h2
-rw-r--r--arch/arm/mach-tegra/tegra2_clocks.c31
2 files changed, 10 insertions, 23 deletions
diff --git a/arch/arm/mach-tegra/clock.h b/arch/arm/mach-tegra/clock.h
index 42f00c0af0de..b76d33df88d7 100644
--- a/arch/arm/mach-tegra/clock.h
+++ b/arch/arm/mach-tegra/clock.h
@@ -53,7 +53,6 @@ struct dvfs_process_id_table {
53 struct dvfs_table *table; 53 struct dvfs_table *table;
54}; 54};
55 55
56
57struct dvfs { 56struct dvfs {
58 struct regulator *reg; 57 struct regulator *reg;
59 struct dvfs_table *table; 58 struct dvfs_table *table;
@@ -128,6 +127,7 @@ struct clk {
128 unsigned long vco_min; 127 unsigned long vco_min;
129 unsigned long vco_max; 128 unsigned long vco_max;
130 const struct clk_pll_table *pll_table; 129 const struct clk_pll_table *pll_table;
130 int pll_lock_delay;
131 131
132 /* DIV */ 132 /* DIV */
133 u32 div; 133 u32 div;
diff --git a/arch/arm/mach-tegra/tegra2_clocks.c b/arch/arm/mach-tegra/tegra2_clocks.c
index 600a5a473ab5..eb4e9ca5c6ae 100644
--- a/arch/arm/mach-tegra/tegra2_clocks.c
+++ b/arch/arm/mach-tegra/tegra2_clocks.c
@@ -79,7 +79,6 @@
79#define PLL_BASE_ENABLE (1<<30) 79#define PLL_BASE_ENABLE (1<<30)
80#define PLL_BASE_REF_ENABLE (1<<29) 80#define PLL_BASE_REF_ENABLE (1<<29)
81#define PLL_BASE_OVERRIDE (1<<28) 81#define PLL_BASE_OVERRIDE (1<<28)
82#define PLL_BASE_LOCK (1<<27)
83#define PLL_BASE_DIVP_MASK (0x7<<20) 82#define PLL_BASE_DIVP_MASK (0x7<<20)
84#define PLL_BASE_DIVP_SHIFT 20 83#define PLL_BASE_DIVP_SHIFT 20
85#define PLL_BASE_DIVN_MASK (0x3FF<<8) 84#define PLL_BASE_DIVN_MASK (0x3FF<<8)
@@ -94,7 +93,6 @@
94#define PLL_OUT_RESET_DISABLE (1<<0) 93#define PLL_OUT_RESET_DISABLE (1<<0)
95 94
96#define PLL_MISC(c) (((c)->flags & PLL_ALT_MISC_REG) ? 0x4 : 0xc) 95#define PLL_MISC(c) (((c)->flags & PLL_ALT_MISC_REG) ? 0x4 : 0xc)
97#define PLL_MISC_LOCK_ENABLE(c) (((c)->flags & PLLU) ? (1<<22) : (1<<18))
98 96
99#define PLL_MISC_DCCON_SHIFT 20 97#define PLL_MISC_DCCON_SHIFT 20
100#define PLL_MISC_CPCON_SHIFT 8 98#define PLL_MISC_CPCON_SHIFT 8
@@ -546,17 +544,7 @@ static struct clk_ops tegra_blink_clk_ops = {
546/* PLL Functions */ 544/* PLL Functions */
547static int tegra2_pll_clk_wait_for_lock(struct clk *c) 545static int tegra2_pll_clk_wait_for_lock(struct clk *c)
548{ 546{
549 ktime_t before; 547 udelay(c->pll_lock_delay);
550
551 before = ktime_get();
552
553 while (!(clk_readl(c->reg + PLL_BASE) & PLL_BASE_LOCK)) {
554 if (ktime_us_delta(ktime_get(), before) > 5000) {
555 pr_err("Timed out waiting for lock bit on pll %s",
556 c->name);
557 return -1;
558 }
559 }
560 548
561 return 0; 549 return 0;
562} 550}
@@ -594,10 +582,6 @@ static int tegra2_pll_clk_enable(struct clk *c)
594 val |= PLL_BASE_ENABLE; 582 val |= PLL_BASE_ENABLE;
595 clk_writel(val, c->reg + PLL_BASE); 583 clk_writel(val, c->reg + PLL_BASE);
596 584
597 val = clk_readl(c->reg + PLL_MISC(c));
598 val |= PLL_MISC_LOCK_ENABLE(c);
599 clk_writel(val, c->reg + PLL_MISC(c));
600
601 tegra2_pll_clk_wait_for_lock(c); 585 tegra2_pll_clk_wait_for_lock(c);
602 586
603 return 0; 587 return 0;
@@ -1177,6 +1161,7 @@ static struct clk tegra_pll_s = {
1177 .vco_max = 26000000, 1161 .vco_max = 26000000,
1178 .pll_table = tegra_pll_s_table, 1162 .pll_table = tegra_pll_s_table,
1179 .max_rate = 26000000, 1163 .max_rate = 26000000,
1164 .pll_lock_delay = 300,
1180}; 1165};
1181 1166
1182static struct clk_mux_sel tegra_clk_m_sel[] = { 1167static struct clk_mux_sel tegra_clk_m_sel[] = {
@@ -1213,6 +1198,7 @@ static struct clk tegra_pll_c = {
1213 .vco_max = 1400000000, 1198 .vco_max = 1400000000,
1214 .pll_table = tegra_pll_c_table, 1199 .pll_table = tegra_pll_c_table,
1215 .max_rate = 600000000, 1200 .max_rate = 600000000,
1201 .pll_lock_delay = 300,
1216}; 1202};
1217 1203
1218static struct clk tegra_pll_c_out1 = { 1204static struct clk tegra_pll_c_out1 = {
@@ -1251,6 +1237,7 @@ static struct clk tegra_pll_m = {
1251 .vco_max = 1200000000, 1237 .vco_max = 1200000000,
1252 .pll_table = tegra_pll_m_table, 1238 .pll_table = tegra_pll_m_table,
1253 .max_rate = 800000000, 1239 .max_rate = 800000000,
1240 .pll_lock_delay = 300,
1254}; 1241};
1255 1242
1256static struct clk tegra_pll_m_out1 = { 1243static struct clk tegra_pll_m_out1 = {
@@ -1289,6 +1276,7 @@ static struct clk tegra_pll_p = {
1289 .vco_max = 1400000000, 1276 .vco_max = 1400000000,
1290 .pll_table = tegra_pll_p_table, 1277 .pll_table = tegra_pll_p_table,
1291 .max_rate = 432000000, 1278 .max_rate = 432000000,
1279 .pll_lock_delay = 300,
1292}; 1280};
1293 1281
1294static struct clk tegra_pll_p_out1 = { 1282static struct clk tegra_pll_p_out1 = {
@@ -1354,6 +1342,7 @@ static struct clk tegra_pll_a = {
1354 .vco_max = 1400000000, 1342 .vco_max = 1400000000,
1355 .pll_table = tegra_pll_a_table, 1343 .pll_table = tegra_pll_a_table,
1356 .max_rate = 56448000, 1344 .max_rate = 56448000,
1345 .pll_lock_delay = 300,
1357}; 1346};
1358 1347
1359static struct clk tegra_pll_a_out0 = { 1348static struct clk tegra_pll_a_out0 = {
@@ -1399,6 +1388,7 @@ static struct clk tegra_pll_d = {
1399 .vco_max = 1000000000, 1388 .vco_max = 1000000000,
1400 .pll_table = tegra_pll_d_table, 1389 .pll_table = tegra_pll_d_table,
1401 .max_rate = 1000000000, 1390 .max_rate = 1000000000,
1391 .pll_lock_delay = 1000,
1402}; 1392};
1403 1393
1404static struct clk tegra_pll_d_out0 = { 1394static struct clk tegra_pll_d_out0 = {
@@ -1431,6 +1421,7 @@ static struct clk tegra_pll_u = {
1431 .vco_max = 960000000, 1421 .vco_max = 960000000,
1432 .pll_table = tegra_pll_u_table, 1422 .pll_table = tegra_pll_u_table,
1433 .max_rate = 480000000, 1423 .max_rate = 480000000,
1424 .pll_lock_delay = 1000,
1434}; 1425};
1435 1426
1436static struct clk_pll_table tegra_pll_x_table[] = { 1427static struct clk_pll_table tegra_pll_x_table[] = {
@@ -1493,6 +1484,7 @@ static struct clk tegra_pll_x = {
1493 .vco_max = 1200000000, 1484 .vco_max = 1200000000,
1494 .pll_table = tegra_pll_x_table, 1485 .pll_table = tegra_pll_x_table,
1495 .max_rate = 1000000000, 1486 .max_rate = 1000000000,
1487 .pll_lock_delay = 300,
1496}; 1488};
1497 1489
1498static struct clk_pll_table tegra_pll_e_table[] = { 1490static struct clk_pll_table tegra_pll_e_table[] = {
@@ -1972,7 +1964,6 @@ static u32 clk_rst_suspend[RST_DEVICES_NUM + CLK_OUT_ENB_NUM +
1972void tegra_clk_suspend(void) 1964void tegra_clk_suspend(void)
1973{ 1965{
1974 unsigned long off, i; 1966 unsigned long off, i;
1975 u32 pllx_misc;
1976 u32 *ctx = clk_rst_suspend; 1967 u32 *ctx = clk_rst_suspend;
1977 1968
1978 *ctx++ = clk_readl(OSC_CTRL) & OSC_CTRL_MASK; 1969 *ctx++ = clk_readl(OSC_CTRL) & OSC_CTRL_MASK;
@@ -2013,10 +2004,6 @@ void tegra_clk_suspend(void)
2013 2004
2014 *ctx++ = clk_readl(MISC_CLK_ENB); 2005 *ctx++ = clk_readl(MISC_CLK_ENB);
2015 *ctx++ = clk_readl(CLK_MASK_ARM); 2006 *ctx++ = clk_readl(CLK_MASK_ARM);
2016
2017 pllx_misc = clk_readl(tegra_pll_x.reg + PLL_MISC(&tegra_pll_x));
2018 pllx_misc &= ~PLL_MISC_LOCK_ENABLE(&tegra_pll_x);
2019 clk_writel(pllx_misc, tegra_pll_x.reg + PLL_MISC(&tegra_pll_x));
2020} 2007}
2021 2008
2022void tegra_clk_resume(void) 2009void tegra_clk_resume(void)