All of lore.kernel.org
 help / color / mirror / Atom feed
* Using Serdev is it Possible to Pull RX Low
@ 2022-05-17 18:42 linuxkernel
  2022-05-18  8:48 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: linuxkernel @ 2022-05-17 18:42 UTC (permalink / raw)
  To: linux-serial

hello

I, looking at writing a kernel driver for the Texas instruments 
TPS92662A/TPS92663A

which uses a "UART bus" e.g

|-----------| |-----------| |-----------| |-----------| | | | TPS92662A 
| | TPS92662A | | TPS92663A | | UART | | -Q1 | | -Q1 | | -Q1 | | | | | | 
| | | |-----------| |-----------| |-----------| |-----------| | | | | | 
| | | | | | | 
-------------------------------------------------------------------
and control communications by specific sequencing.
configuring this appears to require being able to pull RX Low
> The MCU unit can reset the device UART and protocol state machine at 
> any time by holding the RX input low for a period of at least 12 bit 
> times (16 × 12 CLK periods). 
practically i can always pull RX low via other means, but if the UART 
can do this it would be better and be more generic.
is there a method of doing this via serdev or anything else? or will i 
likely have to resort to something like an additional GPIO pin to pull low
kind regards Christopher tyerman

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Using Serdev is it Possible to Pull RX Low
  2022-05-17 18:42 Using Serdev is it Possible to Pull RX Low linuxkernel
@ 2022-05-18  8:48 ` Greg KH
  2022-05-18 18:11   ` christopher tyerman
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2022-05-18  8:48 UTC (permalink / raw)
  To: linuxkernel; +Cc: linux-serial

On Tue, May 17, 2022 at 07:42:46PM +0100, linuxkernel wrote:
> hello
> 
> I, looking at writing a kernel driver for the Texas instruments
> TPS92662A/TPS92663A
> 
> which uses a "UART bus" e.g
> 
> |-----------| |-----------| |-----------| |-----------| | | | TPS92662A | |
> TPS92662A | | TPS92663A | | UART | | -Q1 | | -Q1 | | -Q1 | | | | | | | | |
> |-----------| |-----------| |-----------| |-----------| | | | | | | | | | |
> | | -------------------------------------------------------------------
> and control communications by specific sequencing.
> configuring this appears to require being able to pull RX Low
> > The MCU unit can reset the device UART and protocol state machine at any
> > time by holding the RX input low for a period of at least 12 bit times
> > (16 × 12 CLK periods).
> practically i can always pull RX low via other means, but if the UART can do
> this it would be better and be more generic.

How can your UART do that in a generic way?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Using Serdev is it Possible to Pull RX Low
  2022-05-18  8:48 ` Greg KH
@ 2022-05-18 18:11   ` christopher tyerman
  2022-05-19  7:02     ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: christopher tyerman @ 2022-05-18 18:11 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-serial

On 18/05/2022 09:48, Greg KH wrote:> On Tue, May 17, 2022 at 07:42:46PM 
+0100, linuxkernel wrote:
 >> hello I, looking at writing a kernel driver for the Texas instruments
 >> TPS92662A/TPS92663A which uses a "UART bus" e.g
 >> |-----------|    |-----------|    |-----------|     |-----------|
 >> |           |    | TPS92662A |    | TPS92662A |     | TPS92663A |
 >> |   UART    |    | -Q1       |    | -Q1       |     | -Q1 	   |
 >> |           |    |           |    |           |     |           |
 >> |-----------|    |-----------|    |-----------|     |-----------|
 >>       |                |                |                 |
 >>       |                |                |                 |
 >>       |                |                |                 |
 >>       -----------------------------------------------------
 >> and control communications by specific sequencing. configuring this
 >> appears to require being able to pull RX Low
 >>> The MCU unit can reset the device UART and protocol state machine at
 >>> any time by holding the RX input low for a period of at least 12 bit
 >>> times (16 × 12 CLK periods).
 >> practically i can always pull RX low via other means, but if the UART
 >> can do this it would be better and be more generic.
 > How can your UART do that in a generic way? thanks, greg k-h sorry

im not sure i explained that clearly

i also appear to have, not got the previous diagram right, (corrected in 
this reply for clarity) Im still getting used to plain text emails.

im not that familiar with UARTs in practice, and after re-reading i 
think i could have phrased that better, as had issue with MCU/IC UART 
TX/RX perspectives

e.g

|-----------|           |-----------|
|         TX|-----------|RX         |
| MCU UART  |           |    IC     |
|         RX|-----------|TX         |
|-----------|           |-----------|

from the mcu perspective its the TX pin, while from the RX pin from the 
ICs perspective.

from that perspective i need to pull the ICs RX pin low which means pull 
the MCU UART TX pin Low.

now this seems conceptually similar to a "break condition"

which some tty functions can produce
e.g
static int send_break(struct tty_struct *tty, unsigned int duration) 
[https://elixir.bootlin.com/linux/latest/source/drivers tty/tty_io.c#L2461]

with which i might me half way to answering my own question

i can't see call to that via serdev, or equivalent


however the serdev code sits on top of the tty code 
(http://events17.linuxfoundation.org/sites/events/files/slides/serdev-elce-2017-2.pdf#Outline0.11)

it appears i would have to somehow get to the underlying send_break() 
function without breaking anything

which needs a vaild tty_struct which appears to be part of tty_port and 
can get via

struct tty_struct *tty_port_tty_get(struct tty_port *port);

and it appears that you can get that via

struct serport *serport = serdev_controller_get_drvdata(ctrl);

and can get struct serdev_controller *ctrl from struct serdev_device


but doing that cleanly is another thing.


i could either try and write something like that into the driver or 
could try and write a patch for serdev that effectively calls that 
function in tty so a serdev device can request a break from itself

unless there is a alternative im not seeing.

if there is any advice you can give that would be helpful


kind regards

christopher tyerman


































^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Using Serdev is it Possible to Pull RX Low
  2022-05-18 18:11   ` christopher tyerman
@ 2022-05-19  7:02     ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2022-05-19  7:02 UTC (permalink / raw)
  To: christopher tyerman; +Cc: linux-serial

On Wed, May 18, 2022 at 07:11:38PM +0100, christopher tyerman wrote:
> On 18/05/2022 09:48, Greg KH wrote:> On Tue, May 17, 2022 at 07:42:46PM
> +0100, linuxkernel wrote:
> >> hello I, looking at writing a kernel driver for the Texas instruments
> >> TPS92662A/TPS92663A which uses a "UART bus" e.g
> >> |-----------|    |-----------|    |-----------|     |-----------|
> >> |           |    | TPS92662A |    | TPS92662A |     | TPS92663A |
> >> |   UART    |    | -Q1       |    | -Q1       |     | -Q1 	   |
> >> |           |    |           |    |           |     |           |
> >> |-----------|    |-----------|    |-----------|     |-----------|
> >>       |                |                |                 |
> >>       |                |                |                 |
> >>       |                |                |                 |
> >>       -----------------------------------------------------
> >> and control communications by specific sequencing. configuring this
> >> appears to require being able to pull RX Low
> >>> The MCU unit can reset the device UART and protocol state machine at
> >>> any time by holding the RX input low for a period of at least 12 bit
> >>> times (16 × 12 CLK periods).
> >> practically i can always pull RX low via other means, but if the UART
> >> can do this it would be better and be more generic.
> > How can your UART do that in a generic way? thanks, greg k-h sorry
> 
> im not sure i explained that clearly
> 
> i also appear to have, not got the previous diagram right, (corrected in
> this reply for clarity) Im still getting used to plain text emails.
> 
> im not that familiar with UARTs in practice, and after re-reading i think i
> could have phrased that better, as had issue with MCU/IC UART TX/RX
> perspectives
> 
> e.g
> 
> |-----------|           |-----------|
> |         TX|-----------|RX         |
> | MCU UART  |           |    IC     |
> |         RX|-----------|TX         |
> |-----------|           |-----------|
> 
> from the mcu perspective its the TX pin, while from the RX pin from the ICs
> perspective.
> 
> from that perspective i need to pull the ICs RX pin low which means pull the
> MCU UART TX pin Low.
> 
> now this seems conceptually similar to a "break condition"
> 
> which some tty functions can produce
> e.g
> static int send_break(struct tty_struct *tty, unsigned int duration)
> [https://elixir.bootlin.com/linux/latest/source/drivers tty/tty_io.c#L2461]
> 
> with which i might me half way to answering my own question
> 
> i can't see call to that via serdev, or equivalent
> 

That is correct, serdev can not handle break conditions on the tty port
right now.  You need to write a "real" serial driver if you want to have
that type of control over the connection.

You could propose a patch for serdev to handle break, try that and
submit it and see if the serdev maintainer agrees that it is a worth
addition.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-19  7:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-17 18:42 Using Serdev is it Possible to Pull RX Low linuxkernel
2022-05-18  8:48 ` Greg KH
2022-05-18 18:11   ` christopher tyerman
2022-05-19  7:02     ` Greg KH

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.