diff options
-rw-r--r-- | drivers/net/sfc/efx.c | 25 | ||||
-rw-r--r-- | drivers/net/sfc/ethtool.c | 6 | ||||
-rw-r--r-- | drivers/net/sfc/falcon.c | 11 | ||||
-rw-r--r-- | drivers/net/sfc/falcon.h | 5 | ||||
-rw-r--r-- | drivers/net/sfc/falcon_boards.c | 106 | ||||
-rw-r--r-- | drivers/net/sfc/net_driver.h | 6 | ||||
-rw-r--r-- | drivers/net/sfc/qt202x_phy.c | 2 | ||||
-rw-r--r-- | drivers/net/sfc/tenxpress.c | 2 |
8 files changed, 88 insertions, 75 deletions
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c index d7705a755164..c9f80042669f 100644 --- a/drivers/net/sfc/efx.c +++ b/drivers/net/sfc/efx.c | |||
@@ -1265,7 +1265,7 @@ static void efx_monitor(struct work_struct *data) | |||
1265 | goto out_requeue; | 1265 | goto out_requeue; |
1266 | if (!efx->port_enabled) | 1266 | if (!efx->port_enabled) |
1267 | goto out_unlock; | 1267 | goto out_unlock; |
1268 | rc = efx->board_info.monitor(efx); | 1268 | rc = falcon_board(efx)->monitor(efx); |
1269 | if (rc) { | 1269 | if (rc) { |
1270 | EFX_ERR(efx, "Board sensor %s; shutting down PHY\n", | 1270 | EFX_ERR(efx, "Board sensor %s; shutting down PHY\n", |
1271 | (rc == -ERANGE) ? "reported fault" : "failed"); | 1271 | (rc == -ERANGE) ? "reported fault" : "failed"); |
@@ -1908,7 +1908,7 @@ static struct efx_phy_operations efx_dummy_phy_operations = { | |||
1908 | .clear_interrupt = efx_port_dummy_op_void, | 1908 | .clear_interrupt = efx_port_dummy_op_void, |
1909 | }; | 1909 | }; |
1910 | 1910 | ||
1911 | static struct efx_board efx_dummy_board_info = { | 1911 | static struct falcon_board efx_dummy_board_info = { |
1912 | .init = efx_port_dummy_op_int, | 1912 | .init = efx_port_dummy_op_int, |
1913 | .init_phy = efx_port_dummy_op_void, | 1913 | .init_phy = efx_port_dummy_op_void, |
1914 | .set_id_led = efx_port_dummy_op_set_id_led, | 1914 | .set_id_led = efx_port_dummy_op_set_id_led, |
@@ -2026,10 +2026,6 @@ static void efx_pci_remove_main(struct efx_nic *efx) | |||
2026 | falcon_fini_interrupt(efx); | 2026 | falcon_fini_interrupt(efx); |
2027 | efx_fini_channels(efx); | 2027 | efx_fini_channels(efx); |
2028 | efx_fini_port(efx); | 2028 | efx_fini_port(efx); |
2029 | |||
2030 | /* Shutdown the board, then the NIC and board state */ | ||
2031 | efx->board_info.fini(efx); | ||
2032 | |||
2033 | efx_fini_napi(efx); | 2029 | efx_fini_napi(efx); |
2034 | efx_remove_all(efx); | 2030 | efx_remove_all(efx); |
2035 | } | 2031 | } |
@@ -2089,39 +2085,30 @@ static int efx_pci_probe_main(struct efx_nic *efx) | |||
2089 | if (rc) | 2085 | if (rc) |
2090 | goto fail2; | 2086 | goto fail2; |
2091 | 2087 | ||
2092 | /* Initialise the board */ | ||
2093 | rc = efx->board_info.init(efx); | ||
2094 | if (rc) { | ||
2095 | EFX_ERR(efx, "failed to initialise board\n"); | ||
2096 | goto fail3; | ||
2097 | } | ||
2098 | |||
2099 | rc = falcon_init_nic(efx); | 2088 | rc = falcon_init_nic(efx); |
2100 | if (rc) { | 2089 | if (rc) { |
2101 | EFX_ERR(efx, "failed to initialise NIC\n"); | 2090 | EFX_ERR(efx, "failed to initialise NIC\n"); |
2102 | goto fail4; | 2091 | goto fail3; |
2103 | } | 2092 | } |
2104 | 2093 | ||
2105 | rc = efx_init_port(efx); | 2094 | rc = efx_init_port(efx); |
2106 | if (rc) { | 2095 | if (rc) { |
2107 | EFX_ERR(efx, "failed to initialise port\n"); | 2096 | EFX_ERR(efx, "failed to initialise port\n"); |
2108 | goto fail5; | 2097 | goto fail4; |
2109 | } | 2098 | } |
2110 | 2099 | ||
2111 | efx_init_channels(efx); | 2100 | efx_init_channels(efx); |
2112 | 2101 | ||
2113 | rc = falcon_init_interrupt(efx); | 2102 | rc = falcon_init_interrupt(efx); |
2114 | if (rc) | 2103 | if (rc) |
2115 | goto fail6; | 2104 | goto fail5; |
2116 | 2105 | ||
2117 | return 0; | 2106 | return 0; |
2118 | 2107 | ||
2119 | fail6: | 2108 | fail5: |
2120 | efx_fini_channels(efx); | 2109 | efx_fini_channels(efx); |
2121 | efx_fini_port(efx); | 2110 | efx_fini_port(efx); |
2122 | fail5: | ||
2123 | fail4: | 2111 | fail4: |
2124 | efx->board_info.fini(efx); | ||
2125 | fail3: | 2112 | fail3: |
2126 | efx_fini_napi(efx); | 2113 | efx_fini_napi(efx); |
2127 | fail2: | 2114 | fail2: |
diff --git a/drivers/net/sfc/ethtool.c b/drivers/net/sfc/ethtool.c index 18e02712818c..bb415326c739 100644 --- a/drivers/net/sfc/ethtool.c +++ b/drivers/net/sfc/ethtool.c | |||
@@ -188,14 +188,14 @@ static int efx_ethtool_phys_id(struct net_device *net_dev, u32 count) | |||
188 | struct efx_nic *efx = netdev_priv(net_dev); | 188 | struct efx_nic *efx = netdev_priv(net_dev); |
189 | 189 | ||
190 | do { | 190 | do { |
191 | efx->board_info.set_id_led(efx, EFX_LED_ON); | 191 | falcon_board(efx)->set_id_led(efx, EFX_LED_ON); |
192 | schedule_timeout_interruptible(HZ / 2); | 192 | schedule_timeout_interruptible(HZ / 2); |
193 | 193 | ||
194 | efx->board_info.set_id_led(efx, EFX_LED_OFF); | 194 | falcon_board(efx)->set_id_led(efx, EFX_LED_OFF); |
195 | schedule_timeout_interruptible(HZ / 2); | 195 | schedule_timeout_interruptible(HZ / 2); |
196 | } while (!signal_pending(current) && --count != 0); | 196 | } while (!signal_pending(current) && --count != 0); |
197 | 197 | ||
198 | efx->board_info.set_id_led(efx, EFX_LED_DEFAULT); | 198 | falcon_board(efx)->set_id_led(efx, EFX_LED_DEFAULT); |
199 | return 0; | 199 | return 0; |
200 | } | 200 | } |
201 | 201 | ||
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c index 865638b035bf..29e79f77b732 100644 --- a/drivers/net/sfc/falcon.c +++ b/drivers/net/sfc/falcon.c | |||
@@ -2877,8 +2877,17 @@ int falcon_probe_nic(struct efx_nic *efx) | |||
2877 | if (rc) | 2877 | if (rc) |
2878 | goto fail5; | 2878 | goto fail5; |
2879 | 2879 | ||
2880 | rc = falcon_board(efx)->init(efx); | ||
2881 | if (rc) { | ||
2882 | EFX_ERR(efx, "failed to initialise board\n"); | ||
2883 | goto fail6; | ||
2884 | } | ||
2885 | |||
2880 | return 0; | 2886 | return 0; |
2881 | 2887 | ||
2888 | fail6: | ||
2889 | BUG_ON(i2c_del_adapter(&efx->i2c_adap)); | ||
2890 | memset(&efx->i2c_adap, 0, sizeof(efx->i2c_adap)); | ||
2882 | fail5: | 2891 | fail5: |
2883 | falcon_remove_spi_devices(efx); | 2892 | falcon_remove_spi_devices(efx); |
2884 | falcon_free_buffer(efx, &efx->irq_status); | 2893 | falcon_free_buffer(efx, &efx->irq_status); |
@@ -3070,6 +3079,8 @@ void falcon_remove_nic(struct efx_nic *efx) | |||
3070 | struct falcon_nic_data *nic_data = efx->nic_data; | 3079 | struct falcon_nic_data *nic_data = efx->nic_data; |
3071 | int rc; | 3080 | int rc; |
3072 | 3081 | ||
3082 | falcon_board(efx)->fini(efx); | ||
3083 | |||
3073 | /* Remove I2C adapter and clear it in preparation for a retry */ | 3084 | /* Remove I2C adapter and clear it in preparation for a retry */ |
3074 | rc = i2c_del_adapter(&efx->i2c_adap); | 3085 | rc = i2c_del_adapter(&efx->i2c_adap); |
3075 | BUG_ON(rc); | 3086 | BUG_ON(rc); |
diff --git a/drivers/net/sfc/falcon.h b/drivers/net/sfc/falcon.h index 4dd965774a90..54dad2de22f2 100644 --- a/drivers/net/sfc/falcon.h +++ b/drivers/net/sfc/falcon.h | |||
@@ -29,6 +29,11 @@ static inline int falcon_rev(struct efx_nic *efx) | |||
29 | return efx->pci_dev->revision; | 29 | return efx->pci_dev->revision; |
30 | } | 30 | } |
31 | 31 | ||
32 | static inline struct falcon_board *falcon_board(struct efx_nic *efx) | ||
33 | { | ||
34 | return &efx->board_info; | ||
35 | } | ||
36 | |||
32 | extern struct efx_nic_type falcon_a_nic_type; | 37 | extern struct efx_nic_type falcon_a_nic_type; |
33 | extern struct efx_nic_type falcon_b_nic_type; | 38 | extern struct efx_nic_type falcon_b_nic_type; |
34 | 39 | ||
diff --git a/drivers/net/sfc/falcon_boards.c b/drivers/net/sfc/falcon_boards.c index 429d3cd646b5..af7cd2a0b449 100644 --- a/drivers/net/sfc/falcon_boards.c +++ b/drivers/net/sfc/falcon_boards.c | |||
@@ -65,7 +65,7 @@ static int efx_init_lm87(struct efx_nic *efx, struct i2c_board_info *info, | |||
65 | goto err; | 65 | goto err; |
66 | } | 66 | } |
67 | 67 | ||
68 | efx->board_info.hwmon_client = client; | 68 | falcon_board(efx)->hwmon_client = client; |
69 | return 0; | 69 | return 0; |
70 | 70 | ||
71 | err: | 71 | err: |
@@ -75,12 +75,12 @@ err: | |||
75 | 75 | ||
76 | static void efx_fini_lm87(struct efx_nic *efx) | 76 | static void efx_fini_lm87(struct efx_nic *efx) |
77 | { | 77 | { |
78 | i2c_unregister_device(efx->board_info.hwmon_client); | 78 | i2c_unregister_device(falcon_board(efx)->hwmon_client); |
79 | } | 79 | } |
80 | 80 | ||
81 | static int efx_check_lm87(struct efx_nic *efx, unsigned mask) | 81 | static int efx_check_lm87(struct efx_nic *efx, unsigned mask) |
82 | { | 82 | { |
83 | struct i2c_client *client = efx->board_info.hwmon_client; | 83 | struct i2c_client *client = falcon_board(efx)->hwmon_client; |
84 | s32 alarms1, alarms2; | 84 | s32 alarms1, alarms2; |
85 | 85 | ||
86 | /* If link is up then do not monitor temperature */ | 86 | /* If link is up then do not monitor temperature */ |
@@ -189,8 +189,8 @@ static inline int efx_check_lm87(struct efx_nic *efx, unsigned mask) | |||
189 | 189 | ||
190 | static void sfe4001_poweroff(struct efx_nic *efx) | 190 | static void sfe4001_poweroff(struct efx_nic *efx) |
191 | { | 191 | { |
192 | struct i2c_client *ioexp_client = efx->board_info.ioexp_client; | 192 | struct i2c_client *ioexp_client = falcon_board(efx)->ioexp_client; |
193 | struct i2c_client *hwmon_client = efx->board_info.hwmon_client; | 193 | struct i2c_client *hwmon_client = falcon_board(efx)->hwmon_client; |
194 | 194 | ||
195 | /* Turn off all power rails and disable outputs */ | 195 | /* Turn off all power rails and disable outputs */ |
196 | i2c_smbus_write_byte_data(ioexp_client, P0_OUT, 0xff); | 196 | i2c_smbus_write_byte_data(ioexp_client, P0_OUT, 0xff); |
@@ -203,8 +203,8 @@ static void sfe4001_poweroff(struct efx_nic *efx) | |||
203 | 203 | ||
204 | static int sfe4001_poweron(struct efx_nic *efx) | 204 | static int sfe4001_poweron(struct efx_nic *efx) |
205 | { | 205 | { |
206 | struct i2c_client *hwmon_client = efx->board_info.hwmon_client; | 206 | struct i2c_client *ioexp_client = falcon_board(efx)->ioexp_client; |
207 | struct i2c_client *ioexp_client = efx->board_info.ioexp_client; | 207 | struct i2c_client *hwmon_client = falcon_board(efx)->hwmon_client; |
208 | unsigned int i, j; | 208 | unsigned int i, j; |
209 | int rc; | 209 | int rc; |
210 | u8 out; | 210 | u8 out; |
@@ -346,7 +346,7 @@ static ssize_t set_phy_flash_cfg(struct device *dev, | |||
346 | efx->phy_mode = new_mode; | 346 | efx->phy_mode = new_mode; |
347 | if (new_mode & PHY_MODE_SPECIAL) | 347 | if (new_mode & PHY_MODE_SPECIAL) |
348 | efx_stats_disable(efx); | 348 | efx_stats_disable(efx); |
349 | if (efx->board_info.type == FALCON_BOARD_SFE4001) | 349 | if (falcon_board(efx)->type == FALCON_BOARD_SFE4001) |
350 | err = sfe4001_poweron(efx); | 350 | err = sfe4001_poweron(efx); |
351 | else | 351 | else |
352 | err = sfn4111t_reset(efx); | 352 | err = sfn4111t_reset(efx); |
@@ -363,12 +363,14 @@ static DEVICE_ATTR(phy_flash_cfg, 0644, show_phy_flash_cfg, set_phy_flash_cfg); | |||
363 | 363 | ||
364 | static void sfe4001_fini(struct efx_nic *efx) | 364 | static void sfe4001_fini(struct efx_nic *efx) |
365 | { | 365 | { |
366 | struct falcon_board *board = falcon_board(efx); | ||
367 | |||
366 | EFX_INFO(efx, "%s\n", __func__); | 368 | EFX_INFO(efx, "%s\n", __func__); |
367 | 369 | ||
368 | device_remove_file(&efx->pci_dev->dev, &dev_attr_phy_flash_cfg); | 370 | device_remove_file(&efx->pci_dev->dev, &dev_attr_phy_flash_cfg); |
369 | sfe4001_poweroff(efx); | 371 | sfe4001_poweroff(efx); |
370 | i2c_unregister_device(efx->board_info.ioexp_client); | 372 | i2c_unregister_device(board->ioexp_client); |
371 | i2c_unregister_device(efx->board_info.hwmon_client); | 373 | i2c_unregister_device(board->hwmon_client); |
372 | } | 374 | } |
373 | 375 | ||
374 | static int sfe4001_check_hw(struct efx_nic *efx) | 376 | static int sfe4001_check_hw(struct efx_nic *efx) |
@@ -387,7 +389,7 @@ static int sfe4001_check_hw(struct efx_nic *efx) | |||
387 | * the power undesirably. | 389 | * the power undesirably. |
388 | * We know we can read from the IO expander because we did | 390 | * We know we can read from the IO expander because we did |
389 | * it during power-on. Assume failure now is bad news. */ | 391 | * it during power-on. Assume failure now is bad news. */ |
390 | status = i2c_smbus_read_byte_data(efx->board_info.ioexp_client, P1_IN); | 392 | status = i2c_smbus_read_byte_data(falcon_board(efx)->ioexp_client, P1_IN); |
391 | if (status >= 0 && | 393 | if (status >= 0 && |
392 | (status & ((1 << P1_AFE_PWD_LBN) | (1 << P1_DSP_PWD25_LBN))) != 0) | 394 | (status & ((1 << P1_AFE_PWD_LBN) | (1 << P1_DSP_PWD25_LBN))) != 0) |
393 | return 0; | 395 | return 0; |
@@ -409,36 +411,37 @@ static struct i2c_board_info sfe4001_hwmon_info = { | |||
409 | */ | 411 | */ |
410 | static int sfe4001_init(struct efx_nic *efx) | 412 | static int sfe4001_init(struct efx_nic *efx) |
411 | { | 413 | { |
414 | struct falcon_board *board = falcon_board(efx); | ||
412 | int rc; | 415 | int rc; |
413 | 416 | ||
414 | #if defined(CONFIG_SENSORS_LM90) || defined(CONFIG_SENSORS_LM90_MODULE) | 417 | #if defined(CONFIG_SENSORS_LM90) || defined(CONFIG_SENSORS_LM90_MODULE) |
415 | efx->board_info.hwmon_client = | 418 | board->hwmon_client = |
416 | i2c_new_device(&efx->i2c_adap, &sfe4001_hwmon_info); | 419 | i2c_new_device(&efx->i2c_adap, &sfe4001_hwmon_info); |
417 | #else | 420 | #else |
418 | efx->board_info.hwmon_client = | 421 | board->hwmon_client = |
419 | i2c_new_dummy(&efx->i2c_adap, sfe4001_hwmon_info.addr); | 422 | i2c_new_dummy(&efx->i2c_adap, sfe4001_hwmon_info.addr); |
420 | #endif | 423 | #endif |
421 | if (!efx->board_info.hwmon_client) | 424 | if (!board->hwmon_client) |
422 | return -EIO; | 425 | return -EIO; |
423 | 426 | ||
424 | /* Raise board/PHY high limit from 85 to 90 degrees Celsius */ | 427 | /* Raise board/PHY high limit from 85 to 90 degrees Celsius */ |
425 | rc = i2c_smbus_write_byte_data(efx->board_info.hwmon_client, | 428 | rc = i2c_smbus_write_byte_data(board->hwmon_client, |
426 | MAX664X_REG_WLHO, 90); | 429 | MAX664X_REG_WLHO, 90); |
427 | if (rc) | 430 | if (rc) |
428 | goto fail_hwmon; | 431 | goto fail_hwmon; |
429 | 432 | ||
430 | efx->board_info.ioexp_client = i2c_new_dummy(&efx->i2c_adap, PCA9539); | 433 | board->ioexp_client = i2c_new_dummy(&efx->i2c_adap, PCA9539); |
431 | if (!efx->board_info.ioexp_client) { | 434 | if (!board->ioexp_client) { |
432 | rc = -EIO; | 435 | rc = -EIO; |
433 | goto fail_hwmon; | 436 | goto fail_hwmon; |
434 | } | 437 | } |
435 | 438 | ||
436 | /* 10Xpress has fixed-function LED pins, so there is no board-specific | 439 | /* 10Xpress has fixed-function LED pins, so there is no board-specific |
437 | * blink code. */ | 440 | * blink code. */ |
438 | efx->board_info.set_id_led = tenxpress_set_id_led; | 441 | board->set_id_led = tenxpress_set_id_led; |
439 | 442 | ||
440 | efx->board_info.monitor = sfe4001_check_hw; | 443 | board->monitor = sfe4001_check_hw; |
441 | efx->board_info.fini = sfe4001_fini; | 444 | board->fini = sfe4001_fini; |
442 | 445 | ||
443 | if (efx->phy_mode & PHY_MODE_SPECIAL) { | 446 | if (efx->phy_mode & PHY_MODE_SPECIAL) { |
444 | /* PHY won't generate a 156.25 MHz clock and MAC stats fetch | 447 | /* PHY won't generate a 156.25 MHz clock and MAC stats fetch |
@@ -459,9 +462,9 @@ static int sfe4001_init(struct efx_nic *efx) | |||
459 | fail_on: | 462 | fail_on: |
460 | sfe4001_poweroff(efx); | 463 | sfe4001_poweroff(efx); |
461 | fail_ioexp: | 464 | fail_ioexp: |
462 | i2c_unregister_device(efx->board_info.ioexp_client); | 465 | i2c_unregister_device(board->ioexp_client); |
463 | fail_hwmon: | 466 | fail_hwmon: |
464 | i2c_unregister_device(efx->board_info.hwmon_client); | 467 | i2c_unregister_device(board->hwmon_client); |
465 | return rc; | 468 | return rc; |
466 | } | 469 | } |
467 | 470 | ||
@@ -474,7 +477,7 @@ static int sfn4111t_check_hw(struct efx_nic *efx) | |||
474 | return 0; | 477 | return 0; |
475 | 478 | ||
476 | /* Test LHIGH, RHIGH, FAULT, EOT and IOT alarms */ | 479 | /* Test LHIGH, RHIGH, FAULT, EOT and IOT alarms */ |
477 | status = i2c_smbus_read_byte_data(efx->board_info.hwmon_client, | 480 | status = i2c_smbus_read_byte_data(falcon_board(efx)->hwmon_client, |
478 | MAX664X_REG_RSL); | 481 | MAX664X_REG_RSL); |
479 | if (status < 0) | 482 | if (status < 0) |
480 | return -EIO; | 483 | return -EIO; |
@@ -488,7 +491,7 @@ static void sfn4111t_fini(struct efx_nic *efx) | |||
488 | EFX_INFO(efx, "%s\n", __func__); | 491 | EFX_INFO(efx, "%s\n", __func__); |
489 | 492 | ||
490 | device_remove_file(&efx->pci_dev->dev, &dev_attr_phy_flash_cfg); | 493 | device_remove_file(&efx->pci_dev->dev, &dev_attr_phy_flash_cfg); |
491 | i2c_unregister_device(efx->board_info.hwmon_client); | 494 | i2c_unregister_device(falcon_board(efx)->hwmon_client); |
492 | } | 495 | } |
493 | 496 | ||
494 | static struct i2c_board_info sfn4111t_a0_hwmon_info = { | 497 | static struct i2c_board_info sfn4111t_a0_hwmon_info = { |
@@ -515,20 +518,21 @@ static void sfn4111t_init_phy(struct efx_nic *efx) | |||
515 | 518 | ||
516 | static int sfn4111t_init(struct efx_nic *efx) | 519 | static int sfn4111t_init(struct efx_nic *efx) |
517 | { | 520 | { |
521 | struct falcon_board *board = falcon_board(efx); | ||
518 | int rc; | 522 | int rc; |
519 | 523 | ||
520 | efx->board_info.hwmon_client = | 524 | board->hwmon_client = |
521 | i2c_new_device(&efx->i2c_adap, | 525 | i2c_new_device(&efx->i2c_adap, |
522 | (efx->board_info.minor < 5) ? | 526 | (board->minor < 5) ? |
523 | &sfn4111t_a0_hwmon_info : | 527 | &sfn4111t_a0_hwmon_info : |
524 | &sfn4111t_r5_hwmon_info); | 528 | &sfn4111t_r5_hwmon_info); |
525 | if (!efx->board_info.hwmon_client) | 529 | if (!board->hwmon_client) |
526 | return -EIO; | 530 | return -EIO; |
527 | 531 | ||
528 | efx->board_info.init_phy = sfn4111t_init_phy; | 532 | board->init_phy = sfn4111t_init_phy; |
529 | efx->board_info.set_id_led = tenxpress_set_id_led; | 533 | board->set_id_led = tenxpress_set_id_led; |
530 | efx->board_info.monitor = sfn4111t_check_hw; | 534 | board->monitor = sfn4111t_check_hw; |
531 | efx->board_info.fini = sfn4111t_fini; | 535 | board->fini = sfn4111t_fini; |
532 | 536 | ||
533 | rc = device_create_file(&efx->pci_dev->dev, &dev_attr_phy_flash_cfg); | 537 | rc = device_create_file(&efx->pci_dev->dev, &dev_attr_phy_flash_cfg); |
534 | if (rc) | 538 | if (rc) |
@@ -542,7 +546,7 @@ static int sfn4111t_init(struct efx_nic *efx) | |||
542 | return 0; | 546 | return 0; |
543 | 547 | ||
544 | fail_hwmon: | 548 | fail_hwmon: |
545 | i2c_unregister_device(efx->board_info.hwmon_client); | 549 | i2c_unregister_device(board->hwmon_client); |
546 | return rc; | 550 | return rc; |
547 | } | 551 | } |
548 | 552 | ||
@@ -601,10 +605,12 @@ static void sfe4002_set_id_led(struct efx_nic *efx, enum efx_led_mode mode) | |||
601 | 605 | ||
602 | static int sfe4002_check_hw(struct efx_nic *efx) | 606 | static int sfe4002_check_hw(struct efx_nic *efx) |
603 | { | 607 | { |
608 | struct falcon_board *board = falcon_board(efx); | ||
609 | |||
604 | /* A0 board rev. 4002s report a temperature fault the whole time | 610 | /* A0 board rev. 4002s report a temperature fault the whole time |
605 | * (bad sensor) so we mask it out. */ | 611 | * (bad sensor) so we mask it out. */ |
606 | unsigned alarm_mask = | 612 | unsigned alarm_mask = |
607 | (efx->board_info.major == 0 && efx->board_info.minor == 0) ? | 613 | (board->major == 0 && board->minor == 0) ? |
608 | ~LM87_ALARM_TEMP_EXT1 : ~0; | 614 | ~LM87_ALARM_TEMP_EXT1 : ~0; |
609 | 615 | ||
610 | return efx_check_lm87(efx, alarm_mask); | 616 | return efx_check_lm87(efx, alarm_mask); |
@@ -612,13 +618,14 @@ static int sfe4002_check_hw(struct efx_nic *efx) | |||
612 | 618 | ||
613 | static int sfe4002_init(struct efx_nic *efx) | 619 | static int sfe4002_init(struct efx_nic *efx) |
614 | { | 620 | { |
621 | struct falcon_board *board = falcon_board(efx); | ||
615 | int rc = efx_init_lm87(efx, &sfe4002_hwmon_info, sfe4002_lm87_regs); | 622 | int rc = efx_init_lm87(efx, &sfe4002_hwmon_info, sfe4002_lm87_regs); |
616 | if (rc) | 623 | if (rc) |
617 | return rc; | 624 | return rc; |
618 | efx->board_info.monitor = sfe4002_check_hw; | 625 | board->monitor = sfe4002_check_hw; |
619 | efx->board_info.init_phy = sfe4002_init_phy; | 626 | board->init_phy = sfe4002_init_phy; |
620 | efx->board_info.set_id_led = sfe4002_set_id_led; | 627 | board->set_id_led = sfe4002_set_id_led; |
621 | efx->board_info.fini = efx_fini_lm87; | 628 | board->fini = efx_fini_lm87; |
622 | return 0; | 629 | return 0; |
623 | } | 630 | } |
624 | 631 | ||
@@ -683,13 +690,15 @@ static int sfn4112f_check_hw(struct efx_nic *efx) | |||
683 | 690 | ||
684 | static int sfn4112f_init(struct efx_nic *efx) | 691 | static int sfn4112f_init(struct efx_nic *efx) |
685 | { | 692 | { |
693 | struct falcon_board *board = falcon_board(efx); | ||
694 | |||
686 | int rc = efx_init_lm87(efx, &sfn4112f_hwmon_info, sfn4112f_lm87_regs); | 695 | int rc = efx_init_lm87(efx, &sfn4112f_hwmon_info, sfn4112f_lm87_regs); |
687 | if (rc) | 696 | if (rc) |
688 | return rc; | 697 | return rc; |
689 | efx->board_info.monitor = sfn4112f_check_hw; | 698 | board->monitor = sfn4112f_check_hw; |
690 | efx->board_info.init_phy = sfn4112f_init_phy; | 699 | board->init_phy = sfn4112f_init_phy; |
691 | efx->board_info.set_id_led = sfn4112f_set_id_led; | 700 | board->set_id_led = sfn4112f_set_id_led; |
692 | efx->board_info.fini = efx_fini_lm87; | 701 | board->fini = efx_fini_lm87; |
693 | return 0; | 702 | return 0; |
694 | } | 703 | } |
695 | 704 | ||
@@ -714,24 +723,25 @@ static struct falcon_board_data board_data[] = { | |||
714 | 723 | ||
715 | void falcon_probe_board(struct efx_nic *efx, u16 revision_info) | 724 | void falcon_probe_board(struct efx_nic *efx, u16 revision_info) |
716 | { | 725 | { |
726 | struct falcon_board *board = falcon_board(efx); | ||
717 | struct falcon_board_data *data = NULL; | 727 | struct falcon_board_data *data = NULL; |
718 | int i; | 728 | int i; |
719 | 729 | ||
720 | efx->board_info.type = FALCON_BOARD_TYPE(revision_info); | 730 | board->type = FALCON_BOARD_TYPE(revision_info); |
721 | efx->board_info.major = FALCON_BOARD_MAJOR(revision_info); | 731 | board->major = FALCON_BOARD_MAJOR(revision_info); |
722 | efx->board_info.minor = FALCON_BOARD_MINOR(revision_info); | 732 | board->minor = FALCON_BOARD_MINOR(revision_info); |
723 | 733 | ||
724 | for (i = 0; i < ARRAY_SIZE(board_data); i++) | 734 | for (i = 0; i < ARRAY_SIZE(board_data); i++) |
725 | if (board_data[i].type == efx->board_info.type) | 735 | if (board_data[i].type == board->type) |
726 | data = &board_data[i]; | 736 | data = &board_data[i]; |
727 | 737 | ||
728 | if (data) { | 738 | if (data) { |
729 | EFX_INFO(efx, "board is %s rev %c%d\n", | 739 | EFX_INFO(efx, "board is %s rev %c%d\n", |
730 | (efx->pci_dev->subsystem_vendor == EFX_VENDID_SFC) | 740 | (efx->pci_dev->subsystem_vendor == EFX_VENDID_SFC) |
731 | ? data->ref_model : data->gen_type, | 741 | ? data->ref_model : data->gen_type, |
732 | 'A' + efx->board_info.major, efx->board_info.minor); | 742 | 'A' + board->major, board->minor); |
733 | efx->board_info.init = data->init; | 743 | board->init = data->init; |
734 | } else { | 744 | } else { |
735 | EFX_ERR(efx, "unknown board type %d\n", efx->board_info.type); | 745 | EFX_ERR(efx, "unknown board type %d\n", board->type); |
736 | } | 746 | } |
737 | } | 747 | } |
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h index e1df589dff60..9b84c3ae5ed0 100644 --- a/drivers/net/sfc/net_driver.h +++ b/drivers/net/sfc/net_driver.h | |||
@@ -395,7 +395,7 @@ enum efx_led_mode { | |||
395 | }; | 395 | }; |
396 | 396 | ||
397 | /** | 397 | /** |
398 | * struct efx_board - board information | 398 | * struct falcon_board - board information |
399 | * @type: Board model type | 399 | * @type: Board model type |
400 | * @major: Major rev. ('A', 'B' ...) | 400 | * @major: Major rev. ('A', 'B' ...) |
401 | * @minor: Minor rev. (0, 1, ...) | 401 | * @minor: Minor rev. (0, 1, ...) |
@@ -407,7 +407,7 @@ enum efx_led_mode { | |||
407 | * @hwmon_client: I2C client for hardware monitor | 407 | * @hwmon_client: I2C client for hardware monitor |
408 | * @ioexp_client: I2C client for power/port control | 408 | * @ioexp_client: I2C client for power/port control |
409 | */ | 409 | */ |
410 | struct efx_board { | 410 | struct falcon_board { |
411 | int type; | 411 | int type; |
412 | int major; | 412 | int major; |
413 | int minor; | 413 | int minor; |
@@ -752,7 +752,7 @@ struct efx_nic { | |||
752 | unsigned int irq_rx_moderation; | 752 | unsigned int irq_rx_moderation; |
753 | 753 | ||
754 | struct i2c_adapter i2c_adap; | 754 | struct i2c_adapter i2c_adap; |
755 | struct efx_board board_info; | 755 | struct falcon_board board_info; |
756 | 756 | ||
757 | enum nic_state state; | 757 | enum nic_state state; |
758 | enum reset_type reset_pending; | 758 | enum reset_type reset_pending; |
diff --git a/drivers/net/sfc/qt202x_phy.c b/drivers/net/sfc/qt202x_phy.c index f26684fc8caf..73bc5ad227f4 100644 --- a/drivers/net/sfc/qt202x_phy.c +++ b/drivers/net/sfc/qt202x_phy.c | |||
@@ -126,7 +126,7 @@ static int qt202x_reset_phy(struct efx_nic *efx) | |||
126 | if (rc < 0) | 126 | if (rc < 0) |
127 | goto fail; | 127 | goto fail; |
128 | 128 | ||
129 | efx->board_info.init_phy(efx); | 129 | falcon_board(efx)->init_phy(efx); |
130 | 130 | ||
131 | return rc; | 131 | return rc; |
132 | 132 | ||
diff --git a/drivers/net/sfc/tenxpress.c b/drivers/net/sfc/tenxpress.c index 2923e3d1e027..cb5e0573c7f3 100644 --- a/drivers/net/sfc/tenxpress.c +++ b/drivers/net/sfc/tenxpress.c | |||
@@ -303,7 +303,7 @@ static int tenxpress_phy_init(struct efx_nic *efx) | |||
303 | u16 old_adv, adv; | 303 | u16 old_adv, adv; |
304 | int rc = 0; | 304 | int rc = 0; |
305 | 305 | ||
306 | efx->board_info.init_phy(efx); | 306 | falcon_board(efx)->init_phy(efx); |
307 | 307 | ||
308 | phy_data = kzalloc(sizeof(*phy_data), GFP_KERNEL); | 308 | phy_data = kzalloc(sizeof(*phy_data), GFP_KERNEL); |
309 | if (!phy_data) | 309 | if (!phy_data) |