Some MAC drivers (e.g. stmmac) require a continuous receive clock signal to be generated by a PCS that is handled by a standalone PCS driver. Such a PCS driver does not have access to a PHY device, thus cannot check the PHY_F_RXC_ALWAYS_ON flag. They cannot check max_requires_rxc in the phylink config either, since it is a private member. Therefore, a new flag is needed to signal to the PCS that it should keep the RX clock signal up at all times. Signed-off-by: Romain Gantois <romain.gantois@xxxxxxxxxxx> --- drivers/net/phy/phylink.c | 3 +++ include/linux/phylink.h | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index f26b13d916d4..a5a5fe91d213 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -663,6 +663,9 @@ static int phylink_validate_mac_and_pcs(struct phylink *pl, return -EINVAL; } + if (pl->config->mac_requires_rxc) + pcs->rxc_always_on = true; + /* Validate the link parameters with the PCS */ if (pcs->ops->pcs_validate) { ret = pcs->ops->pcs_validate(pcs, supported, state); diff --git a/include/linux/phylink.h b/include/linux/phylink.h index 8430ac7ead11..e1527e35f997 100644 --- a/include/linux/phylink.h +++ b/include/linux/phylink.h @@ -462,6 +462,10 @@ struct phylink_pcs_ops; * @phylink: pointer to &struct phylink_config * @neg_mode: provide PCS neg mode via "mode" argument * @poll: poll the PCS for link changes + * @rxc_always_on: The MAC driver requires the reference clock + * to always be on. Standalone PCS drivers who + * do not have access to a PHY device can check + * this instead of PHY_F_RXC_ALWAYS_ON. * * This structure is designed to be embedded within the PCS private data, * and will be passed between phylink and the PCS. @@ -474,6 +478,7 @@ struct phylink_pcs { struct phylink *phylink; bool neg_mode; bool poll; + bool rxc_always_on; }; /** -- 2.43.0