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

net: fec: make PPS channel configurable

stable inclusion
from stable-v6.6.68
commit 194532af82a1c9cf081eb1dcae5433e8f6b0cec0
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=194532af82a1c9cf081eb1dcae5433e8f6b0cec0



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

commit 566c2d83887f0570056833102adc5b88e681b0c7 upstream.

Depending on the SoC where the FEC is integrated into the PPS channel
might be routed to different timer instances. Make this configurable
from the devicetree.

When the related DT property is not present fallback to the previous
default and use channel 0.

Reviewed-by: default avatarFrank Li <Frank.Li@nxp.com>
Tested-by: default avatarRafael Beims <rafael.beims@toradex.com>
Signed-off-by: default avatarFrancesco Dolcini <francesco.dolcini@toradex.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 959beace
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -523,8 +523,6 @@ static int fec_ptp_enable(struct ptp_clock_info *ptp,
	unsigned long flags;
	int ret = 0;

	fep->pps_channel = DEFAULT_PPS_CHANNEL;

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

@@ -706,12 +704,16 @@ void fec_ptp_init(struct platform_device *pdev, int irq_idx)
{
	struct net_device *ndev = platform_get_drvdata(pdev);
	struct fec_enet_private *fep = netdev_priv(ndev);
	struct device_node *np = fep->pdev->dev.of_node;
	int irq;
	int ret;

	fep->ptp_caps.owner = THIS_MODULE;
	strscpy(fep->ptp_caps.name, "fec ptp", sizeof(fep->ptp_caps.name));

	fep->pps_channel = DEFAULT_PPS_CHANNEL;
	of_property_read_u32(np, "fsl,pps-channel", &fep->pps_channel);

	fep->ptp_caps.max_adj = 250000000;
	fep->ptp_caps.n_alarm = 0;
	fep->ptp_caps.n_ext_ts = 0;