• Stefan Tauner's avatar
    spi25.c: Refactor spi_write_status_register helpers · 96c2dfc1
    Stefan Tauner authored
    
    In r1115 "Write protection handling for Atmel AT25*" the old
    spi_write_status_register function was duplicated to send WREN and
    EWSR commands respectively controlled by a new common wrapper function
    spi_write_status_register without a reason. Both functions' resulting
    code is equal apart from the opcode used. The code itself does also
    differ in the macros used, but their value (apart from the opcode) is
    equal. This patch adds a new parameter for the opcode to the helper
    function which allows removal of the other one. This relies on the fact
    that EWSR and WREN have the same INSIZE and OUTSIZE though. If that is
    really seen as an issue, the sizes could be made parameters too.
    
    This patch also changes the wrapper so that it no longer sets the
    feature bits of the struct flash(ctx) argument. This may result in
    changed output, because it no longer implicitly disables the debug
    message in following executions. Since almost all chips had their
    feature bits fixed in the previous commit, this is a minor problem.
    
    Also, spi_write_status_enable has been dead code since r658 or so.
    Remove it.
    
    Corresponding to flashrom svn r1528.
    Signed-off-by: default avatarStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
    Acked-by: default avatarCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
    96c2dfc1
spi25.c 30.9 KB