linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Misc omap GPIO/UART fixes
@ 2024-10-10 18:48 Judith Mendez
  2024-10-10 18:48 ` [PATCH 1/2] gpio: omap: Add omap_gpio_disable/enable_irq calls Judith Mendez
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Judith Mendez @ 2024-10-10 18:48 UTC (permalink / raw)
  To: Grygorii Strashko, Santosh Shilimkar, Kevin Hilman, Linus Walleij,
	Bartosz Golaszewski
  Cc: linux-omap, linux-gpio, linux-kernel, linux-serial, 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.

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
-- 
2.46.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] gpio: omap: Add omap_gpio_disable/enable_irq calls
  2024-10-10 18:48 [PATCH 0/2] Misc omap GPIO/UART fixes Judith Mendez
@ 2024-10-10 18:48 ` Judith Mendez
  2024-10-10 18:48 ` [PATCH 2/2] serial: 8250: omap: Move pm_runtime_get_sync Judith Mendez
  2024-10-11 16:58 ` [PATCH 0/2] Misc omap GPIO/UART fixes Judith Mendez
  2 siblings, 0 replies; 5+ messages in thread
From: Judith Mendez @ 2024-10-10 18:48 UTC (permalink / raw)
  To: Grygorii Strashko, Santosh Shilimkar, Kevin Hilman, Linus Walleij,
	Bartosz Golaszewski
  Cc: linux-omap, linux-gpio, linux-kernel, linux-serial, Judith Mendez,
	Bin Liu

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.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Judith Mendez <jm@ti.com>
---
 drivers/gpio/gpio-omap.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 76d5d87e9681..913e6ece1238 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -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,
-- 
2.46.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] serial: 8250: omap: Move pm_runtime_get_sync
  2024-10-10 18:48 [PATCH 0/2] Misc omap GPIO/UART fixes Judith Mendez
  2024-10-10 18:48 ` [PATCH 1/2] gpio: omap: Add omap_gpio_disable/enable_irq calls Judith Mendez
@ 2024-10-10 18:48 ` Judith Mendez
  2024-10-11  4:46   ` Greg KH
  2024-10-11 16:58 ` [PATCH 0/2] Misc omap GPIO/UART fixes Judith Mendez
  2 siblings, 1 reply; 5+ messages in thread
From: Judith Mendez @ 2024-10-10 18:48 UTC (permalink / raw)
  To: Grygorii Strashko, Santosh Shilimkar, Kevin Hilman, Linus Walleij,
	Bartosz Golaszewski
  Cc: linux-omap, linux-gpio, linux-kernel, linux-serial, Judith Mendez,
	Bin Liu

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")
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Judith Mendez <jm@ti.com>
---
 drivers/tty/serial/8250/8250_omap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
index 88b58f44e4e9..0dd68bdbfbcf 100644
--- a/drivers/tty/serial/8250/8250_omap.c
+++ b/drivers/tty/serial/8250/8250_omap.c
@@ -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);
-- 
2.46.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] serial: 8250: omap: Move pm_runtime_get_sync
  2024-10-10 18:48 ` [PATCH 2/2] serial: 8250: omap: Move pm_runtime_get_sync Judith Mendez
@ 2024-10-11  4:46   ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2024-10-11  4:46 UTC (permalink / raw)
  To: Judith Mendez
  Cc: Grygorii Strashko, Santosh Shilimkar, Kevin Hilman, Linus Walleij,
	Bartosz Golaszewski, linux-omap, linux-gpio, linux-kernel,
	linux-serial, Bin Liu

On Thu, Oct 10, 2024 at 01:48:02PM -0500, Judith Mendez wrote:
> 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")
> Signed-off-by: Bin Liu <b-liu@ti.com>
> Signed-off-by: Judith Mendez <jm@ti.com>
> ---
>  drivers/tty/serial/8250/8250_omap.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
> index 88b58f44e4e9..0dd68bdbfbcf 100644
> --- a/drivers/tty/serial/8250/8250_omap.c
> +++ b/drivers/tty/serial/8250/8250_omap.c
> @@ -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);
> -- 
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] Misc omap GPIO/UART fixes
  2024-10-10 18:48 [PATCH 0/2] Misc omap GPIO/UART fixes Judith Mendez
  2024-10-10 18:48 ` [PATCH 1/2] gpio: omap: Add omap_gpio_disable/enable_irq calls Judith Mendez
  2024-10-10 18:48 ` [PATCH 2/2] serial: 8250: omap: Move pm_runtime_get_sync Judith Mendez
@ 2024-10-11 16:58 ` Judith Mendez
  2 siblings, 0 replies; 5+ messages in thread
From: Judith Mendez @ 2024-10-11 16:58 UTC (permalink / raw)
  To: Santosh Shilimkar, Kevin Hilman, Linus Walleij,
	Bartosz Golaszewski
  Cc: linux-omap, linux-gpio, linux-kernel, linux-serial

Hi all,

On 10/10/24 1:48 PM, Judith Mendez wrote:
> 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.

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

~ Judith


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-10-11 16:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-10 18:48 [PATCH 0/2] Misc omap GPIO/UART fixes Judith Mendez
2024-10-10 18:48 ` [PATCH 1/2] gpio: omap: Add omap_gpio_disable/enable_irq calls Judith Mendez
2024-10-10 18:48 ` [PATCH 2/2] serial: 8250: omap: Move pm_runtime_get_sync Judith Mendez
2024-10-11  4:46   ` Greg KH
2024-10-11 16:58 ` [PATCH 0/2] Misc omap GPIO/UART fixes Judith Mendez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).