5.9. Freescale TSEC / eTSEC - emllETSEC
The parameters to the ETSEC Link Layer are setup-specific. The function CreateLinkParmsFromCmdLineETSEC()
in EcSelectLinkLayer.cpp
demonstrates how to initialize the Link Layer instance.
-
struct EC_T_LINK_PARMS_ETSEC
Public Members
-
EC_T_LINK_PARMS linkParms
Common link parameters. Signature must be set to EC_LINK_PARMS_SIGNATURE_ETSEC
-
EC_T_DWORD dwLocalMdioBase
Physical base address of local MDIO register block (4k). For the eTSEC V1 or TSEC this is the same as dwRegisterBase, for the eTSEC V2 it’s not.
-
EC_T_DWORD dwPhyMdioBase
Physical base address of MDIO register block (4k). This is the MDIO base of the (e)TSEC where the PHY (MII bus) is physically connected to (MII interface is shared by (e)TSEC’s).
-
EC_T_DWORD dwTbiPhyAddr
Address of internal TBI PHY. Any address from [0..31] can be used here, but the address shouldn’t collide with any external PHY connected to the external MII bus
-
EC_T_DWORD dwFixedLinkVal
Only evaluated if dwPhyAddr == FIXED_LINK. Set to one of the ETSEC_LINKFLAG_* macros. I.e. ETSEC_LINKFLAG_1000baseT_Full
-
EC_T_VOID *oMiiBusMtx
This mutex protect the access to the (shared) MII bus. Set to 0 if mutex shouldn’t be used. The MII bus is shared between eTSEC instances. So this mutex should be created once and assigned here for all Linklayer instances
-
EC_T_BOOL bNotUseDmaBuffers
EC_TRUE: copy buffer before processing, EC_FALSE: Use buffers from DMA (default)
-
EC_T_ETSEC_TYPE eETSECType
System on Chip type
-
EC_T_LINK_PARMS linkParms
5.9.1. ETSEC supported MAC’s
TSEC (not tested): Legacy hardware. Should be supported, because eTSEC is compatible to TSEC if the enhanced functionality is not used.
eTSEC v1 (tested): This chip is used for QorIQ (i.e. P2020E) and PowerQUICC devices (i.e. MPC8548). It has 4k of IO memory.
eETSEC v2, also called vETSEC, v read as “virtualization” (tested): This chip is used for newer QorIQ devices (i.e. P1020). It has 12k of IO memory (4k MDIO, 4k Register group0, 4k Register group1)
5.9.3. Locking
The optional lock is acquired each time the MDIO register (specified by poDrvSpecificParam->dwPhyMdioBase) are accessed:
poDrvSpecificParam->oMiiBusMtx = EC_NULL;
/* implement locking by using return value of LinkOsCreateLock(eLockType_DEFAULT); */
5.9.4. Link check
The driver’s API function EcLinkGetStatus (pfEcLinkGetStatus) is called by the EC-Simulator stack. On eTSEC the link status can’t be obtained directly by reading eTSEC registers without access to the MII bus (Use mutex, poll for completion). Accessing the bus would violate timing constraints and is therefore not possible.
The following IOCTL updates the link status and accesses the PHY. The IOCTL is blocking and may therefore be not called from the JobTask’s context. I.e. use:
dwRes = esIoControl(dwSimulatorInstanceId, EC_IOCTL_LINKLAYER | EC_LINKIOCTL_UPDATE_LINKSTATUS, EC_NULL);
EcLinkGetStatus always returns the last known link status.
5.9.5. Fixed Link
PHY access can be effectively disable at all to avoid concurrent access if link speed and mode as define to be fixed. This functionality is mainly provided for L2-Switch-IC’s like Vertesse VSC7385 which haven’t any PHY and are attached to the eTSEC MAC with fixed speed and mode.
The driver’s open function will not wait until the link is up on EC-Simulator start up. Auto-negotiation of following PHY’s are not affected by this parameter and still active. There is no forced link and no PHY access at all.
Parameters for fixed link:
pETSECParam->dwPhyAddr = ETSEC_FIXED_LINK;
pETSECParam->dwFixedLinkVal = ETSEC_LINKFLAG_1000baseT_Full | ETSEC_LINKFLAG_LINKOK;