Skip to content

Commit a6d8abf

Browse files
clamor-sthierryreding
authored andcommitted
clk: tegra: Set CSUS as vi_sensor's gate for Tegra20, Tegra30 and Tegra114
The CSUS clock is a clock gate for the output clock signal primarily sourced from the VI_SENSOR clock. This clock signal is used as an input MCLK clock for cameras. Unlike later Tegra SoCs, the Tegra 20 can change its CSUS parent, which is why csus_mux is added in a similar way to how CDEV1 and CDEV2 are handled. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com> Tested-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # tegra20, parallel camera Signed-off-by: Thierry Reding <treding@nvidia.com>
1 parent f521678 commit a6d8abf

3 files changed

Lines changed: 25 additions & 9 deletions

File tree

drivers/clk/tegra/clk-tegra114.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,6 @@ static struct tegra_clk tegra114_clks[tegra_clk_max] __initdata = {
690690
[tegra_clk_tsec] = { .dt_id = TEGRA114_CLK_TSEC, .present = true },
691691
[tegra_clk_xusb_host] = { .dt_id = TEGRA114_CLK_XUSB_HOST, .present = true },
692692
[tegra_clk_msenc] = { .dt_id = TEGRA114_CLK_MSENC, .present = true },
693-
[tegra_clk_csus] = { .dt_id = TEGRA114_CLK_CSUS, .present = true },
694693
[tegra_clk_mselect] = { .dt_id = TEGRA114_CLK_MSELECT, .present = true },
695694
[tegra_clk_tsensor] = { .dt_id = TEGRA114_CLK_TSENSOR, .present = true },
696695
[tegra_clk_i2s3] = { .dt_id = TEGRA114_CLK_I2S3, .present = true },
@@ -1046,6 +1045,12 @@ static __init void tegra114_periph_clk_init(void __iomem *clk_base,
10461045
0, 82, periph_clk_enb_refcnt);
10471046
clks[TEGRA114_CLK_DSIB] = clk;
10481047

1048+
/* csus */
1049+
clk = tegra_clk_register_periph_gate("csus", "vi_sensor", 0,
1050+
clk_base, 0, TEGRA114_CLK_CSUS,
1051+
periph_clk_enb_refcnt);
1052+
clks[TEGRA114_CLK_CSUS] = clk;
1053+
10491054
/* emc mux */
10501055
clk = clk_register_mux(NULL, "emc_mux", mux_pllmcp_clkm,
10511056
ARRAY_SIZE(mux_pllmcp_clkm),

drivers/clk/tegra/clk-tegra20.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,6 @@ static struct tegra_clk tegra20_clks[tegra_clk_max] __initdata = {
530530
[tegra_clk_rtc] = { .dt_id = TEGRA20_CLK_RTC, .present = true },
531531
[tegra_clk_timer] = { .dt_id = TEGRA20_CLK_TIMER, .present = true },
532532
[tegra_clk_kbc] = { .dt_id = TEGRA20_CLK_KBC, .present = true },
533-
[tegra_clk_csus] = { .dt_id = TEGRA20_CLK_CSUS, .present = true },
534533
[tegra_clk_vcp] = { .dt_id = TEGRA20_CLK_VCP, .present = true },
535534
[tegra_clk_bsea] = { .dt_id = TEGRA20_CLK_BSEA, .present = true },
536535
[tegra_clk_bsev] = { .dt_id = TEGRA20_CLK_BSEV, .present = true },
@@ -834,6 +833,12 @@ static void __init tegra20_periph_clk_init(void)
834833
clk_base, 0, 93, periph_clk_enb_refcnt);
835834
clks[TEGRA20_CLK_CDEV2] = clk;
836835

836+
/* csus */
837+
clk = tegra_clk_register_periph_gate("csus", "csus_mux", 0,
838+
clk_base, 0, TEGRA20_CLK_CSUS,
839+
periph_clk_enb_refcnt);
840+
clks[TEGRA20_CLK_CSUS] = clk;
841+
837842
for (i = 0; i < ARRAY_SIZE(tegra_periph_clk_list); i++) {
838843
data = &tegra_periph_clk_list[i];
839844
clk = tegra_clk_register_periph_data(clk_base, data);
@@ -1093,14 +1098,15 @@ static struct clk *tegra20_clk_src_onecell_get(struct of_phandle_args *clkspec,
10931098
hw = __clk_get_hw(clk);
10941099

10951100
/*
1096-
* Tegra20 CDEV1 and CDEV2 clocks are a bit special case, their parent
1097-
* clock is created by the pinctrl driver. It is possible for clk user
1098-
* to request these clocks before pinctrl driver got probed and hence
1099-
* user will get an orphaned clock. That might be undesirable because
1100-
* user may expect parent clock to be enabled by the child.
1101+
* Tegra20 CDEV1, CDEV2 and CSUS clocks are a bit special case, their
1102+
* parent clock is created by the pinctrl driver. It is possible for
1103+
* clk user to request these clocks before pinctrl driver got probed
1104+
* and hence user will get an orphaned clock. That might be undesirable
1105+
* because user may expect parent clock to be enabled by the child.
11011106
*/
11021107
if (clkspec->args[0] == TEGRA20_CLK_CDEV1 ||
1103-
clkspec->args[0] == TEGRA20_CLK_CDEV2) {
1108+
clkspec->args[0] == TEGRA20_CLK_CDEV2 ||
1109+
clkspec->args[0] == TEGRA20_CLK_CSUS) {
11041110
parent_hw = clk_hw_get_parent(hw);
11051111
if (!parent_hw)
11061112
return ERR_PTR(-EPROBE_DEFER);

drivers/clk/tegra/clk-tegra30.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,6 @@ static struct tegra_clk tegra30_clks[tegra_clk_max] __initdata = {
780780
[tegra_clk_rtc] = { .dt_id = TEGRA30_CLK_RTC, .present = true },
781781
[tegra_clk_timer] = { .dt_id = TEGRA30_CLK_TIMER, .present = true },
782782
[tegra_clk_kbc] = { .dt_id = TEGRA30_CLK_KBC, .present = true },
783-
[tegra_clk_csus] = { .dt_id = TEGRA30_CLK_CSUS, .present = true },
784783
[tegra_clk_vcp] = { .dt_id = TEGRA30_CLK_VCP, .present = true },
785784
[tegra_clk_bsea] = { .dt_id = TEGRA30_CLK_BSEA, .present = true },
786785
[tegra_clk_bsev] = { .dt_id = TEGRA30_CLK_BSEV, .present = true },
@@ -1009,6 +1008,12 @@ static void __init tegra30_periph_clk_init(void)
10091008
0, 48, periph_clk_enb_refcnt);
10101009
clks[TEGRA30_CLK_DSIA] = clk;
10111010

1011+
/* csus */
1012+
clk = tegra_clk_register_periph_gate("csus", "vi_sensor", 0,
1013+
clk_base, 0, TEGRA30_CLK_CSUS,
1014+
periph_clk_enb_refcnt);
1015+
clks[TEGRA30_CLK_CSUS] = clk;
1016+
10121017
/* pcie */
10131018
clk = tegra_clk_register_periph_gate("pcie", "clk_m", 0, clk_base, 0,
10141019
70, periph_clk_enb_refcnt);

0 commit comments

Comments
 (0)