From: Lee Jones <hidden> Date: 2017-02-01 14:31:54
When hardware flow-control is disabled, manual toggling of the UART's
reset line (RTS) using userland applications (e.g. stty) is not
possible, since the ASC IP does not provide this functionality in the
same was as some other IPs do. Thus, we have to do this manually.
This set ensures the correct Pinctrl groups are configured and
obtained for both manual toggling of the RTS line and for the IP to
take over the lines when HW flow-control is requested by the user.
Lee Jones (10):
serial: st-asc: Ignore the parity error bit if 8-bit mode is enabled
serial: st-asc: Provide RTS functionality
serial: st-asc: Read in all Pinctrl states
serial: st-asc: (De)Register GPIOD and swap Pinctrl profiles
serial: st-asc: Use generic DT binding for announcing RTS/CTS lines
dt-bindings: serial: Update 'uart-has-rtscts' description
ARM: dts: STiH410-b2260: Identify the UART RTS line
ARM: dts: STiH407-pinctrl: Add Pinctrl group for HW flow-control
ARM: dts: STiH407-family: Use new Pinctrl groups
ARM: dts: STiH410-b2260: Enable HW flow-control
.../devicetree/bindings/serial/serial.txt | 3 +-
arch/arm/boot/dts/stih407-family.dtsi | 3 +-
arch/arm/boot/dts/stih407-pinctrl.dtsi | 12 ++-
arch/arm/boot/dts/stih410-b2260.dts | 5 +
drivers/tty/serial/st-asc.c | 101 +++++++++++++++++++--
5 files changed, 110 insertions(+), 14 deletions(-)
--
2.9.3
From: Lee Jones <hidden> Date: 2017-02-01 14:31:59
There are now 2 possible separate/different Pinctrl states which can
be provided from platform data. One which encompasses the lines
required for HW flow-control (CTS/RTS) and another which does not
specify these lines, such that they can be used via GPIO mechanisms
for manually toggling (i.e. from a request by `stty`).
Signed-off-by: Lee Jones <redacted>
---
drivers/tty/serial/st-asc.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
@@ -694,6 +701,7 @@ static int asc_init_port(struct asc_port *ascport,{structuart_port*port=&ascport->port;structresource*res;+intret;port->iotype=UPIO_MEM;port->flags=UPF_BOOT_AUTOCONF;
@@ -720,6 +728,27 @@ static int asc_init_port(struct asc_port *ascport,WARN_ON(ascport->port.uartclk==0);clk_disable_unprepare(ascport->clk);+ascport->pinctrl=devm_pinctrl_get(&pdev->dev);+if(IS_ERR(ascport->pinctrl)){+ret=PTR_ERR(ascport->pinctrl);+dev_err(&pdev->dev,"Failed to get Pinctrl: %d\n",ret);+}++ascport->states[DEFAULT]=+pinctrl_lookup_state(ascport->pinctrl,"default");+if(IS_ERR(ascport->states[DEFAULT])){+ret=PTR_ERR(ascport->states[DEFAULT]);+dev_err(&pdev->dev,+"Failed to look up Pinctrl state 'default': %d\n",ret);+returnret;+}++/* "no-hw-flowctrl" state is optional */+ascport->states[NO_HW_FLOWCTRL]=+pinctrl_lookup_state(ascport->pinctrl,"no-hw-flowctrl");+if(IS_ERR(ascport->states[NO_HW_FLOWCTRL]))+ascport->states[NO_HW_FLOWCTRL]=NULL;+return0;}
From: Lee Jones <hidden> Date: 2017-02-01 14:32:04
When hardware flow-control is disabled, manual toggling of the UART's
reset line (RTS) using userland applications (e.g. stty) is not
possible, since the ASC IP does not provide this functionality in the
same was as some other IPs do. Thus, we have to do this manually.
This patch configures the UART RTS line as a GPIO for manipulation
within the UART driver when HW flow-control is not enabled.
Signed-off-by: Lee Jones <redacted>
---
arch/arm/boot/dts/stih410-b2260.dts | 1 +
1 file changed, 1 insertion(+)
From: Lee Jones <hidden> Date: 2017-02-01 14:32:13
Hardware flow-control capability must be specified at a platform
level in order to inform the ASC driver that the platform is capable
(i.e. are the lines wired up, etc). STiH4{07,10} devices are indeed
capable, so let's provide the property.
Signed-off-by: Lee Jones <redacted>
---
arch/arm/boot/dts/stih410-b2260.dts | 1 +
1 file changed, 1 insertion(+)
From: Lee Jones <hidden> Date: 2017-02-01 14:32:21
Having just defined some new Pinctrl groups for when HW flow-control
is {en,dis}abled, let's reference them for use within the driver.
Signed-off-by: Lee Jones <redacted>
---
arch/arm/boot/dts/stih407-family.dtsi | 3 +--
arch/arm/boot/dts/stih410-b2260.dts | 5 ++++-
2 files changed, 5 insertions(+), 3 deletions(-)
@@ -222,9 +222,8 @@compatible="st,asc";reg=<0x98300000x2c>;interrupts=<GIC_SPI122IRQ_TYPE_NONE>;-pinctrl-names="default";-pinctrl-0=<&pinctrl_serial0>;clocks=<&clk_s_c0_flexgenCLK_EXT2F_A9>;+/* Pinctrl moved out to a per-board configuration */status="disabled";};
From: Lee Jones <hidden> Date: 2017-02-01 14:32:25
Until this point, it has not been possible for userland serial
applications (e.g. stty) to toggle the UART RTS line. This can
be useful with certain configurations. For example, when using
a Mezzanine on a Linaro 96board, RTS line is used to take the
on-board microcontroller in and out of reset.
Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Lee Jones <redacted>
---
drivers/tty/serial/st-asc.c | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
@@ -391,12 +393,27 @@ static unsigned int asc_tx_empty(struct uart_port *port)staticvoidasc_set_mctrl(structuart_port*port,unsignedintmctrl){+structasc_port*ascport=to_asc_port(port);+/*-*Thisroutineisusedforsetingsignalsof:DTR,DCD,CTS/RTS-*WeuseASC'shardwareforCTS/RTS,sodon'tneedanyforthat.-*SomeboardshaveDTRandDCDimplementedusingPIOpins,-*codetodothisshouldbehookedinhere.+*Thisroutineisusedforsetingsignalsof:DTR,DCD,CTSandRTS.+*WeuseASC'shardwareforCTS/RTSwhenhardwareflow-controlis+*enabled,howeveriftheRTSlineisrequiredforanotherpurpose,+*commonlycontrolledusingHUPfromuserspace,thenweneedtotoggle+*itmanually,usingGPIO.+*+*SomeboardsalsohaveDTRandDCDimplementedusingPIOpins,codeto+*dothisshouldbehookedinhere.*/++if(!ascport->rts)+return;++/* If HW flow-control is enabled, we can't fiddle with the RTS line */+if(asc_in(port,ASC_CTL)&ASC_CTL_CTSENABLE)+return;++gpiod_set_value(ascport->rts,mctrl&TIOCM_RTS);}staticunsignedintasc_get_mctrl(structuart_port*port)
From: Lee Jones <hidden> Date: 2017-02-01 14:32:49
'uart-has-rtscts' property and 'rts-gpios|cts-gpios' are normally
mutually exclusive, however it is possible for some drivers to have
a dynamic approach, meaning that both properties can be relevant.
Signed-off-by: Lee Jones <redacted>
---
Documentation/devicetree/bindings/serial/serial.txt | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
@@ -23,7 +23,8 @@ Optional properties: they are available for use (wired and enabled by pinmux configuration). This depends on both the UART hardware and the board wiring. Note that this property is mutually-exclusive with "cts-gpios" and- "rts-gpios" above.+ "rts-gpios" above, unless support is provided to switch between modes+ dynamically. Examples:
From: Lee Jones <hidden> Date: 2017-02-01 14:33:17
Each serial port which supports HW flow-control should have 2 Pinctrl
groups. One for when HW flow-control is in progress, where the IP
will take over controlling the lines and another group which enables
the lines to be toggled using GPIO mechanisms.
Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Lee Jones <redacted>
---
arch/arm/boot/dts/stih407-pinctrl.dtsi | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
From: Lee Jones <hidden> Date: 2017-02-01 14:33:41
When hardware flow-control is disabled, manual toggling of the UART's
reset line (RTS) using userland applications (e.g. stty) is not
possible, since the ASC IP does not provide this functionality in the
same was as some other IPs do. Thus, we have to do this manually.
This patch ensures that when HW flow-control is disabled the RTS/CTS
lines are free to be registered via the GPIO API. It also ensures
any registered GPIO lines are unregistered when HW flow-control is
requested, allowing the IP to control them automatically.
Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Lee Jones <redacted>
---
drivers/tty/serial/st-asc.c | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
From: Lee Jones <hidden> Date: 2017-02-01 14:34:01
The datasheet states:
"If the MODE field selects an 8-bit frame then this [parity error] bit
is undefined. Software should ignore this bit when reading 8-bit frames."
Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Lee Jones <redacted>
---
drivers/tty/serial/st-asc.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
From: Lee Jones <hidden> Date: 2017-02-01 14:39:44
The initial binding 'st,hw-flow-control' isn't used anywhere, in neither
in upstream nor downstream kernels. It isn't even documented in
dt-bindings, so we can safely assume it's safe to swap to the generic
one.
Signed-off-by: Lee Jones <redacted>
---
drivers/tty/serial/st-asc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Peter Griffin <peter.griffin@linaro.org> Date: 2017-02-01 14:53:54
On Wed, 01 Feb 2017, Lee Jones wrote:
Hardware flow-control capability must be specified at a platform
level in order to inform the ASC driver that the platform is capable
(i.e. are the lines wired up, etc). STiH4{07,10} devices are indeed
capable, so let's provide the property.
Signed-off-by: Lee Jones <redacted>
Acked-by: Peter Griffin <peter.griffin@linaro.org>
From: Peter Griffin <peter.griffin@linaro.org> Date: 2017-02-01 14:55:11
On Wed, 01 Feb 2017, Lee Jones wrote:
There are now 2 possible separate/different Pinctrl states which can
be provided from platform data. One which encompasses the lines
required for HW flow-control (CTS/RTS) and another which does not
specify these lines, such that they can be used via GPIO mechanisms
for manually toggling (i.e. from a request by `stty`).
Signed-off-by: Lee Jones <redacted>
Acked-by: Peter Griffin <peter.griffin@linaro.org>
@@ -694,6 +701,7 @@ static int asc_init_port(struct asc_port *ascport,{structuart_port*port=&ascport->port;structresource*res;+intret;port->iotype=UPIO_MEM;port->flags=UPF_BOOT_AUTOCONF;
@@ -720,6 +728,27 @@ static int asc_init_port(struct asc_port *ascport,WARN_ON(ascport->port.uartclk==0);clk_disable_unprepare(ascport->clk);+ascport->pinctrl=devm_pinctrl_get(&pdev->dev);+if(IS_ERR(ascport->pinctrl)){+ret=PTR_ERR(ascport->pinctrl);+dev_err(&pdev->dev,"Failed to get Pinctrl: %d\n",ret);+}++ascport->states[DEFAULT]=+pinctrl_lookup_state(ascport->pinctrl,"default");+if(IS_ERR(ascport->states[DEFAULT])){+ret=PTR_ERR(ascport->states[DEFAULT]);+dev_err(&pdev->dev,+"Failed to look up Pinctrl state 'default': %d\n",ret);+returnret;+}++/* "no-hw-flowctrl" state is optional */+ascport->states[NO_HW_FLOWCTRL]=+pinctrl_lookup_state(ascport->pinctrl,"no-hw-flowctrl");+if(IS_ERR(ascport->states[NO_HW_FLOWCTRL]))+ascport->states[NO_HW_FLOWCTRL]=NULL;+return0;}
From: Peter Griffin <peter.griffin@linaro.org> Date: 2017-02-01 14:55:48
On Wed, 01 Feb 2017, Lee Jones wrote:
When hardware flow-control is disabled, manual toggling of the UART's
reset line (RTS) using userland applications (e.g. stty) is not
possible, since the ASC IP does not provide this functionality in the
same was as some other IPs do. Thus, we have to do this manually.
This patch configures the UART RTS line as a GPIO for manipulation
within the UART driver when HW flow-control is not enabled.
Signed-off-by: Lee Jones <redacted>
Acked-by: Peter Griffin <peter.griffin@linaro.org>
From: Peter Griffin <peter.griffin@linaro.org> Date: 2017-02-01 14:57:00
On Wed, 01 Feb 2017, Lee Jones wrote:
The initial binding 'st,hw-flow-control' isn't used anywhere, in neither
in upstream nor downstream kernels. It isn't even documented in
dt-bindings, so we can safely assume it's safe to swap to the generic
one.
Signed-off-by: Lee Jones <redacted>
Acked-by: Peter Griffin <peter.griffin@linaro.org>
From: Peter Griffin <peter.griffin@linaro.org> Date: 2017-02-01 14:57:22
On Wed, 01 Feb 2017, Lee Jones wrote:
'uart-has-rtscts' property and 'rts-gpios|cts-gpios' are normally
mutually exclusive, however it is possible for some drivers to have
a dynamic approach, meaning that both properties can be relevant.
Signed-off-by: Lee Jones <redacted>
Acked-by: Peter Griffin <peter.griffin@linaro.org>
@@ -23,7 +23,8 @@ Optional properties: they are available for use (wired and enabled by pinmux configuration). This depends on both the UART hardware and the board wiring. Note that this property is mutually-exclusive with "cts-gpios" and- "rts-gpios" above.+ "rts-gpios" above, unless support is provided to switch between modes+ dynamically. Examples:
@@ -222,9 +222,8 @@compatible="st,asc";reg=<0x98300000x2c>;interrupts=<GIC_SPI122IRQ_TYPE_NONE>;-pinctrl-names="default";-pinctrl-0=<&pinctrl_serial0>;clocks=<&clk_s_c0_flexgenCLK_EXT2F_A9>;+/* Pinctrl moved out to a per-board configuration */status="disabled";};
On Wed, Feb 01, 2017 at 02:31:35PM +0000, Lee Jones wrote:
When hardware flow-control is disabled, manual toggling of the UART's
reset line (RTS) using userland applications (e.g. stty) is not
possible, since the ASC IP does not provide this functionality in the
same was as some other IPs do. Thus, we have to do this manually.
This set ensures the correct Pinctrl groups are configured and
obtained for both manual toggling of the RTS line and for the IP to
take over the lines when HW flow-control is requested by the user.
I see 2 series that are listed as "v2", which one to take?
I know, I'll drop both and wait for an updated set with all of the acks
added to them...
Please fix up and resend.
thanks,
greg k-h
From: Lee Jones <hidden> Date: 2017-02-03 10:17:59
On Fri, 03 Feb 2017, Greg KH wrote:
On Wed, Feb 01, 2017 at 02:31:35PM +0000, Lee Jones wrote:
quoted
When hardware flow-control is disabled, manual toggling of the UART's
reset line (RTS) using userland applications (e.g. stty) is not
possible, since the ASC IP does not provide this functionality in the
same was as some other IPs do. Thus, we have to do this manually.
This set ensures the correct Pinctrl groups are configured and
obtained for both manual toggling of the RTS line and for the IP to
take over the lines when HW flow-control is requested by the user.
I see 2 series that are listed as "v2", which one to take?
The one which was sent most recently. ;)
I know, I'll drop both and wait for an updated set with all of the acks
added to them...
Easy way out. ;)
Please fix up and resend.
Okay, give me 5.
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog