This shows how we could refactor the jedec code. After the refactor we
can delete these:
* am29f040b
* en29f002a -> file_not_used
* m29f002
* mx29f002
* pm29f002
* sst49lf040
* w49f002u
These files can be deleted if we *could*
find a way to integrate the problems into jedec.c:
* w29ee011 -> checks specifically for w29ee011
* w39v040c -> checks for lock in probe: address 0xfff2
* pm49fl00x -> uses chip protect code
* m29f002 -> block based writing
* m29f400bt -> block based writing
I was looking through these two files and saw that they used variable
block
sizes for writing sectors, maybe we can do something simpler to
block_erasers:
* m29f002
* m29f400bt
There are a few files that performs another map_flash_registers() after
successful probe, I was wondering if we could add the re-mapping to
probe_jedec_common or if its safe to omit the function call:
* pm49fl00x
* stm50flw0x0x
* w39v080fa
List of chips that use a specific addressing for command codes:
0x2AA based chips:
* am29f040b
* mx29f002
* pm29f002
0xAAA based chips:
* m29f002
* m29f400bt
0x2AAA based chips:
* pm49fl00x
* sst49lf040
* stm50flw0x0x
* w29ee011
* w39v040c
* w39v080fa
* w49f002u
The full notes:
@jedec {
# start_program_jedec => AA 55 A0
# probe_jedec => AA 55 90 MID DID AA 55 F0
# erase_sector_jedec => AA 55 80 AA 55 30
# erase_block_jedec => AA 55 80 AA 55 50
# erase_chip_jedec => AA 55 80 AA 55 10
# write_page_write_jedec
# write_byte_program_jedec
# write_sector_jedec - byte_program based
# write_jedec is a chip by page writer - page based
# write_jedec_1 is a chip by page writer - sector based
#
# void start_program_jedec(chipaddr bios, unsigned int mask,
# unsigned int shift)
# {
# chip_writeb(0xAA, bios + (0x5555 & mask) );
# chip_writeb(0x55, bios + ((0x2AAA & mask)>>shift) );
# chip_writeb(0xA0, bios + (0x5555 & mask) );
# }
}
@82802ab { # FWHUB map_flash_registers }
@am29f040b { # 0x555 0x2AA
erase_29f040b => erase_chip_jedec_2aa
erase_chip_29f040b => erase_chip_block_jedec_2aa
erase_sector_29f040b => erase_sector_jedec_2aa
probe_29f040b => probe_jedec_2aa_reset
write_29f040b => write_jedec_2aa
write_sector_29f040b => write_sector_jedec_2aa
}
@en29f002a { # file_not_used
}
@m29f002 { # 0x555 0xAAA block_based_write
do_block
erase_m29f002 => erase_chip_block_jedec_aaa
rewrite_block => write_block_jedec_aaa
write_m29f002t # variable page writing
write_m29f002b # same as previous
}
@m29f400bt { # 0x555 0xAAA block_based_write
block_erase_chip_m29f400bt => erase_chip_block_jedec_aaa
block_erase_m29f400bt => erase_sector_jedec_aaa
erase_m29f400bt => erase_chip_jedec_aaa
probe_m29f400bt => probe_jedec_aaa_did_02
write_coreboot_m29f400bt # same as previous
write_m29f400bt # variable page writing
write_page_m29f400bt
}
@mx29f002 { # 0x555 0x2AA
erase_29f002 => erase_chip_jedec_2aa
erase_chip_29f002 => erase_chip_block_jedec_2aa
erase_sector_29f002 => erase_sector_jedec_2aa
probe_29f002 => probe_jedec_2aa_reset
}
@pm29f002 { # 0x555 0x2AA
write_pm29f002 => write_jedec_1_2aa
}
@pm49fl00x { # 0x5555 0x2AAA map_flash_registers needs_protects
erase_49fl00x => erase_chip_block_jedec_2aaa
probe_49fl00x => probe_jedec_2aaa
write_49fl00x => write_jedec_2aaa
write_lockbits_49fl00x
}
@sharplhf00l04 { # FWHUB map_flash_registers }
@sst28sf040 { # FWHUB }
@sst49lf040 { # 0x5555 0x2AAA
erase_49lf040 => erase_sector_jedec_2aaa
write_49lf040 => write_jedec_2aaa
}
@sst49lfxxxc { # FWHUB map_flash_registers }
@sst_fwhub { # FWHUB map_flash_registers }
@stm50flw0x0x { # 0x5555 0x2AAA map_flash_registers
erase_block_stm50flw0x0x
erase_stm50flw0x0x
probe_stm50flw0x0x => probe_jedec_2aaa
unlock_block_stm50flw0x0x
wait_stm50flw0x0x
write_page_stm50flw0x0x
write_stm50flw0x0x
}
@w29ee011 { # 0x5555 0x2AAA has_check_W29EE011 funks_up_AMIC_A49LF040A
probe_w29ee011 => probe_jedec_2aaa_60
}
@w39v040c { # 0x5555 0x2AAA has_lock_fff2
probe_w39v040c => probe_jedec_2aaa
}
@w39v080fa { # 0x5555 0x2AAA map_flash_registers
erase_sector_winbond_fwhub
erase_winbond_fwhub
probe_winbond_fwhub => probe_jedec_2aaa
unlock_block_winbond_fwhub
unlock_winbond_fwhub
write_winbond_fwhub
}
@w49f002u { # 0x5555 0x2AAA
write_49f002 => write_jedec_1_2aaa
}