1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-06 08:07:07 +02:00

Combine block_erase*_en29lv640b and block_erase*_m29f400bt respectively

This patch combines two identical block and chip erase functions respectively:
 - Merge block_erase_m29f400bt and block_erase_en29lv640b into
   erase_block_shifted_jedec.
 - Merge block_erase_chip_m29f400bt and block_erase_chip_en29lv640b into
   erase_chip_block_shifted_jedec.

Leave their implementations in en29lv640b.c for now.

Corresponding to flashrom svn r1808.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
This commit is contained in:
Stefan Tauner
2014-06-01 02:21:02 +00:00
parent 1181ee251a
commit f2756fa240
4 changed files with 20 additions and 75 deletions

View File

@ -85,54 +85,3 @@ int probe_m29f400bt(struct flashctx *flash)
return 0;
}
int erase_m29f400bt(struct flashctx *flash)
{
chipaddr bios = flash->virtual_memory;
chip_writeb(flash, 0xAA, bios + 0xAAA);
chip_writeb(flash, 0x55, bios + 0x555);
chip_writeb(flash, 0x80, bios + 0xAAA);
chip_writeb(flash, 0xAA, bios + 0xAAA);
chip_writeb(flash, 0x55, bios + 0x555);
chip_writeb(flash, 0x10, bios + 0xAAA);
programmer_delay(10);
toggle_ready_jedec(flash, bios);
/* FIXME: Check the status register for errors. */
return 0;
}
int block_erase_m29f400bt(struct flashctx *flash, unsigned int start,
unsigned int len)
{
chipaddr bios = flash->virtual_memory;
chipaddr dst = bios + start;
chip_writeb(flash, 0xAA, bios + 0xAAA);
chip_writeb(flash, 0x55, bios + 0x555);
chip_writeb(flash, 0x80, bios + 0xAAA);
chip_writeb(flash, 0xAA, bios + 0xAAA);
chip_writeb(flash, 0x55, bios + 0x555);
chip_writeb(flash, 0x30, dst);
programmer_delay(10);
toggle_ready_jedec(flash, bios);
/* FIXME: Check the status register for errors. */
return 0;
}
int block_erase_chip_m29f400bt(struct flashctx *flash, unsigned int address,
unsigned int blocklen)
{
if ((address != 0) || (blocklen != flash->chip->total_size * 1024)) {
msg_cerr("%s called with incorrect arguments\n",
__func__);
return -1;
}
return erase_m29f400bt(flash);
}