From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Yang Xiwen via B4 Relay <devnull+forbidden405.outlook.com@kernel.org>
Cc: <forbidden405@outlook.com>,
Yisen Zhuang <yisen.zhuang@huawei.com>,
Salil Mehta <salil.mehta@huawei.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>, Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, Simon Horman <horms@kernel.org>
Subject: Re: [PATCH net-next v3 3/6] net: hisilicon: add support for hisi_femac core on Hi3798MV200
Date: Tue, 20 Feb 2024 15:47:37 +0100 [thread overview]
Message-ID: <20240220154737.705c33e5@device-28.home> (raw)
In-Reply-To: <20240220-net-v3-3-b68e5b75e765@outlook.com>
Hello,
On Tue, 20 Feb 2024 03:57:38 +0800
Yang Xiwen via B4 Relay <devnull+forbidden405.outlook.com@kernel.org>
wrote:
> From: Yang Xiwen <forbidden405@outlook.com>
>
> Register the sub MDIO bus if it is found. Also implement the internal
> PHY reset procedure as needed.
>
> Note it's unable to put the MDIO bus node outside of MAC controller
> (i.e. at the same level in the parent bus node). Because we need to
> control all clocks and resets in FEMAC driver due to the phy reset
> procedure. So the clocks can't be assigned to MDIO bus device, which is
> an essential resource for the MDIO bus to work.
>
> No backward compatibility is maintained since the only existing
> user(Hi3516DV300) has not received any updates from HiSilicon for about
> 8 years already. And till today, no mainline dts for this SoC is found.
> It seems unlikely that there are still existing mainline Hi3516DV300
> users. The effort to maintain the old binding seems gain a little.
>
> Signed-off-by: Yang Xiwen <forbidden405@outlook.com>
Besides what Andrew and Simon already mentionned, I have a few other
small comments :
[...]
> @@ -797,23 +816,22 @@ static int hisi_femac_drv_probe(struct platform_device *pdev)
> goto out_free_netdev;
> }
>
> - priv->clk = devm_clk_get(&pdev->dev, NULL);
> - if (IS_ERR(priv->clk)) {
> - dev_err(dev, "failed to get clk\n");
> - ret = -ENODEV;
> + ret = devm_clk_bulk_get_all(&pdev->dev, &priv->clks);
> + if (ret < 0 || ret != CLK_NUM) {
> + dev_err(dev, "failed to get clk bulk: %d\n", ret);
> goto out_free_netdev;
> }
>
> - ret = clk_prepare_enable(priv->clk);
> + ret = clk_bulk_prepare_enable(CLK_NUM, priv->clks);
> if (ret) {
> - dev_err(dev, "failed to enable clk %d\n", ret);
> + dev_err(dev, "failed to enable clk bulk: %d\n", ret);
> goto out_free_netdev;
> }
>
> priv->mac_rst = devm_reset_control_get(dev, "mac");
> if (IS_ERR(priv->mac_rst)) {
> ret = PTR_ERR(priv->mac_rst);
> - goto out_disable_clk;
> + goto out_free_netdev;
When you return here (or even later), you are missing a call to
"clk_bulk_disable_unprepare" in the cleanup path
> }
> hisi_femac_core_reset(priv);
>
> @@ -826,15 +844,34 @@ static int hisi_femac_drv_probe(struct platform_device *pdev)
> priv->phy_reset_delays,
> DELAYS_NUM);
> if (ret)
> - goto out_disable_clk;
> + goto out_free_netdev;
> hisi_femac_phy_reset(priv);
> }
>
> + // Register the optional MDIO bus
I think this comment style should be avoided, in favor of C-style
comments ( /* blabla */ )
> + for_each_available_child_of_node(node, mdio_np) {
> + if (of_node_name_prefix(mdio_np, "mdio")) {
> + priv->mdio_pdev = of_platform_device_create(mdio_np, NULL, dev);
> + of_node_put(mdio_np);
> + if (!priv->mdio_pdev) {
> + dev_err(dev, "failed to register MDIO bus device\n");
> + ret = -ENODEV;
> + goto out_free_netdev;
> + }
> + mdio_registered = true;
> + break;
> + }
> + of_node_put(mdio_np);
> + }
> +
> + if (!mdio_registered)
> + dev_warn(dev, "MDIO subnode not found. This is usually a bug.\n");
> +
> phy = of_phy_get_and_connect(ndev, node, hisi_femac_adjust_link);
> if (!phy) {
> dev_err(dev, "connect to PHY failed!\n");
> ret = -ENODEV;
> - goto out_disable_clk;
> + goto out_unregister_mdio_bus;
> }
>
> phy_attached_print(phy, "phy_id=0x%.8lx, phy_mode=%s\n",
Thanks,
Maxime
next prev parent reply other threads:[~2024-02-20 14:47 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-19 19:57 [PATCH net-next v3 0/6] net: hisi-femac: add support for Hi3798MV200, remove unmaintained compatibles Yang Xiwen via B4 Relay
2024-02-19 19:57 ` [PATCH net-next v3 1/6] net: mdio: hisi-femac: make clock optional Yang Xiwen via B4 Relay
2024-02-19 19:57 ` [PATCH net-next v3 2/6] dt-bindings: net: hisilicon-femac-mdio: convert to YAML Yang Xiwen via B4 Relay
2024-02-21 8:11 ` Krzysztof Kozlowski
2024-02-21 8:12 ` Krzysztof Kozlowski
2024-02-21 11:24 ` Yang Xiwen
2024-02-22 18:15 ` Krzysztof Kozlowski
2024-02-19 19:57 ` [PATCH net-next v3 3/6] net: hisilicon: add support for hisi_femac core on Hi3798MV200 Yang Xiwen via B4 Relay
2024-02-19 20:03 ` Andrew Lunn
2024-02-19 20:14 ` Yang Xiwen
2024-02-19 21:05 ` Andrew Lunn
2024-02-19 21:19 ` Yang Xiwen
2024-02-19 22:05 ` Andrew Lunn
2024-02-19 22:31 ` Yang Xiwen
2024-02-19 22:34 ` Yang Xiwen
2024-02-19 20:42 ` Yang Xiwen
2024-02-20 13:55 ` Simon Horman
2024-02-20 14:47 ` Maxime Chevallier [this message]
2024-02-20 14:57 ` Yang Xiwen
2024-02-19 19:57 ` [PATCH net-next v3 4/6] net: hisi_femac: remove unused compatible strings Yang Xiwen via B4 Relay
2024-02-19 19:57 ` [PATCH net-next v3 5/6] dt-bindings: net: remove outdated hisilicon-femac Yang Xiwen via B4 Relay
2024-02-19 19:57 ` [PATCH net-next v3 6/6] dt-bindings: net: add hisilicon,hisi-femac Yang Xiwen via B4 Relay
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=20240220154737.705c33e5@device-28.home \
--to=maxime.chevallier@bootlin.com \
--cc=andrew@lunn.ch \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=devnull+forbidden405.outlook.com@kernel.org \
--cc=edumazet@google.com \
--cc=forbidden405@outlook.com \
--cc=hkallweit1@gmail.com \
--cc=horms@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=robh+dt@kernel.org \
--cc=salil.mehta@huawei.com \
--cc=yisen.zhuang@huawei.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).