diff options
| author | Angus Clark <angus.clark@st.com> | 2014-03-26 12:39:17 -0400 |
|---|---|---|
| committer | Brian Norris <computersforpeace@gmail.com> | 2014-04-14 14:22:59 -0400 |
| commit | cc6668637ebed620eaafc807802f3d85b193f534 (patch) | |
| tree | 0465203ccba705e77131e9bcdb8a3c143f490078 | |
| parent | 009e7e61b1f15b16964f1b4b6bb1e30e6b03dc3b (diff) | |
mtd: st_spi_fsm: Update Macronix 'QE' configuration
Update the configuration of the Macronix 'QE' bit, such that
we only set or clear the bit if required.
Signed-off-by: Angus Clark <angus.clark@st.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
| -rw-r--r-- | drivers/mtd/devices/st_spi_fsm.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c index 40eb830eea21..f86d3e01433b 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c | |||
| @@ -1164,12 +1164,27 @@ static int stfsm_mx25_config(struct stfsm *fsm) | |||
| 1164 | CFG_ERASESEC_TOGGLE_32BIT_ADDR); | 1164 | CFG_ERASESEC_TOGGLE_32BIT_ADDR); |
| 1165 | } | 1165 | } |
| 1166 | 1166 | ||
| 1167 | /* For QUAD mode, set 'QE' STATUS bit */ | 1167 | /* Check status of 'QE' bit */ |
| 1168 | stfsm_read_status(fsm, FLASH_CMD_RDSR, &sta); | ||
| 1168 | data_pads = ((fsm->stfsm_seq_read.seq_cfg >> 16) & 0x3) + 1; | 1169 | data_pads = ((fsm->stfsm_seq_read.seq_cfg >> 16) & 0x3) + 1; |
| 1169 | if (data_pads == 4) { | 1170 | if (data_pads == 4) { |
| 1170 | stfsm_read_status(fsm, FLASH_CMD_RDSR, &sta); | 1171 | if (!(sta & MX25_STATUS_QE)) { |
| 1171 | sta |= MX25_STATUS_QE; | 1172 | /* Set 'QE' */ |
| 1172 | stfsm_write_status(fsm, sta, 1); | 1173 | sta |= MX25_STATUS_QE; |
| 1174 | |||
| 1175 | stfsm_write_status(fsm, sta, 1); | ||
| 1176 | |||
| 1177 | stfsm_wait_busy(fsm); | ||
| 1178 | } | ||
| 1179 | } else { | ||
| 1180 | if (sta & MX25_STATUS_QE) { | ||
| 1181 | /* Clear 'QE' */ | ||
| 1182 | sta &= ~MX25_STATUS_QE; | ||
| 1183 | |||
| 1184 | stfsm_write_status(fsm, sta, 1); | ||
| 1185 | |||
| 1186 | stfsm_wait_busy(fsm); | ||
| 1187 | } | ||
| 1173 | } | 1188 | } |
| 1174 | 1189 | ||
| 1175 | return 0; | 1190 | return 0; |
