carl9170 firmware: reset PTA-DMA registers before reboot
authorChristian Lamparter <chunkeey@googlemail.com>
Mon, 6 Dec 2010 12:22:42 +0000 (13:22 +0100)
committerChristian Lamparter <chunkeey@googlemail.com>
Mon, 6 Dec 2010 12:24:30 +0000 (13:24 +0100)
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
carlfw/usb/main.c

index 6545ec0931180e709936c264afb8394d4ed52a14..48ece0e99d4455119229ed584b7908c686d02583 100644 (file)
@@ -224,6 +224,17 @@ static void turn_power_off(void)
 
        set(AR9170_MAC_REG_DMA_TRIGGER, 0);
 
+       andl(AR9170_USB_REG_DMA_CTL, ~(AR9170_USB_DMA_CTL_ENABLE_TO_DEVICE |
+                                      AR9170_USB_DMA_CTL_ENABLE_FROM_DEVICE |
+                                      AR9170_USB_DMA_CTL_UP_PACKET_MODE |
+                                      AR9170_USB_DMA_CTL_DOWN_STREAM));
+
+       /* Do a software reset to PTA component */
+       orl(AR9170_PTA_REG_DMA_MODE_CTRL, AR9170_PTA_DMA_MODE_CTRL_RESET);
+       andl(AR9170_PTA_REG_DMA_MODE_CTRL, ~AR9170_PTA_DMA_MODE_CTRL_RESET);
+
+       orl(AR9170_PTA_REG_DMA_MODE_CTRL, AR9170_PTA_DMA_MODE_CTRL_DISABLE_USB);
+
        set(AR9170_MAC_REG_POWER_STATE_CTRL,
            AR9170_MAC_POWER_STATE_CTRL_RESET);
 
@@ -272,8 +283,6 @@ static void turn_power_off(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);