+ /*
+ * When interrupts are being enabled, the interrupt registers
+ * should clear the register to assure a clean state.
+ */
+ if (enabled) {
+ rt2x00pci_register_read(rt2x00dev, INT_SOURCE_CSR, ®);
+ rt2x00pci_register_write(rt2x00dev, INT_SOURCE_CSR, reg);
+
+ rt2x00pci_register_read(rt2x00dev, MCU_INT_SOURCE_CSR, ®);
+ rt2x00pci_register_write(rt2x00dev, MCU_INT_SOURCE_CSR, reg);
+ }
+
+ /*
+ * Only toggle the interrupts bits we are going to use.
+ * Non-checked interrupt bits are disabled by default.
+ */
+ rt2x00pci_register_read(rt2x00dev, INT_MASK_CSR, ®);
+ rt2x00_set_field32(®, INT_MASK_CSR_TXDONE, !enabled);
+ rt2x00_set_field32(®, INT_MASK_CSR_RXDONE, !enabled);
+ rt2x00_set_field32(®, INT_MASK_CSR_BEACON_DONE, !enabled);
+ rt2x00_set_field32(®, INT_MASK_CSR_ENABLE_MITIGATION, !enabled);
+ rt2x00_set_field32(®, INT_MASK_CSR_MITIGATION_PERIOD, 0xff);
+ rt2x00pci_register_write(rt2x00dev, INT_MASK_CSR, reg);
+
+ rt2x00pci_register_read(rt2x00dev, MCU_INT_MASK_CSR, ®);
+ rt2x00_set_field32(®, MCU_INT_MASK_CSR_0, !enabled);
+ rt2x00_set_field32(®, MCU_INT_MASK_CSR_1, !enabled);
+ rt2x00_set_field32(®, MCU_INT_MASK_CSR_2, !enabled);
+ rt2x00_set_field32(®, MCU_INT_MASK_CSR_3, !enabled);
+ rt2x00_set_field32(®, MCU_INT_MASK_CSR_4, !enabled);
+ rt2x00_set_field32(®, MCU_INT_MASK_CSR_5, !enabled);
+ rt2x00_set_field32(®, MCU_INT_MASK_CSR_6, !enabled);
+ rt2x00_set_field32(®, MCU_INT_MASK_CSR_7, !enabled);
+ rt2x00pci_register_write(rt2x00dev, MCU_INT_MASK_CSR, reg);
+}
+
+static int rt61pci_enable_radio(struct rt2x00_dev *rt2x00dev)
+{