mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: j.bhargav.u@gmail.com
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org, tony@atomide.com,
	netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, goledhruva@gmail.com,
	m-chawdhry@ti.com, daniel.baluta@gmail.com, simona.toaca@nxp.com
Subject: Re: [v3] dt-bindings: net: ti,davinci-emac: Convert to DT schema
Date: Thu, 03 Sep 2026 15:17:12 +0000	[thread overview]
Message-ID: <178844863252.3394541.10006643092711574384@kernel.org> (raw)
In-Reply-To: <20260901-ti-davinci-emac-v3-1-db41e32f3f6d@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider:

Critical: 0 · High: 0 · Medium: 1 · Low: 1

- [Medium] The new schema lets `ti,dm816-emac` nodes carry either 1 or 2
  `reg` entries with no further constraint, while the driver derives…
- [Low] The schema makes `clocks` required (justified in the commit
  message by 'driver probe fails without it') but leaves `power-domains`…

--

dt-bindings: net: ti,davinci-emac: Convert to DT schema

This converts the DaVinci EMAC text binding to YAML, documents clocks,
clock-names, syscon, power-domains and ti,hwmods, and adds per-compatible
conditionals restricting reg, syscon and clock-names.  clocks becomes a
required property and ti,hwmods is marked deprecated.

> diff --git a/Documentation/devicetree/bindings/net/ti,davinci-emac.yaml b/Documentation/devicetree/bindings/net/ti,davinci-emac.yaml
> new file mode 100644
> index 0000000000000..f0c539d1bac79
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/ti,davinci-emac.yaml
> @@ -0,0 +1,127 @@

[ ... ]

> +properties:
> +  compatible:
> +    enum:
> +      - ti,davinci-dm6467-emac
> +      - ti,am3517-emac
> +      - ti,dm816-emac
> +
> +  reg:
> +    minItems: 1
> +    items:
> +      - description: EMAC core
> +      - description: EMAC control module

[Severity: Medium]

For ti,dm816-emac this leaves reg free to be either 1 or 2 entries, but the
driver derives hardware semantics from the entry count.  In
davinci_emac_probe() the presence of the second region is the only signal
used, both for the control module base:

	res_ctrl = platform_get_resource(pdev, IORESOURCE_MEM, 1);
	if (res_ctrl) {
		priv->ctrl_base =
			devm_ioremap_resource(&pdev->dev, res_ctrl);
		...
	} else {
		priv->ctrl_base = priv->remap_addr + pdata->ctrl_mod_reg_offset;
	}

and for the SCM eFuse MAC-ID instance:

	rc = davinci_emac_try_get_mac(pdev, res_ctrl ? 0 : 1, priv->mac_addr);

which flows into ti_cm_get_macid()/cpsw_am33xx_cm_get_macid() and selects the
register pair at offset + slave * 8.

Given that, can a schema-valid DM816x node land on the wrong hardware?  Two
cases seem possible:

A single-reg EMAC0 node with a 0x800 core window (as in dm816x.dtsi, where
MDIO at 0x4a100800 is a separate node) plus ti,davinci-ctrl-mod-reg-offset =
<0x900> would make ctrl_base point 0x900 past the end of the ioremap.

An EMAC1 node written with two reg entries would be passed instance 0 and get
EMAC0's factory MAC address, putting two interfaces on the wire with the same
address.

In-tree, arch/arm/boot/dts/ti/omap/dm816x.dtsi happens to pair these
correctly (eth0 has two reg entries, eth1 has one), but nothing here requires
that pairing.  Would it make sense to constrain this per instance, or at
least document that the presence of the second reg entry also selects the
MAC-ID instance?  The commit message line:

    - Allow 1-2 reg entries for DM816.

reads as though the choice is free.

[ ... ]

> +  power-domains:
> +    maxItems: 1
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +  - ti,davinci-ctrl-reg-offset
> +  - ti,davinci-ctrl-mod-reg-offset
> +  - ti,davinci-ctrl-ram-offset
> +  - ti,davinci-ctrl-ram-size
> +  - clocks

[Severity: Low]

clocks is required here, but power-domains stays optional.  For
ti,davinci-dm6467-emac, is clocks alone enough to describe an enabled module?
davinci_emac_probe() only queries the rate and immediately drops the clock:

	emac_clk = devm_clk_get(&pdev->dev, NULL);
	if (IS_ERR(emac_clk)) { ... }
	emac_bus_frequency = clk_get_rate(emac_clk);
	devm_clk_put(&pdev->dev, emac_clk);

There is no clk_prepare_enable() in probe, so the LPSC gate and local reset
appear to be handled by the genpd reached through power-domains.  In
drivers/clk/davinci/psc.c each LPSC registers a domain with
GENPD_FLAG_PM_CLK and davinci_psc_genpd_attach_dev() adds the LPSC clock to
the device's pm_clk list:

	lpsc->pm_domain.attach_dev = davinci_psc_genpd_attach_dev;
	lpsc->pm_domain.flags = GENPD_FLAG_PM_CLK;
	pm_genpd_init(&lpsc->pm_domain, NULL, is_on);

That matches da850.dtsi, the only in-tree user of this compatible, which
carries both clocks = <&psc1 5> and power-domains = <&psc1 5>, and it matches
the example added below.

> +allOf:
> +  - $ref: ethernet-controller.yaml#
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: ti,davinci-dm6467-emac
> +    then:
> +      properties:
> +        syscon: false
> +        clock-names: false
> +        reg:
> +          maxItems: 1

Since this conditional already narrows reg, syscon and clock-names for
ti,davinci-dm6467-emac, would adding power-domains to a required list here be
appropriate?  Without it, a conforming node describes a module that is never
ungated, while probe continues and later register access in emac_dev_open()
and the cpdma setup targets a gated, reset-asserted module.

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260901-ti-davinci-emac-v3-1-db41e32f3f6d%40gmail.com

  reply	other threads:[~2026-09-03 15:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01  0:15 [PATCH v3] " Bhargav Joshi
2026-09-03 15:17 ` netdev-bot+sashiko [this message]
2026-09-03 15:22   ` [v3] " Krzysztof Kozlowski
2026-09-03 23:09     ` Jakub Kicinski
2026-09-03 19:43   ` Bhargav Joshi

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=178844863252.3394541.10006643092711574384@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=conor+dt@kernel.org \
    --cc=daniel.baluta@gmail.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=goledhruva@gmail.com \
    --cc=j.bhargav.u@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m-chawdhry@ti.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=robh@kernel.org \
    --cc=simona.toaca@nxp.com \
    --cc=tony@atomide.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

all inboxes | Powered by JetHome®