Skip to contentSkip to conversation

imx_serial: Generate interrupt on tx empty if enabled

PATCH Applied Guenter Roeck 3 participants 4 messages Aug 20, 2015 – Sep 16, 2015 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 imx_serial: Generate interrupt on tx empty if enabled

Generate an interrupt if the tx buffer is empty and the tx empty interrupt is enabled. This fixes a problem seen when running a Linux image since Linux commit 55c3cb1358e ("serial: imx: remove unneeded imx_transmit_buffer() from imx_start_tx()"). Linux now waits for the tx empty interrupt before starting to send data, causing transmit stalls until there is an interrupt for another reason.

---
 hw/char/imx_serial.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/char/imx_serial.c +3 -1
index f3fbc77..8dc791d 100644
@@ -145,7 +145,9 @@ static void imx_update(IMXSerialState *s)
     uint32_t flags;
 
     flags = (s->usr1 & s->ucr1) & (USR1_TRDY|USR1_RRDY);
-    if (!(s->ucr1 & UCR1_TXMPTYEN)) {
+    if (s->ucr1 & UCR1_TXMPTYEN) {
+        flags |= (s->uts1 & UTS1_TXEMPTY);
+    } else {
         flags &= ~USR1_TRDY;
     }
 
Signature · 1 line
2.1.4
#1 lore raw

Can we please have some r-b or ACK for this? :)

Quoted 28 lines · Guenter Roeck

Generate an interrupt if the tx buffer is empty and the tx empty interrupt is enabled. This fixes a problem seen when running a Linux image since Linux commit 55c3cb1358e ("serial: imx: remove unneeded imx_transmit_buffer() from imx_start_tx()"). Linux now waits for the tx empty interrupt before starting to send data, causing transmit stalls until there is an interrupt for another reason.

---
 hw/char/imx_serial.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/char/imx_serial.c +3 -1
index f3fbc77..8dc791d 100644
@@ -145,7 +145,9 @@ static void imx_update(IMXSerialState *s)
     uint32_t flags;
 
     flags = (s->usr1 & s->ucr1) & (USR1_TRDY|USR1_RRDY);
-    if (!(s->ucr1 & UCR1_TXMPTYEN)) {
+    if (s->ucr1 & UCR1_TXMPTYEN) {
+        flags |= (s->uts1 & UTS1_TXEMPTY);
+    } else {
         flags &= ~USR1_TRDY;
     }
 
Reviewed-by
#2 lore raw
Quoted 12 lines · Michael Tokarev

Can we please have some r-b or ACK for this? :)

Quoted 8 lines · Guenter Roeck

Generate an interrupt if the tx buffer is empty and the tx empty interrupt is enabled. This fixes a problem seen when running a Linux image since Linux commit 55c3cb1358e ("serial: imx: remove unneeded imx_transmit_buffer() from imx_start_tx()"). Linux now waits for the tx empty interrupt before starting to send data, causing transmit stalls until there is an interrupt for another reason.

Looks right, Jean-Christophe may know more though.

Quoted 11 lines
Quoted 11 lines
---
 hw/char/imx_serial.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/char/imx_serial.c +0 -0
index f3fbc77..8dc791d 100644
@@ -145,7 +145,9 @@ static void imx_update(IMXSerialState *s)
     uint32_t flags;
 
Quoted 6 lines

hw/char/imx_serial.c static void imx_update(IMXSerialState *s) · line 151

Quoted 6 lines
hw/char/imx_serial.c +3 -1
     flags = (s->usr1 & s->ucr1) & (USR1_TRDY|USR1_RRDY);
-    if (!(s->ucr1 & UCR1_TXMPTYEN)) {
+    if (s->ucr1 & UCR1_TXMPTYEN) {
+        flags |= (s->uts1 & UTS1_TXEMPTY);
+    } else {
         flags &= ~USR1_TRDY;

Out of scope, but this conditional looks wrong (in original code too). Why does TXMPTYEN gate TRDY?

Regards,
Peter

Quoted 5 lines
Quoted 3 lines
hw/char/imx_serial.c +0 -0
     }
 
#3 lore raw
Quoted 12 lines · Peter Crosthwaite
Quoted 11 lines · Michael Tokarev

Can we please have some r-b or ACK for this? :)

Quoted 7 lines · Guenter Roeck

Generate an interrupt if the tx buffer is empty and the tx empty interrupt is enabled. This fixes a problem seen when running a Linux image since Linux commit 55c3cb1358e ("serial: imx: remove unneeded imx_transmit_buffer() from imx_start_tx()"). Linux now waits for the tx empty interrupt before starting to send data, causing transmit stalls until there is an interrupt for another reason.

Quoted 3 lines
Quoted 1 line
Quoted 1 line

Looks right, Jean-Christophe may know more though.

Thanks, applied to the trivial-patches tree :)

/mjt