69a31cb9f06ce5a2aba036531b55e5eb8c526745
[openwrt/staging/chunkeey.git] / target / linux / mvebu / patches-4.19 / 408-sfp-more-cotsworks-fixes.patch
1 From e26af2726067ff260b77485df6af8375b82bfb1d Mon Sep 17 00:00:00 2001
2 From: Russell King <rmk+kernel@armlinux.org.uk>
3 Date: Sat, 23 Dec 2017 12:22:58 +0000
4 Subject: [PATCH] sfp: more cotsworks fixes
5
6 Cotsworks also gets the date code wrong.
7
8 Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
9 ---
10 drivers/net/phy/sfp.c | 15 ++++++++-------
11 1 file changed, 8 insertions(+), 7 deletions(-)
12
13 --- a/drivers/net/phy/sfp.c
14 +++ b/drivers/net/phy/sfp.c
15 @@ -1571,9 +1571,9 @@ static int sfp_sm_mod_probe(struct sfp *
16 return -EAGAIN;
17 }
18
19 - /* Cotsworks do not seem to update the checksums when they
20 - * do the final programming with the final module part number,
21 - * serial number and date code.
22 + /* Cotsworks do not seem to update the checksums when they update the
23 + * module part number, serial number and date code. They also format
24 + * the date code incorrectly.
25 */
26 cotsworks = !memcmp(id.base.vendor_name, "COTSWORKS ", 16);
27
28 @@ -1612,11 +1612,12 @@ static int sfp_sm_mod_probe(struct sfp *
29
30 sfp->id = id;
31
32 - date[0] = sfp->id.ext.datecode[4];
33 - date[1] = sfp->id.ext.datecode[5];
34 + /* Cotsworks also gets the date code wrong. */
35 + date[0] = sfp->id.ext.datecode[4 - 2 * cotsworks];
36 + date[1] = sfp->id.ext.datecode[5 - 2 * cotsworks];
37 date[2] = '-';
38 - date[3] = sfp->id.ext.datecode[2];
39 - date[4] = sfp->id.ext.datecode[3];
40 + date[3] = sfp->id.ext.datecode[2 + 2 * cotsworks];
41 + date[4] = sfp->id.ext.datecode[3 + 2 * cotsworks];
42 date[5] = '-';
43 date[6] = sfp->id.ext.datecode[0];
44 date[7] = sfp->id.ext.datecode[1];