mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: jensemil.schulzostergaard@microchip.com
Cc: UNGLinuxDriver@microchip.com, andrew@lunn.ch, olteanv@gmail.com,
	davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
	horms@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, woojung.huh@microchip.com,
	linux@armlinux.org.uk, Steen.Hegelund@microchip.com,
	daniel.machon@microchip.com, geert+renesas@glider.be,
	magnus.damm@gmail.com, edumazet@kernel.org,
	richardcochran@gmail.com, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH net-next v15 2/9] dt-bindings: net: dsa: add Microchip LAN9645x switch
Date: Mon, 19 Oct 2026 10:08:43 +0000	[thread overview]
Message-ID: <179240452378.3135.9892080157783163049@kernel.org> (raw)
In-Reply-To: <20261015-dsa_lan9645x_switch_driver_base-v15-2-562f316f78b9@microchip.com>

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

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

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The binding (microchip,lan96455s-switch.yaml) and its RGMII
  delay design contradict the in-tree RGMII contract in ethernet-…
- [Low] The binding (microchip,lan96455s-switch.yaml) does not reject
  port nodes beyond port 8, and those nodes escape its RGMII delay…

--

dt-bindings: net: dsa: add Microchip LAN9645x switch

This adds a YAML binding for the Microchip LAN9645x DSA switch family,
with microchip,lan96455s-switch as the fallback compatible. The switch
registers are described with one reg entry per register target. RGMII
ports may set a fixed 0 or 2000 ps MAC internal delay.

> diff --git a/Documentation/devicetree/bindings/net/dsa/microchip,lan96455s-switch.yaml b/Documentation/devicetree/bindings/net/dsa/microchip,lan96455s-switch.yaml
> new file mode 100644
> index 0000000000000..517bc4c00de30
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/dsa/microchip,lan96455s-switch.yaml
> @@ -0,0 +1,208 @@

[ ... ]

> +  ethernet-ports:
> +    type: object
> +    additionalProperties: true
> +    patternProperties:
> +      "^(ethernet-)?port@[0-8]$":

[Severity: Low]
Can port nodes above port 8 get past this schema?

The local pattern only matches port@0 through port@8. However,
ethernet-ports has additionalProperties: true, and the inherited
dsa.yaml#/$defs/ethernet-ports checks "^(ethernet-)?port@[0-9a-f]+$"
against dsa-port.yaml. That means port@9 through port@f are evaluated
and pass.

Those nodes also skip the local RGMII if/then. For example, port@9 with
phy-mode = "rgmii" and rx-internal-delay-ps = <5000> passes, because
ethernet-controller.yaml only types that property as uint32.

The hardware has only 9 ports, so these nodes are rejected only at probe
time:

net/dsa/dsa.c:dsa_switch_parse_ports_of() {
    ...
		if (reg >= ds->num_ports) {
			dev_err(ds->dev, "port %pOF index %u exceeds num_ports (%u)\n",
    ...
}

The description says the last SKU digit gives 5, 7 or 9 usable front
ports. No compatible-based if block limits which port@N nodes the 5-port
and 7-port SKUs may declare, so a bare microchip,lan96455s-switch node can
describe all nine ports.

renesas,rzn1-a5psw.yaml, which the changelog names as the model, has the
same pattern.

Should the schema reject port nodes outside the range each SKU supports?

> +        type: object
> +        description: Ethernet switch ports
> +        additionalProperties: true
> +
> +        allOf:
> +          - if:
> +              properties:
> +                phy-mode:
> +                  contains:
> +                    enum:
> +                      - rgmii
> +                      - rgmii-rxid
> +                      - rgmii-txid
> +                      - rgmii-id
> +            then:
> +              properties:
> +                rx-internal-delay-ps:
> +                  $ref: "#/$defs/internal-delay-ps"
> +                tx-internal-delay-ps:
> +                  $ref: "#/$defs/internal-delay-ps"

[ ... ]

> +$defs:
> +  internal-delay-ps:
> +    description:
> +      Disable the delay line using 0 ps, or enable the 2000 ps delay. The
> +      delay line is not tunable, so no other phase can be selected.
> +    enum: [0, 2000]
> +    default: 0

[Severity: Medium]
Does this delay definition conflict with the RGMII rules in
ethernet-controller.yaml?

The if/then above applies this 0/2000 ps enum to all four RGMII modes.
That means the schema accepts phy-mode = "rgmii" together with
tx-internal-delay-ps = <2000>. The informative section of
ethernet-controller.yaml says:

  # be used to indicate fine tuning performed by the MAC. The values
  # expected here are small. A value of 2000ps, i.e 2ns, and a phy-mode
  # of 'rgmii' will not be accepted by Reviewers.

That section also says delays not added by the PCB are software
configuration and are not described in DT. If the MAC adds the delay, it
has to remove that delay from the phy-mode it passes to the PHY.

The schema also accepts rgmii-id, rgmii-rxid or rgmii-txid with a 2000 ps
MAC delay. In the driver added later in the series ("net: dsa: lan9645x:
add basic dsa driver for LAN9645X"), nothing seems to remove that delay
again. lan9645x_parse_mac_delay() in lan9645x_port.c sets the flag only
from the DT property:

	*out = val == 2000;

lan9645x_phylink_mac_config() in lan9645x_phylink.c then calls
lan9645x_rgmii_dll_config() for any RGMII mode. That function enables the
DLL delay whenever the flag is set:

	if (phy_interface_mode_is_rgmii(state->interface))
		lan9645x_rgmii_dll_config(p);

Meanwhile phylink passes the unmodified phy-mode to the PHY.

Take port 7 or 8 with an external PHY, phy-mode = "rgmii-id" and
tx-internal-delay-ps = <2000>. Both the MAC and the PHY would add 2 ns,
for about 4 ns of skew. Wouldn't that give a non-working link, even
though the DT passes dt_binding_check?

The if also has no else branch. Non-RGMII ports (gmii, rmii, BASE-X,
QSGMII) therefore accept any uint32 value for rx-internal-delay-ps and
tx-internal-delay-ps.

Could the MAC delay be derived from phy-mode instead of these properties,
with the phy-mode passed to the PHY adjusted to match?

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261015-dsa_lan9645x_switch_driver_base-v15-0-562f316f78b9%40microchip.com

  reply	other threads:[~2026-10-19 10:08 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15  8:05 [PATCH net-next v15 0/9] net: dsa: add DSA support for the LAN9645x switch chip family Jens Emil Schulz Østergaard
2026-10-15  8:05 ` [PATCH net-next v15 1/9] net: dsa: add tag driver for LAN9645X Jens Emil Schulz Østergaard
2026-10-19 10:08   ` netdev-bot+sashiko
2026-10-15  8:05 ` [PATCH net-next v15 2/9] dt-bindings: net: dsa: add Microchip LAN9645x switch Jens Emil Schulz Østergaard
2026-10-19 10:08   ` netdev-bot+sashiko [this message]
2026-10-15  8:05 ` [PATCH net-next v15 3/9] net: dsa: lan9645x: add autogenerated register macros Jens Emil Schulz Østergaard
2026-10-15  8:05 ` [PATCH net-next v15 4/9] net: dsa: lan9645x: add basic dsa driver for LAN9645X Jens Emil Schulz Østergaard
2026-10-19 10:08   ` netdev-bot+sashiko
2026-10-15  8:05 ` [PATCH net-next v15 5/9] net: dsa: lan9645x: add vlan support Jens Emil Schulz Østergaard
2026-10-19 10:08   ` netdev-bot+sashiko
2026-10-15  8:06 ` [PATCH net-next v15 6/9] net: dsa: lan9645x: add mac table integration Jens Emil Schulz Østergaard
2026-10-15  8:06 ` [PATCH net-next v15 7/9] net: dsa: lan9645x: add mdb management Jens Emil Schulz Østergaard
2026-10-19 10:08   ` netdev-bot+sashiko
2026-10-15  8:06 ` [PATCH net-next v15 8/9] net: dsa: lan9645x: add bridge support Jens Emil Schulz Østergaard
2026-10-19 10:08   ` netdev-bot+sashiko
2026-10-15  8:06 ` [PATCH net-next v15 9/9] net: dsa: lan9645x: add port statistics Jens Emil Schulz Østergaard
2026-10-19 10:08   ` netdev-bot+sashiko

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=179240452378.3135.9892080157783163049@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=Steen.Hegelund@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=conor+dt@kernel.org \
    --cc=daniel.machon@microchip.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=horms@kernel.org \
    --cc=jensemil.schulzostergaard@microchip.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=magnus.damm@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=robh@kernel.org \
    --cc=woojung.huh@microchip.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®