diff options
Diffstat (limited to 'drivers/net/niu.c')
-rw-r--r-- | drivers/net/niu.c | 64 |
1 files changed, 28 insertions, 36 deletions
diff --git a/drivers/net/niu.c b/drivers/net/niu.c index 4009c4ce96b4..918f802fe089 100644 --- a/drivers/net/niu.c +++ b/drivers/net/niu.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* niu.c: Neptune ethernet driver. | 1 | /* niu.c: Neptune ethernet driver. |
2 | * | 2 | * |
3 | * Copyright (C) 2007 David S. Miller (davem@davemloft.net) | 3 | * Copyright (C) 2007, 2008 David S. Miller (davem@davemloft.net) |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/module.h> | 6 | #include <linux/module.h> |
@@ -33,8 +33,8 @@ | |||
33 | 33 | ||
34 | #define DRV_MODULE_NAME "niu" | 34 | #define DRV_MODULE_NAME "niu" |
35 | #define PFX DRV_MODULE_NAME ": " | 35 | #define PFX DRV_MODULE_NAME ": " |
36 | #define DRV_MODULE_VERSION "0.8" | 36 | #define DRV_MODULE_VERSION "0.9" |
37 | #define DRV_MODULE_RELDATE "April 24, 2008" | 37 | #define DRV_MODULE_RELDATE "May 4, 2008" |
38 | 38 | ||
39 | static char version[] __devinitdata = | 39 | static char version[] __devinitdata = |
40 | DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; | 40 | DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; |
@@ -865,7 +865,6 @@ static int link_status_1g_serdes(struct niu *np, int *link_up_p) | |||
865 | return 0; | 865 | return 0; |
866 | } | 866 | } |
867 | 867 | ||
868 | |||
869 | static int link_status_10g_serdes(struct niu *np, int *link_up_p) | 868 | static int link_status_10g_serdes(struct niu *np, int *link_up_p) |
870 | { | 869 | { |
871 | unsigned long flags; | 870 | unsigned long flags; |
@@ -900,7 +899,6 @@ static int link_status_10g_serdes(struct niu *np, int *link_up_p) | |||
900 | return 0; | 899 | return 0; |
901 | } | 900 | } |
902 | 901 | ||
903 | |||
904 | static int link_status_1g_rgmii(struct niu *np, int *link_up_p) | 902 | static int link_status_1g_rgmii(struct niu *np, int *link_up_p) |
905 | { | 903 | { |
906 | struct niu_link_config *lp = &np->link_config; | 904 | struct niu_link_config *lp = &np->link_config; |
@@ -957,7 +955,6 @@ out: | |||
957 | return err; | 955 | return err; |
958 | } | 956 | } |
959 | 957 | ||
960 | |||
961 | static int bcm8704_reset(struct niu *np) | 958 | static int bcm8704_reset(struct niu *np) |
962 | { | 959 | { |
963 | int err, limit; | 960 | int err, limit; |
@@ -1357,8 +1354,6 @@ static int mii_reset(struct niu *np) | |||
1357 | return 0; | 1354 | return 0; |
1358 | } | 1355 | } |
1359 | 1356 | ||
1360 | |||
1361 | |||
1362 | static int xcvr_init_1g_rgmii(struct niu *np) | 1357 | static int xcvr_init_1g_rgmii(struct niu *np) |
1363 | { | 1358 | { |
1364 | int err; | 1359 | int err; |
@@ -1419,7 +1414,6 @@ static int xcvr_init_1g_rgmii(struct niu *np) | |||
1419 | return 0; | 1414 | return 0; |
1420 | } | 1415 | } |
1421 | 1416 | ||
1422 | |||
1423 | static int mii_init_common(struct niu *np) | 1417 | static int mii_init_common(struct niu *np) |
1424 | { | 1418 | { |
1425 | struct niu_link_config *lp = &np->link_config; | 1419 | struct niu_link_config *lp = &np->link_config; |
@@ -7008,31 +7002,20 @@ static int __devinit niu_phy_type_prop_decode(struct niu *np, | |||
7008 | return 0; | 7002 | return 0; |
7009 | } | 7003 | } |
7010 | 7004 | ||
7011 | /* niu board models have a trailing dash version incremented | ||
7012 | * with HW rev change. Need to ingnore the dash version while | ||
7013 | * checking for match | ||
7014 | * | ||
7015 | * for example, for the 10G card the current vpd.board_model | ||
7016 | * is 501-5283-04, of which -04 is the dash version and have | ||
7017 | * to be ignored | ||
7018 | */ | ||
7019 | static int niu_board_model_match(struct niu *np, const char *model) | ||
7020 | { | ||
7021 | return !strncmp(np->vpd.board_model, model, strlen(model)); | ||
7022 | } | ||
7023 | |||
7024 | static int niu_pci_vpd_get_nports(struct niu *np) | 7005 | static int niu_pci_vpd_get_nports(struct niu *np) |
7025 | { | 7006 | { |
7026 | int ports = 0; | 7007 | int ports = 0; |
7027 | 7008 | ||
7028 | if ((niu_board_model_match(np, NIU_QGC_LP_BM_STR)) || | 7009 | if ((!strcmp(np->vpd.model, NIU_QGC_LP_MDL_STR)) || |
7029 | (niu_board_model_match(np, NIU_QGC_PEM_BM_STR)) || | 7010 | (!strcmp(np->vpd.model, NIU_QGC_PEM_MDL_STR)) || |
7030 | (niu_board_model_match(np, NIU_ALONSO_BM_STR))) { | 7011 | (!strcmp(np->vpd.model, NIU_MARAMBA_MDL_STR)) || |
7012 | (!strcmp(np->vpd.model, NIU_KIMI_MDL_STR)) || | ||
7013 | (!strcmp(np->vpd.model, NIU_ALONSO_MDL_STR))) { | ||
7031 | ports = 4; | 7014 | ports = 4; |
7032 | } else if ((niu_board_model_match(np, NIU_2XGF_LP_BM_STR)) || | 7015 | } else if ((!strcmp(np->vpd.model, NIU_2XGF_LP_MDL_STR)) || |
7033 | (niu_board_model_match(np, NIU_2XGF_PEM_BM_STR)) || | 7016 | (!strcmp(np->vpd.model, NIU_2XGF_PEM_MDL_STR)) || |
7034 | (niu_board_model_match(np, NIU_FOXXY_BM_STR)) || | 7017 | (!strcmp(np->vpd.model, NIU_FOXXY_MDL_STR)) || |
7035 | (niu_board_model_match(np, NIU_2XGF_MRVL_BM_STR))) { | 7018 | (!strcmp(np->vpd.model, NIU_2XGF_MRVL_MDL_STR))) { |
7036 | ports = 2; | 7019 | ports = 2; |
7037 | } | 7020 | } |
7038 | 7021 | ||
@@ -7053,8 +7036,8 @@ static void __devinit niu_pci_vpd_validate(struct niu *np) | |||
7053 | return; | 7036 | return; |
7054 | } | 7037 | } |
7055 | 7038 | ||
7056 | if (!strcmp(np->vpd.model, "SUNW,CP3220") || | 7039 | if (!strcmp(np->vpd.model, NIU_ALONSO_MDL_STR) || |
7057 | !strcmp(np->vpd.model, "SUNW,CP3260")) { | 7040 | !strcmp(np->vpd.model, NIU_KIMI_MDL_STR)) { |
7058 | np->flags |= NIU_FLAGS_10G; | 7041 | np->flags |= NIU_FLAGS_10G; |
7059 | np->flags &= ~NIU_FLAGS_FIBER; | 7042 | np->flags &= ~NIU_FLAGS_FIBER; |
7060 | np->flags |= NIU_FLAGS_XCVR_SERDES; | 7043 | np->flags |= NIU_FLAGS_XCVR_SERDES; |
@@ -7065,7 +7048,7 @@ static void __devinit niu_pci_vpd_validate(struct niu *np) | |||
7065 | } | 7048 | } |
7066 | if (np->flags & NIU_FLAGS_10G) | 7049 | if (np->flags & NIU_FLAGS_10G) |
7067 | np->mac_xcvr = MAC_XCVR_XPCS; | 7050 | np->mac_xcvr = MAC_XCVR_XPCS; |
7068 | } else if (niu_board_model_match(np, NIU_FOXXY_BM_STR)) { | 7051 | } else if (!strcmp(np->vpd.model, NIU_FOXXY_MDL_STR)) { |
7069 | np->flags |= (NIU_FLAGS_10G | NIU_FLAGS_FIBER | | 7052 | np->flags |= (NIU_FLAGS_10G | NIU_FLAGS_FIBER | |
7070 | NIU_FLAGS_HOTPLUG_PHY); | 7053 | NIU_FLAGS_HOTPLUG_PHY); |
7071 | } else if (niu_phy_type_prop_decode(np, np->vpd.phy_type)) { | 7054 | } else if (niu_phy_type_prop_decode(np, np->vpd.phy_type)) { |
@@ -7264,8 +7247,11 @@ static int __devinit niu_get_and_validate_port(struct niu *np) | |||
7264 | parent->num_ports = nr64(ESPC_NUM_PORTS_MACS) & | 7247 | parent->num_ports = nr64(ESPC_NUM_PORTS_MACS) & |
7265 | ESPC_NUM_PORTS_MACS_VAL; | 7248 | ESPC_NUM_PORTS_MACS_VAL; |
7266 | 7249 | ||
7250 | /* All of the current probing methods fail on | ||
7251 | * Maramba on-board parts. | ||
7252 | */ | ||
7267 | if (!parent->num_ports) | 7253 | if (!parent->num_ports) |
7268 | return -ENODEV; | 7254 | parent->num_ports = 4; |
7269 | } | 7255 | } |
7270 | } | 7256 | } |
7271 | } | 7257 | } |
@@ -7538,8 +7524,8 @@ static int __devinit walk_phys(struct niu *np, struct niu_parent *parent) | |||
7538 | u32 val; | 7524 | u32 val; |
7539 | int err; | 7525 | int err; |
7540 | 7526 | ||
7541 | if (!strcmp(np->vpd.model, "SUNW,CP3220") || | 7527 | if (!strcmp(np->vpd.model, NIU_ALONSO_MDL_STR) || |
7542 | !strcmp(np->vpd.model, "SUNW,CP3260")) { | 7528 | !strcmp(np->vpd.model, NIU_KIMI_MDL_STR)) { |
7543 | num_10g = 0; | 7529 | num_10g = 0; |
7544 | num_1g = 2; | 7530 | num_1g = 2; |
7545 | parent->plat_type = PLAT_TYPE_ATCA_CP3220; | 7531 | parent->plat_type = PLAT_TYPE_ATCA_CP3220; |
@@ -7548,7 +7534,7 @@ static int __devinit walk_phys(struct niu *np, struct niu_parent *parent) | |||
7548 | phy_encode(PORT_TYPE_1G, 1) | | 7534 | phy_encode(PORT_TYPE_1G, 1) | |
7549 | phy_encode(PORT_TYPE_1G, 2) | | 7535 | phy_encode(PORT_TYPE_1G, 2) | |
7550 | phy_encode(PORT_TYPE_1G, 3)); | 7536 | phy_encode(PORT_TYPE_1G, 3)); |
7551 | } else if (niu_board_model_match(np, NIU_FOXXY_BM_STR)) { | 7537 | } else if (!strcmp(np->vpd.model, NIU_FOXXY_MDL_STR)) { |
7552 | num_10g = 2; | 7538 | num_10g = 2; |
7553 | num_1g = 0; | 7539 | num_1g = 0; |
7554 | parent->num_ports = 2; | 7540 | parent->num_ports = 2; |
@@ -7943,6 +7929,7 @@ static int __devinit niu_get_of_props(struct niu *np) | |||
7943 | struct device_node *dp; | 7929 | struct device_node *dp; |
7944 | const char *phy_type; | 7930 | const char *phy_type; |
7945 | const u8 *mac_addr; | 7931 | const u8 *mac_addr; |
7932 | const char *model; | ||
7946 | int prop_len; | 7933 | int prop_len; |
7947 | 7934 | ||
7948 | if (np->parent->plat_type == PLAT_TYPE_NIU) | 7935 | if (np->parent->plat_type == PLAT_TYPE_NIU) |
@@ -7997,6 +7984,11 @@ static int __devinit niu_get_of_props(struct niu *np) | |||
7997 | 7984 | ||
7998 | memcpy(dev->dev_addr, dev->perm_addr, dev->addr_len); | 7985 | memcpy(dev->dev_addr, dev->perm_addr, dev->addr_len); |
7999 | 7986 | ||
7987 | model = of_get_property(dp, "model", &prop_len); | ||
7988 | |||
7989 | if (model) | ||
7990 | strcpy(np->vpd.model, model); | ||
7991 | |||
8000 | return 0; | 7992 | return 0; |
8001 | #else | 7993 | #else |
8002 | return -EINVAL; | 7994 | return -EINVAL; |