From dbbb809d592dde0b3c9ecb97b3b387ff8e40e799 Mon Sep 17 00:00:00 2001 From: Oleksij Rempel Date: Wed, 24 Jul 2013 10:26:18 +0200 Subject: [PATCH] k2_fw_usb_api: workaround for EP4 bug. This patch is workaround for xhci related issue. After usb port resume FIFO on EP4 can't accept Bulck stream longer then 64 Bytes. Currently we have no better way then just completly reset chip. Side effect of this workaround - disconnection event for this device. It means, module will be reloaded and we will get new usb minor id. This is why, we should not do it on each firmware restart. Signed-off-by: Oleksij Rempel --- .../magpie_fw_dev/target/hif/k2_fw_usb_api.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/target_firmware/magpie_fw_dev/target/hif/k2_fw_usb_api.c b/target_firmware/magpie_fw_dev/target/hif/k2_fw_usb_api.c index 0be8a87..83a72a9 100755 --- a/target_firmware/magpie_fw_dev/target/hif/k2_fw_usb_api.c +++ b/target_firmware/magpie_fw_dev/target/hif/k2_fw_usb_api.c @@ -402,6 +402,17 @@ void _fw_usb_reset_fifo(void) A_UART_HWINIT((22*1000*1000), 19200); } +void cold_reboot(void) +{ + 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(); +} + /* * -- support more than 64 bytes command on ep4 -- */ @@ -420,7 +431,7 @@ void vUsb_Reg_Out_patch(void) usbfifolen = USB_BYTE_REG_READ(ZM_EP4_BYTE_COUNT_LOW_OFFSET); if (usbfifolen > 0x40) { A_PRINTF("EP4 FIFO Bug? Buffer is too big: %x\n", usbfifolen); - goto ERR; + cold_reboot(); } // check is command is new -- 2.31.1