Skip to content

Commit

Permalink
spi: cadence_qspi: Split indirect read functionality
Browse files Browse the repository at this point in the history
This patch splits indirect read functionality as dma changes.

Signed-off-by: T Karthik Reddy <[email protected]>
Signed-off-by: Michal Simek <[email protected]>
State: pending
  • Loading branch information
T Karthik Reddy authored and Michal Simek committed Jan 23, 2020
1 parent 3a79939 commit a4a6f46
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
8 changes: 6 additions & 2 deletions drivers/spi/cadence_qspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,12 @@ static int cadence_spi_xfer(struct udevice *dev, unsigned int bitlen,
err = cadence_qspi_apb_indirect_read_setup(plat,
priv->cmd_len, dm_plat->mode, cmd_buf);
if (!err) {
err = cadence_qspi_apb_indirect_read_execute
(plat, data_bytes, din);
if (plat->is_dma)
err = cadence_qspi_apb_dma_read(plat,
data_bytes, din);
else
err = cadence_qspi_apb_indirect_read_execute(plat,
data_bytes, din);
}
break;
case CQSPI_INDIRECT_WRITE:
Expand Down
11 changes: 0 additions & 11 deletions drivers/spi/cadence_qspi_apb.c
Original file line number Diff line number Diff line change
Expand Up @@ -765,20 +765,10 @@ int cadence_qspi_apb_indirect_read_execute(struct cadence_spi_platdata *plat,

writel(n_rx, plat->regbase + CQSPI_REG_INDIRECTRDBYTES);

if (plat->is_dma)
cadence_qspi_apb_dma_read(plat, n_rx, rxbuf);

/* Start the indirect read transfer */
writel(CQSPI_REG_INDIRECTRD_START,
plat->regbase + CQSPI_REG_INDIRECTRD);

if (plat->is_dma) {
ret = cadence_qspi_apb_wait_for_dma_cmplt(plat);
if (ret)
return ret;
goto rd_done;
}

while (remaining > 0) {
ret = cadence_qspi_wait_for_data(plat);
if (ret < 0) {
Expand Down Expand Up @@ -807,7 +797,6 @@ int cadence_qspi_apb_indirect_read_execute(struct cadence_spi_platdata *plat,
}
}

rd_done:
/* Check indirect done status */
ret = wait_for_bit_le32(plat->regbase + CQSPI_REG_INDIRECTRD,
CQSPI_REG_INDIRECTRD_DONE, 1, 10, 0);
Expand Down

0 comments on commit a4a6f46

Please sign in to comment.