Skip to content

Commit

Permalink
serial: mchp_xec: Fix uart_xec_irq_tx_complete function
Browse files Browse the repository at this point in the history
This function is only checking for byte current byte being transmitted.
This patch ensures that function returns `1` until TX is disabled and
no byte is being transmitted.

Signed-off-by: Bernardo Perez Priego <[email protected]>
  • Loading branch information
perezpri committed Aug 30, 2024
1 parent 1540bd7 commit 0302642
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/serial/uart_mchp_xec.c
Original file line number Diff line number Diff line change
Expand Up @@ -749,8 +749,10 @@ static int uart_xec_irq_tx_complete(const struct device *dev)
struct uart_regs *regs = dev_cfg->regs;
k_spinlock_key_t key = k_spin_lock(&dev_data->lock);

int ret = ((regs->LSR & (LSR_TEMT | LSR_THRE))
== (LSR_TEMT | LSR_THRE)) ? 1 : 0;
int ret = (((regs->IER & IER_TBE) == 0) &&
((regs->LSR & (LSR_TEMT | LSR_THRE)) == (LSR_TEMT | LSR_THRE)))
? 1
: 0;

k_spin_unlock(&dev_data->lock, key);

Expand Down

0 comments on commit 0302642

Please sign in to comment.