Commit 546edcec authored by Alessandro Rubini's avatar Alessandro Rubini Committed by Adam Wujek

abscal: only start pps when we start sending frames

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>

abscal: simplify code related to CONFIG_ABSCAL
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent cb5934e8
......@@ -16,7 +16,18 @@ static int wr_init(struct pp_instance *ppi, unsigned char *pkt, int plen)
wrp->parentWrModeOn = 0;
wrp->calibrated = !WR_DEFAULT_PHY_CALIBRATION_REQUIRED;
if ((wrp->wrConfig & WR_M_AND_S) == WR_M_ONLY)
#ifdef CONFIG_ABSCAL
/* absolute calibration only exists in arch-wrpc, so far */
extern int ptp_mode;
if (ptp_mode == 4 /* WRC_MODE_ABSCAL */)
ppi->next_state = WRS_WR_LINK_ON;
#endif
if ((wrp->wrConfig & WR_M_AND_S) == WR_M_ONLY
#ifdef CONFIG_ABSCAL
&& ptp_mode != 4 /* WRC_MODE_ABSCAL -- not defined in wrs build */
#endif
)
wrp->ops->enable_timing_output(ppi, 1);
else
wrp->ops->enable_timing_output(ppi, 0);
......
......@@ -26,6 +26,7 @@ static int next_pps_ms(struct pp_instance *ppi, struct pp_time *t)
int wr_abscal(struct pp_instance *ppi, uint8_t *pkt, int plen)
{
struct pp_time t;
struct wr_dsport *wrp = WR_DSPOR(ppi);
int len, i;
if (ppi->is_new_state) {
......@@ -38,6 +39,8 @@ int wr_abscal(struct pp_instance *ppi, uint8_t *pkt, int plen)
if (pp_timeout(ppi, PP_TO_EXT_0)) {
uint64_t secs = t.secs;
wrp->ops->enable_timing_output(ppi, 1);
/* Wait for the second to tick */
while( ppi->t_ops->get(ppi, &t), t.secs == secs)
;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment