Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1418423 > unrolled thread

[PATCH 0/8] Improve Rx/Tx DMA implementation

Started byBhuvanchandra DV <bhuvanchandra.dv@toradex.com>
First post2016-06-09 17:30 +0200
Last post2016-06-21 02:30 +0200
Articles 6 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/8] Improve Rx/Tx DMA implementation Bhuvanchandra DV <bhuvanchandra.dv@toradex.com> - 2016-06-09 17:30 +0200
    [PATCH 4/8] tty: serial: fsl_lpuart: Fix broken 8m/s1 support Bhuvanchandra DV <bhuvanchandra.dv@toradex.com> - 2016-06-09 17:30 +0200
    [PATCH 1/8] tty: serial: fsl_lpuart: consider TX FIFO too in tx_empty Bhuvanchandra DV <bhuvanchandra.dv@toradex.com> - 2016-06-09 17:30 +0200
    Re: [PATCH 2/8] tty: serial: fsl_lpuart: support suspend/resume Shawn Guo <shawnguo@kernel.org> - 2016-06-11 16:10 +0200
      Re: [PATCH 2/8] tty: serial: fsl_lpuart: support suspend/resume Stefan Agner <stefan@agner.ch> - 2016-06-14 04:50 +0200
        Re: [PATCH 2/8] tty: serial: fsl_lpuart: support suspend/resume Stephen Boyd <sboyd@codeaurora.org> - 2016-06-21 02:30 +0200

#1418423 — [PATCH 0/8] Improve Rx/Tx DMA implementation

FromBhuvanchandra DV <bhuvanchandra.dv@toradex.com>
Date2016-06-09 17:30 +0200
Subject[PATCH 0/8] Improve Rx/Tx DMA implementation
Message-ID<rIa49-8aG-3@gated-at.bofh.it>
Bhuvanchandra DV (5):
  tty: serial: fsl_lpuart: Fix broken 8m/s1 support
  tty: serial: fsl-lpuart: Use cyclic DMA for Rx
  tty: serial: fsl-lpuart: Use scatter/gather DMA for Tx Drop PIO to DMA
    switching and use scatter/gather DMA for Tx path to improve
    performance.
  tty: serial: fsl-lpuart: Update suspend/resume for DMA mode
  tty: serial: fsl_lpuart: Add support for RS-485

Stefan Agner (3):
  tty: serial: fsl_lpuart: consider TX FIFO too in tx_empty
  tty: serial: fsl_lpuart: support suspend/resume
  tty: serial: fsl_lpuart: fix clearing of receive flag

 drivers/clk/imx/clk-vf610.c     |  12 +-
 drivers/tty/serial/fsl_lpuart.c | 810 +++++++++++++++++++++++-----------------
 2 files changed, 482 insertions(+), 340 deletions(-)

-- 
2.8.3

[toc] | [next] | [standalone]


#1418426 — [PATCH 4/8] tty: serial: fsl_lpuart: Fix broken 8m/s1 support

FromBhuvanchandra DV <bhuvanchandra.dv@toradex.com>
Date2016-06-09 17:30 +0200
Subject[PATCH 4/8] tty: serial: fsl_lpuart: Fix broken 8m/s1 support
Message-ID<rIa4a-8aG-27@gated-at.bofh.it>
In reply to#1418423
By default the driver always configure the mode as 8s1 even when 8m1
mode is selected. Fix this by adding support to control the space/mark bit.

Signed-off-by: Bhuvanchandra DV <bhuvanchandra.dv@toradex.com>
---
 drivers/tty/serial/fsl_lpuart.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 97c1fda..615f191 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -1220,13 +1220,14 @@ lpuart_set_termios(struct uart_port *port, struct ktermios *termios,
 {
 	struct lpuart_port *sport = container_of(port, struct lpuart_port, port);
 	unsigned long flags;
-	unsigned char cr1, old_cr1, old_cr2, cr4, bdh, modem;
+	unsigned char cr1, old_cr1, old_cr2, cr3, cr4, bdh, modem;
 	unsigned int  baud;
 	unsigned int old_csize = old ? old->c_cflag & CSIZE : CS8;
 	unsigned int sbr, brfa;
 
 	cr1 = old_cr1 = readb(sport->port.membase + UARTCR1);
 	old_cr2 = readb(sport->port.membase + UARTCR2);
+	cr3 = readb(sport->port.membase + UARTCR3);
 	cr4 = readb(sport->port.membase + UARTCR4);
 	bdh = readb(sport->port.membase + UARTBDH);
 	modem = readb(sport->port.membase + UARTMODEM);
@@ -1274,7 +1275,10 @@ lpuart_set_termios(struct uart_port *port, struct ktermios *termios,
 	if ((termios->c_cflag & PARENB)) {
 		if (termios->c_cflag & CMSPAR) {
 			cr1 &= ~UARTCR1_PE;
-			cr1 |= UARTCR1_M;
+			if (termios->c_cflag & PARODD)
+				cr3 |= UARTCR3_T8;
+			else
+				cr3 &= ~UARTCR3_T8;
 		} else {
 			cr1 |= UARTCR1_PE;
 			if ((termios->c_cflag & CSIZE) == CS8)
@@ -1342,6 +1346,7 @@ lpuart_set_termios(struct uart_port *port, struct ktermios *termios,
 	writeb(cr4 | brfa, sport->port.membase + UARTCR4);
 	writeb(bdh, sport->port.membase + UARTBDH);
 	writeb(sbr & 0xFF, sport->port.membase + UARTBDL);
+	writeb(cr3, sport->port.membase + UARTCR3);
 	writeb(cr1, sport->port.membase + UARTCR1);
 	writeb(modem, sport->port.membase + UARTMODEM);
 
-- 
2.8.3

[toc] | [prev] | [next] | [standalone]


#1418433 — [PATCH 1/8] tty: serial: fsl_lpuart: consider TX FIFO too in tx_empty

FromBhuvanchandra DV <bhuvanchandra.dv@toradex.com>
Date2016-06-09 17:30 +0200
Subject[PATCH 1/8] tty: serial: fsl_lpuart: consider TX FIFO too in tx_empty
Message-ID<rIa4b-8aG-49@gated-at.bofh.it>
In reply to#1418423
From: Stefan Agner <stefan@agner.ch>

Currently the tx_empty callback only considers the Transmit Complete
Flag (TC). The reference manual is not quite clear if the TC flag
covers the TX FIFO too. Debug prints on real hardware have shown that
from time to time the TC flag is asserted (indicating Transmitter
idle) while there are still data in the TX FIFO. Hence, in this case
the serial core will call the shutdown callback even though there are
data remaining in the TX FIFO buffers.

Avoid early shutdowns by considering the TX FIFO empty flag too. Also
avoid theoretical race conditions between DMA and the driver by
checking whether the TX DMA is in progress too.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 drivers/tty/serial/fsl_lpuart.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 3d79003..fabfa7e 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -810,8 +810,18 @@ static irqreturn_t lpuart32_int(int irq, void *dev_id)
 /* return TIOCSER_TEMT when transmitter is not busy */
 static unsigned int lpuart_tx_empty(struct uart_port *port)
 {
-	return (readb(port->membase + UARTSR1) & UARTSR1_TC) ?
-		TIOCSER_TEMT : 0;
+	struct lpuart_port *sport = container_of(port,
+			struct lpuart_port, port);
+	unsigned char sr1 = readb(port->membase + UARTSR1);
+	unsigned char sfifo = readb(port->membase + UARTSFIFO);
+
+	if (sport->dma_tx_in_progress)
+		return 0;
+
+	if (sr1 & UARTSR1_TC && sfifo & UARTSFIFO_TXEMPT)
+		return TIOCSER_TEMT;
+
+	return 0;
 }
 
 static unsigned int lpuart32_tx_empty(struct uart_port *port)
-- 
2.8.3

[toc] | [prev] | [next] | [standalone]


#1419979 — Re: [PATCH 2/8] tty: serial: fsl_lpuart: support suspend/resume

FromShawn Guo <shawnguo@kernel.org>
Date2016-06-11 16:10 +0200
SubjectRe: [PATCH 2/8] tty: serial: fsl_lpuart: support suspend/resume
Message-ID<rIRLP-45x-9@gated-at.bofh.it>
In reply to#1418423
On Thu, Jun 09, 2016 at 08:40:33PM +0530, Bhuvanchandra DV wrote:
> From: Stefan Agner <stefan@agner.ch>
> 
> In order to allow wake support in STOP sleep mode, clocks are
> needed. Use imx_clk_gate2_cgr to disable automatic clock gating
> in low power mode STOP. This allows to enable wake by UART using:
> echo enabled > /sys/class/tty/ttyLP0/power/wakeup
> 
> However, if wake is not enabled, the driver should disable the
> clocks explicitly to save power.
> 
> Signed-off-by: Stefan Agner <stefan@agner.ch>
> ---
>  drivers/clk/imx/clk-vf610.c     | 12 ++++++------

Please send clock driver changes in a separate patch.

Shawn

>  drivers/tty/serial/fsl_lpuart.c | 16 ++++++++++++++--
>  2 files changed, 20 insertions(+), 8 deletions(-)

[toc] | [prev] | [next] | [standalone]


#1421539 — Re: [PATCH 2/8] tty: serial: fsl_lpuart: support suspend/resume

FromStefan Agner <stefan@agner.ch>
Date2016-06-14 04:50 +0200
SubjectRe: [PATCH 2/8] tty: serial: fsl_lpuart: support suspend/resume
Message-ID<rJMAp-6Yq-5@gated-at.bofh.it>
In reply to#1419979

On June 13, 2016 5:18:19 PM PDT, Bhhuvanchandra DV <bhuvanchandra.dv@toradex.com> wrote:
>Hi Shawn,
>
>On 06/11/2016 02:03 PM, Shawn Guo wrote:
>
>> On Thu, Jun 09, 2016 at 08:40:33PM +0530, Bhuvanchandra DV wrote:
>>> From: Stefan Agner <stefan@agner.ch>
>>>
>>> In order to allow wake support in STOP sleep mode, clocks are
>>> needed. Use imx_clk_gate2_cgr to disable automatic clock gating
>>> in low power mode STOP. This allows to enable wake by UART using:
>>> echo enabled > /sys/class/tty/ttyLP0/power/wakeup
>>>
>>> However, if wake is not enabled, the driver should disable the
>>> clocks explicitly to save power.
>>>
>>> Signed-off-by: Stefan Agner <stefan@agner.ch>
>>> ---
>>>   drivers/clk/imx/clk-vf610.c     | 12 ++++++------
>> Please send clock driver changes in a separate patch.

The changes are dependet on each other, hence I put it in a single patch. But since it is a new feature it shouldn't really matter...

>
>How about splitting this patchset to two? few patches are having minor
>fixes and the few patches might need some review and discussions.
>May be some thing like DMA fixes and the other minor fixes.

I don't think that splitting up the patchset is necessary, with the current order it is possible to pick up the fixes independently...

--
Stefan

>
>--
>Bhuvan
>
>>
>> Shawn
>>
>>>   drivers/tty/serial/fsl_lpuart.c | 16 ++++++++++++++--
>>>   2 files changed, 20 insertions(+), 8 deletions(-)

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

[toc] | [prev] | [next] | [standalone]


#1427159 — Re: [PATCH 2/8] tty: serial: fsl_lpuart: support suspend/resume

FromStephen Boyd <sboyd@codeaurora.org>
Date2016-06-21 02:30 +0200
SubjectRe: [PATCH 2/8] tty: serial: fsl_lpuart: support suspend/resume
Message-ID<rMhJL-6Qh-1@gated-at.bofh.it>
In reply to#1421539
On 06/13, Stefan Agner wrote:
> 
> 
> On June 13, 2016 5:18:19 PM PDT, Bhhuvanchandra DV <bhuvanchandra.dv@toradex.com> wrote:
> >Hi Shawn,
> >
> >On 06/11/2016 02:03 PM, Shawn Guo wrote:
> >
> >> On Thu, Jun 09, 2016 at 08:40:33PM +0530, Bhuvanchandra DV wrote:
> >>> From: Stefan Agner <stefan@agner.ch>
> >>>
> >>> In order to allow wake support in STOP sleep mode, clocks are
> >>> needed. Use imx_clk_gate2_cgr to disable automatic clock gating
> >>> in low power mode STOP. This allows to enable wake by UART using:
> >>> echo enabled > /sys/class/tty/ttyLP0/power/wakeup
> >>>
> >>> However, if wake is not enabled, the driver should disable the
> >>> clocks explicitly to save power.
> >>>
> >>> Signed-off-by: Stefan Agner <stefan@agner.ch>
> >>> ---
> >>>   drivers/clk/imx/clk-vf610.c     | 12 ++++++------
> >> Please send clock driver changes in a separate patch.
> 
> The changes are dependet on each other, hence I put it in a single patch. But since it is a new feature it shouldn't really matter...
> 
> >
> >How about splitting this patchset to two? few patches are having minor
> >fixes and the few patches might need some review and discussions.
> >May be some thing like DMA fixes and the other minor fixes.
> 
> I don't think that splitting up the patchset is necessary, with the current order it is possible to pick up the fixes independently...
> 

I think the main problem is clk and tty subsystems are modified
in the same patch here. Did you want an ack from clk maintainers
here or will the patch be split so we can take the clk part
through clk tree?

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web