All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthijs van Duin <matthijsvanduin@gmail.com>
To: Tony Lindgren <tony@atomide.com>
Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	Brian Hutchinson <b.hutchman@gmail.com>
Subject: Re: [PATCH 4/4] ARM: dts: Add minimal support for dm8168-evm
Date: Tue, 3 Feb 2015 06:51:34 +0100	[thread overview]
Message-ID: <CAALWOA_6Lx1_MrDFwSe0hOiub3FxzrrCburQf=VWnXabKbjtmA@mail.gmail.com> (raw)
In-Reply-To: <20150202174416.GE9418@atomide.com>

On 2 February 2015 at 18:44, Tony Lindgren <tony@atomide.com> wrote:
> * Matthijs van Duin <matthijsvanduin@gmail.com> [150128 13:46]:
>> On 26 January 2015 at 16:58, Tony Lindgren <tony@atomide.com> wrote:
>> > I'm pretty sure I verified the that the audio_pll_clk1 is hardwwired
>> > to 32KiHz by looking at it with a scope on the clkout pin.
>>
>> Yeah it comes straight from the "rtcdivider" so it'll produce
>> 0.0016384 * devosc.
>
> Not much about "rtcdivider" in the dm816x TRM..
> [..]
> That seems to be in the dm814x TRM. OK so it looks like in
> mainline kernel drivers/clk/ti/fapll.c we can then fix the hardcoded
> value in ti_fapll_synth_recalc_rate() to return the rate of fd->clk_ref
> multiplied 0.0016384 instead of 32768.

Ah sorry, yes, for some reason I thought you meant the dm814x one...
(which makes no sense in retrospect)

It seems however the situation is actually similar on the dm816x since
the diagram of the audio FAPLL also shows clock 1 deriving directly
from devosc, and the associated audio frequency/divider 1 registers
read as zero. Presumably it was produced by the audio PLL in some
early design but replaced by a fixed synthesizer later on, later named
"rtcdivider" in the dm814x. Note that the multiplier 0.0016384 = 32768
/ 20e6 is for the dm814x, it'll be 32768 / 27e6 on the dm816x.

I think "audio 1" should be kept out of the fapll code entirely given
that it doesn't seem to be related to the audio FAPLL anymore in any
way other than in name.


I've also been looking at the rest of Netra's 32KiHz clock tree, but
the TRM is a real mess there, often contradicting both itself and the
TI kernel. As far as I can tell they agree on:

audio_1 = devosc * (32768 / 27e6);

audio_a = audio_1 / (CM_DPLL_APA_CLKSEL + 1);
rtc_fck = { clkin32, audio_a }[CM_DPLL_SYSCLK18_CLKSEL];

but the TRM seems to suggest the mux output is the "sec_clk32k"
specifically for the RTC while the signal I called "audio_a" here is
sysclk18 provided for debouncing and as timer option.  In contrast the
TI kernel considers the mux the only user of audio_a and its output
sysclk18.  It does also define a secure 32k but without parent or any
apparent users.

(The audio FAPLL description (1.10.3.1.4) also claims mux option 0
selects the synthesized 32k clock, but that contradicts all other
evidence so I will ignore that.)

I'm leaning more towards believing the TI kernel since on Centaurus
(all flavors) sysclk18 definitely comes from the mux. It adds a twist
however: PRCM's clkin32 doesn't come straight from the pin but PLLSS
inserts another mux which by default *also* feeds it the synthesized
32k:

rtcdivider = devosc * (32768 / 20e6);  // former audio 1
prcm_clkin32 = { rtcdivider, clkin32 }[PLLSS_SYSCLK18_CLKSRC];

sysclk18_a = rtcdivider / (CM_DPLL_RTCDIVA_CLKSEL + 1);
sysclk18 = { prcm_clkin32, sysclk18_a }[CM_DPLL_SYSCLK18_CLKSEL];

I confirmed the above on our board where clkin32 is not connected, so
I could "manually" toggle it using the internal pull up/down. This
also revealed that mux in PLLSS, unlike the PRCM one, is not
glitch-free but takes immediate effect. It also revealed the TRM's
statement that  "If newly selected clock is idle, a switchover never
occurs (previously selected clock continues to pass through the mux)"
is false. Switching sysclk18 to the idle clkin32 stopped timers fed by
it (including the "synctimer32k") and switching back also proved
impossible without toggling clkin32 or having PLLSS feed it the
rtcdivider clock. This may be the reason this (otherwise redundant)
mux exists in the first place.

Finally, Centaurus also has an internal ~32kHz RC osc as option for
the watchdog and on the 811x (also known as Jacinto 5 Eco) the clkin32
is upgraded from clock input to oscillator.

WARNING: multiple messages have this Message-ID (diff)
From: matthijsvanduin@gmail.com (Matthijs van Duin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/4] ARM: dts: Add minimal support for dm8168-evm
Date: Tue, 3 Feb 2015 06:51:34 +0100	[thread overview]
Message-ID: <CAALWOA_6Lx1_MrDFwSe0hOiub3FxzrrCburQf=VWnXabKbjtmA@mail.gmail.com> (raw)
In-Reply-To: <20150202174416.GE9418@atomide.com>

On 2 February 2015 at 18:44, Tony Lindgren <tony@atomide.com> wrote:
> * Matthijs van Duin <matthijsvanduin@gmail.com> [150128 13:46]:
>> On 26 January 2015 at 16:58, Tony Lindgren <tony@atomide.com> wrote:
>> > I'm pretty sure I verified the that the audio_pll_clk1 is hardwwired
>> > to 32KiHz by looking at it with a scope on the clkout pin.
>>
>> Yeah it comes straight from the "rtcdivider" so it'll produce
>> 0.0016384 * devosc.
>
> Not much about "rtcdivider" in the dm816x TRM..
> [..]
> That seems to be in the dm814x TRM. OK so it looks like in
> mainline kernel drivers/clk/ti/fapll.c we can then fix the hardcoded
> value in ti_fapll_synth_recalc_rate() to return the rate of fd->clk_ref
> multiplied 0.0016384 instead of 32768.

Ah sorry, yes, for some reason I thought you meant the dm814x one...
(which makes no sense in retrospect)

It seems however the situation is actually similar on the dm816x since
the diagram of the audio FAPLL also shows clock 1 deriving directly
from devosc, and the associated audio frequency/divider 1 registers
read as zero. Presumably it was produced by the audio PLL in some
early design but replaced by a fixed synthesizer later on, later named
"rtcdivider" in the dm814x. Note that the multiplier 0.0016384 = 32768
/ 20e6 is for the dm814x, it'll be 32768 / 27e6 on the dm816x.

I think "audio 1" should be kept out of the fapll code entirely given
that it doesn't seem to be related to the audio FAPLL anymore in any
way other than in name.


I've also been looking at the rest of Netra's 32KiHz clock tree, but
the TRM is a real mess there, often contradicting both itself and the
TI kernel. As far as I can tell they agree on:

audio_1 = devosc * (32768 / 27e6);

audio_a = audio_1 / (CM_DPLL_APA_CLKSEL + 1);
rtc_fck = { clkin32, audio_a }[CM_DPLL_SYSCLK18_CLKSEL];

but the TRM seems to suggest the mux output is the "sec_clk32k"
specifically for the RTC while the signal I called "audio_a" here is
sysclk18 provided for debouncing and as timer option.  In contrast the
TI kernel considers the mux the only user of audio_a and its output
sysclk18.  It does also define a secure 32k but without parent or any
apparent users.

(The audio FAPLL description (1.10.3.1.4) also claims mux option 0
selects the synthesized 32k clock, but that contradicts all other
evidence so I will ignore that.)

I'm leaning more towards believing the TI kernel since on Centaurus
(all flavors) sysclk18 definitely comes from the mux. It adds a twist
however: PRCM's clkin32 doesn't come straight from the pin but PLLSS
inserts another mux which by default *also* feeds it the synthesized
32k:

rtcdivider = devosc * (32768 / 20e6);  // former audio 1
prcm_clkin32 = { rtcdivider, clkin32 }[PLLSS_SYSCLK18_CLKSRC];

sysclk18_a = rtcdivider / (CM_DPLL_RTCDIVA_CLKSEL + 1);
sysclk18 = { prcm_clkin32, sysclk18_a }[CM_DPLL_SYSCLK18_CLKSEL];

I confirmed the above on our board where clkin32 is not connected, so
I could "manually" toggle it using the internal pull up/down. This
also revealed that mux in PLLSS, unlike the PRCM one, is not
glitch-free but takes immediate effect. It also revealed the TRM's
statement that  "If newly selected clock is idle, a switchover never
occurs (previously selected clock continues to pass through the mux)"
is false. Switching sysclk18 to the idle clkin32 stopped timers fed by
it (including the "synctimer32k") and switching back also proved
impossible without toggling clkin32 or having PLLSS feed it the
rtcdivider clock. This may be the reason this (otherwise redundant)
mux exists in the first place.

Finally, Centaurus also has an internal ~32kHz RC osc as option for
the watchdog and on the 811x (also known as Jacinto 5 Eco) the clkin32
is upgraded from clock input to oscillator.

  reply	other threads:[~2015-02-03  5:51 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-13 23:37 [PATCH 0/4] Device tree related changes to boot dm816x Tony Lindgren
2015-01-13 23:37 ` Tony Lindgren
2015-01-13 23:37 ` [PATCH 1/4] ARM: OMAP2+: Add board-generic.c entry for ti81xx Tony Lindgren
2015-01-13 23:37   ` Tony Lindgren
2015-01-14 13:51   ` Sergei Shtylyov
2015-01-14 13:51     ` Sergei Shtylyov
2015-01-15  0:07     ` Tony Lindgren
2015-01-15  0:07       ` Tony Lindgren
2015-01-19 19:18       ` Tony Lindgren
2015-01-19 19:18         ` Tony Lindgren
2015-01-19 20:42         ` Felipe Balbi
2015-01-19 20:42           ` Felipe Balbi
2015-01-19 21:05           ` Tony Lindgren
2015-01-19 21:05             ` Tony Lindgren
2015-01-19 21:10             ` Felipe Balbi
2015-01-19 21:10               ` Felipe Balbi
2015-01-13 23:37 ` [PATCH 2/4] ARM: dts: Add basic dm816x device tree configuration Tony Lindgren
2015-01-13 23:37   ` Tony Lindgren
2015-01-15 21:23   ` Suman Anna
2015-01-15 21:23     ` Suman Anna
2015-01-15 22:59     ` Tony Lindgren
2015-01-15 22:59       ` Tony Lindgren
2015-01-17 16:41       ` Tony Lindgren
2015-01-17 16:41         ` Tony Lindgren
2015-01-13 23:37 ` [PATCH 3/4] ARM: dts: Add basic clocks for dm816x Tony Lindgren
2015-01-13 23:37   ` Tony Lindgren
2015-01-13 23:37 ` [PATCH 4/4] ARM: dts: Add minimal support for dm8168-evm Tony Lindgren
2015-01-13 23:37   ` Tony Lindgren
2015-01-17 16:47   ` Tony Lindgren
2015-01-17 16:47     ` Tony Lindgren
2015-01-17 17:51     ` Matthijs van Duin
2015-01-17 17:51       ` Matthijs van Duin
2015-01-17 18:14       ` Tony Lindgren
2015-01-17 18:14         ` Tony Lindgren
2015-01-17 22:37         ` Matthijs van Duin
2015-01-17 22:37           ` Matthijs van Duin
2015-01-19 17:29           ` Tony Lindgren
2015-01-19 17:29             ` Tony Lindgren
2015-01-22  3:17             ` Matthijs van Duin
2015-01-22  3:17               ` Matthijs van Duin
2015-01-23 16:47               ` Tony Lindgren
2015-01-23 16:47                 ` Tony Lindgren
2015-01-25  8:34                 ` Matthijs van Duin
2015-01-25  8:34                   ` Matthijs van Duin
2015-01-26 15:58                   ` Tony Lindgren
2015-01-26 15:58                     ` Tony Lindgren
2015-01-28 21:43                     ` Matthijs van Duin
2015-01-28 21:43                       ` Matthijs van Duin
2015-02-02 17:44                       ` Tony Lindgren
2015-02-02 17:44                         ` Tony Lindgren
2015-02-03  5:51                         ` Matthijs van Duin [this message]
2015-02-03  5:51                           ` Matthijs van Duin
2015-01-28 17:04                 ` Tony Lindgren
2015-01-28 17:04                   ` Tony Lindgren
2015-02-01  1:51     ` Matthijs van Duin
2015-02-01  1:51       ` Matthijs van Duin
2015-02-02 16:09       ` Tony Lindgren
2015-02-02 16:09         ` Tony Lindgren
2015-03-18  0:06         ` Tony Lindgren
2015-03-18  0:06           ` Tony Lindgren
2015-03-18  8:32           ` Matthijs van Duin
2015-03-18  8:32             ` Matthijs van Duin
2015-03-18 16:54             ` Tony Lindgren
2015-03-18 16:54               ` Tony Lindgren
2015-03-19  5:13               ` Matthijs van Duin
2015-03-19  5:13                 ` Matthijs van Duin

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='CAALWOA_6Lx1_MrDFwSe0hOiub3FxzrrCburQf=VWnXabKbjtmA@mail.gmail.com' \
    --to=matthijsvanduin@gmail.com \
    --cc=b.hutchman@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=tony@atomide.com \
    /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.