]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.6-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Oct 2024 10:40:42 +0000 (12:40 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Oct 2024 10:40:42 +0000 (12:40 +0200)
added patches:
net-fec-move-fec_ptp_read-to-the-top-of-the-file.patch
net-fec-remove-duplicated-code.patch

queue-6.6/net-fec-move-fec_ptp_read-to-the-top-of-the-file.patch [new file with mode: 0644]
queue-6.6/net-fec-remove-duplicated-code.patch [new file with mode: 0644]
queue-6.6/series

diff --git a/queue-6.6/net-fec-move-fec_ptp_read-to-the-top-of-the-file.patch b/queue-6.6/net-fec-move-fec_ptp_read-to-the-top-of-the-file.patch
new file mode 100644 (file)
index 0000000..a250602
--- /dev/null
@@ -0,0 +1,100 @@
+From 4374a1fe580a14f6152752390c678d90311df247 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Cs=C3=B3k=C3=A1s=2C=20Bence?= <csokas.bence@prolan.hu>
+Date: Mon, 12 Aug 2024 11:47:13 +0200
+Subject: net: fec: Move `fec_ptp_read()` to the top of the file
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Csókás, Bence <csokas.bence@prolan.hu>
+
+commit 4374a1fe580a14f6152752390c678d90311df247 upstream.
+
+This function is used in `fec_ptp_enable_pps()` through
+struct cyclecounter read(). Moving the declaration makes
+it clearer, what's happening.
+
+Suggested-by: Frank Li <Frank.li@nxp.com>
+Link: https://lore.kernel.org/netdev/20240805144754.2384663-1-csokas.bence@prolan.hu/T/#ma6c21ad264016c24612048b1483769eaff8cdf20
+Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu>
+Reviewed-by: Andrew Lunn <andrew@lunn.ch>
+Link: https://patch.msgid.link/20240812094713.2883476-1-csokas.bence@prolan.hu
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/freescale/fec_ptp.c |   50 +++++++++++++++----------------
+ 1 file changed, 25 insertions(+), 25 deletions(-)
+
+--- a/drivers/net/ethernet/freescale/fec_ptp.c
++++ b/drivers/net/ethernet/freescale/fec_ptp.c
+@@ -91,6 +91,30 @@
+ #define FEC_PTP_MAX_NSEC_COUNTER      0x80000000ULL
+ /**
++ * fec_ptp_read - read raw cycle counter (to be used by time counter)
++ * @cc: the cyclecounter structure
++ *
++ * this function reads the cyclecounter registers and is called by the
++ * cyclecounter structure used to construct a ns counter from the
++ * arbitrary fixed point registers
++ */
++static u64 fec_ptp_read(const struct cyclecounter *cc)
++{
++      struct fec_enet_private *fep =
++              container_of(cc, struct fec_enet_private, cc);
++      u32 tempval;
++
++      tempval = readl(fep->hwp + FEC_ATIME_CTRL);
++      tempval |= FEC_T_CTRL_CAPTURE;
++      writel(tempval, fep->hwp + FEC_ATIME_CTRL);
++
++      if (fep->quirks & FEC_QUIRK_BUG_CAPTURE)
++              udelay(1);
++
++      return readl(fep->hwp + FEC_ATIME);
++}
++
++/**
+  * fec_ptp_enable_pps
+  * @fep: the fec_enet_private structure handle
+  * @enable: enable the channel pps output
+@@ -136,7 +160,7 @@ static int fec_ptp_enable_pps(struct fec
+                * NSEC_PER_SEC - ts.tv_nsec. Add the remaining nanoseconds
+                * to current timer would be next second.
+                */
+-              tempval = fep->cc.read(&fep->cc);
++              tempval = fec_ptp_read(&fep->cc);
+               /* Convert the ptp local counter to 1588 timestamp */
+               ns = timecounter_cyc2time(&fep->tc, tempval);
+               ts = ns_to_timespec64(ns);
+@@ -272,30 +296,6 @@ static enum hrtimer_restart fec_ptp_pps_
+ }
+ /**
+- * fec_ptp_read - read raw cycle counter (to be used by time counter)
+- * @cc: the cyclecounter structure
+- *
+- * this function reads the cyclecounter registers and is called by the
+- * cyclecounter structure used to construct a ns counter from the
+- * arbitrary fixed point registers
+- */
+-static u64 fec_ptp_read(const struct cyclecounter *cc)
+-{
+-      struct fec_enet_private *fep =
+-              container_of(cc, struct fec_enet_private, cc);
+-      u32 tempval;
+-
+-      tempval = readl(fep->hwp + FEC_ATIME_CTRL);
+-      tempval |= FEC_T_CTRL_CAPTURE;
+-      writel(tempval, fep->hwp + FEC_ATIME_CTRL);
+-
+-      if (fep->quirks & FEC_QUIRK_BUG_CAPTURE)
+-              udelay(1);
+-
+-      return readl(fep->hwp + FEC_ATIME);
+-}
+-
+-/**
+  * fec_ptp_start_cyclecounter - create the cycle counter from hw
+  * @ndev: network device
+  *
diff --git a/queue-6.6/net-fec-remove-duplicated-code.patch b/queue-6.6/net-fec-remove-duplicated-code.patch
new file mode 100644 (file)
index 0000000..9961978
--- /dev/null
@@ -0,0 +1,41 @@
+From 713ebaed68d88121cbaf5e74104e2290a9ea74bd Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Cs=C3=B3k=C3=A1s=2C=20Bence?= <csokas.bence@prolan.hu>
+Date: Mon, 12 Aug 2024 11:47:15 +0200
+Subject: net: fec: Remove duplicated code
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Csókás, Bence <csokas.bence@prolan.hu>
+
+commit 713ebaed68d88121cbaf5e74104e2290a9ea74bd upstream.
+
+`fec_ptp_pps_perout()` reimplements logic already
+in `fec_ptp_read()`. Replace with function call.
+
+Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu>
+Reviewed-by: Andrew Lunn <andrew@lunn.ch>
+Link: https://patch.msgid.link/20240812094713.2883476-2-csokas.bence@prolan.hu
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/freescale/fec_ptp.c |    8 +-------
+ 1 file changed, 1 insertion(+), 7 deletions(-)
+
+--- a/drivers/net/ethernet/freescale/fec_ptp.c
++++ b/drivers/net/ethernet/freescale/fec_ptp.c
+@@ -235,13 +235,7 @@ static int fec_ptp_pps_perout(struct fec
+       timecounter_read(&fep->tc);
+       /* Get the current ptp hardware time counter */
+-      temp_val = readl(fep->hwp + FEC_ATIME_CTRL);
+-      temp_val |= FEC_T_CTRL_CAPTURE;
+-      writel(temp_val, fep->hwp + FEC_ATIME_CTRL);
+-      if (fep->quirks & FEC_QUIRK_BUG_CAPTURE)
+-              udelay(1);
+-
+-      ptp_hc = readl(fep->hwp + FEC_ATIME);
++      ptp_hc = fec_ptp_read(&fep->cc);
+       /* Convert the ptp local counter to 1588 timestamp */
+       curr_time = timecounter_cyc2time(&fep->tc, ptp_hc);
index 67f426a646ce5b7ed8a2801527852592052b6f55..f7a92d157b9d73669d65df2bbc1bbbf2c2bb1919 100644 (file)
@@ -43,3 +43,5 @@ xfs-fix-freeing-speculative-preallocations-for-preallocated-files.patch
 xfs-allow-unlinked-symlinks-and-dirs-with-zero-size.patch
 xfs-restrict-when-we-try-to-align-cow-fork-delalloc-to-cowextsz-hints.patch
 maple_tree-correct-tree-corruption-on-spanning-store.patch
+net-fec-move-fec_ptp_read-to-the-top-of-the-file.patch
+net-fec-remove-duplicated-code.patch