All of lore.kernel.org
 help / color / mirror / Atom feed
From: Biju Das <biju.das.jz@bp.renesas.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
	Stephen Boyd <swboyd@chromium.org>,
	"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
	Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	"linux-renesas-soc@vger.kernel.org" 
	<linux-renesas-soc@vger.kernel.org>,
	Linux-sh list <linux-sh@vger.kernel.org>
Subject: RE: [PATCH] tty: serial: sh-sci: Fix transmit end interrupt handler
Date: Fri, 17 Mar 2023 13:47:24 +0000	[thread overview]
Message-ID: <OS0PR01MB59220E5FA2CDC27108DB926C86BD9@OS0PR01MB5922.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <CAMuHMdW5jpnFBsHPbTE9QEbEYUNW9S0Qz93gg3QusLe0aSSbGg@mail.gmail.com>

Hi Geert,

Thanks for the feedback.

> Subject: Re: [PATCH] tty: serial: sh-sci: Fix transmit end interrupt handler
> 
> Hi Biju,
> 
> CC linux-sh
> 
> On Fri, Mar 17, 2023 at 10:15 AM Biju Das <biju.das.jz@bp.renesas.com>
> wrote:
> > > Subject: Re: [PATCH] tty: serial: sh-sci: Fix transmit end interrupt
> > > handler On Fri, Mar 17, 2023 at 9:08 AM Biju Das
> <biju.das.jz@bp.renesas.com> wrote:
> > > > > Subject: Re: [PATCH] tty: serial: sh-sci: Fix transmit end
> > > > > interrupt handler On Fri, Mar 17, 2023 at 8:59 AM Biju Das
> > > <biju.das.jz@bp.renesas.com> wrote:
> > > > > > > Subject: Re: [PATCH] tty: serial: sh-sci: Fix transmit end
> > > > > > > interrupt handler On Thu, Mar 16, 2023 at 5:34 PM Biju Das
> > > > > <biju.das.jz@bp.renesas.com> wrote:
> > > > > > > > > Subject: Re: [PATCH] tty: serial: sh-sci: Fix transmit
> > > > > > > > > end interrupt handler
> > > > > > >
> > > > > > > > > On Thu, Mar 16, 2023 at 5:01 PM Biju Das
> > > > > > > > > <biju.das.jz@bp.renesas.com>
> > > > > > > wrote:
> > > > > > > > > > The RZ SCI/ RZ/A1 SCIF has only 4 interrupts. The
> > > > > > > > > > fourth interrupt is transmit end interrupt, so shuffle
> > > > > > > > > > the interrupts to fix the transmit end interrupt
> > > > > > > > > > handler for these
> > > IPs.
> > > > > > > > > >
> > > > > > > > > > Fixes: 392fb8df528b ("serial: sh-sci: Use
> > > > > > > > > > platform_get_irq_optional() for optional interrupts")
> > > > > > > > >
> > > > > > > > > I don't think that's the right bad commit.
> > > > > > > >
> > > > > > > > OK. I will use below commit as fixes one, that is the
> > > > > > > > commit which added RZ/A1 SCIF with 4 interrupts.
> > > > > > > >
> > > > > > > > commit 8b0bbd956228ae87 ("serial: sh-sci: Add support for
> > > > > > > > R7S9210")
> > > > > > >
> > > > > > > That one added support for RZ/A2, and is also not the bad
> commit?
> > > > > >
> > > > > > OK will use below one,
> > > > > >
> > > > > > Fixes: 4c84c1b3acca ("ARM: shmobile: r7s72100: add scif nodes
> > > > > > to
> > > > > > dtsi")
> > > > >
> > > > > This really starts to look like a guessing game... Beep ;-)
> > > >
> > > > Already there is a generic compatible in driver, where we started
> > > > introducing RZ/A1 SoC With 4 interrupts. So addition of this SoC
> > > > has this
> > > issue. Am I missing anything here?
> > >
> > > The rabbit hole seems to be deeper than I thought...
> > >
> > > Looking at the code, the driver always assumed the fourth interrupt
> > > is BRI, which matches the RZ/A1 datasheet for SCIF.
> > > So the 4 IRQ case is really a subset of the 6 IRQ case, and
> > > Documentation/devicetree/bindings/serial/renesas,scif.yaml
> > > is wrong.
> >
> > OK.
> >
> > >
> > > However, SCI(g) is the odd one (also on SH): it has TEI as the
> > > fourth IRQ, which I probably missed when doing the json-schema
> > > conversion in commit 384d00fae8e51f8f ("dt-bindings: serial: sh-sci:
> > > Convert to json-schema"), leading to the bug in scif.yaml.
> > >
> > > Note that the driver never looks at the interrupt names, but uses
> > > indices exclusively.
> > >
> > > So I guess SCI has been broken on SH since forever, too?
> >
> > I think so, by looking at the changes done in tx to make it work on
> RZ/G2UL.
> > On RZ/G2UL both rx and tx is broken.
> >
> > Not sure SCI is tested ever on SH platform??
> >
> > Can any SH platform person confirm this?
> 
> SCI is only supported on
>   - sh770x,
>   - sh7750 (excluding rts7751r2d)
>     I know it's not exposed on my landisk,
>   - sh7760, for the SIM-port, which I doubt anyone uses.
> 
> FTR, I tried the "obvious" thing (remove the rts7751r2d-checks in
> arch/sh/kernel/cpu/sh4/setup-sh7750.c, and replace sci_br_interrupt as the
> interrupt handler by sci_tx_interrupt in sh-sci.c), but that didn't make
> ttySC0 work on qemu/rts7751r2d.

I am not seeing any SH platform SoCs in[1] and RZ/A2 does not have any SCI nodes
defined in dts, 

So Shall I use the below fixes tag instead, as it is documented in dt bindings and is the first
SoC with broken irq handler??

Fixes: f9a2adcc9e90 ("arm64: dts: renesas: r9a07g044: Add SCI[0-1] nodes")

With below check in driver.

+	/*
+	 * The fourth interrupt on SCI port is transmit end interrupt, so
+	 * shuffle the interrupts.
+	 */
+	if (p->type == PORT_SCI)
+		swap(sci_port->irqs[SCIx_BRI_IRQ], sci_port->irqs[SCIx_TEI_IRQ]);


[1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/Documentation/devicetree/bindings/serial/renesas,sci.yaml?h=next-20230317

Cheers,
Biju

  reply	other threads:[~2023-03-17 13:47 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-16 16:01 [PATCH] tty: serial: sh-sci: Fix transmit end interrupt handler Biju Das
2023-03-16 16:13 ` Geert Uytterhoeven
2023-03-16 16:34   ` Biju Das
2023-03-16 17:54     ` Geert Uytterhoeven
2023-03-17  7:59       ` Biju Das
2023-03-17  8:05         ` Geert Uytterhoeven
2023-03-17  8:08           ` Biju Das
2023-03-17  9:00             ` Biju Das
2023-03-17  9:05               ` Geert Uytterhoeven
2023-03-17  9:07               ` Wolfram Sang
2023-03-17  9:16                 ` Wolfram Sang
2023-03-17  9:21                 ` Biju Das
2023-03-17  9:04             ` Geert Uytterhoeven
2023-03-17  9:15               ` Biju Das
2023-03-17  9:38                 ` Geert Uytterhoeven
2023-03-17 13:47                   ` Biju Das [this message]
2023-03-17 14:30                     ` Geert Uytterhoeven
2023-03-17 14:40                       ` Biju Das
2023-04-11 10:08 Biju Das
2023-04-11 14:14 ` Greg Kroah-Hartman
2023-04-11 14:24   ` Biju Das
2023-04-11 14:40     ` Biju Das
2023-04-11 14:56       ` Greg Kroah-Hartman
2023-04-11 15:36         ` Biju Das
2023-04-12  6:37           ` Greg Kroah-Hartman
2023-04-12  6:52             ` Biju Das

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=OS0PR01MB59220E5FA2CDC27108DB926C86BD9@OS0PR01MB5922.jpnprd01.prod.outlook.com \
    --to=biju.das.jz@bp.renesas.com \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=swboyd@chromium.org \
    --cc=yoshihiro.shimoda.uh@renesas.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.