From patchwork Sat Oct 26 19:45:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wunderlich X-Patchwork-Id: 11213811 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7CD731864 for ; Sat, 26 Oct 2019 19:46:00 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 581A820867 for ; Sat, 26 Oct 2019 19:46:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="sYXcKBZu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 581A820867 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=public-files.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=udP174Onl/Hd13DipJDb+KclD+ZUJbUnjOj/315JuOE=; b=sYX cKBZuY4ZWoVkdQ45mM3+lZDv8Ok4yg2ur1zAt+BQuHTxuW3wffcSAn89z8nnm0ScqY3mu6sBSugoM 3daNILzhl/RSbNqTBdcqLwJ6x5Prt/w0V1WRKcgRj8avbeHeqguD4A69pVWtVplRHbzPexzuHt1TC i9me6JwXqr0Br8G9BAzuLHQtIxXXXZ5ydhd3xVvWbHbNa4I55chCQ2cYv4Z1hKUe9XS8egrYFYjrU eY7hM3WUIYA3x5vShLbkcqX/LOWUJ6xacpxtdtIP/4WSDWI9dX4eyqXNM+2KMLsGUzEq2jExaavgA Igg1TH5ktdja8OcxE7fdg4mfcJN+ZTw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iOS0b-0005wC-VN; Sat, 26 Oct 2019 19:45:57 +0000 Received: from mxwww.masterlogin.de ([2a03:2900:1:1::b]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iOS0Y-0005vh-Q5; Sat, 26 Oct 2019 19:45:56 +0000 Received: from mxout1.routing.net (unknown [192.168.10.81]) by new.mxwww.masterlogin.de (Postfix) with ESMTPS id E6DEC96433; Sat, 26 Oct 2019 19:45:52 +0000 (UTC) Received: from mxbox2.masterlogin.de (unknown [192.168.10.89]) by mxout1.routing.net (Postfix) with ESMTP id 51D2543C00; Sat, 26 Oct 2019 19:45:53 +0000 (UTC) Received: from localhost.localdomain (fttx-pool-80.208.211.177.bambit.de [80.208.211.177]) by mxbox2.masterlogin.de (Postfix) with ESMTPSA id D9DED1005F5; Sat, 26 Oct 2019 19:45:52 +0000 (UTC) From: Frank Wunderlich To: linux-mediatek@lists.infradead.org Subject: [PATCH, RESEND] serial: 8250-mtk: Ask for IRQ-count before request one Date: Sat, 26 Oct 2019 21:45:22 +0200 Message-Id: <20191026194522.28293-1-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191026_124554_992881_E94C69FB X-CRM114-Status: UNSURE ( 9.74 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [2a03:2900:1:1:0:0:0:b listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Frank Wunderlich , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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 --- 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; }