summaryrefslogtreecommitdiffstats
path: root/stm50.c
diff options
context:
space:
mode:
authorCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2014-08-03 13:05:34 +0000
committerStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2014-08-03 13:05:34 +0000
commitef3ac8ac17eac9d2041ea9c9e711a9b059412b59 (patch)
treee5fec0cda5a546133a7440f65da442329ec3db48 /stm50.c
parent2a41f0a2c0daeb0ee2a38a252ab96135d70a6b81 (diff)
downloadflashrom-ef3ac8ac17eac9d2041ea9c9e711a9b059412b59.tar.gz
flashrom-ef3ac8ac17eac9d2041ea9c9e711a9b059412b59.tar.bz2
flashrom-ef3ac8ac17eac9d2041ea9c9e711a9b059412b59.zip
Refactor unlocking of many chips with locking at register space address +2
This includes PMC Pm49*, SST 49LF00*, ST M50* and Winbond W39* families. The erase and write test status bits of all affected chips have been reset. Corresponding to flashrom svn r1833. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Diffstat (limited to 'stm50.c')
-rw-r--r--stm50.c55
1 files changed, 0 insertions, 55 deletions
diff --git a/stm50.c b/stm50.c
index edcfdd225..1ae2bc4d3 100644
--- a/stm50.c
+++ b/stm50.c
@@ -27,63 +27,8 @@
*/
#include "flash.h"
-#include "flashchips.h"
#include "chipdrivers.h"
-static int stm50_unlock_address(struct flashctx *flash, int offset)
-{
- chipaddr wrprotect = flash->virtual_registers + 2;
- static const uint8_t unlock_sector = 0x00;
- msg_cdbg("unlocking at 0x%x\n", offset);
- chip_writeb(flash, unlock_sector, wrprotect + offset);
- if (chip_readb(flash, wrprotect + offset) != unlock_sector) {
- msg_cerr("Cannot unlock address 0x%x\n", offset);
- return -1;
- }
- return 0;
-}
-
-/* Chips known to use a non-uniform block and sector layout for locking (as well as for erasing):
- * Name Size Address range of lock registers
- * M50FLW080A 1MB FFB00002 - FFBFF002
- * M50FLW080B 1MB FFB00002 - FFBFF002
- * M50FW002 256k FFBC0002 - FFBFC002
- * M50LPW116 2MB FFA00002 - FFBFC002
- */
-int unlock_stm50_nonuniform(struct flashctx *flash)
-{
- int i;
- struct eraseblock *eraseblocks = flash->chip->block_erasers[0].eraseblocks;
- unsigned int done = 0;
- for (i = 0; i < NUM_ERASEREGIONS && eraseblocks[i].count != 0; i++) {
- unsigned int block_size = eraseblocks[i].size;
- unsigned int block_count = eraseblocks[i].count;
-
- int j;
- for (j = 0; j < block_count; j++) {
- if (stm50_unlock_address(flash, done)) {
- msg_cerr("UNLOCK FAILED!\n");
- return -1;
- }
- done += block_count * block_size;
- }
- }
- return 0;
-}
-
-/* Unlocking for uniform 64 kB blocks starting at offset 2 of the feature registers. */
-int unlock_stm50_uniform(struct flashctx *flash)
-{
- int i;
- for (i = 0; i < flash->chip->total_size * 1024; i+= 64 * 1024) {
- if (stm50_unlock_address(flash, i)) {
- msg_cerr("UNLOCK FAILED!\n");
- return -1;
- }
- }
- return 0;
-}
-
static int stm50_erase_sector(struct flashctx *flash, unsigned int addr)
{
chipaddr bios = flash->virtual_memory + addr;