All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luiz Angelo Daros de Luca <luizluca@gmail.com>
To: netdev@vger.kernel.org
Cc: linus.walleij@linaro.org, alsi@bang-olufsen.dk, andrew@lunn.ch,
	vivien.didelot@gmail.com, f.fainelli@gmail.com,
	olteanv@gmail.com, davem@davemloft.net, kuba@kernel.org,
	pabeni@redhat.com, robh+dt@kernel.org, krzk+dt@kernel.org,
	arinc.unal@arinc9.com,
	Luiz Angelo Daros de Luca <luizluca@gmail.com>
Subject: [PATCH net-next RFC 2/3] net: dsa: realtek: deprecate custom slave mii
Date: Wed, 29 Jun 2022 00:54:33 -0300	[thread overview]
Message-ID: <20220629035434.1891-3-luizluca@gmail.com> (raw)
In-Reply-To: <20220629035434.1891-1-luizluca@gmail.com>

The custom slave mii was required only to parse the OF mdio node.
However, since fe7324b932, the standard slave mii created by dsa already
looks for an "mdio" node.

The realtek-smi was using a compatible string ("realtek,smi-mdio") to
find the slave mdio node. Although device-tree bindings and examples all
use "mdio". If the name does not match "mdio", the driver will still use
the custom mii slave. The driver will also ask to remove the compatible
string if it exists in the "mdio" node.

After a grace period, we can remove:
- realtek_variant.ds_ops_custom_slavemii
- realtek_ops.phy_{read,write}
- realtek_ops.setup_interface
- {rtl8365mb,rtl8366rb}_phy_{read,write}
- realtek_smi_setup_mdio

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
---
 drivers/net/dsa/realtek/realtek-smi.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/drivers/net/dsa/realtek/realtek-smi.c b/drivers/net/dsa/realtek/realtek-smi.c
index 3eb9d67fd2de..c3668a9208ac 100644
--- a/drivers/net/dsa/realtek/realtek-smi.c
+++ b/drivers/net/dsa/realtek/realtek-smi.c
@@ -379,6 +379,10 @@ static int realtek_smi_setup_mdio(struct dsa_switch *ds)
 		return -ENODEV;
 	}
 
+	dev_warn(priv->dev,
+		 "Rename '%s' to 'mdio' and remove the compatible string\n",
+		  mdio_np->full_name);
+
 	priv->slave_mii_bus = devm_mdiobus_alloc(priv->dev);
 	if (!priv->slave_mii_bus) {
 		ret = -ENOMEM;
@@ -412,10 +416,10 @@ static int realtek_smi_setup_mdio(struct dsa_switch *ds)
 static int realtek_smi_probe(struct platform_device *pdev)
 {
 	const struct realtek_variant *var;
+	struct device_node *np, *mdio_np;
 	struct device *dev = &pdev->dev;
 	struct realtek_priv *priv;
 	struct regmap_config rc;
-	struct device_node *np;
 	int ret;
 
 	var = of_device_get_match_data(dev);
@@ -452,7 +456,6 @@ static int realtek_smi_probe(struct platform_device *pdev)
 	priv->cmd_write = var->cmd_write;
 	priv->ops = var->ops;
 
-	priv->setup_interface = realtek_smi_setup_mdio;
 	priv->write_reg_noack = realtek_smi_write_reg_noack;
 
 	dev_set_drvdata(dev, priv);
@@ -497,8 +500,20 @@ static int realtek_smi_probe(struct platform_device *pdev)
 	priv->ds->dev = dev;
 	priv->ds->num_ports = priv->num_ports;
 	priv->ds->priv = priv;
+	priv->ds->ops = var->ds_ops;
+
+	mdio_np = of_get_child_by_name(np, "mdio");
+	if (mdio_np) {
+		if (of_device_is_compatible(mdio_np, "realtek,smi-mdio"))
+			dev_warn(dev, "Remove deprecated prop '%s' from '%s'",
+				 "compatible = \"realtek,smi-mdio\"",
+				 mdio_np->full_name);
+		of_node_put(mdio_np);
+	} else {
+		priv->ds->ops = var->ds_ops_custom_slavemii;
+		priv->setup_interface = realtek_smi_setup_mdio;
+	}
 
-	priv->ds->ops = var->ds_ops_custom_slavemii;
 	ret = dsa_register_switch(priv->ds);
 	if (ret) {
 		dev_err_probe(dev, ret, "unable to register switch\n");
-- 
2.36.1


  parent reply	other threads:[~2022-06-29  3:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-29  3:54 [PATCH net-next RFC 0/3] net: dsa: realtek: drop custom slave MII Luiz Angelo Daros de Luca
2022-06-29  3:54 ` [PATCH net-next RFC 1/3] net: dsa: realtek: rename switch_ops to its usage, not users Luiz Angelo Daros de Luca
2022-06-29  3:54 ` Luiz Angelo Daros de Luca [this message]
2022-06-29  3:54 ` [PATCH net-next RFC 3/3] net: dsa: realtek: remove deprecated custom slave mii Luiz Angelo Daros de Luca
2022-06-29 12:30 ` [PATCH net-next RFC 0/3] net: dsa: realtek: drop custom slave MII Arınç ÜNAL
2022-06-29 16:49   ` Luiz Angelo Daros de Luca
2022-06-29 16:43 ` Luiz Angelo Daros de Luca
2022-06-29 18:14   ` Alvin Šipraga
2022-06-29 18:31     ` Alvin Šipraga
2022-06-30 17:05     ` Luiz Angelo Daros de Luca
2022-06-30 20:04       ` Alvin Šipraga
2022-07-06 15:29       ` Vladimir Oltean
2022-07-07  8:45         ` Linus Walleij

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=20220629035434.1891-3-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=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=robh+dt@kernel.org \
    --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 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.