瀏覽代碼

mtd: st_spi_fsm: Write to Flash via the FSM FIFO

When we write data to the FIFO the FSM Controller subsequently writes
that data out to the Serial Flash chip.

Acked-by Angus Clark <angus.clark@st.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Lee Jones 11 年之前
父節點
當前提交
30ca64f9f9
共有 1 個文件被更改,包括 14 次插入0 次删除
  1. 14 0
      drivers/mtd/devices/st_spi_fsm.c

+ 14 - 0
drivers/mtd/devices/st_spi_fsm.c

@@ -668,6 +668,20 @@ static void stfsm_read_fifo(struct stfsm *fsm, uint32_t *buf,
 	}
 	}
 }
 }
 
 
+static int stfsm_write_fifo(struct stfsm *fsm,
+			    const uint32_t *buf, const uint32_t size)
+{
+	uint32_t words = size >> 2;
+
+	dev_dbg(fsm->dev, "writing %d bytes to FIFO\n", size);
+
+	BUG_ON((((uint32_t)buf) & 0x3) || (size & 0x3));
+
+	writesl(fsm->base + SPI_FAST_SEQ_DATA_REG, buf, words);
+
+	return size;
+}
+
 static int stfsm_enter_32bit_addr(struct stfsm *fsm, int enter)
 static int stfsm_enter_32bit_addr(struct stfsm *fsm, int enter)
 {
 {
 	struct stfsm_seq *seq = &stfsm_seq_en_32bit_addr;
 	struct stfsm_seq *seq = &stfsm_seq_en_32bit_addr;