diff mbox series

[v4,2/5] tty: serial: sh-sci: Fix Rx on RZ/G2L SCI

Message ID 20230321114753.75038-3-biju.das.jz@bp.renesas.com (mailing list archive)
State Accepted
Delegated to: Geert Uytterhoeven
Headers show
Series Renesas SCI fixes | expand

Commit Message

Biju Das March 21, 2023, 11:47 a.m. UTC
SCI IP on RZ/G2L alike SoCs do not need regshift compared to other SCI
IPs on the SH platform. Currently, it does regshift and configuring Rx
wrongly. Drop adding regshift for RZ/G2L alike SoCs.

Fixes: dfc80387aefb ("serial: sh-sci: Compute the regshift value for SCI ports")
Cc: stable@vger.kernel.org
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v3->v4:
 * Updated the fixes tag
 * Replaced sci_port->is_rz_sci with dev->dev.of_node as regshift are only needed
   for sh770x/sh7750/sh7760, which don't use DT yet.
 * Dropped is_rz_sci variable from struct sci_port.
v3:
 * New patch.
---
 drivers/tty/serial/sh-sci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Geert Uytterhoeven March 27, 2023, 9:15 a.m. UTC | #1
On Tue, Mar 21, 2023 at 12:48 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> SCI IP on RZ/G2L alike SoCs do not need regshift compared to other SCI
> IPs on the SH platform. Currently, it does regshift and configuring Rx
> wrongly. Drop adding regshift for RZ/G2L alike SoCs.
>
> Fixes: dfc80387aefb ("serial: sh-sci: Compute the regshift value for SCI ports")
> Cc: stable@vger.kernel.org
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> v3->v4:
>  * Updated the fixes tag
>  * Replaced sci_port->is_rz_sci with dev->dev.of_node as regshift are only needed
>    for sh770x/sh7750/sh7760, which don't use DT yet.
>  * Dropped is_rz_sci variable from struct sci_port.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

One can wonder how this ever worked on DT-based H8/300...

Gr{oetje,eeting}s,

                        Geert
Biju Das March 28, 2023, 11:32 a.m. UTC | #2
Hi Geert,

Thanks for the feedback.

> Subject: Re: [PATCH v4 2/5] tty: serial: sh-sci: Fix Rx on RZ/G2L SCI
> 
> On Tue, Mar 21, 2023 at 12:48 PM Biju Das <biju.das.jz@bp.renesas.com>
> wrote:
> > SCI IP on RZ/G2L alike SoCs do not need regshift compared to other SCI
> > IPs on the SH platform. Currently, it does regshift and configuring Rx
> > wrongly. Drop adding regshift for RZ/G2L alike SoCs.
> >
> > Fixes: dfc80387aefb ("serial: sh-sci: Compute the regshift value for
> > SCI ports")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > ---
> > v3->v4:
> >  * Updated the fixes tag
> >  * Replaced sci_port->is_rz_sci with dev->dev.of_node as regshift are only
> needed
> >    for sh770x/sh7750/sh7760, which don't use DT yet.
> >  * Dropped is_rz_sci variable from struct sci_port.
> 
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> 
> One can wonder how this ever worked on DT-based H8/300...

Yep, it is interesting to see whether SCI ever worked on DT-based H8/300
Assuming it has same register layout as RZ/G2L SoC.

Cheers,
Biju
Greg Kroah-Hartman March 29, 2023, 9:01 a.m. UTC | #3
On Tue, Mar 28, 2023 at 11:32:38AM +0000, Biju Das wrote:
> Hi Geert,
> 
> Thanks for the feedback.
> 
> > Subject: Re: [PATCH v4 2/5] tty: serial: sh-sci: Fix Rx on RZ/G2L SCI
> > 
> > On Tue, Mar 21, 2023 at 12:48 PM Biju Das <biju.das.jz@bp.renesas.com>
> > wrote:
> > > SCI IP on RZ/G2L alike SoCs do not need regshift compared to other SCI
> > > IPs on the SH platform. Currently, it does regshift and configuring Rx
> > > wrongly. Drop adding regshift for RZ/G2L alike SoCs.
> > >
> > > Fixes: dfc80387aefb ("serial: sh-sci: Compute the regshift value for
> > > SCI ports")
> > > Cc: stable@vger.kernel.org
> > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > ---
> > > v3->v4:
> > >  * Updated the fixes tag
> > >  * Replaced sci_port->is_rz_sci with dev->dev.of_node as regshift are only
> > needed
> > >    for sh770x/sh7750/sh7760, which don't use DT yet.
> > >  * Dropped is_rz_sci variable from struct sci_port.
> > 
> > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > 
> > One can wonder how this ever worked on DT-based H8/300...
> 
> Yep, it is interesting to see whether SCI ever worked on DT-based H8/300
> Assuming it has same register layout as RZ/G2L SoC.

This is already in Linus's tree now, right?

confused,

greg k-h
Biju Das March 29, 2023, 9:06 a.m. UTC | #4
Hi Greg,

Thanks for the feedback.

> Subject: Re: [PATCH v4 2/5] tty: serial: sh-sci: Fix Rx on RZ/G2L SCI
> 
> On Tue, Mar 28, 2023 at 11:32:38AM +0000, Biju Das wrote:
> > Hi Geert,
> >
> > Thanks for the feedback.
> >
> > > Subject: Re: [PATCH v4 2/5] tty: serial: sh-sci: Fix Rx on RZ/G2L
> > > SCI
> > >
> > > On Tue, Mar 21, 2023 at 12:48 PM Biju Das
> > > <biju.das.jz@bp.renesas.com>
> > > wrote:
> > > > SCI IP on RZ/G2L alike SoCs do not need regshift compared to other
> > > > SCI IPs on the SH platform. Currently, it does regshift and
> > > > configuring Rx wrongly. Drop adding regshift for RZ/G2L alike SoCs.
> > > >
> > > > Fixes: dfc80387aefb ("serial: sh-sci: Compute the regshift value
> > > > for SCI ports")
> > > > Cc: stable@vger.kernel.org
> > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > > ---
> > > > v3->v4:
> > > >  * Updated the fixes tag
> > > >  * Replaced sci_port->is_rz_sci with dev->dev.of_node as regshift
> > > > are only
> > > needed
> > > >    for sh770x/sh7750/sh7760, which don't use DT yet.
> > > >  * Dropped is_rz_sci variable from struct sci_port.
> > >
> > > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > >
> > > One can wonder how this ever worked on DT-based H8/300...
> >
> > Yep, it is interesting to see whether SCI ever worked on DT-based
> > H8/300 Assuming it has same register layout as RZ/G2L SoC.
> 
> This is already in Linus's tree now, right?

As per the discussion with Geert, It is been removed since 2022. Yes, It is present in backports.

Geert, please correct me If I am wrong.

Cheers,
Biju
Greg Kroah-Hartman March 29, 2023, 9:20 a.m. UTC | #5
On Wed, Mar 29, 2023 at 09:06:43AM +0000, Biju Das wrote:
> Hi Greg,
> 
> Thanks for the feedback.
> 
> > Subject: Re: [PATCH v4 2/5] tty: serial: sh-sci: Fix Rx on RZ/G2L SCI
> > 
> > On Tue, Mar 28, 2023 at 11:32:38AM +0000, Biju Das wrote:
> > > Hi Geert,
> > >
> > > Thanks for the feedback.
> > >
> > > > Subject: Re: [PATCH v4 2/5] tty: serial: sh-sci: Fix Rx on RZ/G2L
> > > > SCI
> > > >
> > > > On Tue, Mar 21, 2023 at 12:48 PM Biju Das
> > > > <biju.das.jz@bp.renesas.com>
> > > > wrote:
> > > > > SCI IP on RZ/G2L alike SoCs do not need regshift compared to other
> > > > > SCI IPs on the SH platform. Currently, it does regshift and
> > > > > configuring Rx wrongly. Drop adding regshift for RZ/G2L alike SoCs.
> > > > >
> > > > > Fixes: dfc80387aefb ("serial: sh-sci: Compute the regshift value
> > > > > for SCI ports")
> > > > > Cc: stable@vger.kernel.org
> > > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > > > ---
> > > > > v3->v4:
> > > > >  * Updated the fixes tag
> > > > >  * Replaced sci_port->is_rz_sci with dev->dev.of_node as regshift
> > > > > are only
> > > > needed
> > > > >    for sh770x/sh7750/sh7760, which don't use DT yet.
> > > > >  * Dropped is_rz_sci variable from struct sci_port.
> > > >
> > > > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > > >
> > > > One can wonder how this ever worked on DT-based H8/300...
> > >
> > > Yep, it is interesting to see whether SCI ever worked on DT-based
> > > H8/300 Assuming it has same register layout as RZ/G2L SoC.
> > 
> > This is already in Linus's tree now, right?
> 
> As per the discussion with Geert, It is been removed since 2022. Yes, It is present in backports.
> 
> Geert, please correct me If I am wrong.

Seems to not apply against 6.3-rc3 :(
Biju Das March 29, 2023, 9:31 a.m. UTC | #6
Hi Greg,

> Subject: Re: [PATCH v4 2/5] tty: serial: sh-sci: Fix Rx on RZ/G2L SCI
> 
> On Wed, Mar 29, 2023 at 09:06:43AM +0000, Biju Das wrote:
> > Hi Greg,
> >
> > Thanks for the feedback.
> >
> > > Subject: Re: [PATCH v4 2/5] tty: serial: sh-sci: Fix Rx on RZ/G2L
> > > SCI
> > >
> > > On Tue, Mar 28, 2023 at 11:32:38AM +0000, Biju Das wrote:
> > > > Hi Geert,
> > > >
> > > > Thanks for the feedback.
> > > >
> > > > > Subject: Re: [PATCH v4 2/5] tty: serial: sh-sci: Fix Rx on
> > > > > RZ/G2L SCI
> > > > >
> > > > > On Tue, Mar 21, 2023 at 12:48 PM Biju Das
> > > > > <biju.das.jz@bp.renesas.com>
> > > > > wrote:
> > > > > > SCI IP on RZ/G2L alike SoCs do not need regshift compared to
> > > > > > other SCI IPs on the SH platform. Currently, it does regshift
> > > > > > and configuring Rx wrongly. Drop adding regshift for RZ/G2L alike
> SoCs.
> > > > > >
> > > > > > Fixes: dfc80387aefb ("serial: sh-sci: Compute the regshift
> > > > > > value for SCI ports")
> > > > > > Cc: stable@vger.kernel.org
> > > > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > > > > ---
> > > > > > v3->v4:
> > > > > >  * Updated the fixes tag
> > > > > >  * Replaced sci_port->is_rz_sci with dev->dev.of_node as
> > > > > > regshift are only
> > > > > needed
> > > > > >    for sh770x/sh7750/sh7760, which don't use DT yet.
> > > > > >  * Dropped is_rz_sci variable from struct sci_port.
> > > > >
> > > > > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > > > >
> > > > > One can wonder how this ever worked on DT-based H8/300...
> > > >
> > > > Yep, it is interesting to see whether SCI ever worked on DT-based
> > > > H8/300 Assuming it has same register layout as RZ/G2L SoC.
> > >
> > > This is already in Linus's tree now, right?
> >
> > As per the discussion with Geert, It is been removed since 2022. Yes, It
> is present in backports.
> >
> > Geert, please correct me If I am wrong.
> 
> Seems to not apply against 6.3-rc3 :(

OK, Only H8/300 support is removed in 2022. But we have RZ/G2L alike SoCs that
needs this fix. SCI support for RZ/G2L SoCs in DT[1] are present since 5.17 +.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/arch/arm64/boot/dts/renesas/r9a07g044.dtsi?h=linux-5.17.y#n393

Cheers,
Biju
diff mbox series

Patch

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 616041faab55..15954ca3e9dc 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -2937,7 +2937,7 @@  static int sci_init_single(struct platform_device *dev,
 	port->flags		= UPF_FIXED_PORT | UPF_BOOT_AUTOCONF | p->flags;
 	port->fifosize		= sci_port->params->fifosize;
 
-	if (port->type == PORT_SCI) {
+	if (port->type == PORT_SCI && !dev->dev.of_node) {
 		if (sci_port->reg_size >= 0x20)
 			port->regshift = 2;
 		else