AM4378: Ethernet phy not working during 6.1 migration with updated dts.

Part Number: AM4378

Tool/software:

We are working on am437x based custom board, Migrating from 4.19 to 6.1 kernel.  I updated the dts changes specific to ethernet & cpsw switch taking am437x-sk dts as reference.

After updating my dts ethernet phy's are not working. 

dmesg gives error messages.

root@picv6-1:~# dmesg | grep "cpsw"
[ 3.391245] cpsw-switch 4a100000.switch: /ocp@44000000/interconnect@4a000000/segment@0/target-module@100000/switch@0/ethernet-ports/port@1 read phy-mode err -19
root@picv6-1:~#
root@picv6-1:~# dmesg | grep "mdio"
[ 3.363963] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6, bus freq 1000000
[ 3.374624] davinci_mdio 4a101000.mdio: phy[0]: device 4a101000.mdio:00, driver unknown
[ 3.382696] davinci_mdio 4a101000.mdio: phy[1]: device 4a101000.mdio:01, driver unknown

Updated dts ethernet nodes with 6.1 kernel.

&mac_sw {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&cpsw_default>;
pinctrl-1 = <&cpsw_sleep>;
status = "okay";
};

&davinci_mdio_sw {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&davinci_mdio_default>;
pinctrl-1 = <&davinci_mdio_sleep>;

ethphy0: ethernet-phy@0 {
reg = <0>;
};

ethphy1: ethernet-phy@1 {
reg = <1>;
};
};

&cpsw_port1 {
phy-handle = <&ethphy0>;
phy-mode = "rmii-rxid";
ti,dual-emac-pvid = <1>;
};

&cpsw_port2 {
phy-handle = <&ethphy1>;
phy-mode = "rmii-rxid";
ti,dual-emac-pvid = <2>;
};

please review my changes and let me know if i miss anything.

  • The query has been assigned to the expert. Please expect a response within a day or two.

    Thanks!

  • Hi,

    Since you are changing kernel versions there a few things causing the issue.

    - Are the PHYs in use compiled into the 6.1 kernel? Were the PHY drivers configured in the kernel config?

    - Are you able to connect to one interface at a time get a link up and able to ping another device?

    - If the PHYs are in RMII mode I don't believe rmii-rxid is a valid selection. I suggest trying rmii.

    The DTS looks comparable to the example that TI provides for the AM437x SK EVM. 

    Best Regards,

    Schuyler

  • Hi Schuyler,

    As suggested changed "phy-mode" to rmii instead of rmii-rxid.  with this phy detected as Generic PHY driver.(i.e same in 4.19 kernel also) 

    I can see the Link state change when i connect ethernet cable and interfaces are visible with ifconfig.  

    But packets are not going out.  tx count incretments & rx count is zero.

    Any other areas i need to look further.

    Regards,

    Siva.

  • Hi Schuyler,

    Here is the Logs output after changing phy mode. 

    dmesg | grep "cpsw"
    [ 3.361711] cpsw-switch 4a100000.switch: initialized cpsw ale version 1.4
    [ 3.368616] cpsw-switch 4a100000.switch: ALE Table size 1024
    [ 3.374470] cpsw-switch 4a100000.switch: cpts: overflow check period 500 (jiffies)
    [ 3.382088] cpsw-switch 4a100000.switch: CPTS: ref_clk_freq:250000000 calc_mult:2147483648 calc_shift:29 error:0 nsec/sec
    [ 3.393233] cpsw-switch 4a100000.switch: Detected MACID = 64:8c:bb:d2:5b:51
    [ 3.400317] cpsw-switch 4a100000.switch: Detected MACID = 64:8c:bb:d2:5b:53
    [ 3.410043] cpsw-switch 4a100000.switch: initialized (regs 0x4a100000, pool size 256) hw_ver:0019010F 1.15 (0)
    [ 12.384382] cpsw-switch 4a100000.switch: starting ndev. mode: dual_mac
    [ 12.455661] cpsw-switch 4a100000.switch: starting ndev. mode: dual_mac
    [ 213.365334] cpsw-switch 4a100000.switch eth1: Link is Up - 10Mbps/Full - flow control off
    [ 724.005509] cpsw-switch 4a100000.switch eth1: Link is Down
    [ 729.205596] cpsw-switch 4a100000.switch eth1: Link is Up - 10Mbps/Full - flow control off
    root@picv6-1:~#
    root@picv6-1:~# dmesg | grep "mdio"
    [ 3.333971] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6, bus freq 1000000
    [ 3.344636] davinci_mdio 4a101000.mdio: phy[0]: device 4a101000.mdio:00, driver unknown
    [ 3.352706] davinci_mdio 4a101000.mdio: phy[1]: device 4a101000.mdio:01, driver unknown
    [ 12.418931] Generic PHY 4a101000.mdio:01: attached PHY driver (mii_bus:phy_addr=4a101000.mdio:01, irq=POLL)
    [ 12.480557] Generic PHY 4a101000.mdio:00: attached PHY driver (mii_bus:phy_addr=4a101000.mdio:00, irq=POLL)

    Regards,

    Siva.

  • Hi,

    That is a low bit rate, which PHYs are you using? 

    Also could you please post the results of ethtool eth0 and ethtool eth1 as well ethtool -S eth0 and ethtool -S eth1?

    Best Regards,

    Schuyler

  • LAN8740AI-EN-TR is the ethernet phy used on the board.

    Here is the output of ethtool command for eth0 & eth1 interface. Ethernet cable connected eth0.

    root@picv6-1:~# ethtool eth0
    Settings for eth0:
    Supported ports: [ TP MII ]
    Supported link modes: 10baseT/Half 10baseT/Full
    Supported pause frame use: Symmetric Receive-only
    Supports auto-negotiation: Yes
    Supported FEC modes: Not reported
    Advertised link modes: 10baseT/Half 10baseT/Full
    Advertised pause frame use: No
    Advertised auto-negotiation: Yes
    Advertised FEC modes: Not reported
    Speed: Unknown!
    Duplex: Unknown! (255)
    Auto-negotiation: on
    Port: MII
    PHYAD: 0
    Transceiver: external
    Supports Wake-on: d
    Wake-on: d
    Current message level: 0x00000000 (0)

    Link detected: no
    root@picv6-1:~# ethtool eth1
    Settings for eth1:
    Supported ports: [ TP MII ]
    Supported link modes: 10baseT/Half 10baseT/Full
    Supported pause frame use: Symmetric Receive-only
    Supports auto-negotiation: Yes
    Supported FEC modes: Not reported
    Advertised link modes: 10baseT/Half 10baseT/Full
    Advertised pause frame use: No
    Advertised auto-negotiation: Yes
    Advertised FEC modes: Not reported
    Speed: Unknown!
    Duplex: Unknown! (255)
    Auto-negotiation: on
    Port: MII
    PHYAD: 1
    Transceiver: external
    Supports Wake-on: d
    Wake-on: d
    Current message level: 0x00000000 (0)

    Link detected: no
    root@picv6-1:~#
    root@picv6-1:~# ethtool -S eth0
    NIC statistics:
    Good Rx Frames: 0
    Broadcast Rx Frames: 0
    Multicast Rx Frames: 0
    Pause Rx Frames: 0
    Rx CRC Errors: 0
    Rx Align/Code Errors: 0
    Oversize Rx Frames: 0
    Rx Jabbers: 0
    Undersize (Short) Rx Frames: 0
    Rx Fragments: 0
    Rx Octets: 0
    Good Tx Frames: 0
    Broadcast Tx Frames: 0
    Multicast Tx Frames: 0
    Pause Tx Frames: 0
    Deferred Tx Frames: 0
    Collisions: 0
    Single Collision Tx Frames: 0
    Multiple Collision Tx Frames: 0
    Excessive Collisions: 0
    Late Collisions: 0
    Tx Underrun: 0
    Carrier Sense Errors: 0
    Tx Octets: 0
    Rx + Tx 64 Octet Frames: 0
    Rx + Tx 65-127 Octet Frames: 0
    Rx + Tx 128-255 Octet Frames: 0
    Rx + Tx 256-511 Octet Frames: 0
    Rx + Tx 512-1023 Octet Frames: 0
    Rx + Tx 1024-Up Octet Frames: 0
    Net Octets: 0
    Rx Start of Frame Overruns: 0
    Rx Middle of Frame Overruns: 0
    Rx DMA Overruns: 0
    Rx DMA chan 0: head_enqueue: 1
    Rx DMA chan 0: tail_enqueue: 127
    Rx DMA chan 0: pad_enqueue: 0
    Rx DMA chan 0: misqueued: 0
    Rx DMA chan 0: desc_alloc_fail: 0
    Rx DMA chan 0: pad_alloc_fail: 0
    Rx DMA chan 0: runt_receive_buf: 0
    Rx DMA chan 0: runt_transmit_bu: 0
    Rx DMA chan 0: empty_dequeue: 0
    Rx DMA chan 0: busy_dequeue: 0
    Rx DMA chan 0: good_dequeue: 0
    Rx DMA chan 0: requeue: 0
    Rx DMA chan 0: teardown_dequeue: 0
    Tx DMA chan 0: head_enqueue: 0
    Tx DMA chan 0: tail_enqueue: 0
    Tx DMA chan 0: pad_enqueue: 0
    Tx DMA chan 0: misqueued: 0
    Tx DMA chan 0: desc_alloc_fail: 0
    Tx DMA chan 0: pad_alloc_fail: 0
    Tx DMA chan 0: runt_receive_buf: 0
    Tx DMA chan 0: runt_transmit_bu: 0
    Tx DMA chan 0: empty_dequeue: 0
    Tx DMA chan 0: busy_dequeue: 0
    Tx DMA chan 0: good_dequeue: 0
    Tx DMA chan 0: requeue: 0
    Tx DMA chan 0: teardown_dequeue: 0
    root@picv6-1:~#
    root@picv6-1:~#
    root@picv6-1:~# ethtool -S eth1
    NIC statistics:
    Good Rx Frames: 0
    Broadcast Rx Frames: 0
    Multicast Rx Frames: 0
    Pause Rx Frames: 0
    Rx CRC Errors: 0
    Rx Align/Code Errors: 0
    Oversize Rx Frames: 0
    Rx Jabbers: 0
    Undersize (Short) Rx Frames: 0
    Rx Fragments: 0
    Rx Octets: 0
    Good Tx Frames: 0
    Broadcast Tx Frames: 0
    Multicast Tx Frames: 0
    Pause Tx Frames: 0
    Deferred Tx Frames: 0
    Collisions: 0
    Single Collision Tx Frames: 0
    Multiple Collision Tx Frames: 0
    Excessive Collisions: 0
    Late Collisions: 0
    Tx Underrun: 0
    Carrier Sense Errors: 0
    Tx Octets: 0
    Rx + Tx 64 Octet Frames: 0
    Rx + Tx 65-127 Octet Frames: 0
    Rx + Tx 128-255 Octet Frames: 0
    Rx + Tx 256-511 Octet Frames: 0
    Rx + Tx 512-1023 Octet Frames: 0
    Rx + Tx 1024-Up Octet Frames: 0
    Net Octets: 0
    Rx Start of Frame Overruns: 0
    Rx Middle of Frame Overruns: 0
    Rx DMA Overruns: 0
    Rx DMA chan 0: head_enqueue: 1
    Rx DMA chan 0: tail_enqueue: 127
    Rx DMA chan 0: pad_enqueue: 0
    Rx DMA chan 0: misqueued: 0
    Rx DMA chan 0: desc_alloc_fail: 0
    Rx DMA chan 0: pad_alloc_fail: 0
    Rx DMA chan 0: runt_receive_buf: 0
    Rx DMA chan 0: runt_transmit_bu: 0
    Rx DMA chan 0: empty_dequeue: 0
    Rx DMA chan 0: busy_dequeue: 0
    Rx DMA chan 0: good_dequeue: 0
    Rx DMA chan 0: requeue: 0
    Rx DMA chan 0: teardown_dequeue: 0
    Tx DMA chan 0: head_enqueue: 0
    Tx DMA chan 0: tail_enqueue: 0
    Tx DMA chan 0: pad_enqueue: 0
    Tx DMA chan 0: misqueued: 0
    Tx DMA chan 0: desc_alloc_fail: 0
    Tx DMA chan 0: pad_alloc_fail: 0
    Tx DMA chan 0: runt_receive_buf: 0
    Tx DMA chan 0: runt_transmit_bu: 0
    Tx DMA chan 0: empty_dequeue: 0
    Tx DMA chan 0: busy_dequeue: 0
    Tx DMA chan 0: good_dequeue: 0
    Tx DMA chan 0: requeue: 0
    Tx DMA chan 0: teardown_dequeue: 0

  • Hi,

    Is this PHY configured to be built in the kernel configuration?

    Based on the ethtool results, is each PHY configured only for 10Mbps half and full Duplex? I am looking to see if the ethtool output matches what the PHY is configured for.

    Could you please attach the full boot log (not cut and paste, use the insert file option when posting).  Also please attach the .config file from the kernel build.

    Best Regards,

    Schuyler

  • pic6Ethernet.txt
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    root@picv6-1:~# dmesg
    [ 0.000000] Booting Linux on physical CPU 0x0
    [ 0.000000] Linux version 6.1.33-g40c32565ca (oe-user@oe-host) (arm-poky-linux-gnueabi-gcc (GCC) 11.5.0, GNU ld (GNU Binutils) 2.38.20220708) #1 SMP Thu Jul 6 14:17:24 UTC 2023
    [ 0.000000] CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c5387d
    [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
    [ 0.000000] OF: fdt: Machine model: TI AM437x PIC6.1 Default 19-07-2024
    [ 0.000000] Memory policy: Data cache writeback
    [ 0.000000] efi: UEFI not found.
    [ 0.000000] cma: Reserved 64 MiB at 0x9c000000
    [ 0.000000] Zone ranges:
    [ 0.000000] Normal [mem 0x0000000080000000-0x000000009fffffff]
    [ 0.000000] HighMem empty
    [ 0.000000] Movable zone start for each node
    [ 0.000000] Early memory node ranges
    [ 0.000000] node 0: [mem 0x0000000080000000-0x000000009fffffff]
    [ 0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x000000009fffffff]
    [ 0.000000] CPU: All CPU(s) started in SVC mode.
    [ 0.000000] AM437x ES1.2 (sgx neon)
    [ 0.000000] percpu: Embedded 12 pages/cpu s17364 r8192 d23596 u49152
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
                                                       

    please find the dmesg output.

  • Hi,

    The PHYs are communicating with the, otherwise there would not be a link up or link down. The changing is that due to the cable being plugged or un-plugged.

    - are the PHYs only configured to operate at 10Mbps?

    - is the PHY driver built into the kernel or as a module, please a section of the kernel config (typically stored as .config in the kernel source directory)

    -  these message is something that probably needs investigating. They appear to indicate the gpios used to reset the PHY are accessible.

    [ 3.344716] of_get_named_gpiod_flags: can't parse 'reset-gpios' property of node '/ocp@44000000/interconnect@4a000000/segment@0/target-module@100000/switch@0/mdio@1000/ethernet-phy@1[0]'
    [ 3.344774] of_get_named_gpiod_flags: can't parse 'reset-gpio' property of node '/ocp@44000000/interconnect@4a000000/segment@0/target-module@100000/switch@0/mdio@1000/ethernet-phy@1[0]'

    Best Regards,

    Schuyler 

  • Hi Schuyler

    - are the PHYs only configured to operate at 10Mbps?

    Not sure, ethernet cable is connected to wifi router LAN.

    - is the PHY driver built into the kernel or as a module, please a section of the kernel config (typically stored as .config in the kernel source directory)

    PHY driver built as a part of kernel.  Please find the .config generated for am437x based custom board.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    #
    # Automatically generated file; DO NOT EDIT.
    # Linux/arm 6.1.33 Kernel Configuration
    #
    CONFIG_CC_VERSION_TEXT="arm-poky-linux-gnueabi-gcc (GCC) 11.5.0"
    CONFIG_CC_IS_GCC=y
    CONFIG_GCC_VERSION=110500
    CONFIG_CLANG_VERSION=0
    CONFIG_AS_IS_GNU=y
    CONFIG_AS_VERSION=20244508
    CONFIG_LD_IS_BFD=y
    CONFIG_LD_VERSION=20244508
    CONFIG_LLD_VERSION=0
    CONFIG_CC_HAS_ASM_GOTO_OUTPUT=y
    CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT=y
    CONFIG_CC_HAS_ASM_INLINE=y
    CONFIG_CC_HAS_NO_PROFILE_FN_ATTR=y
    CONFIG_PAHOLE_VERSION=0
    CONFIG_IRQ_WORK=y
    CONFIG_BUILDTIME_TABLE_SORT=y
    CONFIG_THREAD_INFO_IN_TASK=y
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    -  these message is something that probably needs investigating. They appear to indicate the gpios used to reset the PHY are accessible.

    reset-gpio are not used as per schematic.

    As per 4.19 kernel dts. these nodes are not moved to in 6.1 kernel, as i take am437x-sk dts as reference.

    &mac {
    //slaves = <1>;
    //pinctrl-names = "default", "sleep";
    pinctrl-names = "default";
    pinctrl-0 = <&cpsw1_default>, <&cpsw2_default>;
    //pinctrl-1 = <&cpsw_sleep>;
    dual_emac = <1>;

    status = "okay";
    };


    &phy_sel {
    rmii-clock-ext = <1>;
    };

    &elm {
    status = "okay";
    };

    Regards,

    Siva.

  • when i run udhcpc -i eth1, i can see link going up nd down.

    udhcpc: broadcasting discover
    udhcpc: broadcasting discover
    udhcpc: broadcasting discover
    [ 471.924955] cpsw-switch 4a100000.switch eth1: Link is Up - 10Mbps/Full - flow control off
    13:33:06.846753 IP6 fe80::ba94:d9ff:fec7:4b19 > ff02::16: HBH ICMP6, multicast listener report v2, 1 group record(s), length 28
    13:33:07.776749 IP6 fe80::ba94:d9ff:fec7:4b19 > ff02::16: HBH ICMP6, multicast listener report v2, 1 group record(s), length 28
    [ 472.965454] cpsw-switch 4a100000.switch eth1: Link is Down
    udhcpc: broadcasting discover
    udhcpc: broadcasting discover
    udhcpc: broadcasting discover
    [ 501.045003] cpsw-switch 4a100000.switch eth1: Link is Up - 10Mbps/Full - flow control off
    13:33:35.966709 IP6 fe80::ba94:d9ff:fec7:4b19 > ff02::16: HBH ICMP6, multicast listener report v2, 1 group record(s), length 28
    13:33:36.356729 IP6 fe80::ba94:d9ff:fec7:4b19 > ff02::16: HBH ICMP6, multicast listener report v2, 1 group record(s), length 28
    udhcpc: broadcasting discover
    13:33:58.206756 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from b8:94:d9:c7:4b:19 (oui Unknown), length 300
    [ 523.925456] cpsw-switch 4a100000.switch eth1: Link is Down
    udhcpc: broadcasting discover
    udhcpc: broadcasting discover
    [ 533.284965] cpsw-switch 4a100000.switch eth1: Link is Up - 10Mbps/Full - flow control off
    13:34:08.206758 IP6 fe80::ba94:d9ff:fec7:4b19 > ff02::16: HBH ICMP6, multicast listener report v2, 1 group record(s), length 28
    13:34:08.896733 IP6 fe80::ba94:d9ff:fec7:4b19 > ff02::16: HBH ICMP6, multicast listener report v2, 1 group record(s), length 28
    [ 534.325445] cpsw-switch 4a100000.switch eth1: Link is Down