From: Greg KH <gregkh@linuxfoundation.org>
To: zhangqiumiao1@huawei.com
Cc: jirislaby@kernel.org, linux-kernel@vger.kernel.org,
linux-serial@vger.kernel.org
Subject: Re: [PATCH v4] tty: make pl011 serial port driver support 485 mode
Date: Thu, 4 Feb 2021 16:51:33 +0100 [thread overview]
Message-ID: <YBwYBed2IH0PFpcS@kroah.com> (raw)
In-Reply-To: <1612164643-1480-1-git-send-email-zhangqiumiao1@huawei.com>
On Mon, Feb 01, 2021 at 03:30:43PM +0800, zhangqiumiao1@huawei.com wrote:
> From: Qiumiao Zhang <zhangqiumiao1@huawei.com>
>
> make pl011 serial port support 485 mode full duplex communication
>
> Signed-off-by: Qiumiao Zhang <zhangqiumiao1@huawei.com>
> ---
> Changes in v4:
> -Add a bound to the loop in pl011_stop_tx
> -Remove extra curly braces in pl011_stop_tx
>
> Changes in v3:
> -Fix busy loop forever in pl011_tx_empty
> -Move the definition of cr into uart_amba_port
> -Run checkpatch with no error or warning
>
> Changes in v2:
> -Fix two compilation errors
>
> drivers/tty/serial/amba-pl011.c | 38 ++++++++++++++++++++++++++++++++++++++
> 1 file changed, 38 insertions(+)
>
> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
> index c255476..026add3 100644
> --- a/drivers/tty/serial/amba-pl011.c
> +++ b/drivers/tty/serial/amba-pl011.c
> @@ -44,6 +44,7 @@
>
> #include "amba-pl011.h"
>
> +#define ISEMPTY 1
> #define UART_NR 14
>
> #define SERIAL_AMBA_MAJOR 204
> @@ -264,6 +265,7 @@ struct uart_amba_port {
> unsigned int fifosize; /* vendor-specific */
> unsigned int old_cr; /* state during shutdown */
> unsigned int fixed_baud; /* vendor-set fixed baud rate */
> + unsigned int cr;
> char type[12];
> #ifdef CONFIG_DMA_ENGINE
> /* DMA stuff */
> @@ -1284,14 +1286,33 @@ static inline bool pl011_dma_rx_running(struct uart_amba_port *uap)
> #define pl011_dma_flush_buffer NULL
> #endif
>
> +static unsigned int pl011_tx_empty(struct uart_port *port);
> +
> static void pl011_stop_tx(struct uart_port *port)
> {
> + unsigned int count = 1000000; /* 1s */
1 second of what?
> struct uart_amba_port *uap =
> container_of(port, struct uart_amba_port, port);
>
> uap->im &= ~UART011_TXIM;
> pl011_write(uap->im, uap, REG_IMSC);
> pl011_dma_tx_stop(uap);
> + if (port->rs485.flags & SER_RS485_ENABLED) {
> + while(pl011_tx_empty(port) != ISEMPTY && count) {
> + count--;
> + cpu_relax();
> + udelay(1);
Why relax and delay?
And always run checkpatch on your change before sending it out next
time.
thanks,
greg k-h
parent reply other threads:[~2021-02-04 15:53 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <1612164643-1480-1-git-send-email-zhangqiumiao1@huawei.com>]
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=YBwYBed2IH0PFpcS@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=zhangqiumiao1@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).