Skip to content

Commit f178812

Browse files
author
Paolo Abeni
committed
Merge branch 'net-fec-add-pps-channel-configuration'
Francesco Dolcini says: ==================== net: fec: add PPS channel configuration Make the FEC Ethernet PPS channel configurable from device tree. ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
2 parents 5d6a8ae + 566c2d8 commit f178812

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

Documentation/devicetree/bindings/net/fsl,fec.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,13 @@ properties:
183183
description:
184184
Register bits of stop mode control, the format is <&gpr req_gpr req_bit>.
185185

186+
fsl,pps-channel:
187+
$ref: /schemas/types.yaml#/definitions/uint32
188+
default: 0
189+
description:
190+
Specifies to which timer instance the PPS signal is routed.
191+
enum: [0, 1, 2, 3]
192+
186193
mdio:
187194
$ref: mdio.yaml#
188195
unevaluatedProperties: false

drivers/net/ethernet/freescale/fec_ptp.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@
8484
#define FEC_CC_MULT (1 << 31)
8585
#define FEC_COUNTER_PERIOD (1 << 31)
8686
#define PPS_OUPUT_RELOAD_PERIOD NSEC_PER_SEC
87-
#define FEC_CHANNLE_0 0
88-
#define DEFAULT_PPS_CHANNEL FEC_CHANNLE_0
87+
#define DEFAULT_PPS_CHANNEL 0
8988

9089
#define FEC_PTP_MAX_NSEC_PERIOD 4000000000ULL
9190
#define FEC_PTP_MAX_NSEC_COUNTER 0x80000000ULL
@@ -525,7 +524,6 @@ static int fec_ptp_enable(struct ptp_clock_info *ptp,
525524
int ret = 0;
526525

527526
if (rq->type == PTP_CLK_REQ_PPS) {
528-
fep->pps_channel = DEFAULT_PPS_CHANNEL;
529527
fep->reload_period = PPS_OUPUT_RELOAD_PERIOD;
530528

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

539-
if (rq->perout.index != DEFAULT_PPS_CHANNEL)
537+
if (rq->perout.index != fep->pps_channel)
540538
return -EOPNOTSUPP;
541539

542-
fep->pps_channel = DEFAULT_PPS_CHANNEL;
543540
period.tv_sec = rq->perout.period.sec;
544541
period.tv_nsec = rq->perout.period.nsec;
545542
period_ns = timespec64_to_ns(&period);
@@ -707,12 +704,16 @@ void fec_ptp_init(struct platform_device *pdev, int irq_idx)
707704
{
708705
struct net_device *ndev = platform_get_drvdata(pdev);
709706
struct fec_enet_private *fep = netdev_priv(ndev);
707+
struct device_node *np = fep->pdev->dev.of_node;
710708
int irq;
711709
int ret;
712710

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

714+
fep->pps_channel = DEFAULT_PPS_CHANNEL;
715+
of_property_read_u32(np, "fsl,pps-channel", &fep->pps_channel);
716+
716717
fep->ptp_caps.max_adj = 250000000;
717718
fep->ptp_caps.n_alarm = 0;
718719
fep->ptp_caps.n_ext_ts = 0;

0 commit comments

Comments
 (0)