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>
This commit is contained in:

committed by
Jeff Garzik

parent
0a95f56323
commit
f41507245e
@@ -1628,9 +1628,9 @@ static int falcon_spi_wait(struct efx_nic *efx)
|
||||
}
|
||||
}
|
||||
|
||||
static int falcon_spi_cmd(const struct efx_spi_device *spi,
|
||||
unsigned int command, int address,
|
||||
const void *in, void *out, unsigned int len)
|
||||
int falcon_spi_cmd(const struct efx_spi_device *spi,
|
||||
unsigned int command, int address,
|
||||
const void *in, void *out, unsigned int len)
|
||||
{
|
||||
struct efx_nic *efx = spi->efx;
|
||||
bool addressed = (address >= 0);
|
||||
@@ -1641,6 +1641,7 @@ static int falcon_spi_cmd(const struct efx_spi_device *spi,
|
||||
/* Input validation */
|
||||
if (len > FALCON_SPI_MAX_LEN)
|
||||
return -EINVAL;
|
||||
BUG_ON(!mutex_is_locked(&efx->spi_lock));
|
||||
|
||||
/* Check SPI not currently being accessed */
|
||||
rc = falcon_spi_wait(efx);
|
||||
@@ -1699,8 +1700,7 @@ efx_spi_munge_command(const struct efx_spi_device *spi,
|
||||
return command | (((address >> 8) & spi->munge_address) << 3);
|
||||
}
|
||||
|
||||
|
||||
static int falcon_spi_fast_wait(const struct efx_spi_device *spi)
|
||||
int falcon_spi_fast_wait(const struct efx_spi_device *spi)
|
||||
{
|
||||
u8 status;
|
||||
int i, rc;
|
||||
@@ -2259,7 +2259,9 @@ int falcon_read_nvram(struct efx_nic *efx, struct falcon_nvconfig *nvconfig_out)
|
||||
nvconfig = region + NVCONFIG_OFFSET;
|
||||
|
||||
spi = efx->spi_flash ? efx->spi_flash : efx->spi_eeprom;
|
||||
mutex_lock(&efx->spi_lock);
|
||||
rc = falcon_spi_read(spi, 0, FALCON_NVCONFIG_END, NULL, region);
|
||||
mutex_unlock(&efx->spi_lock);
|
||||
if (rc) {
|
||||
EFX_ERR(efx, "Failed to read %s\n",
|
||||
efx->spi_flash ? "flash" : "EEPROM");
|
||||
@@ -2555,6 +2557,11 @@ static int falcon_spi_device_init(struct efx_nic *efx,
|
||||
SPI_DEV_TYPE_FIELD(device_type, SPI_DEV_TYPE_ADDR_LEN);
|
||||
spi_device->munge_address = (spi_device->size == 1 << 9 &&
|
||||
spi_device->addr_len == 1);
|
||||
spi_device->erase_command =
|
||||
SPI_DEV_TYPE_FIELD(device_type, SPI_DEV_TYPE_ERASE_CMD);
|
||||
spi_device->erase_size =
|
||||
1 << SPI_DEV_TYPE_FIELD(device_type,
|
||||
SPI_DEV_TYPE_ERASE_SIZE);
|
||||
spi_device->block_size =
|
||||
1 << SPI_DEV_TYPE_FIELD(device_type,
|
||||
SPI_DEV_TYPE_BLOCK_SIZE);
|
||||
|
Reference in New Issue
Block a user