diff --git a/board/qca/arm/common/cmd_bootqca.c b/board/qca/arm/common/cmd_bootqca.c index 41493843cc..f4aab67dbd 100644 --- a/board/qca/arm/common/cmd_bootqca.c +++ b/board/qca/arm/common/cmd_bootqca.c @@ -43,7 +43,6 @@ static qca_smem_flash_info_t *sfi = &qca_smem_flash_info; int ipq_fs_on_nand ; extern int nand_env_device; extern qca_mmc mmc_host; -extern void board_usb_deinit(int id); #ifdef CONFIG_QCA_MMC static qca_mmc *host = &mmc_host; @@ -426,9 +425,6 @@ static int do_boot_signedimg(cmd_tbl_t *cmdtp, int flag, int argc, char *const a disk_partition_t disk_info; unsigned int active_part = 0; #endif -#ifdef CONFIG_USB_XHCI_IPQ - int i; -#endif #ifdef CONFIG_IPQ_ELF_AUTH image_info img_info; #endif @@ -637,14 +633,6 @@ static int do_boot_signedimg(cmd_tbl_t *cmdtp, int flag, int argc, char *const a dcache_enable(); - board_pci_deinit(); -#ifdef CONFIG_USB_XHCI_IPQ - usb_stop(); - for (i=0; istate |= states; @@ -702,9 +707,17 @@ int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], } /* Now run the OS! We hope this doesn't return */ - if (!ret && (states & BOOTM_STATE_OS_GO)) + if (!ret && (states & BOOTM_STATE_OS_GO)) { + board_pci_deinit(); + +#ifdef CONFIG_USB_XHCI_IPQ + usb_stop(); + for (i = 0; i < CONFIG_USB_MAX_CONTROLLER_COUNT; i++) + board_usb_deinit(i); +#endif ret = boot_selected_os(argc, argv, BOOTM_STATE_OS_GO, images, boot_fn); + } /* Deal with any fallout */ err: