Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * This file is part of the flashrom project. | 2 * This file is part of the flashrom project. |
| 3 * | 3 * |
| 4 * Copyright (C) 2010 Carl-Daniel Hailfinger | 4 * Copyright (C) 2010 Carl-Daniel Hailfinger |
| 5 * Copyright (C) 2010 Idwer Vollering | 5 * Copyright (C) 2010 Idwer Vollering |
| 6 * | 6 * |
| 7 * This program is free software; you can redistribute it and/or modify | 7 * This program is free software; you can redistribute it and/or modify |
| 8 * it under the terms of the GNU General Public License as published by | 8 * it under the terms of the GNU General Public License as published by |
| 9 * the Free Software Foundation; version 2 of the License. | 9 * the Free Software Foundation; version 2 of the License. |
| 10 * | 10 * |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 { | 142 { |
| 143 uint32_t tmp; | 143 uint32_t tmp; |
| 144 | 144 |
| 145 get_io_perms(); | 145 get_io_perms(); |
| 146 | 146 |
| 147 io_base_addr = pcidev_init(PCI_VENDOR_ID_INTEL, PCI_BASE_ADDRESS_0, | 147 io_base_addr = pcidev_init(PCI_VENDOR_ID_INTEL, PCI_BASE_ADDRESS_0, |
| 148 nics_intel_spi); | 148 nics_intel_spi); |
| 149 | 149 |
| 150 nicintel_spibar = physmap("Intel Gigabit NIC w/ SPI flash", | 150 nicintel_spibar = physmap("Intel Gigabit NIC w/ SPI flash", |
| 151 io_base_addr, 4096); | 151 io_base_addr, 4096); |
| 152 /* Automatic restore is not possible because we only change two bits. */ | |
|
Stefan Reinauer
2011/04/19 18:24:55
Why are two bits not enough?
Louis
2011/04/20 00:43:55
Hm.... I don't the exact reason, I just patch this
dhendrix
2011/04/20 00:55:25
Agreed -- Removing the comment is probably best to
| |
| 152 tmp = pci_mmio_readl(nicintel_spibar + EECD); | 153 tmp = pci_mmio_readl(nicintel_spibar + EECD); |
| 153 tmp &= ~FLASH_WRITES_DISABLED; | 154 tmp &= ~FLASH_WRITES_DISABLED; |
| 154 tmp |= FLASH_WRITES_ENABLED; | 155 tmp |= FLASH_WRITES_ENABLED; |
| 155 pci_mmio_writel(tmp, nicintel_spibar + EECD); | 156 pci_mmio_writel(tmp, nicintel_spibar + EECD); |
| 156 | 157 |
| 157 /* 1 usec halfperiod delay for now. */ | 158 /* 1 usec halfperiod delay for now. */ |
| 158 if (bitbang_spi_init(&bitbang_spi_master_nicintel, 1)) | 159 if (bitbang_spi_init(&bitbang_spi_master_nicintel, 1)) |
| 159 return 1; | 160 return 1; |
| 160 | 161 |
| 161 buses_supported = CHIP_BUSTYPE_SPI; | 162 buses_supported = CHIP_BUSTYPE_SPI; |
| 162 spi_controller = SPI_CONTROLLER_NICINTEL; | 163 spi_controller = SPI_CONTROLLER_NICINTEL; |
| 163 | 164 |
| 164 return 0; | 165 return 0; |
| 165 } | 166 } |
| 166 | 167 |
| 167 int nicintel_spi_shutdown(void) | 168 int nicintel_spi_shutdown(void) |
| 168 { | 169 { |
| 169 uint32_t tmp; | 170 uint32_t tmp; |
| 170 | 171 |
| 172 /* Automatic restore is not possible because we only change two bits. */ | |
| 171 tmp = pci_mmio_readl(nicintel_spibar + EECD); | 173 tmp = pci_mmio_readl(nicintel_spibar + EECD); |
| 172 tmp &= ~FLASH_WRITES_ENABLED; | 174 tmp &= ~FLASH_WRITES_ENABLED; |
| 173 tmp |= FLASH_WRITES_DISABLED; | 175 tmp |= FLASH_WRITES_DISABLED; |
| 174 pci_mmio_writel(tmp, nicintel_spibar + EECD); | 176 pci_mmio_writel(tmp, nicintel_spibar + EECD); |
| 175 | 177 |
| 176 physunmap(nicintel_spibar, 4096); | 178 physunmap(nicintel_spibar, 4096); |
| 177 pci_cleanup(pacc); | 179 pci_cleanup(pacc); |
| 178 release_io_perms(); | 180 release_io_perms(); |
| 179 | 181 |
| 180 return 0; | 182 return 0; |
| 181 } | 183 } |
| OLD | NEW |