Commit cc6668637ebed620eaafc807802f3d85b193f534
Committed by
Brian Norris
1 parent
009e7e61b1
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
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>
Showing 1 changed file with 19 additions and 4 deletions Side-by-side Diff
drivers/mtd/devices/st_spi_fsm.c
... | ... | @@ -1164,12 +1164,27 @@ |
1164 | 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 | 1169 | data_pads = ((fsm->stfsm_seq_read.seq_cfg >> 16) & 0x3) + 1; |
1169 | 1170 | if (data_pads == 4) { |
1170 | - stfsm_read_status(fsm, FLASH_CMD_RDSR, &sta); | |
1171 | - sta |= MX25_STATUS_QE; | |
1172 | - stfsm_write_status(fsm, sta, 1); | |
1171 | + if (!(sta & MX25_STATUS_QE)) { | |
1172 | + /* Set 'QE' */ | |
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 | 1190 | return 0; |