Re: [PATCH 1/3] clk: meson: mpll: properly handle spread spectrum

From: Martin Blumenstingl
Date: Fri Mar 29 2019 - 15:40:14 EST


Hi Jerome,

On Fri, Mar 29, 2019 at 4:34 PM Jerome Brunet <jbrunet@xxxxxxxxxxxx> wrote:
>
> The bit 'SSEN' available on some MPLL DSS outputs is not related to the
> fractional part of the divider but to the function called
> 'Spread Spectrum'.
>
> This function might be used to solve EM issues by adding a jitter on
> clock signal. This widens the signal spectrum and weakens the peaks in it.
>
> While spread spectrum might be useful for some application, it is
> problematic for others, such as audio.
>
> This patch introduce a new flag to the MPLL driver to enable (or not) the
> spread spectrum function.
>
> Fixes: 1f737ffa13ef ("clk: meson: mpll: fix mpll0 fractional part ignored")
> Signed-off-by: Jerome Brunet <jbrunet@xxxxxxxxxxxx>
> ---
> drivers/clk/meson/clk-mpll.c | 9 ++++++---
> drivers/clk/meson/clk-mpll.h | 1 +
> 2 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/clk/meson/clk-mpll.c b/drivers/clk/meson/clk-mpll.c
> index 64d31c8ba3d0..2d39a8bc367c 100644
> --- a/drivers/clk/meson/clk-mpll.c
> +++ b/drivers/clk/meson/clk-mpll.c
> @@ -141,9 +141,12 @@ static void mpll_init(struct clk_hw *hw)
> /* Enable the fractional part */
> meson_parm_write(clk->map, &mpll->sdm_en, 1);
>
> - /* Set additional fractional part enable if required */
> - if (MESON_PARM_APPLICABLE(&mpll->ssen))
> - meson_parm_write(clk->map, &mpll->ssen, 1);
> + /* Set spread spectrum if possible */
> + if (MESON_PARM_APPLICABLE(&mpll->ssen)) {
> + unsigned int ss =
> + mpll->flags & CLK_MESON_MPLL_SPREAD_SPECTRUM ? 1 : 0;
> + meson_parm_write(clk->map, &mpll->ssen, ss);
> + }
this changes the "ssen" flag on all supported clocks from 1 (before
this patch) to 0 (after this patch).
is this on purpose and how does it affect existing clocks?

based on the original commit 1f737ffa13ef ("clk: meson: mpll: fix
mpll0 fractional part ignored") it seems that
CLK_MESON_MPLL_SPREAD_SPECTRUM should be set for mpll0 (at least on
GXBB and Meson8b)


Martin