diff options
author | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2012-12-29 15:03:51 +0000 |
---|---|---|
committer | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2012-12-29 15:03:51 +0000 |
commit | 6ee37e28365f2a8ea498d03b08def0dcb1cc6494 (patch) | |
tree | 3328db4647bba505d32ebc5755c511728cec438e /a25.c | |
parent | 2c421199ab37e691a83ad09b542ed43ee5811603 (diff) | |
download | ast2050-flashrom-6ee37e28365f2a8ea498d03b08def0dcb1cc6494.zip ast2050-flashrom-6ee37e28365f2a8ea498d03b08def0dcb1cc6494.tar.gz |
Improve SPI status register pretty printing
- Move all functions related to SPI status registers to a new file
spi25_statusreg.c. This includes the generic as well as the
SST-specific functions from spi25.c and the chip-specific functions
from a25.c and at25.c.
- introduce helper functions
* spi_prettyprint_status_register_hex()
* spi_prettyprint_status_register_bpl()
* spi_prettyprint_status_register_plain()
Use the latter on every compatible flash chip that has no better printlock
function set and get rid of the implicit pretty printing in the SPI probing
functions.
- remove
* spi_prettyprint_status_register_common()
* spi_prettyprint_status_register_amic_a25lq032() because it can be fully
substituted with spi_prettyprint_status_register_amic_a25l032().
* spi_prettyprint_status_register() (old switch, no longer needed)
- promote and export
* spi_prettyprint_status_register_amic_a25l05p() as spi_prettyprint_status_register_default_bp1().
* spi_prettyprint_status_register_amic_a25l40p() as spi_prettyprint_status_register_default_bp2().
* spi_prettyprint_status_register_st_m25p() as spi_prettyprint_status_register_default_bp3().
- add #define TEST_BAD_REW and use it for a number of Atmel chips which
had only TEST_BAD_READ set even though they dont have erasers or a write
function set.
Corresponding to flashrom svn r1634.
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Diffstat (limited to 'a25.c')
-rw-r--r-- | a25.c | 100 |
1 files changed, 0 insertions, 100 deletions
@@ -1,100 +0,0 @@ -/* - * This file is part of the flashrom project. - * - * Copyright (C) 2010 Carl-Daniel Hailfinger - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "flash.h" -#include "chipdrivers.h" -#include "spi.h" - -/* Prettyprint the status register. Works for AMIC A25L series. */ - -int spi_prettyprint_status_register_amic_a25l05p(struct flashctx *flash) -{ - uint8_t status; - - status = spi_read_status_register(flash); - msg_cdbg("Chip status register is %02x\n", status); - - spi_prettyprint_status_register_srwd(status); - spi_prettyprint_status_register_bit(status, 6); - spi_prettyprint_status_register_bit(status, 5); - spi_prettyprint_status_register_bit(status, 4); - spi_prettyprint_status_register_bp(status, 1); - spi_prettyprint_status_register_welwip(status); - return 0; -} - -int spi_prettyprint_status_register_amic_a25l40p(struct flashctx *flash) -{ - uint8_t status; - - status = spi_read_status_register(flash); - msg_cdbg("Chip status register is %02x\n", status); - - spi_prettyprint_status_register_srwd(status); - spi_prettyprint_status_register_bit(status, 6); - spi_prettyprint_status_register_bit(status, 5); - spi_prettyprint_status_register_bp(status, 2); - spi_prettyprint_status_register_welwip(status); - return 0; -} - -int spi_prettyprint_status_register_amic_a25l032(struct flashctx *flash) -{ - uint8_t status; - - status = spi_read_status_register(flash); - msg_cdbg("Chip status register is %02x\n", status); - - spi_prettyprint_status_register_srwd(status); - msg_cdbg("Chip status register: Sector Protect Size (SEC) " - "is %i KB\n", (status & (1 << 6)) ? 4 : 64); - msg_cdbg("Chip status register: Top/Bottom (TB) " - "is %s\n", (status & (1 << 5)) ? "bottom" : "top"); - spi_prettyprint_status_register_bp(status, 2); - spi_prettyprint_status_register_welwip(status); - msg_cdbg("Chip status register 2 is NOT decoded!\n"); - return 0; -} - -int spi_prettyprint_status_register_amic_a25lq032(struct flashctx *flash) -{ - uint8_t status; - - status = spi_read_status_register(flash); - msg_cdbg("Chip status register is %02x\n", status); - - spi_prettyprint_status_register_srwd(status); - msg_cdbg("Chip status register: Sector Protect Size (SEC) " - "is %i KB\n", (status & (1 << 6)) ? 4 : 64); - msg_cdbg("Chip status register: Top/Bottom (TB) " - "is %s\n", (status & (1 << 5)) ? "bottom" : "top"); - spi_prettyprint_status_register_bp(status, 2); - spi_prettyprint_status_register_welwip(status); - msg_cdbg("Chip status register 2 is NOT decoded!\n"); - return 0; -} - -/* FIXME: spi_disable_blockprotect is incorrect but works fine for chips using - * spi_prettyprint_status_register_amic_a25l05p or - * spi_prettyprint_status_register_amic_a25l40p. - * FIXME: spi_disable_blockprotect is incorrect and will fail for chips using - * spi_prettyprint_status_register_amic_a25l032 or - * spi_prettyprint_status_register_amic_a25lq032 if those have locks controlled - * by the second status register. - */ |