Skip to contentSkip to conversation

Misc omap GPIO/UART fixes

PATCH Superseded Judith Mendez 2 participants 5 messages Oct 10, 2024 – Oct 11, 2024

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Misc omap GPIO/UART fixes

This patch series carries some miscellaneous omap driver fixes for GPIO and UART drivers.

For GPIO, add gpio_enable and gpio_disable calls to gpio-omap which fixes an issue where if there is an irq storm, serial console is unresponsive.

For UART, move pm_runtime_get_sync since the current order of omap_8250_rx_dma_flush and pm_runtime_get_sync calls are set in a way that when omap_8250_shutdown returns, dma->rx_running is set and this causes issues next time the UART is re-opened.

Judith Mendez (2):
gpio: omap: Add omap_gpio_disable/enable_irq calls
serial: 8250: omap: Move pm_runtime_get_sync

 drivers/gpio/gpio-omap.c            | 29 +++++++++++++++++++++++++++++
 drivers/tty/serial/8250/8250_omap.c |  4 ++--
 2 files changed, 31 insertions(+), 2 deletions(-)

base-commit: f45840d172a06d07a1a408b38bdb0be9ab3fd8cb

Signature · 1 line
2.46.2
#1 lore raw

PATCH 1/2 gpio: omap: Add omap_gpio_disable/enable_irq calls

Add omap_gpio_disable_irq and omap_gpio_enable_irq calls in gpio-omap.

Currently, kernel cannot disable gpio interrupts in case of a irq storm, so add omap_gpio_disable_irq so that interrupts can be disabled/enabled.

---
 drivers/gpio/gpio-omap.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
drivers/gpio/gpio-omap.c +29 -0
index 76d5d87e9681..913e6ece1238 100644
@@ -711,6 +711,31 @@ static void omap_gpio_unmask_irq(struct irq_data *d)
 	raw_spin_unlock_irqrestore(&bank->lock, flags);
 }
 
+static void omap_gpio_set_irq(struct irq_data *d, bool enable)
+{
+	struct gpio_bank *bank = omap_irq_data_get_bank(d);
+	unsigned int offset = d->hwirq;
+	unsigned long flags;
+
+	raw_spin_lock_irqsave(&bank->lock, flags);
+	omap_set_gpio_irqenable(bank, offset, enable);
+	raw_spin_unlock_irqrestore(&bank->lock, flags);
+}
+
+static void omap_gpio_disable_irq(struct irq_data *d)
+{
+	bool enable = 1;
+
+	omap_gpio_set_irq(d, !enable);
+}
+
+static void omap_gpio_enable_irq(struct irq_data *d)
+{
+	bool enable = 1;
+
+	omap_gpio_set_irq(d, enable);
+}
+
 static void omap_gpio_irq_print_chip(struct irq_data *d, struct seq_file *p)
 {
 	struct gpio_bank *bank = omap_irq_data_get_bank(d);
@@ -723,6 +748,8 @@ static const struct irq_chip omap_gpio_irq_chip = {
 	.irq_shutdown = omap_gpio_irq_shutdown,
 	.irq_mask = omap_gpio_mask_irq,
 	.irq_unmask = omap_gpio_unmask_irq,
+	.irq_disable = omap_gpio_disable_irq,
+	.irq_enable = omap_gpio_enable_irq,
 	.irq_set_type = omap_gpio_irq_type,
 	.irq_set_wake = omap_gpio_wake_enable,
 	.irq_bus_lock = omap_gpio_irq_bus_lock,
@@ -737,6 +764,8 @@ static const struct irq_chip omap_gpio_irq_chip_nowake = {
 	.irq_shutdown = omap_gpio_irq_shutdown,
 	.irq_mask = omap_gpio_mask_irq,
 	.irq_unmask = omap_gpio_unmask_irq,
+	.irq_disable = omap_gpio_disable_irq,
+	.irq_enable = omap_gpio_enable_irq,
 	.irq_set_type = omap_gpio_irq_type,
 	.irq_bus_lock = omap_gpio_irq_bus_lock,
 	.irq_bus_sync_unlock = gpio_irq_bus_sync_unlock,
Signature · 1 line
2.46.2
#2 lore raw

PATCH 2/2 serial: 8250: omap: Move pm_runtime_get_sync

In reply to Judith Mendez

Currently in omap_8250_shutdown, the dma->rx_running flag is set to zero in omap_8250_rx_dma_flush. Next pm_runtime_get_sync is called, which is a runtime resume call stack which can re-set the flag. When the call omap_8250_shutdown returns, the flag is expected to be UN-SET, but this is not the case. This is causing issues the next time UART is re-opened and omap_8250_rx_dma is called. Fix by moving pm_runtime_get_sync before the omap_8250_rx_dma_flush.

Fixes 0e31c8d173ab ("tty: serial: 8250_omap: add custom DMA-RX callback")
---
 drivers/tty/serial/8250/8250_omap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/8250/8250_omap.c +2 -2
index 88b58f44e4e9..0dd68bdbfbcf 100644
@@ -776,12 +776,12 @@ static void omap_8250_shutdown(struct uart_port *port)
 	struct uart_8250_port *up = up_to_u8250p(port);
 	struct omap8250_priv *priv = port->private_data;
 
+	pm_runtime_get_sync(port->dev);
+
 	flush_work(&priv->qos_work);
 	if (up->dma)
 		omap_8250_rx_dma_flush(up);
 
-	pm_runtime_get_sync(port->dev);
-
 	serial_out(up, UART_OMAP_WER, 0);
 	if (priv->habit & UART_HAS_EFR2)
 		serial_out(up, UART_OMAP_EFR2, 0x0);
Signature · 1 line
2.46.2
maintainer
#3 lore raw

Re: [PATCH 2/2] serial: 8250: omap: Move pm_runtime_get_sync

Quoted 40 lines · Judith Mendez

Currently in omap_8250_shutdown, the dma->rx_running flag is set to zero in omap_8250_rx_dma_flush. Next pm_runtime_get_sync is called, which is a runtime resume call stack which can re-set the flag. When the call omap_8250_shutdown returns, the flag is expected to be UN-SET, but this is not the case. This is causing issues the next time UART is re-opened and omap_8250_rx_dma is called. Fix by moving pm_runtime_get_sync before the omap_8250_rx_dma_flush.

Fixes 0e31c8d173ab ("tty: serial: 8250_omap: add custom DMA-RX callback")
---
 drivers/tty/serial/8250/8250_omap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/8250/8250_omap.c +2 -2
index 88b58f44e4e9..0dd68bdbfbcf 100644
@@ -776,12 +776,12 @@ static void omap_8250_shutdown(struct uart_port *port)
 	struct uart_8250_port *up = up_to_u8250p(port);
 	struct omap8250_priv *priv = port->private_data;
 
+	pm_runtime_get_sync(port->dev);
+
 	flush_work(&priv->qos_work);
 	if (up->dma)
 		omap_8250_rx_dma_flush(up);
 
-	pm_runtime_get_sync(port->dev);
-
 	serial_out(up, UART_OMAP_WER, 0);
 	if (priv->habit & UART_HAS_EFR2)
 		serial_out(up, UART_OMAP_EFR2, 0x0);
Signature · 1 line
2.46.2

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree.

You are receiving this message because of the following common error(s) as indicated below:

- You have marked a patch with a "Fixes:" tag for a commit that is in an older released kernel, yet you do not have a cc: stable line in the signed-off-by area at all, which means that the patch will not be applied to any older kernel releases. To properly fix this, please follow the documented rules in the Documentation/process/stable-kernel-rules.rst file for how to resolve this.

If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers.

thanks,

greg k-h's patch email bot

#4 lore raw
In reply to Judith Mendez

Hi all,

Quoted 7 lines · Judith Mendez

This patch series carries some miscellaneous omap driver fixes for GPIO and UART drivers.

For GPIO, add gpio_enable and gpio_disable calls to gpio-omap which fixes an issue where if there is an irq storm, serial console is unresponsive.

Quoted 6 lines

For UART, move pm_runtime_get_sync since the current order of omap_8250_rx_dma_flush and pm_runtime_get_sync calls are set in a way that when omap_8250_shutdown returns, dma->rx_running is set and this causes issues next time the UART is re-opened.

Please ignore this patch series, I will be re-sending this patch series with some CC list cleanups.

~ Judith