Commit 2747bef2 authored by Federico Vaga's avatar Federico Vaga

sw:drv:spi: do not push if empty TX buffer

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent af000639
......@@ -195,6 +195,9 @@ static void spi_ocores_hw_xfer_tx_push8(struct spi_ocores *sp)
{
uint32_t data;
if (!sp->cur_tx_buf)
return;
data = *((uint8_t *)sp->cur_tx_buf);
sp->cur_tx_buf += 1;
spi_ocores_tx_set(sp, 0, data);
......@@ -205,6 +208,9 @@ static void spi_ocores_hw_xfer_tx_push16(struct spi_ocores *sp)
{
uint32_t data;
if (!sp->cur_tx_buf)
return;
data = *((uint16_t *)sp->cur_tx_buf);
sp->cur_tx_buf += 2;
spi_ocores_tx_set(sp, 0, data);
......@@ -215,6 +221,9 @@ static void spi_ocores_hw_xfer_tx_push32(struct spi_ocores *sp)
{
uint32_t data;
if (!sp->cur_tx_buf)
return;
data = *((uint32_t *)sp->cur_tx_buf);
sp->cur_tx_buf += 4;
spi_ocores_tx_set(sp, 0, data);
......@@ -225,6 +234,9 @@ static void spi_ocores_hw_xfer_tx_push64(struct spi_ocores *sp)
{
int i;
if (!sp->cur_tx_buf)
return;
for (i = 0; i < 2; ++i) {
uint32_t data;
......@@ -239,6 +251,9 @@ static void spi_ocores_hw_xfer_tx_push128(struct spi_ocores *sp)
{
int i;
if (!sp->cur_tx_buf)
return;
for (i = 0; i < 4; ++i) {
uint32_t data;
......
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