* [PATCH 1/1] [NIU] Redo the fix for getting # of ports from EEPROM
@ 2008-05-09 0:20 Matheos Worku
2008-05-09 0:25 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Matheos Worku @ 2008-05-09 0:20 UTC (permalink / raw)
To: netdev, David Miller
Signed-off-by: Matheos <matheos.worku@sun.com>
---
drivers/net/niu.c | 47 +++++++++++++++++++++--------------------------
drivers/net/niu.h | 9 +++++++++
2 files changed, 30 insertions(+), 26 deletions(-)
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 57cfd72..c07930c 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -7008,31 +7008,20 @@ static int __devinit
niu_phy_type_prop_decode(struct niu *np,
return 0;
}
-/* niu board models have a trailing dash version incremented
- * with HW rev change. Need to ingnore the dash version while
- * checking for match
- *
- * for example, for the 10G card the current vpd.board_model
- * is 501-5283-04, of which -04 is the dash version and have
- * to be ignored
- */
-static int niu_board_model_match(struct niu *np, const char *model)
-{
- return !strncmp(np->vpd.board_model, model, strlen(model));
-}
-
static int niu_pci_vpd_get_nports(struct niu *np)
{
int ports = 0;
- if ((niu_board_model_match(np, NIU_QGC_LP_BM_STR)) ||
- (niu_board_model_match(np, NIU_QGC_PEM_BM_STR)) ||
- (niu_board_model_match(np, NIU_ALONSO_BM_STR))) {
+ if ((!strcmp(np->vpd.model, NIU_QGC_LP_MDL_STR)) ||
+ (!strcmp(np->vpd.model, NIU_QGC_PEM_MDL_STR)) ||
+ (!strcmp(np->vpd.model, NIU_MARAMBA_MDL_STR)) ||
+ (!strcmp(np->vpd.model, NIU_KIMI_MDL_STR)) ||
+ (!strcmp(np->vpd.model, NIU_ALONSO_MDL_STR))) {
ports = 4;
- } else if ((niu_board_model_match(np, NIU_2XGF_LP_BM_STR)) ||
- (niu_board_model_match(np, NIU_2XGF_PEM_BM_STR)) ||
- (niu_board_model_match(np, NIU_FOXXY_BM_STR)) ||
- (niu_board_model_match(np, NIU_2XGF_MRVL_BM_STR))) {
+ } else if ((!strcmp(np->vpd.model, NIU_2XGF_LP_MDL_STR)) ||
+ (!strcmp(np->vpd.model, NIU_2XGF_PEM_MDL_STR)) ||
+ (!strcmp(np->vpd.model, NIU_FOXXY_MDL_STR)) ||
+ (!strcmp(np->vpd.model, NIU_2XGF_MRVL_MDL_STR))) {
ports = 2;
}
@@ -7053,8 +7042,8 @@ static void __devinit niu_pci_vpd_validate(struct
niu *np)
return;
}
- if (!strcmp(np->vpd.model, "SUNW,CP3220") ||
- !strcmp(np->vpd.model, "SUNW,CP3260")) {
+ if (!strcmp(np->vpd.model, NIU_ALONSO_MDL_STR) ||
+ !strcmp(np->vpd.model, NIU_KIMI_MDL_STR)) {
np->flags |= NIU_FLAGS_10G;
np->flags &= ~NIU_FLAGS_FIBER;
np->flags |= NIU_FLAGS_XCVR_SERDES;
@@ -7065,7 +7054,7 @@ static void __devinit niu_pci_vpd_validate(struct
niu *np)
}
if (np->flags & NIU_FLAGS_10G)
np->mac_xcvr = MAC_XCVR_XPCS;
- } else if (niu_board_model_match(np, NIU_FOXXY_BM_STR)) {
+ } else if (!strcmp(np->vpd.model, NIU_FOXXY_MDL_STR)) {
np->flags |= (NIU_FLAGS_10G | NIU_FLAGS_FIBER |
NIU_FLAGS_HOTPLUG_PHY);
} else if (niu_phy_type_prop_decode(np, np->vpd.phy_type)) {
@@ -7541,8 +7530,8 @@ static int __devinit walk_phys(struct niu *np,
struct niu_parent *parent)
u32 val;
int err;
- if (!strcmp(np->vpd.model, "SUNW,CP3220") ||
- !strcmp(np->vpd.model, "SUNW,CP3260")) {
+ if (!strcmp(np->vpd.model, NIU_ALONSO_MDL_STR) ||
+ !strcmp(np->vpd.model, NIU_KIMI_MDL_STR)) {
num_10g = 0;
num_1g = 2;
parent->plat_type = PLAT_TYPE_ATCA_CP3220;
@@ -7551,7 +7540,7 @@ static int __devinit walk_phys(struct niu *np,
struct niu_parent *parent)
phy_encode(PORT_TYPE_1G, 1) |
phy_encode(PORT_TYPE_1G, 2) |
phy_encode(PORT_TYPE_1G, 3));
- } else if (niu_board_model_match(np, NIU_FOXXY_BM_STR)) {
+ } else if (!strcmp(np->vpd.model, NIU_FOXXY_MDL_STR)) {
num_10g = 2;
num_1g = 0;
parent->num_ports = 2;
@@ -7946,6 +7935,7 @@ static int __devinit niu_get_of_props(struct niu *np)
struct device_node *dp;
const char *phy_type;
const u8 *mac_addr;
+ const char *model;
int prop_len;
if (np->parent->plat_type == PLAT_TYPE_NIU)
@@ -8000,6 +7990,11 @@ static int __devinit niu_get_of_props(struct niu *np)
memcpy(dev->dev_addr, dev->perm_addr, dev->addr_len);
+ model = of_get_property(dp, "model", &prop_len);
+
+ if (model)
+ strcpy(np->vpd.model, model);
+
return 0;
#else
return -EINVAL;
diff --git a/drivers/net/niu.h b/drivers/net/niu.h
index 97ffbe1..12fd570 100644
--- a/drivers/net/niu.h
+++ b/drivers/net/niu.h
@@ -2946,6 +2946,15 @@ struct rx_ring_info {
#define NIU_ALONSO_BM_STR "373-0202"
#define NIU_FOXXY_BM_STR "501-7961"
#define NIU_2XGF_MRVL_BM_STR "SK-6E82"
+#define NIU_QGC_LP_MDL_STR "SUNW,pcie-qgc"
+#define NIU_2XGF_LP_MDL_STR "SUNW,pcie-2xgf"
+#define NIU_QGC_PEM_MDL_STR "SUNW,pcie-qgc-pem"
+#define NIU_2XGF_PEM_MDL_STR "SUNW,pcie-2xgf-pem"
+#define NIU_ALONSO_MDL_STR "SUNW,CP3220"
+#define NIU_KIMI_MDL_STR "SUNW,CP3260"
+#define NIU_MARAMBA_MDL_STR "SUNW,pcie-neptune"
+#define NIU_FOXXY_MDL_STR "SUNW,pcie-rfem"
+#define NIU_2XGF_MRVL_MDL_STR "SysKonnect,pcie-2xgf"
#define NIU_VPD_MIN_MAJOR 3
#define NIU_VPD_MIN_MINOR 4
--
1.5.2
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH 1/1] [NIU] Redo the fix for getting # of ports from EEPROM
2008-05-09 0:20 [PATCH 1/1] [NIU] Redo the fix for getting # of ports from EEPROM Matheos Worku
@ 2008-05-09 0:25 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2008-05-09 0:25 UTC (permalink / raw)
To: Matheos.Worku; +Cc: netdev
From: Matheos Worku <Matheos.Worku@Sun.COM>
Date: Thu, 08 May 2008 17:20:51 -0700
> @@ -8000,6 +7990,11 @@ static int __devinit niu_get_of_props(struct niu *np)
>
> memcpy(dev->dev_addr, dev->perm_addr, dev->addr_len);
>
> + model = of_get_property(dp, "model", &prop_len);
> +
> + if (model)
> + strcpy(np->vpd.model, model);
> +
Please fix the indentation in cases like this. There should
be two tab characters in front of the strcpy().
I don't know what editor you use, but in emacs the editor
can take care of this automatically for you by simply typing
"M-x c-set-style RET linux RET"
I've been fixing up these coding style issues for you in the past, and
I've had to do so for every single patch you send me. Unfortunately,
it's consuming a lot of my time and I'm not going to do it any more.
Therefore, please have a read up of:
linux/Documentation/CodingStyle
which should help you in this area. But generally, if you follow the
existing conventions in the rest of the niu.[ch] files you'll be OK
;-)
Another thing I noticed you do is put two blank lines between
functions, please only use one.
Please also write a full changelog description so people can
understand what you are doing here.
Thank you.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-05-09 0:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-09 0:20 [PATCH 1/1] [NIU] Redo the fix for getting # of ports from EEPROM Matheos Worku
2008-05-09 0:25 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).