mbox series

[v2,0/7] Cleanup Tegra210 EMC frequency scaling

Message ID 20240419104516.308975-1-diogo.ivo@tecnico.ulisboa.pt
Headers show
Series Cleanup Tegra210 EMC frequency scaling | expand

Message

Diogo Ivo April 19, 2024, 10:45 a.m. UTC
Hello,

This patch series consists of a general cleanup of the Tegra210 EMC
frequency scaling code for revision 7.

Currently the code is relying heavily on a function, update_clock_tree_delay(),
that is responsible for too many things, making it long and confusing.
The general idea with these patches is to simplify this function and its
surrounding code, making it more modular.

The motivation behind these changes (besides improving readability and
maintainability) is to make it simpler to add support in the future for
frequency change revisions other than 7, where we can reuse a large
portion of the modularized code rather than essentially repeating 2k
lines of code with minimal changes.

There are no functional changes with this patch set, as it is only meant
as preparation for following patches where revision 6 support is added.

The first version of the series can be found in [1]. The changes made in v2
are described in each patch.

[1]: https://lore.kernel.org/linux-tegra/20240409094632.62916-1-diogo.ivo@tecnico.ulisboa.pt/

Diogo Ivo (7):
  memory: tegra: Remove periodic compensation duplicate calls
  memory: tegra: Move DQSOSC measurement to common place
  memory: tegra: Reword and correct comments
  memory: tegra: Change macros to interpret parameter as integer
  memory: tegra: Loop update_clock_tree_delay()
  memory: tegra: Move compare/update current delay values to a function
  memory: tegra: Rework update_clock_tree_delay()

 drivers/memory/tegra/tegra210-emc-cc-r21021.c | 427 ++++--------------
 1 file changed, 84 insertions(+), 343 deletions(-)

Comments

Krzysztof Kozlowski April 24, 2024, 6:16 p.m. UTC | #1
On Fri, 19 Apr 2024 11:45:08 +0100, Diogo Ivo wrote:
> This patch series consists of a general cleanup of the Tegra210 EMC
> frequency scaling code for revision 7.
> 
> Currently the code is relying heavily on a function, update_clock_tree_delay(),
> that is responsible for too many things, making it long and confusing.
> The general idea with these patches is to simplify this function and its
> surrounding code, making it more modular.
> 
> [...]

Applied, thanks!

[1/7] memory: tegra: Remove periodic compensation duplicate calls
      https://git.kernel.org/krzk/linux-mem-ctrl/c/f8037b3d9a75f4963c1fd3eaf39b968f206d37df
[2/7] memory: tegra: Move DQSOSC measurement to common place
      https://git.kernel.org/krzk/linux-mem-ctrl/c/09dd3744d7c02a3844e8a6c96ab2fb3c1e94de52
[3/7] memory: tegra: Reword and correct comments
      https://git.kernel.org/krzk/linux-mem-ctrl/c/d48076e5bb9be787b769efb3e6439902dc8e99f7
[4/7] memory: tegra: Change macros to interpret parameter as integer
      https://git.kernel.org/krzk/linux-mem-ctrl/c/56c95667042ba12a66157477282ca73605a25481
[5/7] memory: tegra: Loop update_clock_tree_delay()
      https://git.kernel.org/krzk/linux-mem-ctrl/c/0d647b9031fe4f6b20d2f18b3d087dea740eecf1
[6/7] memory: tegra: Move compare/update current delay values to a function
      https://git.kernel.org/krzk/linux-mem-ctrl/c/c1a70060c654327be4aed6e617f53bae5af8625f
[7/7] memory: tegra: Rework update_clock_tree_delay()
      https://git.kernel.org/krzk/linux-mem-ctrl/c/edbf2db5ae95c4d8f189d05e827d9dd3ea75cfbc

Best regards,
Krzysztof Kozlowski April 25, 2024, 6:11 a.m. UTC | #2
On 24/04/2024 20:16, Krzysztof Kozlowski wrote:
> 
> On Fri, 19 Apr 2024 11:45:08 +0100, Diogo Ivo wrote:
>> This patch series consists of a general cleanup of the Tegra210 EMC
>> frequency scaling code for revision 7.
>>
>> Currently the code is relying heavily on a function, update_clock_tree_delay(),
>> that is responsible for too many things, making it long and confusing.
>> The general idea with these patches is to simplify this function and its
>> surrounding code, making it more modular.
>>
>> [...]
> 
> Applied, thanks!
> 
> [1/7] memory: tegra: Remove periodic compensation duplicate calls
>       https://git.kernel.org/krzk/linux-mem-ctrl/c/f8037b3d9a75f4963c1fd3eaf39b968f206d37df
> [2/7] memory: tegra: Move DQSOSC measurement to common place
>       https://git.kernel.org/krzk/linux-mem-ctrl/c/09dd3744d7c02a3844e8a6c96ab2fb3c1e94de52
> [3/7] memory: tegra: Reword and correct comments
>       https://git.kernel.org/krzk/linux-mem-ctrl/c/d48076e5bb9be787b769efb3e6439902dc8e99f7
> [4/7] memory: tegra: Change macros to interpret parameter as integer
>       https://git.kernel.org/krzk/linux-mem-ctrl/c/56c95667042ba12a66157477282ca73605a25481
> [5/7] memory: tegra: Loop update_clock_tree_delay()
>       https://git.kernel.org/krzk/linux-mem-ctrl/c/0d647b9031fe4f6b20d2f18b3d087dea740eecf1
> [6/7] memory: tegra: Move compare/update current delay values to a function
>       https://git.kernel.org/krzk/linux-mem-ctrl/c/c1a70060c654327be4aed6e617f53bae5af8625f
> [7/7] memory: tegra: Rework update_clock_tree_delay()
>       https://git.kernel.org/krzk/linux-mem-ctrl/c/edbf2db5ae95c4d8f189d05e827d9dd3ea75cfbc

And entire patchset dropped because it fails to compile on several
architectures.

Don't send code which does not compile.

Best regards,
Krzysztof
Diogo Ivo April 27, 2024, 5:05 p.m. UTC | #3
On Thu, Apr 25, 2024 at 08:11:20AM GMT, Krzysztof Kozlowski wrote:
> On 24/04/2024 20:16, Krzysztof Kozlowski wrote:
> > 
> > On Fri, 19 Apr 2024 11:45:08 +0100, Diogo Ivo wrote:
> >> This patch series consists of a general cleanup of the Tegra210 EMC
> >> frequency scaling code for revision 7.
> >>
> >> Currently the code is relying heavily on a function, update_clock_tree_delay(),
> >> that is responsible for too many things, making it long and confusing.
> >> The general idea with these patches is to simplify this function and its
> >> surrounding code, making it more modular.
> >>
> >> [...]
> > 
> > Applied, thanks!
> > 
> > [1/7] memory: tegra: Remove periodic compensation duplicate calls
> >       https://git.kernel.org/krzk/linux-mem-ctrl/c/f8037b3d9a75f4963c1fd3eaf39b968f206d37df
> > [2/7] memory: tegra: Move DQSOSC measurement to common place
> >       https://git.kernel.org/krzk/linux-mem-ctrl/c/09dd3744d7c02a3844e8a6c96ab2fb3c1e94de52
> > [3/7] memory: tegra: Reword and correct comments
> >       https://git.kernel.org/krzk/linux-mem-ctrl/c/d48076e5bb9be787b769efb3e6439902dc8e99f7
> > [4/7] memory: tegra: Change macros to interpret parameter as integer
> >       https://git.kernel.org/krzk/linux-mem-ctrl/c/56c95667042ba12a66157477282ca73605a25481
> > [5/7] memory: tegra: Loop update_clock_tree_delay()
> >       https://git.kernel.org/krzk/linux-mem-ctrl/c/0d647b9031fe4f6b20d2f18b3d087dea740eecf1
> > [6/7] memory: tegra: Move compare/update current delay values to a function
> >       https://git.kernel.org/krzk/linux-mem-ctrl/c/c1a70060c654327be4aed6e617f53bae5af8625f
> > [7/7] memory: tegra: Rework update_clock_tree_delay()
> >       https://git.kernel.org/krzk/linux-mem-ctrl/c/edbf2db5ae95c4d8f189d05e827d9dd3ea75cfbc
> 
> And entire patchset dropped because it fails to compile on several
> architectures.
> 
> Don't send code which does not compile.
> 
> Best regards,
> Krzysztof

Sorry for that! I was testing this on an ARM64 platform where the code
does compile, so I did not catch this error. Thanks for pointing it out,
I will send a fixed version.

Best regards,
Diogo