Bring back Qualcomm Atheros WiFi card without reboot

I have Qualcomm Atheros QCA9377 in my laptop. Its a faulty WiFi card and when you suspend the laptop there is chance that this card will fail to wake up again.

You will usually see this kinda messages in dmesg

[ 2531.129372] ath10k_pci 0000:03:00.0: failed to wake target for read32 at 0x0003a028: -110
[ 2531.161648] ath10k_pci 0000:03:00.0: failed to wake target for read32 at 0x0003a028: -110
[ 2531.193844] ath10k_pci 0000:03:00.0: failed to wake target for read32 at 0x0003a028: -110
[ 2531.226087] ath10k_pci 0000:03:00.0: failed to wake target for read32 at 0x0003a028: -110
[ 2531.258337] ath10k_pci 0000:03:00.0: failed to wake target for read32 at 0x0003a028: -110
[ 2531.290679] ath10k_pci 0000:03:00.0: failed to wake target for read32 at 0x0003a028: -110
[ 2531.322957] ath10k_pci 0000:03:00.0: failed to wake target for read32 at 0x0003a028: -110
[ 2531.355247] ath10k_pci 0000:03:00.0: failed to wake target for read32 at 0x0003a028: -110
[ 2531.387576] ath10k_pci 0000:03:00.0: failed to wake target for read32 at 0x0003a028: -110
[ 2531.419842] ath10k_pci 0000:03:00.0: failed to wake target for read32 at 0x0003a028: -110
[ 2531.907388] ath10k_pci 0000:03:00.0: failed to read device register, device is gone
[ 2532.005008] ath10k_pci 0000:03:00.0: failed to reset chip: -5
[ 2532.005012] ath10k_pci 0000:03:00.0: Could not init hif: -5
[ 2532.005055] ath10k_pci 0000:03:00.0: firmware crashed! (guid e0cd4ca0-0969-45df-807b-3f07dfbf66b6)

It also fails sometimes when laptop completely powered off and I freshly boot my laptop.

I searched for it multiple times and on multiple forums and sites, I found a common solution which is too turn off WiFi when you sleep the laptop and turn it back on when you wake up.

Some suggested to remove the module ath10k_pci before sleep and load it again on wake while some suggested to turn off power saving mode of NetworkManager.

None of it was working for me and neither for some guys at bugzilla.kernel.org

This bug is finally marked as hardware bug in bugzilla and you should just get replacement WiFi card like from Intel

For me, I cant buy right now new WiFi card. So I resorted to find other hacks.

After so much trying, I found a new workaround.

The key is too completely, remove the WiFi card from pci list.

echo "1" | sudo tee /sys/bus/pci/devices/0000:03:00.0/remove

0000:03:00.0 is the pci id of my WiFi card which I found with this command

lspci | grep Atheros

And now tell linux to rescan the pci to add the device again

echo "1" | sudo tee /sys/bus/pci/rescan 

This sometimes does not work and you have to suspend and resume laptop again. But hey, at least you don’t have to completely reboot the laptop