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.

Force connection, link, and speed on EMAC using NDK, pdk, and MCSDK for 6472

Hello,

I have a custom 6472 design, and I am attempting to get Ethernet up and running. I have EMAC0 directly connected to an Ethernet Switch with GMII. My current code (which I'm ressurecting from quite a while ago) is using NDK 2.20.04.26, MCSDK 1.00.00.08, and PDK 1.00.00.06. I would like the EMAC driver to not poll through MDIO, and to just force the speed to 1000. the following is the "runNetwork" code which was borrowed from an example to the NDK running:

void runNetwork(void)
{
    int               rc;
    HANDLE            hCfg;

    //
    // THIS MUST BE THE ABSOLUTE FIRST THING DONE IN AN APPLICATION!!
    //
    rc = NC_SystemOpen( NC_PRIORITY_LOW, NC_OPMODE_INTERRUPT );
    if( rc )
    {
        for(;;);
    }

    //
    // Create and build the system configuration from scratch.
    //

    // Create a new configuration
    hCfg = CfgNew();
    if( !hCfg )
    {
        goto main_exit;
    }

    // We better validate the length of the supplied names
    if( strlen( DomainName ) >= CFG_DOMAIN_MAX ||
        strlen( HostName ) >= CFG_HOSTNAME_MAX )
    {
        goto main_exit;
    }

    // Add our global hostname to hCfg (to be claimed in all connected domains)
    CfgAddEntry( hCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_HOSTNAME, 0, strlen(HostName), (UINT8 *)HostName, 0 );

    // If the IP address is specified, manually configure IP and Gateway
    if( inet_addr(LocalIPAddr) )
    {
        CI_IPNET NA;
        CI_ROUTE RT;
        IPN      IPTmp;

        // Setup manual IP address
        bzero( &NA, sizeof(NA) );
        NA.IPAddr  = inet_addr(LocalIPAddr);
        NA.IPMask  = inet_addr(LocalIPMask);
        strcpy( NA.Domain, DomainName );
        NA.NetType = 0;

        // Add the address to interface 1
        CfgAddEntry( hCfg, CFGTAG_IPNET, 1, 0, sizeof(CI_IPNET), (UINT8 *)&NA, 0 );

        // Add the default gateway. Since it is the default, the
        // destination address and mask are both zero (we go ahead
        // and show the assignment for clarity).
        bzero( &RT, sizeof(RT) );
        RT.IPDestAddr = 0;
        RT.IPDestMask = 0;
        RT.IPGateAddr = inet_addr(GatewayIP);

        // Add the route
        CfgAddEntry( hCfg, CFGTAG_ROUTE, 0, 0, sizeof(CI_ROUTE), (UINT8 *)&RT, 0 );

        // Manually add the DNS server when specified
        IPTmp = inet_addr(DNSServer);
        if( IPTmp )
            CfgAddEntry( hCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_DOMAINNAMESERVER, 0, sizeof(IPTmp), (UINT8 *)&IPTmp, 0 );
    }

    //
    // Configure IPStack/OS Options
    //

    // We don't want to see debug messages less than WARNINGS
    rc = DBG_WARN;
    CfgAddEntry( hCfg, CFGTAG_OS, CFGITEM_OS_DBGPRINTLEVEL, CFG_ADDMODE_UNIQUE, sizeof(uint), (UINT8 *)&rc, 0 );

    //
    // This code sets up the TCP and UDP buffer sizes
    // (Note 8192 is actually the default. This code is here to
    // illustrate how the buffer and limit sizes are configured.)
    //

    // UDP Receive limit
    rc = 8192;
    CfgAddEntry( hCfg, CFGTAG_IP, CFGITEM_IP_SOCKUDPRXLIMIT, CFG_ADDMODE_UNIQUE, sizeof(uint), (UINT8 *)&rc, 0 );

    //
    // Boot the system using this configuration
    //
    // We keep booting until the function returns 0. This allows
    // us to have a "reboot" command.
    //
    do
    {
        rc = NC_NetStart( hCfg, NetworkOpen, NetworkClose, NetworkIPAddr );
    } while( rc > 0 );

    // Delete Configuration
    CfgFree( hCfg );

    // Close the OS
main_exit:
    NC_SystemClose();
    return;
}


  • After lots of digging through the MCSDK NIMU driver and the PDK EMAC driver I have discovered that they needed modifications. What I have attempted so far is in nimu_eth.c I changed open_cfg.mdio_flag to false, and in emac_drv.c I added the following false statement after the if (EMAC_MDIO(port_num)):

            else // if we are not using MDIO, force the port to gigabit
            {
                CSL_FINST(emacRegs->MACCONTROL, EMAC_MACCONTROL_FULLDUPLEX, ENABLE );
                CSL_FINST(emacRegs->MACCONTROL, EMAC_MACCONTROL_GIG, ENABLE );
                CSL_FINST(emacRegs->MACCONTROL, EMAC_MACCONTROL_GIGFORCE, ENABLE );
            }

    This is what was initially done with the code which shipped with our original EVM6472, and it seemed to work. The old binaries still work, but ressurecting the original build environment has not worked, so I wanted to use the MCSDK, PDK, and more recent NDK.

    I keep looking for the 6472 to output the 125MHz clock back to the switch, but I'm not seeing it. Are there other things I'm missing my turning off the MDIO?

  • Hi,

    Can you read the MDIO Control register at 0x02C81800 address and make sure MDIO is enabled (bit#30) in that register?

    Please provide MDIO control register value after configuration when 125MHz is not there.

    Regards,

    Bhavin

  • I discovered why the 125MHz was missing: the driver was configured for RGMII instead of GMII. That is now fixed, but soon after BIOS boots it hangs. I'm attempting to turn MDIO off because the part is not connected to a PHY.

  • I fixed my issue. I was attempting to mimic the return values as if MDIO was enabled. Once I removed that code it started working.