From: Lino Sanfilippo <LinoSanfilippo@gmx.de>
To: Crescent CY Hsieh <crescentcy.hsieh@moxa.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Subject: Re: [PATCH v5] tty: serial: Add RS422 flag to struct serial_rs485
Date: Fri, 24 Nov 2023 22:06:19 +0100 [thread overview]
Message-ID: <aa1f0e1e-1587-592c-7e86-e8f168b71c21@gmx.de> (raw)
In-Reply-To: <20231121095122.15948-1-crescentcy.hsieh@moxa.com>
On 21.11.23 at 10:51, Crescent CY Hsieh wrote:
> Add "SER_RS485_MODE_RS422" flag to struct serial_rs485, so that serial
> port can switch interface into RS422 if supported by using ioctl command
> "TIOCSRS485".
>
> By treating RS422 as a mode of RS485, which means while enabling RS422
> there are two flags need to be set (SER_RS485_ENABLED and
> SER_RS485_MODE_RS422), it would make things much easier. For example
> some places that checks for "SER_RS485_ENABLED" won't need to be rewritten.
>
> Signed-off-by: Crescent CY Hsieh <crescentcy.hsieh@moxa.com>
>
> ---
> Changes from v4 to v5:
> - Revise commit message.
> - Delete RS422 checks within uart_set_rs485_termination().
>
> Changes from v3 to v4:
> - Include 'linux/const.h' header in '/include/uapi/linux/serial.h'
> - Replace BIT() with _BITUL() which defined in
> '/include/uapi/linux/const.h'
>
> Changes from v2 to v3:
> - Remove "SER_RS422_ENABLED" flag from legacy flags.
> - Revise "SER_RS422_ENABLED" into "SER_RS485_MODE_RS422".
> - Remove the code which checks the conflicts between SER_RS485_ENABLED
> and SER_RS422_ENABLED.
> - Add return check in uart_set_rs485_termination().
>
> Changes from v1 to v2:
> - Revise the logic that checks whether RS422/RS485 are enabled
> simultaneously.
>
> v4: https://lore.kernel.org/all/20231113094136.52003-1-crescentcy.hsieh@moxa.com/
> v3: https://lore.kernel.org/all/20231108060719.11775-1-crescentcy.hsieh@moxa.com/
> v2: https://lore.kernel.org/all/20231101064404.45711-1-crescentcy.hsieh@moxa.com/
> v1: https://lore.kernel.org/all/20231030053632.5109-1-crescentcy.hsieh@moxa.com/
>
> ---
> drivers/tty/serial/serial_core.c | 7 +++++++
> include/uapi/linux/serial.h | 19 +++++++++++--------
> 2 files changed, 18 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index 831d03361..db1ebed7f 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -1376,6 +1376,13 @@ static void uart_sanitize_serial_rs485(struct uart_port *port, struct serial_rs4
> return;
> }
>
> + /* Clear other RS485 flags and return if enabling RS422 */
> + if (rs485->flags & SER_RS485_MODE_RS422) {
> + memset(rs485, 0, sizeof(*rs485));
> + rs485->flags |= (SER_RS485_ENABLED | SER_RS485_MODE_RS422);
Does not RS422 also require termination resistors? So what about SER_RS485_TERMINATE_BUS?
Regards,
Lino
prev parent reply other threads:[~2023-11-24 21:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-21 9:51 Crescent CY Hsieh
2023-11-23 14:16 ` Greg Kroah-Hartman
2023-11-24 21:06 ` Lino Sanfilippo [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=aa1f0e1e-1587-592c-7e86-e8f168b71c21@gmx.de \
--to=linosanfilippo@gmx.de \
--cc=crescentcy.hsieh@moxa.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®