All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Jochen Mades <jochen@mades.net>
Cc: "linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
	Lino Sanfilippo <LinoSanfilippo@gmx.de>
Subject: Re: amba-pl011 driver: bug in RS485 mode
Date: Thu, 30 Dec 2021 13:21:52 +0100	[thread overview]
Message-ID: <Yc2kYOU67BqDpzLy@kroah.com> (raw)
In-Reply-To: <572288095.547800.1640594185677@webmail.strato.com>

On Mon, Dec 27, 2021 at 09:36:25AM +0100, Jochen Mades wrote:
> Hi,
> 
> I tested the amba-pl011 driver from the current branch rpi-5.16.y in RS485 mode and found a bug.
> 
> The current driver pulls-up RTS in function pl011_set_mctrl independent from the rs485-flags SER_RS485_RTS_AFTER_SEND.
> This leads to problems if the driver is used as RS485 slave.
> 
> In my opinion the patch should look like that (and was tested successfully by myself):
> 
> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
> index 537f37ac4..3b45beae8 100644
> --- a/drivers/tty/serial/amba-pl011.c
> +++ b/drivers/tty/serial/amba-pl011.c
> @@ -1647,7 +1647,12 @@ static void pl011_set_mctrl(struct uart_port *port, unsigned int mctrl)
>         unsigned int cr;
> 
>         if (port->rs485.flags & SER_RS485_ENABLED)
> -               mctrl &= ~TIOCM_RTS;
> +       {
> +               if (port->rs485.flags & SER_RS485_RTS_AFTER_SEND)
> +                       mctrl &= ~TIOCM_RTS;
> +               else
> +                       mctrl |= TIOCM_RTS;
> +       }
> 
>         cr = pl011_read(uap, REG_CR);
> 
> 
> Please let me know, if I'm allowed to commit this change and let me know how to do that or if someone of you guys will do that better.

Anyone is allowed to submit a change, please do so as per the
Documentation/SubmittingPatches file describes and we will be glad to
review it and apply it if it is ok.

thanks,

greg k-h

      reply	other threads:[~2021-12-30 12:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-27  8:36 amba-pl011 driver: bug in RS485 mode Jochen Mades
2021-12-30 12:21 ` Greg KH [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=Yc2kYOU67BqDpzLy@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=LinoSanfilippo@gmx.de \
    --cc=jochen@mades.net \
    --cc=linux-serial@vger.kernel.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.