static void _fw_power_off() { /* * 1. set CPU bypass * 2. turn off CPU PLL * 3. turn off ETH PLL * 4. disable ETH PLL bypass and update * 4.1 set suspend timeout * 5. set SUSPEND_ENABLE */ iowrite32(MAGPIE_REG_CPU_PLL_BYPASS_ADDR, BIT0 | BIT4); A_DELAY_USECS(100); // wait for stable iowrite32(MAGPIE_REG_CPU_PLL_ADDR, BIT16); A_DELAY_USECS(100); // wait for stable A_UART_HWINIT((40*1000*1000), 19200); A_CLOCK_INIT(40); io32_set(MAGPIE_REG_ETH_PLL_ADDR, BIT16); io32_set(MAGPIE_REG_ETH_PLL_BYPASS_ADDR, BIT4 | BIT0); io32_set(MAGPIE_REG_SUSPEND_ENABLE_ADDR, 0x10 << 8); }
void _fw_usb_suspend_reboot() { /* reset usb/wlan dma */ _fw_reset_dma_fifo(); /* restore gpio setting and usb/wlan dma state */ _fw_restore_dma_fifo(); /* set clock to bypass mode - 40Mhz from XTAL */ iowrite32(MAGPIE_REG_CPU_PLL_BYPASS_ADDR, BIT0 | BIT4); A_DELAY_USECS(100); /* wait for stable */ iowrite32(MAGPIE_REG_CPU_PLL_ADDR, BIT16); A_DELAY_USECS(100); /* wait for stable */ A_UART_HWINIT((40*1000*1000), 19200); A_CLOCK_INIT(40); if (!bEepromExist) { /* jump to flash boot (eeprom data in flash) */ bJumptoFlash = TRUE; A_PRINTF("Jump to Flash BOOT\n"); app_start(); } else { A_PRINTF("receive the suspend command...\n"); /* reboot..... */ A_USB_JUMP_BOOT(); } }
void _fw_usbfifo_recv_command(VBUF *buf) { A_UINT8 *cmd_data; A_UINT32 tmp; cmd_data = (A_UINT8 *)(buf->desc_list->buf_addr + buf->desc_list->data_offset); tmp = *((A_UINT32 *)cmd_data); if ( tmp == 0xFFFFFFFF ) { // reset usb/wlan dma _fw_reset_dma_fifo(); // restore gpio setting and usb/wlan dma state _fw_restore_dma_fifo(); // set clock to bypass mode - 40Mhz from XTAL HAL_WORD_REG_WRITE(MAGPIE_REG_CPU_PLL_BYPASS_ADDR, (BIT0|BIT4)); A_DELAY_USECS(100); // wait for stable HAL_WORD_REG_WRITE(MAGPIE_REG_CPU_PLL_ADDR, (BIT16)); A_DELAY_USECS(100); // wait for stable A_UART_HWINIT((40*1000*1000), 19200); A_CLOCK_INIT(40); if (!bEepromExist) { //jump to flash boot (eeprom data in flash) bJumptoFlash = TRUE; A_PRINTF("Jump to Flash BOOT\n"); app_start(); }else{ A_PRINTF("receive the suspend command...\n"); // reboot..... A_USB_JUMP_BOOT(); } } else { m_origUsbfifoRecvCmd(buf); } }