summaryrefslogtreecommitdiffstats
path: root/nicintel_spi.c
diff options
context:
space:
mode:
authorCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2011-05-03 21:49:41 +0000
committerCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2011-05-03 21:49:41 +0000
commit54ce73a1f5c7ddecc7579c136dbac9c2c201b621 (patch)
treef24b7ce88dfdedbb3388cb3f6e4e44ee4e9f15f0 /nicintel_spi.c
parent8ed293416dc3d47539dd95709f2b1dc0ccfe0736 (diff)
downloadflashrom-54ce73a1f5c7ddecc7579c136dbac9c2c201b621.tar.gz
flashrom-54ce73a1f5c7ddecc7579c136dbac9c2c201b621.tar.bz2
flashrom-54ce73a1f5c7ddecc7579c136dbac9c2c201b621.zip
Revert MMIO space writes on shutdown as needed
Reversible MMIO space writes now use rmmio_write*(). Reversible PCI MMIO space writes now use pci_rmmio_write*(). If a MMIO value needs to be queued for restore without writing it, use rmmio_val*(). MMIO space writes which are one-shot (e.g. communication with some chip) should continue to use the permanent mmio_write* variants. Corresponding to flashrom svn r1292. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> David tested it successfully on some NM10/ICH7 platforms which switch between SPI and LPC targets (x86 BIOS ROM vs. EC firmware ROM). Acked-by: David Hendricks <dhendrix@google.com>
Diffstat (limited to 'nicintel_spi.c')
-rw-r--r--nicintel_spi.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/nicintel_spi.c b/nicintel_spi.c
index 3882e81f4..28d332e1b 100644
--- a/nicintel_spi.c
+++ b/nicintel_spi.c
@@ -148,6 +148,11 @@ int nicintel_spi_init(void)
nicintel_spibar = physmap("Intel Gigabit NIC w/ SPI flash",
io_base_addr, 4096);
+ /* Automatic restore of EECD on shutdown is not possible because EECD
+ * does not only contain FLASH_WRITES_DISABLED|FLASH_WRITES_ENABLED,
+ * but other bits with side effects as well. Those other bits must be
+ * left untouched.
+ */
tmp = pci_mmio_readl(nicintel_spibar + EECD);
tmp &= ~FLASH_WRITES_DISABLED;
tmp |= FLASH_WRITES_ENABLED;
@@ -167,6 +172,9 @@ int nicintel_spi_shutdown(void)
{
uint32_t tmp;
+ /* Disable writes manually. See the comment about EECD in
+ * nicintel_spi_init() for details.
+ */
tmp = pci_mmio_readl(nicintel_spibar + EECD);
tmp &= ~FLASH_WRITES_ENABLED;
tmp |= FLASH_WRITES_DISABLED;