Commit c67d3081 authored by Federico Vaga's avatar Federico Vaga

sw:drv:spi: add is_busy helper

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 014947bc
......@@ -569,6 +569,13 @@ static void spi_ocores_finalize_current_message(struct spi_ocores *sp)
}
static bool spi_ocores_is_busy(struct spi_ocores *sp)
{
uint32_t ctrl = sp->read(sp, SPI_OCORES_CTRL);
return (ctrl & SPI_OCORES_CTRL_BUSY);
}
/**
* Process an SPI transfer
* @sp: SPI OCORE controller
......@@ -577,9 +584,7 @@ static void spi_ocores_finalize_current_message(struct spi_ocores *sp)
*/
static int spi_ocores_process(struct spi_ocores *sp)
{
uint32_t ctrl = sp->read(sp, SPI_OCORES_CTRL);
if (ctrl & SPI_OCORES_CTRL_BUSY)
if (spi_ocores_is_busy(sp))
return -ENODATA;
spi_ocores_hw_xfer_rx_pop(sp);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment