Skip to content

Commit 3370e33

Browse files
Luo Jiekuba-moo
authored andcommitted
net: phy: qcom: qca808x: Support PHY counter
Enable CRC checking for received and transmitted frames, and configure counters to clear after being read within config_init() for accurate counter recording. Additionally, add PHY counter operations and integrate shared functions. Signed-off-by: Luo Jie <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 22bf4bd commit 3370e33

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

drivers/net/phy/qcom/qca808x.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ MODULE_LICENSE("GPL");
9393

9494
struct qca808x_priv {
9595
int led_polarity_mode;
96+
struct qcom_phy_hw_stats hw_stats;
9697
};
9798

9899
static int qca808x_phy_fast_retrain_config(struct phy_device *phydev)
@@ -243,6 +244,10 @@ static int qca808x_config_init(struct phy_device *phydev)
243244

244245
qca808x_fill_possible_interfaces(phydev);
245246

247+
ret = qcom_phy_counter_config(phydev);
248+
if (ret)
249+
return ret;
250+
246251
/* Configure adc threshold as 100mv for the link 10M */
247252
return at803x_debug_reg_mask(phydev, QCA808X_PHY_DEBUG_ADC_THRESHOLD,
248253
QCA808X_ADC_THRESHOLD_MASK,
@@ -622,6 +627,22 @@ static int qca808x_led_polarity_set(struct phy_device *phydev, int index,
622627
active_low ? 0 : QCA808X_LED_ACTIVE_HIGH);
623628
}
624629

630+
static int qca808x_update_stats(struct phy_device *phydev)
631+
{
632+
struct qca808x_priv *priv = phydev->priv;
633+
634+
return qcom_phy_update_stats(phydev, &priv->hw_stats);
635+
}
636+
637+
static void qca808x_get_phy_stats(struct phy_device *phydev,
638+
struct ethtool_eth_phy_stats *eth_stats,
639+
struct ethtool_phy_stats *stats)
640+
{
641+
struct qca808x_priv *priv = phydev->priv;
642+
643+
qcom_phy_get_stats(stats, priv->hw_stats);
644+
}
645+
625646
static struct phy_driver qca808x_driver[] = {
626647
{
627648
/* Qualcomm QCA8081 */
@@ -651,6 +672,8 @@ static struct phy_driver qca808x_driver[] = {
651672
.led_hw_control_set = qca808x_led_hw_control_set,
652673
.led_hw_control_get = qca808x_led_hw_control_get,
653674
.led_polarity_set = qca808x_led_polarity_set,
675+
.update_stats = qca808x_update_stats,
676+
.get_phy_stats = qca808x_get_phy_stats,
654677
}, };
655678

656679
module_phy_driver(qca808x_driver);

0 commit comments

Comments
 (0)