diff --git a/sys/src/9/imx8/uartimx.c b/sys/src/9/imx8/uartimx.c index afc7d0096..5d6e0d2f1 100644 --- a/sys/src/9/imx8/uartimx.c +++ b/sys/src/9/imx8/uartimx.c @@ -166,13 +166,16 @@ kick(Uart *u) { u32int *regs = (u32int*)u->regs; - if(u->blocked) - return; - while(regs[USR1] & SR1_TRDY){ - if(u->op >= u->oe && uartstageoutput(u) == 0) + while(u->op < u->oe || uartstageoutput(u)){ + if(u->blocked) break; + if((regs[USR1] & SR1_TRDY) == 0){ + regs[UCR1] |= CR1_TRDYEN; + return; + } regs[UTXD] = *(u->op++) & TX_DATA; } + regs[UCR1] &= ~CR1_TRDYEN; } static void @@ -195,11 +198,11 @@ config(Uart *u) regs[UCR4] = 31<baud) / 1600)-1; regs[UBMR] = (u->freq / 1600)-1; - regs[UCR1] = CR1_UARTEN | CR1_TRDYEN | CR1_RRDYEN; + regs[UCR1] = CR1_UARTEN | CR1_RRDYEN; } static int