aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/falcon_boards.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2009-11-23 11:04:23 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-24 13:58:40 -0500
commit981fc1b4b8cc6bfe8c6f0c07052e25738d959c68 (patch)
treeb55aa171ae37e4eff14b6750f61f667a213b518e /drivers/net/sfc/falcon_boards.c
parent398468ed1b5c61fe8bcbc8cc1ed323e3c23b58ef (diff)
sfc: Rename efx_board::init_leds to init_phy and use for SFN4111T
efx_board::init_leds was introduced as a second stage of initialisation because of the inter-dependency between the board and PHY. We want to move board initialisation into NIC probing, which is too early to use MDIO, so SFN4111T initialisation also needs to be split. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc/falcon_boards.c')
-rw-r--r--drivers/net/sfc/falcon_boards.c43
1 files changed, 25 insertions, 18 deletions
diff --git a/drivers/net/sfc/falcon_boards.c b/drivers/net/sfc/falcon_boards.c
index b2505fc5c1f7..429d3cd646b5 100644
--- a/drivers/net/sfc/falcon_boards.c
+++ b/drivers/net/sfc/falcon_boards.c
@@ -499,9 +499,22 @@ static struct i2c_board_info sfn4111t_r5_hwmon_info = {
499 I2C_BOARD_INFO("max6646", 0x4d), 499 I2C_BOARD_INFO("max6646", 0x4d),
500}; 500};
501 501
502static void sfn4111t_init_phy(struct efx_nic *efx)
503{
504 if (!(efx->phy_mode & PHY_MODE_SPECIAL)) {
505 if (sft9001_wait_boot(efx) != -EINVAL)
506 return;
507
508 efx->phy_mode = PHY_MODE_SPECIAL;
509 efx_stats_disable(efx);
510 }
511
512 sfn4111t_reset(efx);
513 sft9001_wait_boot(efx);
514}
515
502static int sfn4111t_init(struct efx_nic *efx) 516static int sfn4111t_init(struct efx_nic *efx)
503{ 517{
504 int i = 0;
505 int rc; 518 int rc;
506 519
507 efx->board_info.hwmon_client = 520 efx->board_info.hwmon_client =
@@ -512,6 +525,7 @@ static int sfn4111t_init(struct efx_nic *efx)
512 if (!efx->board_info.hwmon_client) 525 if (!efx->board_info.hwmon_client)
513 return -EIO; 526 return -EIO;
514 527
528 efx->board_info.init_phy = sfn4111t_init_phy;
515 efx->board_info.set_id_led = tenxpress_set_id_led; 529 efx->board_info.set_id_led = tenxpress_set_id_led;
516 efx->board_info.monitor = sfn4111t_check_hw; 530 efx->board_info.monitor = sfn4111t_check_hw;
517 efx->board_info.fini = sfn4111t_fini; 531 efx->board_info.fini = sfn4111t_fini;
@@ -520,20 +534,13 @@ static int sfn4111t_init(struct efx_nic *efx)
520 if (rc) 534 if (rc)
521 goto fail_hwmon; 535 goto fail_hwmon;
522 536
523 do { 537 if (efx->phy_mode & PHY_MODE_SPECIAL)
524 if (efx->phy_mode & PHY_MODE_SPECIAL) { 538 /* PHY may not generate a 156.25 MHz clock and MAC
525 /* PHY may not generate a 156.25 MHz clock and MAC 539 * stats fetch will fail. */
526 * stats fetch will fail. */ 540 efx_stats_disable(efx);
527 efx_stats_disable(efx); 541
528 sfn4111t_reset(efx); 542 return 0;
529 }
530 rc = sft9001_wait_boot(efx);
531 if (rc == 0)
532 return 0;
533 efx->phy_mode = PHY_MODE_SPECIAL;
534 } while (rc == -EINVAL && ++i < 2);
535 543
536 device_remove_file(&efx->pci_dev->dev, &dev_attr_phy_flash_cfg);
537fail_hwmon: 544fail_hwmon:
538 i2c_unregister_device(efx->board_info.hwmon_client); 545 i2c_unregister_device(efx->board_info.hwmon_client);
539 return rc; 546 return rc;
@@ -574,7 +581,7 @@ static struct i2c_board_info sfe4002_hwmon_info = {
574#define SFE4002_RX_LED (0) /* Green */ 581#define SFE4002_RX_LED (0) /* Green */
575#define SFE4002_TX_LED (1) /* Amber */ 582#define SFE4002_TX_LED (1) /* Amber */
576 583
577static void sfe4002_init_leds(struct efx_nic *efx) 584static void sfe4002_init_phy(struct efx_nic *efx)
578{ 585{
579 /* Set the TX and RX LEDs to reflect status and activity, and the 586 /* Set the TX and RX LEDs to reflect status and activity, and the
580 * fault LED off */ 587 * fault LED off */
@@ -609,7 +616,7 @@ static int sfe4002_init(struct efx_nic *efx)
609 if (rc) 616 if (rc)
610 return rc; 617 return rc;
611 efx->board_info.monitor = sfe4002_check_hw; 618 efx->board_info.monitor = sfe4002_check_hw;
612 efx->board_info.init_leds = sfe4002_init_leds; 619 efx->board_info.init_phy = sfe4002_init_phy;
613 efx->board_info.set_id_led = sfe4002_set_id_led; 620 efx->board_info.set_id_led = sfe4002_set_id_led;
614 efx->board_info.fini = efx_fini_lm87; 621 efx->board_info.fini = efx_fini_lm87;
615 return 0; 622 return 0;
@@ -641,7 +648,7 @@ static struct i2c_board_info sfn4112f_hwmon_info = {
641#define SFN4112F_ACT_LED 0 648#define SFN4112F_ACT_LED 0
642#define SFN4112F_LINK_LED 1 649#define SFN4112F_LINK_LED 1
643 650
644static void sfn4112f_init_leds(struct efx_nic *efx) 651static void sfn4112f_init_phy(struct efx_nic *efx)
645{ 652{
646 falcon_qt202x_set_led(efx, SFN4112F_ACT_LED, 653 falcon_qt202x_set_led(efx, SFN4112F_ACT_LED,
647 QUAKE_LED_RXLINK | QUAKE_LED_LINK_ACT); 654 QUAKE_LED_RXLINK | QUAKE_LED_LINK_ACT);
@@ -680,7 +687,7 @@ static int sfn4112f_init(struct efx_nic *efx)
680 if (rc) 687 if (rc)
681 return rc; 688 return rc;
682 efx->board_info.monitor = sfn4112f_check_hw; 689 efx->board_info.monitor = sfn4112f_check_hw;
683 efx->board_info.init_leds = sfn4112f_init_leds; 690 efx->board_info.init_phy = sfn4112f_init_phy;
684 efx->board_info.set_id_led = sfn4112f_set_id_led; 691 efx->board_info.set_id_led = sfn4112f_set_id_led;
685 efx->board_info.fini = efx_fini_lm87; 692 efx->board_info.fini = efx_fini_lm87;
686 return 0; 693 return 0;