mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 17:13:52 +02:00
net: phy: micrel: lan8814: Enable LTC at probe time
The LTC for lan8814 was enabled only if timestamping was enabled, otherwise it would be stopped. Meaning that LTC will not increase by itself. This might break other features that don't required timestamping like generating 1PPS. Therefore enable the LTC at probe time. Acked-by: Richard Cochran <richardcochran@gmail.com> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
220d63f249
commit
9f6b3a4981
|
|
@ -305,12 +305,7 @@ struct lan8814_shared_priv {
|
|||
struct ptp_clock *ptp_clock;
|
||||
struct ptp_clock_info ptp_clock_info;
|
||||
|
||||
/* Reference counter to how many ports in the package are enabling the
|
||||
* timestamping
|
||||
*/
|
||||
u8 ref;
|
||||
|
||||
/* Lock for ptp_clock and ref */
|
||||
/* Lock for ptp_clock */
|
||||
struct mutex shared_lock;
|
||||
};
|
||||
|
||||
|
|
@ -2426,8 +2421,6 @@ static int lan8814_hwtstamp(struct mii_timestamper *mii_ts,
|
|||
{
|
||||
struct kszphy_ptp_priv *ptp_priv =
|
||||
container_of(mii_ts, struct kszphy_ptp_priv, mii_ts);
|
||||
struct phy_device *phydev = ptp_priv->phydev;
|
||||
struct lan8814_shared_priv *shared = phydev->shared->priv;
|
||||
struct lan8814_ptp_rx_ts *rx_ts, *tmp;
|
||||
int txcfg = 0, rxcfg = 0;
|
||||
int pkt_ts_enable;
|
||||
|
|
@ -2492,20 +2485,6 @@ static int lan8814_hwtstamp(struct mii_timestamper *mii_ts,
|
|||
else
|
||||
lan8814_config_ts_intr(ptp_priv->phydev, false);
|
||||
|
||||
mutex_lock(&shared->shared_lock);
|
||||
if (config->rx_filter != HWTSTAMP_FILTER_NONE)
|
||||
shared->ref++;
|
||||
else
|
||||
shared->ref--;
|
||||
|
||||
if (shared->ref)
|
||||
lanphy_write_page_reg(ptp_priv->phydev, 4, PTP_CMD_CTL,
|
||||
PTP_CMD_CTL_PTP_ENABLE_);
|
||||
else
|
||||
lanphy_write_page_reg(ptp_priv->phydev, 4, PTP_CMD_CTL,
|
||||
PTP_CMD_CTL_PTP_DISABLE_);
|
||||
mutex_unlock(&shared->shared_lock);
|
||||
|
||||
/* In case of multiple starts and stops, these needs to be cleared */
|
||||
list_for_each_entry_safe(rx_ts, tmp, &ptp_priv->rx_ts_list, list) {
|
||||
list_del(&rx_ts->list);
|
||||
|
|
@ -3247,6 +3226,9 @@ static int lan8814_ptp_probe_once(struct phy_device *phydev)
|
|||
lanphy_write_page_reg(phydev, 4, PTP_OPERATING_MODE,
|
||||
PTP_OPERATING_MODE_STANDALONE_);
|
||||
|
||||
/* Enable ptp to run LTC clock for ptp and gpio 1PPS operation */
|
||||
lanphy_write_page_reg(phydev, 4, PTP_CMD_CTL, PTP_CMD_CTL_PTP_ENABLE_);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user