Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp3477350imc; Sun, 24 Feb 2019 06:06:13 -0800 (PST) X-Google-Smtp-Source: AHgI3Ial5GWGLRkkngMQxEJWuxpDgTjO7mJWMqoPi4+3LvdB/9mAzRlxd1CuCidRet0iolsqVuO8 X-Received: by 2002:a63:5359:: with SMTP id t25mr12365914pgl.99.1551017173321; Sun, 24 Feb 2019 06:06:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551017173; cv=none; d=google.com; s=arc-20160816; b=u9WIm3tmK/AWXRA0ksub0qMf5JcusRFR8wqA1wiuxzR3hpJsnWXsviILBX2Ouzxhav ACa/n+q44YQPb2ahQ3YeYXows5sMNCgUvvaBFO8aEioG9NO8aY4h2u+W8h0v0VxG6phP 529hjy2tDg6kWWvSpzJj58e1awTWhuyooFHpzkZYRPKbI3L0nrq7/8qZ3H6jbKi2GFWx 5bL8BKOsOvowcn7mIpdviARd2sLtgHKePKMmdz8zdXbM/nFkFRK+Qzk24+DZMHzCF2AJ rZR0+3cCkeSE37p//6Fa2xfC9Iy1a8Aeu9t4pPiE0Ka4doh8lDAp8TOglcufbwNSSBvW AnAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=VsZhWDlaH0yeGpP4ocR7R689ulWdRweyI/dJoONhF0U=; b=aB3/rBd1IxJjWxj3s73KVmd4eJT4gtXaOAfcR2HBlPzK10uZmQexwRRL1Zs07+HIYX FCAS1NyG5yX1FiQZ4ggP5gORorVJI2rCMuuFj2ei00Iq5ezGKeT1SKspgWeBdPJu0Kyo sCWa0AE8Oho1gofP98u0JBxE1ktaxYS+HFomAec80zEJSi0OdMA8D4Tn+qW7l1T5vLvo 0c20t8qN1HIeGrrhCcNawty5d8y25le67xr1+tozpRniEHfFHK1arYws/5pZmeDN81kR F1X46oTHrT4TCAh2vWFDCQSf3NB6de2HV7+Cnf7qRun0eZl0Gn2dT9G5Ox60pPUkTToy XNBA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e9si6196158pgk.173.2019.02.24.06.05.45; Sun, 24 Feb 2019 06:06:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728435AbfBXOFR (ORCPT + 99 others); Sun, 24 Feb 2019 09:05:17 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:52496 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728409AbfBXOFQ (ORCPT ); Sun, 24 Feb 2019 09:05:16 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BD79A1688; Sun, 24 Feb 2019 06:05:15 -0800 (PST) Received: from why.lan (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9DDF73F690; Sun, 24 Feb 2019 06:05:12 -0800 (PST) From: Marc Zyngier To: Amitkumar Karwar , Enric Balletbo i Serra , Ganapathi Bhat , Heiko Stuebner , Kalle Valo , Nishant Sarmukadam , Rob Herring , Xinming Hu Cc: "David S. Miller" , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH 2/4] mwifiex: Fetch wake-up interrupt from 'wake-up' subnode when it exists Date: Sun, 24 Feb 2019 14:04:24 +0000 Message-Id: <20190224140426.3267-3-marc.zyngier@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190224140426.3267-1-marc.zyngier@arm.com> References: <20190224140426.3267-1-marc.zyngier@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Encoding the wake-up interrupt as part of the PCI DT node is completely broken, as it violates the most basic rules of PCI description in OF: the interrupts described in such node are supposed to apply to the PCI device, and not to some non-PCI stuff on the side. In such a configuration, both the PCI device and the wake-up widget end-up trying to share an interrupt. Of course, this doesn't work: The PCI device can only generate interrupts through the root port, while the wake-up widget uses sideband signaling that bypasses PCI altogether. Clearly, this was never tested. So let's first try and obtain the wake-up interrupt from a 'wake-up' subnode, and fallback to the main DT node otherwise. This ensures that old DTs will carry on working as bad as before (with the added warning to let the user know about the situation), and new DT will enjoy legacy interrupts in case MSIs are unavailable. Signed-off-by: Marc Zyngier --- drivers/net/wireless/marvell/mwifiex/main.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c index 20cee5c397fb..2105c2b7c627 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.c +++ b/drivers/net/wireless/marvell/mwifiex/main.c @@ -1590,17 +1590,26 @@ static void mwifiex_probe_of(struct mwifiex_adapter *adapter) { int ret; struct device *dev = adapter->dev; + struct device_node *wup_node; if (!dev->of_node) goto err_exit; adapter->dt_node = dev->of_node; - adapter->irq_wakeup = irq_of_parse_and_map(adapter->dt_node, 0); + wup_node = of_get_child_by_name(adapter->dt_node, "wake-up"); + if (!wup_node) + wup_node = adapter->dt_node; + adapter->irq_wakeup = irq_of_parse_and_map(wup_node, 0); if (!adapter->irq_wakeup) { dev_dbg(dev, "fail to parse irq_wakeup from device tree\n"); goto err_exit; } + if (dev_is_pci(dev) && adapter->dt_node == wup_node) + dev_warn(dev, + "wake-up interrupt outside 'wake-up' subnode of %pOF\n", + adapter->dt_node); + ret = devm_request_irq(dev, adapter->irq_wakeup, mwifiex_irq_wakeup_handler, IRQF_TRIGGER_LOW, "wifi_wake", adapter); -- 2.20.1