You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openwrt/target/linux/mvebu/patches-4.19/408-sfp-more-cotsworks-fixe...

45 lines
1.5 KiB
Diff

From e26af2726067ff260b77485df6af8375b82bfb1d Mon Sep 17 00:00:00 2001
From: Russell King <rmk+kernel@armlinux.org.uk>
Date: Sat, 23 Dec 2017 12:22:58 +0000
Subject: [PATCH] sfp: more cotsworks fixes
Cotsworks also gets the date code wrong.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
drivers/net/phy/sfp.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -1571,9 +1571,9 @@ static int sfp_sm_mod_probe(struct sfp *
return -EAGAIN;
}
- /* Cotsworks do not seem to update the checksums when they
- * do the final programming with the final module part number,
- * serial number and date code.
+ /* Cotsworks do not seem to update the checksums when they update the
+ * module part number, serial number and date code. They also format
+ * the date code incorrectly.
*/
cotsworks = !memcmp(id.base.vendor_name, "COTSWORKS ", 16);
@@ -1612,11 +1612,12 @@ static int sfp_sm_mod_probe(struct sfp *
sfp->id = id;
- date[0] = sfp->id.ext.datecode[4];
- date[1] = sfp->id.ext.datecode[5];
+ /* Cotsworks also gets the date code wrong. */
+ date[0] = sfp->id.ext.datecode[4 - 2 * cotsworks];
+ date[1] = sfp->id.ext.datecode[5 - 2 * cotsworks];
date[2] = '-';
- date[3] = sfp->id.ext.datecode[2];
- date[4] = sfp->id.ext.datecode[3];
+ date[3] = sfp->id.ext.datecode[2 + 2 * cotsworks];
+ date[4] = sfp->id.ext.datecode[3 + 2 * cotsworks];
date[5] = '-';
date[6] = sfp->id.ext.datecode[0];
date[7] = sfp->id.ext.datecode[1];