Commit b495021
tty: serial: 8250_omap: fix TX with DMA for am33xx
Commit 1788cf6 ("tty: serial: switch from circ_buf to kfifo")
introduced an error in the TX DMA handling for 8250_omap.
When the OMAP_DMA_TX_KICK flag is set, the "skip_byte" is pulled from
the kfifo and emitted directly in order to start the DMA. While the
kfifo is updated, dma->tx_size is not decreased. This leads to
uart_xmit_advance() called in omap_8250_dma_tx_complete() advancing the
kfifo by one too much.
In practice, transmitting N bytes has been seen to result in the last
N-1 bytes being sent repeatedly.
This change fixes the problem by moving all of the dma setup after the
OMAP_DMA_TX_KICK handling and using kfifo_len() instead of the DMA size
for the 4-byte cutoff check. This slightly changes the behaviour at
buffer wraparound, but it still transmits the correct bytes somehow.
Now, the "skip_byte" would no longer be accounted to the stats. As
previously, dma->tx_size included also this skip byte, up->icount.tx was
updated by aforementioned uart_xmit_advance() in
omap_8250_dma_tx_complete(). Fix this by using the uart_fifo_out()
helper instead of bare kfifo_get().
Based on patch by Mans Rullgard <[email protected]>
Signed-off-by: "Jiri Slaby (SUSE)" <[email protected]>
Fixes: 1788cf6 ("tty: serial: switch from circ_buf to kfifo")
Link: https://lore.kernel.org/all/[email protected]/
Reported-by: Mans Rullgard <[email protected]>
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>1 parent 81cf4d7 commit b495021
1 file changed
+10
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1173 | 1173 | | |
1174 | 1174 | | |
1175 | 1175 | | |
1176 | | - | |
1177 | | - | |
1178 | | - | |
1179 | | - | |
1180 | | - | |
1181 | | - | |
1182 | | - | |
1183 | | - | |
1184 | | - | |
1185 | | - | |
1186 | 1176 | | |
1187 | 1177 | | |
1188 | 1178 | | |
| |||
1207 | 1197 | | |
1208 | 1198 | | |
1209 | 1199 | | |
1210 | | - | |
| 1200 | + | |
1211 | 1201 | | |
1212 | 1202 | | |
1213 | 1203 | | |
1214 | | - | |
| 1204 | + | |
1215 | 1205 | | |
1216 | 1206 | | |
1217 | 1207 | | |
1218 | 1208 | | |
1219 | | - | |
1220 | | - | |
1221 | | - | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
1222 | 1216 | | |
1223 | 1217 | | |
1224 | 1218 | | |
| |||
1228 | 1222 | | |
1229 | 1223 | | |
1230 | 1224 | | |
| 1225 | + | |
1231 | 1226 | | |
1232 | 1227 | | |
1233 | 1228 | | |
| |||
0 commit comments