From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH/RFC] serial: sh-sci: Add device tree support for r8a7779
Date: Fri, 25 Apr 2014 07:05:50 +0000 [thread overview]
Message-ID: <1922942.7jvlviEDpf@avalon> (raw)
In-Reply-To: <20140425002641.GB31164@verge.net.au>
Hi Simon,
On Friday 25 April 2014 09:26:42 Simon Horman wrote:
> On Fri, Apr 25, 2014 at 01:33:29AM +0200, Laurent Pinchart wrote:
> > Hi Simon,
> >
> > Thank you for the patch.
> >
> > On Thursday 24 April 2014 15:54:44 Simon Horman wrote:
> > > According to the platform data for the legacy-C initialisation of sh-sci
> > > for the r8a7779 SoC and my own testing the SCIx_SH4_SCIF_REGTYPE bit of
> > > scscr needs to be set.
> > >
> > > Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> > >
> > > ---
> > >
> > > With the approach taken by this patch sh-sci may be initialised using
> > > the "renesas,scif-r8a7779" compat string but not the generic
> > > "renesas,scif" compat string. An alternate approach would be to add a
> > > binding to allow setting of this bit to be controlled directly from DT.
> >
> > Handling the SCSCR bits properly with DT has been on my to-do list for
> > some time. Thank you for volunteering to implement that :-D
> >
> > The CKE bits control both the behaviour of the SCK pin and the SCIF input
> > clock selection. The SCIF can use various internal and external clocks,
> > with up to two baud rate generators (programmable dividers) chained.
> > Whether the SoC is provided with an external clock for its serial ports
> > is a board property, not an SoC property. I would thus like to implement
> > support for this feature properly and avoid hardcoding the CKE bits like
> > done below.
> >
> > The Marzen board has an external clock generator connected to the SCIF_SCK
> > pin that can be used as a clock source, but I don't really see a reason
> > why we couldn't use the internal P clock instead. I don't want to delay
> > integration of SCIF DT support until we have a proper solution to handle
> > clock configuration, but couldn't we use the internal P clock on the
> > Marzen board in the meantime ?
>
> I think that approach sounds reasonable and I seem to have it working
> without any driver changes. Could you confirm that the following
> DT snippet is what you have in mind? (I intend to update it as per any
> relevant changes you make when reposting your DT sci patch for the
> r8a7791.)
That's what I have in mind, but please see below for a small comment.
> diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
> index e924f96..3e9cca4 100644
> --- a/arch/arm/boot/dts/r8a7779.dtsi
> +++ b/arch/arm/boot/dts/r8a7779.dtsi
> @@ -203,6 +203,66 @@
> status = "disabled";
> };
>
> + scif0: serial@ffe40000 {
> + compatible = "renesas,scif", "renesas,scif-r8a7779";
> + reg = <0xffe40000 265>;
> + interrupt-parent = <&gic>;
> + interrupts = <0 88 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&cpg_clocks R8A7779_CLK_P>;
> + clock-names = "sci_ick";
Clock handling in the sh-sci driver should probably be improved. The driver
currently requires an "sci_ick" interface clock and supports an optional
"sci_fck" functional clock. In practice, as far as I can see, platforms that
provide both sci_ick and sci_fck set the two clocks to the same source.
Furthermore, some SCI* instances support a second internal clock source for
the baud rate generator. We don't support that at the moment.
This leads me to believe that we should merge the "sci_ick" and "sci_fck"
clocks for the DT case into a single clock that I would call "fck" (no need
for a "sci_" prefix), and later add support for the second baud rate clock.
This would require a small driver change. I can try to submit patches in the
next couple of days if you agree with the approach.
> + status = "disabled";
> + };
> +
> + scif1: serial@ffe41000 {
> + compatible = "renesas,scif", "renesas,scif-r8a7779";
> + reg = <0xffe41000 265>;
> + interrupt-parent = <&gic>;
> + interrupts = <0 89 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&cpg_clocks R8A7779_CLK_P>;
> + clock-names = "sci_ick";
> + status = "disabled";
> + };
> +
> + scif2: serial@ffe42000 {
> + compatible = "renesas,scif", "renesas,scif-r8a7779";
> + reg = <0xffe42000 265>;
> + interrupt-parent = <&gic>;
> + interrupts = <0 90 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&cpg_clocks R8A7779_CLK_P>;
> + clock-names = "sci_ick";
> + status = "disabled";
> + };
> +
> + scif3: serial@ffe43000 {
> + compatible = "renesas,scif", "renesas,scif-r8a7779";
> + reg = <0xffe43000 265>;
> + interrupt-parent = <&gic>;
> + interrupts = <0 91 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&cpg_clocks R8A7779_CLK_P>;
> + clock-names = "sci_ick";
> + status = "disabled";
> + };
> +
> + scif4: serial@ffe44000 {
> + compatible = "renesas,scif", "renesas,scif-r8a7779";
> + reg = <0xffe44000 265>;
> + interrupt-parent = <&gic>;
> + interrupts = <0 92 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&cpg_clocks R8A7779_CLK_P>;
> + clock-names = "sci_ick";
> + status = "disabled";
> + };
> +
> + scif5: serial@ffe45000 {
> + compatible = "renesas,scif", "renesas,scif-r8a7779";
> + reg = <0xffe45000 265>;
> + interrupt-parent = <&gic>;
> + interrupts = <0 93 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&cpg_clocks R8A7779_CLK_P>;
> + clock-names = "sci_ick";
> + status = "disabled";
> + };
> +
> pfc: pfc@fffc0000 {
> compatible = "renesas,pfc-r8a7779";
> reg = <0xfffc0000 0x23c>;
--
Regards,
Laurent Pinchart
WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Simon Horman <horms@verge.net.au>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-serial@vger.kernel.org,
Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
Magnus Damm <magnus.damm@gmail.com>,
linux-sh@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH/RFC] serial: sh-sci: Add device tree support for r8a7779
Date: Fri, 25 Apr 2014 09:05:50 +0200 [thread overview]
Message-ID: <1922942.7jvlviEDpf@avalon> (raw)
In-Reply-To: <20140425002641.GB31164@verge.net.au>
Hi Simon,
On Friday 25 April 2014 09:26:42 Simon Horman wrote:
> On Fri, Apr 25, 2014 at 01:33:29AM +0200, Laurent Pinchart wrote:
> > Hi Simon,
> >
> > Thank you for the patch.
> >
> > On Thursday 24 April 2014 15:54:44 Simon Horman wrote:
> > > According to the platform data for the legacy-C initialisation of sh-sci
> > > for the r8a7779 SoC and my own testing the SCIx_SH4_SCIF_REGTYPE bit of
> > > scscr needs to be set.
> > >
> > > Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> > >
> > > ---
> > >
> > > With the approach taken by this patch sh-sci may be initialised using
> > > the "renesas,scif-r8a7779" compat string but not the generic
> > > "renesas,scif" compat string. An alternate approach would be to add a
> > > binding to allow setting of this bit to be controlled directly from DT.
> >
> > Handling the SCSCR bits properly with DT has been on my to-do list for
> > some time. Thank you for volunteering to implement that :-D
> >
> > The CKE bits control both the behaviour of the SCK pin and the SCIF input
> > clock selection. The SCIF can use various internal and external clocks,
> > with up to two baud rate generators (programmable dividers) chained.
> > Whether the SoC is provided with an external clock for its serial ports
> > is a board property, not an SoC property. I would thus like to implement
> > support for this feature properly and avoid hardcoding the CKE bits like
> > done below.
> >
> > The Marzen board has an external clock generator connected to the SCIF_SCK
> > pin that can be used as a clock source, but I don't really see a reason
> > why we couldn't use the internal P clock instead. I don't want to delay
> > integration of SCIF DT support until we have a proper solution to handle
> > clock configuration, but couldn't we use the internal P clock on the
> > Marzen board in the meantime ?
>
> I think that approach sounds reasonable and I seem to have it working
> without any driver changes. Could you confirm that the following
> DT snippet is what you have in mind? (I intend to update it as per any
> relevant changes you make when reposting your DT sci patch for the
> r8a7791.)
That's what I have in mind, but please see below for a small comment.
> diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
> index e924f96..3e9cca4 100644
> --- a/arch/arm/boot/dts/r8a7779.dtsi
> +++ b/arch/arm/boot/dts/r8a7779.dtsi
> @@ -203,6 +203,66 @@
> status = "disabled";
> };
>
> + scif0: serial@ffe40000 {
> + compatible = "renesas,scif", "renesas,scif-r8a7779";
> + reg = <0xffe40000 265>;
> + interrupt-parent = <&gic>;
> + interrupts = <0 88 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&cpg_clocks R8A7779_CLK_P>;
> + clock-names = "sci_ick";
Clock handling in the sh-sci driver should probably be improved. The driver
currently requires an "sci_ick" interface clock and supports an optional
"sci_fck" functional clock. In practice, as far as I can see, platforms that
provide both sci_ick and sci_fck set the two clocks to the same source.
Furthermore, some SCI* instances support a second internal clock source for
the baud rate generator. We don't support that at the moment.
This leads me to believe that we should merge the "sci_ick" and "sci_fck"
clocks for the DT case into a single clock that I would call "fck" (no need
for a "sci_" prefix), and later add support for the second baud rate clock.
This would require a small driver change. I can try to submit patches in the
next couple of days if you agree with the approach.
> + status = "disabled";
> + };
> +
> + scif1: serial@ffe41000 {
> + compatible = "renesas,scif", "renesas,scif-r8a7779";
> + reg = <0xffe41000 265>;
> + interrupt-parent = <&gic>;
> + interrupts = <0 89 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&cpg_clocks R8A7779_CLK_P>;
> + clock-names = "sci_ick";
> + status = "disabled";
> + };
> +
> + scif2: serial@ffe42000 {
> + compatible = "renesas,scif", "renesas,scif-r8a7779";
> + reg = <0xffe42000 265>;
> + interrupt-parent = <&gic>;
> + interrupts = <0 90 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&cpg_clocks R8A7779_CLK_P>;
> + clock-names = "sci_ick";
> + status = "disabled";
> + };
> +
> + scif3: serial@ffe43000 {
> + compatible = "renesas,scif", "renesas,scif-r8a7779";
> + reg = <0xffe43000 265>;
> + interrupt-parent = <&gic>;
> + interrupts = <0 91 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&cpg_clocks R8A7779_CLK_P>;
> + clock-names = "sci_ick";
> + status = "disabled";
> + };
> +
> + scif4: serial@ffe44000 {
> + compatible = "renesas,scif", "renesas,scif-r8a7779";
> + reg = <0xffe44000 265>;
> + interrupt-parent = <&gic>;
> + interrupts = <0 92 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&cpg_clocks R8A7779_CLK_P>;
> + clock-names = "sci_ick";
> + status = "disabled";
> + };
> +
> + scif5: serial@ffe45000 {
> + compatible = "renesas,scif", "renesas,scif-r8a7779";
> + reg = <0xffe45000 265>;
> + interrupt-parent = <&gic>;
> + interrupts = <0 93 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&cpg_clocks R8A7779_CLK_P>;
> + clock-names = "sci_ick";
> + status = "disabled";
> + };
> +
> pfc: pfc@fffc0000 {
> compatible = "renesas,pfc-r8a7779";
> reg = <0xfffc0000 0x23c>;
--
Regards,
Laurent Pinchart
WARNING: multiple messages have this Message-ID (diff)
From: laurent.pinchart@ideasonboard.com (Laurent Pinchart)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH/RFC] serial: sh-sci: Add device tree support for r8a7779
Date: Fri, 25 Apr 2014 09:05:50 +0200 [thread overview]
Message-ID: <1922942.7jvlviEDpf@avalon> (raw)
In-Reply-To: <20140425002641.GB31164@verge.net.au>
Hi Simon,
On Friday 25 April 2014 09:26:42 Simon Horman wrote:
> On Fri, Apr 25, 2014 at 01:33:29AM +0200, Laurent Pinchart wrote:
> > Hi Simon,
> >
> > Thank you for the patch.
> >
> > On Thursday 24 April 2014 15:54:44 Simon Horman wrote:
> > > According to the platform data for the legacy-C initialisation of sh-sci
> > > for the r8a7779 SoC and my own testing the SCIx_SH4_SCIF_REGTYPE bit of
> > > scscr needs to be set.
> > >
> > > Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> > >
> > > ---
> > >
> > > With the approach taken by this patch sh-sci may be initialised using
> > > the "renesas,scif-r8a7779" compat string but not the generic
> > > "renesas,scif" compat string. An alternate approach would be to add a
> > > binding to allow setting of this bit to be controlled directly from DT.
> >
> > Handling the SCSCR bits properly with DT has been on my to-do list for
> > some time. Thank you for volunteering to implement that :-D
> >
> > The CKE bits control both the behaviour of the SCK pin and the SCIF input
> > clock selection. The SCIF can use various internal and external clocks,
> > with up to two baud rate generators (programmable dividers) chained.
> > Whether the SoC is provided with an external clock for its serial ports
> > is a board property, not an SoC property. I would thus like to implement
> > support for this feature properly and avoid hardcoding the CKE bits like
> > done below.
> >
> > The Marzen board has an external clock generator connected to the SCIF_SCK
> > pin that can be used as a clock source, but I don't really see a reason
> > why we couldn't use the internal P clock instead. I don't want to delay
> > integration of SCIF DT support until we have a proper solution to handle
> > clock configuration, but couldn't we use the internal P clock on the
> > Marzen board in the meantime ?
>
> I think that approach sounds reasonable and I seem to have it working
> without any driver changes. Could you confirm that the following
> DT snippet is what you have in mind? (I intend to update it as per any
> relevant changes you make when reposting your DT sci patch for the
> r8a7791.)
That's what I have in mind, but please see below for a small comment.
> diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
> index e924f96..3e9cca4 100644
> --- a/arch/arm/boot/dts/r8a7779.dtsi
> +++ b/arch/arm/boot/dts/r8a7779.dtsi
> @@ -203,6 +203,66 @@
> status = "disabled";
> };
>
> + scif0: serial at ffe40000 {
> + compatible = "renesas,scif", "renesas,scif-r8a7779";
> + reg = <0xffe40000 265>;
> + interrupt-parent = <&gic>;
> + interrupts = <0 88 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&cpg_clocks R8A7779_CLK_P>;
> + clock-names = "sci_ick";
Clock handling in the sh-sci driver should probably be improved. The driver
currently requires an "sci_ick" interface clock and supports an optional
"sci_fck" functional clock. In practice, as far as I can see, platforms that
provide both sci_ick and sci_fck set the two clocks to the same source.
Furthermore, some SCI* instances support a second internal clock source for
the baud rate generator. We don't support that at the moment.
This leads me to believe that we should merge the "sci_ick" and "sci_fck"
clocks for the DT case into a single clock that I would call "fck" (no need
for a "sci_" prefix), and later add support for the second baud rate clock.
This would require a small driver change. I can try to submit patches in the
next couple of days if you agree with the approach.
> + status = "disabled";
> + };
> +
> + scif1: serial at ffe41000 {
> + compatible = "renesas,scif", "renesas,scif-r8a7779";
> + reg = <0xffe41000 265>;
> + interrupt-parent = <&gic>;
> + interrupts = <0 89 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&cpg_clocks R8A7779_CLK_P>;
> + clock-names = "sci_ick";
> + status = "disabled";
> + };
> +
> + scif2: serial at ffe42000 {
> + compatible = "renesas,scif", "renesas,scif-r8a7779";
> + reg = <0xffe42000 265>;
> + interrupt-parent = <&gic>;
> + interrupts = <0 90 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&cpg_clocks R8A7779_CLK_P>;
> + clock-names = "sci_ick";
> + status = "disabled";
> + };
> +
> + scif3: serial at ffe43000 {
> + compatible = "renesas,scif", "renesas,scif-r8a7779";
> + reg = <0xffe43000 265>;
> + interrupt-parent = <&gic>;
> + interrupts = <0 91 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&cpg_clocks R8A7779_CLK_P>;
> + clock-names = "sci_ick";
> + status = "disabled";
> + };
> +
> + scif4: serial at ffe44000 {
> + compatible = "renesas,scif", "renesas,scif-r8a7779";
> + reg = <0xffe44000 265>;
> + interrupt-parent = <&gic>;
> + interrupts = <0 92 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&cpg_clocks R8A7779_CLK_P>;
> + clock-names = "sci_ick";
> + status = "disabled";
> + };
> +
> + scif5: serial at ffe45000 {
> + compatible = "renesas,scif", "renesas,scif-r8a7779";
> + reg = <0xffe45000 265>;
> + interrupt-parent = <&gic>;
> + interrupts = <0 93 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&cpg_clocks R8A7779_CLK_P>;
> + clock-names = "sci_ick";
> + status = "disabled";
> + };
> +
> pfc: pfc at fffc0000 {
> compatible = "renesas,pfc-r8a7779";
> reg = <0xfffc0000 0x23c>;
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2014-04-25 7:05 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-24 6:54 [PATCH/RFC] serial: sh-sci: Add device tree support for r8a7779 Simon Horman
2014-04-24 6:54 ` Simon Horman
2014-04-24 6:54 ` Simon Horman
2014-04-24 23:33 ` Laurent Pinchart
2014-04-24 23:33 ` Laurent Pinchart
2014-04-24 23:33 ` Laurent Pinchart
2014-04-25 0:26 ` Simon Horman
2014-04-25 0:26 ` Simon Horman
2014-04-25 0:26 ` Simon Horman
2014-04-25 7:05 ` Laurent Pinchart [this message]
2014-04-25 7:05 ` Laurent Pinchart
2014-04-25 7:05 ` Laurent Pinchart
2014-04-25 7:11 ` Geert Uytterhoeven
2014-04-25 7:11 ` Geert Uytterhoeven
2014-04-25 7:11 ` Geert Uytterhoeven
2014-04-28 0:03 ` Simon Horman
2014-04-28 0:03 ` Simon Horman
2014-04-28 0:03 ` Simon Horman
2014-04-28 0:08 ` Laurent Pinchart
2014-04-28 0:08 ` Laurent Pinchart
2014-04-28 0:08 ` Laurent Pinchart
2014-04-28 1:13 ` Simon Horman
2014-04-28 1:13 ` Simon Horman
2014-04-28 1:13 ` Simon Horman
2014-04-28 7:07 ` Simon Horman
2014-04-28 7:07 ` Simon Horman
2014-04-28 7:07 ` Simon Horman
2014-04-29 13:44 ` Laurent Pinchart
2014-04-29 13:44 ` Laurent Pinchart
2014-04-29 13:44 ` Laurent Pinchart
2014-04-29 21:48 ` Simon Horman
2014-04-29 21:48 ` Simon Horman
2014-04-29 21:48 ` Simon Horman
2014-04-30 0:59 ` Laurent Pinchart
2014-04-30 0:59 ` Laurent Pinchart
2014-04-30 0:59 ` Laurent Pinchart
2014-04-30 1:45 ` Simon Horman
2014-04-30 1:45 ` Simon Horman
2014-04-30 1:45 ` Simon Horman
2014-07-02 4:19 ` [PATCH/RFC] serial: sh-sci: Add device tree support for r8a7778 Simon Horman
2014-07-02 4:19 ` Simon Horman
2014-07-02 4:19 ` Simon Horman
2014-07-02 8:01 ` Laurent Pinchart
2014-07-02 8:01 ` Laurent Pinchart
2014-07-02 8:01 ` Laurent Pinchart
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=1922942.7jvlviEDpf@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.