aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/devices
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/devices')
-rw-r--r--drivers/mtd/devices/st_spi_fsm.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c
index 5e22c8688197..73e0f2731bcb 100644
--- a/drivers/mtd/devices/st_spi_fsm.c
+++ b/drivers/mtd/devices/st_spi_fsm.c
@@ -281,6 +281,32 @@ static void stfsm_wait_seq(struct stfsm *fsm)
281 dev_err(fsm->dev, "timeout on sequence completion\n"); 281 dev_err(fsm->dev, "timeout on sequence completion\n");
282} 282}
283 283
284static void stfsm_read_fifo(struct stfsm *fsm, uint32_t *buf,
285 const uint32_t size)
286{
287 uint32_t remaining = size >> 2;
288 uint32_t avail;
289 uint32_t words;
290
291 dev_dbg(fsm->dev, "Reading %d bytes from FIFO\n", size);
292
293 BUG_ON((((uint32_t)buf) & 0x3) || (size & 0x3));
294
295 while (remaining) {
296 for (;;) {
297 avail = stfsm_fifo_available(fsm);
298 if (avail)
299 break;
300 udelay(1);
301 }
302 words = min(avail, remaining);
303 remaining -= words;
304
305 readsl(fsm->base + SPI_FAST_SEQ_DATA_REG, buf, words);
306 buf += words;
307 }
308}
309
284static int stfsm_set_mode(struct stfsm *fsm, uint32_t mode) 310static int stfsm_set_mode(struct stfsm *fsm, uint32_t mode)
285{ 311{
286 int ret, timeout = 10; 312 int ret, timeout = 10;