Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'follow-up-to-rgmii-mode-clarification-am65-cpsw-fix-checkpatch'

Matthias Schiffer says:

====================
Follow-up to RGMII mode clarification: am65-cpsw fix + checkpatch

Following previous discussion [1] and the documentation update by
Andrew [2]:

Fix up the mode to account for the fixed TX delay on the AM65 CPSW
Ethernet controllers, similar to the way the icssg-prueth does it. For
backwards compatibility, the "impossible" modes that claim to have a
delay on the PCB are still accepted, but trigger a warning message.

As Andrew suggested, I have also added a checkpatch check that requires
a comment for any RGMII mode that is not "rgmii-id".

No Device Trees are updated to avoid the warning for now, to give other
projects syncing the Linux Device Trees some time to fix their drivers
as well. I intend to submit an equivalent change for U-Boot's
am65-cpsw-nuss driver as soon as the changes are accepted for Linux.

[1] https://lore.kernel.org/lkml/d25b1447-c28b-4998-b238-92672434dc28@lunn.ch/
[2] https://lore.kernel.org/all/20250430-v6-15-rc3-net-rgmii-delays-v2-1-099ae651d5e5@lunn.ch/
commit c360eb0c3ccb ("dt-bindings: net: ethernet-controller: Add informative text about RGMII delays")
v1: https://lore.kernel.org/all/cover.1744710099.git.matthias.schiffer@ew.tq-group.com/
====================

Link: https://patch.msgid.link/cover.1750756583.git.matthias.schiffer@ew.tq-group.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

+47 -3
+9
Documentation/dev-tools/checkpatch.rst
··· 495 495 496 496 See: https://lore.kernel.org/lkml/20131006222342.GT19510@leaf/ 497 497 498 + **UNCOMMENTED_RGMII_MODE** 499 + Historically, the RGMII PHY modes specified in Device Trees have been 500 + used inconsistently, often referring to the usage of delays on the PHY 501 + side rather than describing the board. 502 + 503 + PHY modes "rgmii", "rgmii-rxid" and "rgmii-txid" modes require the clock 504 + signal to be delayed on the PCB; this unusual configuration should be 505 + described in a comment. If they are not (meaning that the delay is realized 506 + internally in the MAC or PHY), "rgmii-id" is the correct PHY mode. 498 507 499 508 Commit message 500 509 --------------
+1 -1
Documentation/devicetree/bindings/net/ti,k3-am654-cpsw-nuss.yaml
··· 284 284 ti,syscon-efuse = <&mcu_conf 0x200>; 285 285 phys = <&phy_gmii_sel 1>; 286 286 287 - phy-mode = "rgmii-rxid"; 287 + phy-mode = "rgmii-id"; 288 288 phy-handle = <&phy0>; 289 289 }; 290 290 };
+25 -2
drivers/net/ethernet/ti/am65-cpsw-nuss.c
··· 2602 2602 return -ENOENT; 2603 2603 2604 2604 for_each_child_of_node(node, port_np) { 2605 + phy_interface_t phy_if; 2605 2606 struct am65_cpsw_port *port; 2606 2607 u32 port_id; 2607 2608 ··· 2668 2667 2669 2668 /* get phy/link info */ 2670 2669 port->slave.port_np = of_node_get(port_np); 2671 - ret = of_get_phy_mode(port_np, &port->slave.phy_if); 2670 + ret = of_get_phy_mode(port_np, &phy_if); 2672 2671 if (ret) { 2673 2672 dev_err(dev, "%pOF read phy-mode err %d\n", 2674 2673 port_np, ret); 2675 2674 goto of_node_put; 2676 2675 } 2677 2676 2678 - ret = phy_set_mode_ext(port->slave.ifphy, PHY_MODE_ETHERNET, port->slave.phy_if); 2677 + /* CPSW controllers supported by this driver have a fixed 2678 + * internal TX delay in RGMII mode. Fix up PHY mode to account 2679 + * for this and warn about Device Trees that claim to have a TX 2680 + * delay on the PCB. 2681 + */ 2682 + switch (phy_if) { 2683 + case PHY_INTERFACE_MODE_RGMII_ID: 2684 + phy_if = PHY_INTERFACE_MODE_RGMII_RXID; 2685 + break; 2686 + case PHY_INTERFACE_MODE_RGMII_TXID: 2687 + phy_if = PHY_INTERFACE_MODE_RGMII; 2688 + break; 2689 + case PHY_INTERFACE_MODE_RGMII: 2690 + case PHY_INTERFACE_MODE_RGMII_RXID: 2691 + dev_warn(dev, 2692 + "RGMII mode without internal TX delay unsupported; please fix your Device Tree\n"); 2693 + break; 2694 + default: 2695 + break; 2696 + } 2697 + 2698 + port->slave.phy_if = phy_if; 2699 + ret = phy_set_mode_ext(port->slave.ifphy, PHY_MODE_ETHERNET, phy_if); 2679 2700 if (ret) 2680 2701 goto of_node_put; 2681 2702
+12
scripts/checkpatch.pl
··· 3741 3741 } 3742 3742 } 3743 3743 3744 + # Check for RGMII phy-mode with delay on PCB 3745 + if ($realfile =~ /\.(dts|dtsi|dtso)$/ && 3746 + $line =~ /^\+\s*(phy-mode|phy-connection-type)\s*=\s*"/ && 3747 + !ctx_has_comment($first_line, $linenr)) { 3748 + my $prop = $1; 3749 + my $mode = get_quoted_string($line, $rawline); 3750 + if ($mode =~ /^"rgmii(?:|-rxid|-txid)"$/) { 3751 + WARN("UNCOMMENTED_RGMII_MODE", 3752 + "$prop $mode without comment -- delays on the PCB should be described, otherwise use \"rgmii-id\"\n" . $herecurr); 3753 + } 3754 + } 3755 + 3744 3756 # check for using SPDX license tag at beginning of files 3745 3757 if ($realline == $checklicenseline) { 3746 3758 if ($rawline =~ /^[ \+]\s*\#\!\s*\//) {