From: Lukas Wunner <lukas@wunner.de>
To: Vignesh Raghavendra <vigneshr@ti.com>
Cc: Bin Liu <b-liu@ti.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-serial@vger.kernel.org, Jiri Slaby <jirislaby@kernel.org>,
Matthias Schiffer <matthias.schiffer@ew.tq-group.com>,
Jan Kiszka <jan.kiszka@siemens.com>,
Su Bao Cheng <baocheng.su@siemens.com>,
Nishanth Menon <nm@ti.com>,
Lino Sanfilippo <LinoSanfilippo@gmx.de>,
Ilpo Jarvinen <ilpo.jarvinen@linux.intel.com>
Subject: Re: [PATCH] serial: 8250: 8250_omap: Support native RS485
Date: Thu, 6 Oct 2022 09:27:07 +0200 [thread overview]
Message-ID: <20221006072707.GA15502@wunner.de> (raw)
In-Reply-To: <cda09b02-a1ca-67a0-a6f6-4e0793605ce1@ti.com>
On Thu, Oct 06, 2022 at 12:37:43PM +0530, Vignesh Raghavendra wrote:
> On 04/10/22 7:15 pm, Bin Liu wrote:
> > On Mon, Oct 03, 2022 at 09:42:24PM +0200, Lukas Wunner wrote:
> >> On Mon, Oct 03, 2022 at 10:10:59AM -0500, Bin Liu wrote:
> >>> On Tue, Sep 27, 2022 at 02:10:01PM +0200, Lukas Wunner wrote:
> >>>> Recent TI Sitara SoCs such as AM64/AM65 have gained the ability to
> >>>> automatically assert RTS when data is transmitted, obviating the need
> >>>> to emulate this functionality in software.
> >>>>
> >>>> The feature is controlled through new DIR_EN and DIR_POL bits in the
> >>>> Mode Definition Register 3. For details see page 8783 and 8890 of the
> >>>> AM65 TRM: https://www.ti.com/lit/ug/spruid7e/spruid7e.pdf
> >> [...]
> >>>> - if (up->port.rs485.flags & SER_RS485_ENABLED)
> >>>> + if (priv->habit & UART_HAS_NATIVE_RS485)
> >>>> + serial_out(up, UART_OMAP_MDR3, priv->mdr3);
> >>>
> >>> This makes the NATIVE_RS485 always used if the SoC supports it, but
> >>>
> >>>> + else if (up->port.rs485.flags & SER_RS485_ENABLED)
> >>>> serial8250_em485_stop_tx(up);
> >>>
> >>> there are cases em485 should be used even if SoC supports NATIVE_RS485.
> >>> For example:
> >>> - the design has pinmux conflict and the RTS pin has to be used for
> >>> something else. Then a GPIO pin would be used for RS485 DE control;
> >>> - the design requires customized delay_rts_before_send or
> >>> delay_rts_after_send which NATIVE_RS485 doesn't support;
> >>>
> >>> So we might need an option for such usecases. A device tree flag?
> >>
> >> I expect those cases to be rare, hence do not see the need to
> >
> > Maybe rare, but I know some projects use GPIO for DE control.
> >
> >> address them right from the start. Support for falling back
> >
> > So I think missing it is a regression, because this patch forces to
> > use the RTS pin for DE control, this breaks the existing projects which
> > use GPIO for RTS/DE or have customized delay_rts_{before,after}_send.
>
> I agree with Bin. This patch as such can break DTs which intend to use
> GPIO based DE.
> Quick fix would be to simply look for presence of rts-gpios property in
> DT, if so fallback to registering serial8250_em485_*. This should avoid
> regressing DTs using GPIO for DE control.
I've updated the patch to check for
mctrl_gpio_to_gpiod(up->gpios, UART_GPIO_RTS)
as well as user-requested delays that exceed the fixed hardware delays.
The driver falls back to software emulation in that case.
Updated patch is on this development branch and is currently being
compile-tested by Intel's 0-day bot:
https://github.com/l1k/linux/commits/rs485_sitara
Thanks,
Lukas
prev parent reply other threads:[~2022-10-06 7:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-27 12:10 [PATCH] serial: 8250: 8250_omap: Support native RS485 Lukas Wunner
2022-09-28 11:38 ` Ilpo Järvinen
2022-10-03 19:54 ` Lukas Wunner
2022-10-04 9:06 ` Ilpo Järvinen
2022-10-06 6:21 ` Lukas Wunner
2022-10-06 7:16 ` Vignesh Raghavendra
2022-10-06 7:43 ` Vignesh Raghavendra
2022-10-06 10:59 ` Ilpo Järvinen
2022-10-03 15:10 ` Bin Liu
2022-10-03 19:42 ` Lukas Wunner
2022-10-04 13:45 ` Bin Liu
2022-10-06 7:07 ` Vignesh Raghavendra
2022-10-06 7:27 ` Lukas Wunner [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=20221006072707.GA15502@wunner.de \
--to=lukas@wunner.de \
--cc=LinoSanfilippo@gmx.de \
--cc=b-liu@ti.com \
--cc=baocheng.su@siemens.com \
--cc=gregkh@linuxfoundation.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jan.kiszka@siemens.com \
--cc=jirislaby@kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=matthias.schiffer@ew.tq-group.com \
--cc=nm@ti.com \
--cc=vigneshr@ti.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.