summaryrefslogtreecommitdiff
path: root/chip/stm32/spi.c
diff options
context:
space:
mode:
Diffstat (limited to 'chip/stm32/spi.c')
-rw-r--r--chip/stm32/spi.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/chip/stm32/spi.c b/chip/stm32/spi.c
index 21984618be..abb86940a4 100644
--- a/chip/stm32/spi.c
+++ b/chip/stm32/spi.c
@@ -617,6 +617,7 @@ DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, spi_chipset_shutdown, HOOK_PRIO_DEFAULT);
static void spi_init(void)
{
stm32_spi_regs_t *spi = STM32_SPI1_REGS;
+ uint8_t was_enabled = enabled;
/* Reset the SPI Peripheral to clear any existing weird states. */
/* Fix for bug chrome-os-partner:31390 */
@@ -646,8 +647,11 @@ static void spi_init(void)
gpio_enable_interrupt(GPIO_SPI1_NSS);
- /* If chipset is already on, prepare for transactions */
- if (chipset_in_state(CHIPSET_STATE_ON))
+ /*
+ * If we were already enabled or chipset is already on,
+ * prepare for transaction
+ */
+ if (was_enabled || chipset_in_state(CHIPSET_STATE_ON))
spi_chipset_startup();
}
DECLARE_HOOK(HOOK_INIT, spi_init, HOOK_PRIO_DEFAULT);