Commit 959beace authored by Francesco Dolcini's avatar Francesco Dolcini Committed by Wen Zhiwei
Browse files

net: fec: refactor PPS channel configuration

stable inclusion
from stable-v6.6.68
commit 897bab2abdac6e4d112a4e5bdd21a47de0ed33e3
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IBMDV1

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=897bab2abdac6e4d112a4e5bdd21a47de0ed33e3



--------------------------------

commit bf8ca67e21671e7a56e31da45360480b28f185f1 upstream.

Preparation patch to allow for PPS channel configuration, no functional
change intended.

Signed-off-by: default avatarFrancesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: default avatarFrank Li <Frank.Li@nxp.com>
Reviewed-by: default avatarCsókás, Bence <csokas.bence@prolan.hu>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
Signed-off-by: default avatarCsókás, Bence <csokas.bence@prolan.hu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarWen Zhiwei <wenzhiwei@kylinos.cn>
parent 7e94cf46
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -84,8 +84,7 @@
#define FEC_CC_MULT	(1 << 31)
#define FEC_COUNTER_PERIOD	(1 << 31)
#define PPS_OUPUT_RELOAD_PERIOD	NSEC_PER_SEC
#define FEC_CHANNLE_0		0
#define DEFAULT_PPS_CHANNEL	FEC_CHANNLE_0
#define DEFAULT_PPS_CHANNEL	0

#define FEC_PTP_MAX_NSEC_PERIOD		4000000000ULL
#define FEC_PTP_MAX_NSEC_COUNTER	0x80000000ULL
@@ -524,8 +523,9 @@ static int fec_ptp_enable(struct ptp_clock_info *ptp,
	unsigned long flags;
	int ret = 0;

	if (rq->type == PTP_CLK_REQ_PPS) {
	fep->pps_channel = DEFAULT_PPS_CHANNEL;

	if (rq->type == PTP_CLK_REQ_PPS) {
		fep->reload_period = PPS_OUPUT_RELOAD_PERIOD;

		ret = fec_ptp_enable_pps(fep, on);
@@ -536,10 +536,9 @@ static int fec_ptp_enable(struct ptp_clock_info *ptp,
		if (rq->perout.flags)
			return -EOPNOTSUPP;

		if (rq->perout.index != DEFAULT_PPS_CHANNEL)
		if (rq->perout.index != fep->pps_channel)
			return -EOPNOTSUPP;

		fep->pps_channel = DEFAULT_PPS_CHANNEL;
		period.tv_sec = rq->perout.period.sec;
		period.tv_nsec = rq->perout.period.nsec;
		period_ns = timespec64_to_ns(&period);