From: Jochen Mades <jochen@mades.net>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: linux-serial@vger.kernel.org
Subject: Re: Extending serial port linux driver to toggle RS485 direction pin (GPIO)
Date: Wed, 3 Nov 2021 08:23:38 +0100 (CET) [thread overview]
Message-ID: <527160377.1225435.1635924219001@webmail.strato.com> (raw)
In-Reply-To: <YYGKbfvFki8VN4HN@kroah.com>
Hi Greg,
thanks for your fast reply. I checked the sources you mentioned below, that helps a bit..
Could you please give me some more background what you mean with your question:
> You could do much the same in the pl011_rs485_tx_start() function when
> SER_RS485_RX_DURING_TX and SER_RS485_RTS_ON_SEND are checked, right?
Is there already a concept for RS485 drivers? ...or where to find "pl011_rs485_tx_start()"?
Bests
Jochen
> On 02/11/2021 19:58 Greg KH <gregkh@linuxfoundation.org> wrote:
>
>
> On Tue, Nov 02, 2021 at 06:55:56PM +0100, Jochen wrote:
> > Hello,
> >
> > I have a RS485 hardware shield connected to the hardware uart of a raspberry PI3, where you have to toggle the RS485 driver DIRECTION-pin from within your software during write-commands. The DIR-Pin is connected to a GPIO pin of the PI.
> >
> > As I do not want to do that in every application software, I thought it could be a good idea to enhance the serial-port driver (locally on my PI) with that functionality. Looking to the sources of amba-pl011.c I thought the "pl011_write"-function could be the right place to do so....but to be honest it seems not to work
> >
> > Could you please give me a hint where to do that best in the serial port driver? (or is there already a RS485 driver with configurable Dir-GPIO-pin).
> > Is there a documentation of the serial-port architecture available which could help me to solve my problem?
>
> Other drivers do this today, using gpio pins for this. One example is
> the drivers/tty/serial/ar933x_uart.c driver (look at the
> ar933x_uart_tx_chars() function)
>
> You could do much the same in the pl011_rs485_tx_start() function when
> SER_RS485_RX_DURING_TX and SER_RS485_RTS_ON_SEND are checked, right?
>
> As for making it "generic", I think there are other drivers that allow
> the gpio pins to be selected as part of their device tree, look in the
> drivers/tty/serial/ directory for the use of gpio values in lots of
> different drivers.
>
> hope this helps,
>
> greg k-h
next prev parent reply other threads:[~2021-11-03 7:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-02 17:55 Extending serial port linux driver to toggle RS485 direction pin (GPIO) Jochen
2021-11-02 18:58 ` Greg KH
2021-11-03 7:23 ` Jochen Mades [this message]
2021-11-03 8:23 ` Greg KH
2021-11-16 6:43 ` Jochen Mades
2021-11-16 8:28 ` Greg KH
2021-11-16 11:47 ` Jochen Mades
2021-11-16 14:21 ` Greg KH
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=527160377.1225435.1635924219001@webmail.strato.com \
--to=jochen@mades.net \
--cc=gregkh@linuxfoundation.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