* [PATCH v3 0/2] Add CTS/RTS gpio support to STM32 UART
@ 2020-04-20 17:02 ` mani
0 siblings, 0 replies; 18+ messages in thread
From: mani @ 2020-04-20 17:02 UTC (permalink / raw)
To: gregkh, robh+dt, mcoquelin.stm32, alexandre.torgue
Cc: devicetree, Manivannan Sadhasivam, linux-kernel, andy.shevchenko,
linux-serial, fabrice.gasnier, linux-stm32, linux-arm-kernel
From: Manivannan Sadhasivam <mani@kernel.org>
Hello,
This patchset adds CTS/RTS gpio support to STM32 UART controller.
Eventhough the UART controller supports using dedicated CTS/RTS gpios,
sometimes we need to use different set of gpios for flow control.
This is necessary for the upcoming STM32MP1 based board called Stinger96
IoT-Box. On that board, a bluetooth chip is connected to one of the UART
controller but the CTS/RTS lines got swapped mistakenly. So this patchset
serves as a workaround for that hardware bug and also supports the
usecase of using any gpio for CTS/RTS functionality. As per the sugggestion
provided by Andy for v1, I've now switched to mctrl_gpio driver.
This patchset has been validated with Stinger96 IoT-Box connected to Murata
WiFi-BT combo chip.
Thanks,
Mani
Changes in v3:
* Added Andy's reviewed-by tag
* Fixed minor issues spotted by Fabrice
Changes in v2:
As per the review by Andy:
* Switched to mctrl_gpio driver instead of using custom CTS/RTS
implementation
* Removed the use of software flow control terminology.
Manivannan Sadhasivam (2):
dt-bindings: serial: Document CTS/RTS gpios in STM32 UART
tty: serial: Add modem control gpio support for STM32 UART
.../bindings/serial/st,stm32-uart.yaml | 14 +++++
drivers/tty/serial/Kconfig | 1 +
drivers/tty/serial/stm32-usart.c | 53 ++++++++++++++++++-
drivers/tty/serial/stm32-usart.h | 1 +
4 files changed, 67 insertions(+), 2 deletions(-)
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v3 1/2] dt-bindings: serial: Document CTS/RTS gpios in STM32 UART
2020-04-20 17:02 ` mani
@ 2020-04-20 17:02 ` mani
-1 siblings, 0 replies; 18+ messages in thread
From: mani @ 2020-04-20 17:02 UTC (permalink / raw)
To: gregkh, robh+dt, mcoquelin.stm32, alexandre.torgue
Cc: linux-serial, devicetree, linux-stm32, linux-arm-kernel,
linux-kernel, fabrice.gasnier, andy.shevchenko,
Manivannan Sadhasivam
From: Manivannan Sadhasivam <mani@kernel.org>
Document the use of CTS/RTS gpios for flow control in STM32 UART
controller. These properties can be used instead of 'st,hw-flow-ctrl'
for making use of any gpio pins for flow control instead of dedicated
pins. It should be noted that both CTS/RTS and 'st,hw-flow-ctrl'
properties cannot co-exist in a design.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
---
.../devicetree/bindings/serial/st,stm32-uart.yaml | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/Documentation/devicetree/bindings/serial/st,stm32-uart.yaml b/Documentation/devicetree/bindings/serial/st,stm32-uart.yaml
index 238c44192d31..75b8521eb7cb 100644
--- a/Documentation/devicetree/bindings/serial/st,stm32-uart.yaml
+++ b/Documentation/devicetree/bindings/serial/st,stm32-uart.yaml
@@ -48,6 +48,12 @@ properties:
minItems: 1
maxItems: 2
+ cts-gpios:
+ maxItems: 1
+
+ rts-gpios:
+ maxItems: 1
+
wakeup-source: true
rs485-rts-delay: true
@@ -55,6 +61,14 @@ properties:
linux,rs485-enabled-at-boot-time: true
rs485-rx-during-tx: true
+if:
+ required:
+ - st,hw-flow-ctrl
+then:
+ properties:
+ cts-gpios: false
+ rts-gpios: false
+
required:
- compatible
- reg
--
2.17.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 1/2] dt-bindings: serial: Document CTS/RTS gpios in STM32 UART
@ 2020-04-20 17:02 ` mani
0 siblings, 0 replies; 18+ messages in thread
From: mani @ 2020-04-20 17:02 UTC (permalink / raw)
To: gregkh, robh+dt, mcoquelin.stm32, alexandre.torgue
Cc: devicetree, Manivannan Sadhasivam, linux-kernel, andy.shevchenko,
linux-serial, fabrice.gasnier, linux-stm32, linux-arm-kernel
From: Manivannan Sadhasivam <mani@kernel.org>
Document the use of CTS/RTS gpios for flow control in STM32 UART
controller. These properties can be used instead of 'st,hw-flow-ctrl'
for making use of any gpio pins for flow control instead of dedicated
pins. It should be noted that both CTS/RTS and 'st,hw-flow-ctrl'
properties cannot co-exist in a design.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
---
.../devicetree/bindings/serial/st,stm32-uart.yaml | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/Documentation/devicetree/bindings/serial/st,stm32-uart.yaml b/Documentation/devicetree/bindings/serial/st,stm32-uart.yaml
index 238c44192d31..75b8521eb7cb 100644
--- a/Documentation/devicetree/bindings/serial/st,stm32-uart.yaml
+++ b/Documentation/devicetree/bindings/serial/st,stm32-uart.yaml
@@ -48,6 +48,12 @@ properties:
minItems: 1
maxItems: 2
+ cts-gpios:
+ maxItems: 1
+
+ rts-gpios:
+ maxItems: 1
+
wakeup-source: true
rs485-rts-delay: true
@@ -55,6 +61,14 @@ properties:
linux,rs485-enabled-at-boot-time: true
rs485-rx-during-tx: true
+if:
+ required:
+ - st,hw-flow-ctrl
+then:
+ properties:
+ cts-gpios: false
+ rts-gpios: false
+
required:
- compatible
- reg
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH v3 1/2] dt-bindings: serial: Document CTS/RTS gpios in STM32 UART
2020-04-20 17:02 ` mani
@ 2020-05-06 19:59 ` Rob Herring
-1 siblings, 0 replies; 18+ messages in thread
From: Rob Herring @ 2020-05-06 19:59 UTC (permalink / raw)
To: mani
Cc: gregkh, robh+dt, mcoquelin.stm32, alexandre.torgue, devicetree,
Manivannan Sadhasivam, linux-kernel, andy.shevchenko,
linux-serial, fabrice.gasnier, linux-stm32, linux-arm-kernel
On Mon, 20 Apr 2020 22:32:03 +0530, mani@kernel.org wrote:
> From: Manivannan Sadhasivam <mani@kernel.org>
>
> Document the use of CTS/RTS gpios for flow control in STM32 UART
> controller. These properties can be used instead of 'st,hw-flow-ctrl'
> for making use of any gpio pins for flow control instead of dedicated
> pins. It should be noted that both CTS/RTS and 'st,hw-flow-ctrl'
> properties cannot co-exist in a design.
>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
> ---
> .../devicetree/bindings/serial/st,stm32-uart.yaml | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
Reviewed-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v3 1/2] dt-bindings: serial: Document CTS/RTS gpios in STM32 UART
@ 2020-05-06 19:59 ` Rob Herring
0 siblings, 0 replies; 18+ messages in thread
From: Rob Herring @ 2020-05-06 19:59 UTC (permalink / raw)
To: mani
Cc: devicetree, alexandre.torgue, Manivannan Sadhasivam, gregkh,
linux-kernel, andy.shevchenko, robh+dt, mcoquelin.stm32,
linux-serial, fabrice.gasnier, linux-stm32, linux-arm-kernel
On Mon, 20 Apr 2020 22:32:03 +0530, mani@kernel.org wrote:
> From: Manivannan Sadhasivam <mani@kernel.org>
>
> Document the use of CTS/RTS gpios for flow control in STM32 UART
> controller. These properties can be used instead of 'st,hw-flow-ctrl'
> for making use of any gpio pins for flow control instead of dedicated
> pins. It should be noted that both CTS/RTS and 'st,hw-flow-ctrl'
> properties cannot co-exist in a design.
>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
> ---
> .../devicetree/bindings/serial/st,stm32-uart.yaml | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
Reviewed-by: Rob Herring <robh@kernel.org>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v3 1/2] dt-bindings: serial: Document CTS/RTS gpios in STM32 UART
2020-04-20 17:02 ` mani
@ 2020-05-18 7:04 ` Geert Uytterhoeven
-1 siblings, 0 replies; 18+ messages in thread
From: Geert Uytterhoeven @ 2020-05-18 7:04 UTC (permalink / raw)
To: mani
Cc: Greg KH, Rob Herring, Maxime Coquelin, Alexandre Torgue,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
Linux Kernel Mailing List, Andy Shevchenko,
open list:SERIAL DRIVERS, fabrice.gasnier, linux-stm32,
Linux ARM
Hi Mani,
On Mon, Apr 20, 2020 at 7:02 PM <mani@kernel.org> wrote:
> From: Manivannan Sadhasivam <mani@kernel.org>
>
> Document the use of CTS/RTS gpios for flow control in STM32 UART
> controller. These properties can be used instead of 'st,hw-flow-ctrl'
> for making use of any gpio pins for flow control instead of dedicated
> pins. It should be noted that both CTS/RTS and 'st,hw-flow-ctrl'
> properties cannot co-exist in a design.
>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
> --- a/Documentation/devicetree/bindings/serial/st,stm32-uart.yaml
> +++ b/Documentation/devicetree/bindings/serial/st,stm32-uart.yaml
> @@ -55,6 +61,14 @@ properties:
> linux,rs485-enabled-at-boot-time: true
> rs485-rx-during-tx: true
>
> +if:
> + required:
> + - st,hw-flow-ctrl
Perhaps "st,hw-flow-ctrl" should be deprecated, in favor of the standard
"uart-has-rtscts" property?
Of course the driver needs to gain support for the latter first.
> +then:
> + properties:
> + cts-gpios: false
> + rts-gpios: false
> +
> required:
> - compatible
> - reg
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v3 1/2] dt-bindings: serial: Document CTS/RTS gpios in STM32 UART
@ 2020-05-18 7:04 ` Geert Uytterhoeven
0 siblings, 0 replies; 18+ messages in thread
From: Geert Uytterhoeven @ 2020-05-18 7:04 UTC (permalink / raw)
To: mani
Cc: open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
Alexandre Torgue, Greg KH, Linux Kernel Mailing List,
Andy Shevchenko, Rob Herring, Maxime Coquelin,
open list:SERIAL DRIVERS, fabrice.gasnier, linux-stm32,
Linux ARM
Hi Mani,
On Mon, Apr 20, 2020 at 7:02 PM <mani@kernel.org> wrote:
> From: Manivannan Sadhasivam <mani@kernel.org>
>
> Document the use of CTS/RTS gpios for flow control in STM32 UART
> controller. These properties can be used instead of 'st,hw-flow-ctrl'
> for making use of any gpio pins for flow control instead of dedicated
> pins. It should be noted that both CTS/RTS and 'st,hw-flow-ctrl'
> properties cannot co-exist in a design.
>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
> --- a/Documentation/devicetree/bindings/serial/st,stm32-uart.yaml
> +++ b/Documentation/devicetree/bindings/serial/st,stm32-uart.yaml
> @@ -55,6 +61,14 @@ properties:
> linux,rs485-enabled-at-boot-time: true
> rs485-rx-during-tx: true
>
> +if:
> + required:
> + - st,hw-flow-ctrl
Perhaps "st,hw-flow-ctrl" should be deprecated, in favor of the standard
"uart-has-rtscts" property?
Of course the driver needs to gain support for the latter first.
> +then:
> + properties:
> + cts-gpios: false
> + rts-gpios: false
> +
> required:
> - compatible
> - reg
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Linux-stm32] [PATCH v3 1/2] dt-bindings: serial: Document CTS/RTS gpios in STM32 UART
2020-05-18 7:04 ` Geert Uytterhoeven
@ 2020-05-18 7:25 ` Erwan LE RAY
-1 siblings, 0 replies; 18+ messages in thread
From: Erwan LE RAY @ 2020-05-18 7:25 UTC (permalink / raw)
To: Geert Uytterhoeven, mani
Cc: open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
Greg KH, Linux Kernel Mailing List, Andy Shevchenko, Rob Herring,
Maxime Coquelin, open list:SERIAL DRIVERS, Fabrice GASNIER,
linux-stm32, Linux ARM
Hi Geert,
On 5/18/20 9:04 AM, Geert Uytterhoeven wrote:
> Hi Mani,
>
> On Mon, Apr 20, 2020 at 7:02 PM <mani@kernel.org> wrote:
>> From: Manivannan Sadhasivam <mani@kernel.org>
>>
>> Document the use of CTS/RTS gpios for flow control in STM32 UART
>> controller. These properties can be used instead of 'st,hw-flow-ctrl'
>> for making use of any gpio pins for flow control instead of dedicated
>> pins. It should be noted that both CTS/RTS and 'st,hw-flow-ctrl'
>> properties cannot co-exist in a design.
>>
>> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
>> Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
>> --- a/Documentation/devicetree/bindings/serial/st,stm32-uart.yaml
>> +++ b/Documentation/devicetree/bindings/serial/st,stm32-uart.yaml
>> @@ -55,6 +61,14 @@ properties:
>> linux,rs485-enabled-at-boot-time: true
>> rs485-rx-during-tx: true
>>
>> +if:
>> + required:
>> + - st,hw-flow-ctrl
> Perhaps "st,hw-flow-ctrl" should be deprecated, in favor of the standard
> "uart-has-rtscts" property?
> Of course the driver needs to gain support for the latter first.
You're fully right, the patch to deprecate "st, hw-flow-ctrl" and
introduce generic "uart-has-rtscts" property in the driver is ready and
will be sent this week on top of Mani patch.
>
>> +then:
>> + properties:
>> + cts-gpios: false
>> + rts-gpios: false
>> +
>> required:
>> - compatible
>> - reg
> Gr{oetje,eeting}s,
>
> Geert
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Linux-stm32] [PATCH v3 1/2] dt-bindings: serial: Document CTS/RTS gpios in STM32 UART
@ 2020-05-18 7:25 ` Erwan LE RAY
0 siblings, 0 replies; 18+ messages in thread
From: Erwan LE RAY @ 2020-05-18 7:25 UTC (permalink / raw)
To: Geert Uytterhoeven, mani
Cc: open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list:SERIAL DRIVERS, Greg KH, Linux Kernel Mailing List,
Andy Shevchenko, Rob Herring, Maxime Coquelin, Fabrice GASNIER,
linux-stm32, Linux ARM
Hi Geert,
On 5/18/20 9:04 AM, Geert Uytterhoeven wrote:
> Hi Mani,
>
> On Mon, Apr 20, 2020 at 7:02 PM <mani@kernel.org> wrote:
>> From: Manivannan Sadhasivam <mani@kernel.org>
>>
>> Document the use of CTS/RTS gpios for flow control in STM32 UART
>> controller. These properties can be used instead of 'st,hw-flow-ctrl'
>> for making use of any gpio pins for flow control instead of dedicated
>> pins. It should be noted that both CTS/RTS and 'st,hw-flow-ctrl'
>> properties cannot co-exist in a design.
>>
>> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
>> Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
>> --- a/Documentation/devicetree/bindings/serial/st,stm32-uart.yaml
>> +++ b/Documentation/devicetree/bindings/serial/st,stm32-uart.yaml
>> @@ -55,6 +61,14 @@ properties:
>> linux,rs485-enabled-at-boot-time: true
>> rs485-rx-during-tx: true
>>
>> +if:
>> + required:
>> + - st,hw-flow-ctrl
> Perhaps "st,hw-flow-ctrl" should be deprecated, in favor of the standard
> "uart-has-rtscts" property?
> Of course the driver needs to gain support for the latter first.
You're fully right, the patch to deprecate "st, hw-flow-ctrl" and
introduce generic "uart-has-rtscts" property in the driver is ready and
will be sent this week on top of Mani patch.
>
>> +then:
>> + properties:
>> + cts-gpios: false
>> + rts-gpios: false
>> +
>> required:
>> - compatible
>> - reg
> Gr{oetje,eeting}s,
>
> Geert
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v3 2/2] tty: serial: Add modem control gpio support for STM32 UART
2020-04-20 17:02 ` mani
@ 2020-04-20 17:02 ` mani
-1 siblings, 0 replies; 18+ messages in thread
From: mani @ 2020-04-20 17:02 UTC (permalink / raw)
To: gregkh, robh+dt, mcoquelin.stm32, alexandre.torgue
Cc: linux-serial, devicetree, linux-stm32, linux-arm-kernel,
linux-kernel, fabrice.gasnier, andy.shevchenko,
Manivannan Sadhasivam
From: Manivannan Sadhasivam <mani@kernel.org>
STM32 UART controllers have the built in modem control support using
dedicated gpios which can be enabled using 'st,hw-flow-ctrl' flag in DT.
But there might be cases where the board design need to use different
gpios for modem control.
For supporting such cases, this commit adds modem control gpio support
to STM32 UART controller using mctrl_gpio driver.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
---
drivers/tty/serial/Kconfig | 1 +
drivers/tty/serial/stm32-usart.c | 53 ++++++++++++++++++++++++++++++--
drivers/tty/serial/stm32-usart.h | 1 +
3 files changed, 53 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 0aea76cd67ff..e7a6f2130684 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -1462,6 +1462,7 @@ config SERIAL_STM32
tristate "STMicroelectronics STM32 serial port support"
select SERIAL_CORE
depends on ARCH_STM32 || COMPILE_TEST
+ select SERIAL_MCTRL_GPIO if GPIOLIB
help
This driver is for the on-chip Serial Controller on
STMicroelectronics STM32 MCUs.
diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
index 5e93e8d40f59..17c2f3276888 100644
--- a/drivers/tty/serial/stm32-usart.c
+++ b/drivers/tty/serial/stm32-usart.c
@@ -31,6 +31,7 @@
#include <linux/tty_flip.h>
#include <linux/tty.h>
+#include "serial_mctrl_gpio.h"
#include "stm32-usart.h"
static void stm32_stop_tx(struct uart_port *port);
@@ -510,12 +511,29 @@ static void stm32_set_mctrl(struct uart_port *port, unsigned int mctrl)
stm32_set_bits(port, ofs->cr3, USART_CR3_RTSE);
else
stm32_clr_bits(port, ofs->cr3, USART_CR3_RTSE);
+
+ mctrl_gpio_set(stm32_port->gpios, mctrl);
}
static unsigned int stm32_get_mctrl(struct uart_port *port)
{
+ struct stm32_port *stm32_port = to_stm32_port(port);
+ unsigned int ret;
+
/* This routine is used to get signals of: DCD, DSR, RI, and CTS */
- return TIOCM_CAR | TIOCM_DSR | TIOCM_CTS;
+ ret = TIOCM_CAR | TIOCM_DSR | TIOCM_CTS;
+
+ return mctrl_gpio_get(stm32_port->gpios, &ret);
+}
+
+static void stm32_enable_ms(struct uart_port *port)
+{
+ mctrl_gpio_enable_ms(to_stm32_port(port)->gpios);
+}
+
+static void stm32_disable_ms(struct uart_port *port)
+{
+ mctrl_gpio_disable_ms(to_stm32_port(port)->gpios);
}
/* Transmit stop */
@@ -626,6 +644,9 @@ static void stm32_shutdown(struct uart_port *port)
u32 val, isr;
int ret;
+ /* Disable modem control interrupts */
+ stm32_disable_ms(port);
+
val = USART_CR1_TXEIE | USART_CR1_TE;
val |= stm32_port->cr1_irq | USART_CR1_RE;
val |= BIT(cfg->uart_enable_bit);
@@ -764,6 +785,12 @@ static void stm32_set_termios(struct uart_port *port, struct ktermios *termios,
cr3 |= USART_CR3_CTSE | USART_CR3_RTSE;
}
+ /* Handle modem control interrupts */
+ if (UART_ENABLE_MS(port, termios->c_cflag))
+ stm32_enable_ms(port);
+ else
+ stm32_disable_ms(port);
+
usartdiv = DIV_ROUND_CLOSEST(port->uartclk, baud);
/*
@@ -898,6 +925,7 @@ static const struct uart_ops stm32_uart_ops = {
.throttle = stm32_throttle,
.unthrottle = stm32_unthrottle,
.stop_rx = stm32_stop_rx,
+ .enable_ms = stm32_enable_ms,
.break_ctl = stm32_break_ctl,
.startup = stm32_startup,
.shutdown = stm32_shutdown,
@@ -960,10 +988,31 @@ static int stm32_init_port(struct stm32_port *stm32port,
stm32port->port.uartclk = clk_get_rate(stm32port->clk);
if (!stm32port->port.uartclk) {
- clk_disable_unprepare(stm32port->clk);
ret = -EINVAL;
+ goto err_clk;
+ }
+
+ stm32port->gpios = mctrl_gpio_init(&stm32port->port, 0);
+ if (IS_ERR(stm32port->gpios)) {
+ ret = PTR_ERR(stm32port->gpios);
+ goto err_clk;
}
+ /* Both CTS/RTS gpios and "st,hw-flow-ctrl" should not be specified */
+ if (stm32port->hw_flow_control) {
+ if (mctrl_gpio_to_gpiod(stm32port->gpios, UART_GPIO_CTS) ||
+ mctrl_gpio_to_gpiod(stm32port->gpios, UART_GPIO_RTS)) {
+ dev_err(&pdev->dev, "Conflicting RTS/CTS config\n");
+ ret = -EINVAL;
+ goto err_clk;
+ }
+ }
+
+ return ret;
+
+err_clk:
+ clk_disable_unprepare(stm32port->clk);
+
return ret;
}
diff --git a/drivers/tty/serial/stm32-usart.h b/drivers/tty/serial/stm32-usart.h
index db8bf0d4982d..d4c916e78d40 100644
--- a/drivers/tty/serial/stm32-usart.h
+++ b/drivers/tty/serial/stm32-usart.h
@@ -274,6 +274,7 @@ struct stm32_port {
bool fifoen;
int wakeirq;
int rdr_mask; /* receive data register mask */
+ struct mctrl_gpios *gpios; /* modem control gpios */
};
static struct stm32_port stm32_ports[STM32_MAX_PORTS];
--
2.17.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 2/2] tty: serial: Add modem control gpio support for STM32 UART
@ 2020-04-20 17:02 ` mani
0 siblings, 0 replies; 18+ messages in thread
From: mani @ 2020-04-20 17:02 UTC (permalink / raw)
To: gregkh, robh+dt, mcoquelin.stm32, alexandre.torgue
Cc: devicetree, Manivannan Sadhasivam, linux-kernel, andy.shevchenko,
linux-serial, fabrice.gasnier, linux-stm32, linux-arm-kernel
From: Manivannan Sadhasivam <mani@kernel.org>
STM32 UART controllers have the built in modem control support using
dedicated gpios which can be enabled using 'st,hw-flow-ctrl' flag in DT.
But there might be cases where the board design need to use different
gpios for modem control.
For supporting such cases, this commit adds modem control gpio support
to STM32 UART controller using mctrl_gpio driver.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
---
drivers/tty/serial/Kconfig | 1 +
drivers/tty/serial/stm32-usart.c | 53 ++++++++++++++++++++++++++++++--
drivers/tty/serial/stm32-usart.h | 1 +
3 files changed, 53 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 0aea76cd67ff..e7a6f2130684 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -1462,6 +1462,7 @@ config SERIAL_STM32
tristate "STMicroelectronics STM32 serial port support"
select SERIAL_CORE
depends on ARCH_STM32 || COMPILE_TEST
+ select SERIAL_MCTRL_GPIO if GPIOLIB
help
This driver is for the on-chip Serial Controller on
STMicroelectronics STM32 MCUs.
diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
index 5e93e8d40f59..17c2f3276888 100644
--- a/drivers/tty/serial/stm32-usart.c
+++ b/drivers/tty/serial/stm32-usart.c
@@ -31,6 +31,7 @@
#include <linux/tty_flip.h>
#include <linux/tty.h>
+#include "serial_mctrl_gpio.h"
#include "stm32-usart.h"
static void stm32_stop_tx(struct uart_port *port);
@@ -510,12 +511,29 @@ static void stm32_set_mctrl(struct uart_port *port, unsigned int mctrl)
stm32_set_bits(port, ofs->cr3, USART_CR3_RTSE);
else
stm32_clr_bits(port, ofs->cr3, USART_CR3_RTSE);
+
+ mctrl_gpio_set(stm32_port->gpios, mctrl);
}
static unsigned int stm32_get_mctrl(struct uart_port *port)
{
+ struct stm32_port *stm32_port = to_stm32_port(port);
+ unsigned int ret;
+
/* This routine is used to get signals of: DCD, DSR, RI, and CTS */
- return TIOCM_CAR | TIOCM_DSR | TIOCM_CTS;
+ ret = TIOCM_CAR | TIOCM_DSR | TIOCM_CTS;
+
+ return mctrl_gpio_get(stm32_port->gpios, &ret);
+}
+
+static void stm32_enable_ms(struct uart_port *port)
+{
+ mctrl_gpio_enable_ms(to_stm32_port(port)->gpios);
+}
+
+static void stm32_disable_ms(struct uart_port *port)
+{
+ mctrl_gpio_disable_ms(to_stm32_port(port)->gpios);
}
/* Transmit stop */
@@ -626,6 +644,9 @@ static void stm32_shutdown(struct uart_port *port)
u32 val, isr;
int ret;
+ /* Disable modem control interrupts */
+ stm32_disable_ms(port);
+
val = USART_CR1_TXEIE | USART_CR1_TE;
val |= stm32_port->cr1_irq | USART_CR1_RE;
val |= BIT(cfg->uart_enable_bit);
@@ -764,6 +785,12 @@ static void stm32_set_termios(struct uart_port *port, struct ktermios *termios,
cr3 |= USART_CR3_CTSE | USART_CR3_RTSE;
}
+ /* Handle modem control interrupts */
+ if (UART_ENABLE_MS(port, termios->c_cflag))
+ stm32_enable_ms(port);
+ else
+ stm32_disable_ms(port);
+
usartdiv = DIV_ROUND_CLOSEST(port->uartclk, baud);
/*
@@ -898,6 +925,7 @@ static const struct uart_ops stm32_uart_ops = {
.throttle = stm32_throttle,
.unthrottle = stm32_unthrottle,
.stop_rx = stm32_stop_rx,
+ .enable_ms = stm32_enable_ms,
.break_ctl = stm32_break_ctl,
.startup = stm32_startup,
.shutdown = stm32_shutdown,
@@ -960,10 +988,31 @@ static int stm32_init_port(struct stm32_port *stm32port,
stm32port->port.uartclk = clk_get_rate(stm32port->clk);
if (!stm32port->port.uartclk) {
- clk_disable_unprepare(stm32port->clk);
ret = -EINVAL;
+ goto err_clk;
+ }
+
+ stm32port->gpios = mctrl_gpio_init(&stm32port->port, 0);
+ if (IS_ERR(stm32port->gpios)) {
+ ret = PTR_ERR(stm32port->gpios);
+ goto err_clk;
}
+ /* Both CTS/RTS gpios and "st,hw-flow-ctrl" should not be specified */
+ if (stm32port->hw_flow_control) {
+ if (mctrl_gpio_to_gpiod(stm32port->gpios, UART_GPIO_CTS) ||
+ mctrl_gpio_to_gpiod(stm32port->gpios, UART_GPIO_RTS)) {
+ dev_err(&pdev->dev, "Conflicting RTS/CTS config\n");
+ ret = -EINVAL;
+ goto err_clk;
+ }
+ }
+
+ return ret;
+
+err_clk:
+ clk_disable_unprepare(stm32port->clk);
+
return ret;
}
diff --git a/drivers/tty/serial/stm32-usart.h b/drivers/tty/serial/stm32-usart.h
index db8bf0d4982d..d4c916e78d40 100644
--- a/drivers/tty/serial/stm32-usart.h
+++ b/drivers/tty/serial/stm32-usart.h
@@ -274,6 +274,7 @@ struct stm32_port {
bool fifoen;
int wakeirq;
int rdr_mask; /* receive data register mask */
+ struct mctrl_gpios *gpios; /* modem control gpios */
};
static struct stm32_port stm32_ports[STM32_MAX_PORTS];
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH v3 2/2] tty: serial: Add modem control gpio support for STM32 UART
2020-04-20 17:02 ` mani
@ 2020-04-21 12:58 ` Fabrice Gasnier
-1 siblings, 0 replies; 18+ messages in thread
From: Fabrice Gasnier @ 2020-04-21 12:58 UTC (permalink / raw)
To: mani
Cc: gregkh, robh+dt, mcoquelin.stm32, alexandre.torgue, devicetree,
linux-kernel, andy.shevchenko, linux-serial, linux-stm32,
linux-arm-kernel
On 4/20/20 7:02 PM, mani@kernel.org wrote:
> From: Manivannan Sadhasivam <mani@kernel.org>
>
> STM32 UART controllers have the built in modem control support using
> dedicated gpios which can be enabled using 'st,hw-flow-ctrl' flag in DT.
> But there might be cases where the board design need to use different
> gpios for modem control.
>
> For supporting such cases, this commit adds modem control gpio support
> to STM32 UART controller using mctrl_gpio driver.
>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
> ---
> drivers/tty/serial/Kconfig | 1 +
> drivers/tty/serial/stm32-usart.c | 53 ++++++++++++++++++++++++++++++--
> drivers/tty/serial/stm32-usart.h | 1 +
> 3 files changed, 53 insertions(+), 2 deletions(-)
Hi Mani,
You can add my:
Acked-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Thanks,
Fabrice
>
> diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
> index 0aea76cd67ff..e7a6f2130684 100644
> --- a/drivers/tty/serial/Kconfig
> +++ b/drivers/tty/serial/Kconfig
> @@ -1462,6 +1462,7 @@ config SERIAL_STM32
> tristate "STMicroelectronics STM32 serial port support"
> select SERIAL_CORE
> depends on ARCH_STM32 || COMPILE_TEST
> + select SERIAL_MCTRL_GPIO if GPIOLIB
> help
> This driver is for the on-chip Serial Controller on
> STMicroelectronics STM32 MCUs.
> diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
> index 5e93e8d40f59..17c2f3276888 100644
> --- a/drivers/tty/serial/stm32-usart.c
> +++ b/drivers/tty/serial/stm32-usart.c
> @@ -31,6 +31,7 @@
> #include <linux/tty_flip.h>
> #include <linux/tty.h>
>
> +#include "serial_mctrl_gpio.h"
> #include "stm32-usart.h"
>
> static void stm32_stop_tx(struct uart_port *port);
> @@ -510,12 +511,29 @@ static void stm32_set_mctrl(struct uart_port *port, unsigned int mctrl)
> stm32_set_bits(port, ofs->cr3, USART_CR3_RTSE);
> else
> stm32_clr_bits(port, ofs->cr3, USART_CR3_RTSE);
> +
> + mctrl_gpio_set(stm32_port->gpios, mctrl);
> }
>
> static unsigned int stm32_get_mctrl(struct uart_port *port)
> {
> + struct stm32_port *stm32_port = to_stm32_port(port);
> + unsigned int ret;
> +
> /* This routine is used to get signals of: DCD, DSR, RI, and CTS */
> - return TIOCM_CAR | TIOCM_DSR | TIOCM_CTS;
> + ret = TIOCM_CAR | TIOCM_DSR | TIOCM_CTS;
> +
> + return mctrl_gpio_get(stm32_port->gpios, &ret);
> +}
> +
> +static void stm32_enable_ms(struct uart_port *port)
> +{
> + mctrl_gpio_enable_ms(to_stm32_port(port)->gpios);
> +}
> +
> +static void stm32_disable_ms(struct uart_port *port)
> +{
> + mctrl_gpio_disable_ms(to_stm32_port(port)->gpios);
> }
>
> /* Transmit stop */
> @@ -626,6 +644,9 @@ static void stm32_shutdown(struct uart_port *port)
> u32 val, isr;
> int ret;
>
> + /* Disable modem control interrupts */
> + stm32_disable_ms(port);
> +
> val = USART_CR1_TXEIE | USART_CR1_TE;
> val |= stm32_port->cr1_irq | USART_CR1_RE;
> val |= BIT(cfg->uart_enable_bit);
> @@ -764,6 +785,12 @@ static void stm32_set_termios(struct uart_port *port, struct ktermios *termios,
> cr3 |= USART_CR3_CTSE | USART_CR3_RTSE;
> }
>
> + /* Handle modem control interrupts */
> + if (UART_ENABLE_MS(port, termios->c_cflag))
> + stm32_enable_ms(port);
> + else
> + stm32_disable_ms(port);
> +
> usartdiv = DIV_ROUND_CLOSEST(port->uartclk, baud);
>
> /*
> @@ -898,6 +925,7 @@ static const struct uart_ops stm32_uart_ops = {
> .throttle = stm32_throttle,
> .unthrottle = stm32_unthrottle,
> .stop_rx = stm32_stop_rx,
> + .enable_ms = stm32_enable_ms,
> .break_ctl = stm32_break_ctl,
> .startup = stm32_startup,
> .shutdown = stm32_shutdown,
> @@ -960,10 +988,31 @@ static int stm32_init_port(struct stm32_port *stm32port,
>
> stm32port->port.uartclk = clk_get_rate(stm32port->clk);
> if (!stm32port->port.uartclk) {
> - clk_disable_unprepare(stm32port->clk);
> ret = -EINVAL;
> + goto err_clk;
> + }
> +
> + stm32port->gpios = mctrl_gpio_init(&stm32port->port, 0);
> + if (IS_ERR(stm32port->gpios)) {
> + ret = PTR_ERR(stm32port->gpios);
> + goto err_clk;
> }
>
> + /* Both CTS/RTS gpios and "st,hw-flow-ctrl" should not be specified */
> + if (stm32port->hw_flow_control) {
> + if (mctrl_gpio_to_gpiod(stm32port->gpios, UART_GPIO_CTS) ||
> + mctrl_gpio_to_gpiod(stm32port->gpios, UART_GPIO_RTS)) {
> + dev_err(&pdev->dev, "Conflicting RTS/CTS config\n");
> + ret = -EINVAL;
> + goto err_clk;
> + }
> + }
> +
> + return ret;
> +
> +err_clk:
> + clk_disable_unprepare(stm32port->clk);
> +
> return ret;
> }
>
> diff --git a/drivers/tty/serial/stm32-usart.h b/drivers/tty/serial/stm32-usart.h
> index db8bf0d4982d..d4c916e78d40 100644
> --- a/drivers/tty/serial/stm32-usart.h
> +++ b/drivers/tty/serial/stm32-usart.h
> @@ -274,6 +274,7 @@ struct stm32_port {
> bool fifoen;
> int wakeirq;
> int rdr_mask; /* receive data register mask */
> + struct mctrl_gpios *gpios; /* modem control gpios */
> };
>
> static struct stm32_port stm32_ports[STM32_MAX_PORTS];
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v3 2/2] tty: serial: Add modem control gpio support for STM32 UART
@ 2020-04-21 12:58 ` Fabrice Gasnier
0 siblings, 0 replies; 18+ messages in thread
From: Fabrice Gasnier @ 2020-04-21 12:58 UTC (permalink / raw)
To: mani
Cc: devicetree, alexandre.torgue, gregkh, linux-kernel,
andy.shevchenko, robh+dt, mcoquelin.stm32, linux-serial,
linux-stm32, linux-arm-kernel
On 4/20/20 7:02 PM, mani@kernel.org wrote:
> From: Manivannan Sadhasivam <mani@kernel.org>
>
> STM32 UART controllers have the built in modem control support using
> dedicated gpios which can be enabled using 'st,hw-flow-ctrl' flag in DT.
> But there might be cases where the board design need to use different
> gpios for modem control.
>
> For supporting such cases, this commit adds modem control gpio support
> to STM32 UART controller using mctrl_gpio driver.
>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
> ---
> drivers/tty/serial/Kconfig | 1 +
> drivers/tty/serial/stm32-usart.c | 53 ++++++++++++++++++++++++++++++--
> drivers/tty/serial/stm32-usart.h | 1 +
> 3 files changed, 53 insertions(+), 2 deletions(-)
Hi Mani,
You can add my:
Acked-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Thanks,
Fabrice
>
> diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
> index 0aea76cd67ff..e7a6f2130684 100644
> --- a/drivers/tty/serial/Kconfig
> +++ b/drivers/tty/serial/Kconfig
> @@ -1462,6 +1462,7 @@ config SERIAL_STM32
> tristate "STMicroelectronics STM32 serial port support"
> select SERIAL_CORE
> depends on ARCH_STM32 || COMPILE_TEST
> + select SERIAL_MCTRL_GPIO if GPIOLIB
> help
> This driver is for the on-chip Serial Controller on
> STMicroelectronics STM32 MCUs.
> diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
> index 5e93e8d40f59..17c2f3276888 100644
> --- a/drivers/tty/serial/stm32-usart.c
> +++ b/drivers/tty/serial/stm32-usart.c
> @@ -31,6 +31,7 @@
> #include <linux/tty_flip.h>
> #include <linux/tty.h>
>
> +#include "serial_mctrl_gpio.h"
> #include "stm32-usart.h"
>
> static void stm32_stop_tx(struct uart_port *port);
> @@ -510,12 +511,29 @@ static void stm32_set_mctrl(struct uart_port *port, unsigned int mctrl)
> stm32_set_bits(port, ofs->cr3, USART_CR3_RTSE);
> else
> stm32_clr_bits(port, ofs->cr3, USART_CR3_RTSE);
> +
> + mctrl_gpio_set(stm32_port->gpios, mctrl);
> }
>
> static unsigned int stm32_get_mctrl(struct uart_port *port)
> {
> + struct stm32_port *stm32_port = to_stm32_port(port);
> + unsigned int ret;
> +
> /* This routine is used to get signals of: DCD, DSR, RI, and CTS */
> - return TIOCM_CAR | TIOCM_DSR | TIOCM_CTS;
> + ret = TIOCM_CAR | TIOCM_DSR | TIOCM_CTS;
> +
> + return mctrl_gpio_get(stm32_port->gpios, &ret);
> +}
> +
> +static void stm32_enable_ms(struct uart_port *port)
> +{
> + mctrl_gpio_enable_ms(to_stm32_port(port)->gpios);
> +}
> +
> +static void stm32_disable_ms(struct uart_port *port)
> +{
> + mctrl_gpio_disable_ms(to_stm32_port(port)->gpios);
> }
>
> /* Transmit stop */
> @@ -626,6 +644,9 @@ static void stm32_shutdown(struct uart_port *port)
> u32 val, isr;
> int ret;
>
> + /* Disable modem control interrupts */
> + stm32_disable_ms(port);
> +
> val = USART_CR1_TXEIE | USART_CR1_TE;
> val |= stm32_port->cr1_irq | USART_CR1_RE;
> val |= BIT(cfg->uart_enable_bit);
> @@ -764,6 +785,12 @@ static void stm32_set_termios(struct uart_port *port, struct ktermios *termios,
> cr3 |= USART_CR3_CTSE | USART_CR3_RTSE;
> }
>
> + /* Handle modem control interrupts */
> + if (UART_ENABLE_MS(port, termios->c_cflag))
> + stm32_enable_ms(port);
> + else
> + stm32_disable_ms(port);
> +
> usartdiv = DIV_ROUND_CLOSEST(port->uartclk, baud);
>
> /*
> @@ -898,6 +925,7 @@ static const struct uart_ops stm32_uart_ops = {
> .throttle = stm32_throttle,
> .unthrottle = stm32_unthrottle,
> .stop_rx = stm32_stop_rx,
> + .enable_ms = stm32_enable_ms,
> .break_ctl = stm32_break_ctl,
> .startup = stm32_startup,
> .shutdown = stm32_shutdown,
> @@ -960,10 +988,31 @@ static int stm32_init_port(struct stm32_port *stm32port,
>
> stm32port->port.uartclk = clk_get_rate(stm32port->clk);
> if (!stm32port->port.uartclk) {
> - clk_disable_unprepare(stm32port->clk);
> ret = -EINVAL;
> + goto err_clk;
> + }
> +
> + stm32port->gpios = mctrl_gpio_init(&stm32port->port, 0);
> + if (IS_ERR(stm32port->gpios)) {
> + ret = PTR_ERR(stm32port->gpios);
> + goto err_clk;
> }
>
> + /* Both CTS/RTS gpios and "st,hw-flow-ctrl" should not be specified */
> + if (stm32port->hw_flow_control) {
> + if (mctrl_gpio_to_gpiod(stm32port->gpios, UART_GPIO_CTS) ||
> + mctrl_gpio_to_gpiod(stm32port->gpios, UART_GPIO_RTS)) {
> + dev_err(&pdev->dev, "Conflicting RTS/CTS config\n");
> + ret = -EINVAL;
> + goto err_clk;
> + }
> + }
> +
> + return ret;
> +
> +err_clk:
> + clk_disable_unprepare(stm32port->clk);
> +
> return ret;
> }
>
> diff --git a/drivers/tty/serial/stm32-usart.h b/drivers/tty/serial/stm32-usart.h
> index db8bf0d4982d..d4c916e78d40 100644
> --- a/drivers/tty/serial/stm32-usart.h
> +++ b/drivers/tty/serial/stm32-usart.h
> @@ -274,6 +274,7 @@ struct stm32_port {
> bool fifoen;
> int wakeirq;
> int rdr_mask; /* receive data register mask */
> + struct mctrl_gpios *gpios; /* modem control gpios */
> };
>
> static struct stm32_port stm32_ports[STM32_MAX_PORTS];
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v3 0/2] Add CTS/RTS gpio support to STM32 UART
2020-04-20 17:02 ` mani
@ 2020-05-07 14:07 ` Manivannan Sadhasivam
-1 siblings, 0 replies; 18+ messages in thread
From: Manivannan Sadhasivam @ 2020-05-07 14:07 UTC (permalink / raw)
To: gregkh
Cc: linux-serial, devicetree, linux-stm32, linux-arm-kernel,
linux-kernel, fabrice.gasnier, andy.shevchenko, robh+dt,
mcoquelin.stm32, alexandre.torgue
Hi Greg,
On Mon, Apr 20, 2020 at 10:32:02PM +0530, mani@kernel.org wrote:
> From: Manivannan Sadhasivam <mani@kernel.org>
>
> Hello,
>
> This patchset adds CTS/RTS gpio support to STM32 UART controller.
> Eventhough the UART controller supports using dedicated CTS/RTS gpios,
> sometimes we need to use different set of gpios for flow control.
>
> This is necessary for the upcoming STM32MP1 based board called Stinger96
> IoT-Box. On that board, a bluetooth chip is connected to one of the UART
> controller but the CTS/RTS lines got swapped mistakenly. So this patchset
> serves as a workaround for that hardware bug and also supports the
> usecase of using any gpio for CTS/RTS functionality. As per the sugggestion
> provided by Andy for v1, I've now switched to mctrl_gpio driver.
>
> This patchset has been validated with Stinger96 IoT-Box connected to Murata
> WiFi-BT combo chip.
>
Are you planning to take this series for 5.8?
Thanks,
Mani
> Thanks,
> Mani
>
> Changes in v3:
>
> * Added Andy's reviewed-by tag
> * Fixed minor issues spotted by Fabrice
>
> Changes in v2:
>
> As per the review by Andy:
>
> * Switched to mctrl_gpio driver instead of using custom CTS/RTS
> implementation
> * Removed the use of software flow control terminology.
>
> Manivannan Sadhasivam (2):
> dt-bindings: serial: Document CTS/RTS gpios in STM32 UART
> tty: serial: Add modem control gpio support for STM32 UART
>
> .../bindings/serial/st,stm32-uart.yaml | 14 +++++
> drivers/tty/serial/Kconfig | 1 +
> drivers/tty/serial/stm32-usart.c | 53 ++++++++++++++++++-
> drivers/tty/serial/stm32-usart.h | 1 +
> 4 files changed, 67 insertions(+), 2 deletions(-)
>
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v3 0/2] Add CTS/RTS gpio support to STM32 UART
@ 2020-05-07 14:07 ` Manivannan Sadhasivam
0 siblings, 0 replies; 18+ messages in thread
From: Manivannan Sadhasivam @ 2020-05-07 14:07 UTC (permalink / raw)
To: gregkh
Cc: devicetree, mcoquelin.stm32, linux-kernel, andy.shevchenko,
robh+dt, linux-serial, fabrice.gasnier, linux-stm32,
linux-arm-kernel, alexandre.torgue
Hi Greg,
On Mon, Apr 20, 2020 at 10:32:02PM +0530, mani@kernel.org wrote:
> From: Manivannan Sadhasivam <mani@kernel.org>
>
> Hello,
>
> This patchset adds CTS/RTS gpio support to STM32 UART controller.
> Eventhough the UART controller supports using dedicated CTS/RTS gpios,
> sometimes we need to use different set of gpios for flow control.
>
> This is necessary for the upcoming STM32MP1 based board called Stinger96
> IoT-Box. On that board, a bluetooth chip is connected to one of the UART
> controller but the CTS/RTS lines got swapped mistakenly. So this patchset
> serves as a workaround for that hardware bug and also supports the
> usecase of using any gpio for CTS/RTS functionality. As per the sugggestion
> provided by Andy for v1, I've now switched to mctrl_gpio driver.
>
> This patchset has been validated with Stinger96 IoT-Box connected to Murata
> WiFi-BT combo chip.
>
Are you planning to take this series for 5.8?
Thanks,
Mani
> Thanks,
> Mani
>
> Changes in v3:
>
> * Added Andy's reviewed-by tag
> * Fixed minor issues spotted by Fabrice
>
> Changes in v2:
>
> As per the review by Andy:
>
> * Switched to mctrl_gpio driver instead of using custom CTS/RTS
> implementation
> * Removed the use of software flow control terminology.
>
> Manivannan Sadhasivam (2):
> dt-bindings: serial: Document CTS/RTS gpios in STM32 UART
> tty: serial: Add modem control gpio support for STM32 UART
>
> .../bindings/serial/st,stm32-uart.yaml | 14 +++++
> drivers/tty/serial/Kconfig | 1 +
> drivers/tty/serial/stm32-usart.c | 53 ++++++++++++++++++-
> drivers/tty/serial/stm32-usart.h | 1 +
> 4 files changed, 67 insertions(+), 2 deletions(-)
>
> --
> 2.17.1
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v3 0/2] Add CTS/RTS gpio support to STM32 UART
2020-05-07 14:07 ` Manivannan Sadhasivam
@ 2020-05-07 15:34 ` Greg KH
-1 siblings, 0 replies; 18+ messages in thread
From: Greg KH @ 2020-05-07 15:34 UTC (permalink / raw)
To: Manivannan Sadhasivam
Cc: linux-serial, devicetree, linux-stm32, linux-arm-kernel,
linux-kernel, fabrice.gasnier, andy.shevchenko, robh+dt,
mcoquelin.stm32, alexandre.torgue
On Thu, May 07, 2020 at 07:37:50PM +0530, Manivannan Sadhasivam wrote:
> Hi Greg,
>
> On Mon, Apr 20, 2020 at 10:32:02PM +0530, mani@kernel.org wrote:
> > From: Manivannan Sadhasivam <mani@kernel.org>
> >
> > Hello,
> >
> > This patchset adds CTS/RTS gpio support to STM32 UART controller.
> > Eventhough the UART controller supports using dedicated CTS/RTS gpios,
> > sometimes we need to use different set of gpios for flow control.
> >
> > This is necessary for the upcoming STM32MP1 based board called Stinger96
> > IoT-Box. On that board, a bluetooth chip is connected to one of the UART
> > controller but the CTS/RTS lines got swapped mistakenly. So this patchset
> > serves as a workaround for that hardware bug and also supports the
> > usecase of using any gpio for CTS/RTS functionality. As per the sugggestion
> > provided by Andy for v1, I've now switched to mctrl_gpio driver.
> >
> > This patchset has been validated with Stinger96 IoT-Box connected to Murata
> > WiFi-BT combo chip.
> >
>
> Are you planning to take this series for 5.8?
I had to wait for the DT protion to be reviewed before I could do
anything. Give me some time, if it looks ok, it will go into 5.8.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v3 0/2] Add CTS/RTS gpio support to STM32 UART
@ 2020-05-07 15:34 ` Greg KH
0 siblings, 0 replies; 18+ messages in thread
From: Greg KH @ 2020-05-07 15:34 UTC (permalink / raw)
To: Manivannan Sadhasivam
Cc: devicetree, mcoquelin.stm32, linux-kernel, andy.shevchenko,
robh+dt, linux-serial, fabrice.gasnier, linux-stm32,
linux-arm-kernel, alexandre.torgue
On Thu, May 07, 2020 at 07:37:50PM +0530, Manivannan Sadhasivam wrote:
> Hi Greg,
>
> On Mon, Apr 20, 2020 at 10:32:02PM +0530, mani@kernel.org wrote:
> > From: Manivannan Sadhasivam <mani@kernel.org>
> >
> > Hello,
> >
> > This patchset adds CTS/RTS gpio support to STM32 UART controller.
> > Eventhough the UART controller supports using dedicated CTS/RTS gpios,
> > sometimes we need to use different set of gpios for flow control.
> >
> > This is necessary for the upcoming STM32MP1 based board called Stinger96
> > IoT-Box. On that board, a bluetooth chip is connected to one of the UART
> > controller but the CTS/RTS lines got swapped mistakenly. So this patchset
> > serves as a workaround for that hardware bug and also supports the
> > usecase of using any gpio for CTS/RTS functionality. As per the sugggestion
> > provided by Andy for v1, I've now switched to mctrl_gpio driver.
> >
> > This patchset has been validated with Stinger96 IoT-Box connected to Murata
> > WiFi-BT combo chip.
> >
>
> Are you planning to take this series for 5.8?
I had to wait for the DT protion to be reviewed before I could do
anything. Give me some time, if it looks ok, it will go into 5.8.
thanks,
greg k-h
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 18+ messages in thread