int PHY Antenna RX Diversity Set (u32 val)
- If this is a N PHY
- Return 0 as antenna diversity is not implemented for N PHY
- Else if this is an LP PHY
If the PHY revision >= 2
- Return 0
If val > 1
Set bit 2 in PHY Register 0x410
- If val is 2
Set bit 1 in PHY Register 0x410
- Otherwise
Clear bit 1 in PHY Register 0x410
- Otherwise
Clear bit 2 in PHY Register 0x410
MaskSet PHY Register 0x410 with mask 0xFFFE and set with val
- Else if this is an A or G PHY
- If an A PHY
- Set the offset to 0
- Otherwise
- Set the offset to 0x400
Read PHY Register (offset + 1), mask with 0xFE7F, and save in tmp1
If val > 1
- Bitwise OR tmp1 with 0x0180 and save in tmp1
- Otherwise
- Bitwise OR tmp1 with (val left shifted by 7 and masked with 0x0180) and save in tmp1
Write tmp1 to PHY Register (offset + 1)
If val > 1
Read PHY Register (offset + 0x2B), mask with 0xFEFF, and save as tmp2
- If val == 2
- Set bit 0x0100 in tmp2
Write tmp2 to PHY Register (offset + 0x2B)
- If this is a G PHY
Read PHY Register 0x48C, mask with 0xDFFF and save as tmp1
If val > 1
- Set bit 0x2000 in tmp1
Write tmp1 to PHY Register 0x48C
If the PHY revision > 1
Set bit 0x0010 in PHY Register 0x461
MaskSet PHY Register 0x4AD with mask 0xFF00 and set with 0x0015
- If the PHY revision is 2
Write 8 to PHY Register 0x427
- Otherwise
MaskSet PHY Register 0x427 with mask 0xFF00 and set with 0x0008
If the PHY revision >= 6
Write 0x00DC to PHY Register 0x49B
- Otherwise (Note: this is an A PHY)
If PHY revision > 2
Set bit 0x0010 in PHY Register 0x61
- If PHY revision = 3
Write 0x001D to PHY Register 0x93
Write 0x0008 to PHY Register 0x27
- Otherwise
Write 0x003A to PHY Register 0x93
MaskSet PHY Register 0x27 with mask 0xFF00 and set with 0x0008
- Otherwise
MaskSet PHY Register 0x2B with mask 0xFF00 and set with 0x0024
- If an A PHY
- Otherwise
- Error for unsupported PHY
- Return 1