From bc4a52f9100b3c9db496fec1cbe0538eb77b059c Mon Sep 17 00:00:00 2001 From: Serg Podtynnyi Date: Sat, 3 May 2025 23:54:19 +0700 Subject: [PATCH] arch/arm/rp23xx: update serial code smp fixes from cxd56 Most of the code is the same, update to recent fixes Signed-off-by: Serg Podtynnyi --- arch/arm/src/rp23xx/rp23xx_serial.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/arch/arm/src/rp23xx/rp23xx_serial.c b/arch/arm/src/rp23xx/rp23xx_serial.c index eedcfcb2102..b4d826ef524 100644 --- a/arch/arm/src/rp23xx/rp23xx_serial.c +++ b/arch/arm/src/rp23xx/rp23xx_serial.c @@ -772,11 +772,11 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg) #endif priv->baud = cfgetispeed(termiosp); + spin_unlock_irqrestore(&priv->lock, flags); + /* Configure the UART line format and speed. */ up_set_format(dev); - - spin_unlock_irqrestore(&priv->lock, flags); } break; #endif @@ -903,7 +903,7 @@ static void up_txint(struct uart_dev_s *dev, bool enable) struct up_dev_s *priv = (struct up_dev_s *)dev->priv; irqstate_t flags; - flags = enter_critical_section(); + flags = spin_lock_irqsave(&priv->lock); if (enable) { #ifndef CONFIG_SUPPRESS_SERIAL_INTS @@ -914,7 +914,13 @@ static void up_txint(struct uart_dev_s *dev, bool enable) * interrupts disabled (note this may recurse). */ +# ifdef CONFIG_SMP + spin_unlock_irqrestore(&priv->lock, flags); +# endif uart_xmitchars(dev); +# ifdef CONFIG_SMP + flags = spin_lock_irqsave(&priv->lock); +# endif #endif } else @@ -922,8 +928,7 @@ static void up_txint(struct uart_dev_s *dev, bool enable) priv->ier &= ~RP23XX_UART_UARTICR_TXIC; up_serialout(priv, RP23XX_UART_UARTIMSC_OFFSET, priv->ier); } - - leave_critical_section(flags); + spin_unlock_irqrestore(&priv->lock, flags); } /**************************************************************************** @@ -967,7 +972,7 @@ static bool up_txempty(struct uart_dev_s *dev) * * Description: * Performs the low level UART initialization early in debug so that the - * serial console will be available during bootup. This must be called + * serial console will be available during boot up. This must be called * before arm_serialinit. * * NOTE: Configuration of the CONSOLE UART was performed by up_lowsetup()