From: Maxime Ripard <maxime.ripard@bootlin.com>
To: Philipp Rossak <embed3d@gmail.com>
Cc: Chen-Yu Tsai <wens@csie.org>,
Alessandro Zummo <a.zummo@towertech.it>,
alexandre.belloni@bootlin.com,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-sunxi <linux-sunxi@googlegroups.com>,
linux-rtc@vger.kernel.org,
Mike Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@codeaurora.org>
Subject: Re: [PATCH v3] rtc: ac100: Fix ac100 determine rate bug
Date: Mon, 19 Feb 2018 13:20:46 +0100 [thread overview]
Message-ID: <20180219122046.kap53tbui6av5irl@flea.lan> (raw)
In-Reply-To: <aae613df-f7d8-d9dd-306b-fcda2bbb770f@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 4245 bytes --]
On Sun, Feb 18, 2018 at 06:55:58PM +0100, Philipp Rossak wrote:
> On 16.02.2018 14:15, Chen-Yu Tsai wrote:
> > On Fri, Feb 16, 2018 at 9:07 PM, Maxime Ripard
> > <maxime.ripard@bootlin.com> wrote:
> > > On Fri, Feb 16, 2018 at 12:10:18PM +0800, Chen-Yu Tsai wrote:
> > > > > diff --git a/arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts
> > > > > b/arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts
> > > > > index 6550bf0e594b..6f56d429f17e 100644
> > > > > --- a/arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts
> > > > > +++ b/arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts
> > > > > @@ -175,11 +175,18 @@
> > > > > compatible = "x-powers,ac100-rtc";
> > > > > interrupt-parent = <&r_intc>;
> > > > > interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
> > > > > - clocks = <&ac100_codec>;
> > > > > + clocks = <&ac100_rtc_32k>;
> > > > > #clock-cells = <1>;
> > > > > clock-output-names = "cko1_rtc",
> > > > > "cko2_rtc",
> > > > > "cko3_rtc";
> > > > > +
> > > > > + ac100_rtc_32k: rtc-32k-oscillator {
> > > > > + compatible = "fixed-clock";
> > > > > + #clock-cells = <0>;
> > > > > + clock-frequency = <32768>;
> > > > > + clock-output-names = "ac100-rtc-32k";
> > > > > + };
> > > > > };
> > > > > };
> > > > > };
> > > > >
> > > > > What do you think about that solution?
> > > >
> > > > That's not quite right either. As I mentioned before, the
> > > > RTC block has two clock inputs, one 4MHz signal from the
> > > > codec block, and one 32.768 kHz signal from an external
> > > > crystal. The original device tree binding describes the
> > > > first one, and the 32.768 kHz clock was registered by
> > > > the RTC driver internally.
> > > >
> > > > If you're going to add the crystal clock, you still need
> > > > to keep the codec one. Note that this does not fix what
> > > > Maxime is asking you. I've already provided an explanation:
> > > >
> > > > The clock core allows registering clocks with not-yet-existing
> > > > clock parents. Parents are matches by string names. If no
> > > > clock by that name is registered yet, the clock core simply
> > > > orphans the new clock if the unregistered parent is its
> > > > current parent or simply ignores that parent if its not the
> > > > current parent. This is entirely valid and is what we are
> > > > counting on here, as we haven't implemented the codec-side
> > > > driver.
> > >
> > > So, we end up in a situation where clk_hw_get_num_parents returns the
> > > amount of clocks we can be parented to (orphans or not), but
> > > clk_hw_get_parent_by_index will not return the orphan clocks?
> >
> > There is no placeholder for missing parents, unlike the regulator
> > subsystem that has a dummy regulator for this purpose.
> >
> > > That's pretty bad :/
> >
> > Yeah. I didn't expect this to happen. But to be fair, I should
> > have done the check on clk_hw_get_parent_by_index.
> >
> > > Is there a way to test before registering that all our parents are
> > > actually there? clk_get?
> >
> > That's probably the way to do it. However in the AC100 RTC case,
> > I left it open to be missing on purpose, so we could use the RTC
> > without waiting for the codec to be supported.
> >
> > ChenYu
> >
>
> So how should we proceed with this issue?
>
> Should I send a new version with a fixed comment or should I implement the
> check in clk_get function?
>
> For the second option I will need about 3 weeks to submit a proper patch
> since I have the next two weeks some other stuff to do.
> If a proper fix is required earlier, it might be better if someone else is
> taking care about a fix.
A better comment will do.
Maxime
--
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2018-02-19 12:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-14 13:56 Philipp Rossak
2018-02-15 14:06 ` [linux-sunxi] " Julian Calaby
2018-02-15 14:11 ` Maxime Ripard
2018-02-15 17:53 ` Philipp Rossak
2018-02-16 4:10 ` Chen-Yu Tsai
2018-02-16 12:49 ` Philipp Rossak
2018-02-16 12:59 ` Chen-Yu Tsai
2018-02-16 13:53 ` Philipp Rossak
2018-02-16 13:07 ` Maxime Ripard
2018-02-16 13:15 ` Chen-Yu Tsai
2018-02-18 17:55 ` Philipp Rossak
2018-02-19 12:20 ` Maxime Ripard [this message]
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=20180219122046.kap53tbui6av5irl@flea.lan \
--to=maxime.ripard@bootlin.com \
--cc=a.zummo@towertech.it \
--cc=alexandre.belloni@bootlin.com \
--cc=embed3d@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=linux-sunxi@googlegroups.com \
--cc=mturquette@baylibre.com \
--cc=sboyd@codeaurora.org \
--cc=wens@csie.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®