aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/tenxpress.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2009-11-29 10:08:55 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-29 20:23:53 -0500
commitc1c4f453b61463df4df16f7aa5782fc0cfe05b9e (patch)
treea72b533294500e7f19ab1f67142b732471df53cb /drivers/net/sfc/tenxpress.c
parente58f69f4082f60076885798fae8f3a17ea713bf6 (diff)
sfc: Remove static PHY data and enumerations
New NICs have firmware managing the PHY, and we will discover the PHY capabilities at run-time. Replace the static data with probe() and test_name() operations. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc/tenxpress.c')
-rw-r--r--drivers/net/sfc/tenxpress.c49
1 files changed, 37 insertions, 12 deletions
diff --git a/drivers/net/sfc/tenxpress.c b/drivers/net/sfc/tenxpress.c
index 0dfb2275a158..8de97a9f2719 100644
--- a/drivers/net/sfc/tenxpress.c
+++ b/drivers/net/sfc/tenxpress.c
@@ -298,6 +298,23 @@ static int tenxpress_init(struct efx_nic *efx)
298 return 0; 298 return 0;
299} 299}
300 300
301static int sfx7101_phy_probe(struct efx_nic *efx)
302{
303 efx->mdio.mmds = TENXPRESS_REQUIRED_DEVS;
304 efx->mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22;
305 efx->loopback_modes = SFX7101_LOOPBACKS | FALCON_XMAC_LOOPBACKS;
306 return 0;
307}
308
309static int sft9001_phy_probe(struct efx_nic *efx)
310{
311 efx->mdio.mmds = TENXPRESS_REQUIRED_DEVS;
312 efx->mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22;
313 efx->loopback_modes = (SFT9001_LOOPBACKS | FALCON_XMAC_LOOPBACKS |
314 FALCON_GMAC_LOOPBACKS);
315 return 0;
316}
317
301static int tenxpress_phy_init(struct efx_nic *efx) 318static int tenxpress_phy_init(struct efx_nic *efx)
302{ 319{
303 struct tenxpress_phy_data *phy_data; 320 struct tenxpress_phy_data *phy_data;
@@ -512,7 +529,7 @@ static int tenxpress_phy_reconfigure(struct efx_nic *efx)
512 529
513 phy_mode_change = (efx->phy_mode == PHY_MODE_NORMAL && 530 phy_mode_change = (efx->phy_mode == PHY_MODE_NORMAL &&
514 phy_data->phy_mode != PHY_MODE_NORMAL); 531 phy_data->phy_mode != PHY_MODE_NORMAL);
515 loop_reset = (LOOPBACK_OUT_OF(phy_data, efx, efx->phy_op->loopbacks) || 532 loop_reset = (LOOPBACK_OUT_OF(phy_data, efx, LOOPBACKS_EXTERNAL(efx)) ||
516 LOOPBACK_CHANGED(phy_data, efx, 1 << LOOPBACK_GPHY)); 533 LOOPBACK_CHANGED(phy_data, efx, 1 << LOOPBACK_GPHY));
517 534
518 if (loop_reset || phy_mode_change) { 535 if (loop_reset || phy_mode_change) {
@@ -627,6 +644,13 @@ static const char *const sfx7101_test_names[] = {
627 "bist" 644 "bist"
628}; 645};
629 646
647static const char *sfx7101_test_name(struct efx_nic *efx, unsigned int index)
648{
649 if (index < ARRAY_SIZE(sfx7101_test_names))
650 return sfx7101_test_names[index];
651 return NULL;
652}
653
630static int 654static int
631sfx7101_run_tests(struct efx_nic *efx, int *results, unsigned flags) 655sfx7101_run_tests(struct efx_nic *efx, int *results, unsigned flags)
632{ 656{
@@ -656,6 +680,13 @@ static const char *const sft9001_test_names[] = {
656 "cable.pairD.length", 680 "cable.pairD.length",
657}; 681};
658 682
683static const char *sft9001_test_name(struct efx_nic *efx, unsigned int index)
684{
685 if (index < ARRAY_SIZE(sft9001_test_names))
686 return sft9001_test_names[index];
687 return NULL;
688}
689
659static int sft9001_run_tests(struct efx_nic *efx, int *results, unsigned flags) 690static int sft9001_run_tests(struct efx_nic *efx, int *results, unsigned flags)
660{ 691{
661 int rc = 0, rc2, i, ctrl_reg, res_reg; 692 int rc = 0, rc2, i, ctrl_reg, res_reg;
@@ -758,7 +789,7 @@ tenxpress_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
758 * but doesn't advertise the correct speed. So override it */ 789 * but doesn't advertise the correct speed. So override it */
759 if (efx->loopback_mode == LOOPBACK_GPHY) 790 if (efx->loopback_mode == LOOPBACK_GPHY)
760 ecmd->speed = SPEED_1000; 791 ecmd->speed = SPEED_1000;
761 else if (LOOPBACK_MASK(efx) & efx->phy_op->loopbacks) 792 else if (LOOPBACK_EXTERNAL(efx))
762 ecmd->speed = SPEED_10000; 793 ecmd->speed = SPEED_10000;
763} 794}
764 795
@@ -788,7 +819,7 @@ static void sft9001_set_npage_adv(struct efx_nic *efx, u32 advertising)
788} 819}
789 820
790struct efx_phy_operations falcon_sfx7101_phy_ops = { 821struct efx_phy_operations falcon_sfx7101_phy_ops = {
791 .macs = EFX_XMAC, 822 .probe = sfx7101_phy_probe,
792 .init = tenxpress_phy_init, 823 .init = tenxpress_phy_init,
793 .reconfigure = tenxpress_phy_reconfigure, 824 .reconfigure = tenxpress_phy_reconfigure,
794 .poll = tenxpress_phy_poll, 825 .poll = tenxpress_phy_poll,
@@ -796,15 +827,12 @@ struct efx_phy_operations falcon_sfx7101_phy_ops = {
796 .get_settings = tenxpress_get_settings, 827 .get_settings = tenxpress_get_settings,
797 .set_settings = tenxpress_set_settings, 828 .set_settings = tenxpress_set_settings,
798 .set_npage_adv = sfx7101_set_npage_adv, 829 .set_npage_adv = sfx7101_set_npage_adv,
799 .num_tests = ARRAY_SIZE(sfx7101_test_names), 830 .test_name = sfx7101_test_name,
800 .test_names = sfx7101_test_names,
801 .run_tests = sfx7101_run_tests, 831 .run_tests = sfx7101_run_tests,
802 .mmds = TENXPRESS_REQUIRED_DEVS,
803 .loopbacks = SFX7101_LOOPBACKS,
804}; 832};
805 833
806struct efx_phy_operations falcon_sft9001_phy_ops = { 834struct efx_phy_operations falcon_sft9001_phy_ops = {
807 .macs = EFX_GMAC | EFX_XMAC, 835 .probe = sft9001_phy_probe,
808 .init = tenxpress_phy_init, 836 .init = tenxpress_phy_init,
809 .reconfigure = tenxpress_phy_reconfigure, 837 .reconfigure = tenxpress_phy_reconfigure,
810 .poll = tenxpress_phy_poll, 838 .poll = tenxpress_phy_poll,
@@ -812,9 +840,6 @@ struct efx_phy_operations falcon_sft9001_phy_ops = {
812 .get_settings = tenxpress_get_settings, 840 .get_settings = tenxpress_get_settings,
813 .set_settings = tenxpress_set_settings, 841 .set_settings = tenxpress_set_settings,
814 .set_npage_adv = sft9001_set_npage_adv, 842 .set_npage_adv = sft9001_set_npage_adv,
815 .num_tests = ARRAY_SIZE(sft9001_test_names), 843 .test_name = sft9001_test_name,
816 .test_names = sft9001_test_names,
817 .run_tests = sft9001_run_tests, 844 .run_tests = sft9001_run_tests,
818 .mmds = TENXPRESS_REQUIRED_DEVS,
819 .loopbacks = SFT9001_LOOPBACKS,
820}; 845};