/** ============================================================================ * @n@b Init_MAC * * @b Description * @n This API initializes the CPGMAC Sliver (MAC Port) port. * * @param[in] * @n macPortNum MAC port number for which the initialization must be done. * * @param[in] * @n macAddress MAC address to configure on this port. * * @param[in] * @n mtu Maximum Frame length to configure on this port. * * @return * @n None * ============================================================================= */ int Init_MAC (UInt32 macPortNum, UInt8 macAddress[6], UInt32 mtu) { /* Reset MAC Sliver 0 */ CSL_CPGMAC_SL_resetMac (macPortNum); while (CSL_CPGMAC_SL_isMACResetDone (macPortNum) != TRUE); /* Setup the MAC Control Register for this port: * (1) Enable Full duplex * (2) Enable GMII * (3) Enable Gigabit * (4) Enable External Configuration. This enables * the "Full duplex" and "Gigabit" settings to be * controlled externally from SGMII * (5) Don't enable any control/error/short frames */ CSL_CPGMAC_SL_enableFullDuplex (macPortNum); CSL_CPGMAC_SL_enableGMII (macPortNum); CSL_CPGMAC_SL_enableGigabit (macPortNum); CSL_CPGMAC_SL_enableExtControl (macPortNum); /* Configure the MAC address for this port */ CSL_CPSW_3GF_setPortMACAddress (macPortNum, macAddress); /* Configure VLAN ID/CFI/Priority. * * For now, we are not using VLANs so just configure them * to all zeros. */ CSL_CPSW_3GF_setPortVlanReg (macPortNum, 0, 0, 0); /* Configure the Receive Maximum length on this port, * i.e., the maximum size the port can receive without * any errors. * * Set the Rx Max length to the MTU configured for the * interface. */ CSL_CPGMAC_SL_setRxMaxLen (macPortNum, mtu); //platform_write("MAC intialization done for port %d and its mac address is %X:%X:%X:%X:%X:%X\n",macPortNum,macAddress[0],\ macAddress[1],macAddress[2],macAddress[3],macAddress[4],macAddress[5]); /* Done setting up the MAC port */ return 0; }
/****************************************************************************** * Init_MAC ******************************************************************************/ void Init_MAC(uint32_t macPortNum) { CSL_CPGMAC_SL_resetMac (macPortNum); while (CSL_CPGMAC_SL_isMACResetDone (macPortNum) != TRUE); /* Setup the MAC Control Register for this port: * (1) Enable Full duplex * (2) Enable GMII * (3) Enable Gigabit * (4) Enable External Configuration. This enables * the "Full duplex" and "Gigabit" settings to be * controlled externally from SGMII * (5) Don't Enable any control/error frames * (6) Enable short frames */ CSL_CPGMAC_SL_enableFullDuplex (macPortNum); CSL_CPGMAC_SL_enableGMII (macPortNum); CSL_CPGMAC_SL_enableGigabit (macPortNum); CSL_CPGMAC_SL_enableExtControl (macPortNum); }