mgmt: ec_host_cmd: stm32_spi: fix cs interrupt configuration
Move enabling CS interrupt at the end of the backend configuration, when everything is ready. It prevents handling the interrupt, when something is not prepared e.g. DMA is not configured. Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
This commit is contained in:
parent
c7bebc669f
commit
21c12786ec
1 changed files with 5 additions and 4 deletions
|
@ -706,10 +706,6 @@ static int ec_host_cmd_spi_init(const struct ec_host_cmd_backend *backend,
|
|||
return -EIO;
|
||||
}
|
||||
|
||||
gpio_init_callback(&hc_spi->cs_callback, gpio_cb_nss, BIT(hc_spi->cs.pin));
|
||||
gpio_add_callback(hc_spi->cs.port, &hc_spi->cs_callback);
|
||||
gpio_pin_interrupt_configure(hc_spi->cs.port, hc_spi->cs.pin, GPIO_INT_EDGE_BOTH);
|
||||
|
||||
hc_spi->rx_ctx = rx_ctx;
|
||||
hc_spi->rx_ctx->len = 0;
|
||||
|
||||
|
@ -746,6 +742,11 @@ static int ec_host_cmd_spi_init(const struct ec_host_cmd_backend *backend,
|
|||
tx_status(spi, EC_SPI_RX_READY);
|
||||
hc_spi->state = SPI_HOST_CMD_STATE_READY_TO_RX;
|
||||
|
||||
/* Configure CS interrupt once everything is ready. */
|
||||
gpio_init_callback(&hc_spi->cs_callback, gpio_cb_nss, BIT(hc_spi->cs.pin));
|
||||
gpio_add_callback(hc_spi->cs.port, &hc_spi->cs_callback);
|
||||
gpio_pin_interrupt_configure(hc_spi->cs.port, hc_spi->cs.pin, GPIO_INT_EDGE_BOTH);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue