aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/sfc')
-rw-r--r--drivers/net/sfc/falcon.c57
1 files changed, 24 insertions, 33 deletions
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c
index 267019bb2b15..b2c3381c3cdb 100644
--- a/drivers/net/sfc/falcon.c
+++ b/drivers/net/sfc/falcon.c
@@ -1235,7 +1235,6 @@ static void falcon_remove_spi_devices(struct efx_nic *efx)
1235static int falcon_probe_nvconfig(struct efx_nic *efx) 1235static int falcon_probe_nvconfig(struct efx_nic *efx)
1236{ 1236{
1237 struct falcon_nvconfig *nvconfig; 1237 struct falcon_nvconfig *nvconfig;
1238 int board_rev;
1239 int rc; 1238 int rc;
1240 1239
1241 nvconfig = kmalloc(sizeof(*nvconfig), GFP_KERNEL); 1240 nvconfig = kmalloc(sizeof(*nvconfig), GFP_KERNEL);
@@ -1243,37 +1242,25 @@ static int falcon_probe_nvconfig(struct efx_nic *efx)
1243 return -ENOMEM; 1242 return -ENOMEM;
1244 1243
1245 rc = falcon_read_nvram(efx, nvconfig); 1244 rc = falcon_read_nvram(efx, nvconfig);
1246 if (rc == -EINVAL) { 1245 if (rc)
1247 netif_err(efx, probe, efx->net_dev,
1248 "NVRAM is invalid therefore using defaults\n");
1249 efx->phy_type = PHY_TYPE_NONE;
1250 efx->mdio.prtad = MDIO_PRTAD_NONE;
1251 board_rev = 0;
1252 rc = 0;
1253 } else if (rc) {
1254 goto fail1; 1246 goto fail1;
1255 } else { 1247
1256 struct falcon_nvconfig_board_v2 *v2 = &nvconfig->board_v2; 1248 efx->phy_type = nvconfig->board_v2.port0_phy_type;
1257 struct falcon_nvconfig_board_v3 *v3 = &nvconfig->board_v3; 1249 efx->mdio.prtad = nvconfig->board_v2.port0_phy_addr;
1258 1250
1259 efx->phy_type = v2->port0_phy_type; 1251 if (le16_to_cpu(nvconfig->board_struct_ver) >= 3) {
1260 efx->mdio.prtad = v2->port0_phy_addr; 1252 rc = falcon_spi_device_init(
1261 board_rev = le16_to_cpu(v2->board_revision); 1253 efx, &efx->spi_flash, FFE_AB_SPI_DEVICE_FLASH,
1262 1254 le32_to_cpu(nvconfig->board_v3
1263 if (le16_to_cpu(nvconfig->board_struct_ver) >= 3) { 1255 .spi_device_type[FFE_AB_SPI_DEVICE_FLASH]));
1264 rc = falcon_spi_device_init( 1256 if (rc)
1265 efx, &efx->spi_flash, FFE_AB_SPI_DEVICE_FLASH, 1257 goto fail2;
1266 le32_to_cpu(v3->spi_device_type 1258 rc = falcon_spi_device_init(
1267 [FFE_AB_SPI_DEVICE_FLASH])); 1259 efx, &efx->spi_eeprom, FFE_AB_SPI_DEVICE_EEPROM,
1268 if (rc) 1260 le32_to_cpu(nvconfig->board_v3
1269 goto fail2; 1261 .spi_device_type[FFE_AB_SPI_DEVICE_EEPROM]));
1270 rc = falcon_spi_device_init( 1262 if (rc)
1271 efx, &efx->spi_eeprom, FFE_AB_SPI_DEVICE_EEPROM, 1263 goto fail2;
1272 le32_to_cpu(v3->spi_device_type
1273 [FFE_AB_SPI_DEVICE_EEPROM]));
1274 if (rc)
1275 goto fail2;
1276 }
1277 } 1264 }
1278 1265
1279 /* Read the MAC addresses */ 1266 /* Read the MAC addresses */
@@ -1282,7 +1269,8 @@ static int falcon_probe_nvconfig(struct efx_nic *efx)
1282 netif_dbg(efx, probe, efx->net_dev, "PHY is %d phy_id %d\n", 1269 netif_dbg(efx, probe, efx->net_dev, "PHY is %d phy_id %d\n",
1283 efx->phy_type, efx->mdio.prtad); 1270 efx->phy_type, efx->mdio.prtad);
1284 1271
1285 rc = falcon_probe_board(efx, board_rev); 1272 rc = falcon_probe_board(efx,
1273 le16_to_cpu(nvconfig->board_v2.board_revision));
1286 if (rc) 1274 if (rc)
1287 goto fail2; 1275 goto fail2;
1288 1276
@@ -1419,8 +1407,11 @@ static int falcon_probe_nic(struct efx_nic *efx)
1419 1407
1420 /* Read in the non-volatile configuration */ 1408 /* Read in the non-volatile configuration */
1421 rc = falcon_probe_nvconfig(efx); 1409 rc = falcon_probe_nvconfig(efx);
1422 if (rc) 1410 if (rc) {
1411 if (rc == -EINVAL)
1412 netif_err(efx, probe, efx->net_dev, "NVRAM is invalid\n");
1423 goto fail5; 1413 goto fail5;
1414 }
1424 1415
1425 /* Initialise I2C adapter */ 1416 /* Initialise I2C adapter */
1426 board = falcon_board(efx); 1417 board = falcon_board(efx);