How do you grant PHY address when 32 PHYs are attached on same MDC/MDIO?
You can do this by using four separate RESET signals (RESET_0, RESET_1, RESET_2, RESET_3). The total MDC/MDIO address space is five bits, but the KSZ8061 (like our other PHYs) has three PHYADDR strapping pins for setting the three LSB address bits. The two MSB address bits default to '00', but they can be changed by writing to bits 9-8 in register 18h.
- Divide the 32 PHYs into four groups. Within each group, there are 8 PHYs. All PHYs in a group get the same RESET signal. A different RESET signals goes to each group.
- Within each group, set the strapping options so that each PHY has a unique address (5'b00000 to 5'b00111).
- Initially, all RESET signals are low (all PHYS are in reset).
- Release RESET_3.
- For each PHY in this group, write to register 18h and set bits 9-8 to '11'.
- Keep RESET_3 high. Now these PHYs are address 5'b11111 to 5'b11000.
- Release RESET_2.
- For each PHY in this group, write to register 18h and set bits 9-8 to '10'.
- Keep RESET_2 high. Now these PHYs are address 5'b10111 to 5'b10000.
- Release RESET_1.
- For each PHY in this group, write to register 18h and set bits 9-8 to '01'.
- Keep RESET_1 high. Now these PHYs are address 5'b01111 to 5'b01000.
- Release RESET_0.
- Do not write to register 18h for this group. (These PHYs are address 5'b00111 to 5'b00000).