Devicetree
 help / color / mirror / Atom feed
From: Nicolai Buchwitz <nb@tipi-net.de>
To: sashiko-reviews@lists.linux.dev
Cc: linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH 3/3] ARM: dts: bcm2711: give the GENET MDIO controller its clock
Date: Wed, 21 Oct 2026 17:10:19 +0200	[thread overview]
Message-ID: <f6c76f30641895e8c415bf815b902e11@tipi-net.de> (raw)
In-Reply-To: <sashiko-outbox-180405@kernel.org>

On 21.10.2026 16:58, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential 
> issue(s) to consider:
> - [Medium] ARM: dts: bcm2711: genet_mdio clocks property ignored in 
> unimac_mdio_probe()
> --
> 
> commit abe7b1908b1ca3d642c93b8cea72ce17c73c4c14
> Author: Nicolai Buchwitz <nb@tipi-net.de>
> 
> ARM: dts: bcm2711: give the GENET MDIO controller its clock
> 
> This commit adds the BCM2711_CLOCK_GISB clock phandle to the genet_mdio
> device tree node in bcm2711.dtsi so the mdio-bcm-unimac driver can 
> query
> the 200 MHz clock rate.
> 
>> diff --git a/arch/arm/boot/dts/broadcom/bcm2711.dtsi 
>> b/arch/arm/boot/dts/broadcom/bcm2711.dtsi
>> index 5e3b4bb393967..82b38551d55cf 100644
>> --- a/arch/arm/boot/dts/broadcom/bcm2711.dtsi
>> +++ b/arch/arm/boot/dts/broadcom/bcm2711.dtsi
>> @@ -597,6 +597,7 @@ genet_mdio: mdio@e14 {
>>  				compatible = "brcm,genet-mdio-v5";
>>  				reg = <0xe14 0x8>;
>>  				reg-names = "mdio";
>> +				clocks = <&clocks BCM2711_CLOCK_GISB>;
>>  				#address-cells = <0x1>;
>>  				#size-cells = <0x0>;
>>  			};
> 
> [Severity: Medium]
> Will mdio-bcm-unimac actually read the clocks property added to the
> genet_mdio child node here?
> 
> When bcmgenet_probe() initializes the controller, it requests the 
> parent
> genet node's "enet" clock via devm_clk_get_optional(&priv->pdev->dev,
> "enet"), which evaluates to NULL on BCM2711 because the parent
> ethernet@7d580000 node has no clocks property.
> 
> Then bcmgenet_probe() -> bcmgenet_mii_init() -> bcmgenet_mii_register()
> registers the unimac-mdio platform device with platform_data attached:
> 
> drivers/net/ethernet/broadcom/genet/bcmmii.c:bcmgenet_mii_register() {
> 	...
> 	ppd.clk = priv->clk;
> 	...
> 	if (dn)
> 		platform_device_set_of_node(ppdev, bcmgenet_mii_of_find_mdio(priv));
> 	else
> 		ppd.phy_mask = ~0;
> 
> 	ret = platform_device_add_resources(ppdev, &res, 1);
> 	if (ret)
> 		goto out;
> 
> 	ret = platform_device_add_data(ppdev, &ppd, sizeof(ppd));
> 	...
> }
> 
> When unimac_mdio_probe() runs for that device, pdata is non-NULL, so it
> takes the if (pdata) branch and never calls devm_clk_get_optional() on 
> the
> genet_mdio OF node:
> 
> drivers/net/mdio/mdio-bcm-unimac.c:unimac_mdio_probe() {
> 	...
> 	if (pdata) {
> 		bus->name = pdata->bus_name;
> 		priv->wait_func = pdata->wait_func;
> 		priv->wait_func_data = pdata->wait_func_data;
> 		bus->phy_mask = ~pdata->phy_mask;
> 		priv->clk = pdata->clk;
> 	} else {
> 		bus->name = "unimac MII bus";
> 		priv->wait_func_data = priv;
> 		priv->wait_func = unimac_mdio_poll;
> 		priv->clk = devm_clk_get_optional(&pdev->dev, NULL);
> 	}
> 	...
> }
> 
> As a result, priv->clk remains NULL and clk_get_rate(priv->clk) in
> unimac_mdio_clk_set() still returns 0 (and unimac_mdio_clk_set() also
> returns early unless clock-frequency is set).
> 
> Should unimac_mdio_probe() fall back to devm_clk_get_optional() when
> pdata->clk is NULL, or should the clock be wired up through the parent
> genet node?

Known, see the cover letter. Today the pdata branch never looks at the
mdio node, so the property is unused until James's series [1] adds the
node-first devm_clk_get_optional() there (planned for v2), with the
unimac_mdio_clk_set() change as a follow-up. The DT describes the
hardware either way.

[1] 
https://lore.kernel.org/netdev/20261009143506.2507607-1-jjc@jclark.com/

      reply	other threads:[~2026-10-21 15:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20 14:58 [PATCH 0/3] clk: bcm2835: describe the BCM2711 GISB clock for the GENET MDIO controller Nicolai Buchwitz
2026-10-20 14:58 ` [PATCH 1/3] dt-bindings: clock: bcm2835: add the BCM2711 GISB clock Nicolai Buchwitz
2026-10-20 15:38   ` Florian Fainelli
2026-10-20 14:58 ` [PATCH 2/3] clk: bcm2835: register " Nicolai Buchwitz
2026-10-20 15:40   ` Florian Fainelli
2026-10-20 14:58 ` [PATCH 3/3] ARM: dts: bcm2711: give the GENET MDIO controller its clock Nicolai Buchwitz
2026-10-20 15:40   ` Florian Fainelli
2026-10-21 14:58   ` sashiko-bot
2026-10-21 15:10     ` Nicolai Buchwitz [this message]

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=f6c76f30641895e8c415bf815b902e11@tipi-net.de \
    --to=nb@tipi-net.de \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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