diff mbox series

[RESEND] serial: 8250-mtk: Ask for IRQ-count before request one

Message ID 20191026194522.28293-1-frank-w@public-files.de (mailing list archive)
State New, archived
Headers show
Series [RESEND] serial: 8250-mtk: Ask for IRQ-count before request one | expand

Commit Message

Frank Wunderlich Oct. 26, 2019, 7:45 p.m. UTC
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(-)

Comments

Fabio Estevam Oct. 26, 2019, 8:31 p.m. UTC | #1
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.
Frank Wunderlich Oct. 27, 2019, 6:32 a.m. UTC | #2
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.
diff mbox series

Patch

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;
 }