14.04.2020 23:46, Dmitry Osipenko пишет: > 09.04.2020 20:52, Thierry Reding пишет: > ... >> +static void tegra210_change_dll_src(struct tegra210_emc *emc, >> + u32 clksrc) >> +{ >> + u32 dll_setting = emc->next->dll_clk_src; >> + u32 emc_clk_src; >> + u32 emc_clk_div; >> + >> + emc_clk_src = (clksrc & EMC_CLK_EMC_2X_CLK_SRC_MASK) >> >> + EMC_CLK_EMC_2X_CLK_SRC_SHIFT; >> + emc_clk_div = (clksrc & EMC_CLK_EMC_2X_CLK_DIVISOR_MASK) >> >> + EMC_CLK_EMC_2X_CLK_DIVISOR_SHIFT; >> + >> + dll_setting &= ~(DLL_CLK_EMC_DLL_CLK_SRC_MASK | >> + DLL_CLK_EMC_DLL_CLK_DIVISOR_MASK); >> + dll_setting |= emc_clk_src << DLL_CLK_EMC_DLL_CLK_SRC_SHIFT; >> + dll_setting |= emc_clk_div << DLL_CLK_EMC_DLL_CLK_DIVISOR_SHIFT; >> + >> + dll_setting &= ~DLL_CLK_EMC_DLL_DDLL_CLK_SEL_MASK; >> + if (emc_clk_src == EMC_CLK_SOURCE_PLLMB_LJ) >> + dll_setting |= (PLLM_VCOB << >> + DLL_CLK_EMC_DLL_DDLL_CLK_SEL_SHIFT); >> + else if (emc_clk_src == EMC_CLK_SOURCE_PLLM_LJ) >> + dll_setting |= (PLLM_VCOA << >> + DLL_CLK_EMC_DLL_DDLL_CLK_SEL_SHIFT); >> + else >> + dll_setting |= (EMC_DLL_SWITCH_OUT << >> + DLL_CLK_EMC_DLL_DDLL_CLK_SEL_SHIFT); >> + >> + tegra210_clk_emc_dll_update_setting(dll_setting); >> + >> + if (emc->next->clk_out_enb_x_0_clk_enb_emc_dll) >> + tegra210_clk_emc_dll_enable(true); >> + else >> + tegra210_clk_emc_dll_enable(false); > > Isn't something like fence_udelay(1) needed after touching clk registers? > Won't be better to move this whole function into clk/tegra? It feels a bit dirty that a raw clk pointer is passed to the EMC code. I'd factor all the clk functions into clk/tegra to have a clean separation of the code.