Commit 38ba8fa5 authored by Alessandro Rubini's avatar Alessandro Rubini

white rabbit: locking_poll() prototype change

The locking_poll operation needs to differentiate between slave
and grandmaster mode (we use this in the wrpc to change the clock
class, according to whether we are locked to the 10MHz or not).

The WR-Switch implementation is missing at this point.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 561ae15f
......@@ -22,13 +22,17 @@ int wrpc_spll_locking_enable(struct pp_instance *ppi)
return WR_SPLL_OK;
}
int wrpc_spll_locking_poll(struct pp_instance *ppi)
int wrpc_spll_locking_poll(struct pp_instance *ppi, int grandmaster)
{
int locked;
static int t24p_calibrated = 0;
locked = spll_check_lock(0);
locked = spll_check_lock(0); /* both slave and gm mode */
if (grandmaster)
return locked ? WR_SPLL_READY : WR_SPLL_ERROR;
/* Else, slave: ensure calibration is done */
if(!locked) {
t24p_calibrated = 0;
}
......
......@@ -40,7 +40,7 @@ struct wrpc_ethhdr {
/* wrpc-spll.c (some should move to time-wrpc/) */
int wrpc_spll_locking_enable(struct pp_instance *ppi);
int wrpc_spll_locking_poll(struct pp_instance *ppi);
int wrpc_spll_locking_poll(struct pp_instance *ppi, int grandmaster);
int wrpc_spll_locking_disable(struct pp_instance *ppi);
int wrpc_spll_enable_ptracker(struct pp_instance *ppi);
int wrpc_adjust_in_progress(void);
......
......@@ -61,7 +61,7 @@ int wrs_calibration_pattern_disable(struct pp_instance *ppi);
/* wrs-time.c (some should moce to wrs-spll.c) */
int wrs_locking_enable(struct pp_instance *ppi);
int wrs_locking_poll(struct pp_instance *ppi);
int wrs_locking_poll(struct pp_instance *ppi, int grandmaster);
int wrs_locking_disable(struct pp_instance *ppi);
int wrs_enable_ptracker(struct pp_instance *ppi);
int wrs_adjust_in_progress(void);
......
......@@ -27,7 +27,7 @@ int wr_s_lock(struct pp_instance *ppi, unsigned char *pkt, int plen)
goto out;
}
if (wrp->ops->locking_poll(ppi) == WR_SPLL_READY) {
if (wrp->ops->locking_poll(ppi, 0) == WR_SPLL_READY) {
ppi->next_state = WRS_LOCKED;
wrp->ops->locking_disable(ppi);
}
......
......@@ -91,7 +91,7 @@ int wr_link_on(struct pp_instance *ppi, unsigned char *pkt, int plen);
/* White Rabbit hw-dependent functions (code in arch-wrpc and arch-wrs) */
struct wr_operations {
int (*locking_enable)(struct pp_instance *ppi);
int (*locking_poll)(struct pp_instance *ppi);
int (*locking_poll)(struct pp_instance *ppi, int grandmaster);
int (*locking_disable)(struct pp_instance *ppi);
int (*enable_ptracker)(struct pp_instance *ppi);
......
......@@ -297,7 +297,7 @@ int wr_servo_update(struct pp_instance *ppi)
tics = ppi->t_ops->calc_timeout(ppi, 0);
if (wrp->ops->locking_poll(ppi) != WR_SPLL_READY) {
if (wrp->ops->locking_poll(ppi, 0) != WR_SPLL_READY) {
pp_diag(ppi, servo, 1, "PLL OutOfLock, should restart sync\n");
wrp->ops->enable_timing_output(ppi, 0);
/* TODO check
......
......@@ -128,10 +128,13 @@ int wrs_locking_enable(struct pp_instance *ppi)
return WR_SPLL_OK;
}
int wrs_locking_poll(struct pp_instance *ppi)
int wrs_locking_poll(struct pp_instance *ppi, int grandmaster)
{
int ret, rval;
if (grandmaster) /* FIXME: check wrs grandmaster PLL */
return WR_SPLL_READY;
ret = minipc_call(hal_ch, DEFAULT_TO, &__rpcdef_lock_cmd,
&rval, ppi->iface_name, HEXP_LOCK_CMD_CHECK, 0);
if (ret != HEXP_LOCK_STATUS_LOCKED) {
......
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