The code in ath_if.c will not allow you to set diversity if XR is enabled (according to the comment) however its not checking the state of XR correctly. Instead of seeing if XR is enabled on any VAP (as its a per vap stat) it checks to see if the card is 'XR capable' which is not the right thing to do. Additionally if a chipset supports diversity it will be enabled by default without any dependence on XR which is inconsistent.
I don't see any reason to have this dependence on XR. With the current code if you have an XR capable card diversity will be defaulted on. You can turn it off, but you will never be able to turn it on again.
The patch attached will remove the dependence upon XR