X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;ds=sidebyside;f=target_firmware%2Fmagpie_fw_dev%2Ftarget%2Finit%2Finit.c;h=3554656a7616b53ac829f9f03f90906d631a9676;hb=857dfa0da967914f30505f53950dfa6e18957bed;hp=922cf6a9638d0360b6cd87bb36ac41fdd47e8394;hpb=8804cc94e3b66550797279f540b960d18a78421f;p=open-ath9k-htc-firmware.git diff --git a/target_firmware/magpie_fw_dev/target/init/init.c b/target_firmware/magpie_fw_dev/target/init/init.c index 922cf6a..3554656 100755 --- a/target_firmware/magpie_fw_dev/target/init/init.c +++ b/target_firmware/magpie_fw_dev/target/init/init.c @@ -1,10 +1,44 @@ +/* + * Copyright (c) 2013 Qualcomm Atheros, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted (subject to the limitations in the + * disclaimer below) provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Qualcomm Atheros nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE + * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT + * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #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); @@ -26,7 +60,7 @@ uint32_t idle_cnt = 0; #if defined(PROJECT_K2) // save the ROM printf function point -uint32_t save_cmnos_printf; +int (* save_cmnos_printf)(const char * fmt, ...); #endif #define ATH_DATE_STRING __DATE__" "__TIME__ @@ -52,7 +86,7 @@ void fatal_exception_func() void change_magpie_clk(void) { - volatile uint32_t i=0, rd_data; + volatile uint32_t rd_data; HAL_WORD_REG_WRITE(0x00056004, 0x11); rd_data = HAL_WORD_REG_READ(0x00056004) & 0x1; @@ -111,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)); @@ -132,9 +166,12 @@ void exception_reset(struct register_dump_s *dump) MAGPIE_REG_USB_RX1_SWAP_DATA = 0x1; MAGPIE_REG_USB_RX2_SWAP_DATA = 0x1; - A_PRINTF("Jump to BOOT\n"); - - // reboot..... + A_PRINTF("Cold reboot initiated."); +#if defined(PROJECT_MAGPIE) + HAL_WORD_REG_WRITE(WATCH_DOG_MAGIC_PATTERN_ADDR, 0); +#elif defined(PROJECT_K2) + HAL_WORD_REG_WRITE(MAGPIE_REG_RST_STATUS_ADDR, 0); +#endif /* #if defined(PROJECT_MAGPIE) */ A_USB_JUMP_BOOT(); } @@ -184,7 +221,6 @@ void AR6002_fatal_exception_handler_patch(CPU_exception_frame_t *exc_frame) { struct register_dump_s dump; - void (*reset_func)(void) = (void*)(RESET_VECTOR_ADDRESS); uint32_t exc_cause, exc_vaddr; asm volatile("rsr %0,%1" : "=r" (exc_cause) : "n" (EXCCAUSE)); asm volatile("rsr %0,%1" : "=r" (exc_vaddr) : "n" (EXCVADDR)); @@ -346,17 +382,9 @@ void wlan_task(void) A_TASKLET_RUN(); A_TIMER_RUN(); - /* Low priority tasks */ - if ((loop_low & 0xf) == 0) { - } - /* Very low priority tasks */ - if ((loop_low & 0xfff) == 0x7) { - if ((loop_low & 0x1000) == 0) { - A_DBG_TASK(); - } else { - } - } + if ((loop_low & 0x1fff) == 0x7) + A_DBG_TASK(); idle_task(); }