Skip to content

Commit 5c992af

Browse files
abresticMike Turquette
authored andcommitted
clk: tegra: Fix xusb_hs_src clock hierarchy
Currently the Tegra1x4 clock init code hard-codes the mux setting for xusb_hs_src and treats it as a fixed-factor clock. It is, however, a mux which can be parented by either xusb_ss_src/2 or pll_u_60M. Add the fixed-factor clock xusb_ss_div2 and put an entry in periph_clks[] for the xusb_hs_src mux. Signed-off-by: Andrew Bresticker <abrestic@chromium.org> Signed-off-by: Mike Turquette <mturquette@linaro.org>
1 parent 9d61707 commit 5c992af

6 files changed

Lines changed: 21 additions & 22 deletions

File tree

‎drivers/clk/tegra/clk-id.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ enum clk_id {
233233
tegra_clk_xusb_hs_src,
234234
tegra_clk_xusb_ss,
235235
tegra_clk_xusb_ss_src,
236+
tegra_clk_xusb_ss_div2,
236237
tegra_clk_max,
237238
};
238239

‎drivers/clk/tegra/clk-tegra-periph.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,11 @@ static u32 mux_clkm_pllre_clk32_480M_pllc_ref_idx[] = {
340340
[0] = 0, [1] = 1, [2] = 3, [3] = 3, [4] = 4, [5] = 7,
341341
};
342342

343+
static const char *mux_ss_60M[] = {
344+
"xusb_ss_div2", "pll_u_60M"
345+
};
346+
#define mux_ss_60M_idx NULL
347+
343348
static const char *mux_d_audio_clk[] = {
344349
"pll_a_out0", "pll_p", "clk_m", "spdif_in_sync", "i2s0_sync",
345350
"i2s1_sync", "i2s2_sync", "i2s3_sync", "i2s4_sync", "vimclk_sync",
@@ -501,6 +506,7 @@ static struct tegra_periph_init_data periph_clks[] = {
501506
XUSB("xusb_falcon_src", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_FALCON_SRC, 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_falcon_src),
502507
XUSB("xusb_fs_src", mux_clkm_48M_pllp_480M, CLK_SOURCE_XUSB_FS_SRC, 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_fs_src),
503508
XUSB("xusb_ss_src", mux_clkm_pllre_clk32_480M_pllc_ref, CLK_SOURCE_XUSB_SS_SRC, 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_ss_src),
509+
NODIV("xusb_hs_src", mux_ss_60M, CLK_SOURCE_XUSB_SS_SRC, 25, MASK(1), 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_hs_src, NULL),
504510
XUSB("xusb_dev_src", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_DEV_SRC, 95, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_dev_src),
505511
};
506512

‎drivers/clk/tegra/clk-tegra114.c‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@
142142
#define UTMIPLL_HW_PWRDN_CFG0_IDDQ_SWCTL BIT(0)
143143

144144
#define CLK_SOURCE_CSITE 0x1d4
145-
#define CLK_SOURCE_XUSB_SS_SRC 0x610
146145
#define CLK_SOURCE_EMC 0x19c
147146

148147
/* PLLM override registers */
@@ -834,6 +833,7 @@ static struct tegra_clk tegra114_clks[tegra_clk_max] __initdata = {
834833
[tegra_clk_xusb_falcon_src] = { .dt_id = TEGRA114_CLK_XUSB_FALCON_SRC, .present = true },
835834
[tegra_clk_xusb_fs_src] = { .dt_id = TEGRA114_CLK_XUSB_FS_SRC, .present = true },
836835
[tegra_clk_xusb_ss_src] = { .dt_id = TEGRA114_CLK_XUSB_SS_SRC, .present = true },
836+
[tegra_clk_xusb_ss_div2] = { .dt_id = TEGRA114_CLK_XUSB_SS_DIV2, .present = true},
837837
[tegra_clk_xusb_dev_src] = { .dt_id = TEGRA114_CLK_XUSB_DEV_SRC, .present = true },
838838
[tegra_clk_xusb_dev] = { .dt_id = TEGRA114_CLK_XUSB_DEV, .present = true },
839839
[tegra_clk_xusb_hs_src] = { .dt_id = TEGRA114_CLK_XUSB_HS_SRC, .present = true },
@@ -1182,16 +1182,11 @@ static __init void tegra114_periph_clk_init(void __iomem *clk_base,
11821182
void __iomem *pmc_base)
11831183
{
11841184
struct clk *clk;
1185-
u32 val;
1186-
1187-
/* xusb_hs_src */
1188-
val = readl(clk_base + CLK_SOURCE_XUSB_SS_SRC);
1189-
val |= BIT(25); /* always select PLLU_60M */
1190-
writel(val, clk_base + CLK_SOURCE_XUSB_SS_SRC);
11911185

1192-
clk = clk_register_fixed_factor(NULL, "xusb_hs_src", "pll_u_60M", 0,
1193-
1, 1);
1194-
clks[TEGRA114_CLK_XUSB_HS_SRC] = clk;
1186+
/* xusb_ss_div2 */
1187+
clk = clk_register_fixed_factor(NULL, "xusb_ss_div2", "xusb_ss_src", 0,
1188+
1, 2);
1189+
clks[TEGRA114_CLK_XUSB_SS_DIV2] = clk;
11951190

11961191
/* dsia mux */
11971192
clk = clk_register_mux(NULL, "dsia_mux", mux_plld_out0_plld2_out0,

‎drivers/clk/tegra/clk-tegra124.c‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
#define CLK_SOURCE_CSITE 0x1d4
3232
#define CLK_SOURCE_EMC 0x19c
33-
#define CLK_SOURCE_XUSB_SS_SRC 0x610
3433

3534
#define PLLC_BASE 0x80
3635
#define PLLC_OUT 0x84
@@ -925,6 +924,7 @@ static struct tegra_clk tegra124_clks[tegra_clk_max] __initdata = {
925924
[tegra_clk_xusb_falcon_src] = { .dt_id = TEGRA124_CLK_XUSB_FALCON_SRC, .present = true },
926925
[tegra_clk_xusb_fs_src] = { .dt_id = TEGRA124_CLK_XUSB_FS_SRC, .present = true },
927926
[tegra_clk_xusb_ss_src] = { .dt_id = TEGRA124_CLK_XUSB_SS_SRC, .present = true },
927+
[tegra_clk_xusb_ss_div2] = { .dt_id = TEGRA124_CLK_XUSB_SS_DIV2, .present = true },
928928
[tegra_clk_xusb_dev_src] = { .dt_id = TEGRA124_CLK_XUSB_DEV_SRC, .present = true },
929929
[tegra_clk_xusb_dev] = { .dt_id = TEGRA124_CLK_XUSB_DEV, .present = true },
930930
[tegra_clk_xusb_hs_src] = { .dt_id = TEGRA124_CLK_XUSB_HS_SRC, .present = true },
@@ -1105,16 +1105,11 @@ static __init void tegra124_periph_clk_init(void __iomem *clk_base,
11051105
void __iomem *pmc_base)
11061106
{
11071107
struct clk *clk;
1108-
u32 val;
1109-
1110-
/* xusb_hs_src */
1111-
val = readl(clk_base + CLK_SOURCE_XUSB_SS_SRC);
1112-
val |= BIT(25); /* always select PLLU_60M */
1113-
writel(val, clk_base + CLK_SOURCE_XUSB_SS_SRC);
11141108

1115-
clk = clk_register_fixed_factor(NULL, "xusb_hs_src", "pll_u_60M", 0,
1116-
1, 1);
1117-
clks[TEGRA124_CLK_XUSB_HS_SRC] = clk;
1109+
/* xusb_ss_div2 */
1110+
clk = clk_register_fixed_factor(NULL, "xusb_ss_div2", "xusb_ss_src", 0,
1111+
1, 2);
1112+
clks[TEGRA124_CLK_XUSB_SS_DIV2] = clk;
11181113

11191114
/* dsia mux */
11201115
clk = clk_register_mux(NULL, "dsia_mux", mux_plld_out0_plld2_out0,

‎include/dt-bindings/clock/tegra114-car.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@
337337
#define TEGRA114_CLK_CLK_OUT_3_MUX 308
338338
#define TEGRA114_CLK_DSIA_MUX 309
339339
#define TEGRA114_CLK_DSIB_MUX 310
340-
#define TEGRA114_CLK_CLK_MAX 311
340+
#define TEGRA114_CLK_XUSB_SS_DIV2 311
341+
#define TEGRA114_CLK_CLK_MAX 312
341342

342343
#endif /* _DT_BINDINGS_CLOCK_TEGRA114_CAR_H */

‎include/dt-bindings/clock/tegra124-car.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@
336336
#define TEGRA124_CLK_DSIA_MUX 309
337337
#define TEGRA124_CLK_DSIB_MUX 310
338338
#define TEGRA124_CLK_SOR0_LVDS 311
339-
#define TEGRA124_CLK_CLK_MAX 312
339+
#define TEGRA124_CLK_XUSB_SS_DIV2 312
340+
#define TEGRA124_CLK_CLK_MAX 313
340341

341342
#endif /* _DT_BINDINGS_CLOCK_TEGRA124_CAR_H */

0 commit comments

Comments
 (0)