diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2010-12-02 08:47:10 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-12-03 12:08:06 -0500 |
commit | 6a8872c54d177abd900a0cf165b76ecb4803f052 (patch) | |
tree | befd3690b9c73a7ae6342345c2a205a345d78028 /drivers/net/sfc/mtd.c | |
parent | 6c88b0b6dc886e49c0e6ee21d677c2e380bde688 (diff) |
sfc: Expose Falcon BootROM config through MTD, not ethtool
The ethtool EEPROM interface is really meant for exposing chip
configuration, not BootROM configuration.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc/mtd.c')
-rw-r--r-- | drivers/net/sfc/mtd.c | 77 |
1 files changed, 54 insertions, 23 deletions
diff --git a/drivers/net/sfc/mtd.c b/drivers/net/sfc/mtd.c index 02e54b4f701f..d44c74584e0f 100644 --- a/drivers/net/sfc/mtd.c +++ b/drivers/net/sfc/mtd.c | |||
@@ -387,35 +387,66 @@ static struct efx_mtd_ops falcon_mtd_ops = { | |||
387 | 387 | ||
388 | static int falcon_mtd_probe(struct efx_nic *efx) | 388 | static int falcon_mtd_probe(struct efx_nic *efx) |
389 | { | 389 | { |
390 | struct efx_spi_device *spi = efx->spi_flash; | 390 | struct efx_spi_device *spi; |
391 | struct efx_mtd *efx_mtd; | 391 | struct efx_mtd *efx_mtd; |
392 | int rc; | 392 | int rc = -ENODEV; |
393 | 393 | ||
394 | ASSERT_RTNL(); | 394 | ASSERT_RTNL(); |
395 | 395 | ||
396 | if (!spi || spi->size <= FALCON_FLASH_BOOTCODE_START) | 396 | spi = efx->spi_flash; |
397 | return -ENODEV; | 397 | if (spi && spi->size > FALCON_FLASH_BOOTCODE_START) { |
398 | 398 | efx_mtd = kzalloc(sizeof(*efx_mtd) + sizeof(efx_mtd->part[0]), | |
399 | efx_mtd = kzalloc(sizeof(*efx_mtd) + sizeof(efx_mtd->part[0]), | 399 | GFP_KERNEL); |
400 | GFP_KERNEL); | 400 | if (!efx_mtd) |
401 | if (!efx_mtd) | 401 | return -ENOMEM; |
402 | return -ENOMEM; | 402 | |
403 | 403 | efx_mtd->spi = spi; | |
404 | efx_mtd->spi = spi; | 404 | efx_mtd->name = "flash"; |
405 | efx_mtd->name = "flash"; | 405 | efx_mtd->ops = &falcon_mtd_ops; |
406 | efx_mtd->ops = &falcon_mtd_ops; | 406 | |
407 | efx_mtd->n_parts = 1; | ||
408 | efx_mtd->part[0].mtd.type = MTD_NORFLASH; | ||
409 | efx_mtd->part[0].mtd.flags = MTD_CAP_NORFLASH; | ||
410 | efx_mtd->part[0].mtd.size = spi->size - FALCON_FLASH_BOOTCODE_START; | ||
411 | efx_mtd->part[0].mtd.erasesize = spi->erase_size; | ||
412 | efx_mtd->part[0].offset = FALCON_FLASH_BOOTCODE_START; | ||
413 | efx_mtd->part[0].type_name = "sfc_flash_bootrom"; | ||
414 | |||
415 | rc = efx_mtd_probe_device(efx, efx_mtd); | ||
416 | if (rc) { | ||
417 | kfree(efx_mtd); | ||
418 | return rc; | ||
419 | } | ||
420 | } | ||
407 | 421 | ||
408 | efx_mtd->n_parts = 1; | 422 | spi = efx->spi_eeprom; |
409 | efx_mtd->part[0].mtd.type = MTD_NORFLASH; | 423 | if (spi && spi->size > EFX_EEPROM_BOOTCONFIG_START) { |
410 | efx_mtd->part[0].mtd.flags = MTD_CAP_NORFLASH; | 424 | efx_mtd = kzalloc(sizeof(*efx_mtd) + sizeof(efx_mtd->part[0]), |
411 | efx_mtd->part[0].mtd.size = spi->size - FALCON_FLASH_BOOTCODE_START; | 425 | GFP_KERNEL); |
412 | efx_mtd->part[0].mtd.erasesize = spi->erase_size; | 426 | if (!efx_mtd) |
413 | efx_mtd->part[0].offset = FALCON_FLASH_BOOTCODE_START; | 427 | return -ENOMEM; |
414 | efx_mtd->part[0].type_name = "sfc_flash_bootrom"; | 428 | |
429 | efx_mtd->spi = spi; | ||
430 | efx_mtd->name = "EEPROM"; | ||
431 | efx_mtd->ops = &falcon_mtd_ops; | ||
432 | |||
433 | efx_mtd->n_parts = 1; | ||
434 | efx_mtd->part[0].mtd.type = MTD_RAM; | ||
435 | efx_mtd->part[0].mtd.flags = MTD_CAP_RAM; | ||
436 | efx_mtd->part[0].mtd.size = | ||
437 | min(spi->size, EFX_EEPROM_BOOTCONFIG_END) - | ||
438 | EFX_EEPROM_BOOTCONFIG_START; | ||
439 | efx_mtd->part[0].mtd.erasesize = spi->erase_size; | ||
440 | efx_mtd->part[0].offset = EFX_EEPROM_BOOTCONFIG_START; | ||
441 | efx_mtd->part[0].type_name = "sfc_bootconfig"; | ||
442 | |||
443 | rc = efx_mtd_probe_device(efx, efx_mtd); | ||
444 | if (rc) { | ||
445 | kfree(efx_mtd); | ||
446 | return rc; | ||
447 | } | ||
448 | } | ||
415 | 449 | ||
416 | rc = efx_mtd_probe_device(efx, efx_mtd); | ||
417 | if (rc) | ||
418 | kfree(efx_mtd); | ||
419 | return rc; | 450 | return rc; |
420 | } | 451 | } |
421 | 452 | ||