aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-tegra
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2011-02-12 18:52:56 -0500
committerColin Cross <ccross@android.com>2011-02-21 03:10:10 -0500
commit3ec349fbf1e88e84d4dffc54b6cb32129a32b7b0 (patch)
tree53fb620a736e87c4eea09986ec3eb716a87650a5 /arch/arm/mach-tegra
parent41cfe3676d0f4f07ba79d4f64a21450ab02d22cd (diff)
ARM: tegra: clock: Rearrange static clock tables
Make the static clocks look more like the array of clocks so they can all be initalized with the same helper function. Acked-by: Olof Johansson <olof@lixom.net> Signed-off-by: Colin Cross <ccross@android.com>
Diffstat (limited to 'arch/arm/mach-tegra')
-rw-r--r--arch/arm/mach-tegra/tegra2_clocks.c106
1 files changed, 51 insertions, 55 deletions
diff --git a/arch/arm/mach-tegra/tegra2_clocks.c b/arch/arm/mach-tegra/tegra2_clocks.c
index d0b759023582..a36bda93112a 100644
--- a/arch/arm/mach-tegra/tegra2_clocks.c
+++ b/arch/arm/mach-tegra/tegra2_clocks.c
@@ -1775,7 +1775,7 @@ static struct clk_mux_sel mux_pclk[] = {
1775 .max_rate = _max, \ 1775 .max_rate = _max, \
1776 } 1776 }
1777 1777
1778struct clk tegra_periph_clks[] = { 1778struct clk tegra_list_clks[] = {
1779 PERIPH_CLK("apbdma", "tegra-dma", NULL, 34, 0, 108000000, mux_pclk, 0), 1779 PERIPH_CLK("apbdma", "tegra-dma", NULL, 34, 0, 108000000, mux_pclk, 0),
1780 PERIPH_CLK("rtc", "rtc-tegra", NULL, 4, 0, 32768, mux_clk_32k, PERIPH_NO_RESET), 1780 PERIPH_CLK("rtc", "rtc-tegra", NULL, 4, 0, 32768, mux_clk_32k, PERIPH_NO_RESET),
1781 PERIPH_CLK("timer", "timer", NULL, 5, 0, 26000000, mux_clk_m, 0), 1781 PERIPH_CLK("timer", "timer", NULL, 5, 0, 26000000, mux_clk_m, 0),
@@ -1885,71 +1885,67 @@ struct clk_duplicate tegra_clk_duplicates[] = {
1885 .clk = ck, \ 1885 .clk = ck, \
1886 } 1886 }
1887 1887
1888struct clk_lookup tegra_clk_lookups[] = { 1888struct clk *tegra_ptr_clks[] = {
1889 /* external root sources */ 1889 &tegra_clk_32k,
1890 CLK(NULL, "32k_clk", &tegra_clk_32k), 1890 &tegra_pll_s,
1891 CLK(NULL, "pll_s", &tegra_pll_s), 1891 &tegra_clk_m,
1892 CLK(NULL, "clk_m", &tegra_clk_m), 1892 &tegra_pll_m,
1893 CLK(NULL, "pll_m", &tegra_pll_m), 1893 &tegra_pll_m_out1,
1894 CLK(NULL, "pll_m_out1", &tegra_pll_m_out1), 1894 &tegra_pll_c,
1895 CLK(NULL, "pll_c", &tegra_pll_c), 1895 &tegra_pll_c_out1,
1896 CLK(NULL, "pll_c_out1", &tegra_pll_c_out1), 1896 &tegra_pll_p,
1897 CLK(NULL, "pll_p", &tegra_pll_p), 1897 &tegra_pll_p_out1,
1898 CLK(NULL, "pll_p_out1", &tegra_pll_p_out1), 1898 &tegra_pll_p_out2,
1899 CLK(NULL, "pll_p_out2", &tegra_pll_p_out2), 1899 &tegra_pll_p_out3,
1900 CLK(NULL, "pll_p_out3", &tegra_pll_p_out3), 1900 &tegra_pll_p_out4,
1901 CLK(NULL, "pll_p_out4", &tegra_pll_p_out4), 1901 &tegra_pll_a,
1902 CLK(NULL, "pll_a", &tegra_pll_a), 1902 &tegra_pll_a_out0,
1903 CLK(NULL, "pll_a_out0", &tegra_pll_a_out0), 1903 &tegra_pll_d,
1904 CLK(NULL, "pll_d", &tegra_pll_d), 1904 &tegra_pll_d_out0,
1905 CLK(NULL, "pll_d_out0", &tegra_pll_d_out0), 1905 &tegra_pll_u,
1906 CLK(NULL, "pll_u", &tegra_pll_u), 1906 &tegra_pll_x,
1907 CLK(NULL, "pll_x", &tegra_pll_x), 1907 &tegra_pll_e,
1908 CLK(NULL, "pll_e", &tegra_pll_e), 1908 &tegra_clk_cclk,
1909 CLK(NULL, "cclk", &tegra_clk_cclk), 1909 &tegra_clk_sclk,
1910 CLK(NULL, "sclk", &tegra_clk_sclk), 1910 &tegra_clk_hclk,
1911 CLK(NULL, "hclk", &tegra_clk_hclk), 1911 &tegra_clk_pclk,
1912 CLK(NULL, "pclk", &tegra_clk_pclk), 1912 &tegra_clk_d,
1913 CLK(NULL, "clk_d", &tegra_clk_d), 1913 &tegra_dev1_clk,
1914 CLK(NULL, "clk_dev1", &tegra_dev1_clk), 1914 &tegra_dev2_clk,
1915 CLK(NULL, "clk_dev2", &tegra_dev2_clk), 1915 &tegra_clk_virtual_cpu,
1916 CLK(NULL, "cpu", &tegra_clk_virtual_cpu), 1916 &tegra_clk_blink,
1917 CLK(NULL, "blink", &tegra_clk_blink), 1917};
1918}; 1918
1919static void tegra2_init_one_clock(struct clk *c)
1920{
1921 clk_init(c);
1922 if (!c->lookup.dev_id && !c->lookup.con_id)
1923 c->lookup.con_id = c->name;
1924 c->lookup.clk = c;
1925 clkdev_add(&c->lookup);
1926}
1919 1927
1920void __init tegra2_init_clocks(void) 1928void __init tegra2_init_clocks(void)
1921{ 1929{
1922 int i; 1930 int i;
1923 struct clk_lookup *cl;
1924 struct clk *c; 1931 struct clk *c;
1925 struct clk_duplicate *cd;
1926
1927 for (i = 0; i < ARRAY_SIZE(tegra_clk_lookups); i++) {
1928 cl = &tegra_clk_lookups[i];
1929 clk_init(cl->clk);
1930 clkdev_add(cl);
1931 }
1932 1932
1933 for (i = 0; i < ARRAY_SIZE(tegra_periph_clks); i++) { 1933 for (i = 0; i < ARRAY_SIZE(tegra_ptr_clks); i++)
1934 c = &tegra_periph_clks[i]; 1934 tegra2_init_one_clock(tegra_ptr_clks[i]);
1935 cl = &c->lookup;
1936 cl->clk = c;
1937 1935
1938 clk_init(cl->clk); 1936 for (i = 0; i < ARRAY_SIZE(tegra_list_clks); i++)
1939 clkdev_add(cl); 1937 tegra2_init_one_clock(&tegra_list_clks[i]);
1940 }
1941 1938
1942 for (i = 0; i < ARRAY_SIZE(tegra_clk_duplicates); i++) { 1939 for (i = 0; i < ARRAY_SIZE(tegra_clk_duplicates); i++) {
1943 cd = &tegra_clk_duplicates[i]; 1940 c = tegra_get_clock_by_name(tegra_clk_duplicates[i].name);
1944 c = tegra_get_clock_by_name(cd->name); 1941 if (!c) {
1945 if (c) {
1946 cl = &cd->lookup;
1947 cl->clk = c;
1948 clkdev_add(cl);
1949 } else {
1950 pr_err("%s: Unknown duplicate clock %s\n", __func__, 1942 pr_err("%s: Unknown duplicate clock %s\n", __func__,
1951 cd->name); 1943 tegra_clk_duplicates[i].name);
1944 continue;
1952 } 1945 }
1946
1947 tegra_clk_duplicates[i].lookup.clk = c;
1948 clkdev_add(&tegra_clk_duplicates[i].lookup);
1953 } 1949 }
1954 1950
1955 init_audio_sync_clock_mux(); 1951 init_audio_sync_clock_mux();