Misc OMAP GPIO/UART fixes
Subsystems (3)
PATCH RESEND 1/2 gpio: omap: Add omap_gpio_disable/enable_irq calls
In reply to Judith MendezAdd 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
@@ -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.47.0
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.
Changes since v1:
- Fix CC list
- Drop Fixes tag
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.47.0
PATCH RESEND 2/2 serial: 8250: omap: Move pm_runtime_get_sync
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.
--- drivers/tty/serial/8250/8250_omap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/8250/8250_omap.c +2 -2
@@ -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.47.0
Re: [PATCH RESEND 1/2] gpio: omap: Add omap_gpio_disable/enable_irq calls
In reply to Judith MendezQuoted 27 lines · Judith Mendez
Add
omap_gpio_disable_irqandomap_gpio_enable_irqcalls in gpio-omap.Currently, kernel cannot disable gpio interrupts in case of a irq storm, so add
omap_gpio_disable_irqso that interrupts can be disabled/enabled.Signed-off-by Bin Liu <[email protected]>Signed-off-by Judith Mendez <[email protected]>--- drivers/gpio/gpio-omap.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)drivers/gpio/gpio-omap.c +6
-0@@ -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; +
drivers/gpio/gpio-omap.c static void omap_gpio_unmask_irq(struct irq_data *d) · line 729
Quoted 10 lines
drivers/gpio/gpio-omap.c +10
-0+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);
Seems like an odd way to make "false", why not:
omap_gpio_set_irq(d, false);
Andrew
Quoted 30 lines
drivers/gpio/gpio-omap.c +13
-0+} + +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,
Kevin Hilman
maintainerQuoted 7 lines · Judith Mendez
This patch series carries some miscellaneous OMAP driver fixes for GPIO and UART drivers.
For GPIO, add
gpio_enableandgpio_disablecalls 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_syncsince the current order ofomap_8250_rx_dma_flushandpm_runtime_get_synccalls are set in a way that whenomap_8250_shutdownreturns,dma->rx_runningis set and this causes issues next time the UART is re-opened.
Could you summarize which OMAP platforms this was tested on?
Thanks,
Kevin
Re: [PATCH RESEND 2/2] serial: 8250: omap: Move pm_runtime_get_sync
In reply to Judith MendezQuoted 10 lines · Judith Mendez
Currently in
omap_8250_shutdown, thedma->rx_runningflag is set to zero inomap_8250_rx_dma_flush. Nextpm_runtime_get_syncis called, which is a runtime resume call stack which can re-set the flag. When the callomap_8250_shutdownreturns, 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 andomap_8250_rx_dmais called. Fix by movingpm_runtime_get_syncbefore theomap_8250_rx_dma_flush.
Quoted 2 lines
Signed-off-by Bin Liu <[email protected]>Signed-off-by Judith Mendez <[email protected]>
Gave this a quick boot test on am335x-boneblack and am57xx-beagle-x15.
I realize that doesn't really test the DMA paths involved here, but at least it doesn't break basic boot to serial console, and the change looks coorect.
Thanks for sending a fix for this.
Kevin
Greg KH
maintainerRe: [PATCH RESEND 2/2] serial: 8250: omap: Move pm_runtime_get_sync
In reply to Judith MendezQuoted 9 lines · Judith Mendez
Currently in
omap_8250_shutdown, thedma->rx_runningflag is set to zero inomap_8250_rx_dma_flush. Nextpm_runtime_get_syncis called, which is a runtime resume call stack which can re-set the flag. When the callomap_8250_shutdownreturns, 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 andomap_8250_rx_dmais called. Fix by movingpm_runtime_get_syncbefore theomap_8250_rx_dma_flush.
You can go to 72 columns :)
Quoted 2 lines
Signed-off-by Bin Liu <[email protected]>Signed-off-by Judith Mendez <[email protected]>
Wait, who wrote this, Bin? If so, there needs to be a "From:" line saying so.
What commit id does this fix? Do you want it backported to older kernels? Why mix two different subsystems in the same patch series, who is supposed to take it?
thanks,
greg k-h
Re: [PATCH RESEND 2/2] serial: 8250: omap: Move pm_runtime_get_sync
In reply to Judith MendezAm Fri, 11 Oct 2024 12:33:56 -0500
schrieb Judith Mendez <[email protected]>:
Quoted 10 lines
Currently in
omap_8250_shutdown, thedma->rx_runningflag is set to zero inomap_8250_rx_dma_flush. Nextpm_runtime_get_syncis called, which is a runtime resume call stack which can re-set the flag. When the callomap_8250_shutdownreturns, 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 andomap_8250_rx_dmais called. Fix by movingpm_runtime_get_syncbefore theomap_8250_rx_dma_flush.
Quoted 2 lines
Signed-off-by Bin Liu <[email protected]>Signed-off-by Judith Mendez <[email protected]>
Is this a theorectical problem or some real practical problem? So you are running a system with runtime pm enabled on serial console.
How did you come across this issue?
I could run the serial console/getty with runtime pm autosuspend enabled without issues all the years.
Regards,
Andreas
Re: [PATCH RESEND 2/2] serial: 8250: omap: Move pm_runtime_get_sync
In reply to a message not in the archiveAm Sun, 13 Oct 2024 21:52:05 -0500
schrieb Bin Liu <[email protected]>:
Quoted 33 lines
Hi,
Somehow this email wasn’t cc’d to my company email account [email protected], so I am replying from my personal email which subscribed to the mailing list, and sorry if the formatting is wrong since I am writing this response on my phone.
Quoted 17 lines · Andreas Kemnade
Am Fri, 11 Oct 2024 12:33:56 -0500
schrieb Judith Mendez <[email protected]>:Currently in
omap_8250_shutdown, thedma->rx_runningQuoted 9 lines
flag is set to zero in
omap_8250_rx_dma_flush. Nextpm_runtime_get_syncis called, which is a runtime resume call stack which can re-set the flag. When the callomap_8250_shutdownreturns, 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 andomap_8250_rx_dmais called. Fix by movingpm_runtime_get_syncbefore theomap_8250_rx_dma_flush.Quoted 3 lines
Signed-off-by Bin Liu <[email protected]>Signed-off-by Judith Mendez <[email protected]>Quoted 7 lines
Is this a theorectical problem or some real practical problem? So you are running a system with runtime pm enabled on serial console.
How did you come across this issue?
I could run the serial console/getty with runtime pm autosuspend enabled without issues all the years.
Quoted 7 lines
Yes this is a real issue reported on AM335x. Please see the report linked below.
PROCESSOR-SDK-AM335X: Possible bug in 8250_omap UART driver - Processors forum - Processors - TI E2E support forums e2e.ti.com
Thanks for information, so it looks like material for backporting. Maybe add the link in the description and add the cc stable and add back the fixes tag.
Regards,
Andreas
Re: [PATCH RESEND 1/2] gpio: omap: Add omap_gpio_disable/enable_irq calls
In reply to Andrew DavisHi Andrew,
Quoted 40 lines · Andrew Davis
Quoted 26 lines · Judith Mendez
Add
omap_gpio_disable_irqandomap_gpio_enable_irqcalls in gpio-omap.Currently, kernel cannot disable gpio interrupts in case of a irq storm, so add
omap_gpio_disable_irqso that interrupts can be disabled/enabled.Signed-off-by Bin Liu <[email protected]>Signed-off-by Judith Mendez <[email protected]>---
drivers/gpio/gpio-omap.c| 29 +++++++++++++++++++++++++++++1 file changed, 29 insertions(+)drivers/gpio/gpio-omap.c +6
-0@@ -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; +drivers/gpio/gpio-omap.c static void omap_gpio_unmask_irq(struct irq_data *d) · line 728
Quoted 10 lines
drivers/gpio/gpio-omap.c +10
-0+ 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);Seems like an odd way to make "false", why not:
Quoted 1 line
omap_gpio_set_irq(d, false);
Thanks for your review, you are right, but I will be reverting to the original patch format. Where we do not used wrappers function around omap_gpio_set_irq().
~ Judith
Quoted 34 lines
Andrew
Quoted 31 lines
drivers/gpio/gpio-omap.c +13
-0+} + +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,
Re: [PATCH RESEND 2/2] serial: 8250: omap: Move pm_runtime_get_sync
In reply to Greg KHHi Greg,
Quoted 11 lines · Greg KH
Quoted 9 lines · Judith Mendez
Currently in
omap_8250_shutdown, thedma->rx_runningflag is set to zero inomap_8250_rx_dma_flush. Nextpm_runtime_get_syncis called, which is a runtime resume call stack which can re-set the flag. When the callomap_8250_shutdownreturns, 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 andomap_8250_rx_dmais called. Fix by movingpm_runtime_get_syncbefore theomap_8250_rx_dma_flush.
Quoted 1 line
You can go to 72 columns :)
ok, will fix, thanks!
Quoted 6 lines
Quoted 3 lines
Signed-off-by Bin Liu <[email protected]>Signed-off-by Judith Mendez <[email protected]>Wait, who wrote this, Bin? If so, there needs to be a "From:" line saying so.
I did not realize I could create a patch for someone, apologies, I will be sending v3 with correct "From:".
Quoted 4 lines
What commit id does this fix? Do you want it backported to older kernels? Why mix two different subsystems in the same patch series, who is supposed to take it?
I suppose it should be backported to older kernels so I will add back the fixes tag.
Apologies for sending two different subsystems in one series, I thought describing as "misc" would be good enough to mix the two, but I can separate the patches and respin. Thanks.
~ Judith
Quoted 4 lines
thanks,
greg k-h