mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-03 06:53:18 +02:00
Convert the following chips to use struct eraseblock
Am29F010A/B Am29F002(N)BB Am29F002(N)BT Am29F016D Am29F040B Am29F080B Am29LV040B Am29LV081B A29040B Pm29F002T Pm29F002B Change function signature of Am29 erase functions and JEDEC chip erase to be usable with block_erasers. Corresponding to flashrom svn r812. Signed-off-by: Sean Nelson <audiohacked@gmail.com> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
This commit is contained in:

committed by
Carl-Daniel Hailfinger

parent
63ce4bb0d2
commit
72a9a02b38
18
am29f040b.c
18
am29f040b.c
@ -22,9 +22,8 @@
|
||||
|
||||
/* FIMXE: check that the 2 second delay is really needed.
|
||||
Use erase_sector_jedec if not? */
|
||||
static int erase_sector_29f040b(struct flashchip *flash, unsigned long address)
|
||||
int erase_sector_29f040b(struct flashchip *flash, unsigned int address, unsigned int blocklen)
|
||||
{
|
||||
int page_size = flash->page_size;
|
||||
chipaddr bios = flash->virtual_memory;
|
||||
|
||||
chip_writeb(0xAA, bios + 0x555);
|
||||
@ -39,13 +38,24 @@ static int erase_sector_29f040b(struct flashchip *flash, unsigned long address)
|
||||
/* wait for Toggle bit ready */
|
||||
toggle_ready_jedec(bios + address);
|
||||
|
||||
if (check_erased_range(flash, address, page_size)) {
|
||||
if (check_erased_range(flash, address, blocklen)) {
|
||||
fprintf(stderr, "ERASE FAILED!\n");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* erase chip with block_erase() prototype */
|
||||
int erase_chip_29f040b(struct flashchip *flash, unsigned int addr, unsigned int blocklen)
|
||||
{
|
||||
if ((addr != 0) || (blocklen != flash->total_size * 1024)) {
|
||||
fprintf(stderr, "%s called with incorrect arguments\n",
|
||||
__func__);
|
||||
return -1;
|
||||
}
|
||||
return erase_29f040b(flash);
|
||||
}
|
||||
|
||||
/* FIXME: use write_sector_jedec? */
|
||||
static int write_sector_29f040b(chipaddr bios, uint8_t *src, chipaddr dst,
|
||||
unsigned int page_size)
|
||||
@ -127,7 +137,7 @@ int write_29f040b(struct flashchip *flash, uint8_t *buf)
|
||||
printf("Programming page ");
|
||||
for (i = 0; i < total_size / page_size; i++) {
|
||||
/* erase the page before programming */
|
||||
if (erase_sector_29f040b(flash, i * page_size)) {
|
||||
if (erase_sector_29f040b(flash, i * page_size, page_size)) {
|
||||
fprintf(stderr, "ERASE FAILED!\n");
|
||||
return -1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user