From: Qingfang DENG <dqfext@gmail.com>
To: Russell King <linux@armlinux.org.uk>
Cc: Jose Abreu <Jose.Abreu@synopsys.com>, netdev@vger.kernel.org
Subject: Handling standalone PCS IRQ
Date: Tue, 19 Jul 2022 22:39:12 +0800 [thread overview]
Message-ID: <20220719143912.2727014-1-dqfext@gmail.com> (raw)
Hi all,
I was working with an SoC that has a built-in DWC XPCS with IRQ support.
However the current driver still uses polling.
I may modify xpcs_create() to try getting an IRQ number from DT, and fall back
to polling if it fails (see the code below). But I don't know how to notify
phylink in the IRQ handler.
There is a phylink_mac_change() function to notify phylink, but it is supposed
to be used in a MAC driver, and it requires a (struct phylink *), not a
(struct phylink_pcs *). Do we need a similar one for PCS?
Thanks.
--- a/drivers/net/pcs/pcs-xpcs.c
+++ b/drivers/net/pcs/pcs-xpcs.c
@@ -1272,6 +1272,13 @@ static const struct phylink_pcs_ops xpcs_phylink_ops = {
.pcs_link_up = xpcs_link_up,
};
+static irqreturn_t xpcs_irq(int irq, void *dev_id) {
+ struct dw_xpcs *xpcs = dev_id;
+
+ /* XXX: notify phylink */
+ return IRQ_HANDLED;
+}
+
struct dw_xpcs *xpcs_create(struct mdio_device *mdiodev,
phy_interface_t interface)
{
@@ -1303,7 +1310,21 @@ struct dw_xpcs *xpcs_create(struct mdio_device *mdiodev,
}
xpcs->pcs.ops = &xpcs_phylink_ops;
- xpcs->pcs.poll = true;
+
+ ret = of_irq_get(mdiodev->dev.of_node, 0);
+ if (ret == -EPROBE_DEFER)
+ goto out;
+
+ if (ret > 0) {
+ ret = devm_request_threaded_irq(&mdiodev->dev, ret,
+ NULL, xpcs_irq,
+ IRQF_ONESHOT,
+ KBUILD_MODNAME, xpcs);
+ if (ret < 0)
+ goto out;
+ } else {
+ xpcs->pcs.poll = true;
+ }
ret = xpcs_soft_reset(xpcs, compat);
if (ret)
next reply other threads:[~2022-07-19 14:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-19 14:39 Qingfang DENG [this message]
2022-07-21 17:05 ` Handling standalone PCS IRQ Andrew Lunn
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=20220719143912.2727014-1-dqfext@gmail.com \
--to=dqfext@gmail.com \
--cc=Jose.Abreu@synopsys.com \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.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: link
Be 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.