clk: tegra: Fix maximum audio sync clock for Tegra124/210
Subsystems (3)
Jon Hunter
maintainerPATCH RESEND 1/2 clk: tegra: Fix maximum audio sync clock for Tegra124/210
The maximum frequency supported for I2S on Tegra124 and Tegra210 is 24.576MHz (as stated in the Tegra TK1 data sheet for Tegra124 and the Jetson TX1 module data sheet for Tegra210). However, the maximum I2S frequency is limited to 24MHz because that is the maximum frequency of the audio sync clock. Increase the maximum audio sync clock frequency to 24.576MHz for Tegra124 and Tegra210 in order to support 24.576MHz for I2S.
Update the tegra_clk_register_sync_source() function so that it does not set the initial rate for the sync clocks and use the clock init tables to set the initial rate instead.
---
Resending with Thierry's ACK and CC'ing clock maintainers.
drivers/clk/tegra/clk-audio-sync.c | 3 +-- drivers/clk/tegra/clk-tegra-audio.c | 7 ++----- drivers/clk/tegra/clk-tegra114.c | 9 ++++++++- drivers/clk/tegra/clk-tegra124.c | 9 ++++++++- drivers/clk/tegra/clk-tegra210.c | 9 ++++++++- drivers/clk/tegra/clk-tegra30.c | 9 ++++++++- drivers/clk/tegra/clk.h | 4 ++-- 7 files changed, 37 insertions(+), 13 deletions(-)
drivers/clk/tegra/clk-audio-sync.c +1 -2
@@ -55,7 +55,7 @@ const struct clk_ops tegra_clk_sync_source_ops = { };struct clk *tegra_clk_register_sync_source (const char *name, -unsigned long rate,unsigned long max_rate) +unsigned long max_rate) {struct tegra_clk_sync_source *sync;struct clk_init_data init;
@@ -67,7 +67,6 @@ struct clk *tegra_clk_register_sync_source(const char *name,return ERR_PTR (-ENOMEM ); } - sync->rate = rate; sync->max_rate = max_rate; init.ops = &tegra_clk_sync_source_ops;
drivers/clk/tegra/clk-tegra-audio.c +2 -5
@@ -49,8 +49,6 @@ struct tegra_sync_source_initdata {#define SYNC (_name) \ {\ .name = #_name,\ - .rate = 24000000,\ - .max_rate = 24000000,\ .clk_id = tegra_clk_ ## _name,\ }
@@ -176,7 +174,7 @@ static void __init tegra_audio_sync_clk_init(void __iomem *clk_base,void __init tegra_audio_clk_init (void __iomem *clk_base,void __iomem *pmc_base,struct tegra_clk *tegra_clks,struct tegra_audio_clk_info *audio_info, -unsigned int num_plls) +unsigned int num_plls,unsigned long sync_max_rate) {struct clk *clk;struct clk **dt_clk;
@@ -221,8 +219,7 @@ void __init tegra_audio_clk_init(void __iomem *clk_base,if (!dt_clk)continue ; - clk =tegra_clk_register_sync_source (data->name, - data->rate, data->max_rate); + clk =tegra_clk_register_sync_source (data->name, sync_max_rate); *dt_clk = clk; }
drivers/clk/tegra/clk-tegra114.c +8 -1
@@ -1190,6 +1190,13 @@ static struct tegra_clk_init_table init_table[] __initdata = { { TEGRA114_CLK_XUSB_FALCON_SRC, TEGRA114_CLK_PLL_P, 204000000, 0 }, { TEGRA114_CLK_XUSB_HOST_SRC, TEGRA114_CLK_PLL_P, 102000000, 0 }, { TEGRA114_CLK_VDE, TEGRA114_CLK_CLK_MAX, 600000000, 0 }, + { TEGRA114_CLK_SPDIF_IN_SYNC, TEGRA114_CLK_CLK_MAX, 24000000, 0 }, + { TEGRA114_CLK_I2S0_SYNC, TEGRA114_CLK_CLK_MAX, 24000000, 0 }, + { TEGRA114_CLK_I2S1_SYNC, TEGRA114_CLK_CLK_MAX, 24000000, 0 }, + { TEGRA114_CLK_I2S2_SYNC, TEGRA114_CLK_CLK_MAX, 24000000, 0 }, + { TEGRA114_CLK_I2S3_SYNC, TEGRA114_CLK_CLK_MAX, 24000000, 0 }, + { TEGRA114_CLK_I2S4_SYNC, TEGRA114_CLK_CLK_MAX, 24000000, 0 }, + { TEGRA114_CLK_VIMCLK_SYNC, TEGRA114_CLK_CLK_MAX, 24000000, 0 },/* must be the last entry */ { TEGRA114_CLK_CLK_MAX, TEGRA114_CLK_CLK_MAX, 0, 0 }, };
@@ -1362,7 +1369,7 @@ static void __init tegra114_clock_init(struct device_node *np)tegra114_periph_clk_init (clk_base, pmc_base);tegra_audio_clk_init (clk_base, pmc_base, tegra114_clks, tegra114_audio_plls, -ARRAY_SIZE (tegra114_audio_plls)); +ARRAY_SIZE (tegra114_audio_plls),24000000 );tegra_pmc_clk_init (pmc_base, tegra114_clks);tegra_super_clk_gen4_init (clk_base, pmc_base, tegra114_clks, &pll_x_params);
drivers/clk/tegra/clk-tegra124.c +8 -1
@@ -1291,6 +1291,13 @@ static struct tegra_clk_init_table common_init_table[] __initdata = { { TEGRA124_CLK_CSITE, TEGRA124_CLK_CLK_MAX, 0, 1 }, { TEGRA124_CLK_TSENSOR, TEGRA124_CLK_CLK_M, 400000, 0 }, { TEGRA124_CLK_VIC03, TEGRA124_CLK_PLL_C3, 0, 0 }, + { TEGRA124_CLK_SPDIF_IN_SYNC, TEGRA124_CLK_CLK_MAX, 24576000, 0 }, + { TEGRA124_CLK_I2S0_SYNC, TEGRA124_CLK_CLK_MAX, 24576000, 0 }, + { TEGRA124_CLK_I2S1_SYNC, TEGRA124_CLK_CLK_MAX, 24576000, 0 }, + { TEGRA124_CLK_I2S2_SYNC, TEGRA124_CLK_CLK_MAX, 24576000, 0 }, + { TEGRA124_CLK_I2S3_SYNC, TEGRA124_CLK_CLK_MAX, 24576000, 0 }, + { TEGRA124_CLK_I2S4_SYNC, TEGRA124_CLK_CLK_MAX, 24576000, 0 }, + { TEGRA124_CLK_VIMCLK_SYNC, TEGRA124_CLK_CLK_MAX, 24576000, 0 },/* must be the last entry */ { TEGRA124_CLK_CLK_MAX, TEGRA124_CLK_CLK_MAX, 0, 0 }, };
@@ -1455,7 +1462,7 @@ static void __init tegra124_132_clock_init_pre(struct device_node *np)tegra124_periph_clk_init (clk_base, pmc_base);tegra_audio_clk_init (clk_base, pmc_base, tegra124_clks, tegra124_audio_plls, -ARRAY_SIZE (tegra124_audio_plls)); +ARRAY_SIZE (tegra124_audio_plls),24576000 );tegra_pmc_clk_init (pmc_base, tegra124_clks);/* For Tegra124 & Tegra132, PLLD is the only source for DSIA & DSIB */
drivers/clk/tegra/clk-tegra210.c +8 -1
@@ -3370,6 +3370,13 @@ static struct tegra_clk_init_table init_table[] __initdata = { { TEGRA210_CLK_CCLK_G, TEGRA210_CLK_CLK_MAX, 0, 1 }, { TEGRA210_CLK_PLL_U_OUT1, TEGRA210_CLK_CLK_MAX, 48000000, 1 }, { TEGRA210_CLK_PLL_U_OUT2, TEGRA210_CLK_CLK_MAX, 60000000, 1 }, + { TEGRA210_CLK_SPDIF_IN_SYNC, TEGRA210_CLK_CLK_MAX, 24576000, 0 }, + { TEGRA210_CLK_I2S0_SYNC, TEGRA210_CLK_CLK_MAX, 24576000, 0 }, + { TEGRA210_CLK_I2S1_SYNC, TEGRA210_CLK_CLK_MAX, 24576000, 0 }, + { TEGRA210_CLK_I2S2_SYNC, TEGRA210_CLK_CLK_MAX, 24576000, 0 }, + { TEGRA210_CLK_I2S3_SYNC, TEGRA210_CLK_CLK_MAX, 24576000, 0 }, + { TEGRA210_CLK_I2S4_SYNC, TEGRA210_CLK_CLK_MAX, 24576000, 0 }, + { TEGRA210_CLK_VIMCLK_SYNC, TEGRA210_CLK_CLK_MAX, 24576000, 0 },/* This MUST be the last entry. */ { TEGRA210_CLK_CLK_MAX, TEGRA210_CLK_CLK_MAX, 0, 0 }, };
@@ -3563,7 +3570,7 @@ static void __init tegra210_clock_init(struct device_node *np)tegra210_periph_clk_init (clk_base, pmc_base);tegra_audio_clk_init (clk_base, pmc_base, tegra210_clks, tegra210_audio_plls, -ARRAY_SIZE (tegra210_audio_plls)); +ARRAY_SIZE (tegra210_audio_plls),24576000 );tegra_pmc_clk_init (pmc_base, tegra210_clks);/* For Tegra210, PLLD is the only source for DSIA & DSIB */
drivers/clk/tegra/clk-tegra30.c +8 -1
@@ -1267,6 +1267,13 @@ static struct tegra_clk_init_table init_table[] __initdata = { { TEGRA30_CLK_GR3D2, TEGRA30_CLK_PLL_C, 300000000, 0 }, { TEGRA30_CLK_PLL_U, TEGRA30_CLK_CLK_MAX, 480000000, 0 }, { TEGRA30_CLK_VDE, TEGRA30_CLK_CLK_MAX, 600000000, 0 }, + { TEGRA30_CLK_SPDIF_IN_SYNC, TEGRA30_CLK_CLK_MAX, 24000000, 0 }, + { TEGRA30_CLK_I2S0_SYNC, TEGRA30_CLK_CLK_MAX, 24000000, 0 }, + { TEGRA30_CLK_I2S1_SYNC, TEGRA30_CLK_CLK_MAX, 24000000, 0 }, + { TEGRA30_CLK_I2S2_SYNC, TEGRA30_CLK_CLK_MAX, 24000000, 0 }, + { TEGRA30_CLK_I2S3_SYNC, TEGRA30_CLK_CLK_MAX, 24000000, 0 }, + { TEGRA30_CLK_I2S4_SYNC, TEGRA30_CLK_CLK_MAX, 24000000, 0 }, + { TEGRA30_CLK_VIMCLK_SYNC, TEGRA30_CLK_CLK_MAX, 24000000, 0 },/* must be the last entry */ { TEGRA30_CLK_CLK_MAX, TEGRA30_CLK_CLK_MAX, 0, 0 }, };
@@ -1344,7 +1351,7 @@ static void __init tegra30_clock_init(struct device_node *np)tegra30_periph_clk_init ();tegra_audio_clk_init (clk_base, pmc_base, tegra30_clks, tegra30_audio_plls, -ARRAY_SIZE (tegra30_audio_plls)); +ARRAY_SIZE (tegra30_audio_plls),24000000 );tegra_pmc_clk_init (pmc_base, tegra30_clks);tegra_init_dup_clks (tegra_clk_duplicates, clks,TEGRA30_CLK_CLK_MAX );
drivers/clk/tegra/clk.h +2 -2
@@ -41,7 +41,7 @@ extern const struct clk_ops tegra_clk_sync_source_ops;extern int *periph_clk_enb_refcnt;struct clk *tegra_clk_register_sync_source (const char *name, -unsigned long fixed_rate,unsigned long max_rate); +unsigned long max_rate);/** * struct tegra_clk_frac_div - fractional divider clock
@@ -796,7 +796,7 @@ void tegra_register_devclks(struct tegra_devclk *dev_clks, int num);void tegra_audio_clk_init (void __iomem *clk_base,void __iomem *pmc_base,struct tegra_clk *tegra_clks,struct tegra_audio_clk_info *audio_info, -unsigned int num_plls); +unsigned int num_plls,unsigned long sync_max_rate); void tegra_periph_clk_init(void __iomem *clk_base, void __iomem *pmc_base, struct tegra_clk *tegra_clks,
Signature · 1 line
2.7.4
Jon Hunter
maintainerPATCH RESEND 2/2 clk: tegra30: Use Tegra CPU powergate helper function
Rather than using the tegra_powergate_is_powered() function for determining if a CPU is powered, use the tegra_pmc_cpu_is_powered() instead which was created to get the CPU power status. Internally tegra_pmc_cpu_is_powered() calls tegra_powergate_is_powered() and so is equivalent.
The Tegra30 clock driver is the only public user of tegra_powergate_is_powered() and so by updating the Tegra30 clock driver to use tegra_pmc_cpu_is_powered(), we can then make tegra_powergate_is_powered() a non-public function.
---
Resending with Thierry's ACK and CC'ing clock maintainers.
drivers/clk/tegra/clk-tegra30.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clk/tegra/clk-tegra30.c +3 -3
@@ -1148,9 +1148,9 @@ static bool tegra30_cpu_rail_off_ready(void) cpu_rst_status =readl (clk_base +TEGRA30_CLK_RST_CONTROLLER_CPU_CMPLX_STATUS ); - cpu_pwr_status =tegra_powergate_is_powered (TEGRA_POWERGATE_CPU1 ) || -tegra_powergate_is_powered (TEGRA_POWERGATE_CPU2 ) || -tegra_powergate_is_powered (TEGRA_POWERGATE_CPU3 ); + cpu_pwr_status =tegra_pmc_cpu_is_powered (1 ) || +tegra_pmc_cpu_is_powered (2 ) || +tegra_pmc_cpu_is_powered (3 );if (((cpu_rst_status &0xE ) !=0xE ) || cpu_pwr_status)return false;
Signature · 1 line
2.7.4
Quoting Jon Hunter (2018-12-03 02:28:40)
Quoted 8 lines
The maximum frequency supported for I2S on Tegra124 and Tegra210 is 24.576MHz (as stated in the Tegra TK1 data sheet for Tegra124 and the Jetson TX1 module data sheet for Tegra210). However, the maximum I2S frequency is limited to 24MHz because that is the maximum frequency of the audio sync clock. Increase the maximum audio sync clock frequency to 24.576MHz for Tegra124 and Tegra210 in order to support 24.576MHz for I2S.
Quoted 7 lines
Update the
tegra_clk_register_sync_source()function so that it does not set the initial rate for the sync clocks and use the clock init tables to set the initial rate instead.Signed-off-by Jon Hunter <[email protected]>Acked-by Thierry Reding <[email protected]>---
Applied to clk-next
Re: [RESEND PATCH 2/2] clk: tegra30: Use Tegra CPU powergate helper function
In reply to Jon HunterQuoting Jon Hunter (2018-12-03 02:28:41)
Quoted 6 lines
Rather than using the
tegra_powergate_is_powered()function for determining if a CPU is powered, use thetegra_pmc_cpu_is_powered()instead which was created to get the CPU power status. Internallytegra_pmc_cpu_is_powered()callstegra_powergate_is_powered()and so is equivalent.
Quoted 8 lines
The Tegra30 clock driver is the only public user of
tegra_powergate_is_powered()and so by updating the Tegra30 clock driver to usetegra_pmc_cpu_is_powered(), we can then maketegra_powergate_is_powered()a non-public function.Signed-off-by Jon Hunter <[email protected]>Acked-by Thierry Reding <[email protected]>---
Applied to clk-next