From 47eef3a5ce981c6754836c8c996b4cc724617604 Mon Sep 17 00:00:00 2001 From: Chuanhong Guo Date: Wed, 23 Jan 2019 13:46:15 +0800 Subject: [PATCH] generic: ar8216: introduce qca,mib-poll-interval property This allows users to specify a shorter mib poll interval so that the swconfig leds could behave normal with current get_port_stats() implementation. Signed-off-by: Chuanhong Guo --- .../linux/generic/files/drivers/net/phy/ar8216.c | 14 ++++++++++++-- .../linux/generic/files/drivers/net/phy/ar8216.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c index 259adef822..a2c42d18e6 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8216.c +++ b/target/linux/generic/files/drivers/net/phy/ar8216.c @@ -2208,7 +2208,7 @@ ar8xxx_mib_work_func(struct work_struct *work) next_attempt: mutex_unlock(&priv->mib_lock); schedule_delayed_work(&priv->mib_work, - msecs_to_jiffies(AR8XXX_MIB_WORK_DELAY)); + msecs_to_jiffies(priv->mib_poll_interval)); } static int @@ -2238,7 +2238,7 @@ ar8xxx_mib_start(struct ar8xxx_priv *priv) return; schedule_delayed_work(&priv->mib_work, - msecs_to_jiffies(AR8XXX_MIB_WORK_DELAY)); + msecs_to_jiffies(priv->mib_poll_interval)); } static void @@ -2513,6 +2513,11 @@ ar8xxx_phy_probe(struct phy_device *phydev) priv->mii_bus = phydev->mdio.bus; priv->pdev = &phydev->mdio.dev; + ret = of_property_read_u32(priv->pdev->of_node, "qca,mib-poll-interval", + &priv->mib_poll_interval); + if (ret) + priv->mib_poll_interval = AR8XXX_MIB_WORK_DELAY; + ret = ar8xxx_id_chip(priv); if (ret) goto free_priv; @@ -2680,6 +2685,11 @@ ar8xxx_mdiodev_probe(struct mdio_device *mdiodev) priv->pdev = &mdiodev->dev; priv->chip = (const struct ar8xxx_chip *) match->data; + ret = of_property_read_u32(priv->pdev->of_node, "qca,mib-poll-interval", + &priv->mib_poll_interval); + if (ret) + priv->mib_poll_interval = AR8XXX_MIB_WORK_DELAY; + ret = ar8xxx_read_id(priv); if (ret) goto free_priv; diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.h b/target/linux/generic/files/drivers/net/phy/ar8216.h index e9e8331786..35274b480a 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8216.h +++ b/target/linux/generic/files/drivers/net/phy/ar8216.h @@ -489,6 +489,7 @@ struct ar8xxx_priv { struct mutex mib_lock; struct delayed_work mib_work; u64 *mib_stats; + u32 mib_poll_interval; struct list_head list; unsigned int use_count; -- 2.30.2