From: laurent.pinchart@ideasonboard.com (Laurent Pinchart)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH RFC v3 2/2] clk: Add handling of clk parent and rate assigned from DT
Date: Tue, 01 Apr 2014 15:36:28 +0200 [thread overview]
Message-ID: <1915856.W2jCYOiLTu@avalon> (raw)
In-Reply-To: <20140331083210.GX24917@pengutronix.de>
Hi Sascha,
On Monday 31 March 2014 10:32:10 Sascha Hauer wrote:
> On Fri, Mar 28, 2014 at 05:44:17PM +0100, Laurent Pinchart wrote:
> > On Thursday 27 March 2014 15:47:12 Sascha Hauer wrote:
> > > On Thu, Mar 27, 2014 at 03:08:10PM +0100, Laurent Pinchart wrote:
> > [snip]
> >
> > > > That's clearer indeed. Can the parents and rates depend on the board,
> > > > or on the SoC only ? We might be getting dangerously close to
> > > > specifying platform configuration instead of describing the hardware.
> > > > A real example might be nice to support the discussion.
> > >
> > > This patch comes just at the right time. This is what I do with it:
> > >
> > > #define cko1_sel 57
> > > #define pll4_audio_div 203
> > > #define pll4_audio 173
> > > #define ssi3_sel 47
> > >
> > > &clks {
> > > assigned-clocks {
> > > clocks = <&clks cko1_sel>, <&clks ssi3_sel>, <&clks pll4_audio>;
> > > clock-parents = <&clks pll4_audio_div>, <&clks pll4_audio_div>,
<0>;
> > > clock-rates = <0>, <0>, <786432000>;
> > > };
> > > };
> > >
> > > cko1_sel is a clock that can be routed out of the SoC. In my case it is
> > > connected the sysclk of an external Audio Codec. ssi3_sel drives my SoC
> > > internal I2S unit which I use in master mode. The above makes sure that
> > > the I2S unit and the the external codec both get their clock from the
> > > audio PLL. The audio PLL is configured to a rate of 786432000Hz which
> > > is an exact multiple of the desired audio clock.
> >
> > Thank you for the example.
> >
> > Are the cko1_sel and ssi3_sel used only by the external audio codec and
> > internal I2S unit respectively ? If so, it might make sense to move the
> > configuration of their parent to the audio codec and I2S unit DT nodes.
> > However, grouping the parent configuration and the pll4 rate configuration
> > in a single place makes sense as well. Guidelines are probably needed.
>
> I didn't bother much to find the right place for the nodes. It indeed might
> make sense to put them under the I2S unit and the codec. However, the clock-
> rate is a shared property between the I2S unit and the codec which probably
> should better be placed under the block which provides the clocks.
>
> > I get a slight feeling of uneasiness about this, probably because we're at
> > the boundary between hardware description and system configuration.
> > Encoding in DT that "for this particular board this particular clock must
> > be configured this particular way" sounds fine to me, but we need to make
> > sure it won't turn to software-driven rather than hardware-driven use
> > case descriptions.
>
> I agree this is in the grey area between hardware and software description.
> At least on i.MX it happens with audio and video that totally unrelated
> units share a clock. Often it's next to impossible to find an algorithm that
> configures the clocks correctly without the help of hardcoded assumptions
> about parents and rates. I find specifying this in the devicetree much more
> convenient than writing board specific code each time.
I totally agree with you. The approach makes sense, I just wanted to point out
that this is a grey area and that we should be aware of it when designing the
DT bindings.
--
Regards,
Laurent Pinchart
WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
To: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: Sylwester Nawrocki
<s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
mark.rutland-5wv7dgnIgG8@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org,
gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org,
t.figa-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
sw0312.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org
Subject: Re: [PATCH RFC v3 2/2] clk: Add handling of clk parent and rate assigned from DT
Date: Tue, 01 Apr 2014 15:36:28 +0200 [thread overview]
Message-ID: <1915856.W2jCYOiLTu@avalon> (raw)
In-Reply-To: <20140331083210.GX24917-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Hi Sascha,
On Monday 31 March 2014 10:32:10 Sascha Hauer wrote:
> On Fri, Mar 28, 2014 at 05:44:17PM +0100, Laurent Pinchart wrote:
> > On Thursday 27 March 2014 15:47:12 Sascha Hauer wrote:
> > > On Thu, Mar 27, 2014 at 03:08:10PM +0100, Laurent Pinchart wrote:
> > [snip]
> >
> > > > That's clearer indeed. Can the parents and rates depend on the board,
> > > > or on the SoC only ? We might be getting dangerously close to
> > > > specifying platform configuration instead of describing the hardware.
> > > > A real example might be nice to support the discussion.
> > >
> > > This patch comes just at the right time. This is what I do with it:
> > >
> > > #define cko1_sel 57
> > > #define pll4_audio_div 203
> > > #define pll4_audio 173
> > > #define ssi3_sel 47
> > >
> > > &clks {
> > > assigned-clocks {
> > > clocks = <&clks cko1_sel>, <&clks ssi3_sel>, <&clks pll4_audio>;
> > > clock-parents = <&clks pll4_audio_div>, <&clks pll4_audio_div>,
<0>;
> > > clock-rates = <0>, <0>, <786432000>;
> > > };
> > > };
> > >
> > > cko1_sel is a clock that can be routed out of the SoC. In my case it is
> > > connected the sysclk of an external Audio Codec. ssi3_sel drives my SoC
> > > internal I2S unit which I use in master mode. The above makes sure that
> > > the I2S unit and the the external codec both get their clock from the
> > > audio PLL. The audio PLL is configured to a rate of 786432000Hz which
> > > is an exact multiple of the desired audio clock.
> >
> > Thank you for the example.
> >
> > Are the cko1_sel and ssi3_sel used only by the external audio codec and
> > internal I2S unit respectively ? If so, it might make sense to move the
> > configuration of their parent to the audio codec and I2S unit DT nodes.
> > However, grouping the parent configuration and the pll4 rate configuration
> > in a single place makes sense as well. Guidelines are probably needed.
>
> I didn't bother much to find the right place for the nodes. It indeed might
> make sense to put them under the I2S unit and the codec. However, the clock-
> rate is a shared property between the I2S unit and the codec which probably
> should better be placed under the block which provides the clocks.
>
> > I get a slight feeling of uneasiness about this, probably because we're at
> > the boundary between hardware description and system configuration.
> > Encoding in DT that "for this particular board this particular clock must
> > be configured this particular way" sounds fine to me, but we need to make
> > sure it won't turn to software-driven rather than hardware-driven use
> > case descriptions.
>
> I agree this is in the grey area between hardware and software description.
> At least on i.MX it happens with audio and video that totally unrelated
> units share a clock. Often it's next to impossible to find an algorithm that
> configures the clocks correctly without the help of hardcoded assumptions
> about parents and rates. I find specifying this in the devicetree much more
> convenient than writing board specific code each time.
I totally agree with you. The approach makes sense, I just wanted to point out
that this is a grey area and that we should be aware of it when designing the
DT bindings.
--
Regards,
Laurent Pinchart
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>,
linux-arm-kernel@lists.infradead.org, mturquette@linaro.org,
mark.rutland@arm.com, devicetree@vger.kernel.org,
linux@arm.linux.org.uk, gregkh@linuxfoundation.org,
t.figa@samsung.com, sw0312.kim@samsung.com,
linux-kernel@vger.kernel.org, kyungmin.park@samsung.com,
robh+dt@kernel.org, galak@codeaurora.org,
grant.likely@linaro.org, m.szyprowski@samsung.com
Subject: Re: [PATCH RFC v3 2/2] clk: Add handling of clk parent and rate assigned from DT
Date: Tue, 01 Apr 2014 15:36:28 +0200 [thread overview]
Message-ID: <1915856.W2jCYOiLTu@avalon> (raw)
In-Reply-To: <20140331083210.GX24917@pengutronix.de>
Hi Sascha,
On Monday 31 March 2014 10:32:10 Sascha Hauer wrote:
> On Fri, Mar 28, 2014 at 05:44:17PM +0100, Laurent Pinchart wrote:
> > On Thursday 27 March 2014 15:47:12 Sascha Hauer wrote:
> > > On Thu, Mar 27, 2014 at 03:08:10PM +0100, Laurent Pinchart wrote:
> > [snip]
> >
> > > > That's clearer indeed. Can the parents and rates depend on the board,
> > > > or on the SoC only ? We might be getting dangerously close to
> > > > specifying platform configuration instead of describing the hardware.
> > > > A real example might be nice to support the discussion.
> > >
> > > This patch comes just at the right time. This is what I do with it:
> > >
> > > #define cko1_sel 57
> > > #define pll4_audio_div 203
> > > #define pll4_audio 173
> > > #define ssi3_sel 47
> > >
> > > &clks {
> > > assigned-clocks {
> > > clocks = <&clks cko1_sel>, <&clks ssi3_sel>, <&clks pll4_audio>;
> > > clock-parents = <&clks pll4_audio_div>, <&clks pll4_audio_div>,
<0>;
> > > clock-rates = <0>, <0>, <786432000>;
> > > };
> > > };
> > >
> > > cko1_sel is a clock that can be routed out of the SoC. In my case it is
> > > connected the sysclk of an external Audio Codec. ssi3_sel drives my SoC
> > > internal I2S unit which I use in master mode. The above makes sure that
> > > the I2S unit and the the external codec both get their clock from the
> > > audio PLL. The audio PLL is configured to a rate of 786432000Hz which
> > > is an exact multiple of the desired audio clock.
> >
> > Thank you for the example.
> >
> > Are the cko1_sel and ssi3_sel used only by the external audio codec and
> > internal I2S unit respectively ? If so, it might make sense to move the
> > configuration of their parent to the audio codec and I2S unit DT nodes.
> > However, grouping the parent configuration and the pll4 rate configuration
> > in a single place makes sense as well. Guidelines are probably needed.
>
> I didn't bother much to find the right place for the nodes. It indeed might
> make sense to put them under the I2S unit and the codec. However, the clock-
> rate is a shared property between the I2S unit and the codec which probably
> should better be placed under the block which provides the clocks.
>
> > I get a slight feeling of uneasiness about this, probably because we're at
> > the boundary between hardware description and system configuration.
> > Encoding in DT that "for this particular board this particular clock must
> > be configured this particular way" sounds fine to me, but we need to make
> > sure it won't turn to software-driven rather than hardware-driven use
> > case descriptions.
>
> I agree this is in the grey area between hardware and software description.
> At least on i.MX it happens with audio and video that totally unrelated
> units share a clock. Often it's next to impossible to find an algorithm that
> configures the clocks correctly without the help of hardcoded assumptions
> about parents and rates. I find specifying this in the devicetree much more
> convenient than writing board specific code each time.
I totally agree with you. The approach makes sense, I just wanted to point out
that this is a grey area and that we should be aware of it when designing the
DT bindings.
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2014-04-01 13:36 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-27 12:16 [PATCH RFC v3 0/2] clk: Support for DT assigned clock parents and rates Sylwester Nawrocki
2014-03-27 12:16 ` Sylwester Nawrocki
2014-03-27 12:16 ` Sylwester Nawrocki
2014-03-27 12:16 ` [PATCH RFC v3 1/2] clk: Add function parsing arbitrary clock list DT property Sylwester Nawrocki
2014-03-27 12:16 ` Sylwester Nawrocki
2014-03-27 12:16 ` Sylwester Nawrocki
2014-03-27 17:17 ` Bartlomiej Zolnierkiewicz
2014-03-27 17:17 ` Bartlomiej Zolnierkiewicz
2014-03-27 17:17 ` Bartlomiej Zolnierkiewicz
2014-03-27 18:02 ` Sylwester Nawrocki
2014-03-27 18:02 ` Sylwester Nawrocki
2014-03-27 18:02 ` Sylwester Nawrocki
2014-03-27 12:16 ` [PATCH RFC v3 2/2] clk: Add handling of clk parent and rate assigned from DT Sylwester Nawrocki
2014-03-27 12:16 ` Sylwester Nawrocki
2014-03-27 12:16 ` Sylwester Nawrocki
2014-03-27 13:24 ` Laurent Pinchart
2014-03-27 13:24 ` Laurent Pinchart
2014-03-27 13:24 ` Laurent Pinchart
2014-03-27 13:57 ` Sylwester Nawrocki
2014-03-27 13:57 ` Sylwester Nawrocki
2014-03-27 13:57 ` Sylwester Nawrocki
2014-03-27 14:08 ` Laurent Pinchart
2014-03-27 14:08 ` Laurent Pinchart
2014-03-27 14:08 ` Laurent Pinchart
2014-03-27 14:47 ` Sascha Hauer
2014-03-27 14:47 ` Sascha Hauer
2014-03-27 14:47 ` Sascha Hauer
2014-03-28 16:44 ` Laurent Pinchart
2014-03-28 16:44 ` Laurent Pinchart
2014-03-28 16:44 ` Laurent Pinchart
2014-03-31 8:32 ` Sascha Hauer
2014-03-31 8:32 ` Sascha Hauer
2014-03-31 8:32 ` Sascha Hauer
2014-04-01 13:36 ` Laurent Pinchart [this message]
2014-04-01 13:36 ` Laurent Pinchart
2014-04-01 13:36 ` Laurent Pinchart
2014-03-27 15:02 ` Sylwester Nawrocki
2014-03-27 15:02 ` Sylwester Nawrocki
2014-03-27 15:02 ` Sylwester Nawrocki
2014-03-28 16:49 ` Laurent Pinchart
2014-03-28 16:49 ` Laurent Pinchart
2014-03-28 16:49 ` Laurent Pinchart
2014-03-31 11:40 ` Sylwester Nawrocki
2014-03-31 11:40 ` Sylwester Nawrocki
2014-03-27 17:19 ` Bartlomiej Zolnierkiewicz
2014-03-27 17:19 ` Bartlomiej Zolnierkiewicz
2014-03-27 17:19 ` Bartlomiej Zolnierkiewicz
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=1915856.W2jCYOiLTu@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.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.