diff options
author | Vincent Cheng <vincent.cheng.xh@renesas.com> | 2021-02-17 00:42:13 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-02-17 13:49:25 -0800 |
commit | e8b4d8b542b167b101aaaa308dc3be39da9f59d0 (patch) | |
tree | f3ed96f7af6f29cb049892e8655437268504f9ef | |
parent | 797d3186544fcd5bfd7a03b9ef3e20c1db3802b8 (diff) |
ptp: ptp_clockmatrix: Add alignment of 1 PPS to idtcm_perout_enable.
When enabling output using PTP_CLK_REQ_PEROUT, need to align the output
clock to the internal 1 PPS clock.
Signed-off-by: Vincent Cheng <vincent.cheng.xh@renesas.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/ptp/ptp_clockmatrix.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/ptp/ptp_clockmatrix.c b/drivers/ptp/ptp_clockmatrix.c index 9bfd32baad92..f597e4f52693 100644 --- a/drivers/ptp/ptp_clockmatrix.c +++ b/drivers/ptp/ptp_clockmatrix.c @@ -1389,13 +1389,23 @@ static int idtcm_perout_enable(struct idtcm_channel *channel, bool enable, struct ptp_perout_request *perout) { + struct idtcm *idtcm = channel->idtcm; unsigned int flags = perout->flags; + struct timespec64 ts = {0, 0}; + int err; if (flags == PEROUT_ENABLE_OUTPUT_MASK) - return idtcm_output_mask_enable(channel, enable); + err = idtcm_output_mask_enable(channel, enable); + else + err = idtcm_output_enable(channel, enable, perout->index); + + if (err) { + dev_err(&idtcm->client->dev, "Unable to set output enable"); + return err; + } - /* Enable/disable individual output instead */ - return idtcm_output_enable(channel, enable, perout->index); + /* Align output to internal 1 PPS */ + return _idtcm_settime(channel, &ts, SCSR_TOD_WR_TYPE_SEL_DELTA_PLUS); } static int idtcm_get_pll_mode(struct idtcm_channel *channel, |