mvebu: add kernel 4.19 support
[openwrt/staging/blogic.git] / target / linux / mvebu / patches-4.19 / 408-sfp-more-cotsworks-fixes.patch
diff --git a/target/linux/mvebu/patches-4.19/408-sfp-more-cotsworks-fixes.patch b/target/linux/mvebu/patches-4.19/408-sfp-more-cotsworks-fixes.patch
new file mode 100644 (file)
index 0000000..f9f7aba
--- /dev/null
@@ -0,0 +1,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
+@@ -1570,9 +1570,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);
+@@ -1611,11 +1611,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];