From: Greg Kroah-Hartman Date: Fri, 18 Oct 2024 10:40:42 +0000 (+0200) Subject: 6.6-stable patches X-Git-Tag: v5.10.228~52 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=17dc1801a165c0af246696a83345198516a76044;p=thirdparty%2Fkernel%2Fstable-queue.git 6.6-stable patches added patches: net-fec-move-fec_ptp_read-to-the-top-of-the-file.patch net-fec-remove-duplicated-code.patch --- 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 index 00000000000..a25060211d2 --- /dev/null +++ b/queue-6.6/net-fec-move-fec_ptp_read-to-the-top-of-the-file.patch @@ -0,0 +1,100 @@ +From 4374a1fe580a14f6152752390c678d90311df247 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Cs=C3=B3k=C3=A1s=2C=20Bence?= +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 + +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 +Link: https://lore.kernel.org/netdev/20240805144754.2384663-1-csokas.bence@prolan.hu/T/#ma6c21ad264016c24612048b1483769eaff8cdf20 +Signed-off-by: Csókás, Bence +Reviewed-by: Andrew Lunn +Link: https://patch.msgid.link/20240812094713.2883476-1-csokas.bence@prolan.hu +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + 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 index 00000000000..99619781af9 --- /dev/null +++ b/queue-6.6/net-fec-remove-duplicated-code.patch @@ -0,0 +1,41 @@ +From 713ebaed68d88121cbaf5e74104e2290a9ea74bd Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Cs=C3=B3k=C3=A1s=2C=20Bence?= +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 + +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 +Reviewed-by: Andrew Lunn +Link: https://patch.msgid.link/20240812094713.2883476-2-csokas.bence@prolan.hu +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + 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); diff --git a/queue-6.6/series b/queue-6.6/series index 67f426a646c..f7a92d157b9 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -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