Lines Matching +full:phy +full:- +full:10 +full:base +full:- +full:t1l +full:- +full:2
1 // SPDX-License-Identifier: GPL-2.0
2 /* Driver for the Texas Instruments DP83TD510 PHY
10 #include <linux/phy.h>
16 /* Bit 7 - mii_interrupt, active high. Clears on read.
40 * 32-bit or 16-bit counters for TX and RX statistics and must be read in
43 * - DP83TD510E_PKT_STAT_1: Contains TX packet count bits [15:0].
44 * - DP83TD510E_PKT_STAT_2: Contains TX packet count bits [31:16].
45 * - DP83TD510E_PKT_STAT_3: Contains TX error packet count.
46 * - DP83TD510E_PKT_STAT_4: Contains RX packet count bits [15:0].
47 * - DP83TD510E_PKT_STAT_5: Contains RX packet count bits [31:16].
48 * - DP83TD510E_PKT_STAT_6: Contains RX error packet count.
68 * "Application Report - DP83TD510E Cable Diagnostics Toolkit":
69 * SNR(dB) = -10 * log10 (VAL/2^17) - 1.76 dB.
70 * SQI ranges are implemented according to "OPEN ALLIANCE - Advanced diagnostic
71 * features for 100BASE-T1 automotive Ethernet PHYs"
96 /* Time Domain Reflectometry (TDR) Functionality of DP83TD510 PHY
98 * I assume that this PHY is using a variation of Spread Spectrum Time Domain
101 * - The DP83TD510 PHY transmits a modulated signal of configurable length
104 * - The pulse observed on the wire, triggered by the HW RESET register, is not
107 * I assume that SSTDR seems to be a logical choice for the 10BaseT1L
109 * environments with significant electrical noise, such as long 10BaseT1L cable
113 * The SSTDR variation used in this PHY involves more configuration variables
121 * ,<--cfg_pre_silence_time
122 * | ,<-SSTDR Modulated Transmission
123 * | | ,<--cfg_post_silence_time
124 * | | | ,<--Force Link Mode
125 * |<--'-->|<-------'------->|<--'-->|<--------'------->|
127 * - cfg_pre_silence_time: Optional silence time before TDR transmission starts.
128 * - SSTDR Modulated Transmission: Transmission duration configured by
130 * - cfg_post_silence_time: Silence time after TDR transmission.
131 * - Force Link Mode: If nothing is configured after cfg_post_silence_time,
132 * the PHY continues in force link mode without autonegotiation.
155 #define DP83TD510E_TDR_CFG1_POST_SILENCE_TIME GENMASK(3, 2)
158 #define DP83TD510E_TDR_CFG1_POST_SILENCE_TIME_100MS 2
161 * settle down all pulses and reflections. Since for 10BASE-T1L we have
167 #define DP83TD510E_TDR_CFG1_PRE_SILENCE_TIME_100MS 2
180 * - Default: 16000 µs
181 * - Observation: A minimum duration of 6000 µs is recommended to ensure
198 #define DP83TD510E_TDR_PEAK_SIGN BIT(10)
222 /* LED SPEED: High for 10Base-T */
244 #define DP83TD510E_LED_POLARITY(idx) BIT((idx) * 4 + 2)
250 #define DP83TD510E_ALCD_CABLE_LENGTH GENMASK(10, 0)
258 return -EINVAL; in dp83td510_led_brightness_set()
273 return -EINVAL; in dp83td510_led_mode()
292 return -EOPNOTSUPP; in dp83td510_led_mode()
343 /* LED mode: LED SPEED (10BaseT1L indicator) */ in dp83td510_led_hw_control_get()
384 return -EINVAL; in dp83td510_led_polarity_set()
393 * dp83td510_update_stats - Update the PHY statistics for the DP83TD510 PHY.
396 * The function reads the PHY statistics registers and updates the statistics
403 struct dp83td510_priv *priv = phydev->priv; in dp83td510_update_stats()
408 * - Group 1 (TX stats): DP83TD510E_PKT_STAT_1 to DP83TD510E_PKT_STAT_3 in dp83td510_update_stats()
409 * - Group 2 (RX stats): DP83TD510E_PKT_STAT_4 to DP83TD510E_PKT_STAT_6 in dp83td510_update_stats()
412 * plain sequence (e.g., 1, 2, 3 for Group 1 or 4, 5, 6 for Group 2). in dp83td510_update_stats()
413 * Any deviation from the sequence, such as reading 1, 2, 1, 2, 3, will in dp83td510_update_stats()
429 priv->stats.tx_pkt_cnt += count; in dp83td510_update_stats()
435 priv->stats.tx_err_pkt_cnt += ret; in dp83td510_update_stats()
448 priv->stats.rx_pkt_cnt += count; in dp83td510_update_stats()
454 priv->stats.rx_err_pkt_cnt += ret; in dp83td510_update_stats()
463 struct dp83td510_priv *priv = phydev->priv; in dp83td510_get_phy_stats()
465 stats->tx_packets = priv->stats.tx_pkt_cnt; in dp83td510_get_phy_stats()
466 stats->tx_errors = priv->stats.tx_err_pkt_cnt; in dp83td510_get_phy_stats()
467 stats->rx_packets = priv->stats.rx_pkt_cnt; in dp83td510_get_phy_stats()
468 stats->rx_errors = priv->stats.rx_err_pkt_cnt; in dp83td510_get_phy_stats()
475 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { in dp83td510_config_intr()
527 phydev->speed = SPEED_UNKNOWN; in dp83td510_read_status()
528 phydev->duplex = DUPLEX_UNKNOWN; in dp83td510_read_status()
529 phydev->pause = 0; in dp83td510_read_status()
530 phydev->asym_pause = 0; in dp83td510_read_status()
531 linkmode_zero(phydev->lp_advertising); in dp83td510_read_status()
535 phydev->link = !!(phy_sts & DP83TD510E_LINK_STATUS); in dp83td510_read_status()
536 if (phydev->link) { in dp83td510_read_status()
537 /* This PHY supports only one link mode: 10BaseT1L_Full */ in dp83td510_read_status()
538 phydev->duplex = DUPLEX_FULL; in dp83td510_read_status()
539 phydev->speed = SPEED_10; in dp83td510_read_status()
541 if (phydev->autoneg == AUTONEG_ENABLE) { in dp83td510_read_status()
550 if (phydev->autoneg == AUTONEG_ENABLE) { in dp83td510_read_status()
561 phydev->master_slave_state = MASTER_SLAVE_STATE_ERR; in dp83td510_read_status()
578 if (phydev->autoneg == AUTONEG_DISABLE) in dp83td510_config_aneg()
595 if (!phydev->link) in dp83td510_get_sqi()
608 return -EINVAL; in dp83td510_get_sqi()
617 * dp83td510_cable_test_start - Start the cable test for the DP83TD510 PHY.
627 struct dp83td510_priv *priv = phydev->priv; in dp83td510_cable_test_start()
637 if (phydev->link) { in dp83td510_cable_test_start()
638 priv->alcd_test_active = true; in dp83td510_cable_test_start()
642 priv->alcd_test_active = false; in dp83td510_cable_test_start()
662 * pre TDR silence time to 10ms to avoid false reflections (value 0 in dp83td510_cable_test_start()
666 * PHY framework. The idea is to wait until in dp83td510_cable_test_start()
668 * the PHY to the default state within the post silence time window. in dp83td510_cable_test_start()
719 * dp83td510_cable_test_get_tdr_status - Get the status of the TDR test for the
720 * DP83TD510 PHY.
775 * dp83td510_cable_test_get_alcd_status - Get the status of the ALCD test for the
776 * DP83TD510 PHY.
824 * dp83td510_cable_test_get_status - Get the status of the cable test for the
825 * DP83TD510 PHY.
836 struct dp83td510_priv *priv = phydev->priv; in dp83td510_cable_test_get_status()
839 if (priv->alcd_test_active) in dp83td510_cable_test_get_status()
847 /* This PHY can't respond on MDIO bus if no RMII clock is enabled. in dp83td510_get_features()
848 * In case RMII mode is used (most meaningful mode for this PHY) and in dp83td510_get_features()
849 * the PHY do not have own XTAL, and CLK providing MAC is not probed, in dp83td510_get_features()
854 linkmode_set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, phydev->supported); in dp83td510_get_features()
855 linkmode_set_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, phydev->supported); in dp83td510_get_features()
856 linkmode_set_bit(ETHTOOL_LINK_MODE_Pause_BIT, phydev->supported); in dp83td510_get_features()
858 phydev->supported); in dp83td510_get_features()
865 struct device *dev = &phydev->mdio.dev; in dp83td510_probe()
870 return -ENOMEM; in dp83td510_probe()
872 phydev->priv = priv; in dp83td510_probe()
913 MODULE_DESCRIPTION("Texas Instruments DP83TD510E PHY driver");