+static void handle_download_exception(void)
+{
+ struct dma_desc *desc, *target;
+
+ /* actually, the queue should be stopped by now? */
+ usb_stop_down_queue();
+
+ target = (void *)((get(AR9170_PTA_REG_DN_CURR_ADDRH) << 16) |
+ get(AR9170_PTA_REG_DN_CURR_ADDRL));
+
+ /*
+ * Put "forgotten" packets from the head of the queue, back
+ * to the current position
+ */
+ __while_desc_bits(desc, &fw.pta.down_queue, AR9170_OWN_BITS_HW) {
+ if (desc == target)
+ break;
+
+ dma_reclaim(&fw.pta.down_queue,
+ dma_unlink_head(&fw.pta.down_queue));
+ }
+
+ __for_each_desc_continue(desc, &fw.pta.down_queue) {
+ if ((desc->status & AR9170_OWN_BITS) == AR9170_OWN_BITS_SW)
+ dma_fix_downqueue(desc);
+ }
+
+
+ usb_start_down_queue();
+
+ down_trigger();
+}
+