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.

Linux/66AK2H14: 66AK2H14 ARM UBOOT ping failed

Expert 2985 points
Part Number: 66AK2H14


Tool/software: Linux

Hi all,

I met a problem.

My hardware environment: 66AK2414's SGMII port0 is connected to SWITCH BCM5389's port0 and BCM5389's port7 is connected to 88E1111's SGMII port and 88E1111 is connected to PC through RJ45.

I used the DSP to send a packet to PC through BCM5389 and PC could receive the packet, so the hardware was OK.

Then I set the CONFIG_DM_ETH as n in k2hk_evm_defconfig in the UBOOT source codes directories. And rebuilt the UBOOT, flashed UBOOT into NOR FLASH, set the SOC as ARM SPI BOOT mode.

Then the UBOOT was up.

But when I typed the ping command to PC, the UBOOT showed me data abort and then reboot.

The messages from UBOOT is below.

U-Boot SPL 2016.05-00118-ga7b7639-dirty (Dec 24 2016 - 11:10:56)
Trying to boot from SPI


U-Boot 2016.05-00118-ga7b7639-dirty (Dec 24 2016 - 11:10:56 +0800)

CPU: 66AK2Hx SR2.0
I2C:   ready
DRAM:  DDR3 status: 0xb000001f
Detected DDR3 [Four DDR3 Chips]
DDR3 speed 1600
DRAM: 2 GiB (includes reported below)
DDR3 status: 0xb0000fff
ddr3_init done

Clear entire DDR3 memory to enable ECC
1 GiB
board_init done
NAND:  512 MiB
*** Warning - bad CRC, using default environment

Net TEST:   using eth_legacy.c
Start to init NET
Start to init EMAC
net_serdes setup
K2HK_EMAC_TEST
Hit any key to stop autoboot:  0 
=> setenv ipaddr 192.168.1.105
=> ping 192.168.1.101

Waiting for SGMII auto negotiation to complete. done
Using K2HK_EMAC_TEST device
data abort
pc : [<bff55640>]          lr : [<bff55305>]
reloc pc : [<0c025640>]    lr : [<0c025305>]
sp : beee7928  ip : 00000000     fp : bffed58c
r10: 6501a8c0  r9 : beeefee0     r8 : bffed060
r7 : bffeca40  r6 : 00000000     r5 : 00000000  r4 : 0000002a
r3 : 00000001  r2 : ffffffff     r1 : e59ff098  r0 : ea000047
Flags: nzCv  IRQs off  FIQs off  Mode SVC_32
Resetting CPU ...

resetting ...

I found the SGMII auto negotiation was done after I typed ping command, so the link was up.

But why UBOOT showed me data abort?

Could anyone help me have a loot at this question?

Regards,

Feng

  • Moving this to the Keystone forum.

    Best Regards,
    Yordan
  • Hi,

    Ethernet experts have been notified. Feedback will be posted here.

    Best Regards,
    Yordan
  • Hi,

    Did the DSP and Linux U-boot use the same code to intialize the SGMII 0 of the K2H? Is the SGMII set to slave mode with auto-negotiation in both cases? I thought the SGMII auto-negotiation should be completed and link is up before the ping command. Using U-BOOT, are you able to download Linux DTB and kernel from network with TFTP? Or the network always crash when you send out the first packet?

    Regards, Eric
  • Hi, Feng,

    Could you indicate what ProcSDK release you are based on?

    From your description, I interpret that the 88E1111's SGMII port is the SGMII port 1 on TI's K2H EVM. In TI's u-boot, there is a environment variable ethact which indicates which ethernet port being active. Different versions of the u-boot may behave differently.

    It seems that it is some net test app running in u-boot. Is it possible that the data abort is causes by that app?

    Rex
  • Hi lding,

    My processor sdk version is ti-processor-sdk-linux-k2hk-evm-03.01.00.06-x86-install.bin

    The DSP and Linux U_BOOT use the same configuration of SGMII0 of 66AK2H14. The configuration is master mode with auto-negotiation.
    From the UBOOT print message above, UBOOT had detected the SGMII0 as auto-negotiation completed and link up.
    I had not tried the TFTP, because I think if ping cmd doesn't work then TFTP will fail also.

    Regards,
    Feng
  • Hi Rex,

    My processor sdk version is ti-processor-sdk-linux-k2hk-evm-03.01.00.06-x86-install.bin

    On TI's K2Hk EVM, both the SGMII0 and SGMII1 had been connected to each 88E1111. I used the default UBOOT source codes and then modified some part without adding some kind of NET test app. And I just used the ping CMD and then the UBOOT crashed.

    Regards,
    Feng
  • Hi lding,

    The DSP codes of SGMII0 configuration is below

    Int32 Init_SGMII (UInt32 macPortNum)
    {
    	UInt32					sgmiiCfg_Value 	= 0x9801;
    	UInt32				   *sgmiiCfg_Reg	= (UInt32 *)0x02090118;
        CSL_SGMII_ADVABILITY    sgmiiCfg;
        CSL_SGMII_STATUS        sgmiiStatus;
    
    	/* Reset the port before configuring it */
    	CSL_SGMII_doSoftReset (macPortNum);
    	while (CSL_SGMII_getSoftResetStatus (macPortNum) != 0);
    
    	/* Hold the port in soft reset and set up
    	* the SGMII control register:
    	*      (1) Enable Master Mode (default)
    	*      (2) Enable Auto-negotiation
    	*/
    	CSL_SGMII_startRxTxSoftReset (macPortNum);
    	//CSL_SGMII_disableMasterMode (macPortNum);
    	CSL_SGMII_enableMasterMode (macPortNum);
    
    	/* Setup the Advertised Ability register for this port:
    	*      (1) Enable Full duplex mode
    	*      (2) Enable Auto Negotiation
    	*/
    //	sgmiiCfg.linkSpeed      =   CSL_SGMII_1000_MBPS;
    //	sgmiiCfg.duplexMode     =   CSL_SGMII_FULL_DUPLEX;
    //	//sgmiiCfg.bLinkUp		= 	1;
    //	CSL_SGMII_setAdvAbility (macPortNum, &sgmiiCfg);
    
    	memcpy((void *)sgmiiCfg_Reg, &sgmiiCfg_Value, 4);
    
    	//CSL_SGMII_disableAutoNegotiation (macPortNum);
    	CSL_SGMII_enableAutoNegotiation (macPortNum);
    	CSL_SGMII_endRxTxSoftReset (macPortNum);
    
    	/* Wait for SGMII Link */
    	if (!cpswSimTest)
    	{
    		do
    		{
    			CSL_SGMII_getStatus(macPortNum, &sgmiiStatus);
    		} while (sgmiiStatus.bIsLinkUp != 1);
    
    		/* Wait for SGMII Autonegotiation to complete without error */
    		do
    		{
    			CSL_SGMII_getStatus(macPortNum, &sgmiiStatus);
    			if (sgmiiStatus.bIsAutoNegError != 0)
    				return -1;
    		} while (sgmiiStatus.bIsAutoNegComplete != 1);
    
    		/*
    		 * May need to wait some more time for the external PHY to be ready to transmit packets reliabily.
    		 * It is possible to access the PHY status register through the MDIO interface to check when
    		 * the PHY is ready.
    		 * To avoid platform-dependent code, we just introduce about 2ms wait here
    		 */
    		if((cpswLpbkMode == CPSW_LOOPBACK_EXTERNAL) || (cpswLpbkMode == CPSW_LOOPBACK_NONE))
    			CycleDelay(2000000);
    	}
    
        /* All done with configuration. Return Now. */
        return 0;
    }

    This DSP codes can config the SGMII0 well and I can send packet to PC through this link BCM5389->88E1111->PC.

    And in the UBOOT source codes I had some modification as below

    in board_k2hk.c file

    #ifdef CONFIG_DRIVER_TI_KEYSTONE_NET
    struct eth_priv_t eth_priv_cfg[] = {
    	{
    		.int_name	= "K2HK_EMAC_TEST",
    		.rx_flow	= 22,
    		.phy_addr	= 0,
    		.slave_port	= 1,
    		.sgmii_link_type = SGMII_LINK_MAC_MAC_AUTONEG,
    		.phy_if          = PHY_INTERFACE_MODE_SGMII,
    	},
    /*
    	{
    		.int_name	= "K2HK_EMAC1",
    		.rx_flow	= 23,
    		.phy_addr	= 1,
    		.slave_port	= 2,
    		.sgmii_link_type = SGMII_LINK_MAC_MAC_AUTONEG,
    		.phy_if          = PHY_INTERFACE_MODE_SGMII,
    	},
    	{
    		.int_name	= "K2HK_EMAC2",
    		.rx_flow	= 24,
    		.phy_addr	= 2,
    		.slave_port	= 3,
    		.sgmii_link_type = SGMII_LINK_MAC_MAC_AUTONEG,
    		.phy_if          = PHY_INTERFACE_MODE_SGMII,
    	},
    	{
    		.int_name	= "K2HK_EMAC3",
    		.rx_flow	= 25,
    		.phy_addr	= 3,
    		.slave_port	= 4,
    		.sgmii_link_type = SGMII_LINK_MAC_MAC_AUTONEG,
    		.phy_if          = PHY_INTERFACE_MODE_SGMII,
    	},
    */
    };

    in the k2hk_evm_defconfig file

    CONFIG_ARM=y
    CONFIG_ARCH_KEYSTONE=y
    CONFIG_TARGET_K2HK_EVM=y
    CONFIG_DM_SERIAL=y
    CONFIG_DEFAULT_DEVICE_TREE="k2hk-evm"
    CONFIG_SPL=y
    CONFIG_OF_BOARD_SETUP=y
    CONFIG_HUSH_PARSER=y
    CONFIG_CMD_BOOTZ=y
    # CONFIG_CMD_IMLS is not set
    CONFIG_CMD_ASKENV=y
    # CONFIG_CMD_FLASH is not set
    CONFIG_CMD_NAND=y
    CONFIG_CMD_SF=y
    CONFIG_CMD_SPI=y
    CONFIG_CMD_I2C=y
    CONFIG_CMD_USB=y
    # CONFIG_CMD_SETEXPR is not set
    CONFIG_CMD_DHCP=y
    #JF set n to test
    CONFIG_CMD_MII=y
    CONFIG_CMD_PING=y
    CONFIG_CMD_EXT2=y
    CONFIG_CMD_EXT4=y
    CONFIG_CMD_EXT4_WRITE=y
    CONFIG_CMD_FAT=y
    CONFIG_CMD_FS_GENERIC=y
    CONFIG_CMD_RIO=y
    CONFIG_OF_CONTROL=y
    CONFIG_DM=y
    CONFIG_TI_AEMIF=y
    CONFIG_DM_SPI=y
    CONFIG_DM_SPI_FLASH=y
    CONFIG_SPI_FLASH=y
    CONFIG_SPI_FLASH_STMICRO=y
    #JF: set n to use the eth_legacy.c file
    CONFIG_DM_ETH=n
    CONFIG_SYS_NS16550=y
    CONFIG_CMD_TIME=y
    CONFIG_KEYSTONE_RIO=y
    CONFIG_LIB_RAND=y
    CONFIG_NET_RANDOM_ETHADDR=y

    Please note that I had set CONFIG_DM_ETH=n. Because if it's y same as the default value, the UBOOT will not use the parameters above in board_k2hk.c file. I manually set CONFIG_DM_ETH=n, then the parameters of SGMII port configuration in board_k2hk.c file will work.

    Could you please help me to verify the UBOOT source codes modification is OK or not?

    Regards,

    Feng

  • Feng,

    In DSP code, if the K2H is directly connected to 88E1111, the K2H is the slave of the auto-negotitation, this is what we did in the our PA example code running on EVM. As in your customized board, you have a BCM switch in between, you can set the K2H as the master of auto-neg, this is OK.

    In Linux, we are checking what "SGMII_LINK_MAC_MAC_AUTONEG" and "PHY_INTERFACE_MODE_SGMII" did in U-boot. But since you also get SGMII link up, the SGMII setup code may not be the issue.

    You log showed you sent ping before link up, can you confirm that if you wait for link up first, then send ping command, the U-boot crash as well?

    Hit any key to stop autoboot: 0

    => setenv ipaddr 192.168.1.105
    => ping 192.168.1.101
    Waiting for SGMII auto negotiation to complete. done

    Regards, Eric
  • Hi lding,

    I had no K2H EVM. My DSP codes were also tested on my customized board with this link K2H->BCM5389->88E1111->PC.
    And I modified the original DSP codes from salve auto-negotiation to master auto-negotiation and I could send packet to PC. From this, I wanted to say my hardware is OK.

    From your kind and very helpful suggestion, I also think it's not a normal way that sending ping cmd before link up.
    But after UBOOT was up, how should I do next to set the SGMII link up? I mean I thought it should be a normal way that UBOOT set the link up internally before the UBOOT console comes out. So I think it's a normal way that if I can control the UBOOT console, the SGMII link shoud be up or not up with error message printing already.
    Should I take some steps to set the SGMII link up manually before I send ping cmd? What setps should I take?

    Regards,
    Feng
  • Feng,

    I asked our Linux team for comment how to do in U-boot.

    Regards, Eric
  • Hi, Feng,

    In U-boot, the SGMII isn't configured till ping starts. Keystone2_sgmii_config() is called to configure the SGMII. Please see the u-boot ping logs below. It first initializes SGMII and PHY, if it fails, it goes to the next available port. In your case, you may want to be sure the configuration matches that in DSP. You can check the register to see if the PLL_CTRL if the lane status is up. I can't think of any reason causes the issue. Can you capture any packets out of port 7 of the switch?

    Ping through the first port:

    => setenv ipaddr 158.218.109.222
    => ping 158.218.109.254

    netcp@2000000 Waiting for SGMII auto negotiation to complete. done
    Using netcp@2000000 device
    host 158.218.109.254 is alive
    =>

    Ping through the 2nd port:

    netcp@2000000 Waiting for SGMII auto negotiation to complete. done
    netcp@2000000 Waiting for PHY auto negotiation to complete......... TIMEOUT !
    ERROR: phy startup failed

    at drivers/net/keystone_net.c:776/ks2_eth_start()

    netcp@slave-1 Waiting for SGMII auto negotiation to complete. done
    Using netcp@slave-1 device
    host 158.218.109.254 is alive