diff options
author | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2016-01-23 16:16:49 +0000 |
---|---|---|
committer | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2016-01-23 16:16:49 +0000 |
commit | 124b7837d9c46cbc4c7c444f5d63a96d0d3b3f86 (patch) | |
tree | 2d62c23191801afaecbf98925effb8b8c7a44ab6 /at45db.c | |
parent | 41a940c641a7ddba77d04c93e01280d20a3a354a (diff) | |
download | flashrom-124b7837d9c46cbc4c7c444f5d63a96d0d3b3f86.zip flashrom-124b7837d9c46cbc4c7c444f5d63a96d0d3b3f86.tar.gz |
Add a bunch of new/tested stuff and various small changes 24
Tested mainboards:
OK:
- ASRock G31M-GS
Binary file (standard input) matches
Corresponding to flashrom svn r1917.
Diffstat (limited to 'at45db.c')
-rw-r--r-- | at45db.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -99,6 +99,10 @@ static unsigned int at45db_get_sector_count(struct flashctx *flash) static uint8_t at45db_prettyprint_protection_register(struct flashctx *flash, uint8_t opcode, const char *regname) { const uint8_t cmd[] = { opcode, 0, 0, 0 }; + const size_t sec_count = at45db_get_sector_count(flash); + if (sec_count < 2) + return 0; + /* The first two sectors share the first result byte. */ uint8_t buf[at45db_get_sector_count(flash) - 1]; @@ -332,7 +336,7 @@ static int at45db_erase(struct flashctx *flash, uint8_t opcode, unsigned int at4 /* Wait for completion. */ ret = at45db_wait_ready(flash, stepsize, retries); if (ret != 0) - msg_cerr("%s: chip did not became ready again after sending the erase command!\n", __func__); + msg_cerr("%s: chip did not become ready again after sending the erase command!\n", __func__); return ret; } @@ -463,7 +467,7 @@ static int at45db_fill_buffer1(struct flashctx *flash, const uint8_t *bytes, uns } /* Create a suitable buffer to store opcode, address and data chunks for buffer1. */ - const unsigned int max_data_write = flash->mst->spi.max_data_write; + const int max_data_write = flash->mst->spi.max_data_write - 4; const unsigned int max_chunk = (max_data_write > 0 && max_data_write <= page_size) ? max_data_write : page_size; uint8_t buf[4 + max_chunk]; @@ -504,7 +508,7 @@ static int at45db_commit_buffer1(struct flashctx *flash, unsigned int at45db_add /* Wait for completion (typically a few ms). */ ret = at45db_wait_ready(flash, 250, 200); // 50 ms if (ret != 0) { - msg_cerr("%s: chip did not became ready again!\n", __func__); + msg_cerr("%s: chip did not become ready again!\n", __func__); return ret; } |