Forum Discussion

K606's avatar
K606
Icon for Contributor rankContributor
1 month ago

Agilex 5 EMAC GMII loopthrough: signals are not toggling in Fabric

I am trying to route GMII signals through the Agilex5 HPS to the Fabric.

In the .dts I am using, I have the following settings for the two EMACs:

&gmac0 {
	status = "okay";
	mac-mode = "gmii";
	phy-mode = "gmii"; // must be added, and if no PHY, then add fixed link
	//phy-handle = <&emac0_phy0>;
	max-frame-size = <9000>;
	fixed-link {
	      speed = <1000>;
	      full-duplex;
	};
	mdio0 {
		#address-cells = <1>;
		#size-cells = <0>;
		compatible = "snps,dwmac-mdio";
		emac0_phy0: ethernet-phy@0 {
			reg = <0>;
		};
	};
};

&gmac1 {
	status = "okay";
	mac-mode = "gmii";
	phy-mode = "gmii";
	//phy-handle = <&emac1_phy0>;
	max-frame-size = <9000>;
	fixed-link {
	      speed = <1000>;
	      full-duplex;
	};
	mdio0 {
		#address-cells = <1>;
		#size-cells = <0>;
		compatible = "snps,dwmac-mdio";
		emac1_phy0: ethernet-phy@0 {
			reg = <0>;
		};
	};
};

In the RTL I am connecting the two EMACs as followed:

logic user_clk_pll_125, user_clk_pll_25, user_clk_pll_2_5; // 1G / 100M / 10M
(* noprune *) logic [7:0] tx_dummy_counter;
(* noprune *) logic emac0_mac_tx_clk_o_wire, emac0_mac_tx_clk_i_wire, emac0_mac_rx_clk_wire, emac0_mac_rst_tx_n_wire, emac0_mac_rst_rx_n_wire;
(* noprune *) logic emac0_mac_txen_wire, emac0_mac_txer_wire, emac0_mac_rxdv_wire, emac0_mac_rxer_wire, emac0_mac_col_wire, emac0_mac_crs_wire;
(* noprune *) logic [7:0] emac0_mac_rxd_wire;
(* noprune *) logic [2:0] emac0_mac_speed_wire;
(* noprune *) logic [7:0] emac0_mac_txd_o_wire;
(* noprune *) logic [7:0] rx_dummy_counter;
(* noprune *) logic emac1_mac_tx_clk_o_wire, emac1_mac_tx_clk_i_wire, emac1_mac_rx_clk_wire, emac1_mac_rst_tx_n_wire, emac1_mac_rst_rx_n_wire;
(* noprune *) logic emac1_mac_txen_wire, emac1_mac_txer_wire, emac1_mac_rxdv_wire, emac1_mac_rxer_wire, emac1_mac_col_wire, emac1_mac_crs_wire;
(* noprune *) logic [7:0] emac1_mac_rxd_wire;
(* noprune *) logic [2:0] emac1_mac_speed_wire;
(* noprune *) logic [7:0] emac1_mac_txd_o_wire;
assign emac0_mac_rx_clk_wire = emac1_mac_tx_clk_o_wire; // 1G
assign emac1_mac_rxdv_wire = emac0_mac_txen_wire;
assign emac1_mac_rxer_wire = emac0_mac_txer_wire;
assign emac1_mac_rxd_wire = emac0_mac_txd_o_wire;
assign emac1_mac_col_wire = 1'b0;
assign emac1_mac_crs_wire = 1'b0;
assign emac0_mac_rx_clk_wire = emac0_mac_tx_clk_o_wire; // 1G
assign emac0_mac_rxdv_wire = emac1_mac_txen_wire;
assign emac0_mac_rxer_wire = emac1_mac_txer_wire;
assign emac0_mac_rxd_wire = emac1_mac_txd_o_wire;
assign emac0_mac_col_wire = 1'b0;
assign emac0_mac_crs_wire = 1'b0;

The GMII signals are exported from the Agilex HPS as followed:

When the system boots, the following can be seen is dmesg:

[    1.443647] socfpga-dwmac 10810000.ethernet: Adding to iommu group 0
[    1.450679] socfpga-dwmac 10810000.ethernet: IRQ eth_wake_irq not found
[    1.457291] socfpga-dwmac 10810000.ethernet: IRQ eth_lpi not found
[    1.463542] socfpga-dwmac 10810000.ethernet: RX VLAN HW Stripping
[    1.469741] socfpga-dwmac 10810000.ethernet: SMTG Hub Cross Timestamp supported
[    1.477398] socfpga-dwmac 10810000.ethernet: User ID: 0x76, Synopsys ID: 0x31
[    1.484534] socfpga-dwmac 10810000.ethernet:         XGMAC2
[    1.489489] socfpga-dwmac 10810000.ethernet: DMA HW capability register supported
[    1.496943] socfpga-dwmac 10810000.ethernet: RX Checksum Offload Engine supported
[    1.504396] socfpga-dwmac 10810000.ethernet: COE Type 1
[    1.509603] socfpga-dwmac 10810000.ethernet: TX Checksum insertion supported
[    1.516623] socfpga-dwmac 10810000.ethernet: TSO supported
[    1.522089] socfpga-dwmac 10810000.ethernet: Enable RX Mitigation via HW Watchdog Timer
[    1.530076] socfpga-dwmac 10810000.ethernet: device MAC address 42:ca:f5:1e:55:80
[    1.537533] socfpga-dwmac 10810000.ethernet: Enabled L3L4 Flow TC (entries=16)
[    1.544737] socfpga-dwmac 10810000.ethernet: Enabled RFS Flow TC (entries=10)
[    1.551847] socfpga-dwmac 10810000.ethernet: TSO feature enabled
[    1.557831] socfpga-dwmac 10810000.ethernet: SPH feature enabled
[    1.563815] socfpga-dwmac 10810000.ethernet: TX COE limited to 2 tx queues
[    1.570665] socfpga-dwmac 10810000.ethernet: Using 40/40 bits DMA host/device width
[    1.581335] socfpga-dwmac 10820000.ethernet: Adding to iommu group 1
[    1.588338] socfpga-dwmac 10820000.ethernet: IRQ eth_wake_irq not found
[    1.594945] socfpga-dwmac 10820000.ethernet: IRQ eth_lpi not found
[    1.601179] socfpga-dwmac 10820000.ethernet: RX VLAN HW Stripping
[    1.607380] socfpga-dwmac 10820000.ethernet: SMTG Hub Cross Timestamp supported
[    1.614905] socfpga-dwmac 10820000.ethernet: User ID: 0x76, Synopsys ID: 0x31
[    1.622027] socfpga-dwmac 10820000.ethernet:         XGMAC2
[    1.626982] socfpga-dwmac 10820000.ethernet: DMA HW capability register supported
[    1.634436] socfpga-dwmac 10820000.ethernet: RX Checksum Offload Engine supported
[    1.641890] socfpga-dwmac 10820000.ethernet: COE Type 1
[    1.647097] socfpga-dwmac 10820000.ethernet: TX Checksum insertion supported
[    1.654117] socfpga-dwmac 10820000.ethernet: TSO supported
[    1.659583] socfpga-dwmac 10820000.ethernet: Enable RX Mitigation via HW Watchdog Timer
[    1.667568] socfpga-dwmac 10820000.ethernet: device MAC address 3e:47:0a:4f:7b:96
[    1.675024] socfpga-dwmac 10820000.ethernet: Enabled L3L4 Flow TC (entries=16)
[    1.682221] socfpga-dwmac 10820000.ethernet: Enabled RFS Flow TC (entries=10)
[    1.689330] socfpga-dwmac 10820000.ethernet: TSO feature enabled
[    1.695314] socfpga-dwmac 10820000.ethernet: SPH feature enabled
[    1.701298] socfpga-dwmac 10820000.ethernet: TX COE limited to 2 tx queues
[    1.708147] socfpga-dwmac 10820000.ethernet: Using 40/40 bits DMA host/device width
[    1.718293] socfpga-dwmac 10830000.ethernet: Adding to iommu group 2
[    1.725245] socfpga-dwmac 10830000.ethernet: IRQ eth_wake_irq not found
[    1.731850] socfpga-dwmac 10830000.ethernet: IRQ eth_lpi not found
[    1.738075] socfpga-dwmac 10830000.ethernet: RX VLAN HW Stripping
[    1.744242] socfpga-dwmac 10830000.ethernet: SMTG Hub Cross Timestamp supported
[    1.751730] socfpga-dwmac 10830000.ethernet: User ID: 0x76, Synopsys ID: 0x31
[    1.758854] socfpga-dwmac 10830000.ethernet:         XGMAC2
[    1.763807] socfpga-dwmac 10830000.ethernet: DMA HW capability register supported
[    1.771261] socfpga-dwmac 10830000.ethernet: RX Checksum Offload Engine supported
[    1.778712] socfpga-dwmac 10830000.ethernet: COE Type 1
[    1.783917] socfpga-dwmac 10830000.ethernet: TX Checksum insertion supported
[    1.790936] socfpga-dwmac 10830000.ethernet: TSO supported
[    1.796400] socfpga-dwmac 10830000.ethernet: Enable RX Mitigation via HW Watchdog Timer
[    1.804372] socfpga-dwmac 10830000.ethernet: Enabled L3L4 Flow TC (entries=16)
[    1.811565] socfpga-dwmac 10830000.ethernet: Enabled RFS Flow TC (entries=10)
[    1.818673] socfpga-dwmac 10830000.ethernet: TSO feature enabled
[    1.824656] socfpga-dwmac 10830000.ethernet: SPH feature enabled
[    1.830639] socfpga-dwmac 10830000.ethernet: TX COE limited to 2 tx queues
[    1.837487] socfpga-dwmac 10830000.ethernet: Using 40/40 bits DMA host/device width
...
[   11.730428] socfpga-dwmac 10830000.ethernet eth2: Register MEM_TYPE_PAGE_POOL RxQ-0
[   11.747001] socfpga-dwmac 10830000.ethernet eth2: Register MEM_TYPE_PAGE_POOL RxQ-1
[   11.770275] socfpga-dwmac 10830000.ethernet eth2: Register MEM_TYPE_PAGE_POOL RxQ-2
[   11.778338] socfpga-dwmac 10830000.ethernet eth2: Register MEM_TYPE_PAGE_POOL RxQ-3
[   11.782322] socfpga-dwmac 10830000.ethernet eth2: Register MEM_TYPE_PAGE_POOL RxQ-4
[   11.787412] socfpga-dwmac 10830000.ethernet eth2: Register MEM_TYPE_PAGE_POOL RxQ-5
[   11.790998] socfpga-dwmac 10830000.ethernet eth2: Register MEM_TYPE_PAGE_POOL RxQ-6
[   11.796018] socfpga-dwmac 10830000.ethernet eth2: Register MEM_TYPE_PAGE_POOL RxQ-7
[   11.813781] fpga_manager fpga0: Stratix10 SOC FPGA Manager registered
[   11.913063] socfpga-dwmac 10830000.ethernet eth2: PHY [stmmac-2:01] driver [Micrel KSZ9031 Gigabit PHY] (irq=POLL)
[   11.913393] socfpga-dwmac 10830000.ethernet eth2: No Safety Features support found
[   11.913478] socfpga-dwmac 10830000.ethernet eth2: IEEE 1588-2008 Advanced Timestamp supported
[   12.001908] socfpga-dwmac 10830000.ethernet eth2: registered PTP clock
[   12.007839] socfpga-dwmac 10830000.ethernet eth2: FPE workqueue start
[   12.007940] socfpga-dwmac 10830000.ethernet eth2: configuring for phy/rgmii-id link mode
[   12.155854] socfpga-dwmac 10820000.ethernet eth1: Register MEM_TYPE_PAGE_POOL RxQ-0
[   12.159161] socfpga-dwmac 10820000.ethernet eth1: Register MEM_TYPE_PAGE_POOL RxQ-1
[   12.180998] socfpga-dwmac 10820000.ethernet eth1: Register MEM_TYPE_PAGE_POOL RxQ-2
[   12.191086] socfpga-dwmac 10820000.ethernet eth1: Register MEM_TYPE_PAGE_POOL RxQ-3
[   12.199787] socfpga-dwmac 10820000.ethernet eth1: Register MEM_TYPE_PAGE_POOL RxQ-4
[   12.208205] socfpga-dwmac 10820000.ethernet eth1: Register MEM_TYPE_PAGE_POOL RxQ-5
[   12.218464] socfpga-dwmac 10820000.ethernet eth1: Register MEM_TYPE_PAGE_POOL RxQ-6
[   12.229854] socfpga-dwmac 10820000.ethernet eth1: Register MEM_TYPE_PAGE_POOL RxQ-7
[   12.247722] socfpga-dwmac 10820000.ethernet eth1: No Safety Features support found
[   12.247967] socfpga-dwmac 10820000.ethernet eth1: IEEE 1588-2008 Advanced Timestamp supported
[   12.331440] socfpga-dwmac 10820000.ethernet eth1: registered PTP clock
[   12.332900] socfpga-dwmac 10820000.ethernet eth1: FPE workqueue start
[   12.332987] socfpga-dwmac 10820000.ethernet eth1: configuring for fixed/gmii link mode
[   12.343803] socfpga-dwmac 10820000.ethernet eth1: Link is Up - 100Mbps/Full - flow control off
[   12.344209] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
[   12.449807] of-fpga-region soc:base_fpga_region: FPGA Region probed
[   12.469882] socfpga-dwmac 10810000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0
[   12.479649] socfpga-dwmac 10810000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-1
[   12.482568] socfpga-dwmac 10810000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-2
[   12.490255] socfpga-dwmac 10810000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-3
[   12.493314] socfpga-dwmac 10810000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-4
[   12.501735] socfpga-dwmac 10810000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-5
[   12.514200] socfpga-dwmac 10810000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-6
[   12.536765] socfpga-dwmac 10810000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-7
[   12.582718] socfpga-dwmac 10810000.ethernet eth0: No Safety Features support found
[   12.583005] socfpga-dwmac 10810000.ethernet eth0: IEEE 1588-2008 Advanced Timestamp supported
[   12.591157] socfpga-dwmac 10810000.ethernet eth0: registered PTP clock
[   12.601012] socfpga-dwmac 10810000.ethernet eth0: FPE workqueue start
[   12.601201] socfpga-dwmac 10810000.ethernet eth0: configuring for fixed/gmii link mode
[   12.611650] socfpga-dwmac 10810000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off
[   12.615095] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
...

(this log was from testing 100M, but the same occurs for 1G)

In signal tap, no wires are toggled (even though it seems the output clocks are fine)

Please help!

10 Replies

  • Hello K606​ ,

    You may have a typo for the rx clock.

    Could you please try this?

    assign emac1_mac_rx_clk_wire = emac0_mac_tx_clk_o_wire; // 1G

    Thank you.

    • K606's avatar
      K606
      Icon for Contributor rankContributor

      Hi - so I changed this line. However, it seems the issue persists.

      Do you know why this might be?

      Please also note that the SoC system clocks are confirgured as followed:

      root@localhost:~# cat /sys/kernel/debug/clk/clk_summary
                                       enable  prepare  protect                                duty  hardware
         clock                          count    count    count        rate   accuracy phase  cycle    enable
      -------------------------------------------------------------------------------------------------------
       qspi-clk                             1        1        0   200000000          0     0  50000         Y
       osc1                                 2        2        0    25000000          0     0  50000         Y
          periph_pll                        1        1        0  2500000000          0     0  50000         Y
             peri_pll_c3                    1        1        0   500000000          0     0  50000         Y
                psi_ref_free_clk            0        0        0   500000000          0     0  50000         Y
                   psi_ref_clk              0        0        0   500000000          0     0  50000         Y
                s2f_user1_free_clk          0        0        0   500000000          0     0  50000         Y
                   s2f_user1_clk            0        0        0   500000000          0     0  50000         Y
                s2f_user0_free_clk          0        0        0   500000000          0     0  50000         Y
                   s2f_user0_clk            0        0        0   500000000          0     0  50000         Y
                emaca_free_clk              3        3        0   250000000          0     0  50000         Y
                   emac2_clk                1        1        0   250000000          0     0  50000         Y
                   emac1_clk                1        1        0   250000000          0     0  50000         Y
                   emac0_clk                1        1        0   250000000          0     0  50000         Y

      So it seems the clocks are active, but when sending a 'ping' from EMAC0 to EMAC1 - there is no activity on the GMII lines in Fabric (even though it seems the ping is working in userland in the HPS)

      root@localhost:~# sudo ip addr add 192.168.70.5/24 dev eth0
      root@localhost:~# sudo ip addr add 192.168.70.1/24 dev eth1
      root@localhost:~# ifconfig
      eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
              inet 192.168.70.5  netmask 255.255.255.0  broadcast 0.0.0.0
              ether 3e:17:2e:db:8b:f6  txqueuelen 1000  (Ethernet)
              RX packets 60  bytes 19080 (19.0 KB)
              RX errors 0  dropped 0  overruns 0  frame 0
              TX packets 168  bytes 27408 (27.4 KB)
              TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
              device interrupt 23  
      
      eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
              inet 192.168.70.1  netmask 255.255.255.0  broadcast 0.0.0.0
              ether 62:6f:4c:21:f2:f4  txqueuelen 1000  (Ethernet)
              RX packets 59  bytes 18762 (18.7 KB)
              RX errors 0  dropped 0  overruns 0  frame 0
              TX packets 170  bytes 27588 (27.5 KB)
              TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
              device interrupt 40  
      ...
      
      root@localhost:~# ping -I 192.168.70.1 192.168.70.5
      PING 192.168.70.5 (192.168.70.5) from 192.168.70.1 : 56(84) bytes of data.
      64 bytes from 192.168.70.5: icmp_seq=1 ttl=64 time=0.189 ms
      64 bytes from 192.168.70.5: icmp_seq=2 ttl=64 time=0.034 ms
      64 bytes from 192.168.70.5: icmp_seq=3 ttl=64 time=0.168 ms
      64 bytes from 192.168.70.5: icmp_seq=4 ttl=64 time=0.042 ms
      64 bytes from 192.168.70.5: icmp_seq=5 ttl=64 time=0.022 ms
      64 bytes from 192.168.70.5: icmp_seq=6 ttl=64 time=0.009 ms
      64 bytes from 192.168.70.5: icmp_seq=7 ttl=64 time=0.029 ms
      64 bytes from 192.168.70.5: icmp_seq=8 ttl=64 time=0.020 ms
      64 bytes from 192.168.70.5: icmp_seq=9 ttl=64 time=0.009 ms
      64 bytes from 192.168.70.5: icmp_seq=10 ttl=64 time=0.034 ms
      64 bytes from 192.168.70.5: icmp_seq=11 ttl=64 time=0.014 ms
      64 bytes from 192.168.70.5: icmp_seq=12 ttl=64 time=0.012 ms
      64 bytes from 192.168.70.5: icmp_seq=13 ttl=64 time=0.052 ms
      64 bytes from 192.168.70.5: icmp_seq=14 ttl=64 time=0.025 ms
      64 bytes from 192.168.70.5: icmp_seq=15 ttl=64 time=0.019 ms
      ^C
      --- 192.168.70.5 ping statistics ---
      15 packets transmitted, 15 received, 0% packet loss, time 14335ms
      • ShunJingG_Altera's avatar
        ShunJingG_Altera
        Icon for New Contributor rankNew Contributor

        hello,

        thank you for the feedback.

        May i know if ping is working before the change?

        May i know what is the sampling clock for your signal tap?
        For 1G speed you may need at least 250MHz sampling clock.