From patchwork Wed Jun 29 03:54:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Angelo Daros de Luca X-Patchwork-Id: 12899262 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C61FC43334 for ; Wed, 29 Jun 2022 03:54:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231216AbiF2Dyx (ORCPT ); Tue, 28 Jun 2022 23:54:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231165AbiF2Dyv (ORCPT ); Tue, 28 Jun 2022 23:54:51 -0400 Received: from mail-ot1-x329.google.com (mail-ot1-x329.google.com [IPv6:2607:f8b0:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D7B4205D8 for ; Tue, 28 Jun 2022 20:54:50 -0700 (PDT) Received: by mail-ot1-x329.google.com with SMTP id t26-20020a9d775a000000b006168f7563daso11258431otl.2 for ; Tue, 28 Jun 2022 20:54:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zT6ZznFkaTdmQtDR/I7q1fiiUEuYnpac/NIGkYGkHto=; b=PjDxawVi8fuUKmHEmVY3MyqdQe+2K3+fKuARweOfe28onUai6eh3kl9INQ3iDTyTd9 D9DCsytQ85brRliJJhrUYIbu3qEE3/Yy5O0tSUazL1ZItjQ7aUCrs+NenbwoUmbzB7WZ 2d5jrbFHm7ma2u+i4OZp4bFxzDwEVFTvbBtQ8bqlCueIq2p0YCHwPtLoOzkfwlxXkAw5 cIrelOjwfsDzDZgF5eY8F4cFew+4Rq14CUJgwxEUP8+w24p3k5Hp8thX9jszoMC6FBBj YVYU+YcI1ZPKPtrJj8ZAXYmvRGF55oaYX/hwdOnkYQnBBXBglGr51r6VSRgSQudh4E71 +6Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zT6ZznFkaTdmQtDR/I7q1fiiUEuYnpac/NIGkYGkHto=; b=XZp+9QNVCtysNi1VRXe3e79SKvO5fZ3DqiH0lVTpTK6HqRxZYhtHYkYcszCPYXUkz0 KRRoNOJOwCkXo/E4nsZ2fbp7O300TwEE/03CoIHxt3dHIb6zdzEvNQBg9BrtVEaXXmTs KfakqbLLT0iG6LhgufqAoRM7kSSt2FGSTZKqRpjX05Ajgr5DjgAnqheZuj7ftsrJ5puc /PY9VM7Ca+L8vwQg8hDKqYINJpvC27i0/vpdZ834IZX3IYvssqkxTgRNJF60SVsoDYHM KvmVSeQ4/TH/znUvT3Jbjb4CXGjEoN/311fg/xuiy9hn2b9/TCbJcSpjvAixGzpLijm3 CRpg== X-Gm-Message-State: AJIora9IV7C60/2F6+v95yVyG0+yZQr7KTBQxFy3xt4AJT4k4iw/VWzE QNbfhIBmasnB7FhH3ppocWxQyNrJr/JS6g== X-Google-Smtp-Source: AGRyM1skBgJbuybToBBlHaJULzqg9upc7Ua9MEs04ghUxBfggZZ+lRZE7nqZIZkhYiovcqt1uZduzA== X-Received: by 2002:a05:6830:2459:b0:616:ce47:fae8 with SMTP id x25-20020a056830245900b00616ce47fae8mr609838otr.291.1656474889147; Tue, 28 Jun 2022 20:54:49 -0700 (PDT) Received: from tresc043793.tre-sc.gov.br ([187.94.103.218]) by smtp.gmail.com with ESMTPSA id r6-20020a056870580600b001089aef1815sm5636756oap.20.2022.06.28.20.54.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jun 2022 20:54:47 -0700 (PDT) From: Luiz Angelo Daros de Luca 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 Subject: [PATCH net-next RFC 1/3] net: dsa: realtek: rename switch_ops to its usage, not users Date: Wed, 29 Jun 2022 00:54:32 -0300 Message-Id: <20220629035434.1891-2-luizluca@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220629035434.1891-1-luizluca@gmail.com> References: <20220629035434.1891-1-luizluca@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC The difference between ds_ops_smi and ds_ops_mdio is only the presence of phy_{read,write} because the realtek-smi implements a custom slave MII while realtek-mdio uses the standard slave mii created by DSA. It's better to have a name that reflects why we need different switch_ops instead of who is using it. Signed-off-by: Luiz Angelo Daros de Luca --- drivers/net/dsa/realtek/realtek-mdio.c | 2 +- drivers/net/dsa/realtek/realtek-smi.c | 2 +- drivers/net/dsa/realtek/realtek.h | 4 ++-- drivers/net/dsa/realtek/rtl8365mb.c | 8 ++++---- drivers/net/dsa/realtek/rtl8366rb.c | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/net/dsa/realtek/realtek-mdio.c b/drivers/net/dsa/realtek/realtek-mdio.c index c58f49d558d2..90624a5102b5 100644 --- a/drivers/net/dsa/realtek/realtek-mdio.c +++ b/drivers/net/dsa/realtek/realtek-mdio.c @@ -222,7 +222,7 @@ static int realtek_mdio_probe(struct mdio_device *mdiodev) priv->ds->dev = dev; priv->ds->num_ports = priv->num_ports; priv->ds->priv = priv; - priv->ds->ops = var->ds_ops_mdio; + priv->ds->ops = var->ds_ops; ret = dsa_register_switch(priv->ds); if (ret) { diff --git a/drivers/net/dsa/realtek/realtek-smi.c b/drivers/net/dsa/realtek/realtek-smi.c index 45992f79ec8d..3eb9d67fd2de 100644 --- a/drivers/net/dsa/realtek/realtek-smi.c +++ b/drivers/net/dsa/realtek/realtek-smi.c @@ -498,7 +498,7 @@ static int realtek_smi_probe(struct platform_device *pdev) priv->ds->num_ports = priv->num_ports; priv->ds->priv = priv; - priv->ds->ops = var->ds_ops_smi; + 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"); diff --git a/drivers/net/dsa/realtek/realtek.h b/drivers/net/dsa/realtek/realtek.h index 4fa7c6ba874a..004a9ae91ccf 100644 --- a/drivers/net/dsa/realtek/realtek.h +++ b/drivers/net/dsa/realtek/realtek.h @@ -116,8 +116,8 @@ struct realtek_ops { }; struct realtek_variant { - const struct dsa_switch_ops *ds_ops_smi; - const struct dsa_switch_ops *ds_ops_mdio; + const struct dsa_switch_ops *ds_ops_custom_slavemii; + const struct dsa_switch_ops *ds_ops; const struct realtek_ops *ops; unsigned int clk_delay; u8 cmd_read; diff --git a/drivers/net/dsa/realtek/rtl8365mb.c b/drivers/net/dsa/realtek/rtl8365mb.c index da31d8b839ac..35fd32c4d340 100644 --- a/drivers/net/dsa/realtek/rtl8365mb.c +++ b/drivers/net/dsa/realtek/rtl8365mb.c @@ -2086,7 +2086,7 @@ static int rtl8365mb_detect(struct realtek_priv *priv) return 0; } -static const struct dsa_switch_ops rtl8365mb_switch_ops_smi = { +static const struct dsa_switch_ops rtl8365mb_switch_ops_custom_slavemii = { .get_tag_protocol = rtl8365mb_get_tag_protocol, .change_tag_protocol = rtl8365mb_change_tag_protocol, .setup = rtl8365mb_setup, @@ -2105,7 +2105,7 @@ static const struct dsa_switch_ops rtl8365mb_switch_ops_smi = { .get_stats64 = rtl8365mb_get_stats64, }; -static const struct dsa_switch_ops rtl8365mb_switch_ops_mdio = { +static const struct dsa_switch_ops rtl8365mb_switch_ops = { .get_tag_protocol = rtl8365mb_get_tag_protocol, .change_tag_protocol = rtl8365mb_change_tag_protocol, .setup = rtl8365mb_setup, @@ -2133,8 +2133,8 @@ static const struct realtek_ops rtl8365mb_ops = { }; const struct realtek_variant rtl8365mb_variant = { - .ds_ops_smi = &rtl8365mb_switch_ops_smi, - .ds_ops_mdio = &rtl8365mb_switch_ops_mdio, + .ds_ops_custom_slavemii = &rtl8365mb_switch_ops_custom_slavemii, + .ds_ops = &rtl8365mb_switch_ops, .ops = &rtl8365mb_ops, .clk_delay = 10, .cmd_read = 0xb9, diff --git a/drivers/net/dsa/realtek/rtl8366rb.c b/drivers/net/dsa/realtek/rtl8366rb.c index 25f88022b9e4..7c3de3be3a53 100644 --- a/drivers/net/dsa/realtek/rtl8366rb.c +++ b/drivers/net/dsa/realtek/rtl8366rb.c @@ -1793,7 +1793,7 @@ static int rtl8366rb_detect(struct realtek_priv *priv) return 0; } -static const struct dsa_switch_ops rtl8366rb_switch_ops_smi = { +static const struct dsa_switch_ops rtl8366rb_switch_ops_custom_slavemii = { .get_tag_protocol = rtl8366_get_tag_protocol, .setup = rtl8366rb_setup, .phylink_mac_link_up = rtl8366rb_mac_link_up, @@ -1816,7 +1816,7 @@ static const struct dsa_switch_ops rtl8366rb_switch_ops_smi = { .port_max_mtu = rtl8366rb_max_mtu, }; -static const struct dsa_switch_ops rtl8366rb_switch_ops_mdio = { +static const struct dsa_switch_ops rtl8366rb_switch_ops = { .get_tag_protocol = rtl8366_get_tag_protocol, .setup = rtl8366rb_setup, .phy_read = rtl8366rb_dsa_phy_read, @@ -1858,8 +1858,8 @@ static const struct realtek_ops rtl8366rb_ops = { }; const struct realtek_variant rtl8366rb_variant = { - .ds_ops_smi = &rtl8366rb_switch_ops_smi, - .ds_ops_mdio = &rtl8366rb_switch_ops_mdio, + .ds_ops_custom_slavemii = &rtl8366rb_switch_ops_custom_slavemii, + .ds_ops = &rtl8366rb_switch_ops, .ops = &rtl8366rb_ops, .clk_delay = 10, .cmd_read = 0xa9, From patchwork Wed Jun 29 03:54:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Angelo Daros de Luca X-Patchwork-Id: 12899263 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2842EC43334 for ; Wed, 29 Jun 2022 03:55:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229572AbiF2DzA (ORCPT ); Tue, 28 Jun 2022 23:55:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230235AbiF2Dy6 (ORCPT ); Tue, 28 Jun 2022 23:54:58 -0400 Received: from mail-oa1-x36.google.com (mail-oa1-x36.google.com [IPv6:2001:4860:4864:20::36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28A5E29808 for ; Tue, 28 Jun 2022 20:54:54 -0700 (PDT) Received: by mail-oa1-x36.google.com with SMTP id 586e51a60fabf-101bb9275bcso19771665fac.8 for ; Tue, 28 Jun 2022 20:54:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QNzQn/kZnGRmAeuFru6HW4F7EfldgkyUkpR5YkXQfwk=; b=UKVg5bxtqemAHqpSOlx+3tgwdsaBX8xJwuhu6vYY+rBpngnr0vweVAX4gv6dTDgcdT 7xdxYV2mXsRRu0+Kue8r3FooDPFaKVSslELHddyeFINJ7hBAu2FZhbFpTOkIYgTCV/6W 7gEgy1ElqyjC1b/BmffTE29aILjwlqHzGTPCCzLJxWNigJiiOPAue6QFjy95PuASuZE6 Mg+8KZVOu9RqxYMUv1EFcBfH/nLLHWXDboFZojyo8vaNWFstmMqDzHRXUGdJTp1lJ0cY c6ulmq9DRk0rfG3VCNS/OZwkWQXjgQvJdMxyN8pw7VqKwIe9wPNws5w9H4BbEIQEY0uL 0URQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QNzQn/kZnGRmAeuFru6HW4F7EfldgkyUkpR5YkXQfwk=; b=kLWX2C/W7PZpYJCmJ91siSugoTyf0+IpzxQ+g+NF/lulbzocyEbSh3U1ga3qCQniv9 htjRrGK2jAdrtdjqH0qEop0nHKvQL+RMR2jx8i5yYxvXvqZlsiFG5+RWACnd73gPrT2d Lxy3Ui2QeVjEFVOpVqJIk7+4Tm1+gCGvq5ye8UG2pGBHTEgpj3BN+ACBxu2lI77yb5VP IO38faL5q+OnBQedtxDdxvhimyZGKZVv9IYtFf4NNTN8MznG869/qlEiGA1xFyXjrynF ENlpr/APJDJ4gYY4ncix4K+hAvarwh5SEQEf8JMR/Kb2zPdMsHMKmGNjyprztuion7FU B09A== X-Gm-Message-State: AJIora8be9iOuK9Rkr65z4VuNMXzCIHzWSxXhKhqS6cjACWlkwipu3SR nJ1SYh4U/jG8qnuXMTXWrj6nQzfuV4+RrA== X-Google-Smtp-Source: AGRyM1tq7/Gme7OzCGkvoyg8PgO0fSMvOwDqTCzHG3XpVFZ4hrVSRGtTeuJNy4m/JwY+qStXgBdt0w== X-Received: by 2002:a05:6870:b414:b0:10b:8204:7e95 with SMTP id x20-20020a056870b41400b0010b82047e95mr727264oap.88.1656474893256; Tue, 28 Jun 2022 20:54:53 -0700 (PDT) Received: from tresc043793.tre-sc.gov.br ([187.94.103.218]) by smtp.gmail.com with ESMTPSA id r6-20020a056870580600b001089aef1815sm5636756oap.20.2022.06.28.20.54.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jun 2022 20:54:52 -0700 (PDT) From: Luiz Angelo Daros de Luca 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 Subject: [PATCH net-next RFC 2/3] net: dsa: realtek: deprecate custom slave mii Date: Wed, 29 Jun 2022 00:54:33 -0300 Message-Id: <20220629035434.1891-3-luizluca@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220629035434.1891-1-luizluca@gmail.com> References: <20220629035434.1891-1-luizluca@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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 --- 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"); From patchwork Wed Jun 29 03:54:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Angelo Daros de Luca X-Patchwork-Id: 12899264 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2E83CCA47C for ; Wed, 29 Jun 2022 03:55:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231199AbiF2DzA (ORCPT ); Tue, 28 Jun 2022 23:55:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231165AbiF2Dy7 (ORCPT ); Tue, 28 Jun 2022 23:54:59 -0400 Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5827F2ED56 for ; Tue, 28 Jun 2022 20:54:58 -0700 (PDT) Received: by mail-oi1-x231.google.com with SMTP id h65so19952720oia.11 for ; Tue, 28 Jun 2022 20:54:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JLWIIMMtnGdD1IKiWzRd6SzAH7vtKRCUdPqnUchpkWY=; b=F6/E/uLBnQhnEiIGjT3zYi+fPcKtVWUjg4/7Q39jHlc5uweRPC2u2In0I7MkA2Whmn /I9YaXTfAew+kxh3czyy6gyVpdY31+0T9ucYt2WDYn+sswZ+aPzokYssD9NIubT56uyB jw7+OVi/AA3DZQvGicMppcAfNSn7dmmbo5lIoaeYgJFwzABTQ7xe8UllI8IsauNhfNI5 P9C2ObAtruVcSeAwlUiOeo+bWHmlNqVzPuQGD/vrmdh+n4/i0wBFKUqD60hFwYevYV+3 bj0exJmu9O9x/JIvLWGpzbPYV9yTTZXz9TU0cl7IQxYavryIP1Yx4/rem05qqcJdE2Z7 z5Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JLWIIMMtnGdD1IKiWzRd6SzAH7vtKRCUdPqnUchpkWY=; b=v2DZuJic8eHL2CFP7QqraTX0xd8JeAMqwXCVoqZd1q9A2q+cLzM0Pg6y+IC6GpXBEK QQSiywaWIUwK/fRflbr3cw2fiLzrjWWnl1RgmQNUnzQPYZJ+swN03VrgJhjzd5VKtNoj nCuEsa+LW8G3fSOip9WYKA9glNCRH+tBE7dtGSdYjgSUyLLr3Da88Q8v3Y8/S1K9YsBQ m55zzdP6MTfX+vxqnQWMP/FDNd3+hfPa6iPCRuSGrXNtQ5f+vtgBFmda4qPoPB3XNEMD 03aEDntwsOJe8oY1ajCfPFpahsd+C4RhoHF/EeeDwHDT4f9cXeQafGzv/IxWhPOjfe2L EXVw== X-Gm-Message-State: AJIora8IADyliLS9/T+/z65kC+Xg0pHFAkbRkl37KRnv5sVuEx+Vvr2l dULRa+YL8hYk63ey69CGH2WSpioxWkC0gQ== X-Google-Smtp-Source: AGRyM1tJQc6ol2EUyfexWAYtLORRgahzaBnDbtH9yZDndkfV2HIlpLYDTc4S4/tqQ1/YCjkq5cd6yA== X-Received: by 2002:a05:6808:1691:b0:2f9:4bd7:581e with SMTP id bb17-20020a056808169100b002f94bd7581emr1830102oib.144.1656474897397; Tue, 28 Jun 2022 20:54:57 -0700 (PDT) Received: from tresc043793.tre-sc.gov.br ([187.94.103.218]) by smtp.gmail.com with ESMTPSA id r6-20020a056870580600b001089aef1815sm5636756oap.20.2022.06.28.20.54.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jun 2022 20:54:56 -0700 (PDT) From: Luiz Angelo Daros de Luca 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 Subject: [PATCH net-next RFC 3/3] net: dsa: realtek: remove deprecated custom slave mii Date: Wed, 29 Jun 2022 00:54:34 -0300 Message-Id: <20220629035434.1891-4-luizluca@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220629035434.1891-1-luizluca@gmail.com> References: <20220629035434.1891-1-luizluca@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Drop the code path using the custom slave mii. It still warns if there is a compatible string in "mdio" node. However, if that compatible string is in a node not named "mdio", it will show an error. In that case, it might still work using polling instead of interruptions. Signed-off-by: Luiz Angelo Daros de Luca --- drivers/net/dsa/realtek/realtek-smi.c | 71 +++------------------------ drivers/net/dsa/realtek/realtek.h | 5 -- drivers/net/dsa/realtek/rtl8365mb.c | 30 ----------- drivers/net/dsa/realtek/rtl8366rb.c | 34 ------------- 4 files changed, 8 insertions(+), 132 deletions(-) diff --git a/drivers/net/dsa/realtek/realtek-smi.c b/drivers/net/dsa/realtek/realtek-smi.c index c3668a9208ac..5de0b1563e44 100644 --- a/drivers/net/dsa/realtek/realtek-smi.c +++ b/drivers/net/dsa/realtek/realtek-smi.c @@ -352,67 +352,6 @@ static const struct regmap_config realtek_smi_nolock_regmap_config = { .disable_locking = true, }; -static int realtek_smi_mdio_read(struct mii_bus *bus, int addr, int regnum) -{ - struct realtek_priv *priv = bus->priv; - - return priv->ops->phy_read(priv, addr, regnum); -} - -static int realtek_smi_mdio_write(struct mii_bus *bus, int addr, int regnum, - u16 val) -{ - struct realtek_priv *priv = bus->priv; - - return priv->ops->phy_write(priv, addr, regnum, val); -} - -static int realtek_smi_setup_mdio(struct dsa_switch *ds) -{ - struct realtek_priv *priv = ds->priv; - struct device_node *mdio_np; - int ret; - - mdio_np = of_get_compatible_child(priv->dev->of_node, "realtek,smi-mdio"); - if (!mdio_np) { - dev_err(priv->dev, "no MDIO bus node\n"); - 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; - goto err_put_node; - } - priv->slave_mii_bus->priv = priv; - priv->slave_mii_bus->name = "SMI slave MII"; - priv->slave_mii_bus->read = realtek_smi_mdio_read; - priv->slave_mii_bus->write = realtek_smi_mdio_write; - snprintf(priv->slave_mii_bus->id, MII_BUS_ID_SIZE, "SMI-%d", - ds->index); - priv->slave_mii_bus->dev.of_node = mdio_np; - priv->slave_mii_bus->parent = priv->dev; - ds->slave_mii_bus = priv->slave_mii_bus; - - ret = devm_of_mdiobus_register(priv->dev, priv->slave_mii_bus, mdio_np); - if (ret) { - dev_err(priv->dev, "unable to register MDIO bus %s\n", - priv->slave_mii_bus->id); - goto err_put_node; - } - - return 0; - -err_put_node: - of_node_put(mdio_np); - - return ret; -} - static int realtek_smi_probe(struct platform_device *pdev) { const struct realtek_variant *var; @@ -510,8 +449,14 @@ static int realtek_smi_probe(struct platform_device *pdev) 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; + mdio_np = of_get_compatible_child(priv->dev->of_node, + "realtek,smi-mdio"); + if (mdio_np) { + dev_err(priv->dev, + "Rename '%s' to 'mdio' and remove the compatible string\n", + mdio_np->full_name); + of_node_put(mdio_np); + } } ret = dsa_register_switch(priv->ds); diff --git a/drivers/net/dsa/realtek/realtek.h b/drivers/net/dsa/realtek/realtek.h index 004a9ae91ccf..972a87be7e39 100644 --- a/drivers/net/dsa/realtek/realtek.h +++ b/drivers/net/dsa/realtek/realtek.h @@ -73,7 +73,6 @@ struct realtek_priv { struct rtl8366_mib_counter *mib_counters; const struct realtek_ops *ops; - int (*setup_interface)(struct dsa_switch *ds); int (*write_reg_noack)(void *ctx, u32 addr, u32 data); int vlan_enabled; @@ -110,13 +109,9 @@ struct realtek_ops { int (*enable_vlan)(struct realtek_priv *priv, bool enable); int (*enable_vlan4k)(struct realtek_priv *priv, bool enable); int (*enable_port)(struct realtek_priv *priv, int port, bool enable); - int (*phy_read)(struct realtek_priv *priv, int phy, int regnum); - int (*phy_write)(struct realtek_priv *priv, int phy, int regnum, - u16 val); }; struct realtek_variant { - const struct dsa_switch_ops *ds_ops_custom_slavemii; const struct dsa_switch_ops *ds_ops; const struct realtek_ops *ops; unsigned int clk_delay; diff --git a/drivers/net/dsa/realtek/rtl8365mb.c b/drivers/net/dsa/realtek/rtl8365mb.c index 35fd32c4d340..bca4019f4fca 100644 --- a/drivers/net/dsa/realtek/rtl8365mb.c +++ b/drivers/net/dsa/realtek/rtl8365mb.c @@ -1987,14 +1987,6 @@ static int rtl8365mb_setup(struct dsa_switch *ds) if (ret) goto out_teardown_irq; - if (priv->setup_interface) { - ret = priv->setup_interface(ds); - if (ret) { - dev_err(priv->dev, "could not set up MDIO bus\n"); - goto out_teardown_irq; - } - } - /* Start statistics counter polling */ rtl8365mb_stats_setup(priv); @@ -2086,25 +2078,6 @@ static int rtl8365mb_detect(struct realtek_priv *priv) return 0; } -static const struct dsa_switch_ops rtl8365mb_switch_ops_custom_slavemii = { - .get_tag_protocol = rtl8365mb_get_tag_protocol, - .change_tag_protocol = rtl8365mb_change_tag_protocol, - .setup = rtl8365mb_setup, - .teardown = rtl8365mb_teardown, - .phylink_get_caps = rtl8365mb_phylink_get_caps, - .phylink_mac_config = rtl8365mb_phylink_mac_config, - .phylink_mac_link_down = rtl8365mb_phylink_mac_link_down, - .phylink_mac_link_up = rtl8365mb_phylink_mac_link_up, - .port_stp_state_set = rtl8365mb_port_stp_state_set, - .get_strings = rtl8365mb_get_strings, - .get_ethtool_stats = rtl8365mb_get_ethtool_stats, - .get_sset_count = rtl8365mb_get_sset_count, - .get_eth_phy_stats = rtl8365mb_get_phy_stats, - .get_eth_mac_stats = rtl8365mb_get_mac_stats, - .get_eth_ctrl_stats = rtl8365mb_get_ctrl_stats, - .get_stats64 = rtl8365mb_get_stats64, -}; - static const struct dsa_switch_ops rtl8365mb_switch_ops = { .get_tag_protocol = rtl8365mb_get_tag_protocol, .change_tag_protocol = rtl8365mb_change_tag_protocol, @@ -2128,12 +2101,9 @@ static const struct dsa_switch_ops rtl8365mb_switch_ops = { static const struct realtek_ops rtl8365mb_ops = { .detect = rtl8365mb_detect, - .phy_read = rtl8365mb_phy_read, - .phy_write = rtl8365mb_phy_write, }; const struct realtek_variant rtl8365mb_variant = { - .ds_ops_custom_slavemii = &rtl8365mb_switch_ops_custom_slavemii, .ds_ops = &rtl8365mb_switch_ops, .ops = &rtl8365mb_ops, .clk_delay = 10, diff --git a/drivers/net/dsa/realtek/rtl8366rb.c b/drivers/net/dsa/realtek/rtl8366rb.c index 7c3de3be3a53..d2f4ccaaf54f 100644 --- a/drivers/net/dsa/realtek/rtl8366rb.c +++ b/drivers/net/dsa/realtek/rtl8366rb.c @@ -1030,14 +1030,6 @@ static int rtl8366rb_setup(struct dsa_switch *ds) if (ret) dev_info(priv->dev, "no interrupt support\n"); - if (priv->setup_interface) { - ret = priv->setup_interface(ds); - if (ret) { - dev_err(priv->dev, "could not set up MDIO bus\n"); - return -ENODEV; - } - } - return 0; } @@ -1793,29 +1785,6 @@ static int rtl8366rb_detect(struct realtek_priv *priv) return 0; } -static const struct dsa_switch_ops rtl8366rb_switch_ops_custom_slavemii = { - .get_tag_protocol = rtl8366_get_tag_protocol, - .setup = rtl8366rb_setup, - .phylink_mac_link_up = rtl8366rb_mac_link_up, - .phylink_mac_link_down = rtl8366rb_mac_link_down, - .get_strings = rtl8366_get_strings, - .get_ethtool_stats = rtl8366_get_ethtool_stats, - .get_sset_count = rtl8366_get_sset_count, - .port_bridge_join = rtl8366rb_port_bridge_join, - .port_bridge_leave = rtl8366rb_port_bridge_leave, - .port_vlan_filtering = rtl8366rb_vlan_filtering, - .port_vlan_add = rtl8366_vlan_add, - .port_vlan_del = rtl8366_vlan_del, - .port_enable = rtl8366rb_port_enable, - .port_disable = rtl8366rb_port_disable, - .port_pre_bridge_flags = rtl8366rb_port_pre_bridge_flags, - .port_bridge_flags = rtl8366rb_port_bridge_flags, - .port_stp_state_set = rtl8366rb_port_stp_state_set, - .port_fast_age = rtl8366rb_port_fast_age, - .port_change_mtu = rtl8366rb_change_mtu, - .port_max_mtu = rtl8366rb_max_mtu, -}; - static const struct dsa_switch_ops rtl8366rb_switch_ops = { .get_tag_protocol = rtl8366_get_tag_protocol, .setup = rtl8366rb_setup, @@ -1853,12 +1822,9 @@ static const struct realtek_ops rtl8366rb_ops = { .is_vlan_valid = rtl8366rb_is_vlan_valid, .enable_vlan = rtl8366rb_enable_vlan, .enable_vlan4k = rtl8366rb_enable_vlan4k, - .phy_read = rtl8366rb_phy_read, - .phy_write = rtl8366rb_phy_write, }; const struct realtek_variant rtl8366rb_variant = { - .ds_ops_custom_slavemii = &rtl8366rb_switch_ops_custom_slavemii, .ds_ops = &rtl8366rb_switch_ops, .ops = &rtl8366rb_ops, .clk_delay = 10,