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.

AM3352: RGMII2 has link status up, but no ping/communication in U-Boot

Part Number: AM3352

Hello,

I've been struggling with a problem for a couple days now. I have a board with the AM3352 chip, and I'm trying to setup U-Boot (in SPI NOR flash) to allow TFTP over EMAC1 (RGMII2). In my system, I have 2 ethernet ports available for a network boot, the first one works, but the second one (RGMII2) does not. I cannot seem to access two PHYs at the same time, so I'm either able to use the first port (which will not be available on the next version of our hardware) or the second port (which doesn't ping or communicate over TFTP). 

The RGMII2 PHY is the Micrel KSZ9031. It auto-negotiates to 1000MBPS with my router (have tried multiple routers, multiple cables, etc, all the regular stuff). On Wireshark, I see no traffic across my network (using a static IP). The first ethernet port works perfectly, and I've used it for network boot for months without issue.

Here are my files of interest (based mostly on the am335x set of U-Boot files).

In mux.c:

static struct module_pin_mux rmii1_pin_mux[] = {
   {OFFSET(mii1_crs), MODE(1) | RXACTIVE},     /* RMII1_CRS */
   {OFFSET(mii1_rxerr), MODE(1) | RXACTIVE},   /* RMII1_RXERR */
   {OFFSET(mii1_txen), MODE(1)},           /* RMII1_TXEN */
   {OFFSET(mii1_txd1), MODE(1)},           /* RMII1_TXD1 */
   {OFFSET(mii1_txd0), MODE(1)},           /* RMII1_TXD0 */
   {OFFSET(mii1_rxd1), MODE(1) | RXACTIVE},    /* RMII1_RXD1 */
   {OFFSET(mii1_rxd0), MODE(1) | RXACTIVE},    /* RMII1_RXD0 */
   {OFFSET(mdio_data), MODE(0) | RXACTIVE | PULLUP_EN}, /* MDIO_DATA */
   {OFFSET(mdio_clk), MODE(0) | PULLUP_EN},    /* MDIO_CLK */
   {OFFSET(rmii1_refclk), MODE(0) | RXACTIVE}, /* RMII1_REFCLK */
   {-1},
};

static struct module_pin_mux rgmii2_pin_mux[] = {
   {OFFSET(gpmc_a0), MODE(2)},     /* (R13) gpmc_a0.rgmii2_tctl */
   {OFFSET(gpmc_a1), MODE(2) | RXACTIVE},   /* (V14) gpmc_a1.rgmii2_rctl */
   {OFFSET(gpmc_a2), MODE(2)},           /* (U14) gpmc_a2.rgmii2_td3 */
   {OFFSET(gpmc_a3), MODE(2)},           /* (T14) gpmc_a3.rgmii2_td2 */
   {OFFSET(gpmc_a4), MODE(2)},           /* (R14) gpmc_a4.rgmii2_td1 */
   {OFFSET(gpmc_a5), MODE(2)},           /* (V15) gpmc_a5.rgmii2_td0 */
   {OFFSET(gpmc_a6), MODE(2)},    		/* (U15) gpmc_a6.rgmii2_tclk */
   {OFFSET(gpmc_a7), MODE(2) | RXACTIVE},    /* (T15) gpmc_a7.rgmii2_rclk */
   {OFFSET(gpmc_a8), MODE(2) | RXACTIVE},    /* (V16) gpmc_a8.rgmii2_rd3 */
   {OFFSET(gpmc_a9), MODE(2) | RXACTIVE},    /* (U16) gpmc_a9.rgmii2_rd2 */
   {OFFSET(gpmc_a10), MODE(2) | RXACTIVE},    /* (T16) gpmc_a10.rgmii2_rd1 */
   {OFFSET(gpmc_a11), MODE(2) | RXACTIVE},    /* (V17) gpmc_a11.rgmii2_rd0 */
   {OFFSET(mdio_data), MODE(0) | RXACTIVE | PULLUP_EN}, /* MDIO_DATA */
   {OFFSET(mdio_clk), MODE(0) | PULLUP_EN},    /* MDIO_CLK */   
   {-1},
};

...
// I have also tried commenting rmii1 out, to see if that solves the problem - no luck
   configure_module_pin_mux(rmii1_pin_mux);
   configure_module_pin_mux(rgmii2_pin_mux);
...


In board.c, the commented out code shows other permutations of what I've tried:

static struct cpsw_slave_data cpsw_slaves[] = {
	{
		.slave_reg_ofs	= 0x308,
		.sliver_reg_ofs	= 0xdc0,
		.phy_addr	= 6,
	},
	{
		.slave_reg_ofs	= 0x208,
		.sliver_reg_ofs	= 0xd80,
		.phy_addr	= 7,
	},
};

// static struct cpsw_slave_data cpsw_slaves[] = {
// 	{
// 		.slave_reg_ofs	= 0x208,
// 		.sliver_reg_ofs	= 0xd80,		
// 		.phy_addr	= 6,
// 	},
// 	{
// 		.slave_reg_ofs	= 0x308,
// 		.sliver_reg_ofs	= 0xdc0,
// 		.phy_addr	= 7,
// 	},
// };

static struct cpsw_platform_data cpsw_data = {
	.mdio_base		= CPSW_MDIO_BASE,
	.cpsw_base		= CPSW_BASE,
	.mdio_div		= 0xff,
	.channels		= 8,
	.cpdma_reg_ofs		= 0x800,
	.slaves			= 2,
	.slave_data		= cpsw_slaves,
	.ale_reg_ofs		= 0xd00,
	.ale_entries		= 1024,
	.host_port_reg_ofs	= 0x108,
	.hw_stats_reg_ofs	= 0x900,
	.bd_ram_ofs		= 0x2000,
	.mac_control		= (1 << 5),
	.control		= cpsw_control,
	.host_port_num		= 0,
	.version		= CPSW_CTRL_VERSION_2,
};

...

	writel(RGMII1_IDMODE | RGMII2_IDMODE |
		RMII_CHIPCKL_ENABLE |
		GMII1_SEL_RMII | GMII2_SEL_RGMII,
		&cdev->miisel);
	// writel(RGMII_MODE_ENABLE  | RGMII_INT_DELAY, &cdev->miisel);

	cpsw_slaves[0].phy_if = PHY_INTERFACE_MODE_RMII;
	cpsw_slaves[0].phy_addr = 6;
	cpsw_slaves[1].phy_if =	PHY_INTERFACE_MODE_RGMII;
	//cpsw_slaves[1].phy_if =	PHY_INTERFACE_MODE_RGMII_TXID;
        cpsw_slaves[1].phy_addr = 7;

        // Need to set active_slave = 1, otherwise, cannot see Micrel PHY
        //cpsw_data.active_slave = 0;
        cpsw_data.active_slave = 1;

	rv = cpsw_register(&cpsw_data);
	if (rv < 0)
		printf("Error %d registering CPSW switch\n", rv);
	else
		n += rv;
...

Pertinent defines, whether useful or not:


#define CONFIG_PHY_GIGE #define CONFIG_PHYLIB #define CONFIG_PHY_SMSC #define CONFIG_PHY_MICREL #define CONFIG_PHY_MICREL_KSZ9031
#define CONFIG_DRIVER_TI_CPSW

Any help would be greatly appreciated!
- SJ

  • Hi Suresh,

    have you modeled your platform files/changes regarding RGMII2 after any existing AM335x board perhaps? It may also be worth having a look at the latest upstream U-Boot branch at https://gitlab.denx.de/u-boot/u-boot

    Suresh Joshi1 said:
    On Wireshark, I see no traffic across my network (using a static IP).

    Not even ARP requests after doing a 'dhcp' in U-Boot? (That's what the other thread you found had mentioned).

    If none of those basic suggestions help it'll probably take me a day or two before I can carve out time to have a deeper look into this.

    Regards, Andreas

  • Hello, thanks for the quick reply!

    I've tried to follow the AM335x examples as much as possible, and to the best of my knowledge, some of my permutations have emulated it to no success. That's not to say I haven't made a mistake along the way, but I think I've tried what I've seen in the AM335 EVMs, BeagleBones, and the PXM2 examples.

    I have not seen any ARPs, or ANY traffic from the RGMII2. It must be a configuration problem, but I can't determine where it could be. 

    I'd appreciate any other suggestions you may have (or, if there are some recent examples of it).

    Thanks!

    -SJ

  • SJ,

    have you set the associated phy-mode device tree property to any of the rgmii* modes like rgmii-id? (also see https://e2e.ti.com/support/processors/f/791/p/894279/3314324#3314324)

    Then, can you dump all of the PHY registers (after initialization is done) and check against the datasheet values to make sure it's configured for RGMII as expected?

    Also can you probe the signals between the AM335x and the PHY with a logic analyzer to see if there is any activity during boot (probe), and when attempting to use the network interface.

    Regards, Andreas

  • Hi Andreas, thanks for the suggestion.

    I believe I am doing that with the lines in board.c (or one of my many permutations around this). Is there somewhere else I should be setting these? I use RGMII-TXID in the Linux device tree and have tested both here:

        cpsw_slaves[0].phy_if = PHY_INTERFACE_MODE_RMII;
        cpsw_slaves[0].phy_addr = 6;
        cpsw_slaves[1].phy_if =	PHY_INTERFACE_MODE_RGMII;
        //cpsw_slaves[1].phy_if =	PHY_INTERFACE_MODE_RGMII_TXID;
        cpsw_slaves[1].phy_addr = 7;

    I'll post a PHY register dump when I can next access the board, but last time it looked correct - however, I have tested and re-tested many configurations since then! So, it would be best to confirm.

    I will try to probe the signals between the AM335x and the PHY, but I don't have full access to all of my test equipment, due to this COVID lockdown business. I'll see if what I have around the house will work well enough.

    Thanks!

    -SJ