micrel.c (87832e937c808a7ebc41254b408362e3255c87c9) micrel.c (1e304328d9c3e94e7dc1899aabd1d5182c204ae9)
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * drivers/net/phy/micrel.c
4 *
5 * Driver for Micrel PHYs
6 *
7 * Author: David J. Choi
8 *

--- 2374 unchanged lines hidden (view full) ---

2383 struct kszphy_ptp_priv *ptp_priv =
2384 container_of(mii_ts, struct kszphy_ptp_priv, mii_ts);
2385 struct phy_device *phydev = ptp_priv->phydev;
2386 struct lan8814_shared_priv *shared = phydev->shared->priv;
2387 struct lan8814_ptp_rx_ts *rx_ts, *tmp;
2388 struct hwtstamp_config config;
2389 int txcfg = 0, rxcfg = 0;
2390 int pkt_ts_enable;
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * drivers/net/phy/micrel.c
4 *
5 * Driver for Micrel PHYs
6 *
7 * Author: David J. Choi
8 *

--- 2374 unchanged lines hidden (view full) ---

2383 struct kszphy_ptp_priv *ptp_priv =
2384 container_of(mii_ts, struct kszphy_ptp_priv, mii_ts);
2385 struct phy_device *phydev = ptp_priv->phydev;
2386 struct lan8814_shared_priv *shared = phydev->shared->priv;
2387 struct lan8814_ptp_rx_ts *rx_ts, *tmp;
2388 struct hwtstamp_config config;
2389 int txcfg = 0, rxcfg = 0;
2390 int pkt_ts_enable;
2391 int tx_mod;
2391
2392 if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
2393 return -EFAULT;
2394
2395 ptp_priv->hwts_tx_type = config.tx_type;
2396 ptp_priv->rx_filter = config.rx_filter;
2397
2398 switch (config.rx_filter) {

--- 33 unchanged lines hidden (view full) ---

2432 lanphy_write_page_reg(ptp_priv->phydev, 5, PTP_RX_PARSE_CONFIG, rxcfg);
2433 lanphy_write_page_reg(ptp_priv->phydev, 5, PTP_TX_PARSE_CONFIG, txcfg);
2434
2435 pkt_ts_enable = PTP_TIMESTAMP_EN_SYNC_ | PTP_TIMESTAMP_EN_DREQ_ |
2436 PTP_TIMESTAMP_EN_PDREQ_ | PTP_TIMESTAMP_EN_PDRES_;
2437 lanphy_write_page_reg(ptp_priv->phydev, 5, PTP_RX_TIMESTAMP_EN, pkt_ts_enable);
2438 lanphy_write_page_reg(ptp_priv->phydev, 5, PTP_TX_TIMESTAMP_EN, pkt_ts_enable);
2439
2392
2393 if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
2394 return -EFAULT;
2395
2396 ptp_priv->hwts_tx_type = config.tx_type;
2397 ptp_priv->rx_filter = config.rx_filter;
2398
2399 switch (config.rx_filter) {

--- 33 unchanged lines hidden (view full) ---

2433 lanphy_write_page_reg(ptp_priv->phydev, 5, PTP_RX_PARSE_CONFIG, rxcfg);
2434 lanphy_write_page_reg(ptp_priv->phydev, 5, PTP_TX_PARSE_CONFIG, txcfg);
2435
2436 pkt_ts_enable = PTP_TIMESTAMP_EN_SYNC_ | PTP_TIMESTAMP_EN_DREQ_ |
2437 PTP_TIMESTAMP_EN_PDREQ_ | PTP_TIMESTAMP_EN_PDRES_;
2438 lanphy_write_page_reg(ptp_priv->phydev, 5, PTP_RX_TIMESTAMP_EN, pkt_ts_enable);
2439 lanphy_write_page_reg(ptp_priv->phydev, 5, PTP_TX_TIMESTAMP_EN, pkt_ts_enable);
2440
2440 if (ptp_priv->hwts_tx_type == HWTSTAMP_TX_ONESTEP_SYNC)
2441 tx_mod = lanphy_read_page_reg(ptp_priv->phydev, 5, PTP_TX_MOD);
2442 if (ptp_priv->hwts_tx_type == HWTSTAMP_TX_ONESTEP_SYNC) {
2441 lanphy_write_page_reg(ptp_priv->phydev, 5, PTP_TX_MOD,
2443 lanphy_write_page_reg(ptp_priv->phydev, 5, PTP_TX_MOD,
2442 PTP_TX_MOD_TX_PTP_SYNC_TS_INSERT_);
2444 tx_mod | PTP_TX_MOD_TX_PTP_SYNC_TS_INSERT_);
2445 } else if (ptp_priv->hwts_tx_type == HWTSTAMP_TX_ON) {
2446 lanphy_write_page_reg(ptp_priv->phydev, 5, PTP_TX_MOD,
2447 tx_mod & ~PTP_TX_MOD_TX_PTP_SYNC_TS_INSERT_);
2448 }
2443
2444 if (config.rx_filter != HWTSTAMP_FILTER_NONE)
2445 lan8814_config_ts_intr(ptp_priv->phydev, true);
2446 else
2447 lan8814_config_ts_intr(ptp_priv->phydev, false);
2448
2449 mutex_lock(&shared->shared_lock);
2450 if (config.rx_filter != HWTSTAMP_FILTER_NONE)

--- 2472 unchanged lines hidden ---
2449
2450 if (config.rx_filter != HWTSTAMP_FILTER_NONE)
2451 lan8814_config_ts_intr(ptp_priv->phydev, true);
2452 else
2453 lan8814_config_ts_intr(ptp_priv->phydev, false);
2454
2455 mutex_lock(&shared->shared_lock);
2456 if (config.rx_filter != HWTSTAMP_FILTER_NONE)

--- 2472 unchanged lines hidden ---