summaryrefslogtreecommitdiffstats
path: root/nicintel_spi.c
diff options
context:
space:
mode:
authorStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2013-08-14 15:48:44 +0000
committerStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2013-08-14 15:48:44 +0000
commit7fb5aa049bee3c685835dc24c8184c5897e4a6bd (patch)
tree3d193e98d25da24307824ab8d0939f3538ec2e50 /nicintel_spi.c
parent36e9f4b3595c6e8b13f80f85785a91b65ecad62f (diff)
downloadast2050-flashrom-7fb5aa049bee3c685835dc24c8184c5897e4a6bd.zip
ast2050-flashrom-7fb5aa049bee3c685835dc24c8184c5897e4a6bd.tar.gz
Automatically unmap physmap()s
Similarly to the previous PCI self-clean up patch this one allows to get rid of a huge number of programmer shutdown functions and makes introducing bugs harder. It adds a new function rphysmap() that takes care of unmapping at shutdown. Callers are changed where it makes sense. Corresponding to flashrom svn r1714. Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Diffstat (limited to 'nicintel_spi.c')
-rw-r--r--nicintel_spi.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/nicintel_spi.c b/nicintel_spi.c
index 0045c09..b1bce6a 100644
--- a/nicintel_spi.c
+++ b/nicintel_spi.c
@@ -151,16 +151,12 @@ static int nicintel_spi_shutdown(void *data)
{
uint32_t tmp;
- /* Disable writes manually. See the comment about EECD in
- * nicintel_spi_init() for details.
- */
+ /* 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;
pci_mmio_writel(tmp, nicintel_spibar + EECD);
- physunmap(nicintel_spibar, MEMMAP_SIZE);
-
return 0;
}
@@ -177,8 +173,7 @@ int nicintel_spi_init(void)
return 1;
io_base_addr = pcidev_readbar(dev, PCI_BASE_ADDRESS_0);
- nicintel_spibar = physmap("Intel Gigabit NIC w/ SPI flash",
- io_base_addr, MEMMAP_SIZE);
+ nicintel_spibar = rphysmap("Intel Gigabit NIC w/ SPI flash", io_base_addr, MEMMAP_SIZE);
/* 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
OpenPOWER on IntegriCloud