fix build with cpu without USB_CLK_RECOVER using old dcd_khci driver

This commit is contained in:
hathach
2024-02-24 00:53:05 +07:00
parent 354998e96c
commit 65a2e5cdf8
2 changed files with 5 additions and 1 deletions

View File

@@ -270,15 +270,19 @@ void dcd_init(uint8_t rhport)
(void) rhport;
// save crystal-less setting (recovery clock)
#ifdef USB_CLK_RECOVER_IRC_EN_IRC_EN
uint32_t clk_recover_irc_en = KHCI->CLK_RECOVER_IRC_EN;
uint32_t clk_recover_ctrl = KHCI->CLK_RECOVER_CTRL;
#endif
KHCI->USBTRC0 |= USB_USBTRC0_USBRESET_MASK;
while (KHCI->USBTRC0 & USB_USBTRC0_USBRESET_MASK);
// restore crystal-less setting
#ifdef USB_CLK_RECOVER_IRC_EN_IRC_EN
KHCI->CLK_RECOVER_IRC_EN = clk_recover_irc_en;
KHCI->CLK_RECOVER_CTRL |= clk_recover_ctrl;
#endif
tu_memclr(&_dcd, sizeof(_dcd));
KHCI->USBTRC0 |= TU_BIT(6); /* software must set this bit to 1 */