aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2012-11-27 23:12:41 -0500
committerBen Hutchings <bhutchings@solarflare.com>2013-08-22 14:26:03 -0400
commitecd0a6f0f2c70a3b713bc77d8a32d6b4ad5ad49b (patch)
treeb194eea24d807eaeaa99fea1d72cd92eef73bb0d
parent964e61355e94905e4234839d4b41678998d617b7 (diff)
sfc: Rename SPI stuff to show that it is Falcon-specific
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
-rw-r--r--drivers/net/ethernet/sfc/falcon.c30
-rw-r--r--drivers/net/ethernet/sfc/mtd.c42
-rw-r--r--drivers/net/ethernet/sfc/nic.h4
-rw-r--r--drivers/net/ethernet/sfc/spi.h18
4 files changed, 47 insertions, 47 deletions
diff --git a/drivers/net/ethernet/sfc/falcon.c b/drivers/net/ethernet/sfc/falcon.c
index 983e7f5c4e11..304131b08f17 100644
--- a/drivers/net/ethernet/sfc/falcon.c
+++ b/drivers/net/ethernet/sfc/falcon.c
@@ -434,7 +434,7 @@ static int falcon_spi_wait(struct efx_nic *efx)
434 } 434 }
435} 435}
436 436
437int falcon_spi_cmd(struct efx_nic *efx, const struct efx_spi_device *spi, 437int falcon_spi_cmd(struct efx_nic *efx, const struct falcon_spi_device *spi,
438 unsigned int command, int address, 438 unsigned int command, int address,
439 const void *in, void *out, size_t len) 439 const void *in, void *out, size_t len)
440{ 440{
@@ -491,22 +491,22 @@ int falcon_spi_cmd(struct efx_nic *efx, const struct efx_spi_device *spi,
491} 491}
492 492
493static size_t 493static size_t
494falcon_spi_write_limit(const struct efx_spi_device *spi, size_t start) 494falcon_spi_write_limit(const struct falcon_spi_device *spi, size_t start)
495{ 495{
496 return min(FALCON_SPI_MAX_LEN, 496 return min(FALCON_SPI_MAX_LEN,
497 (spi->block_size - (start & (spi->block_size - 1)))); 497 (spi->block_size - (start & (spi->block_size - 1))));
498} 498}
499 499
500static inline u8 500static inline u8
501efx_spi_munge_command(const struct efx_spi_device *spi, 501falcon_spi_munge_command(const struct falcon_spi_device *spi,
502 const u8 command, const unsigned int address) 502 const u8 command, const unsigned int address)
503{ 503{
504 return command | (((address >> 8) & spi->munge_address) << 3); 504 return command | (((address >> 8) & spi->munge_address) << 3);
505} 505}
506 506
507/* Wait up to 10 ms for buffered write completion */ 507/* Wait up to 10 ms for buffered write completion */
508int 508int
509falcon_spi_wait_write(struct efx_nic *efx, const struct efx_spi_device *spi) 509falcon_spi_wait_write(struct efx_nic *efx, const struct falcon_spi_device *spi)
510{ 510{
511 unsigned long timeout = jiffies + 1 + DIV_ROUND_UP(HZ, 100); 511 unsigned long timeout = jiffies + 1 + DIV_ROUND_UP(HZ, 100);
512 u8 status; 512 u8 status;
@@ -530,7 +530,7 @@ falcon_spi_wait_write(struct efx_nic *efx, const struct efx_spi_device *spi)
530 } 530 }
531} 531}
532 532
533int falcon_spi_read(struct efx_nic *efx, const struct efx_spi_device *spi, 533int falcon_spi_read(struct efx_nic *efx, const struct falcon_spi_device *spi,
534 loff_t start, size_t len, size_t *retlen, u8 *buffer) 534 loff_t start, size_t len, size_t *retlen, u8 *buffer)
535{ 535{
536 size_t block_len, pos = 0; 536 size_t block_len, pos = 0;
@@ -540,7 +540,7 @@ int falcon_spi_read(struct efx_nic *efx, const struct efx_spi_device *spi,
540 while (pos < len) { 540 while (pos < len) {
541 block_len = min(len - pos, FALCON_SPI_MAX_LEN); 541 block_len = min(len - pos, FALCON_SPI_MAX_LEN);
542 542
543 command = efx_spi_munge_command(spi, SPI_READ, start + pos); 543 command = falcon_spi_munge_command(spi, SPI_READ, start + pos);
544 rc = falcon_spi_cmd(efx, spi, command, start + pos, NULL, 544 rc = falcon_spi_cmd(efx, spi, command, start + pos, NULL,
545 buffer + pos, block_len); 545 buffer + pos, block_len);
546 if (rc) 546 if (rc)
@@ -561,7 +561,7 @@ int falcon_spi_read(struct efx_nic *efx, const struct efx_spi_device *spi,
561} 561}
562 562
563int 563int
564falcon_spi_write(struct efx_nic *efx, const struct efx_spi_device *spi, 564falcon_spi_write(struct efx_nic *efx, const struct falcon_spi_device *spi,
565 loff_t start, size_t len, size_t *retlen, const u8 *buffer) 565 loff_t start, size_t len, size_t *retlen, const u8 *buffer)
566{ 566{
567 u8 verify_buffer[FALCON_SPI_MAX_LEN]; 567 u8 verify_buffer[FALCON_SPI_MAX_LEN];
@@ -576,7 +576,7 @@ falcon_spi_write(struct efx_nic *efx, const struct efx_spi_device *spi,
576 576
577 block_len = min(len - pos, 577 block_len = min(len - pos,
578 falcon_spi_write_limit(spi, start + pos)); 578 falcon_spi_write_limit(spi, start + pos));
579 command = efx_spi_munge_command(spi, SPI_WRITE, start + pos); 579 command = falcon_spi_munge_command(spi, SPI_WRITE, start + pos);
580 rc = falcon_spi_cmd(efx, spi, command, start + pos, 580 rc = falcon_spi_cmd(efx, spi, command, start + pos,
581 buffer + pos, NULL, block_len); 581 buffer + pos, NULL, block_len);
582 if (rc) 582 if (rc)
@@ -586,7 +586,7 @@ falcon_spi_write(struct efx_nic *efx, const struct efx_spi_device *spi,
586 if (rc) 586 if (rc)
587 break; 587 break;
588 588
589 command = efx_spi_munge_command(spi, SPI_READ, start + pos); 589 command = falcon_spi_munge_command(spi, SPI_READ, start + pos);
590 rc = falcon_spi_cmd(efx, spi, command, start + pos, 590 rc = falcon_spi_cmd(efx, spi, command, start + pos,
591 NULL, verify_buffer, block_len); 591 NULL, verify_buffer, block_len);
592 if (memcmp(verify_buffer, buffer + pos, block_len)) { 592 if (memcmp(verify_buffer, buffer + pos, block_len)) {
@@ -1481,15 +1481,15 @@ falcon_read_nvram(struct efx_nic *efx, struct falcon_nvconfig *nvconfig_out)
1481{ 1481{
1482 struct falcon_nic_data *nic_data = efx->nic_data; 1482 struct falcon_nic_data *nic_data = efx->nic_data;
1483 struct falcon_nvconfig *nvconfig; 1483 struct falcon_nvconfig *nvconfig;
1484 struct efx_spi_device *spi; 1484 struct falcon_spi_device *spi;
1485 void *region; 1485 void *region;
1486 int rc, magic_num, struct_ver; 1486 int rc, magic_num, struct_ver;
1487 __le16 *word, *limit; 1487 __le16 *word, *limit;
1488 u32 csum; 1488 u32 csum;
1489 1489
1490 if (efx_spi_present(&nic_data->spi_flash)) 1490 if (falcon_spi_present(&nic_data->spi_flash))
1491 spi = &nic_data->spi_flash; 1491 spi = &nic_data->spi_flash;
1492 else if (efx_spi_present(&nic_data->spi_eeprom)) 1492 else if (falcon_spi_present(&nic_data->spi_eeprom))
1493 spi = &nic_data->spi_eeprom; 1493 spi = &nic_data->spi_eeprom;
1494 else 1494 else
1495 return -EINVAL; 1495 return -EINVAL;
@@ -1504,7 +1504,7 @@ falcon_read_nvram(struct efx_nic *efx, struct falcon_nvconfig *nvconfig_out)
1504 mutex_unlock(&nic_data->spi_lock); 1504 mutex_unlock(&nic_data->spi_lock);
1505 if (rc) { 1505 if (rc) {
1506 netif_err(efx, hw, efx->net_dev, "Failed to read %s\n", 1506 netif_err(efx, hw, efx->net_dev, "Failed to read %s\n",
1507 efx_spi_present(&nic_data->spi_flash) ? 1507 falcon_spi_present(&nic_data->spi_flash) ?
1508 "flash" : "EEPROM"); 1508 "flash" : "EEPROM");
1509 rc = -EIO; 1509 rc = -EIO;
1510 goto out; 1510 goto out;
@@ -1849,7 +1849,7 @@ static int falcon_reset_sram(struct efx_nic *efx)
1849} 1849}
1850 1850
1851static void falcon_spi_device_init(struct efx_nic *efx, 1851static void falcon_spi_device_init(struct efx_nic *efx,
1852 struct efx_spi_device *spi_device, 1852 struct falcon_spi_device *spi_device,
1853 unsigned int device_id, u32 device_type) 1853 unsigned int device_id, u32 device_type)
1854{ 1854{
1855 if (device_type != 0) { 1855 if (device_type != 0) {
diff --git a/drivers/net/ethernet/sfc/mtd.c b/drivers/net/ethernet/sfc/mtd.c
index 08f825b71ac8..e4b35c61e90b 100644
--- a/drivers/net/ethernet/sfc/mtd.c
+++ b/drivers/net/ethernet/sfc/mtd.c
@@ -22,7 +22,7 @@
22#include "mcdi.h" 22#include "mcdi.h"
23#include "mcdi_pcol.h" 23#include "mcdi_pcol.h"
24 24
25#define EFX_SPI_VERIFY_BUF_LEN 16 25#define FALCON_SPI_VERIFY_BUF_LEN 16
26 26
27struct efx_mtd_partition { 27struct efx_mtd_partition {
28 struct mtd_info mtd; 28 struct mtd_info mtd;
@@ -50,7 +50,7 @@ struct efx_mtd_ops {
50struct efx_mtd { 50struct efx_mtd {
51 struct list_head node; 51 struct list_head node;
52 struct efx_nic *efx; 52 struct efx_nic *efx;
53 const struct efx_spi_device *spi; 53 const struct falcon_spi_device *spi;
54 const char *name; 54 const char *name;
55 const struct efx_mtd_ops *ops; 55 const struct efx_mtd_ops *ops;
56 size_t n_parts; 56 size_t n_parts;
@@ -71,10 +71,10 @@ static int siena_mtd_probe(struct efx_nic *efx);
71/* SPI utilities */ 71/* SPI utilities */
72 72
73static int