Hi,
I’d like to ask you some questions about EMAC implementation.
I'm trying to use both EMAC0 and EMAC1 devices and need to receive link up/down interrupts for them .
As I understand there are one MDIO for two EMACs, so I tried to configure PHY0 and PHY1 (PHY0 for EMAC0 and PHY1 for EMAC1) using registers
USERPHYSEL0 and USERPHYSEL1.
So I do it like this:
USERPHYSEL0 = LINKINTENB | (PHY0 & 0x1F)
USERPHYSEL1 = LINKINTENB | (PHY1 & 0x1F)
When I read this registers after configuration, I see that values was set correctly (PHY0 == 6,PHY1 == 3):
MDIO User PHY Select Register 0 0x00000046
MDIO User PHY Select Register 1 0x00000043
Also MISC interrupt for both EMACs is turned on in such way:
EMAC_CTRL_CnMISCEN = 0x2 // handle link interrupts only
Using this configuration I try plug/unplug Ethernet cables to check interrupts.
ALIVE, LINK, LINKINTRAW, LINKINTMASKED registers show correct information about both PHYs.
But I can receive MACMISC0 vector interrupt for PHY0 only. When I try to write PHY1 to USERPHYSEL0, I receive MACMISC0 vector interrupt for PHY1. So PHYs work properly.
According to described above there are couple of questions:
- Is there one MDIO for both EMACs?
- Is PHY interrupt configuration I wrote correct? If no, please correct.
- How can I bind MACMISC0 vector (or EMAC0) to PHY0 and MACMISC1 vector (or EMAC1) to PHY1? I need to receive MACMISC0 vector for PHY0 link status changed and MACMISC1 vector for PHY1.
- Possibly USERPHYSEL0 used to determine PHY for EMAC0 and USERPHYSEL0 for EMAC1. If so why cannot I receive MACMISC1 vector interrupt.