diff options
author | Lee Jones <lee.jones@linaro.org> | 2014-03-20 05:21:02 -0400 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2014-03-20 07:17:20 -0400 |
commit | 150571b74ad92485b1443d0802dc740e194883f1 (patch) | |
tree | 4baa6bea29daf8b607707e9602d29418cccb2c25 /drivers/mtd | |
parent | ac94dbcb6779d184f89bde0f8e2c7368d7179dd8 (diff) |
mtd: st_spi_fsm: Add the ability to write to FSM's status register
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>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/devices/st_spi_fsm.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c index 5e315e31a839..0eb2c09dd004 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c | |||
@@ -588,6 +588,23 @@ static struct stfsm_seq stfsm_seq_erase_chip = { | |||
588 | SEQ_CFG_STARTSEQ), | 588 | SEQ_CFG_STARTSEQ), |
589 | }; | 589 | }; |
590 | 590 | ||
591 | static struct stfsm_seq stfsm_seq_write_status = { | ||
592 | .seq_opc[0] = (SEQ_OPC_PADS_1 | SEQ_OPC_CYCLES(8) | | ||
593 | SEQ_OPC_OPCODE(FLASH_CMD_WREN) | SEQ_OPC_CSDEASSERT), | ||
594 | .seq_opc[1] = (SEQ_OPC_PADS_1 | SEQ_OPC_CYCLES(8) | | ||
595 | SEQ_OPC_OPCODE(FLASH_CMD_WRSR)), | ||
596 | .seq = { | ||
597 | STFSM_INST_CMD1, | ||
598 | STFSM_INST_CMD2, | ||
599 | STFSM_INST_STA_WR1, | ||
600 | STFSM_INST_STOP, | ||
601 | }, | ||
602 | .seq_cfg = (SEQ_CFG_PADS_1 | | ||
603 | SEQ_CFG_READNOTWRITE | | ||
604 | SEQ_CFG_CSDEASSERT | | ||
605 | SEQ_CFG_STARTSEQ), | ||
606 | }; | ||
607 | |||
591 | static struct stfsm_seq stfsm_seq_wrvcr = { | 608 | static struct stfsm_seq stfsm_seq_wrvcr = { |
592 | .seq_opc[0] = (SEQ_OPC_PADS_1 | SEQ_OPC_CYCLES(8) | | 609 | .seq_opc[0] = (SEQ_OPC_PADS_1 | SEQ_OPC_CYCLES(8) | |
593 | SEQ_OPC_OPCODE(FLASH_CMD_WREN) | SEQ_OPC_CSDEASSERT), | 610 | SEQ_OPC_OPCODE(FLASH_CMD_WREN) | SEQ_OPC_CSDEASSERT), |
@@ -817,6 +834,25 @@ static int stfsm_read_status(struct stfsm *fsm, uint8_t cmd, | |||
817 | return 0; | 834 | return 0; |
818 | } | 835 | } |
819 | 836 | ||
837 | static int stfsm_write_status(struct stfsm *fsm, uint16_t status, | ||
838 | int sta_bytes) | ||
839 | { | ||
840 | struct stfsm_seq *seq = &stfsm_seq_write_status; | ||
841 | |||
842 | dev_dbg(fsm->dev, "writing STA[%s] 0x%04x\n", | ||
843 | (sta_bytes == 1) ? "1" : "1+2", status); | ||
844 | |||
845 | seq->status = (uint32_t)status | STA_PADS_1 | STA_CSDEASSERT; | ||
846 | seq->seq[2] = (sta_bytes == 1) ? | ||
847 | STFSM_INST_STA_WR1 : STFSM_INST_STA_WR1_2; | ||
848 | |||
849 | stfsm_load_seq(fsm, seq); | ||
850 | |||
851 | stfsm_wait_seq(fsm); | ||
852 | |||
853 | return 0; | ||
854 | }; | ||
855 | |||
820 | static int stfsm_wrvcr(struct stfsm *fsm, uint8_t data) | 856 | static int stfsm_wrvcr(struct stfsm *fsm, uint8_t data) |
821 | { | 857 | { |
822 | struct stfsm_seq *seq = &stfsm_seq_wrvcr; | 858 | struct stfsm_seq *seq = &stfsm_seq_wrvcr; |