All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Dirk Behme <dirk.behme@de.bosch.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>
Subject: Re: clk: r8a7795: Why to read EXTAL* from DT? (was: Re: [PATCH v6 5/5] clk: shmobile: r8a7795: Add new CPG/MSSR driver)
Date: Wed, 25 Oct 2017 12:27:01 +0200	[thread overview]
Message-ID: <CAMuHMdXKk0SOFoputBX=C1vOVCUHQ6+61hwKPR=G04AZP4mUEw@mail.gmail.com> (raw)
In-Reply-To: <80b63a20-1f04-8dc9-874f-434bf096ef0b@de.bosch.com>

Hi Dirk,

On Wed, Oct 25, 2017 at 8:12 AM, Dirk Behme <dirk.behme@de.bosch.com> wrote:
> today, I want to learn some history ;)
>
> On 12.11.2015 16:54, Geert Uytterhoeven wrote:
>> Add a new R-Car H3 Clock Pulse Generator / Module Standby and Software
>> Reset driver, using the new CPG/MSSR driver core.
>>
>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>> ---
>
> ...
>>
>> diff --git a/drivers/clk/shmobile/r8a7795-cpg-mssr.c
>> b/drivers/clk/shmobile/r8a7795-cpg-mssr.c
>> new file mode 100644
>> index 0000000000000000..57c413635d1af135
>> --- /dev/null
>> +++ b/drivers/clk/shmobile/r8a7795-cpg-mssr.c
>
> ...
>>
>> +static const struct cpg_core_clk r8a7795_core_clks[] __initconst = {
>> +       /* External Clock Inputs */
>> +       DEF_INPUT("extal",  CLK_EXTAL),
>> +       DEF_INPUT("extalr", CLK_EXTALR),
>
> Why do we read the extal* frequencies from DT and don't auto detect them
> based on the MD pins?

Because the input frequency is determined by the EXTAL.
The MD pins define which dividers are used. So knowing both allows to calculate
the real frequencies of all generated clocks. People may populate different
crystals that supported officially.

> Yesterday, I spent two hours debugging a clock issue due to a wrong DT
> because the hardware guys populated a different EXTAL oscillator. I would
> have saved this time if it would have been auto detected.

That's actually the issue the code wanted to solve: on R-Car H3 ES1.0, there
are missing post-dividers on PLL0/2/4, cfr. the PLL_ERRATA flag in the driver.
To work around that, and avoid overclocking e.g. the CPU cores, the EXTAL
frequency and MD pin configuration don't match on Salvator-X with H3 ES1.0
(EXTAL is half the expected frequency according to the MD pins).

Conclusion: make sure your hardware description in DT is correct :-)

P.S. On R-Car Gen2, we used to "guess" extal from the MD pins in some
places, but that was changed. See e.g. commit 9f5ce39ddb8f68b3 ("ARM:
shmobile: rcar-gen2: Obtain extal frequency from DT").

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  reply	other threads:[~2017-10-25 10:27 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-12 15:54 [PATCH v6 0/5] clk: shmobile: Add new CPG/MSSR driver Geert Uytterhoeven
2015-11-12 15:54 ` Geert Uytterhoeven
2015-11-12 15:54 ` [PATCH v6 1/5] clk: shmobile: Rework CONFIG_ARCH_SHMOBILE_MULTI Geert Uytterhoeven
2015-11-12 15:54   ` Geert Uytterhoeven
2015-11-12 15:54 ` [PATCH v6 2/5] clk: shmobile: div6: Make clock-output-names optional Geert Uytterhoeven
2015-11-12 15:54   ` Geert Uytterhoeven
2015-11-12 15:54 ` [PATCH v6 3/5] clk: shmobile: div6: Extract cpg_div6_register() Geert Uytterhoeven
2015-11-12 15:54   ` Geert Uytterhoeven
2015-11-12 15:54 ` [PATCH v6 4/5] clk: shmobile: Add new CPG/MSSR driver core Geert Uytterhoeven
2015-11-12 15:54   ` Geert Uytterhoeven
2015-12-05  3:08   ` Laurent Pinchart
2015-12-05  3:08     ` Laurent Pinchart
2015-12-08  9:38     ` Geert Uytterhoeven
2015-12-08  9:38       ` Geert Uytterhoeven
2015-11-12 15:54 ` [PATCH v6 5/5] clk: shmobile: r8a7795: Add new CPG/MSSR driver Geert Uytterhoeven
2015-11-12 15:54   ` Geert Uytterhoeven
2017-10-25  6:12   ` clk: r8a7795: Why to read EXTAL* from DT? (was: Re: [PATCH v6 5/5] clk: shmobile: r8a7795: Add new CPG/MSSR driver) Dirk Behme
2017-10-25 10:27     ` Geert Uytterhoeven [this message]
2015-12-04  9:04 ` [PATCH v6 0/5] clk: shmobile: Add new CPG/MSSR driver Geert Uytterhoeven
2015-12-04  9:04   ` Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMuHMdXKk0SOFoputBX=C1vOVCUHQ6+61hwKPR=G04AZP4mUEw@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=dirk.behme@de.bosch.com \
    --cc=geert+renesas@glider.be \
    --cc=linux-renesas-soc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.