drivers: usb_c: tcpc: stm32: Read UCPD Status Reg for source of IRQ

At system startup, the SYSCFG ITLINE registers might not
indicate an interrupt even though a UCPD interrupt is pending.
This cause the ISR to be called repeatedly without being serviced,
resulting in a system lockup. Reading the UCPD Status Reg instead
of the SYSCFG ITLINE register fixes the issue.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
This commit is contained in:
Sam Hurst 2022-12-14 11:44:32 -08:00 committed by Carles Cufí
commit 029dc41acb

View file

@ -1023,15 +1023,24 @@ static void ucpd_isr(const struct device *dev_inst[])
*/
uint32_t ucpd_base;
uint32_t sr0;
uint32_t sr1;
/*
* Since the UCPD peripherals share the same interrupt line, determine
* which one generated the interrupt.
*/
if (LL_SYSCFG_IsActiveFlag_UCPD1()) {
/* Read UCPD1 Status Register */
sr0 = LL_UCPD_ReadReg(((const struct tcpc_config *)dev_inst[0]->config)->ucpd_port, SR);
/* Read UCPD2 Status Register */
sr1 = LL_UCPD_ReadReg(((const struct tcpc_config *)dev_inst[1]->config)->ucpd_port, SR);
if (sr0) {
/* UCPD1 interrupt is pending */
ucpd_base = UCPD1_BASE;
} else if (LL_SYSCFG_IsActiveFlag_UCPD2()) {
} else if (sr1) {
/* UCPD2 interrupt is pending */
ucpd_base = UCPD2_BASE;
} else {