From: Marc Zyngier <marc.zyngier@arm.com> To: Amitkumar Karwar <amitkarwar@gmail.com>, Enric Balletbo i Serra <enric.balletbo@collabora.com>, Ganapathi Bhat <gbhat@marvell.com>, Heiko Stuebner <heiko@sntech.de>, Kalle Valo <kvalo@codeaurora.org>, Nishant Sarmukadam <nishants@marvell.com>, Rob Herring <robh+dt@kernel.org>, Xinming Hu <huxinming820@gmail.com> Cc: "David S. Miller" <davem@davemloft.net>, 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 [thread overview] Message-ID: <20190224140426.3267-3-marc.zyngier@arm.com> (raw) In-Reply-To: <20190224140426.3267-1-marc.zyngier@arm.com> 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 <marc.zyngier@arm.com> --- 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
WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <marc.zyngier@arm.com> To: Amitkumar Karwar <amitkarwar@gmail.com>, Enric Balletbo i Serra <enric.balletbo@collabora.com>, Ganapathi Bhat <gbhat@marvell.com>, Heiko Stuebner <heiko@sntech.de>, Kalle Valo <kvalo@codeaurora.org>, Nishant Sarmukadam <nishants@marvell.com>, Rob Herring <robh+dt@kernel.org>, Xinming Hu <huxinming820@gmail.com> Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, "David S. Miller" <davem@davemloft.net>, linux-arm-kernel@lists.infradead.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 [thread overview] Message-ID: <20190224140426.3267-3-marc.zyngier@arm.com> (raw) In-Reply-To: <20190224140426.3267-1-marc.zyngier@arm.com> 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 <marc.zyngier@arm.com> --- 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-02-24 14:05 UTC|newest] Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-02-24 14:04 [PATCH 0/4] mwifiex PCI/wake-up interrupt fixes Marc Zyngier 2019-02-24 14:04 ` Marc Zyngier 2019-02-24 14:04 ` [PATCH 1/4] dt-bindings/marvell-8xxx: Allow wake-up interrupt to be placed in a separate node Marc Zyngier 2019-02-24 14:04 ` Marc Zyngier 2019-02-24 14:04 ` Marc Zyngier [this message] 2019-02-24 14:04 ` [PATCH 2/4] mwifiex: Fetch wake-up interrupt from 'wake-up' subnode when it exists Marc Zyngier 2019-02-24 14:04 ` [PATCH 3/4] mwifiex: Flag wake-up interrupt as IRQ_NOAUTOEN rather than disabling it too late Marc Zyngier 2019-02-24 14:04 ` Marc Zyngier 2019-02-26 23:31 ` Brian Norris 2019-02-26 23:31 ` Brian Norris 2019-02-26 23:34 ` Brian Norris 2019-02-26 23:34 ` Brian Norris 2019-04-04 10:22 ` Kalle Valo 2019-04-04 10:22 ` Kalle Valo 2019-04-04 10:22 ` Kalle Valo 2019-04-04 10:22 ` Kalle Valo 2019-02-24 14:04 ` [PATCH 4/4] arm64: dts: rockchip: gru: Move wifi wake-up interrupt into its own subnode Marc Zyngier 2019-02-24 14:04 ` Marc Zyngier 2019-02-25 12:45 ` [PATCH 0/4] mwifiex PCI/wake-up interrupt fixes Ard Biesheuvel 2019-02-25 12:45 ` Ard Biesheuvel 2019-02-25 14:52 ` Marc Zyngier 2019-02-25 14:52 ` Marc Zyngier 2019-02-26 16:21 ` Ard Biesheuvel 2019-02-26 16:21 ` Ard Biesheuvel 2019-02-26 16:21 ` Ard Biesheuvel 2019-02-26 17:14 ` Marc Zyngier 2019-02-26 17:14 ` Marc Zyngier 2019-02-26 23:44 ` Brian Norris 2019-02-26 23:44 ` Brian Norris 2019-02-26 23:44 ` Brian Norris 2019-02-27 9:27 ` Marc Zyngier 2019-02-27 9:27 ` Marc Zyngier 2019-02-27 9:27 ` Marc Zyngier 2019-02-26 23:28 ` Brian Norris 2019-02-26 23:28 ` Brian Norris 2019-02-27 10:02 ` Marc Zyngier 2019-02-27 10:02 ` Marc Zyngier 2019-02-27 10:16 ` Ard Biesheuvel 2019-02-27 10:16 ` Ard Biesheuvel 2019-02-27 10:16 ` Ard Biesheuvel 2019-02-27 10:16 ` Ard Biesheuvel 2019-02-27 20:57 ` Brian Norris 2019-02-27 20:57 ` Brian Norris 2019-02-27 20:57 ` Brian Norris 2019-02-27 23:03 ` Rafael J. Wysocki 2019-02-27 23:03 ` Rafael J. Wysocki 2019-02-27 23:03 ` Rafael J. Wysocki 2019-02-28 2:29 ` Brian Norris 2019-02-28 2:29 ` Brian Norris 2019-02-28 2:29 ` Brian Norris 2019-02-28 11:03 ` Rafael J. Wysocki 2019-02-28 11:03 ` Rafael J. Wysocki 2019-02-28 11:03 ` Rafael J. Wysocki 2019-02-27 20:51 ` Brian Norris 2019-02-27 20:51 ` Brian Norris 2019-03-08 8:26 ` Kalle Valo 2019-03-08 8:26 ` Kalle Valo 2019-03-08 8:26 ` Kalle Valo 2019-03-08 9:02 ` Marc Zyngier 2019-03-08 9:02 ` Marc Zyngier 2019-03-08 9:36 ` Kalle Valo 2019-03-08 9:36 ` Kalle Valo
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190224140426.3267-3-marc.zyngier@arm.com \ --to=marc.zyngier@arm.com \ --cc=amitkarwar@gmail.com \ --cc=davem@davemloft.net \ --cc=devicetree@vger.kernel.org \ --cc=enric.balletbo@collabora.com \ --cc=gbhat@marvell.com \ --cc=heiko@sntech.de \ --cc=huxinming820@gmail.com \ --cc=kvalo@codeaurora.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-rockchip@lists.infradead.org \ --cc=linux-wireless@vger.kernel.org \ --cc=netdev@vger.kernel.org \ --cc=nishants@marvell.com \ --cc=robh+dt@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.