Carl-Daniel Hailfinger wrote:
OK, I figured one part out: Drop erase_sector_39sf020() which is an identical copy of erase_sector_28sf040().
Alright. This starts making more sense. I still say NACK, as the name for that function is obviously very wrong then. If the erase sector function works on several chips, even from different generations, it should not carry the name of one specific chip.
If we find a good name for it, that makes clear when supporters of new chips can use it, I suggest lets commit your patches.
+int erase_sector_28sf040(volatile uint8_t *bios, unsigned long address) { *bios = AUTO_PG_ERASE1; *(bios + address) = AUTO_PG_ERASE2; @@ -119,6 +118,20 @@ return 0; }
+int erase_all_sectors_28sf040(struct flashchip *flash) +{
- int i;
- int total_size = flash->total_size * 1024;
- int page_size = flash->page_size;
- volatile uint8_t *bios = flash->virtual_memory;
- for (i = 0; i < total_size / page_size; i++) {
/* erase the page before programming */
erase_sector_28sf040(bios, i * page_size);
- }
- return 0;
+}
int erase_28sf040(struct flashchip *flash) { volatile uint8_t *bios = flash->virtual_memory;