stm32h7:SDMMC fix reset of do_gpio

For the case when the watchdog is triggering a timeout we did not
correctly reset the d0 GPIO.

Without this fix, the SD card can become inaccessible.
This commit is contained in:
David Sidrane 2021-06-29 10:58:08 -07:00 committed by Xiang Xiao
parent 6d6ca8f0b6
commit 3439c40044

View File

@ -795,12 +795,8 @@ static void stm32_configwaitints(struct stm32_dev_s *priv, uint32_t waitmask,
flags = enter_critical_section();
#if defined(CONFIG_MMCSD_SDIOWAIT_WRCOMPLETE)
if ((waitmask & SDIOWAIT_WRCOMPLETE) != 0)
if ((waitevents & SDIOWAIT_WRCOMPLETE) != 0)
{
/* Do not use this in STM32_SDMMC_MASK register */
waitmask &= ~SDIOWAIT_WRCOMPLETE;
pinset = priv->d0_gpio & (GPIO_PORT_MASK | GPIO_PIN_MASK | \
GPIO_PUPD_MASK);
pinset |= (GPIO_INPUT | GPIO_EXTI);
@ -1463,8 +1459,13 @@ static void stm32_eventtimeout(wdparm_t arg)
{
/* Yes.. wake up any waiting threads */
#ifdef CONFIG_MMCSD_SDIOWAIT_WRCOMPLETE
stm32_endwait(priv, SDIOWAIT_TIMEOUT |
(priv->waitevents & SDIOWAIT_WRCOMPLETE));
#else
stm32_endwait(priv, SDIOWAIT_TIMEOUT);
mcerr("Timeout: remaining: %u\n", priv->remaining);
#endif
mcerr("Timeout: remaining: %zu\n", priv->remaining);
}
}
@ -2829,11 +2830,7 @@ static void stm32_waitenable(FAR struct sdio_dev_s *dev,
if (stm32_gpioread(priv->d0_gpio))
{
eventset &= ~SDIOWAIT_TIMEOUT;
}
else
{
waitmask = SDIOWAIT_WRCOMPLETE;
eventset &= ~(SDIOWAIT_TIMEOUT | SDIOWAIT_WRCOMPLETE);
}
}
else
@ -2944,7 +2941,7 @@ static sdio_eventset_t stm32_eventwait(FAR struct sdio_dev_s *dev)
if ((priv->waitevents & SDIOWAIT_WRCOMPLETE) != 0)
{
/* Atomically read pin to see if ready (true) and determine if ISR
* fired. If Pin is ready and if ISR did NOT fire end the wait here
* fired. If Pin is ready and if ISR did NOT fire end the wait here.
*/
if (stm32_gpioread(priv->d0_gpio) &&