From: Luiz Angelo Daros de Luca <luizluca@gmail.com>
To: netdev@vger.kernel.org
Cc: linus.walleij@linaro.org, andrew@lunn.ch,
vivien.didelot@gmail.com, f.fainelli@gmail.com,
olteanv@gmail.com, davem@davemloft.net, kuba@kernel.org,
alsi@bang-olufsen.dk, arinc.unal@arinc9.com,
Luiz Angelo Daros de Luca <luizluca@gmail.com>
Subject: [PATCH net-next] net: dsa: realtek: rtl8365mb: irq with realtek-mdio
Date: Wed, 9 Feb 2022 19:45:38 -0300 [thread overview]
Message-ID: <20220209224538.9028-1-luizluca@gmail.com> (raw)
realtek-smi creates a custom ds->slave_mii_bus and uses a mdio
device-tree subnode to associates the interrupt-controller to each port.
However, with realtek-mdio, ds->slave_mii_bus is created and configured
by the switch with no device-tree settings. With no interruptions, the
switch falls back to polling the port status.
This patch adds a new ds_ops->port_setup() to configure each phy_device
interruption. It is only used by realtek-mdio but it could probably be
used by realtek-smi as well, removing the need for a mdio subnode in the
realtek device-tree node.
Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
---
drivers/net/dsa/realtek/rtl8365mb.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/net/dsa/realtek/rtl8365mb.c b/drivers/net/dsa/realtek/rtl8365mb.c
index 2ed592147c20..45afe57a5d31 100644
--- a/drivers/net/dsa/realtek/rtl8365mb.c
+++ b/drivers/net/dsa/realtek/rtl8365mb.c
@@ -1053,6 +1053,23 @@ static void rtl8365mb_phylink_mac_link_up(struct dsa_switch *ds, int port,
}
}
+static int rtl8365mb_port_setup(struct dsa_switch *ds, int port)
+{
+ struct realtek_priv *priv = ds->priv;
+ struct phy_device *phydev;
+
+ if (priv->irqdomain && ds->slave_mii_bus->irq[port] == PHY_POLL) {
+ phydev = mdiobus_get_phy(ds->slave_mii_bus, port);
+ if (!phydev)
+ return 0;
+
+ phydev->irq = irq_find_mapping(priv->irqdomain, port);
+ ds->slave_mii_bus->irq[port] = phydev->irq;
+ }
+
+ return 0;
+}
+
static void rtl8365mb_port_stp_state_set(struct dsa_switch *ds, int port,
u8 state)
{
@@ -2022,6 +2039,7 @@ static const struct dsa_switch_ops rtl8365mb_switch_ops_mdio = {
.phylink_mac_link_up = rtl8365mb_phylink_mac_link_up,
.phy_read = rtl8365mb_dsa_phy_read,
.phy_write = rtl8365mb_dsa_phy_write,
+ .port_setup = rtl8365mb_port_setup,
.port_stp_state_set = rtl8365mb_port_stp_state_set,
.get_strings = rtl8365mb_get_strings,
.get_ethtool_stats = rtl8365mb_get_ethtool_stats,
--
2.35.1
next reply other threads:[~2022-02-09 22:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-09 22:45 Luiz Angelo Daros de Luca [this message]
2022-02-10 3:30 ` [PATCH net-next] net: dsa: realtek: rtl8365mb: irq with realtek-mdio Florian Fainelli
2022-02-10 22:15 ` Luiz Angelo Daros de Luca
2022-02-10 23:48 ` Alvin Šipraga
2022-02-11 4:51 ` Luiz Angelo Daros de Luca
2022-02-11 5:11 ` [PATCH net-next] net: dsa: OF-ware slave_mii_bus (RFC) Luiz Angelo Daros de Luca
2022-02-11 9:35 ` Alvin Šipraga
2022-02-12 3:39 ` Luiz Angelo Daros de Luca
2022-02-11 9:03 ` [PATCH net-next] net: dsa: realtek: rtl8365mb: irq with realtek-mdio Alvin Šipraga
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=20220209224538.9028-1-luizluca@gmail.com \
--to=luizluca@gmail.com \
--cc=alsi@bang-olufsen.dk \
--cc=andrew@lunn.ch \
--cc=arinc.unal@arinc9.com \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=vivien.didelot@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).