GMII/MII
BCM5718 Programmer’s Guide
Broadcom
®
January 29, 2016 • 5718-PG108-R
Page 206
100Base-TX
- Write 0x6100 to PHY register 00h // Force 100Base-TX, full duplex, internal loopback
- Write 0x1000 to PHY register 1Eh // Force link (required for 100Base-TX)
- Set MAC register 0x400[3:2] = 01b // Set MII
- Set MAC register 0x400[1] = 0 // Force full-duplex operation
1000Base-T
- Write 0x4140 to PHY register 00h // Force 1000Base-T, full duplex, internal loopback
- Write 0x1000 to PHY register 1Eh // Force link (optional for 1000Base-T)
- Set MAC register 0x400[3:2] = 10b // Set GMII
- Set MAC register 0x400[1] = 0 // Force full-duplex operation
PHY Configuration Auto-Negotiation (10/100/1000 Speed with Half and Full
Duplex Support)
Basic PHY pseudo-code:
• Enable 10/100/1000 PHY loopback mode
• Enable/disable Auto-MDI crossover
• Enable auto-negotiation
• Forced 10/100/1000 link speeds
-------------------
PHY Reset Procedure
-------------------
uint16_t val16;
// Initiate PHY reset by setting 0x00[15] = 1
phy_write(0x00, 0x8000);
// Wait up to 100ms for 0x00[15] = 0
for (int i = 0; i < 100; i++) {
val16 = phy_read(0x00);
if ((val16 & 0x8000) == 0)
break;
// Delay for 1ms
delay_us(1000);
}
----------------------
PHY Loopback Procedure
----------------------
// Force link down by enabling loopback
phy_write(0x00, (1 << 14));
// Wait up to 15ms for link to drop
for (int i = 0; i < 15000; i++) {
if ((phy_read(0x01) & (1 << 4) == 0)
break;
// Wait 10us
delay_us(10);
}