diff options
-rw-r--r-- | drivers/clk/tegra/clk-tegra210.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/clk/tegra/clk-tegra210.c b/drivers/clk/tegra/clk-tegra210.c index dc4a81328d5a..a4d7d94b6436 100644 --- a/drivers/clk/tegra/clk-tegra210.c +++ b/drivers/clk/tegra/clk-tegra210.c | |||
@@ -241,6 +241,9 @@ | |||
241 | #define PLL_SDM_COEFF BIT(13) | 241 | #define PLL_SDM_COEFF BIT(13) |
242 | #define sdin_din_to_data(din) ((u16)((din) ? : 0xFFFFU)) | 242 | #define sdin_din_to_data(din) ((u16)((din) ? : 0xFFFFU)) |
243 | #define sdin_data_to_din(dat) (((dat) == 0xFFFFU) ? 0 : (s16)dat) | 243 | #define sdin_data_to_din(dat) (((dat) == 0xFFFFU) ? 0 : (s16)dat) |
244 | /* This macro returns ndiv effective scaled to SDM range */ | ||
245 | #define sdin_get_n_eff(cfg) ((cfg)->n * PLL_SDM_COEFF + ((cfg)->sdm_data ? \ | ||
246 | (PLL_SDM_COEFF/2 + sdin_data_to_din((cfg)->sdm_data)) : 0)) | ||
244 | 247 | ||
245 | /* Tegra CPU clock and reset control regs */ | 248 | /* Tegra CPU clock and reset control regs */ |
246 | #define CLK_RST_CONTROLLER_CPU_CMPLX_STATUS 0x470 | 249 | #define CLK_RST_CONTROLLER_CPU_CMPLX_STATUS 0x470 |
@@ -1288,8 +1291,7 @@ static int tegra210_pll_fixed_mdiv_cfg(struct clk_hw *hw, | |||
1288 | s -= PLL_SDM_COEFF / 2; | 1291 | s -= PLL_SDM_COEFF / 2; |
1289 | cfg->sdm_data = sdin_din_to_data(s); | 1292 | cfg->sdm_data = sdin_din_to_data(s); |
1290 | } | 1293 | } |
1291 | cfg->output_rate *= cfg->n * PLL_SDM_COEFF + PLL_SDM_COEFF/2 + | 1294 | cfg->output_rate *= sdin_get_n_eff(cfg); |
1292 | sdin_data_to_din(cfg->sdm_data); | ||
1293 | cfg->output_rate /= p * cfg->m * PLL_SDM_COEFF; | 1295 | cfg->output_rate /= p * cfg->m * PLL_SDM_COEFF; |
1294 | } else { | 1296 | } else { |
1295 | cfg->output_rate *= cfg->n; | 1297 | cfg->output_rate *= cfg->n; |
@@ -1314,8 +1316,7 @@ static int tegra210_pll_fixed_mdiv_cfg(struct clk_hw *hw, | |||
1314 | */ | 1316 | */ |
1315 | static void tegra210_clk_pll_set_gain(struct tegra_clk_pll_freq_table *cfg) | 1317 | static void tegra210_clk_pll_set_gain(struct tegra_clk_pll_freq_table *cfg) |
1316 | { | 1318 | { |
1317 | cfg->n = cfg->n * PLL_SDM_COEFF + PLL_SDM_COEFF/2 + | 1319 | cfg->n = sdin_get_n_eff(cfg); |
1318 | sdin_data_to_din(cfg->sdm_data); | ||
1319 | cfg->m *= PLL_SDM_COEFF; | 1320 | cfg->m *= PLL_SDM_COEFF; |
1320 | } | 1321 | } |
1321 | 1322 | ||