carl9170 firmware: cleanup dma memory before reset
[carl9170fw.git] / carlfw / usb / main.c
index 1a966256e2989decba5ff9be1b87fd609d71cdb5..6545ec0931180e709936c264afb8394d4ed52a14 100644 (file)
@@ -270,18 +270,23 @@ static void turn_power_off(void)
        set(AR9170_PHY_REG_ADC_SERIAL_CTL, AR9170_PHY_ADC_SCTL_SEL_INTERNAL_ADDAC);
 }
 
-void __attribute__((noreturn)) reboot(void)
+void __noreturn reboot(void)
 {
+       set(AR9170_MAC_REG_DMA_TRIGGER, 0);
+
        /* write watchdog magic pattern for suspend  */
        andl(AR9170_PWR_REG_WATCH_DOG_MAGIC, 0xffff);
        orl(AR9170_PWR_REG_WATCH_DOG_MAGIC, 0x98760000);
 
        /* Disable watchdog */
-       orl(AR9170_TIMER_REG_WATCH_DOG, 0xffff);
+       set(AR9170_TIMER_REG_WATCH_DOG, 0xffff);
 
        /* Turn off power */
        turn_power_off();
 
+       /* clean bootloader workspace */
+       memset(&dma_mem, 0, sizeof(dma_mem));
+
        /* add by ygwei for work around USB PHY chirp sequence problem */
        set(0x10f100, 0x12345678);