aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/mvebu/patches-4.19/408-sfp-more-cotsworks-fixes.patch
blob: 69a31cb9f06ce5a2aba036531b55e5eb8c526745 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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];