mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Bhargav Joshi <j.bhargav.u@gmail.com>
Cc: netdev-bot+sashiko@kernel.org, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, 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, 17 Sep 2026 14:49:52 -0500	[thread overview]
Message-ID: <20260917194952.GA3457763-robh@kernel.org> (raw)
In-Reply-To: <CAOWyW_6qRhoUts2MtvDL3JiBx74UOBs73Fye=1FKrky-brmS8Q@mail.gmail.com>

On Fri, Sep 04, 2026 at 01:13:54AM +0530, Bhargav Joshi wrote:
> Hi,
> 
> On Thu, Sep 3, 2026 at 8:47 PM <netdev-bot+sashiko@kernel.org> wrote:
> >
> > 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);
> 
> This driver logic relies on the reg entry count to determine the port
> instance. This is a software implementation detail and not hardware
> detail. I believe it is bad idea to rely on the number of reg entries to
> get instance, It's better to use of_alias_get_id() to get instance of port.
> 
> >From a hardware perspective, eth0 requires 2 reg entries because MDIO
> node occupies the 0x800 to 0x8FF.
> 
> >
> > 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.
> >
> To resolve this I can either:
> 
> Use nodename to hardcode exact address for eth0 and eth1 something like
>   if:
>       properties:
>         $nodename:
>           pattern: "^ethernet@4a100000$"
>   then:
>       properties:
>         reg:
>           minItems: 2
> or
> Enforce 2 reg for both eth0 and eth1, For eth1, even though there is no
> MDIO, the base+0x800 to 0x8FF is simply unused, so describing it as
> split regions is still accurate. But this will require a driver fix
> for getting port
> instance.

Just leave it as-is. This is for ancient h/w.

Rob

  reply	other threads:[~2026-09-17 19:49 UTC|newest]

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

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=20260917194952.GA3457763-robh@kernel.org \
    --to=robh@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-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --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®