aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2010-10-04 14:49:26 -0400
committerColin Cross <ccross@android.com>2011-02-10 00:57:02 -0500
commitcea62c878dd8b73b67fb3e38f989e9d3241d5934 (patch)
treeb401e8e5fe0e53bc22caf8a1a478eb0d722ce5c4 /arch/arm
parent2ea67fd145397c1409ffc85b2210ccf7ef69a183 (diff)
ARM: tegra: clock: Suspend fixes, and add new clocks
Save and restore pll and osc state during suspend Add digital audio clocks Update clk dev associations Correct max clock frequencies Add pll_p as additional cpu clock state Add values to plld table Fix register offset for sdmmc4 clock Add blink timer to tegra2_clocks Signed-off-by: Colin Cross <ccross@android.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-tegra/tegra2_clocks.c263
1 files changed, 244 insertions, 19 deletions
diff --git a/arch/arm/mach-tegra/tegra2_clocks.c b/arch/arm/mach-tegra/tegra2_clocks.c
index 2dd2b031a853..7a2926ae2fd4 100644
--- a/arch/arm/mach-tegra/tegra2_clocks.c
+++ b/arch/arm/mach-tegra/tegra2_clocks.c
@@ -52,7 +52,7 @@
52#define OSC_CTRL_OSC_FREQ_19_2MHZ (1<<30) 52#define OSC_CTRL_OSC_FREQ_19_2MHZ (1<<30)
53#define OSC_CTRL_OSC_FREQ_12MHZ (2<<30) 53#define OSC_CTRL_OSC_FREQ_12MHZ (2<<30)
54#define OSC_CTRL_OSC_FREQ_26MHZ (3<<30) 54#define OSC_CTRL_OSC_FREQ_26MHZ (3<<30)
55#define OSC_CTRL_MASK 0x3f2 55#define OSC_CTRL_MASK (0x3f2 | OSC_CTRL_OSC_FREQ_MASK)
56 56
57#define OSC_FREQ_DET 0x58 57#define OSC_FREQ_DET 0x58
58#define OSC_FREQ_DET_TRIG (1<<31) 58#define OSC_FREQ_DET_TRIG (1<<31)
@@ -135,12 +135,29 @@
135#define BUS_CLK_DISABLE (1<<3) 135#define BUS_CLK_DISABLE (1<<3)
136#define BUS_CLK_DIV_MASK 0x3 136#define BUS_CLK_DIV_MASK 0x3
137 137
138#define PMC_CTRL 0x0
139 #define PMC_CTRL_BLINK_ENB (1 << 7)
140
141#define PMC_DPD_PADS_ORIDE 0x1c
142 #define PMC_DPD_PADS_ORIDE_BLINK_ENB (1 << 20)
143
144#define PMC_BLINK_TIMER_DATA_ON_SHIFT 0
145#define PMC_BLINK_TIMER_DATA_ON_MASK 0x7fff
146#define PMC_BLINK_TIMER_ENB (1 << 15)
147#define PMC_BLINK_TIMER_DATA_OFF_SHIFT 16
148#define PMC_BLINK_TIMER_DATA_OFF_MASK 0xffff
149
138static void __iomem *reg_clk_base = IO_ADDRESS(TEGRA_CLK_RESET_BASE); 150static void __iomem *reg_clk_base = IO_ADDRESS(TEGRA_CLK_RESET_BASE);
151static void __iomem *reg_pmc_base = IO_ADDRESS(TEGRA_PMC_BASE);
139 152
140#define clk_writel(value, reg) \ 153#define clk_writel(value, reg) \
141 __raw_writel(value, (u32)reg_clk_base + (reg)) 154 __raw_writel(value, (u32)reg_clk_base + (reg))
142#define clk_readl(reg) \ 155#define clk_readl(reg) \
143 __raw_readl((u32)reg_clk_base + (reg)) 156 __raw_readl((u32)reg_clk_base + (reg))
157#define pmc_writel(value, reg) \
158 __raw_writel(value, (u32)reg_pmc_base + (reg))
159#define pmc_readl(reg) \
160 __raw_readl((u32)reg_pmc_base + (reg))
144 161
145unsigned long clk_measure_input_freq(void) 162unsigned long clk_measure_input_freq(void)
146{ 163{
@@ -358,6 +375,9 @@ static int tegra2_cpu_clk_set_rate(struct clk *c, unsigned long rate)
358 return ret; 375 return ret;
359 } 376 }
360 377
378 if (rate == c->backup->rate)
379 goto out;
380
361 ret = clk_set_rate_locked(c->main, rate); 381 ret = clk_set_rate_locked(c->main, rate);
362 if (ret) { 382 if (ret) {
363 pr_err("Failed to change cpu pll to %lu\n", rate); 383 pr_err("Failed to change cpu pll to %lu\n", rate);
@@ -370,6 +390,7 @@ static int tegra2_cpu_clk_set_rate(struct clk *c, unsigned long rate)
370 return ret; 390 return ret;
371 } 391 }
372 392
393out:
373 return 0; 394 return 0;
374} 395}
375 396
@@ -429,6 +450,87 @@ static struct clk_ops tegra_bus_ops = {
429 .set_rate = tegra2_bus_clk_set_rate, 450 .set_rate = tegra2_bus_clk_set_rate,
430}; 451};
431 452
453/* Blink output functions */
454
455static void tegra2_blink_clk_init(struct clk *c)
456{
457 u32 val;
458
459 val = pmc_readl(PMC_CTRL);
460 c->state = (val & PMC_CTRL_BLINK_ENB) ? ON : OFF;
461 c->mul = 1;
462 val = pmc_readl(c->reg);
463
464 if (val & PMC_BLINK_TIMER_ENB) {
465 unsigned int on_off;
466
467 on_off = (val >> PMC_BLINK_TIMER_DATA_ON_SHIFT) &
468 PMC_BLINK_TIMER_DATA_ON_MASK;
469 val >>= PMC_BLINK_TIMER_DATA_OFF_SHIFT;
470 val &= PMC_BLINK_TIMER_DATA_OFF_MASK;
471 on_off += val;
472 /* each tick in the blink timer is 4 32KHz clocks */
473 c->div = on_off * 4;
474 } else {
475 c->div = 1;
476 }
477}
478
479static int tegra2_blink_clk_enable(struct clk *c)
480{
481 u32 val;
482
483 val = pmc_readl(PMC_DPD_PADS_ORIDE);
484 pmc_writel(val | PMC_DPD_PADS_ORIDE_BLINK_ENB, PMC_DPD_PADS_ORIDE);
485
486 val = pmc_readl(PMC_CTRL);
487 pmc_writel(val | PMC_CTRL_BLINK_ENB, PMC_CTRL);
488
489 return 0;
490}
491
492static void tegra2_blink_clk_disable(struct clk *c)
493{
494 u32 val;
495
496 val = pmc_readl(PMC_CTRL);
497 pmc_writel(val & ~PMC_CTRL_BLINK_ENB, PMC_CTRL);
498
499 val = pmc_readl(PMC_DPD_PADS_ORIDE);
500 pmc_writel(val & ~PMC_DPD_PADS_ORIDE_BLINK_ENB, PMC_DPD_PADS_ORIDE);
501}
502
503static int tegra2_blink_clk_set_rate(struct clk *c, unsigned long rate)
504{
505 if (rate >= c->parent->rate) {
506 c->div = 1;
507 pmc_writel(0, c->reg);
508 } else {
509 unsigned int on_off;
510 u32 val;
511
512 on_off = DIV_ROUND_UP(c->parent->rate / 8, rate);
513 c->div = on_off * 8;
514
515 val = (on_off & PMC_BLINK_TIMER_DATA_ON_MASK) <<
516 PMC_BLINK_TIMER_DATA_ON_SHIFT;
517 on_off &= PMC_BLINK_TIMER_DATA_OFF_MASK;
518 on_off <<= PMC_BLINK_TIMER_DATA_OFF_SHIFT;
519 val |= on_off;
520 val |= PMC_BLINK_TIMER_ENB;
521 pmc_writel(val, c->reg);
522 }
523
524 return 0;
525}
526
527static struct clk_ops tegra_blink_clk_ops = {
528 .init = &tegra2_blink_clk_init,
529 .enable = &tegra2_blink_clk_enable,
530 .disable = &tegra2_blink_clk_disable,
531 .set_rate = &tegra2_blink_clk_set_rate,
532};
533
432/* PLL Functions */ 534/* PLL Functions */
433static int tegra2_pll_clk_wait_for_lock(struct clk *c) 535static int tegra2_pll_clk_wait_for_lock(struct clk *c)
434{ 536{
@@ -929,6 +1031,7 @@ static struct clk_ops tegra_clk_double_ops = {
929 .set_rate = &tegra2_clk_double_set_rate, 1031 .set_rate = &tegra2_clk_double_set_rate,
930}; 1032};
931 1033
1034/* Audio sync clock ops */
932static void tegra2_audio_sync_clk_init(struct clk *c) 1035static void tegra2_audio_sync_clk_init(struct clk *c)
933{ 1036{
934 int source; 1037 int source;
@@ -1007,6 +1110,37 @@ static struct clk_ops tegra_audio_sync_clk_ops = {
1007 .set_parent = tegra2_audio_sync_clk_set_parent, 1110 .set_parent = tegra2_audio_sync_clk_set_parent,
1008}; 1111};
1009 1112
1113/* cdev1 and cdev2 (dap_mclk1 and dap_mclk2) ops */
1114
1115static void tegra2_cdev_clk_init(struct clk *c)
1116{
1117 /* We could un-tristate the cdev1 or cdev2 pingroup here; this is
1118 * currently done in the pinmux code. */
1119 c->state = ON;
1120 if (!(clk_readl(CLK_OUT_ENB + PERIPH_CLK_TO_ENB_REG(c)) &
1121 PERIPH_CLK_TO_ENB_BIT(c)))
1122 c->state = OFF;
1123}
1124
1125static int tegra2_cdev_clk_enable(struct clk *c)
1126{
1127 clk_writel(PERIPH_CLK_TO_ENB_BIT(c),
1128 CLK_OUT_ENB_SET + PERIPH_CLK_TO_ENB_SET_REG(c));
1129 return 0;
1130}
1131
1132static void tegra2_cdev_clk_disable(struct clk *c)
1133{
1134 clk_writel(PERIPH_CLK_TO_ENB_BIT(c),
1135 CLK_OUT_ENB_CLR + PERIPH_CLK_TO_ENB_SET_REG(c));
1136}
1137
1138static struct clk_ops tegra_cdev_clk_ops = {
1139 .init = &tegra2_cdev_clk_init,
1140 .enable = &tegra2_cdev_clk_enable,
1141 .disable = &tegra2_cdev_clk_disable,
1142};
1143
1010/* Clock definitions */ 1144/* Clock definitions */
1011static struct clk tegra_clk_32k = { 1145static struct clk tegra_clk_32k = {
1012 .name = "clk_32k", 1146 .name = "clk_32k",
@@ -1227,10 +1361,21 @@ static struct clk tegra_pll_a_out0 = {
1227}; 1361};
1228 1362
1229static struct clk_pll_table tegra_pll_d_table[] = { 1363static struct clk_pll_table tegra_pll_d_table[] = {
1364 { 12000000, 216000000, 216, 12, 1, 4},
1365 { 13000000, 216000000, 216, 13, 1, 4},
1366 { 19200000, 216000000, 135, 12, 1, 3},
1367 { 26000000, 216000000, 216, 26, 1, 4},
1368
1369 { 12000000, 594000000, 594, 12, 1, 8},
1370 { 13000000, 594000000, 594, 13, 1, 8},
1371 { 19200000, 594000000, 495, 16, 1, 8},
1372 { 26000000, 594000000, 594, 26, 1, 8},
1373
1230 { 12000000, 1000000000, 1000, 12, 1, 12}, 1374 { 12000000, 1000000000, 1000, 12, 1, 12},
1231 { 13000000, 1000000000, 1000, 13, 1, 12}, 1375 { 13000000, 1000000000, 1000, 13, 1, 12},
1232 { 19200000, 1000000000, 625, 12, 1, 8}, 1376 { 19200000, 1000000000, 625, 12, 1, 8},
1233 { 26000000, 1000000000, 1000, 26, 1, 12}, 1377 { 26000000, 1000000000, 1000, 26, 1, 12},
1378
1234 { 0, 0, 0, 0, 0, 0 }, 1379 { 0, 0, 0, 0, 0, 0 },
1235}; 1380};
1236 1381
@@ -1372,6 +1517,24 @@ static struct clk tegra_clk_d = {
1372 .max_rate = 52000000, 1517 .max_rate = 52000000,
1373}; 1518};
1374 1519
1520/* dap_mclk1, belongs to the cdev1 pingroup. */
1521static struct clk tegra_dev1_clk = {
1522 .name = "clk_dev1",
1523 .ops = &tegra_cdev_clk_ops,
1524 .clk_num = 94,
1525 .rate = 26000000,
1526 .max_rate = 26000000,
1527};
1528
1529/* dap_mclk2, belongs to the cdev2 pingroup. */
1530static struct clk tegra_dev2_clk = {
1531 .name = "clk_dev2",
1532 .ops = &tegra_cdev_clk_ops,
1533 .clk_num = 93,
1534 .rate = 26000000,
1535 .max_rate = 26000000,
1536};
1537
1375/* initialized before peripheral clocks */ 1538/* initialized before peripheral clocks */
1376static struct clk_mux_sel mux_audio_sync_clk[8+1]; 1539static struct clk_mux_sel mux_audio_sync_clk[8+1];
1377static const struct audio_sources { 1540static const struct audio_sources {
@@ -1486,7 +1649,7 @@ static struct clk tegra_clk_virtual_cpu = {
1486 .name = "cpu", 1649 .name = "cpu",
1487 .parent = &tegra_clk_cclk, 1650 .parent = &tegra_clk_cclk,
1488 .main = &tegra_pll_x, 1651 .main = &tegra_pll_x,
1489 .backup = &tegra_clk_m, 1652 .backup = &tegra_pll_p,
1490 .ops = &tegra_cpu_ops, 1653 .ops = &tegra_cpu_ops,
1491 .max_rate = 1000000000, 1654 .max_rate = 1000000000,
1492 .dvfs = &tegra_dvfs_virtual_cpu_dvfs, 1655 .dvfs = &tegra_dvfs_virtual_cpu_dvfs,
@@ -1512,6 +1675,14 @@ static struct clk tegra_clk_pclk = {
1512 .max_rate = 108000000, 1675 .max_rate = 108000000,
1513}; 1676};
1514 1677
1678static struct clk tegra_clk_blink = {
1679 .name = "blink",
1680 .parent = &tegra_clk_32k,
1681 .reg = 0x40,
1682 .ops = &tegra_blink_clk_ops,
1683 .max_rate = 32768,
1684};
1685
1515static struct clk_mux_sel mux_pllm_pllc_pllp_plla[] = { 1686static struct clk_mux_sel mux_pllm_pllc_pllp_plla[] = {
1516 { .input = &tegra_pll_m, .value = 0}, 1687 { .input = &tegra_pll_m, .value = 0},
1517 { .input = &tegra_pll_c, .value = 1}, 1688 { .input = &tegra_pll_c, .value = 1},
@@ -1626,7 +1797,7 @@ struct clk tegra_periph_clks[] = {
1626 PERIPH_CLK("sdmmc1", "sdhci-tegra.0", NULL, 14, 0x150, 52000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), /* scales with voltage */ 1797 PERIPH_CLK("sdmmc1", "sdhci-tegra.0", NULL, 14, 0x150, 52000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), /* scales with voltage */
1627 PERIPH_CLK("sdmmc2", "sdhci-tegra.1", NULL, 9, 0x154, 52000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), /* scales with voltage */ 1798 PERIPH_CLK("sdmmc2", "sdhci-tegra.1", NULL, 9, 0x154, 52000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), /* scales with voltage */
1628 PERIPH_CLK("sdmmc3", "sdhci-tegra.2", NULL, 69, 0x1bc, 52000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), /* scales with voltage */ 1799 PERIPH_CLK("sdmmc3", "sdhci-tegra.2", NULL, 69, 0x1bc, 52000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), /* scales with voltage */
1629 PERIPH_CLK("sdmmc4", "sdhci-tegra.3", NULL, 15, 0x160, 52000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), /* scales with voltage */ 1800 PERIPH_CLK("sdmmc4", "sdhci-tegra.3", NULL, 15, 0x164, 52000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), /* scales with voltage */
1630 PERIPH_CLK("vde", "vde", NULL, 61, 0x1c8, 250000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), /* scales with voltage and process_id */ 1801 PERIPH_CLK("vde", "vde", NULL, 61, 0x1c8, 250000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), /* scales with voltage and process_id */
1631 PERIPH_CLK("csite", "csite", NULL, 73, 0x1d4, 144000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), /* max rate ??? */ 1802 PERIPH_CLK("csite", "csite", NULL, 73, 0x1d4, 144000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), /* max rate ??? */
1632 /* FIXME: what is la? */ 1803 /* FIXME: what is la? */
@@ -1642,34 +1813,34 @@ struct clk tegra_periph_clks[] = {
1642 PERIPH_CLK("i2c2_i2c", "tegra-i2c.1", "i2c", 0, 0, 72000000, mux_pllp_out3, 0), 1813 PERIPH_CLK("i2c2_i2c", "tegra-i2c.1", "i2c", 0, 0, 72000000, mux_pllp_out3, 0),
1643 PERIPH_CLK("i2c3_i2c", "tegra-i2c.2", "i2c", 0, 0, 72000000, mux_pllp_out3, 0), 1814 PERIPH_CLK("i2c3_i2c", "tegra-i2c.2", "i2c", 0, 0, 72000000, mux_pllp_out3, 0),
1644 PERIPH_CLK("dvc_i2c", "tegra-i2c.3", "i2c", 0, 0, 72000000, mux_pllp_out3, 0), 1815 PERIPH_CLK("dvc_i2c", "tegra-i2c.3", "i2c", 0, 0, 72000000, mux_pllp_out3, 0),
1645 PERIPH_CLK("uarta", "uart.0", NULL, 6, 0x178, 216000000, mux_pllp_pllc_pllm_clkm, MUX), 1816 PERIPH_CLK("uarta", "uart.0", NULL, 6, 0x178, 600000000, mux_pllp_pllc_pllm_clkm, MUX),
1646 PERIPH_CLK("uartb", "uart.1", NULL, 7, 0x17c, 216000000, mux_pllp_pllc_pllm_clkm, MUX), 1817 PERIPH_CLK("uartb", "uart.1", NULL, 7, 0x17c, 600000000, mux_pllp_pllc_pllm_clkm, MUX),
1647 PERIPH_CLK("uartc", "uart.2", NULL, 55, 0x1a0, 216000000, mux_pllp_pllc_pllm_clkm, MUX), 1818 PERIPH_CLK("uartc", "uart.2", NULL, 55, 0x1a0, 600000000, mux_pllp_pllc_pllm_clkm, MUX),
1648 PERIPH_CLK("uartd", "uart.3", NULL, 65, 0x1c0, 216000000, mux_pllp_pllc_pllm_clkm, MUX), 1819 PERIPH_CLK("uartd", "uart.3", NULL, 65, 0x1c0, 600000000, mux_pllp_pllc_pllm_clkm, MUX),
1649 PERIPH_CLK("uarte", "uart.4", NULL, 66, 0x1c4, 216000000, mux_pllp_pllc_pllm_clkm, MUX), 1820 PERIPH_CLK("uarte", "uart.4", NULL, 66, 0x1c4, 600000000, mux_pllp_pllc_pllm_clkm, MUX),
1650 PERIPH_CLK("3d", "3d", NULL, 24, 0x158, 300000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71 | PERIPH_MANUAL_RESET), /* scales with voltage and process_id */ 1821 PERIPH_CLK("3d", "3d", NULL, 24, 0x158, 300000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71 | PERIPH_MANUAL_RESET), /* scales with voltage and process_id */
1651 PERIPH_CLK("2d", "2d", NULL, 21, 0x15c, 300000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71), /* scales with voltage and process_id */ 1822 PERIPH_CLK("2d", "2d", NULL, 21, 0x15c, 300000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71), /* scales with voltage and process_id */
1652 /* FIXME: vi and vi_sensor share an enable */ 1823 /* FIXME: vi and vi_sensor share an enable */
1653 PERIPH_CLK("vi", "vi", NULL, 20, 0x148, 150000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71), /* scales with voltage and process_id */ 1824 PERIPH_CLK("vi", "tegra_camera", "vi", 20, 0x148, 150000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71), /* scales with voltage and process_id */
1654 PERIPH_CLK("vi_sensor", "vi_sensor", NULL, 20, 0x1a8, 150000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71 | PERIPH_NO_RESET), /* scales with voltage and process_id */ 1825 PERIPH_CLK("vi_sensor", "tegra_camera", "vi_sensor", 20, 0x1a8, 150000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71 | PERIPH_NO_RESET), /* scales with voltage and process_id */
1655 PERIPH_CLK("epp", "epp", NULL, 19, 0x16c, 300000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71), /* scales with voltage and process_id */ 1826 PERIPH_CLK("epp", "epp", NULL, 19, 0x16c, 300000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71), /* scales with voltage and process_id */
1656 PERIPH_CLK("mpe", "mpe", NULL, 60, 0x170, 250000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71), /* scales with voltage and process_id */ 1827 PERIPH_CLK("mpe", "mpe", NULL, 60, 0x170, 250000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71), /* scales with voltage and process_id */
1657 PERIPH_CLK("host1x", "host1x", NULL, 28, 0x180, 166000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71), /* scales with voltage and process_id */ 1828 PERIPH_CLK("host1x", "host1x", NULL, 28, 0x180, 166000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71), /* scales with voltage and process_id */
1658 /* FIXME: cve and tvo share an enable */ 1829 /* FIXME: cve and tvo share an enable */
1659 PERIPH_CLK("cve", "cve", NULL, 49, 0x140, 250000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71), /* requires min voltage */ 1830 PERIPH_CLK("cve", "cve", NULL, 49, 0x140, 250000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71), /* requires min voltage */
1660 PERIPH_CLK("tvo", "tvo", NULL, 49, 0x188, 250000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71), /* requires min voltage */ 1831 PERIPH_CLK("tvo", "tvo", NULL, 49, 0x188, 250000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71), /* requires min voltage */
1661 PERIPH_CLK("hdmi", "hdmi", NULL, 51, 0x18c, 148500000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71), /* requires min voltage */ 1832 PERIPH_CLK("hdmi", "hdmi", NULL, 51, 0x18c, 600000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71), /* requires min voltage */
1662 PERIPH_CLK("tvdac", "tvdac", NULL, 53, 0x194, 250000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71), /* requires min voltage */ 1833 PERIPH_CLK("tvdac", "tvdac", NULL, 53, 0x194, 250000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71), /* requires min voltage */
1663 PERIPH_CLK("disp1", "tegrafb.0", NULL, 27, 0x138, 190000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71), /* scales with voltage and process_id */ 1834 PERIPH_CLK("disp1", "tegradc.0", NULL, 27, 0x138, 600000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71), /* scales with voltage and process_id */
1664 PERIPH_CLK("disp2", "tegrafb.1", NULL, 26, 0x13c, 190000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71), /* scales with voltage and process_id */ 1835 PERIPH_CLK("disp2", "tegradc.1", NULL, 26, 0x13c, 600000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71), /* scales with voltage and process_id */
1665 PERIPH_CLK("usbd", "fsl-tegra-udc", NULL, 22, 0, 480000000, mux_clk_m, 0), /* requires min voltage */ 1836 PERIPH_CLK("usbd", "fsl-tegra-udc", NULL, 22, 0, 480000000, mux_clk_m, 0), /* requires min voltage */
1666 PERIPH_CLK("usb2", "tegra-ehci.1", NULL, 58, 0, 480000000, mux_clk_m, 0), /* requires min voltage */ 1837 PERIPH_CLK("usb2", "tegra-ehci.1", NULL, 58, 0, 480000000, mux_clk_m, 0), /* requires min voltage */
1667 PERIPH_CLK("usb3", "tegra-ehci.2", NULL, 59, 0, 480000000, mux_clk_m, 0), /* requires min voltage */ 1838 PERIPH_CLK("usb3", "tegra-ehci.2", NULL, 59, 0, 480000000, mux_clk_m, 0), /* requires min voltage */
1668 PERIPH_CLK("emc", "emc", NULL, 57, 0x19c, 800000000, mux_pllm_pllc_pllp_clkm, MUX | DIV_U71 | PERIPH_EMC_ENB), 1839 PERIPH_CLK("emc", "emc", NULL, 57, 0x19c, 800000000, mux_pllm_pllc_pllp_clkm, MUX | DIV_U71 | PERIPH_EMC_ENB),
1669 PERIPH_CLK("dsi", "dsi", NULL, 48, 0, 500000000, mux_plld, 0), /* scales with voltage */ 1840 PERIPH_CLK("dsi", "dsi", NULL, 48, 0, 500000000, mux_plld, 0), /* scales with voltage */
1670 PERIPH_CLK("csi", "csi", NULL, 52, 0, 72000000, mux_pllp_out3, 0), 1841 PERIPH_CLK("csi", "tegra_camera", "csi", 52, 0, 72000000, mux_pllp_out3, 0),
1671 PERIPH_CLK("isp", "isp", NULL, 23, 0, 150000000, mux_clk_m, 0), /* same frequency as VI */ 1842 PERIPH_CLK("isp", "tegra_camera", "isp", 23, 0, 150000000, mux_clk_m, 0), /* same frequency as VI */
1672 PERIPH_CLK("csus", "csus", NULL, 92, 0, 150000000, mux_clk_m, PERIPH_NO_RESET), 1843 PERIPH_CLK("csus", "tegra_camera", "csus", 92, 0, 150000000, mux_clk_m, PERIPH_NO_RESET),
1673 PERIPH_CLK("pex", NULL, "pex", 70, 0, 26000000, mux_clk_m, PERIPH_MANUAL_RESET), 1844 PERIPH_CLK("pex", NULL, "pex", 70, 0, 26000000, mux_clk_m, PERIPH_MANUAL_RESET),
1674 PERIPH_CLK("afi", NULL, "afi", 72, 0, 26000000, mux_clk_m, PERIPH_MANUAL_RESET), 1845 PERIPH_CLK("afi", NULL, "afi", 72, 0, 26000000, mux_clk_m, PERIPH_MANUAL_RESET),
1675 PERIPH_CLK("pcie_xclk", NULL, "pcie_xclk", 74, 0, 26000000, mux_clk_m, PERIPH_MANUAL_RESET), 1846 PERIPH_CLK("pcie_xclk", NULL, "pcie_xclk", 74, 0, 26000000, mux_clk_m, PERIPH_MANUAL_RESET),
@@ -1694,9 +1865,15 @@ struct clk_duplicate tegra_clk_duplicates[] = {
1694 CLK_DUPLICATE("uartc", "tegra_uart.2", NULL), 1865 CLK_DUPLICATE("uartc", "tegra_uart.2", NULL),
1695 CLK_DUPLICATE("uartd", "tegra_uart.3", NULL), 1866 CLK_DUPLICATE("uartd", "tegra_uart.3", NULL),
1696 CLK_DUPLICATE("uarte", "tegra_uart.4", NULL), 1867 CLK_DUPLICATE("uarte", "tegra_uart.4", NULL),
1697 CLK_DUPLICATE("host1x", "tegrafb.0", "host1x"), 1868 CLK_DUPLICATE("usbd", "utmip-pad", NULL),
1698 CLK_DUPLICATE("host1x", "tegrafb.1", "host1x"),
1699 CLK_DUPLICATE("usbd", "tegra-ehci.0", NULL), 1869 CLK_DUPLICATE("usbd", "tegra-ehci.0", NULL),
1870 CLK_DUPLICATE("usbd", "tegra-otg", NULL),
1871 CLK_DUPLICATE("hdmi", "tegradc.0", "hdmi"),
1872 CLK_DUPLICATE("hdmi", "tegradc.1", "hdmi"),
1873 CLK_DUPLICATE("pwm", "tegra_pwm.0", NULL),
1874 CLK_DUPLICATE("pwm", "tegra_pwm.1", NULL),
1875 CLK_DUPLICATE("pwm", "tegra_pwm.2", NULL),
1876 CLK_DUPLICATE("pwm", "tegra_pwm.3", NULL),
1700}; 1877};
1701 1878
1702#define CLK(dev, con, ck) \ 1879#define CLK(dev, con, ck) \
@@ -1732,7 +1909,10 @@ struct clk_lookup tegra_clk_lookups[] = {
1732 CLK(NULL, "hclk", &tegra_clk_hclk), 1909 CLK(NULL, "hclk", &tegra_clk_hclk),
1733 CLK(NULL, "pclk", &tegra_clk_pclk), 1910 CLK(NULL, "pclk", &tegra_clk_pclk),
1734 CLK(NULL, "clk_d", &tegra_clk_d), 1911 CLK(NULL, "clk_d", &tegra_clk_d),
1912 CLK(NULL, "clk_dev1", &tegra_dev1_clk),
1913 CLK(NULL, "clk_dev2", &tegra_dev2_clk),
1735 CLK(NULL, "cpu", &tegra_clk_virtual_cpu), 1914 CLK(NULL, "cpu", &tegra_clk_virtual_cpu),
1915 CLK(NULL, "blink", &tegra_clk_blink),
1736}; 1916};
1737 1917
1738void __init tegra2_init_clocks(void) 1918void __init tegra2_init_clocks(void)
@@ -1775,14 +1955,34 @@ void __init tegra2_init_clocks(void)
1775 1955
1776#ifdef CONFIG_PM 1956#ifdef CONFIG_PM
1777static u32 clk_rst_suspend[RST_DEVICES_NUM + CLK_OUT_ENB_NUM + 1957static u32 clk_rst_suspend[RST_DEVICES_NUM + CLK_OUT_ENB_NUM +
1778 PERIPH_CLK_SOURCE_NUM + 3]; 1958 PERIPH_CLK_SOURCE_NUM + 19];
1779 1959
1780void tegra_clk_suspend(void) 1960void tegra_clk_suspend(void)
1781{ 1961{
1782 unsigned long off, i; 1962 unsigned long off, i;
1963 u32 pllx_misc;
1783 u32 *ctx = clk_rst_suspend; 1964 u32 *ctx = clk_rst_suspend;
1784 1965
1785 *ctx++ = clk_readl(OSC_CTRL) & OSC_CTRL_MASK; 1966 *ctx++ = clk_readl(OSC_CTRL) & OSC_CTRL_MASK;
1967 *ctx++ = clk_readl(tegra_pll_p.reg + PLL_BASE);
1968 *ctx++ = clk_readl(tegra_pll_p.reg + PLL_MISC(&tegra_pll_p));
1969 *ctx++ = clk_readl(tegra_pll_c.reg + PLL_BASE);
1970 *ctx++ = clk_readl(tegra_pll_c.reg + PLL_MISC(&tegra_pll_c));
1971 *ctx++ = clk_readl(tegra_pll_a.reg + PLL_BASE);
1972 *ctx++ = clk_readl(tegra_pll_a.reg + PLL_MISC(&tegra_pll_a));
1973
1974 *ctx++ = clk_readl(tegra_pll_m_out1.reg);
1975 *ctx++ = clk_readl(tegra_pll_p_out1.reg);
1976 *ctx++ = clk_readl(tegra_pll_p_out3.reg);
1977 *ctx++ = clk_readl(tegra_pll_a_out0.reg);
1978 *ctx++ = clk_readl(tegra_pll_c_out1.reg);
1979
1980 *ctx++ = clk_readl(tegra_clk_cclk.reg);
1981 *ctx++ = clk_readl(tegra_clk_cclk.reg + SUPER_CLK_DIVIDER);
1982
1983 *ctx++ = clk_readl(tegra_clk_sclk.reg);
1984 *ctx++ = clk_readl(tegra_clk_sclk.reg + SUPER_CLK_DIVIDER);
1985 *ctx++ = clk_readl(tegra_clk_pclk.reg);
1786 1986
1787 for (off = PERIPH_CLK_SOURCE_I2S1; off <= PERIPH_CLK_SOURCE_OSC; 1987 for (off = PERIPH_CLK_SOURCE_I2S1; off <= PERIPH_CLK_SOURCE_OSC;
1788 off += 4) { 1988 off += 4) {
@@ -1801,6 +2001,10 @@ void tegra_clk_suspend(void)
1801 2001
1802 *ctx++ = clk_readl(MISC_CLK_ENB); 2002 *ctx++ = clk_readl(MISC_CLK_ENB);
1803 *ctx++ = clk_readl(CLK_MASK_ARM); 2003 *ctx++ = clk_readl(CLK_MASK_ARM);
2004
2005 pllx_misc = clk_readl(tegra_pll_x.reg + PLL_MISC(&tegra_pll_x));
2006 pllx_misc &= ~PLL_MISC_LOCK_ENABLE(&tegra_pll_x);
2007 clk_writel(pllx_misc, tegra_pll_x.reg + PLL_MISC(&tegra_pll_x));
1804} 2008}
1805 2009
1806void tegra_clk_resume(void) 2010void tegra_clk_resume(void)
@@ -1813,6 +2017,27 @@ void tegra_clk_resume(void)
1813 val |= *ctx++; 2017 val |= *ctx++;
1814 clk_writel(val, OSC_CTRL); 2018 clk_writel(val, OSC_CTRL);
1815 2019
2020 clk_writel(*ctx++, tegra_pll_p.reg + PLL_BASE);
2021 clk_writel(*ctx++, tegra_pll_p.reg + PLL_MISC(&tegra_pll_p));
2022 clk_writel(*ctx++, tegra_pll_c.reg + PLL_BASE);
2023 clk_writel(*ctx++, tegra_pll_c.reg + PLL_MISC(&tegra_pll_c));
2024 clk_writel(*ctx++, tegra_pll_a.reg + PLL_BASE);
2025 clk_writel(*ctx++, tegra_pll_a.reg + PLL_MISC(&tegra_pll_a));
2026 udelay(300);
2027
2028 clk_writel(*ctx++, tegra_pll_m_out1.reg);
2029 clk_writel(*ctx++, tegra_pll_p_out1.reg);
2030 clk_writel(*ctx++, tegra_pll_p_out3.reg);
2031 clk_writel(*ctx++, tegra_pll_a_out0.reg);
2032 clk_writel(*ctx++, tegra_pll_c_out1.reg);
2033
2034 clk_writel(*ctx++, tegra_clk_cclk.reg);
2035 clk_writel(*ctx++, tegra_clk_cclk.reg + SUPER_CLK_DIVIDER);
2036
2037 clk_writel(*ctx++, tegra_clk_sclk.reg);
2038 clk_writel(*ctx++, tegra_clk_sclk.reg + SUPER_CLK_DIVIDER);
2039 clk_writel(*ctx++, tegra_clk_pclk.reg);
2040
1816 /* enable all clocks before configuring clock sources */ 2041 /* enable all clocks before configuring clock sources */
1817 clk_writel(0xbffffff9ul, CLK_OUT_ENB); 2042 clk_writel(0xbffffff9ul, CLK_OUT_ENB);
1818 clk_writel(0xfefffff7ul, CLK_OUT_ENB + 4); 2043 clk_writel(0xfefffff7ul, CLK_OUT_ENB + 4);