Re: [PATCH v6 09/14] memory: tegra: Add EMC scaling support code for Tegra210

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux