Skip to contentSkip to conversation

tty: serial: omap: use mctrl_gpio helpers

PATCH In review [email protected] 5 participants 7 messages May 22, 2015 – May 27, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tty: serial: omap: use mctrl_gpio helpers

From: Yegor Yefremov <[email protected]>

This patch permits to use GPIOs to control the CTS/RTS/DTR/DSR/DCD/RI signals.

---
 .../devicetree/bindings/serial/omap_serial.txt     |    9 +
 drivers/tty/serial/Kconfig                         |    1 +
 drivers/tty/serial/omap-serial.c                   |  168 +++++++++++++++++++-
 3 files changed, 171 insertions(+), 7 deletions(-)
Documentation/devicetree/bindings/serial/omap_serial.txt +9 -0
index 54c2a15..10fcba8 100644
@@ -16,6 +16,9 @@ Optional properties:
 - dmas : DMA specifier, consisting of a phandle to the DMA controller
          node and a DMA channel number.
 - dma-names : "rx" for receive channel, "tx" for transmit channel.
+- {rts,cts,dtr,dsr,rng,dcd}-gpios: specify a GPIO for RTS/CTS/DTR/DSR/RI/DCD
+  line respectively. It will use specified PIO instead of the peripheral
+  function pin for the UART feature. If unsure, don't specify this property.
 
 Example:
 
@@ -27,4 +30,10 @@ Example:
                         dma-names = "tx", "rx";
                         ti,hwmods = "uart4";
                         clock-frequency = <48000000>;
+                        cts-gpios = <&gpio3 5 GPIO_ACTIVE_LOW>;
+                        rts-gpios = <&gpio3 6 GPIO_ACTIVE_LOW>;
+                        dtr-gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
+                        dsr-gpios = <&gpio1 13 GPIO_ACTIVE_LOW>;
+                        dcd-gpios = <&gpio1 14 GPIO_ACTIVE_LOW>;
+                        rng-gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
                 };
drivers/tty/serial/Kconfig +1 -0
index f8120c1..bbe0e06 100644
@@ -1106,6 +1106,7 @@ config SERIAL_OMAP
 	tristate "OMAP serial port support"
 	depends on ARCH_OMAP2PLUS
 	select SERIAL_CORE
+	select SERIAL_MCTRL_GPIO
 	help
 	  If you have a machine based on an Texas Instruments OMAP CPU you
 	  can enable its onboard serial ports by enabling this option.
drivers/tty/serial/omap-serial.c +161 -7

290 lines not on this page · raw message

Signature · 1 line
1.7.7
#1 lore raw
Quoted 11 lines · On 05/22/2015 07:16 AM, [email protected] wrote:

From: Yegor Yefremov <[email protected]>

This patch permits to use GPIOs to control the CTS/RTS/DTR/DSR/DCD/RI signals.

---
 .../devicetree/bindings/serial/omap_serial.txt     |    9 +
 drivers/tty/serial/Kconfig                         |    1 +
 drivers/tty/serial/omap-serial.c                   |  168 +++++++++++++++++++-
 3 files changed, 171 insertions(+), 7 deletions(-)

Would we rather move introducing new features to 8250_omap.c rather than doing that to omap-serial and keep feature creeping it such that we wont ever be able to switch to 8250_omap ?

Signature · 2 lines
Regards,
Nishanth Menon
#2 lore raw
Quoted 13 lines · Nishanth Menon
Quoted 11 lines · On 05/22/2015 07:16 AM, [email protected] wrote:

From: Yegor Yefremov <[email protected]>

This patch permits to use GPIOs to control the CTS/RTS/DTR/DSR/DCD/RI signals.

---
 .../devicetree/bindings/serial/omap_serial.txt     |    9 +
 drivers/tty/serial/Kconfig                         |    1 +
 drivers/tty/serial/omap-serial.c                   |  168 +++++++++++++++++++-
 3 files changed, 171 insertions(+), 7 deletions(-)
Quoted 3 lines

Would we rather move introducing new features to 8250_omap.c rather than doing that to omap-serial and keep feature creeping it such that we wont ever be able to switch to 8250_omap ?

Yes please. Also, do we really want to allow mapping random GPIO pins to the UART driver? I guess it would be handy for powering UART connected devices like BT up and down..

There's one fix pending to 8250_omap for mainline BTW:

[PATCH] serial: 8250_omap: provide complete custom startup & shutdown callbacks

But other than that it seems to behave at least for me.

Regards,

Tony

#3 lore raw
Quoted 14 lines · Tony Lindgren
Quoted 13 lines · Nishanth Menon
Quoted 11 lines · On 05/22/2015 07:16 AM, [email protected] wrote:

From: Yegor Yefremov <[email protected]>

This patch permits to use GPIOs to control the CTS/RTS/DTR/DSR/DCD/RI signals.

---
 .../devicetree/bindings/serial/omap_serial.txt     |    9 +
 drivers/tty/serial/Kconfig                         |    1 +
 drivers/tty/serial/omap-serial.c                   |  168 +++++++++++++++++++-
 3 files changed, 171 insertions(+), 7 deletions(-)
Quoted 6 lines
Quoted 3 lines

Would we rather move introducing new features to 8250_omap.c rather than doing that to omap-serial and keep feature creeping it such that we wont ever be able to switch to 8250_omap ?

Yes please. Also, do we really want to allow mapping random GPIO pins to the UART driver? I guess it would be

See drivers/tty/serial/serial_mctrl_gpio.[ch], these are used for UARTs on SoCs with enough GPIOs available whose UART don't have full Modem signals. It's pretty handy for BT, GSM, LTE, whatever type of modem-like device.

Signature · 1 line
balbi
#4 lore raw
Quoted 19 lines · Felipe Balbi
Quoted 18 lines · Tony Lindgren
Quoted 16 lines · Nishanth Menon
Quoted 11 lines · On 05/22/2015 07:16 AM, [email protected] wrote:

From: Yegor Yefremov <[email protected]>

This patch permits to use GPIOs to control the CTS/RTS/DTR/DSR/DCD/RI signals.

---
 .../devicetree/bindings/serial/omap_serial.txt     |    9 +
 drivers/tty/serial/Kconfig                         |    1 +
 drivers/tty/serial/omap-serial.c                   |  168 +++++++++++++++++++-
 3 files changed, 171 insertions(+), 7 deletions(-)

Would we rather move introducing new features to 8250_omap.c rather than doing that to omap-serial and keep feature creeping it such that we wont ever be able to switch to 8250_omap ?

Quoted 7 lines
Quoted 2 lines

Yes please. Also, do we really want to allow mapping random GPIO pins to the UART driver? I guess it would be

See drivers/tty/serial/serial_mctrl_gpio.[ch], these are used for UARTs on SoCs with enough GPIOs available whose UART don't have full Modem signals. It's pretty handy for BT, GSM, LTE, whatever type of modem-like device.

OK

Tony

#5 lore raw

Hi Tony, Nishanth and Felipe,

Quoted 23 lines · Tony Lindgren
Quoted 22 lines · Felipe Balbi
Quoted 20 lines · Tony Lindgren
Quoted 13 lines · Nishanth Menon
Quoted 11 lines · On 05/22/2015 07:16 AM, [email protected] wrote:

From: Yegor Yefremov <[email protected]>

This patch permits to use GPIOs to control the CTS/RTS/DTR/DSR/DCD/RI signals.

---
 .../devicetree/bindings/serial/omap_serial.txt     |    9 +
 drivers/tty/serial/Kconfig                         |    1 +
 drivers/tty/serial/omap-serial.c                   |  168 +++++++++++++++++++-
 3 files changed, 171 insertions(+), 7 deletions(-)
Quoted 3 lines

Would we rather move introducing new features to 8250_omap.c rather than doing that to omap-serial and keep feature creeping it such that we wont ever be able to switch to 8250_omap ?

Yes please. Also, do we really want to allow mapping random GPIO pins to the UART driver? I guess it would be

Quoted 6 lines
Quoted 4 lines

See drivers/tty/serial/serial_mctrl_gpio.[ch], these are used for UARTs on SoCs with enough GPIOs available whose UART don't have full Modem signals. It's pretty handy for BT, GSM, LTE, whatever type of modem-like device.

OK

I need this functionality for a real device having switchable RS232/422/485 driver. So I need both RS232 signals, that are not all possible to get via pinmux, and RS485 transmitter switching.

AFAIK RS485 feature is still not implemented in 8250. That's why I would like this patch to be still included into omap_serial for now.

Yegor

#6 lore raw
Quoted 31 lines · Yegor Yefremov

Hi Tony, Nishanth and Felipe,

Quoted 28 lines · Tony Lindgren
Quoted 26 lines · Felipe Balbi
Quoted 14 lines · Tony Lindgren
Quoted 13 lines · Nishanth Menon
Quoted 11 lines · On 05/22/2015 07:16 AM, [email protected] wrote:

From: Yegor Yefremov <[email protected]>

This patch permits to use GPIOs to control the CTS/RTS/DTR/DSR/DCD/RI signals.

---
 .../devicetree/bindings/serial/omap_serial.txt     |    9 +
 drivers/tty/serial/Kconfig                         |    1 +
 drivers/tty/serial/omap-serial.c                   |  168 +++++++++++++++++++-
 3 files changed, 171 insertions(+), 7 deletions(-)
Quoted 6 lines
Quoted 3 lines

Would we rather move introducing new features to 8250_omap.c rather than doing that to omap-serial and keep feature creeping it such that we wont ever be able to switch to 8250_omap ?

Yes please. Also, do we really want to allow mapping random GPIO pins to the UART driver? I guess it would be

See drivers/tty/serial/serial_mctrl_gpio.[ch], these are used for UARTs on SoCs with enough GPIOs available whose UART don't have full Modem signals. It's pretty handy for BT, GSM, LTE, whatever type of modem-like device.

Quoted 8 lines
Quoted 1 line

OK

I need this functionality for a real device having switchable RS232/422/485 driver. So I need both RS232 signals, that are not all possible to get via pinmux, and RS485 transmitter switching.

AFAIK RS485 feature is still not implemented in 8250. That's why I would like this patch to be still included into omap_serial for now.

No one I know in TI has used or tested the RS485 functionality. Thats why Sebastian left it when he created the 8250_omap driver. Since you have the setup to test it, is it possible for you to migrate that functionality to 8250_omap.c itself rather than enhance omap-serial.c?

We really want to be gravitating towards 8250_omap.c and this patch will take us backwards. As a bonus you get more efficient interrupt handling etc with the new driver.

Thanks,
Sekhar