chipphywr(phyaddr, reg, v)
write v to phy
- if corerev is 0x80000000
- set phycontrol_addr to address of gmac common reg phycontrol
- set phyaccess_addr to address of gmac common reg phyaccess
- else
- set phycontrol_addr to address of gmac core reg phycontrol
- set phyaccess_addr to address of gmac core reg phyaccess
- write value from address phycontrol_addr into tmp
- binary and tmp with negation of 0x1f
- binary or tmp with phyaddr
- write tmp into reg at address phycontrol_addr
- write I_MDIO into gmac core reg intstatus
- write PA_START to tmp
- binary or tmp with PA_WRITE
- binary or tmp with phyaddr shifted by PA_ADDR_SHIFT bytes
- binary or tmp with reg shifted by PA_REG_SHIFT bytes
- binary or tmp with v
- write tmp into reg at address phyaccess_addr
- Spinwait until reg at address phyaccess_addr has bit PA_START unset, at most 1000 usecs, with a delay of 10 usecs
- if reg at address phyaccess_addr has bit PA_START set
- write error message to log