diff options
author | Prashant Gaikwad <pgaikwad@nvidia.com> | 2012-08-06 02:27:39 -0400 |
---|---|---|
committer | Stephen Warren <swarren@nvidia.com> | 2012-09-06 13:47:19 -0400 |
commit | 88e790a445b35cf137a62e590ced5315defad060 (patch) | |
tree | c24784a714c678794081c3785ad09616f1448b77 /arch/arm/mach-tegra/tegra30_clocks.c | |
parent | eb70e1bdd8a633e058cfb6186d45d4c8bdbdf534 (diff) |
ARM: tegra30: Separate out clk ops and clk data
Move clock initialization data to separate file. This is
required for migrating to generic clock framework if static
initialization is used.
Signed-off-by: Prashant Gaikwad <pgaikwad@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra/tegra30_clocks.c')
-rw-r--r-- | arch/arm/mach-tegra/tegra30_clocks.c | 1155 |
1 files changed, 22 insertions, 1133 deletions
diff --git a/arch/arm/mach-tegra/tegra30_clocks.c b/arch/arm/mach-tegra/tegra30_clocks.c index 6674f100e16f..645ef6900a0e 100644 --- a/arch/arm/mach-tegra/tegra30_clocks.c +++ b/arch/arm/mach-tegra/tegra30_clocks.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * arch/arm/mach-tegra/tegra30_clocks.c | 2 | * arch/arm/mach-tegra/tegra30_clocks.c |
3 | * | 3 | * |
4 | * Copyright (c) 2010-2011 NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2010-2012 NVIDIA CORPORATION. All rights reserved. |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
@@ -533,13 +533,13 @@ static void tegra30_clk_m_disable(struct clk *c) | |||
533 | WARN(1, "Attempting to disable main SoC clock\n"); | 533 | WARN(1, "Attempting to disable main SoC clock\n"); |
534 | } | 534 | } |
535 | 535 | ||
536 | static struct clk_ops tegra_clk_m_ops = { | 536 | struct clk_ops tegra30_clk_m_ops = { |
537 | .init = tegra30_clk_m_init, | 537 | .init = tegra30_clk_m_init, |
538 | .enable = tegra30_clk_m_enable, | 538 | .enable = tegra30_clk_m_enable, |
539 | .disable = tegra30_clk_m_disable, | 539 | .disable = tegra30_clk_m_disable, |
540 | }; | 540 | }; |
541 | 541 | ||
542 | static struct clk_ops tegra_clk_m_div_ops = { | 542 | struct clk_ops tegra_clk_m_div_ops = { |
543 | .enable = tegra30_clk_m_enable, | 543 | .enable = tegra30_clk_m_enable, |
544 | }; | 544 | }; |
545 | 545 | ||
@@ -567,7 +567,7 @@ static void tegra30_pll_ref_init(struct clk *c) | |||
567 | c->state = ON; | 567 | c->state = ON; |
568 | } | 568 | } |
569 | 569 | ||
570 | static struct clk_ops tegra_pll_ref_ops = { | 570 | struct clk_ops tegra_pll_ref_ops = { |
571 | .init = tegra30_pll_ref_init, | 571 | .init = tegra30_pll_ref_init, |
572 | .enable = tegra30_clk_m_enable, | 572 | .enable = tegra30_clk_m_enable, |
573 | .disable = tegra30_clk_m_disable, | 573 | .disable = tegra30_clk_m_disable, |
@@ -707,7 +707,7 @@ static int tegra30_super_clk_set_rate(struct clk *c, unsigned long rate) | |||
707 | return clk_set_rate(c->parent, rate); | 707 | return clk_set_rate(c->parent, rate); |
708 | } | 708 | } |
709 | 709 | ||
710 | static struct clk_ops tegra_super_ops = { | 710 | struct clk_ops tegra30_super_ops = { |
711 | .init = tegra30_super_clk_init, | 711 | .init = tegra30_super_clk_init, |
712 | .enable = tegra30_super_clk_enable, | 712 | .enable = tegra30_super_clk_enable, |
713 | .disable = tegra30_super_clk_disable, | 713 | .disable = tegra30_super_clk_disable, |
@@ -722,7 +722,7 @@ static int tegra30_twd_clk_set_rate(struct clk *c, unsigned long rate) | |||
722 | return 0; | 722 | return 0; |
723 | } | 723 | } |
724 | 724 | ||
725 | static struct clk_ops tegra30_twd_ops = { | 725 | struct clk_ops tegra30_twd_ops = { |
726 | .set_rate = tegra30_twd_clk_set_rate, | 726 | .set_rate = tegra30_twd_clk_set_rate, |
727 | }; | 727 | }; |
728 | 728 | ||
@@ -801,7 +801,7 @@ static int tegra30_blink_clk_set_rate(struct clk *c, unsigned long rate) | |||
801 | return 0; | 801 | return 0; |
802 | } | 802 | } |
803 | 803 | ||
804 | static struct clk_ops tegra_blink_clk_ops = { | 804 | struct clk_ops tegra30_blink_clk_ops = { |
805 | .init = &tegra30_blink_clk_init, | 805 | .init = &tegra30_blink_clk_init, |
806 | .enable = &tegra30_blink_clk_enable, | 806 | .enable = &tegra30_blink_clk_enable, |
807 | .disable = &tegra30_blink_clk_disable, | 807 | .disable = &tegra30_blink_clk_disable, |
@@ -829,7 +829,6 @@ static int tegra30_pll_clk_wait_for_lock(struct clk *c, u32 lock_reg, | |||
829 | return 0; | 829 | return 0; |
830 | } | 830 | } |
831 | 831 | ||
832 | |||
833 | static void tegra30_utmi_param_configure(struct clk *c) | 832 | static void tegra30_utmi_param_configure(struct clk *c) |
834 | { | 833 | { |
835 | u32 reg; | 834 | u32 reg; |
@@ -1100,7 +1099,7 @@ static int tegra30_pll_clk_set_rate(struct clk *c, unsigned long rate) | |||
1100 | return 0; | 1099 | return 0; |
1101 | } | 1100 | } |
1102 | 1101 | ||
1103 | static struct clk_ops tegra_pll_ops = { | 1102 | struct clk_ops tegra30_pll_ops = { |
1104 | .init = tegra30_pll_clk_init, | 1103 | .init = tegra30_pll_clk_init, |
1105 | .enable = tegra30_pll_clk_enable, | 1104 | .enable = tegra30_pll_clk_enable, |
1106 | .disable = tegra30_pll_clk_disable, | 1105 | .disable = tegra30_pll_clk_disable, |
@@ -1141,7 +1140,7 @@ tegra30_plld_clk_cfg_ex(struct clk *c, enum tegra_clk_ex_param p, u32 setting) | |||
1141 | return 0; | 1140 | return 0; |
1142 | } | 1141 | } |
1143 | 1142 | ||
1144 | static struct clk_ops tegra_plld_ops = { | 1143 | struct clk_ops tegra_plld_ops = { |
1145 | .init = tegra30_pll_clk_init, | 1144 | .init = tegra30_pll_clk_init, |
1146 | .enable = tegra30_pll_clk_enable, | 1145 | .enable = tegra30_pll_clk_enable, |
1147 | .disable = tegra30_pll_clk_disable, | 1146 | .disable = tegra30_pll_clk_disable, |
@@ -1258,7 +1257,7 @@ static int tegra30_plle_clk_enable(struct clk *c) | |||
1258 | return tegra30_plle_configure(c, !c->set); | 1257 | return tegra30_plle_configure(c, !c->set); |
1259 | } | 1258 | } |
1260 | 1259 | ||
1261 | static struct clk_ops tegra_plle_ops = { | 1260 | struct clk_ops tegra30_plle_ops = { |
1262 | .init = tegra30_plle_clk_init, | 1261 | .init = tegra30_plle_clk_init, |
1263 | .enable = tegra30_plle_clk_enable, | 1262 | .enable = tegra30_plle_clk_enable, |
1264 | .disable = tegra30_plle_clk_disable, | 1263 | .disable = tegra30_plle_clk_disable, |
@@ -1386,7 +1385,7 @@ static long tegra30_pll_div_clk_round_rate(struct clk *c, unsigned long rate) | |||
1386 | return -EINVAL; | 1385 | return -EINVAL; |
1387 | } | 1386 | } |
1388 | 1387 | ||
1389 | static struct clk_ops tegra_pll_div_ops = { | 1388 | struct clk_ops tegra30_pll_div_ops = { |
1390 | .init = tegra30_pll_div_clk_init, | 1389 | .init = tegra30_pll_div_clk_init, |
1391 | .enable = tegra30_pll_div_clk_enable, | 1390 | .enable = tegra30_pll_div_clk_enable, |
1392 | .disable = tegra30_pll_div_clk_disable, | 1391 | .disable = tegra30_pll_div_clk_disable, |
@@ -1634,7 +1633,7 @@ static long tegra30_periph_clk_round_rate(struct clk *c, | |||
1634 | return -EINVAL; | 1633 | return -EINVAL; |
1635 | } | 1634 | } |
1636 | 1635 | ||
1637 | static struct clk_ops tegra_periph_clk_ops = { | 1636 | struct clk_ops tegra30_periph_clk_ops = { |
1638 | .init = &tegra30_periph_clk_init, | 1637 | .init = &tegra30_periph_clk_init, |
1639 | .enable = &tegra30_periph_clk_enable, | 1638 | .enable = &tegra30_periph_clk_enable, |
1640 | .disable = &tegra30_periph_clk_disable, | 1639 | .disable = &tegra30_periph_clk_disable, |
@@ -1644,7 +1643,6 @@ static struct clk_ops tegra_periph_clk_ops = { | |||
1644 | .reset = &tegra30_periph_clk_reset, | 1643 | .reset = &tegra30_periph_clk_reset, |
1645 | }; | 1644 | }; |
1646 | 1645 | ||
1647 | |||
1648 | /* Periph extended clock configuration ops */ | 1646 | /* Periph extended clock configuration ops */ |
1649 | static int | 1647 | static int |
1650 | tegra30_vi_clk_cfg_ex(struct clk *c, enum tegra_clk_ex_param p, u32 setting) | 1648 | tegra30_vi_clk_cfg_ex(struct clk *c, enum tegra_clk_ex_param p, u32 setting) |
@@ -1660,7 +1658,7 @@ tegra30_vi_clk_cfg_ex(struct clk *c, enum tegra_clk_ex_param p, u32 setting) | |||
1660 | return -EINVAL; | 1658 | return -EINVAL; |
1661 | } | 1659 | } |
1662 | 1660 | ||
1663 | static struct clk_ops tegra_vi_clk_ops = { | 1661 | struct clk_ops tegra_vi_clk_ops = { |
1664 | .init = &tegra30_periph_clk_init, | 1662 | .init = &tegra30_periph_clk_init, |
1665 | .enable = &tegra30_periph_clk_enable, | 1663 | .enable = &tegra30_periph_clk_enable, |
1666 | .disable = &tegra30_periph_clk_disable, | 1664 | .disable = &tegra30_periph_clk_disable, |
@@ -1686,7 +1684,7 @@ tegra30_nand_clk_cfg_ex(struct clk *c, enum tegra_clk_ex_param p, u32 setting) | |||
1686 | return -EINVAL; | 1684 | return -EINVAL; |
1687 | } | 1685 | } |
1688 | 1686 | ||
1689 | static struct clk_ops tegra_nand_clk_ops = { | 1687 | struct clk_ops tegra_nand_clk_ops = { |
1690 | .init = &tegra30_periph_clk_init, | 1688 | .init = &tegra30_periph_clk_init, |
1691 | .enable = &tegra30_periph_clk_enable, | 1689 | .enable = &tegra30_periph_clk_enable, |
1692 | .disable = &tegra30_periph_clk_disable, | 1690 | .disable = &tegra30_periph_clk_disable, |
@@ -1697,7 +1695,6 @@ static struct clk_ops tegra_nand_clk_ops = { | |||
1697 | .reset = &tegra30_periph_clk_reset, | 1695 | .reset = &tegra30_periph_clk_reset, |
1698 | }; | 1696 | }; |
1699 | 1697 | ||
1700 | |||
1701 | static int | 1698 | static int |
1702 | tegra30_dtv_clk_cfg_ex(struct clk *c, enum tegra_clk_ex_param p, u32 setting) | 1699 | tegra30_dtv_clk_cfg_ex(struct clk *c, enum tegra_clk_ex_param p, u32 setting) |
1703 | { | 1700 | { |
@@ -1713,7 +1710,7 @@ tegra30_dtv_clk_cfg_ex(struct clk *c, enum tegra_clk_ex_param p, u32 setting) | |||
1713 | return -EINVAL; | 1710 | return -EINVAL; |
1714 | } | 1711 | } |
1715 | 1712 | ||
1716 | static struct clk_ops tegra_dtv_clk_ops = { | 1713 | struct clk_ops tegra_dtv_clk_ops = { |
1717 | .init = &tegra30_periph_clk_init, | 1714 | .init = &tegra30_periph_clk_init, |
1718 | .enable = &tegra30_periph_clk_enable, | 1715 | .enable = &tegra30_periph_clk_enable, |
1719 | .disable = &tegra30_periph_clk_disable, | 1716 | .disable = &tegra30_periph_clk_disable, |
@@ -1753,7 +1750,7 @@ static int tegra30_dsib_clk_set_parent(struct clk *c, struct clk *p) | |||
1753 | return -EINVAL; | 1750 | return -EINVAL; |
1754 | } | 1751 | } |
1755 | 1752 | ||
1756 | static struct clk_ops tegra_dsib_clk_ops = { | 1753 | struct clk_ops tegra_dsib_clk_ops = { |
1757 | .init = &tegra30_periph_clk_init, | 1754 | .init = &tegra30_periph_clk_init, |
1758 | .enable = &tegra30_periph_clk_enable, | 1755 | .enable = &tegra30_periph_clk_enable, |
1759 | .disable = &tegra30_periph_clk_disable, | 1756 | .disable = &tegra30_periph_clk_disable, |
@@ -1764,7 +1761,7 @@ static struct clk_ops tegra_dsib_clk_ops = { | |||
1764 | }; | 1761 | }; |
1765 | 1762 | ||
1766 | /* pciex clock support only reset function */ | 1763 | /* pciex clock support only reset function */ |
1767 | static struct clk_ops tegra_pciex_clk_ops = { | 1764 | struct clk_ops tegra_pciex_clk_ops = { |
1768 | .reset = tegra30_periph_clk_reset, | 1765 | .reset = tegra30_periph_clk_reset, |
1769 | }; | 1766 | }; |
1770 | 1767 | ||
@@ -1851,14 +1848,13 @@ static int tegra30_clk_out_set_parent(struct clk *c, struct clk *p) | |||
1851 | return -EINVAL; | 1848 | return -EINVAL; |
1852 | } | 1849 | } |
1853 | 1850 | ||
1854 | static struct clk_ops tegra_clk_out_ops = { | 1851 | struct clk_ops tegra_clk_out_ops = { |
1855 | .init = &tegra30_clk_out_init, | 1852 | .init = &tegra30_clk_out_init, |
1856 | .enable = &tegra30_clk_out_enable, | 1853 | .enable = &tegra30_clk_out_enable, |
1857 | .disable = &tegra30_clk_out_disable, | 1854 | .disable = &tegra30_clk_out_disable, |
1858 | .set_parent = &tegra30_clk_out_set_parent, | 1855 | .set_parent = &tegra30_clk_out_set_parent, |
1859 | }; | 1856 | }; |
1860 | 1857 | ||
1861 | |||
1862 | /* Clock doubler ops */ | 1858 | /* Clock doubler ops */ |
1863 | static void tegra30_clk_double_init(struct clk *c) | 1859 | static void tegra30_clk_double_init(struct clk *c) |
1864 | { | 1860 | { |
@@ -1890,7 +1886,7 @@ static int tegra30_clk_double_set_rate(struct clk *c, unsigned long rate) | |||
1890 | return -EINVAL; | 1886 | return -EINVAL; |
1891 | } | 1887 | } |
1892 | 1888 | ||
1893 | static struct clk_ops tegra_clk_double_ops = { | 1889 | struct clk_ops tegra30_clk_double_ops = { |
1894 | .init = &tegra30_clk_double_init, | 1890 | .init = &tegra30_clk_double_init, |
1895 | .enable = &tegra30_periph_clk_enable, | 1891 | .enable = &tegra30_periph_clk_enable, |
1896 | .disable = &tegra30_periph_clk_disable, | 1892 | .disable = &tegra30_periph_clk_disable, |
@@ -1904,7 +1900,7 @@ static int tegra30_sync_source_set_rate(struct clk *c, unsigned long rate) | |||
1904 | return 0; | 1900 | return 0; |
1905 | } | 1901 | } |
1906 | 1902 | ||
1907 | static struct clk_ops tegra_sync_source_ops = { | 1903 | struct clk_ops tegra_sync_source_ops = { |
1908 | .set_rate = &tegra30_sync_source_set_rate, | 1904 | .set_rate = &tegra30_sync_source_set_rate, |
1909 | }; | 1905 | }; |
1910 | 1906 | ||
@@ -1961,7 +1957,7 @@ static int tegra30_audio_sync_clk_set_parent(struct clk *c, struct clk *p) | |||
1961 | return -EINVAL; | 1957 | return -EINVAL; |
1962 | } | 1958 | } |
1963 | 1959 | ||
1964 | static struct clk_ops tegra_audio_sync_clk_ops = { | 1960 | struct clk_ops tegra30_audio_sync_clk_ops = { |
1965 | .init = tegra30_audio_sync_clk_init, | 1961 | .init = tegra30_audio_sync_clk_init, |
1966 | .enable = tegra30_audio_sync_clk_enable, | 1962 | .enable = tegra30_audio_sync_clk_enable, |
1967 | .disable = tegra30_audio_sync_clk_disable, | 1963 | .disable = tegra30_audio_sync_clk_disable, |
@@ -1990,1115 +1986,8 @@ static void tegra30_cml_clk_disable(struct clk *c) | |||
1990 | clk_writel(val, c->reg); | 1986 | clk_writel(val, c->reg); |
1991 | } | 1987 | } |
1992 | 1988 | ||
1993 | static struct clk_ops tegra_cml_clk_ops = { | 1989 | struct clk_ops tegra_cml_clk_ops = { |
1994 | .init = &tegra30_cml_clk_init, | 1990 | .init = &tegra30_cml_clk_init, |
1995 | .enable = &tegra30_cml_clk_enable, | 1991 | .enable = &tegra30_cml_clk_enable, |
1996 | .disable = &tegra30_cml_clk_disable, | 1992 | .disable = &tegra30_cml_clk_disable, |
1997 | }; | 1993 | }; |
1998 | |||
1999 | /* Clock definitions */ | ||
2000 | static struct clk tegra_clk_32k = { | ||
2001 | .name = "clk_32k", | ||
2002 | .rate = 32768, | ||
2003 | .ops = NULL, | ||
2004 | .max_rate = 32768, | ||
2005 | }; | ||
2006 | |||
2007 | static struct clk tegra_clk_m = { | ||
2008 | .name = "clk_m", | ||
2009 | .flags = ENABLE_ON_INIT, | ||
2010 | .ops = &tegra_clk_m_ops, | ||
2011 | .reg = 0x1fc, | ||
2012 | .reg_shift = 28, | ||
2013 | .max_rate = 48000000, | ||
2014 | }; | ||
2015 | |||
2016 | static struct clk tegra_clk_m_div2 = { | ||
2017 | .name = "clk_m_div2", | ||
2018 | .ops = &tegra_clk_m_div_ops, | ||
2019 | .parent = &tegra_clk_m, | ||
2020 | .mul = 1, | ||
2021 | .div = 2, | ||
2022 | .state = ON, | ||
2023 | .max_rate = 24000000, | ||
2024 | }; | ||
2025 | |||
2026 | static struct clk tegra_clk_m_div4 = { | ||
2027 | .name = "clk_m_div4", | ||
2028 | .ops = &tegra_clk_m_div_ops, | ||
2029 | .parent = &tegra_clk_m, | ||
2030 | .mul = 1, | ||
2031 | .div = 4, | ||
2032 | .state = ON, | ||
2033 | .max_rate = 12000000, | ||
2034 | }; | ||
2035 | |||
2036 | static struct clk tegra_pll_ref = { | ||
2037 | .name = "pll_ref", | ||
2038 | .flags = ENABLE_ON_INIT, | ||
2039 | .ops = &tegra_pll_ref_ops, | ||
2040 | .parent = &tegra_clk_m, | ||
2041 | .max_rate = 26000000, | ||
2042 | }; | ||
2043 | |||
2044 | static struct clk_pll_freq_table tegra_pll_c_freq_table[] = { | ||
2045 | { 12000000, 1040000000, 520, 6, 1, 8}, | ||
2046 | { 13000000, 1040000000, 480, 6, 1, 8}, | ||
2047 | { 16800000, 1040000000, 495, 8, 1, 8}, /* actual: 1039.5 MHz */ | ||
2048 | { 19200000, 1040000000, 325, 6, 1, 6}, | ||
2049 | { 26000000, 1040000000, 520, 13, 1, 8}, | ||
2050 | |||
2051 | { 12000000, 832000000, 416, 6, 1, 8}, | ||
2052 | { 13000000, 832000000, 832, 13, 1, 8}, | ||
2053 | { 16800000, 832000000, 396, 8, 1, 8}, /* actual: 831.6 MHz */ | ||
2054 | { 19200000, 832000000, 260, 6, 1, 8}, | ||
2055 | { 26000000, 832000000, 416, 13, 1, 8}, | ||
2056 | |||
2057 | { 12000000, 624000000, 624, 12, 1, 8}, | ||
2058 | { 13000000, 624000000, 624, 13, 1, 8}, | ||
2059 | { 16800000, 600000000, 520, 14, 1, 8}, | ||
2060 | { 19200000, 624000000, 520, 16, 1, 8}, | ||
2061 | { 26000000, 624000000, 624, 26, 1, 8}, | ||
2062 | |||
2063 | { 12000000, 600000000, 600, 12, 1, 8}, | ||
2064 | { 13000000, 600000000, 600, 13, 1, 8}, | ||
2065 | { 16800000, 600000000, 500, 14, 1, 8}, | ||
2066 | { 19200000, 600000000, 375, 12, 1, 6}, | ||
2067 | { 26000000, 600000000, 600, 26, 1, 8}, | ||
2068 | |||
2069 | { 12000000, 520000000, 520, 12, 1, 8}, | ||
2070 | { 13000000, 520000000, 520, 13, 1, 8}, | ||
2071 | { 16800000, 520000000, 495, 16, 1, 8}, /* actual: 519.75 MHz */ | ||
2072 | { 19200000, 520000000, 325, 12, 1, 6}, | ||
2073 | { 26000000, 520000000, 520, 26, 1, 8}, | ||
2074 | |||
2075 | { 12000000, 416000000, 416, 12, 1, 8}, | ||
2076 | { 13000000, 416000000, 416, 13, 1, 8}, | ||
2077 | { 16800000, 416000000, 396, 16, 1, 8}, /* actual: 415.8 MHz */ | ||
2078 | { 19200000, 416000000, 260, 12, 1, 6}, | ||
2079 | { 26000000, 416000000, 416, 26, 1, 8}, | ||
2080 | { 0, 0, 0, 0, 0, 0 }, | ||
2081 | }; | ||
2082 | |||
2083 | static struct clk tegra_pll_c = { | ||
2084 | .name = "pll_c", | ||
2085 | .flags = PLL_HAS_CPCON, | ||
2086 | .ops = &tegra_pll_ops, | ||
2087 | .reg = 0x80, | ||
2088 | .parent = &tegra_pll_ref, | ||
2089 | .max_rate = 1400000000, | ||
2090 | .u.pll = { | ||
2091 | .input_min = 2000000, | ||
2092 | .input_max = 31000000, | ||
2093 | .cf_min = 1000000, | ||
2094 | .cf_max = 6000000, | ||
2095 | .vco_min = 20000000, | ||
2096 | .vco_max = 1400000000, | ||
2097 | .freq_table = tegra_pll_c_freq_table, | ||
2098 | .lock_delay = 300, | ||
2099 | }, | ||
2100 | }; | ||
2101 | |||
2102 | static struct clk tegra_pll_c_out1 = { | ||
2103 | .name = "pll_c_out1", | ||
2104 | .ops = &tegra_pll_div_ops, | ||
2105 | .flags = DIV_U71, | ||
2106 | .parent = &tegra_pll_c, | ||
2107 | .reg = 0x84, | ||
2108 | .reg_shift = 0, | ||
2109 | .max_rate = 700000000, | ||
2110 | }; | ||
2111 | |||
2112 | static struct clk_pll_freq_table tegra_pll_m_freq_table[] = { | ||
2113 | { 12000000, 666000000, 666, 12, 1, 8}, | ||
2114 | { 13000000, 666000000, 666, 13, 1, 8}, | ||
2115 | { 16800000, 666000000, 555, 14, 1, 8}, | ||
2116 | { 19200000, 666000000, 555, 16, 1, 8}, | ||
2117 | { 26000000, 666000000, 666, 26, 1, 8}, | ||
2118 | { 12000000, 600000000, 600, 12, 1, 8}, | ||
2119 | { 13000000, 600000000, 600, 13, 1, 8}, | ||
2120 | { 16800000, 600000000, 500, 14, 1, 8}, | ||
2121 | { 19200000, 600000000, 375, 12, 1, 6}, | ||
2122 | { 26000000, 600000000, 600, 26, 1, 8}, | ||
2123 | { 0, 0, 0, 0, 0, 0 }, | ||
2124 | }; | ||
2125 | |||
2126 | static struct clk tegra_pll_m = { | ||
2127 | .name = "pll_m", | ||
2128 | .flags = PLL_HAS_CPCON | PLLM, | ||
2129 | .ops = &tegra_pll_ops, | ||
2130 | .reg = 0x90, | ||
2131 | .parent = &tegra_pll_ref, | ||
2132 | .max_rate = 800000000, | ||
2133 | .u.pll = { | ||
2134 | .input_min = 2000000, | ||
2135 | .input_max = 31000000, | ||
2136 | .cf_min = 1000000, | ||
2137 | .cf_max = 6000000, | ||
2138 | .vco_min = 20000000, | ||
2139 | .vco_max = 1200000000, | ||
2140 | .freq_table = tegra_pll_m_freq_table, | ||
2141 | .lock_delay = 300, | ||
2142 | }, | ||
2143 | }; | ||
2144 | |||
2145 | static struct clk tegra_pll_m_out1 = { | ||
2146 | .name = "pll_m_out1", | ||
2147 | .ops = &tegra_pll_div_ops, | ||
2148 | .flags = DIV_U71, | ||
2149 | .parent = &tegra_pll_m, | ||
2150 | .reg = 0x94, | ||
2151 | .reg_shift = 0, | ||
2152 | .max_rate = 600000000, | ||
2153 | }; | ||
2154 | |||
2155 | static struct clk_pll_freq_table tegra_pll_p_freq_table[] = { | ||
2156 | { 12000000, 216000000, 432, 12, 2, 8}, | ||
2157 | { 13000000, 216000000, 432, 13, 2, 8}, | ||
2158 | { 16800000, 216000000, 360, 14, 2, 8}, | ||
2159 | { 19200000, 216000000, 360, 16, 2, 8}, | ||
2160 | { 26000000, 216000000, 432, 26, 2, 8}, | ||
2161 | { 0, 0, 0, 0, 0, 0 }, | ||
2162 | }; | ||
2163 | |||
2164 | static struct clk tegra_pll_p = { | ||
2165 | .name = "pll_p", | ||
2166 | .flags = ENABLE_ON_INIT | PLL_FIXED | PLL_HAS_CPCON, | ||
2167 | .ops = &tegra_pll_ops, | ||
2168 | .reg = 0xa0, | ||
2169 | .parent = &tegra_pll_ref, | ||
2170 | .max_rate = 432000000, | ||
2171 | .u.pll = { | ||
2172 | .input_min = 2000000, | ||
2173 | .input_max = 31000000, | ||
2174 | .cf_min = 1000000, | ||
2175 | .cf_max = 6000000, | ||
2176 | .vco_min = 20000000, | ||
2177 | .vco_max = 1400000000, | ||
2178 | .freq_table = tegra_pll_p_freq_table, | ||
2179 | .lock_delay = 300, | ||
2180 | .fixed_rate = 408000000, | ||
2181 | }, | ||
2182 | }; | ||
2183 | |||
2184 | static struct clk tegra_pll_p_out1 = { | ||
2185 | .name = "pll_p_out1", | ||
2186 | .ops = &tegra_pll_div_ops, | ||
2187 | .flags = ENABLE_ON_INIT | DIV_U71 | DIV_U71_FIXED, | ||
2188 | .parent = &tegra_pll_p, | ||
2189 | .reg = 0xa4, | ||
2190 | .reg_shift = 0, | ||
2191 | .max_rate = 432000000, | ||
2192 | }; | ||
2193 | |||
2194 | static struct clk tegra_pll_p_out2 = { | ||
2195 | .name = "pll_p_out2", | ||
2196 | .ops = &tegra_pll_div_ops, | ||
2197 | .flags = ENABLE_ON_INIT | DIV_U71 | DIV_U71_FIXED, | ||
2198 | .parent = &tegra_pll_p, | ||
2199 | .reg = 0xa4, | ||
2200 | .reg_shift = 16, | ||
2201 | .max_rate = 432000000, | ||
2202 | }; | ||
2203 | |||
2204 | static struct clk tegra_pll_p_out3 = { | ||
2205 | .name = "pll_p_out3", | ||
2206 | .ops = &tegra_pll_div_ops, | ||
2207 | .flags = ENABLE_ON_INIT | DIV_U71 | DIV_U71_FIXED, | ||
2208 | .parent = &tegra_pll_p, | ||
2209 | .reg = 0xa8, | ||
2210 | .reg_shift = 0, | ||
2211 | .max_rate = 432000000, | ||
2212 | }; | ||
2213 | |||
2214 | static struct clk tegra_pll_p_out4 = { | ||
2215 | .name = "pll_p_out4", | ||
2216 | .ops = &tegra_pll_div_ops, | ||
2217 | .flags = ENABLE_ON_INIT | DIV_U71 | DIV_U71_FIXED, | ||
2218 | .parent = &tegra_pll_p, | ||
2219 | .reg = 0xa8, | ||
2220 | .reg_shift = 16, | ||
2221 | .max_rate = 432000000, | ||
2222 | }; | ||
2223 | |||
2224 | static struct clk_pll_freq_table tegra_pll_a_freq_table[] = { | ||
2225 | { 9600000, 564480000, 294, 5, 1, 4}, | ||
2226 | { 9600000, 552960000, 288, 5, 1, 4}, | ||
2227 | { 9600000, 24000000, 5, 2, 1, 1}, | ||
2228 | |||
2229 | { 28800000, 56448000, 49, 25, 1, 1}, | ||
2230 | { 28800000, 73728000, 64, 25, 1, 1}, | ||
2231 | { 28800000, 24000000, 5, 6, 1, 1}, | ||
2232 | { 0, 0, 0, 0, 0, 0 }, | ||
2233 | }; | ||
2234 | |||
2235 | static struct clk tegra_pll_a = { | ||
2236 | .name = "pll_a", | ||
2237 | .flags = PLL_HAS_CPCON, | ||
2238 | .ops = &tegra_pll_ops, | ||
2239 | .reg = 0xb0, | ||
2240 | .parent = &tegra_pll_p_out1, | ||
2241 | .max_rate = 700000000, | ||
2242 | .u.pll = { | ||
2243 | .input_min = 2000000, | ||
2244 | .input_max = 31000000, | ||
2245 | .cf_min = 1000000, | ||
2246 | .cf_max = 6000000, | ||
2247 | .vco_min = 20000000, | ||
2248 | .vco_max = 1400000000, | ||
2249 | .freq_table = tegra_pll_a_freq_table, | ||
2250 | .lock_delay = 300, | ||
2251 | }, | ||
2252 | }; | ||
2253 | |||
2254 | static struct clk tegra_pll_a_out0 = { | ||
2255 | .name = "pll_a_out0", | ||
2256 | .ops = &tegra_pll_div_ops, | ||
2257 | .flags = DIV_U71, | ||
2258 | .parent = &tegra_pll_a, | ||
2259 | .reg = 0xb4, | ||
2260 | .reg_shift = 0, | ||
2261 | .max_rate = 100000000, | ||
2262 | }; | ||
2263 | |||
2264 | static struct clk_pll_freq_table tegra_pll_d_freq_table[] = { | ||
2265 | { 12000000, 216000000, 216, 12, 1, 4}, | ||
2266 | { 13000000, 216000000, 216, 13, 1, 4}, | ||
2267 | { 16800000, 216000000, 180, 14, 1, 4}, | ||
2268 | { 19200000, 216000000, 180, 16, 1, 4}, | ||
2269 | { 26000000, 216000000, 216, 26, 1, 4}, | ||
2270 | |||
2271 | { 12000000, 594000000, 594, 12, 1, 8}, | ||
2272 | { 13000000, 594000000, 594, 13, 1, 8}, | ||
2273 | { 16800000, 594000000, 495, 14, 1, 8}, | ||
2274 | { 19200000, 594000000, 495, 16, 1, 8}, | ||
2275 | { 26000000, 594000000, 594, 26, 1, 8}, | ||
2276 | |||
2277 | { 12000000, 1000000000, 1000, 12, 1, 12}, | ||
2278 | { 13000000, 1000000000, 1000, 13, 1, 12}, | ||
2279 | { 19200000, 1000000000, 625, 12, 1, 8}, | ||
2280 | { 26000000, 1000000000, 1000, 26, 1, 12}, | ||
2281 | |||
2282 | { 0, 0, 0, 0, 0, 0 }, | ||
2283 | }; | ||
2284 | |||
2285 | static struct clk tegra_pll_d = { | ||
2286 | .name = "pll_d", | ||
2287 | .flags = PLL_HAS_CPCON | PLLD, | ||
2288 | .ops = &tegra_plld_ops, | ||
2289 | .reg = 0xd0, | ||
2290 | .parent = &tegra_pll_ref, | ||
2291 | .max_rate = 1000000000, | ||
2292 | .u.pll = { | ||
2293 | .input_min = 2000000, | ||
2294 | .input_max = 40000000, | ||
2295 | .cf_min = 1000000, | ||
2296 | .cf_max = 6000000, | ||
2297 | .vco_min = 40000000, | ||
2298 | .vco_max = 1000000000, | ||
2299 | .freq_table = tegra_pll_d_freq_table, | ||
2300 | .lock_delay = 1000, | ||
2301 | }, | ||
2302 | }; | ||
2303 | |||
2304 | static struct clk tegra_pll_d_out0 = { | ||
2305 | .name = "pll_d_out0", | ||
2306 | .ops = &tegra_pll_div_ops, | ||
2307 | .flags = DIV_2 | PLLD, | ||
2308 | .parent = &tegra_pll_d, | ||
2309 | .max_rate = 500000000, | ||
2310 | }; | ||
2311 | |||
2312 | static struct clk tegra_pll_d2 = { | ||
2313 | .name = "pll_d2", | ||
2314 | .flags = PLL_HAS_CPCON | PLL_ALT_MISC_REG | PLLD, | ||
2315 | .ops = &tegra_plld_ops, | ||
2316 | .reg = 0x4b8, | ||
2317 | .parent = &tegra_pll_ref, | ||
2318 | .max_rate = 1000000000, | ||
2319 | .u.pll = { | ||
2320 | .input_min = 2000000, | ||
2321 | .input_max = 40000000, | ||
2322 | .cf_min = 1000000, | ||
2323 | .cf_max = 6000000, | ||
2324 | .vco_min = 40000000, | ||
2325 | .vco_max = 1000000000, | ||
2326 | .freq_table = tegra_pll_d_freq_table, | ||
2327 | .lock_delay = 1000, | ||
2328 | }, | ||
2329 | }; | ||
2330 | |||
2331 | static struct clk tegra_pll_d2_out0 = { | ||
2332 | .name = "pll_d2_out0", | ||
2333 | .ops = &tegra_pll_div_ops, | ||
2334 | .flags = DIV_2 | PLLD, | ||
2335 | .parent = &tegra_pll_d2, | ||
2336 | .max_rate = 500000000, | ||
2337 | }; | ||
2338 | |||
2339 | static struct clk_pll_freq_table tegra_pll_u_freq_table[] = { | ||
2340 | { 12000000, 480000000, 960, 12, 2, 12}, | ||
2341 | { 13000000, 480000000, 960, 13, 2, 12}, | ||
2342 | { 16800000, 480000000, 400, 7, 2, 5}, | ||
2343 | { 19200000, 480000000, 200, 4, 2, 3}, | ||
2344 | { 26000000, 480000000, 960, 26, 2, 12}, | ||
2345 | { 0, 0, 0, 0, 0, 0 }, | ||
2346 | }; | ||
2347 | |||
2348 | static struct clk tegra_pll_u = { | ||
2349 | .name = "pll_u", | ||
2350 | .flags = PLL_HAS_CPCON | PLLU, | ||
2351 | .ops = &tegra_pll_ops, | ||
2352 | .reg = 0xc0, | ||
2353 | .parent = &tegra_pll_ref, | ||
2354 | .max_rate = 480000000, | ||
2355 | .u.pll = { | ||
2356 | .input_min = 2000000, | ||
2357 | .input_max = 40000000, | ||
2358 | .cf_min = 1000000, | ||
2359 | .cf_max = 6000000, | ||
2360 | .vco_min = 480000000, | ||
2361 | .vco_max = 960000000, | ||
2362 | .freq_table = tegra_pll_u_freq_table, | ||
2363 | .lock_delay = 1000, | ||
2364 | }, | ||
2365 | }; | ||
2366 | |||
2367 | static struct clk_pll_freq_table tegra_pll_x_freq_table[] = { | ||
2368 | /* 1.7 GHz */ | ||
2369 | { 12000000, 1700000000, 850, 6, 1, 8}, | ||
2370 | { 13000000, 1700000000, 915, 7, 1, 8}, /* actual: 1699.2 MHz */ | ||
2371 | { 16800000, 1700000000, 708, 7, 1, 8}, /* actual: 1699.2 MHz */ | ||
2372 | { 19200000, 1700000000, 885, 10, 1, 8}, /* actual: 1699.2 MHz */ | ||
2373 | { 26000000, 1700000000, 850, 13, 1, 8}, | ||
2374 | |||
2375 | /* 1.6 GHz */ | ||
2376 | { 12000000, 1600000000, 800, 6, 1, 8}, | ||
2377 | { 13000000, 1600000000, 738, 6, 1, 8}, /* actual: 1599.0 MHz */ | ||
2378 | { 16800000, 1600000000, 857, 9, 1, 8}, /* actual: 1599.7 MHz */ | ||
2379 | { 19200000, 1600000000, 500, 6, 1, 8}, | ||
2380 | { 26000000, 1600000000, 800, 13, 1, 8}, | ||
2381 | |||
2382 | /* 1.5 GHz */ | ||
2383 | { 12000000, 1500000000, 750, 6, 1, 8}, | ||
2384 | { 13000000, 1500000000, 923, 8, 1, 8}, /* actual: 1499.8 MHz */ | ||
2385 | { 16800000, 1500000000, 625, 7, 1, 8}, | ||
2386 | { 19200000, 1500000000, 625, 8, 1, 8}, | ||
2387 | { 26000000, 1500000000, 750, 13, 1, 8}, | ||
2388 | |||
2389 | /* 1.4 GHz */ | ||
2390 | { 12000000, 1400000000, 700, 6, 1, 8}, | ||
2391 | { 13000000, 1400000000, 969, 9, 1, 8}, /* actual: 1399.7 MHz */ | ||
2392 | { 16800000, 1400000000, 1000, 12, 1, 8}, | ||
2393 | { 19200000, 1400000000, 875, 12, 1, 8}, | ||
2394 | { 26000000, 1400000000, 700, 13, 1, 8}, | ||
2395 | |||
2396 | /* 1.3 GHz */ | ||
2397 | { 12000000, 1300000000, 975, 9, 1, 8}, | ||
2398 | { 13000000, 1300000000, 1000, 10, 1, 8}, | ||
2399 | { 16800000, 1300000000, 928, 12, 1, 8}, /* actual: 1299.2 MHz */ | ||
2400 | { 19200000, 1300000000, 812, 12, 1, 8}, /* actual: 1299.2 MHz */ | ||
2401 | { 26000000, 1300000000, 650, 13, 1, 8}, | ||
2402 | |||
2403 | /* 1.2 GHz */ | ||
2404 | { 12000000, 1200000000, 1000, 10, 1, 8}, | ||
2405 | { 13000000, 1200000000, 923, 10, 1, 8}, /* actual: 1199.9 MHz */ | ||
2406 | { 16800000, 1200000000, 1000, 14, 1, 8}, | ||
2407 | { 19200000, 1200000000, 1000, 16, 1, 8}, | ||
2408 | { 26000000, 1200000000, 600, 13, 1, 8}, | ||
2409 | |||
2410 | /* 1.1 GHz */ | ||
2411 | { 12000000, 1100000000, 825, 9, 1, 8}, | ||
2412 | { 13000000, 1100000000, 846, 10, 1, 8}, /* actual: 1099.8 MHz */ | ||
2413 | { 16800000, 1100000000, 982, 15, 1, 8}, /* actual: 1099.8 MHz */ | ||
2414 | { 19200000, 1100000000, 859, 15, 1, 8}, /* actual: 1099.5 MHz */ | ||
2415 | { 26000000, 1100000000, 550, 13, 1, 8}, | ||
2416 | |||
2417 | /* 1 GHz */ | ||
2418 | { 12000000, 1000000000, 1000, 12, 1, 8}, | ||
2419 | { 13000000, 1000000000, 1000, 13, 1, 8}, | ||
2420 | { 16800000, 1000000000, 833, 14, 1, 8}, /* actual: 999.6 MHz */ | ||
2421 | { 19200000, 1000000000, 625, 12, 1, 8}, | ||
2422 | { 26000000, 1000000000, 1000, 26, 1, 8}, | ||
2423 | |||
2424 | { 0, 0, 0, 0, 0, 0 }, | ||
2425 | }; | ||
2426 | |||
2427 | static struct clk tegra_pll_x = { | ||
2428 | .name = "pll_x", | ||
2429 | .flags = PLL_HAS_CPCON | PLL_ALT_MISC_REG | PLLX, | ||
2430 | .ops = &tegra_pll_ops, | ||
2431 | .reg = 0xe0, | ||
2432 | .parent = &tegra_pll_ref, | ||
2433 | .max_rate = 1700000000, | ||
2434 | .u.pll = { | ||
2435 | .input_min = 2000000, | ||
2436 | .input_max = 31000000, | ||
2437 | .cf_min = 1000000, | ||
2438 | .cf_max = 6000000, | ||
2439 | .vco_min = 20000000, | ||
2440 | .vco_max = 1700000000, | ||
2441 | .freq_table = tegra_pll_x_freq_table, | ||
2442 | .lock_delay = 300, | ||
2443 | }, | ||
2444 | }; | ||
2445 | |||
2446 | static struct clk tegra_pll_x_out0 = { | ||
2447 | .name = "pll_x_out0", | ||
2448 | .ops = &tegra_pll_div_ops, | ||
2449 | .flags = DIV_2 | PLLX, | ||
2450 | .parent = &tegra_pll_x, | ||
2451 | .max_rate = 850000000, | ||
2452 | }; | ||
2453 | |||
2454 | |||
2455 | static struct clk_pll_freq_table tegra_pll_e_freq_table[] = { | ||
2456 | /* PLLE special case: use cpcon field to store cml divider value */ | ||
2457 | { 12000000, 100000000, 150, 1, 18, 11}, | ||
2458 | { 216000000, 100000000, 200, 18, 24, 13}, | ||
2459 | { 0, 0, 0, 0, 0, 0 }, | ||
2460 | }; | ||
2461 | |||
2462 | static struct clk tegra_pll_e = { | ||
2463 | .name = "pll_e", | ||
2464 | .flags = PLL_ALT_MISC_REG, | ||
2465 | .ops = &tegra_plle_ops, | ||
2466 | .reg = 0xe8, | ||
2467 | .max_rate = 100000000, | ||
2468 | .u.pll = { | ||
2469 | .input_min = 12000000, | ||
2470 | .input_max = 216000000, | ||
2471 | .cf_min = 12000000, | ||
2472 | .cf_max = 12000000, | ||
2473 | .vco_min = 1200000000, | ||
2474 | .vco_max = 2400000000U, | ||
2475 | .freq_table = tegra_pll_e_freq_table, | ||
2476 | .lock_delay = 300, | ||
2477 | .fixed_rate = 100000000, | ||
2478 | }, | ||
2479 | }; | ||
2480 | |||
2481 | static struct clk tegra_cml0_clk = { | ||
2482 | .name = "cml0", | ||
2483 | .parent = &tegra_pll_e, | ||
2484 | .ops = &tegra_cml_clk_ops, | ||
2485 | .reg = PLLE_AUX, | ||
2486 | .max_rate = 100000000, | ||
2487 | .u.periph = { | ||
2488 | .clk_num = 0, | ||
2489 | }, | ||
2490 | }; | ||
2491 | |||
2492 | static struct clk tegra_cml1_clk = { | ||
2493 | .name = "cml1", | ||
2494 | .parent = &tegra_pll_e, | ||
2495 | .ops = &tegra_cml_clk_ops, | ||
2496 | .reg = PLLE_AUX, | ||
2497 | .max_rate = 100000000, | ||
2498 | .u.periph = { | ||
2499 | .clk_num = 1, | ||
2500 | }, | ||
2501 | }; | ||
2502 | |||
2503 | static struct clk tegra_pciex_clk = { | ||
2504 | .name = "pciex", | ||
2505 | .parent = &tegra_pll_e, | ||
2506 | .ops = &tegra_pciex_clk_ops, | ||
2507 | .max_rate = 100000000, | ||
2508 | .u.periph = { | ||
2509 | .clk_num = 74, | ||
2510 | }, | ||
2511 | }; | ||
2512 | |||
2513 | /* Audio sync clocks */ | ||
2514 | #define SYNC_SOURCE(_id) \ | ||
2515 | { \ | ||
2516 | .name = #_id "_sync", \ | ||
2517 | .rate = 24000000, \ | ||
2518 | .max_rate = 24000000, \ | ||
2519 | .ops = &tegra_sync_source_ops \ | ||
2520 | } | ||
2521 | static struct clk tegra_sync_source_list[] = { | ||
2522 | SYNC_SOURCE(spdif_in), | ||
2523 | SYNC_SOURCE(i2s0), | ||
2524 | SYNC_SOURCE(i2s1), | ||
2525 | SYNC_SOURCE(i2s2), | ||
2526 | SYNC_SOURCE(i2s3), | ||
2527 | SYNC_SOURCE(i2s4), | ||
2528 | SYNC_SOURCE(vimclk), | ||
2529 | }; | ||
2530 | |||
2531 | static struct clk_mux_sel mux_audio_sync_clk[] = { | ||
2532 | { .input = &tegra_sync_source_list[0], .value = 0}, | ||
2533 | { .input = &tegra_sync_source_list[1], .value = 1}, | ||
2534 | { .input = &tegra_sync_source_list[2], .value = 2}, | ||
2535 | { .input = &tegra_sync_source_list[3], .value = 3}, | ||
2536 | { .input = &tegra_sync_source_list[4], .value = 4}, | ||
2537 | { .input = &tegra_sync_source_list[5], .value = 5}, | ||
2538 | { .input = &tegra_pll_a_out0, .value = 6}, | ||
2539 | { .input = &tegra_sync_source_list[6], .value = 7}, | ||
2540 | { 0, 0 } | ||
2541 | }; | ||
2542 | |||
2543 | #define AUDIO_SYNC_CLK(_id, _index) \ | ||
2544 | { \ | ||
2545 | .name = #_id, \ | ||
2546 | .inputs = mux_audio_sync_clk, \ | ||
2547 | .reg = 0x4A0 + (_index) * 4, \ | ||
2548 | .max_rate = 24000000, \ | ||
2549 | .ops = &tegra_audio_sync_clk_ops \ | ||
2550 | } | ||
2551 | static struct clk tegra_clk_audio_list[] = { | ||
2552 | AUDIO_SYNC_CLK(audio0, 0), | ||
2553 | AUDIO_SYNC_CLK(audio1, 1), | ||
2554 | AUDIO_SYNC_CLK(audio2, 2), | ||
2555 | AUDIO_SYNC_CLK(audio3, 3), | ||
2556 | AUDIO_SYNC_CLK(audio4, 4), | ||
2557 | AUDIO_SYNC_CLK(audio, 5), /* SPDIF */ | ||
2558 | }; | ||
2559 | |||
2560 | #define AUDIO_SYNC_2X_CLK(_id, _index) \ | ||
2561 | { \ | ||
2562 | .name = #_id "_2x", \ | ||
2563 | .flags = PERIPH_NO_RESET, \ | ||
2564 | .max_rate = 48000000, \ | ||
2565 | .ops = &tegra_clk_double_ops, \ | ||
2566 | .reg = 0x49C, \ | ||
2567 | .reg_shift = 24 + (_index), \ | ||
2568 | .parent = &tegra_clk_audio_list[(_index)], \ | ||
2569 | .u.periph = { \ | ||
2570 | .clk_num = 113 + (_index), \ | ||
2571 | }, \ | ||
2572 | } | ||
2573 | static struct clk tegra_clk_audio_2x_list[] = { | ||
2574 | AUDIO_SYNC_2X_CLK(audio0, 0), | ||
2575 | AUDIO_SYNC_2X_CLK(audio1, 1), | ||
2576 | AUDIO_SYNC_2X_CLK(audio2, 2), | ||
2577 | AUDIO_SYNC_2X_CLK(audio3, 3), | ||
2578 | AUDIO_SYNC_2X_CLK(audio4, 4), | ||
2579 | AUDIO_SYNC_2X_CLK(audio, 5), /* SPDIF */ | ||
2580 | }; | ||
2581 | |||
2582 | #define MUX_I2S_SPDIF(_id, _index) \ | ||
2583 | static struct clk_mux_sel mux_pllaout0_##_id##_2x_pllp_clkm[] = { \ | ||
2584 | {.input = &tegra_pll_a_out0, .value = 0}, \ | ||
2585 | {.input = &tegra_clk_audio_2x_list[(_index)], .value = 1}, \ | ||
2586 | {.input = &tegra_pll_p, .value = 2}, \ | ||
2587 | {.input = &tegra_clk_m, .value = 3}, \ | ||
2588 | { 0, 0}, \ | ||
2589 | } | ||
2590 | MUX_I2S_SPDIF(audio0, 0); | ||
2591 | MUX_I2S_SPDIF(audio1, 1); | ||
2592 | MUX_I2S_SPDIF(audio2, 2); | ||
2593 | MUX_I2S_SPDIF(audio3, 3); | ||
2594 | MUX_I2S_SPDIF(audio4, 4); | ||
2595 | MUX_I2S_SPDIF(audio, 5); /* SPDIF */ | ||
2596 | |||
2597 | /* External clock outputs (through PMC) */ | ||
2598 | #define MUX_EXTERN_OUT(_id) \ | ||
2599 | static struct clk_mux_sel mux_clkm_clkm2_clkm4_extern##_id[] = { \ | ||
2600 | {.input = &tegra_clk_m, .value = 0}, \ | ||
2601 | {.input = &tegra_clk_m_div2, .value = 1}, \ | ||
2602 | {.input = &tegra_clk_m_div4, .value = 2}, \ | ||
2603 | {.input = NULL, .value = 3}, /* placeholder */ \ | ||
2604 | { 0, 0}, \ | ||
2605 | } | ||
2606 | MUX_EXTERN_OUT(1); | ||
2607 | MUX_EXTERN_OUT(2); | ||
2608 | MUX_EXTERN_OUT(3); | ||
2609 | |||
2610 | static struct clk_mux_sel *mux_extern_out_list[] = { | ||
2611 | mux_clkm_clkm2_clkm4_extern1, | ||
2612 | mux_clkm_clkm2_clkm4_extern2, | ||
2613 | mux_clkm_clkm2_clkm4_extern3, | ||
2614 | }; | ||
2615 | |||
2616 | #define CLK_OUT_CLK(_id) \ | ||
2617 | { \ | ||
2618 | .name = "clk_out_" #_id, \ | ||
2619 | .lookup = { \ | ||
2620 | .dev_id = "clk_out_" #_id, \ | ||
2621 | .con_id = "extern" #_id, \ | ||
2622 | }, \ | ||
2623 | .ops = &tegra_clk_out_ops, \ | ||
2624 | .reg = 0x1a8, \ | ||
2625 | .inputs = mux_clkm_clkm2_clkm4_extern##_id, \ | ||
2626 | .flags = MUX_CLK_OUT, \ | ||
2627 | .max_rate = 216000000, \ | ||
2628 | .u.periph = { \ | ||
2629 | .clk_num = (_id - 1) * 8 + 2, \ | ||
2630 | }, \ | ||
2631 | } | ||
2632 | static struct clk tegra_clk_out_list[] = { | ||
2633 | CLK_OUT_CLK(1), | ||
2634 | CLK_OUT_CLK(2), | ||
2635 | CLK_OUT_CLK(3), | ||
2636 | }; | ||
2637 | |||
2638 | /* called after peripheral external clocks are initialized */ | ||
2639 | static void init_clk_out_mux(void) | ||
2640 | { | ||
2641 | int i; | ||
2642 | struct clk *c; | ||
2643 | |||
2644 | /* output clock con_id is the name of peripheral | ||
2645 | external clock connected to input 3 of the output mux */ | ||
2646 | for (i = 0; i < ARRAY_SIZE(tegra_clk_out_list); i++) { | ||
2647 | c = tegra_get_clock_by_name( | ||
2648 | tegra_clk_out_list[i].lookup.con_id); | ||
2649 | if (!c) | ||
2650 | pr_err("%s: could not find clk %s\n", __func__, | ||
2651 | tegra_clk_out_list[i].lookup.con_id); | ||
2652 | mux_extern_out_list[i][3].input = c; | ||
2653 | } | ||
2654 | } | ||
2655 | |||
2656 | /* Peripheral muxes */ | ||
2657 | static struct clk_mux_sel mux_sclk[] = { | ||
2658 | { .input = &tegra_clk_m, .value = 0}, | ||
2659 | { .input = &tegra_pll_c_out1, .value = 1}, | ||
2660 | { .input = &tegra_pll_p_out4, .value = 2}, | ||
2661 | { .input = &tegra_pll_p_out3, .value = 3}, | ||
2662 | { .input = &tegra_pll_p_out2, .value = 4}, | ||
2663 | /* { .input = &tegra_clk_d, .value = 5}, - no use on tegra30 */ | ||
2664 | { .input = &tegra_clk_32k, .value = 6}, | ||
2665 | { .input = &tegra_pll_m_out1, .value = 7}, | ||
2666 | { 0, 0}, | ||
2667 | }; | ||
2668 | |||
2669 | static struct clk tegra_clk_sclk = { | ||
2670 | .name = "sclk", | ||
2671 | .inputs = mux_sclk, | ||
2672 | .reg = 0x28, | ||
2673 | .ops = &tegra_super_ops, | ||
2674 | .max_rate = 334000000, | ||
2675 | .min_rate = 40000000, | ||
2676 | }; | ||
2677 | |||
2678 | static struct clk tegra_clk_blink = { | ||
2679 | .name = "blink", | ||
2680 | .parent = &tegra_clk_32k, | ||
2681 | .reg = 0x40, | ||
2682 | .ops = &tegra_blink_clk_ops, | ||
2683 | .max_rate = 32768, | ||
2684 | }; | ||
2685 | |||
2686 | static struct clk_mux_sel mux_pllm_pllc_pllp_plla[] = { | ||
2687 | { .input = &tegra_pll_m, .value = 0}, | ||
2688 | { .input = &tegra_pll_c, .value = 1}, | ||
2689 | { .input = &tegra_pll_p, .value = 2}, | ||
2690 | { .input = &tegra_pll_a_out0, .value = 3}, | ||
2691 | { 0, 0}, | ||
2692 | }; | ||
2693 | |||
2694 | static struct clk_mux_sel mux_pllp_pllc_pllm_clkm[] = { | ||
2695 | { .input = &tegra_pll_p, .value = 0}, | ||
2696 | { .input = &tegra_pll_c, .value = 1}, | ||
2697 | { .input = &tegra_pll_m, .value = 2}, | ||
2698 | { .input = &tegra_clk_m, .value = 3}, | ||
2699 | { 0, 0}, | ||
2700 | }; | ||
2701 | |||
2702 | static struct clk_mux_sel mux_pllp_clkm[] = { | ||
2703 | { .input = &tegra_pll_p, .value = 0}, | ||
2704 | { .input = &tegra_clk_m, .value = 3}, | ||
2705 | { 0, 0}, | ||
2706 | }; | ||
2707 | |||
2708 | static struct clk_mux_sel mux_pllp_plld_pllc_clkm[] = { | ||
2709 | {.input = &tegra_pll_p, .value = 0}, | ||
2710 | {.input = &tegra_pll_d_out0, .value = 1}, | ||
2711 | {.input = &tegra_pll_c, .value = 2}, | ||
2712 | {.input = &tegra_clk_m, .value = 3}, | ||
2713 | { 0, 0}, | ||
2714 | }; | ||
2715 | |||
2716 | static struct clk_mux_sel mux_pllp_pllm_plld_plla_pllc_plld2_clkm[] = { | ||
2717 | {.input = &tegra_pll_p, .value = 0}, | ||
2718 | {.input = &tegra_pll_m, .value = 1}, | ||
2719 | {.input = &tegra_pll_d_out0, .value = 2}, | ||
2720 | {.input = &tegra_pll_a_out0, .value = 3}, | ||
2721 | {.input = &tegra_pll_c, .value = 4}, | ||
2722 | {.input = &tegra_pll_d2_out0, .value = 5}, | ||
2723 | {.input = &tegra_clk_m, .value = 6}, | ||
2724 | { 0, 0}, | ||
2725 | }; | ||
2726 | |||
2727 | static struct clk_mux_sel mux_plla_pllc_pllp_clkm[] = { | ||
2728 | { .input = &tegra_pll_a_out0, .value = 0}, | ||
2729 | /* { .input = &tegra_pll_c, .value = 1}, no use on tegra30 */ | ||
2730 | { .input = &tegra_pll_p, .value = 2}, | ||
2731 | { .input = &tegra_clk_m, .value = 3}, | ||
2732 | { 0, 0}, | ||
2733 | }; | ||
2734 | |||
2735 | static struct clk_mux_sel mux_pllp_pllc_clk32_clkm[] = { | ||
2736 | {.input = &tegra_pll_p, .value = 0}, | ||
2737 | {.input = &tegra_pll_c, .value = 1}, | ||
2738 | {.input = &tegra_clk_32k, .value = 2}, | ||
2739 | {.input = &tegra_clk_m, .value = 3}, | ||
2740 | { 0, 0}, | ||
2741 | }; | ||
2742 | |||
2743 | static struct clk_mux_sel mux_pllp_pllc_clkm_clk32[] = { | ||
2744 | {.input = &tegra_pll_p, .value = 0}, | ||
2745 | {.input = &tegra_pll_c, .value = 1}, | ||
2746 | {.input = &tegra_clk_m, .value = 2}, | ||
2747 | {.input = &tegra_clk_32k, .value = 3}, | ||
2748 | { 0, 0}, | ||
2749 | }; | ||
2750 | |||
2751 | static struct clk_mux_sel mux_pllp_pllc_pllm[] = { | ||
2752 | {.input = &tegra_pll_p, .value = 0}, | ||
2753 | {.input = &tegra_pll_c, .value = 1}, | ||
2754 | {.input = &tegra_pll_m, .value = 2}, | ||
2755 | { 0, 0}, | ||
2756 | }; | ||
2757 | |||
2758 | static struct clk_mux_sel mux_clk_m[] = { | ||
2759 | { .input = &tegra_clk_m, .value = 0}, | ||
2760 | { 0, 0}, | ||
2761 | }; | ||
2762 | |||
2763 | static struct clk_mux_sel mux_pllp_out3[] = { | ||
2764 | { .input = &tegra_pll_p_out3, .value = 0}, | ||
2765 | { 0, 0}, | ||
2766 | }; | ||
2767 | |||
2768 | static struct clk_mux_sel mux_plld_out0[] = { | ||
2769 | { .input = &tegra_pll_d_out0, .value = 0}, | ||
2770 | { 0, 0}, | ||
2771 | }; | ||
2772 | |||
2773 | static struct clk_mux_sel mux_plld_out0_plld2_out0[] = { | ||
2774 | { .input = &tegra_pll_d_out0, .value = 0}, | ||
2775 | { .input = &tegra_pll_d2_out0, .value = 1}, | ||
2776 | { 0, 0}, | ||
2777 | }; | ||
2778 | |||
2779 | static struct clk_mux_sel mux_clk_32k[] = { | ||
2780 | { .input = &tegra_clk_32k, .value = 0}, | ||
2781 | { 0, 0}, | ||
2782 | }; | ||
2783 | |||
2784 | static struct clk_mux_sel mux_plla_clk32_pllp_clkm_plle[] = { | ||
2785 | { .input = &tegra_pll_a_out0, .value = 0}, | ||
2786 | { .input = &tegra_clk_32k, .value = 1}, | ||
2787 | { .input = &tegra_pll_p, .value = 2}, | ||
2788 | { .input = &tegra_clk_m, .value = 3}, | ||
2789 | { .input = &tegra_pll_e, .value = 4}, | ||
2790 | { 0, 0}, | ||
2791 | }; | ||
2792 | |||
2793 | static struct clk_mux_sel mux_cclk_g[] = { | ||
2794 | { .input = &tegra_clk_m, .value = 0}, | ||
2795 | { .input = &tegra_pll_c, .value = 1}, | ||
2796 | { .input = &tegra_clk_32k, .value = 2}, | ||
2797 | { .input = &tegra_pll_m, .value = 3}, | ||
2798 | { .input = &tegra_pll_p, .value = 4}, | ||
2799 | { .input = &tegra_pll_p_out4, .value = 5}, | ||
2800 | { .input = &tegra_pll_p_out3, .value = 6}, | ||
2801 | { .input = &tegra_pll_x, .value = 8}, | ||
2802 | { 0, 0}, | ||
2803 | }; | ||
2804 | |||
2805 | static struct clk tegra_clk_cclk_g = { | ||
2806 | .name = "cclk_g", | ||
2807 | .flags = DIV_U71 | DIV_U71_INT, | ||
2808 | .inputs = mux_cclk_g, | ||
2809 | .reg = 0x368, | ||
2810 | .ops = &tegra_super_ops, | ||
2811 | .max_rate = 1700000000, | ||
2812 | }; | ||
2813 | |||
2814 | static struct clk tegra30_clk_twd = { | ||
2815 | .parent = &tegra_clk_cclk_g, | ||
2816 | .name = "twd", | ||
2817 | .ops = &tegra30_twd_ops, | ||
2818 | .max_rate = 1400000000, /* Same as tegra_clk_cpu_cmplx.max_rate */ | ||
2819 | .mul = 1, | ||
2820 | .div = 2, | ||
2821 | }; | ||
2822 | |||
2823 | #define PERIPH_CLK(_name, _dev, _con, _clk_num, _reg, _max, _inputs, _flags) \ | ||
2824 | { \ | ||
2825 | .name = _name, \ | ||
2826 | .lookup = { \ | ||
2827 | .dev_id = _dev, \ | ||
2828 | .con_id = _con, \ | ||
2829 | }, \ | ||
2830 | .ops = &tegra_periph_clk_ops, \ | ||
2831 | .reg = _reg, \ | ||
2832 | .inputs = _inputs, \ | ||
2833 | .flags = _flags, \ | ||
2834 | .max_rate = _max, \ | ||
2835 | .u.periph = { \ | ||
2836 | .clk_num = _clk_num, \ | ||
2837 | }, \ | ||
2838 | } | ||
2839 | |||
2840 | #define PERIPH_CLK_EX(_name, _dev, _con, _clk_num, _reg, _max, _inputs, \ | ||
2841 | _flags, _ops) \ | ||
2842 | { \ | ||
2843 | .name = _name, \ | ||
2844 | .lookup = { \ | ||
2845 | .dev_id = _dev, \ | ||
2846 | .con_id = _con, \ | ||
2847 | }, \ | ||
2848 | .ops = _ops, \ | ||
2849 | .reg = _reg, \ | ||
2850 | .inputs = _inputs, \ | ||
2851 | .flags = _flags, \ | ||
2852 | .max_rate = _max, \ | ||
2853 | .u.periph = { \ | ||
2854 | .clk_num = _clk_num, \ | ||
2855 | }, \ | ||
2856 | } | ||
2857 | |||
2858 | #define SHARED_CLK(_name, _dev, _con, _parent, _id, _div, _mode)\ | ||
2859 | { \ | ||
2860 | .name = _name, \ | ||
2861 | .lookup = { \ | ||
2862 | .dev_id = _dev, \ | ||
2863 | .con_id = _con, \ | ||
2864 | }, \ | ||
2865 | .ops = &tegra_clk_shared_bus_ops, \ | ||
2866 | .parent = _parent, \ | ||
2867 | .u.shared_bus_user = { \ | ||
2868 | .client_id = _id, \ | ||
2869 | .client_div = _div, \ | ||
2870 | .mode = _mode, \ | ||
2871 | }, \ | ||
2872 | } | ||
2873 | struct clk tegra_list_clks[] = { | ||
2874 | PERIPH_CLK("apbdma", "tegra-apbdma", NULL, 34, 0, 26000000, mux_clk_m, 0), | ||
2875 | PERIPH_CLK("rtc", "rtc-tegra", NULL, 4, 0, 32768, mux_clk_32k, PERIPH_NO_RESET | PERIPH_ON_APB), | ||
2876 | PERIPH_CLK("kbc", "tegra-kbc", NULL, 36, 0, 32768, mux_clk_32k, PERIPH_NO_RESET | PERIPH_ON_APB), | ||
2877 | PERIPH_CLK("timer", "timer", NULL, 5, 0, 26000000, mux_clk_m, 0), | ||
2878 | PERIPH_CLK("kfuse", "kfuse-tegra", NULL, 40, 0, 26000000, mux_clk_m, 0), | ||
2879 | PERIPH_CLK("fuse", "fuse-tegra", "fuse", 39, 0, 26000000, mux_clk_m, PERIPH_ON_APB), | ||
2880 | PERIPH_CLK("fuse_burn", "fuse-tegra", "fuse_burn", 39, 0, 26000000, mux_clk_m, PERIPH_ON_APB), | ||
2881 | PERIPH_CLK("apbif", "tegra30-ahub", "apbif", 107, 0, 26000000, mux_clk_m, 0), | ||
2882 | PERIPH_CLK("i2s0", "tegra30-i2s.0", NULL, 30, 0x1d8, 26000000, mux_pllaout0_audio0_2x_pllp_clkm, MUX | DIV_U71 | PERIPH_ON_APB), | ||
2883 | PERIPH_CLK("i2s1", "tegra30-i2s.1", NULL, 11, 0x100, 26000000, mux_pllaout0_audio1_2x_pllp_clkm, MUX | DIV_U71 | PERIPH_ON_APB), | ||
2884 | PERIPH_CLK("i2s2", "tegra30-i2s.2", NULL, 18, 0x104, 26000000, mux_pllaout0_audio2_2x_pllp_clkm, MUX | DIV_U71 | PERIPH_ON_APB), | ||
2885 | PERIPH_CLK("i2s3", "tegra30-i2s.3", NULL, 101, 0x3bc, 26000000, mux_pllaout0_audio3_2x_pllp_clkm, MUX | DIV_U71 | PERIPH_ON_APB), | ||
2886 | PERIPH_CLK("i2s4", "tegra30-i2s.4", NULL, 102, 0x3c0, 26000000, mux_pllaout0_audio4_2x_pllp_clkm, MUX | DIV_U71 | PERIPH_ON_APB), | ||
2887 | PERIPH_CLK("spdif_out", "tegra30-spdif", "spdif_out", 10, 0x108, 100000000, mux_pllaout0_audio_2x_pllp_clkm, MUX | DIV_U71 | PERIPH_ON_APB), | ||
2888 | PERIPH_CLK("spdif_in", "tegra30-spdif", "spdif_in", 10, 0x10c, 100000000, mux_pllp_pllc_pllm, MUX | DIV_U71 | PERIPH_ON_APB), | ||
2889 | PERIPH_CLK("pwm", "tegra-pwm", NULL, 17, 0x110, 432000000, mux_pllp_pllc_clk32_clkm, MUX | MUX_PWM | DIV_U71 | PERIPH_ON_APB), | ||
2890 | PERIPH_CLK("d_audio", "tegra30-ahub", "d_audio", 106, 0x3d0, 48000000, mux_plla_pllc_pllp_clkm, MUX | DIV_U71), | ||
2891 | PERIPH_CLK("dam0", "tegra30-dam.0", NULL, 108, 0x3d8, 48000000, mux_plla_pllc_pllp_clkm, MUX | DIV_U71), | ||
2892 | PERIPH_CLK("dam1", "tegra30-dam.1", NULL, 109, 0x3dc, 48000000, mux_plla_pllc_pllp_clkm, MUX | DIV_U71), | ||
2893 | PERIPH_CLK("dam2", "tegra30-dam.2", NULL, 110, 0x3e0, 48000000, mux_plla_pllc_pllp_clkm, MUX | DIV_U71), | ||
2894 | PERIPH_CLK("hda", "tegra30-hda", "hda", 125, 0x428, 108000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), | ||
2895 | PERIPH_CLK("hda2codec_2x", "tegra30-hda", "hda2codec", 111, 0x3e4, 48000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), | ||
2896 | PERIPH_CLK("hda2hdmi", "tegra30-hda", "hda2hdmi", 128, 0, 48000000, mux_clk_m, 0), | ||
2897 | PERIPH_CLK("sbc1", "spi_tegra.0", NULL, 41, 0x134, 160000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB), | ||
2898 | PERIPH_CLK("sbc2", "spi_tegra.1", NULL, 44, 0x118, 160000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB), | ||
2899 | PERIPH_CLK("sbc3", "spi_tegra.2", NULL, 46, 0x11c, 160000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB), | ||
2900 | PERIPH_CLK("sbc4", "spi_tegra.3", NULL, 68, 0x1b4, 160000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB), | ||
2901 | PERIPH_CLK("sbc5", "spi_tegra.4", NULL, 104, 0x3c8, 160000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB), | ||
2902 | PERIPH_CLK("sbc6", "spi_tegra.5", NULL, 105, 0x3cc, 160000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB), | ||
2903 | PERIPH_CLK("sata_oob", "tegra_sata_oob", NULL, 123, 0x420, 216000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), | ||
2904 | PERIPH_CLK("sata", "tegra_sata", NULL, 124, 0x424, 216000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), | ||
2905 | PERIPH_CLK("sata_cold", "tegra_sata_cold", NULL, 129, 0, 48000000, mux_clk_m, 0), | ||
2906 | PERIPH_CLK_EX("ndflash", "tegra_nand", NULL, 13, 0x160, 240000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71, &tegra_nand_clk_ops), | ||
2907 | PERIPH_CLK("ndspeed", "tegra_nand_speed", NULL, 80, 0x3f8, 240000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), | ||
2908 | PERIPH_CLK("vfir", "vfir", NULL, 7, 0x168, 72000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB), | ||
2909 | PERIPH_CLK("sdmmc1", "sdhci-tegra.0", NULL, 14, 0x150, 208000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), /* scales with voltage */ | ||
2910 | PERIPH_CLK("sdmmc2", "sdhci-tegra.1", NULL, 9, 0x154, 104000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), /* scales with voltage */ | ||
2911 | PERIPH_CLK("sdmmc3", "sdhci-tegra.2", NULL, 69, 0x1bc, 208000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), /* scales with voltage */ | ||
2912 | PERIPH_CLK("sdmmc4", "sdhci-tegra.3", NULL, 15, 0x164, 104000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), /* scales with voltage */ | ||
2913 | PERIPH_CLK("vcp", "tegra-avp", "vcp", 29, 0, 250000000, mux_clk_m, 0), | ||
2914 | PERIPH_CLK("bsea", "tegra-avp", "bsea", 62, 0, 250000000, mux_clk_m, 0), | ||
2915 | PERIPH_CLK("bsev", "tegra-aes", "bsev", 63, 0, 250000000, mux_clk_m, 0), | ||
2916 | PERIPH_CLK("vde", "vde", NULL, 61, 0x1c8, 520000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_INT), | ||
2917 | PERIPH_CLK("csite", "csite", NULL, 73, 0x1d4, 144000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), /* max rate ??? */ | ||
2918 | PERIPH_CLK("la", "la", NULL, 76, 0x1f8, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), | ||
2919 | PERIPH_CLK("owr", "tegra_w1", NULL, 71, 0x1cc, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB), | ||
2920 | PERIPH_CLK("nor", "nor", NULL, 42, 0x1d0, 127000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71), /* requires min voltage */ | ||
2921 | PERIPH_CLK("mipi", "mipi", NULL, 50, 0x174, 60000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB), /* scales with voltage */ | ||
2922 | PERIPH_CLK("i2c1", "tegra-i2c.0", NULL, 12, 0x124, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB), | ||
2923 | PERIPH_CLK("i2c2", "tegra-i2c.1", NULL, 54, 0x198, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB), | ||
2924 | PERIPH_CLK("i2c3", "tegra-i2c.2", NULL, 67, 0x1b8, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB), | ||
2925 | PERIPH_CLK("i2c4", "tegra-i2c.3", NULL, 103, 0x3c4, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB), | ||
2926 | PERIPH_CLK("i2c5", "tegra-i2c.4", NULL, 47, 0x128, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB), | ||
2927 | PERIPH_CLK("uarta", "tegra-uart.0", NULL, 6, 0x178, 800000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB), | ||
2928 | PERIPH_CLK("uartb", "tegra-uart.1", NULL, 7, 0x17c, 800000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB), | ||
2929 | PERIPH_CLK("uartc", "tegra-uart.2", NULL, 55, 0x1a0, 800000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB), | ||
2930 | PERIPH_CLK("uartd", "tegra-uart.3", NULL, 65, 0x1c0, 800000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB), | ||
2931 | PERIPH_CLK("uarte", "tegra-uart.4", NULL, 66, 0x1c4, 800000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB), | ||
2932 | PERIPH_CLK_EX("vi", "tegra_camera", "vi", 20, 0x148, 425000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71 | DIV_U71_INT, &tegra_vi_clk_ops), | ||
2933 | PERIPH_CLK("3d", "3d", NULL, 24, 0x158, 520000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71 | DIV_U71_INT | DIV_U71_IDLE | PERIPH_MANUAL_RESET), | ||
2934 | PERIPH_CLK("3d2", "3d2", NULL, 98, 0x3b0, 520000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71 | DIV_U71_INT | DIV_U71_IDLE | PERIPH_MANUAL_RESET), | ||
2935 | PERIPH_CLK("2d", "2d", NULL, 21, 0x15c, 520000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71 | DIV_U71_INT | DIV_U71_IDLE), | ||
2936 | PERIPH_CLK("vi_sensor", "tegra_camera", "vi_sensor", 20, 0x1a8, 150000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71 | PERIPH_NO_RESET), | ||
2937 | PERIPH_CLK("epp", "epp", NULL, 19, 0x16c, 520000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71 | DIV_U71_INT), | ||
2938 | PERIPH_CLK("mpe", "mpe", NULL, 60, 0x170, 520000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71 | DIV_U71_INT), | ||
2939 | PERIPH_CLK("host1x", "host1x", NULL, 28, 0x180, 260000000, mux_pllm_pllc_pllp_plla, MUX | DIV_U71 | DIV_U71_INT), | ||
2940 | PERIPH_CLK("cve", "cve", NULL, 49, 0x140, 250000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71), /* requires min voltage */ | ||
2941 | PERIPH_CLK("tvo", "tvo", NULL, 49, 0x188, 250000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71), /* requires min voltage */ | ||
2942 | PERIPH_CLK_EX("dtv", "dtv", NULL, 79, 0x1dc, 250000000, mux_clk_m, 0, &tegra_dtv_clk_ops), | ||
2943 | PERIPH_CLK("hdmi", "hdmi", NULL, 51, 0x18c, 148500000, mux_pllp_pllm_plld_plla_pllc_plld2_clkm, MUX | MUX8 | DIV_U71), | ||
2944 | PERIPH_CLK("tvdac", "tvdac", NULL, 53, 0x194, 220000000, mux_pllp_plld_pllc_clkm, MUX | DIV_U71), /* requires min voltage */ | ||
2945 | PERIPH_CLK("disp1", "tegradc.0", NULL, 27, 0x138, 600000000, mux_pllp_pllm_plld_plla_pllc_plld2_clkm, MUX | MUX8), | ||
2946 | PERIPH_CLK("disp2", "tegradc.1", NULL, 26, 0x13c, 600000000, mux_pllp_pllm_plld_plla_pllc_plld2_clkm, MUX | MUX8), | ||
2947 | PERIPH_CLK("usbd", "fsl-tegra-udc", NULL, 22, 0, 480000000, mux_clk_m, 0), /* requires min voltage */ | ||
2948 | PERIPH_CLK("usb2", "tegra-ehci.1", NULL, 58, 0, 480000000, mux_clk_m, 0), /* requires min voltage */ | ||
2949 | PERIPH_CLK("usb3", "tegra-ehci.2", NULL, 59, 0, 480000000, mux_clk_m, 0), /* requires min voltage */ | ||
2950 | PERIPH_CLK("dsia", "tegradc.0", "dsia", 48, 0, 500000000, mux_plld_out0, 0), | ||
2951 | PERIPH_CLK_EX("dsib", "tegradc.1", "dsib", 82, 0xd0, 500000000, mux_plld_out0_plld2_out0, MUX | PLLD, &tegra_dsib_clk_ops), | ||
2952 | PERIPH_CLK("csi", "tegra_camera", "csi", 52, 0, 102000000, mux_pllp_out3, 0), | ||
2953 | PERIPH_CLK("isp", "tegra_camera", "isp", 23, 0, 150000000, mux_clk_m, 0), /* same frequency as VI */ | ||
2954 | PERIPH_CLK("csus", "tegra_camera", "csus", 92, 0, 150000000, mux_clk_m, PERIPH_NO_RESET), | ||
2955 | |||
2956 | PERIPH_CLK("tsensor", "tegra-tsensor", NULL, 100, 0x3b8, 216000000, mux_pllp_pllc_clkm_clk32, MUX | DIV_U71), | ||
2957 | PERIPH_CLK("actmon", "actmon", NULL, 119, 0x3e8, 216000000, mux_pllp_pllc_clk32_clkm, MUX | DIV_U71), | ||
2958 | PERIPH_CLK("extern1", "extern1", NULL, 120, 0x3ec, 216000000, mux_plla_clk32_pllp_clkm_plle, MUX | MUX8 | DIV_U71), | ||
2959 | PERIPH_CLK("extern2", "extern2", NULL, 121, 0x3f0, 216000000, mux_plla_clk32_pllp_clkm_plle, MUX | MUX8 | DIV_U71), | ||
2960 | PERIPH_CLK("extern3", "extern3", NULL, 122, 0x3f4, 216000000, mux_plla_clk32_pllp_clkm_plle, MUX | MUX8 | DIV_U71), | ||
2961 | PERIPH_CLK("i2cslow", "i2cslow", NULL, 81, 0x3fc, 26000000, mux_pllp_pllc_clk32_clkm, MUX | DIV_U71 | PERIPH_ON_APB), | ||
2962 | PERIPH_CLK("pcie", "tegra-pcie", "pcie", 70, 0, 250000000, mux_clk_m, 0), | ||
2963 | PERIPH_CLK("afi", "tegra-pcie", "afi", 72, 0, 250000000, mux_clk_m, 0), | ||
2964 | PERIPH_CLK("se", "se", NULL, 127, 0x42c, 520000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_INT), | ||
2965 | }; | ||
2966 | |||
2967 | #define CLK_DUPLICATE(_name, _dev, _con) \ | ||
2968 | { \ | ||
2969 | .name = _name, \ | ||
2970 | .lookup = { \ | ||
2971 | .dev_id = _dev, \ | ||
2972 | .con_id = _con, \ | ||
2973 | }, \ | ||
2974 | } | ||
2975 | |||
2976 | /* Some clocks may be used by different drivers depending on the board | ||
2977 | * configuration. List those here to register them twice in the clock lookup | ||
2978 | * table under two names. | ||
2979 | */ | ||
2980 | struct clk_duplicate tegra_clk_duplicates[] = { | ||
2981 | CLK_DUPLICATE("uarta", "serial8250.0", NULL), | ||
2982 | CLK_DUPLICATE("uartb", "serial8250.1", NULL), | ||
2983 | CLK_DUPLICATE("uartc", "serial8250.2", NULL), | ||
2984 | CLK_DUPLICATE("uartd", "serial8250.3", NULL), | ||
2985 | CLK_DUPLICATE("uarte", "serial8250.4", NULL), | ||
2986 | CLK_DUPLICATE("usbd", "utmip-pad", NULL), | ||
2987 | CLK_DUPLICATE("usbd", "tegra-ehci.0", NULL), | ||
2988 | CLK_DUPLICATE("usbd", "tegra-otg", NULL), | ||
2989 | CLK_DUPLICATE("hdmi", "tegradc.0", "hdmi"), | ||
2990 | CLK_DUPLICATE("hdmi", "tegradc.1", "hdmi"), | ||
2991 | CLK_DUPLICATE("dsib", "tegradc.0", "dsib"), | ||
2992 | CLK_DUPLICATE("dsia", "tegradc.1", "dsia"), | ||
2993 | CLK_DUPLICATE("bsev", "tegra-avp", "bsev"), | ||
2994 | CLK_DUPLICATE("bsev", "nvavp", "bsev"), | ||
2995 | CLK_DUPLICATE("vde", "tegra-aes", "vde"), | ||
2996 | CLK_DUPLICATE("bsea", "tegra-aes", "bsea"), | ||
2997 | CLK_DUPLICATE("bsea", "nvavp", "bsea"), | ||
2998 | CLK_DUPLICATE("cml1", "tegra_sata_cml", NULL), | ||
2999 | CLK_DUPLICATE("cml0", "tegra_pcie", "cml"), | ||
3000 | CLK_DUPLICATE("pciex", "tegra_pcie", "pciex"), | ||
3001 | CLK_DUPLICATE("i2c1", "tegra-i2c-slave.0", NULL), | ||
3002 | CLK_DUPLICATE("i2c2", "tegra-i2c-slave.1", NULL), | ||
3003 | CLK_DUPLICATE("i2c3", "tegra-i2c-slave.2", NULL), | ||
3004 | CLK_DUPLICATE("i2c4", "tegra-i2c-slave.3", NULL), | ||
3005 | CLK_DUPLICATE("i2c5", "tegra-i2c-slave.4", NULL), | ||
3006 | CLK_DUPLICATE("sbc1", "spi_slave_tegra.0", NULL), | ||
3007 | CLK_DUPLICATE("sbc2", "spi_slave_tegra.1", NULL), | ||
3008 | CLK_DUPLICATE("sbc3", "spi_slave_tegra.2", NULL), | ||
3009 | CLK_DUPLICATE("sbc4", "spi_slave_tegra.3", NULL), | ||
3010 | CLK_DUPLICATE("sbc5", "spi_slave_tegra.4", NULL), | ||
3011 | CLK_DUPLICATE("sbc6", "spi_slave_tegra.5", NULL), | ||
3012 | CLK_DUPLICATE("twd", "smp_twd", NULL), | ||
3013 | CLK_DUPLICATE("vcp", "nvavp", "vcp"), | ||
3014 | CLK_DUPLICATE("i2s0", NULL, "i2s0"), | ||
3015 | CLK_DUPLICATE("i2s1", NULL, "i2s1"), | ||
3016 | CLK_DUPLICATE("i2s2", NULL, "i2s2"), | ||
3017 | CLK_DUPLICATE("i2s3", NULL, "i2s3"), | ||
3018 | CLK_DUPLICATE("i2s4", NULL, "i2s4"), | ||
3019 | CLK_DUPLICATE("dam0", NULL, "dam0"), | ||
3020 | CLK_DUPLICATE("dam1", NULL, "dam1"), | ||
3021 | CLK_DUPLICATE("dam2", NULL, "dam2"), | ||
3022 | CLK_DUPLICATE("spdif_in", NULL, "spdif_in"), | ||
3023 | }; | ||
3024 | |||
3025 | struct clk *tegra_ptr_clks[] = { | ||
3026 | &tegra_clk_32k, | ||
3027 | &tegra_clk_m, | ||
3028 | &tegra_clk_m_div2, | ||
3029 | &tegra_clk_m_div4, | ||
3030 | &tegra_pll_ref, | ||
3031 | &tegra_pll_m, | ||
3032 | &tegra_pll_m_out1, | ||
3033 | &tegra_pll_c, | ||
3034 | &tegra_pll_c_out1, | ||
3035 | &tegra_pll_p, | ||
3036 | &tegra_pll_p_out1, | ||
3037 | &tegra_pll_p_out2, | ||
3038 | &tegra_pll_p_out3, | ||
3039 | &tegra_pll_p_out4, | ||
3040 | &tegra_pll_a, | ||
3041 | &tegra_pll_a_out0, | ||
3042 | &tegra_pll_d, | ||
3043 | &tegra_pll_d_out0, | ||
3044 | &tegra_pll_d2, | ||
3045 | &tegra_pll_d2_out0, | ||
3046 | &tegra_pll_u, | ||
3047 | &tegra_pll_x, | ||
3048 | &tegra_pll_x_out0, | ||
3049 | &tegra_pll_e, | ||
3050 | &tegra_clk_cclk_g, | ||
3051 | &tegra_cml0_clk, | ||
3052 | &tegra_cml1_clk, | ||
3053 | &tegra_pciex_clk, | ||
3054 | &tegra_clk_sclk, | ||
3055 | &tegra_clk_blink, | ||
3056 | &tegra30_clk_twd, | ||
3057 | }; | ||
3058 | |||
3059 | |||
3060 | static void tegra30_init_one_clock(struct clk *c) | ||
3061 | { | ||
3062 | clk_init(c); | ||
3063 | INIT_LIST_HEAD(&c->shared_bus_list); | ||
3064 | if (!c->lookup.dev_id && !c->lookup.con_id) | ||
3065 | c->lookup.con_id = c->name; | ||
3066 | c->lookup.clk = c; | ||
3067 | clkdev_add(&c->lookup); | ||
3068 | } | ||
3069 | |||
3070 | void __init tegra30_init_clocks(void) | ||
3071 | { | ||
3072 | int i; | ||
3073 | struct clk *c; | ||
3074 | |||
3075 | for (i = 0; i < ARRAY_SIZE(tegra_ptr_clks); i++) | ||
3076 | tegra30_init_one_clock(tegra_ptr_clks[i]); | ||
3077 | |||
3078 | for (i = 0; i < ARRAY_SIZE(tegra_list_clks); i++) | ||
3079 | tegra30_init_one_clock(&tegra_list_clks[i]); | ||
3080 | |||
3081 | for (i = 0; i < ARRAY_SIZE(tegra_clk_duplicates); i++) { | ||
3082 | c = tegra_get_clock_by_name(tegra_clk_duplicates[i].name); | ||
3083 | if (!c) { | ||
3084 | pr_err("%s: Unknown duplicate clock %s\n", __func__, | ||
3085 | tegra_clk_duplicates[i].name); | ||
3086 | continue; | ||
3087 | } | ||
3088 | |||
3089 | tegra_clk_duplicates[i].lookup.clk = c; | ||
3090 | clkdev_add(&tegra_clk_duplicates[i].lookup); | ||
3091 | } | ||
3092 | |||
3093 | for (i = 0; i < ARRAY_SIZE(tegra_sync_source_list); i++) | ||
3094 | tegra30_init_one_clock(&tegra_sync_source_list[i]); | ||
3095 | for (i = 0; i < ARRAY_SIZE(tegra_clk_audio_list); i++) | ||
3096 | tegra30_init_one_clock(&tegra_clk_audio_list[i]); | ||
3097 | for (i = 0; i < ARRAY_SIZE(tegra_clk_audio_2x_list); i++) | ||
3098 | tegra30_init_one_clock(&tegra_clk_audio_2x_list[i]); | ||
3099 | |||
3100 | init_clk_out_mux(); | ||
3101 | for (i = 0; i < ARRAY_SIZE(tegra_clk_out_list); i++) | ||
3102 | tegra30_init_one_clock(&tegra_clk_out_list[i]); | ||
3103 | |||
3104 | } | ||