From: Oleksij Rempel Date: Mon, 30 Sep 2013 18:58:28 +0000 (+0200) Subject: add new ZM_SOC_USB_DMA_RESET_OFFSET register X-Git-Tag: 1.4.0~10^2~2^2~2 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=71263b654796e63abd42f8c02a7e2542bab3fb4e;p=open-ath9k-htc-firmware.git add new ZM_SOC_USB_DMA_RESET_OFFSET register add and use ZM_SOC_USB_DMA_RESET_OFFSET instead if magic number 0x118 Signed-off-by: Oleksij Rempel --- diff --git a/target_firmware/magpie_fw_dev/build/magpie_1_1/inc/usb_defs.h b/target_firmware/magpie_fw_dev/build/magpie_1_1/inc/usb_defs.h index 5b9ccce..109071a 100755 --- a/target_firmware/magpie_fw_dev/build/magpie_1_1/inc/usb_defs.h +++ b/target_firmware/magpie_fw_dev/build/magpie_1_1/inc/usb_defs.h @@ -133,6 +133,7 @@ #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 diff --git a/target_firmware/magpie_fw_dev/target/hif/usb_api_k2_patch.c b/target_firmware/magpie_fw_dev/target/hif/usb_api_k2_patch.c index 48f5565..62c3a51 100755 --- a/target_firmware/magpie_fw_dev/target/hif/usb_api_k2_patch.c +++ b/target_firmware/magpie_fw_dev/target/hif/usb_api_k2_patch.c @@ -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); diff --git a/target_firmware/magpie_fw_dev/target/hif/usb_api_magpie_patch.c b/target_firmware/magpie_fw_dev/target/hif/usb_api_magpie_patch.c index 52c692e..6286889 100755 --- a/target_firmware/magpie_fw_dev/target/hif/usb_api_magpie_patch.c +++ b/target_firmware/magpie_fw_dev/target/hif/usb_api_magpie_patch.c @@ -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() diff --git a/target_firmware/magpie_fw_dev/target/inc/k2/usb_defs.h b/target_firmware/magpie_fw_dev/target/inc/k2/usb_defs.h index 5b9ccce..109071a 100755 --- a/target_firmware/magpie_fw_dev/target/inc/k2/usb_defs.h +++ b/target_firmware/magpie_fw_dev/target/inc/k2/usb_defs.h @@ -133,6 +133,7 @@ #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 diff --git a/target_firmware/magpie_fw_dev/target/init/init.c b/target_firmware/magpie_fw_dev/target/init/init.c index b6e6a44..8fc4640 100755 --- a/target_firmware/magpie_fw_dev/target/init/init.c +++ b/target_firmware/magpie_fw_dev/target/init/init.c @@ -35,10 +35,10 @@ #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));