linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH,RESEND] serial: 8250-mtk: Ask for IRQ-count before request one
@ 2019-10-26 19:45 Frank Wunderlich
  2019-10-26 20:31 ` [PATCH, RESEND] " Fabio Estevam
  0 siblings, 1 reply; 3+ messages in thread
From: Frank Wunderlich @ 2019-10-26 19:45 UTC (permalink / raw)
  To: linux-mediatek
  Cc: Frank Wunderlich, Greg Kroah-Hartman, Matthias Brugger,
	linux-serial, linux-arm-kernel, linux-kernel

at least on bananapi-r2 we have only 1 IRQ and need to
check for IRQ-count to fix following Errors during probe:

[    4.935780] mt6577-uart 11004000.serial: IRQ index 1 not found
[    4.962589] 11002000.serial: ttyS1 at MMIO 0x11002000 (irq = 202, base_baud = 1625000) is a ST16650V2
[    4.972127] mt6577-uart 11002000.serial: IRQ index 1 not found
[    4.998927] 11003000.serial: ttyS2 at MMIO 0x11003000 (irq = 203, base_baud = 1625000) is a ST16650V2
[    5.008474] mt6577-uart 11003000.serial: IRQ index 1 not found

based on Patch from Anson Huang
https://patchwork.ozlabs.org/patch/1164500/

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
 drivers/tty/serial/8250/8250_mtk.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
index b411ba4eb5e9..bf250187928a 100644
--- a/drivers/tty/serial/8250/8250_mtk.c
+++ b/drivers/tty/serial/8250/8250_mtk.c
@@ -485,6 +485,7 @@ static int mtk8250_probe(struct platform_device *pdev)
 	struct resource *regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	struct resource *irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 	struct mtk8250_data *data;
+	int irq_count;
 	int err;
 
 	if (!regs || !irq) {
@@ -544,7 +545,15 @@ static int mtk8250_probe(struct platform_device *pdev)
 	pm_runtime_set_active(&pdev->dev);
 	pm_runtime_enable(&pdev->dev);
 
-	data->rx_wakeup_irq = platform_get_irq(pdev, 1);
+	irq_count = platform_irq_count(pdev);
+	if (irq_count < 0)
+		return irq_count;
+
+	if (irq_count > 1) {
+		data->rx_wakeup_irq = platform_get_irq(pdev, 1);
+		if (data->rx_wakeup_irq < 0)
+			data->rx_wakeup_irq = 0;
+	}
 
 	return 0;
 }
-- 
2.17.1


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

* Re: [PATCH, RESEND] serial: 8250-mtk: Ask for IRQ-count before request one
  2019-10-26 19:45 [PATCH,RESEND] serial: 8250-mtk: Ask for IRQ-count before request one Frank Wunderlich
@ 2019-10-26 20:31 ` Fabio Estevam
  2019-10-27  6:32   ` Aw: " Frank Wunderlich
  0 siblings, 1 reply; 3+ messages in thread
From: Fabio Estevam @ 2019-10-26 20:31 UTC (permalink / raw)
  To: Frank Wunderlich
  Cc: linux-mediatek, Greg Kroah-Hartman, linux-kernel, linux-serial,
	Matthias Brugger,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE

On Sat, Oct 26, 2019 at 4:46 PM Frank Wunderlich
<frank-w@public-files.de> wrote:
>
> at least on bananapi-r2 we have only 1 IRQ and need to
> check for IRQ-count to fix following Errors during probe:
>
> [    4.935780] mt6577-uart 11004000.serial: IRQ index 1 not found
> [    4.962589] 11002000.serial: ttyS1 at MMIO 0x11002000 (irq = 202, base_baud = 1625000) is a ST16650V2
> [    4.972127] mt6577-uart 11002000.serial: IRQ index 1 not found
> [    4.998927] 11003000.serial: ttyS2 at MMIO 0x11003000 (irq = 203, base_baud = 1625000) is a ST16650V2
> [    5.008474] mt6577-uart 11003000.serial: IRQ index 1 not found
>
> based on Patch from Anson Huang
> https://patchwork.ozlabs.org/patch/1164500/

The solution that was accepted for this case was to use
platform_get_irq_optional() instead.

You could try using platform_get_irq_optional() here as well.

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

* Aw: Re: [PATCH, RESEND] serial: 8250-mtk: Ask for IRQ-count before request one
  2019-10-26 20:31 ` [PATCH, RESEND] " Fabio Estevam
@ 2019-10-27  6:32   ` Frank Wunderlich
  0 siblings, 0 replies; 3+ messages in thread
From: Frank Wunderlich @ 2019-10-27  6:32 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Greg Kroah-Hartman, linux-kernel, linux-mediatek, linux-serial,
	Matthias Brugger,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE

Hi,

thank you, seems to work too

have posted v2 here: https://patchwork.kernel.org/patch/11213957/

regards Frank

> Gesendet: Samstag, 26. Oktober 2019 um 21:31 Uhr
> Von: "Fabio Estevam" <festevam@gmail.com>

> The solution that was accepted for this case was to use
> platform_get_irq_optional() instead.
>
> You could try using platform_get_irq_optional() here as well.


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

end of thread, other threads:[~2019-10-27  6:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-26 19:45 [PATCH,RESEND] serial: 8250-mtk: Ask for IRQ-count before request one Frank Wunderlich
2019-10-26 20:31 ` [PATCH, RESEND] " Fabio Estevam
2019-10-27  6:32   ` Aw: " Frank Wunderlich

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).