clk: tegra: Add Tegra OSC to clock lookup
authorSowjanya Komatineni <skomatineni@nvidia.com>
Tue, 14 Jan 2020 07:24:08 +0000 (23:24 -0800)
committerThierry Reding <treding@nvidia.com>
Thu, 12 Mar 2020 10:33:29 +0000 (11:33 +0100)
OSC is one of the parent for Tegra PMC clocks clk_out_1, clk_out_2,
and clk_out_3.

This patch adds Tegra OSC to clock lookup.

Tested-by: Dmitry Osipenko <digetx@gmail.com>
Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/clk/tegra/clk-id.h
drivers/clk/tegra/clk-tegra-fixed.c
drivers/clk/tegra/clk-tegra114.c
drivers/clk/tegra/clk-tegra124.c
drivers/clk/tegra/clk-tegra210.c
drivers/clk/tegra/clk-tegra30.c

index 17d8b25..17c13d1 100644 (file)
@@ -46,6 +46,7 @@ enum clk_id {
        tegra_clk_clk_m,
        tegra_clk_clk_m_div2,
        tegra_clk_clk_m_div4,
+       tegra_clk_osc,
        tegra_clk_osc_div2,
        tegra_clk_osc_div4,
        tegra_clk_clk_out_1,
index 9901063..0dc2d5f 100644 (file)
@@ -46,7 +46,12 @@ int __init tegra_osc_clk_init(void __iomem *clk_base, struct tegra_clk *clks,
                return -EINVAL;
        }
 
+       dt_clk = tegra_lookup_dt_id(tegra_clk_osc, clks);
+       if (!dt_clk)
+               return 0;
+
        osc = clk_register_fixed_rate(NULL, "osc", NULL, 0, *osc_freq);
+       *dt_clk = osc;
 
        /* osc_div2 */
        dt_clk = tegra_lookup_dt_id(tegra_clk_osc_div2, clks);
index d44cb8d..e3c68ec 100644 (file)
@@ -737,6 +737,7 @@ static struct tegra_clk tegra114_clks[tegra_clk_max] __initdata = {
        [tegra_clk_clk_m] = { .dt_id = TEGRA114_CLK_CLK_M, .present = true },
        [tegra_clk_clk_m_div2] = { .dt_id = TEGRA114_CLK_CLK_M_DIV2, .present = true },
        [tegra_clk_clk_m_div4] = { .dt_id = TEGRA114_CLK_CLK_M_DIV4, .present = true },
+       [tegra_clk_osc] = { .dt_id = TEGRA114_CLK_OSC, .present = true },
        [tegra_clk_osc_div2] = { .dt_id = TEGRA114_CLK_OSC_DIV2, .present = true },
        [tegra_clk_osc_div4] = { .dt_id = TEGRA114_CLK_OSC_DIV4, .present = true },
        [tegra_clk_pll_ref] = { .dt_id = TEGRA114_CLK_PLL_REF, .present = true },
@@ -819,6 +820,7 @@ static struct tegra_devclk devclks[] __initdata = {
        { .con_id = "clk_32k", .dt_id = TEGRA114_CLK_CLK_32K },
        { .con_id = "clk_m_div2", .dt_id = TEGRA114_CLK_CLK_M_DIV2 },
        { .con_id = "clk_m_div4", .dt_id = TEGRA114_CLK_CLK_M_DIV4 },
+       { .con_id = "osc", .dt_id = TEGRA114_CLK_OSC },
        { .con_id = "osc_div2", .dt_id = TEGRA114_CLK_OSC_DIV2 },
        { .con_id = "osc_div4", .dt_id = TEGRA114_CLK_OSC_DIV4 },
        { .con_id = "pll_c", .dt_id = TEGRA114_CLK_PLL_C },
index 32f3dd1..ef0f928 100644 (file)
@@ -862,6 +862,7 @@ static struct tegra_clk tegra124_clks[tegra_clk_max] __initdata = {
        [tegra_clk_clk_m] = { .dt_id = TEGRA124_CLK_CLK_M, .present = true },
        [tegra_clk_clk_m_div2] = { .dt_id = TEGRA124_CLK_CLK_M_DIV2, .present = true },
        [tegra_clk_clk_m_div4] = { .dt_id = TEGRA124_CLK_CLK_M_DIV4, .present = true },
+       [tegra_clk_osc] = { .dt_id = TEGRA124_CLK_OSC, .present = true },
        [tegra_clk_osc_div2] = { .dt_id = TEGRA124_CLK_OSC_DIV2, .present = true },
        [tegra_clk_osc_div4] = { .dt_id = TEGRA124_CLK_OSC_DIV4, .present = true },
        [tegra_clk_pll_ref] = { .dt_id = TEGRA124_CLK_PLL_REF, .present = true },
@@ -945,6 +946,7 @@ static struct tegra_devclk devclks[] __initdata = {
        { .con_id = "clk_32k", .dt_id = TEGRA124_CLK_CLK_32K },
        { .con_id = "clk_m_div2", .dt_id = TEGRA124_CLK_CLK_M_DIV2 },
        { .con_id = "clk_m_div4", .dt_id = TEGRA124_CLK_CLK_M_DIV4 },
+       { .con_id = "osc", .dt_id = TEGRA124_CLK_OSC },
        { .con_id = "osc_div2", .dt_id = TEGRA124_CLK_OSC_DIV2 },
        { .con_id = "osc_div4", .dt_id = TEGRA124_CLK_OSC_DIV4 },
        { .con_id = "pll_c", .dt_id = TEGRA124_CLK_PLL_C },
index 899d8ca..958f5f6 100644 (file)
@@ -2373,6 +2373,7 @@ static struct tegra_clk tegra210_clks[tegra_clk_max] __initdata = {
        [tegra_clk_clk_m] = { .dt_id = TEGRA210_CLK_CLK_M, .present = true },
        [tegra_clk_clk_m_div2] = { .dt_id = TEGRA210_CLK_CLK_M_DIV2, .present = true },
        [tegra_clk_clk_m_div4] = { .dt_id = TEGRA210_CLK_CLK_M_DIV4, .present = true },
+       [tegra_clk_osc] = { .dt_id = TEGRA210_CLK_OSC, .present = true },
        [tegra_clk_osc_div2] = { .dt_id = TEGRA210_CLK_OSC_DIV2, .present = true },
        [tegra_clk_osc_div4] = { .dt_id = TEGRA210_CLK_OSC_DIV4, .present = true },
        [tegra_clk_pll_ref] = { .dt_id = TEGRA210_CLK_PLL_REF, .present = true },
@@ -2501,6 +2502,7 @@ static struct tegra_devclk devclks[] __initdata = {
        { .con_id = "clk_32k", .dt_id = TEGRA210_CLK_CLK_32K },
        { .con_id = "clk_m_div2", .dt_id = TEGRA210_CLK_CLK_M_DIV2 },
        { .con_id = "clk_m_div4", .dt_id = TEGRA210_CLK_CLK_M_DIV4 },
+       { .con_id = "osc", .dt_id = TEGRA210_CLK_OSC },
        { .con_id = "osc_div2", .dt_id = TEGRA210_CLK_OSC_DIV2 },
        { .con_id = "osc_div4", .dt_id = TEGRA210_CLK_OSC_DIV4 },
        { .con_id = "pll_c", .dt_id = TEGRA210_CLK_PLL_C },
index 7e62d9a..0ba9958 100644 (file)
@@ -583,6 +583,7 @@ static struct tegra_devclk devclks[] __initdata = {
        { .con_id = "clk_32k", .dt_id = TEGRA30_CLK_CLK_32K },
        { .con_id = "clk_m_div2", .dt_id = TEGRA30_CLK_CLK_M_DIV2 },
        { .con_id = "clk_m_div4", .dt_id = TEGRA30_CLK_CLK_M_DIV4 },
+       { .con_id = "osc", .dt_id = TEGRA30_CLK_OSC },
        { .con_id = "osc_div2", .dt_id = TEGRA30_CLK_OSC_DIV2 },
        { .con_id = "osc_div4", .dt_id = TEGRA30_CLK_OSC_DIV4 },
        { .con_id = "cml0", .dt_id = TEGRA30_CLK_CML0 },
@@ -687,6 +688,7 @@ static struct tegra_clk tegra30_clks[tegra_clk_max] __initdata = {
        [tegra_clk_clk_m] = { .dt_id = TEGRA30_CLK_CLK_M, .present = true },
        [tegra_clk_clk_m_div2] = { .dt_id = TEGRA30_CLK_CLK_M_DIV2, .present = true },
        [tegra_clk_clk_m_div4] = { .dt_id = TEGRA30_CLK_CLK_M_DIV4, .present = true },
+       [tegra_clk_osc] = { .dt_id = TEGRA30_CLK_OSC, .present = true },
        [tegra_clk_osc_div2] = { .dt_id = TEGRA30_CLK_OSC_DIV2, .present = true },
        [tegra_clk_osc_div4] = { .dt_id = TEGRA30_CLK_OSC_DIV4, .present = true },
        [tegra_clk_pll_ref] = { .dt_id = TEGRA30_CLK_PLL_REF, .present = true },