add new ZM_SOC_USB_DMA_RESET_OFFSET register
authorOleksij Rempel <linux@rempel-privat.de>
Mon, 30 Sep 2013 18:58:28 +0000 (20:58 +0200)
committerOleksij Rempel <linux@rempel-privat.de>
Mon, 30 Sep 2013 19:16:51 +0000 (21:16 +0200)
add and use ZM_SOC_USB_DMA_RESET_OFFSET
instead if magic number 0x118

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
target_firmware/magpie_fw_dev/build/magpie_1_1/inc/usb_defs.h
target_firmware/magpie_fw_dev/target/hif/usb_api_k2_patch.c
target_firmware/magpie_fw_dev/target/hif/usb_api_magpie_patch.c
target_firmware/magpie_fw_dev/target/inc/k2/usb_defs.h
target_firmware/magpie_fw_dev/target/init/init.c

index 5b9ccce0166fc43168e4e5baf704dbc6a28ac545..109071a20ed7d960ce9fe5dfccb25f604f68e912 100755 (executable)
 #define ZM_SOC_USB_MODE_CTRL_OFFSET      0x108
 #define ZM_SOC_USB_MAX_AGGREGATE_OFFSET  0x110
 #define ZM_SOC_USB_TIME_CTRL_OFFSET      0x114
+#define ZM_SOC_USB_DMA_RESET_OFFSET      0x118
 
 #define ZM_ADDR_CONV                     0x0
 
index 48f55657ddb03ed731dc4ff8f7edc764e87e20b2..62c3a51f7cbd813adc6ceac3657a95466a91aad2 100755 (executable)
@@ -332,8 +332,7 @@ void _fw_usb_reset_fifo(void)
         * *reg_data = 0x00000001;
         * because of Hardware bug in K2
         */
-       reg_data = (uint32_t *)(USB_CTRL_BASE_ADDRESS + 0x118);
-       *reg_data = 0x00000000;
+       USB_WORD_REG_WRITE(ZM_SOC_USB_DMA_RESET_OFFSET, 0x0);
 
        /* reset both usb(bit2)/wlan(bit1) dma */
        HAL_WORD_REG_WRITE(MAGPIE_REG_RST_PWDN_CTRL_ADDR, (BIT2));
@@ -341,7 +340,7 @@ void _fw_usb_reset_fifo(void)
                        (HAL_WORD_REG_READ(MAGPIE_REG_RST_PWDN_CTRL_ADDR)|BIT0));
        HAL_WORD_REG_WRITE(MAGPIE_REG_RST_PWDN_CTRL_ADDR, 0x0);
 
-       *reg_data = 0x00000001;
+       USB_WORD_REG_WRITE(ZM_SOC_USB_DMA_RESET_OFFSET, BIT0);
 
        /* MAC warem reset */
        //reg_data = (uint32_t *)(K2_REG_MAC_BASE_ADDR + 0x7000);
index 52c692e3074bd0d834ccd5834c12a7bbcd8b8c69..6286889baf5e0393715ad840534dac1802508889 100755 (executable)
@@ -332,15 +332,14 @@ static void _fw_reset_dma_fifo()
 
        A_DELAY_USECS(10);
 
-       // reset usb DMA controller
-       HAL_WORD_REG_WRITE((USB_CTRL_BASE_ADDRESS+0x118), 0x0);
+       /* reset usb DMA controller */
+       USB_WORD_REG_WRITE(ZM_SOC_USB_DMA_RESET_OFFSET, 0x0);
 
        HAL_WORD_REG_WRITE(0x50010, (HAL_WORD_REG_READ(0x50010)|(BIT4)));
        A_DELAY_USECS(5);
        HAL_WORD_REG_WRITE(0x50010, (HAL_WORD_REG_READ(0x50010)&(~BIT4)));
 
-
-       HAL_WORD_REG_WRITE((USB_CTRL_BASE_ADDRESS+0x118), 0x1);
+       USB_WORD_REG_WRITE(ZM_SOC_USB_DMA_RESET_OFFSET, BIT0);
 }
 
 static void _fw_power_off()
index 5b9ccce0166fc43168e4e5baf704dbc6a28ac545..109071a20ed7d960ce9fe5dfccb25f604f68e912 100755 (executable)
 #define ZM_SOC_USB_MODE_CTRL_OFFSET      0x108
 #define ZM_SOC_USB_MAX_AGGREGATE_OFFSET  0x110
 #define ZM_SOC_USB_TIME_CTRL_OFFSET      0x114
+#define ZM_SOC_USB_DMA_RESET_OFFSET      0x118
 
 #define ZM_ADDR_CONV                     0x0
 
index b6e6a4456c8b860dee9575e945f74938f34994a8..8fc464006ba7805f7d49a6b594650083c7442df1 100755 (executable)
 #if defined(_RAM_)
 
 #include "athos_api.h"
-    
+#include "usb_defs.h"
+
 #if defined(PROJECT_MAGPIE)
 #include "regdump.h"
-#include "usb_defs.h"
 extern  uint32_t *init_htc_handle;
 uint8_t htc_complete_setup = 0;
 void reset_EP4_FIFO(void);
@@ -145,12 +145,12 @@ void exception_reset(struct register_dump_s *dump)
        HAL_WORD_REG_WRITE(MAGPIE_REG_AHB_ARB_ADDR,
                           (HAL_WORD_REG_READ(MAGPIE_REG_AHB_ARB_ADDR)|BIT1));
 
-       HAL_WORD_REG_WRITE((USB_CTRL_BASE_ADDRESS+0x118), 0x0);
+       USB_WORD_REG_WRITE(ZM_SOC_USB_DMA_RESET_OFFSET, 0x0);
        HAL_WORD_REG_WRITE(0x50010, HAL_WORD_REG_READ(0x50010)|BIT4);
        A_DELAY_USECS(5);
        HAL_WORD_REG_WRITE(0x50010, HAL_WORD_REG_READ(0x50010)&~BIT4);
        A_DELAY_USECS(5);
-       HAL_WORD_REG_WRITE((USB_CTRL_BASE_ADDRESS+0x118), 0x1);
+       USB_WORD_REG_WRITE(ZM_SOC_USB_DMA_RESET_OFFSET, BIT0);
 
        // set clock to bypass mode - 40Mhz from XTAL
        HAL_WORD_REG_WRITE(MAGPIE_REG_CPU_PLL_BYPASS_ADDR, (BIT0|BIT4));