Solved: Problems with connecting ath9k to 802.11n network

So, I was at a friends house and tried to connect my Qualcomm Atheros AR9285 Wireless Network Adapter (ath9k driver on linux) to their wireless network (D-link DIR-615). It was connecting and then 10 seconds later disconnecting without ever properly establishing a connection. Output as below:

[ 6350.957601] wlan0: authenticate with XXX
[ 6350.971542] wlan0: send auth to XXX (try 1/3)
[ 6350.973230] wlan0: authenticated
[ 6350.976927] wlan0: associate with XXX (try 1/3)
[ 6350.980936] wlan0: RX AssocResp from XXX (capab=0xc31 status=0 aid=3)
[ 6350.981006] wlan0: associated
[ 6350.981376] cfg80211: Calling CRDA for country: GB
[ 6350.984168] ath: EEPROM regdomain: 0x833a
[ 6350.984172] ath: EEPROM indicates we should expect a country code
[ 6350.984174] ath: doing EEPROM country->regdmn map search
[ 6350.984175] ath: country maps to regdmn code: 0x37
[ 6350.984177] ath: Country alpha2 being used: GB
[ 6350.984178] ath: Regpair used: 0x37
[ 6350.984179] ath: regdomain 0x833a dynamically updated by country IE
[ 6350.984207] cfg80211: Regulatory domain changed to country: GB
[ 6350.984209] cfg80211:  DFS Master region: unset
[ 6350.984210] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[ 6350.984213] cfg80211:   (2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[ 6350.984215] cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[ 6350.984217] cfg80211:   (5250000 KHz - 5330000 KHz @ 40000 KHz), (N/A, 2000 mBm), (0 s)
[ 6350.984218] cfg80211:   (5490000 KHz - 5710000 KHz @ 40000 KHz), (N/A, 2700 mBm), (0 s)
[ 6350.984220] cfg80211:   (57240000 KHz - 65880000 KHz @ 2160000 KHz), (N/A, 4000 mBm), (N/A)
[ 6360.987225] wlan0: deauthenticating from XXX by local choice (Reason: 3=DEAUTH_LEAVING)

Not very nice. I browsed around on the internet but couldn’t find anything obvious, eventually by looking at the different options the ath9k kernel driver accepts I found the ath9k_hw_btcoex_disable option which seems to do the trick.

echo options ath9k nohwcrypt=1 ath9k_hw_btcoex_disable > /etc/modprobe.d/ath9k.conf
sudo rmmod ath9k ath9k_hw ath9k_common
sudo modprobe -v ath9k ath9k_hw ath9k_common

and it all works again.