aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2015-04-02 13:38:36 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-04-07 14:00:40 +1000
commitaa9348f64d701e56868ff662204f83a163240605 (patch)
tree8e17e46af32342926390098884a1b1efbf55e7a6
parent3109fa61ad11f7cbb5eff80164acac6c36c4cf92 (diff)
downloadskiboot-aa9348f64d701e56868ff662204f83a163240605.zip
skiboot-aa9348f64d701e56868ff662204f83a163240605.tar.gz
skiboot-aa9348f64d701e56868ff662204f83a163240605.tar.bz2
address reviews for: libflash:don't use the low level interface if it doesn't existskiboot-5.0-rc3
commit 237f9d1a51eaed260119346dfddc044395267154 Author: Cyril Bur <cyril.bur@au1.ibm.com> libflash: don't use the low level interface if it doesn't exist In the review process a less invasive version was reworked. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--libflash/libflash.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/libflash/libflash.c b/libflash/libflash.c
index a81ff4d..e43be4f 100644
--- a/libflash/libflash.c
+++ b/libflash/libflash.c
@@ -93,10 +93,6 @@ int fl_wren(struct spi_flash_ctrl *ct)
int i, rc;
uint8_t stat;
- /* If lower level interface not implmented, just return */
- if (!ct->cmd_wr)
- return 0;
-
/* Some flashes need it to be hammered */
for (i = 0; i < 1000; i++) {
rc = ct->cmd_wr(ct, CMD_WREN, false, 0, NULL, 0);
@@ -673,6 +669,10 @@ static int flash_set_4b(struct flash_chip *c, bool enable)
struct spi_flash_ctrl *ct = c->ctrl;
int rc;
+ /* Don't have low level interface, assume all is well */
+ if (!ct->cmd_wr)
+ return 0;
+
/* Some flash chips want this */
rc = fl_wren(ct);
if (rc) {
@@ -680,13 +680,7 @@ static int flash_set_4b(struct flash_chip *c, bool enable)
/* Ignore the error & move on (could be wrprotect chip) */
}
- /* Don't have low level interface, assume all is well */
- if (!ct->cmd_wr)
- return 0;
-
-
/* Ignore error in case chip is write protected */
-
return ct->cmd_wr(ct, enable ? CMD_EN4B : CMD_EX4B, false, 0, NULL, 0);
}