Texas Instruments TMS320DM643x DMP Switch User Manual


 
www.ti.com
2.7.2.1InitializingtheMDIOModule
2.7.2.2WritingDataToaPHYRegister
2.7.2.3ReadingDataFromaPHYRegister
PeripheralArchitecture
ThefollowingstepsareperformedbytheapplicationsoftwareordevicedrivertoinitializetheMDIO
device:
1.ConfigurethePREAMBLEandCLKDIVbitsintheMDIOcontrolregister(CONTROL).
2.EnabletheMDIOmodulebysettingtheENABLEbitinCONTROL.
3.TheMDIOPHYalivestatusregister(ALIVE)canbereadinpollingfashionuntilaPHYconnectedto
thesystemresponded,andtheMDIOPHYlinkstatusregister(LINK)candeterminewhetherthisPHY
alreadyhasalink.
4.SetuptheappropriatePHYaddressesintheMDIOuserPHYselectregister(USERPHYSELn),andset
theLINKINTENBbittoenablealinkchangeeventinterruptifdesirable.
5.IfaninterruptongeneralMDIOregisteraccessisdesired,setthecorrespondingbitintheMDIOuser
commandcompleteinterruptmasksetregister(USERINTMASKSET)tousetheMDIOuseraccess
register(USERACCESSn).SinceonlyonePHYisusedinthisdevice,theapplicationsoftwarecanuse
oneUSERACCESSntotriggeracompletioninterrupt;theotherUSERACCESSnisnotsetup.
TheMDIOmoduleincludesauseraccessregister(USERACCESSn)todirectlyaccessaspecifiedPHY
device.TowriteaPHYregister,performthefollowing:
1.ChecktoensurethattheGObitintheMDIOuseraccessregister(USERACCESSn)iscleared.
2.WritetotheGO,WRITE,REGADR,PHYADR,andDATAbitsinUSERACCESSncorrespondingtothe
PHYandPHYregisteryouwanttowrite.
3.ThewriteoperationtothePHYisscheduledandcompletedbytheMDIOmodule.Completionofthe
writeoperationcanbedeterminedbypollingtheGObitinUSERACCESSnfora0.
4.CompletionoftheoperationsetsthecorrespondingUSERINTRAWbit(0or1)intheMDIOuser
commandcompleteinterruptregister(USERINTRAW)correspondingtoUSERACCESSnused.If
interruptshavebeenenabledonthisbitusingtheMDIOusercommandcompleteinterruptmaskset
register(USERINTMASKSET),thenthebitisalsosetintheMDIOusercommandcompleteinterrupt
register(USERINTMASKED)andaninterruptistriggeredontheCPU.
TheMDIOmoduleincludesauseraccessregister(USERACCESSn)todirectlyaccessaspecifiedPHY
device.ToreadaPHYregister,performthefollowing:
1.ChecktoensurethattheGObitintheMDIOuseraccessregister(USERACCESSn)iscleared.
2.WritetotheGO,REGADR,andPHYADRbitsinUSERACCESSncorrespondingtothePHYandPHY
registeryouwanttoread.
3.ThereaddatavalueisavailableintheDATAbitsinUSERACCESSnafterthemodulecompletesthe
readoperationontheserialbus.Completionofthereadoperationcanbedeterminedbypollingthe
GOandACKbitsinUSERACCESSn.OncetheGObithascleared,theACKbitissetonasuccessful
read.
4.CompletionoftheoperationsetsthecorrespondingUSERINTRAWbit(0or1)intheMDIOuser
commandcompleteinterruptregister(USERINTRAW)correspondingtoUSERACCESSnused.If
interruptshavebeenenabledonthisbitusingtheMDIOusercommandcompleteinterruptmaskset
register(USERINTMASKSET),thenthebitisalsosetintheMDIOusercommandcompleteinterrupt
register(USERINTMASKED)andaninterruptistriggeredontheCPU.
SPRU941AApril2007EthernetMediaAccessController(EMAC)/31
ManagementDataInput/Output(MDIO)
SubmitDocumentationFeedback