This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SK-AM69: J721EXENETXPANEVM on-board clock generator problem

Part Number: SK-AM69
Other Parts Discussed in Thread: J721EXENETXPANEVM, , AM69

Tool/software:

Hello,

we want to use the J721EXENETXPANEVM Quad ETH expansion card with our SK-AM69 dev kit. We know this combination is not yet suppored, but according to another thread it should not be a big problem. Detailed schematic can be found here.

Because the SK-AM69 does not have a clock generator, we want to use the one on the Quad ETH expansion card (part U4). Resistors R26 and R27 are removed, resistors R23 and D24 are soldered (as jumpers). The CDCI_I2C_SEL signal is set to '1' when Linux boots. And now the problems:

  1. The clock generator has an I2C address of 0x76, which is different from the schematic. It appears that the last bit of the address in EEPROM Page 1 is factory programmed by TI to '0'. Is that correct?
  2. I2C communication does not work at startup (bus errors). We have to manually reset the clock generator with pin 8 (RESET/SYNC). It is odd, because in the schematic it is permanently connected to '1' via a pull-up resistor and is not controlled, so a reset does not seem to be necessary. Can you clarify this behavior?
  3. After manual reset registers can be read/write wtihout problem. However, there is no signal on the clock outputs. List of all registers are listed on the end. All registers are loaded from the EEPROM, we do not write anything yet. Flag 'nvmbusy' in register STATUS1 is suspicious.

Can you try to reproduce this behavior in your setup or give me some tips what is wrong with our setup?

And one more question. AM69 SERDES2 REFCLK is connected to the Quad Eth expansion card by default. Can we use REFCLK as a clock source for the PHY on the expansion card if the option with the clock generator fails?

R70     0x00460000
R69     0x00450000
R68     0x00440000
R67     0x00430020
R66     0x00420000
R65     0x00410F34
R64     0x0040000D
R63     0x003F0210
R62     0x003E4210
R61     0x003D1000
R60     0x003C0010
R59     0x003B0009
R58     0x003A0008
R57     0x00390A65
R56     0x00380405
R55     0x00370004
R54     0x00360000
R53     0x00358000
R52     0x00340008
R51     0x00330A65
R50     0x00320405
R49     0x00310004
R48     0x00300000
R47     0x002F8000
R46     0x002E0008
R45     0x002D0A65
R44     0x002C0405
R43     0x002B0004
R42     0x002A0000
R41     0x00298000
R40     0x00280008
R39     0x00270A65
R38     0x00260405
R37     0x00250004
R36     0x00240000
R35     0x00238000
R34     0x00220050
R33     0x00210007
R32     0x00200000
R31     0x001F1E72
R30     0x001E5140
R29     0x001D400A
R28     0x001C0000
R27     0x001B0000
R26     0x001A0718
R25     0x001902C2
R24     0x00180601
R23     0x00170593
R22     0x00160800
R21     0x00150000
R20     0x00140001
R19     0x00130000
R18     0x0012400A
R17     0x001126C4
R16     0x0010921F
R15     0x000FA037
R14     0x000E0000
R13     0x000D0000
R12     0x000C0000
R11     0x000B0000
R10     0x000A0000
R9      0x00090000
R8      0x00080001
R7      0x00070E10
R6      0x000619CA
R5      0x00050028
R4      0x00040055
R3      0x00030000
R2      0x00020053
R1      0x00016882
R0      0x00000000

  • You are attempting to use a unsupported (and likely untested) configuration.  Regarding the SERDES REFCLK output...yes you should be able to program it to drive the desired frequency for the Ethernet PHY.  Have you tried this?  If this works, then no modifications are needed on the add-on board.  I see the SK-AM69 has the 50-ohm termination resistors on the REFCLK pins, thus this interface is configurated to DRIVE a clock.

    I have requested information on the CDCI device - to see if any custom updates have been done to EERPOM.  I'll hopefully have response in day or so. 

  • I haven't tried the REFCLK approach because I don't know how to configure it yet. However, in the TRM (Figure 12-125 and Figure 12-126), SERDES_REFCLK is shown as an input only. Is the error in the SK-AM69 scheme or in the TRM?

  • Sorry for the delay.  Yes - SERDES_REFCLK can be configured as outputs.  I think the diagram doesn't show because we want customers using the PCIe dedicated outputs for those clocks.  Hopefully I'll have response on on-board CLKGEN questions early next week.

  • The EVM team has verified access to the CDCI clock generator on the QUAD ethernet board.  They successfully accessed and read the CDCI devices on the ENET board at I2C address 0x77. However, the I2C detection is only picking up address 0x76. By default, access is limited to 0x76. To access 0x77, need to set the 15th bit of the generic0 register to HIGH. Additionally, observed that a register dump is only possible for 0x76 when page0 is selected from the hardware strap. 

  • Ok, it was a struggle, but finally the ENET board works. As a final solution, we use REFCLK directly from SERDES2. Here are the modifications that need to be made:

    1. Replace resistors R26 and R27 with 100 nF capacitors on the ENET board.

    In the debugging process we thought there was a problem with REFCLK. We have seen capacitors on the CDCI line, but not on this direct line from SERDES2. When we removed resistors R26 and R27, the voltage on the PHY REFCLK_N/P pads was around 1V, so the PHY itself boosts the voltage. So we replaced these two resistors with 100 nF capacitors. I'm not 100% sure if this modification is necessary, this may be a question for your hardware team.

    2. Modify am65-cpsw-nuss.c Linux driver to enable REFCLK output.

    The phy-cadence-torrent.c driver creates a clock provider with the ability to enable REFCLK as an output clock, but to actually be enabled, it must be used as a clock source in another driver. Add this code to the am65-cpsw-nuss.c probe function:

    	clk = devm_clk_get(dev, "fck");
    	if (IS_ERR(clk))
    		return dev_err_probe(dev, PTR_ERR(clk), "getting fck clock\n");
    	common->bus_freq = clk_get_rate(clk);
    	
    +	clk = devm_clk_get_optional(dev, "serdes_refclk");
    +	if (IS_ERR(clk)) {
    +		ret = PTR_ERR(clk);
    +		dev_err(dev, "failed to get serdes_refclk\n");
    +	} else if (clk) {
    +	    ret = clk_prepare_enable(clk);
    +	    if (ret) {
    +		    dev_err(dev, "failed to enable serdes_refclk\n");
    +	    }
    +	}
    
    	pm_runtime_enable(dev);
    	ret = pm_runtime_resume_and_get(dev);
    	if (ret < 0) {
    		pm_runtime_disable(dev);
    		return ret;
    	}

    Of course there should be error checks, but for our debugging purposes it was OK for now.

    Build the kernel and move it to your board as usual.

    3. Create k3-am69-sk-quad-port-eth-exp.dtso device-tree overlay.

    This overlay was created as a modification of the k3-j784s4-evm-quad-port-eth-exp1.dtso. It is located in the <SDK_INSTALL_PATH>board-support/ti-linux-kernel-6.1.80+gitAUTOINC+2e423244f8-ti/arch/arm64/boot/dts/ti.

    Full code:

    // SPDX-License-Identifier: GPL-2.0
    /**
     * DT Overlay for CPSW9G in QSGMII mode using J7 Quad Port ETH EXP Add-On Ethernet Card with
     * J7AHP board. The Add-On Ethernet Card has to be connected to ENET Expansion 1 slot on the
     * board.
     *
     * Product Datasheet: https://www.ti.com/lit/ug/spruj74/spruj74.pdf
     * Product Link: https://www.ti.com/tool/J721EXENETXPANEVM
     *
     * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
     */
    
    /dts-v1/;
    /plugin/;
    
    #include <dt-bindings/gpio/gpio.h>
    #include <dt-bindings/mux/ti-serdes.h>
    #include <dt-bindings/phy/phy-cadence.h>
    #include <dt-bindings/phy/phy-ti.h>
    #include <dt-bindings/phy/phy.h>
    
    #include "k3-pinctrl.h"
    
    &{/} {
    	aliases {
    		ethernet1 = "/bus@100000/ethernet@c000000/ethernet-ports/port@5";
    		ethernet2 = "/bus@100000/ethernet@c000000/ethernet-ports/port@6";
    		ethernet3 = "/bus@100000/ethernet@c000000/ethernet-ports/port@7";
    		ethernet4 = "/bus@100000/ethernet@c000000/ethernet-ports/port@8";
    	};
    };
    
    &main_cpsw0 {
    	status = "okay";
    	clock-names = "fck", "serdes_refclk";
    	clocks = <&k3_clks 64 0>, <&serdes2 CDNS_TORRENT_REFCLK_DRIVER>;
    	assigned-clock-parents = <&serdes2 CDNS_TORRENT_RECEIVED_REFCLK>;
    	assigned-clocks = <&serdes2 CDNS_TORRENT_REFCLK_DRIVER>;
    };
    
    &main_cpsw0_port5 {
    	status = "okay";
    	phy-handle = <&cpsw9g_phy1>;
    	phy-mode = "qsgmii";
    	mac-address = [00 00 00 00 00 00];
    	phys = <&cpsw0_phy_gmii_sel 5>, <&serdes2_qsgmii_link>;
    	phy-names = "mac", "serdes";
    };
    
    &main_cpsw0_port6 {
    	status = "okay";
    	phy-handle = <&cpsw9g_phy2>;
    	phy-mode = "qsgmii";
    	mac-address = [00 00 00 00 00 00];
    	phys = <&cpsw0_phy_gmii_sel 6>, <&serdes2_qsgmii_link>;
    	phy-names = "mac", "serdes";
    };
    
    &main_cpsw0_port7 {
    	status = "okay";
    	phy-handle = <&cpsw9g_phy3>;
    	phy-mode = "qsgmii";
    	mac-address = [00 00 00 00 00 00];
    	phys = <&cpsw0_phy_gmii_sel 7>, <&serdes2_qsgmii_link>;
    	phy-names = "mac", "serdes";
    };
    
    &main_cpsw0_port8 {
    	status = "okay";
    	phy-handle = <&cpsw9g_phy0>;
    	phy-mode = "qsgmii";
    	mac-address = [00 00 00 00 00 00];
    	phys = <&cpsw0_phy_gmii_sel 8>, <&serdes2_qsgmii_link>;
    	phy-names = "mac", "serdes";
    };
    
    &cpsw0_phy_gmii_sel {
    	ti,qsgmii-main-ports = <8>, <8>;
    };
    
    &davinci_mdio {
    	reset-gpios = <&exp1 9 GPIO_ACTIVE_LOW>;
    	reset-post-delay-us = <120000>;
    	#address-cells = <1>;
    	#size-cells = <0>;
    
    	cpsw9g_phy0: ethernet-phy@16 {
    		reg = <16>;
    	};
    	cpsw9g_phy1: ethernet-phy@17 {
    		reg = <17>;
    	};
    	cpsw9g_phy2: ethernet-phy@18 {
    		reg = <18>;
    	};
    	cpsw9g_phy3: ethernet-phy@19 {
    		reg = <19>;
    	};
    };
    
    &exp1 {
    	/* Power-down to high */
    	qsgmii-pwdn-hog {
    		gpio-hog;
    		gpios = <8 GPIO_ACTIVE_HIGH>;
    		output-low;
    	};
    	/* Clock generator I2C enable */
    	cg-i2c-hog {
    		gpio-hog;
    		gpios = <10 GPIO_ACTIVE_HIGH>;
    		output-high;
    	};
    };
    
    &serdes_ln_ctrl {
    	idle-states = 
            <J784S4_SERDES0_LANE0_PCIE1_LANE0>, <J784S4_SERDES0_LANE1_PCIE1_LANE1>,
            <J784S4_SERDES0_LANE2_PCIE3_LANE0>, <J784S4_SERDES0_LANE3_USB>,
    		
            <J784S4_SERDES1_LANE0_PCIE0_LANE0>, <J784S4_SERDES1_LANE1_PCIE0_LANE1>,
    		<J784S4_SERDES1_LANE2_PCIE0_LANE2>, <J784S4_SERDES1_LANE3_PCIE0_LANE3>,
          
            <J784S4_SERDES2_LANE0_IP2_UNUSED>, <J784S4_SERDES2_LANE1_IP2_UNUSED>,
            <J784S4_SERDES2_LANE2_IP3_UNUSED>, <J784S4_SERDES2_LANE3_QSGMII_LANE8>;
    
    };
    
    &serdes_wiz2 {
    	status = "okay";
    };
    
    &serdes2 {
    	status = "okay";
    	#address-cells = <1>;
    	#size-cells = <0>;
    	
    	assigned-clock-parents = <&k3_clks 406 6>, <&k3_clks 406 6>, <&k3_clks 406 5>;
    	assigned-clocks = <&serdes_wiz2 TI_WIZ_PLL0_REFCLK>, <&serdes_wiz2 TI_WIZ_PLL1_REFCLK>, <&serdes_wiz2 TI_WIZ_REFCLK_DIG>;
    	clocks = <&serdes_wiz2 TI_WIZ_PLL0_REFCLK>, <&serdes_wiz2 TI_WIZ_PHY_EN_REFCLK>;
    
    	serdes2_qsgmii_link: phy@0 {
    		reg = <3>;
    		cdns,num-lanes = <1>;
    		#phy-cells = <0>;
    		cdns,phy-type = <PHY_TYPE_QSGMII>;
    		resets = <&serdes_wiz2 4>;
    	};
    };


    Build the DT overlay and move it to your board as usual.

    4. Add DT overlay to uEnv.txt to load at boot.

    The SD card is expected to be used as the boot source. On your board, change directory to /run/media/BOOT-mmcblk1p1 and add the name of the overlay to the name_overlays variables. For me it is:

    name_overlays=k3-j784s4-edgeai-apps.dtbo k3-am69-sk-quad-port-eth-exp.dtbo
    name_overlays_fit=ti/k3-j784s4-edgeai-apps.dtbo ti/k3-am69-sk-quad-port-eth-ext.dtboCode



    5. Reboot the board.

    After these steps you should see eth1 through eth4 in ifconfig and should be able to communicate. For me, the IP address was obtained from a DHCP server and the communication speed measured with iperf3 was ~950 Mbps, as expected.


    These steps may not be 100% correct, they should probably be confirmed and tested by the TI team.

    Thank you and the EVM team for your time.

  • Awesome work!  Thank you for all the info.

    Regarding the hardware connection - Yes the inline 100nF capacitors is correct as the PHY requires input clock to be capacitively coupled.  The processor's termination resistors are already installed on the SK-AM69 (R109, R110)....so that should be it!