From: Vicente Bergas <vicencb@gmail.com>
To: ilpo.jarvinen@linux.intel.com
Cc: andriy.shevchenko@linux.intel.com,
giulio.benetti@micronovasrl.com, gregkh@linuxfoundation.org,
heikki.krogerus@linux.intel.com, heiko@sntech.de,
jirislaby@kernel.org, johan@kernel.org,
linux-api@vger.kernel.org, linux-serial@vger.kernel.org,
lukas@wunner.de, u.kleine-koenig@pengutronix.de
Subject: Re: [PATCH v3 00/12] Add RS485 support to DW UART
Date: Thu, 21 Apr 2022 17:36:26 +0200 [thread overview]
Message-ID: <20220421153626.120494-1-vicencb@gmail.com> (raw)
In-Reply-To: <20220411083321.9131-1-ilpo.jarvinen@linux.intel.com>
Hello Ilpo,
i have tested your v3 patch on v3 hardware, that is, using the
emulated em485 because of lack of HW support. It is not working
due to three issues.
1.- rs485_stop_tx is never called because there are no interrupts.
I worked around this by disabling DMA:
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -577,3 +577,3 @@ static int dw8250_probe(struct platform_device *pdev)
data->data.dma.rxconf.src_maxburst = p->fifosize / 4;
data->data.dma.txconf.dst_maxburst = p->fifosize / 4;
- up->dma = &data->data.dma;
+ up->dma = 0; // Proof of concept, not to be merged!
2.- Although "linux,rs485-enabled-at-boot-time" is set in the DTS,
the RTS/DriverEnable line is asserted all the time the /dev/ttyS1
device file is closed.
As soon as the device file is openned, the RTS line is deasserted.
Then it works as expected: it is asserted only during transmissions.
When the device file is closed again, the RTS line goes back to the
asserted level and stays there.
When the rs485 mode is enabled, it is expected that the RTS line be
deasserted by default.
3.- The RTS line is asserted a few microseconds earlier than the
start bit, that is acceptable, but then it deasserts one whole bit
time before the last stop bit.
So, the last stop bit of the last byte of a message is not sent
because the driver is disabled.
This has been tested with the port configured at 19200e1, that is,
the bit time is 52 us.
I worked around this by adding "rs485-rts-delay = <0 52>;" in the
DTS. This leads to the following feature (not an issue):
On Mon, 11 Apr 2022 11:33:12 +0300, Ilpo Järvinen wrote:
> Set delay_rts_before_send and delay_rts_after_send to zero for now.
> The granularity of that ABI is too coarse to be useful.
Indeed the time unit of this parameter is milliseconds, as stated in
Documentation/devicetree/bindings/serial/rs485.yaml
Which in the general case is more than ten bit times.
But it is being interpreted as microseconds here:
On Mon, 11 Apr 2022 11:33:11 +0300, Ilpo Järvinen wrote:
> [PATCH v3 02/12] serial: 8250: Handle UART without interrupt on TEMT
>+ stop_delay += (u64)p->port.rs485.delay_rts_after_send * NSEC_PER_USEC;
So, this way it has a useful granularity to be used in
"rs485-rts-delay = <0 52>;" but is not compliant with the spec.
Regards,
Vicente.
next prev parent reply other threads:[~2022-04-21 15:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-11 8:33 [PATCH v3 00/12] Add RS485 support to DW UART Ilpo Järvinen
2022-04-11 8:33 ` [PATCH v3 07/12] serial: termbits: ADDRB to indicate 9th bit addressing mode Ilpo Järvinen
2022-04-11 8:33 ` [PATCH v3 08/12] serial: General support for multipoint addresses Ilpo Järvinen
2022-04-21 15:36 ` Vicente Bergas [this message]
2022-04-21 19:38 ` [PATCH v3 00/12] Add RS485 support to DW UART Lukas Wunner
2022-04-21 20:41 ` Vicente Bergas
2022-04-22 9:25 ` Ilpo Järvinen
2022-04-22 13:07 ` Ilpo Järvinen
2022-04-23 23:57 ` Vicente Bergas
2022-04-25 11:16 ` Ilpo Järvinen
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=20220421153626.120494-1-vicencb@gmail.com \
--to=vicencb@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=giulio.benetti@micronovasrl.com \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=heiko@sntech.de \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jirislaby@kernel.org \
--cc=johan@kernel.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=u.kleine-koenig@pengutronix.de \
/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).