aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/falcon.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2008-11-04 15:34:28 -0500
committerJeff Garzik <jgarzik@redhat.com>2008-11-06 00:49:57 -0500
commitf41507245ef8b079685aba8da5b5b2b5e87e70bc (patch)
treebe8c8aee6a6fc3c69d946dcd3fe24306bf89775e /drivers/net/sfc/falcon.c
parent0a95f56323ce93dac354c1b2d54bf959a985cf7d (diff)
sfc: Expose flash region storing boot code as MTD
The boot code that appears as a PCI expansion ROM on the SFC4000 is stored in flash. Expose this as a standard MTD device to allow for in-place upgrades. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/sfc/falcon.c')
-rw-r--r--drivers/net/sfc/falcon.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c
index 3f74ceff6a2e..71e0bed60616 100644
--- a/drivers/net/sfc/falcon.c
+++ b/drivers/net/sfc/falcon.c
@@ -1628,9 +1628,9 @@ static int falcon_spi_wait(struct efx_nic *efx)
1628 } 1628 }
1629} 1629}
1630 1630
1631static int falcon_spi_cmd(const struct efx_spi_device *spi, 1631int falcon_spi_cmd(const struct efx_spi_device *spi,
1632 unsigned int command, int address, 1632 unsigned int command, int address,
1633 const void *in, void *out, unsigned int len) 1633 const void *in, void *out, unsigned int len)
1634{ 1634{
1635 struct efx_nic *efx = spi->efx; 1635 struct efx_nic *efx = spi->efx;
1636 bool addressed = (address >= 0); 1636 bool addressed = (address >= 0);
@@ -1641,6 +1641,7 @@ static int falcon_spi_cmd(const struct efx_spi_device *spi,
1641 /* Input validation */ 1641 /* Input validation */
1642 if (len > FALCON_SPI_MAX_LEN) 1642 if (len > FALCON_SPI_MAX_LEN)
1643 return -EINVAL; 1643 return -EINVAL;
1644 BUG_ON(!mutex_is_locked(&efx->spi_lock));
1644 1645
1645 /* Check SPI not currently being accessed */ 1646 /* Check SPI not currently being accessed */
1646 rc = falcon_spi_wait(efx); 1647 rc = falcon_spi_wait(efx);
@@ -1699,8 +1700,7 @@ efx_spi_munge_command(const struct efx_spi_device *spi,
1699 return command | (((address >> 8) & spi->munge_address) << 3); 1700 return command | (((address >> 8) & spi->munge_address) << 3);
1700} 1701}
1701 1702
1702 1703int falcon_spi_fast_wait(const struct efx_spi_device *spi)
1703static int falcon_spi_fast_wait(const struct efx_spi_device *spi)
1704{ 1704{
1705 u8 status; 1705 u8 status;
1706 int i, rc; 1706 int i, rc;
@@ -2259,7 +2259,9 @@ int falcon_read_nvram(struct efx_nic *efx, struct falcon_nvconfig *nvconfig_out)
2259 nvconfig = region + NVCONFIG_OFFSET; 2259 nvconfig = region + NVCONFIG_OFFSET;
2260 2260
2261 spi = efx->spi_flash ? efx->spi_flash : efx->spi_eeprom; 2261 spi = efx->spi_flash ? efx->spi_flash : efx->spi_eeprom;
2262 mutex_lock(&efx->spi_lock);
2262 rc = falcon_spi_read(spi, 0, FALCON_NVCONFIG_END, NULL, region); 2263 rc = falcon_spi_read(spi, 0, FALCON_NVCONFIG_END, NULL, region);
2264 mutex_unlock(&efx->spi_lock);
2263 if (rc) { 2265 if (rc) {
2264 EFX_ERR(efx, "Failed to read %s\n", 2266 EFX_ERR(efx, "Failed to read %s\n",
2265 efx->spi_flash ? "flash" : "EEPROM"); 2267 efx->spi_flash ? "flash" : "EEPROM");
@@ -2555,6 +2557,11 @@ static int falcon_spi_device_init(struct efx_nic *efx,
2555 SPI_DEV_TYPE_FIELD(device_type, SPI_DEV_TYPE_ADDR_LEN); 2557 SPI_DEV_TYPE_FIELD(device_type, SPI_DEV_TYPE_ADDR_LEN);
2556 spi_device->munge_address = (spi_device->size == 1 << 9 && 2558 spi_device->munge_address = (spi_device->size == 1 << 9 &&
2557 spi_device->addr_len == 1); 2559 spi_device->addr_len == 1);
2560 spi_device->erase_command =
2561 SPI_DEV_TYPE_FIELD(device_type, SPI_DEV_TYPE_ERASE_CMD);
2562 spi_device->erase_size =
2563 1 << SPI_DEV_TYPE_FIELD(device_type,
2564 SPI_DEV_TYPE_ERASE_SIZE);
2558 spi_device->block_size = 2565 spi_device->block_size =
2559 1 << SPI_DEV_TYPE_FIELD(device_type, 2566 1 << SPI_DEV_TYPE_FIELD(device_type,
2560 SPI_DEV_TYPE_BLOCK_SIZE); 2567 SPI_DEV_TYPE_BLOCK_SIZE);