Commit 7d650df9 authored by Wei Fang's avatar Wei Fang Committed by Jakub Kicinski

net: fec: add pm_qos support on imx6q platform

There is a very low probability that tx timeout will occur during
suspend and resume stress test on imx6q platform. So we add pm_qos
support to prevent system from entering low level idles which may
affect the transmission of tx.
Signed-off-by: default avatarWei Fang <wei.fang@nxp.com>
Link: https://lore.kernel.org/r/20220830070148.2021947-1-wei.fang@nxp.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 05a5474e
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/clocksource.h> #include <linux/clocksource.h>
#include <linux/net_tstamp.h> #include <linux/net_tstamp.h>
#include <linux/pm_qos.h>
#include <linux/ptp_clock_kernel.h> #include <linux/ptp_clock_kernel.h>
#include <linux/timecounter.h> #include <linux/timecounter.h>
...@@ -498,6 +499,9 @@ struct bufdesc_ex { ...@@ -498,6 +499,9 @@ struct bufdesc_ex {
/* i.MX8MQ SoC integration mix wakeup interrupt signal into "int2" interrupt line. */ /* i.MX8MQ SoC integration mix wakeup interrupt signal into "int2" interrupt line. */
#define FEC_QUIRK_WAKEUP_FROM_INT2 (1 << 22) #define FEC_QUIRK_WAKEUP_FROM_INT2 (1 << 22)
/* i.MX6Q adds pm_qos support */
#define FEC_QUIRK_HAS_PMQOS BIT(23)
struct bufdesc_prop { struct bufdesc_prop {
int qid; int qid;
/* Address of Rx and Tx buffers */ /* Address of Rx and Tx buffers */
...@@ -608,6 +612,7 @@ struct fec_enet_private { ...@@ -608,6 +612,7 @@ struct fec_enet_private {
struct delayed_work time_keep; struct delayed_work time_keep;
struct regulator *reg_phy; struct regulator *reg_phy;
struct fec_stop_mode_gpr stop_gpr; struct fec_stop_mode_gpr stop_gpr;
struct pm_qos_request pm_qos_req;
unsigned int tx_align; unsigned int tx_align;
unsigned int rx_align; unsigned int rx_align;
......
...@@ -111,7 +111,8 @@ static const struct fec_devinfo fec_imx6q_info = { ...@@ -111,7 +111,8 @@ static const struct fec_devinfo fec_imx6q_info = {
.quirks = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | .quirks = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT |
FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM |
FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR006358 | FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR006358 |
FEC_QUIRK_HAS_RACC | FEC_QUIRK_CLEAR_SETUP_MII, FEC_QUIRK_HAS_RACC | FEC_QUIRK_CLEAR_SETUP_MII |
FEC_QUIRK_HAS_PMQOS,
}; };
static const struct fec_devinfo fec_mvf600_info = { static const struct fec_devinfo fec_mvf600_info = {
...@@ -3244,6 +3245,9 @@ fec_enet_open(struct net_device *ndev) ...@@ -3244,6 +3245,9 @@ fec_enet_open(struct net_device *ndev)
if (fep->quirks & FEC_QUIRK_ERR006687) if (fep->quirks & FEC_QUIRK_ERR006687)
imx6q_cpuidle_fec_irqs_used(); imx6q_cpuidle_fec_irqs_used();
if (fep->quirks & FEC_QUIRK_HAS_PMQOS)
cpu_latency_qos_add_request(&fep->pm_qos_req, 0);
napi_enable(&fep->napi); napi_enable(&fep->napi);
phy_start(ndev->phydev); phy_start(ndev->phydev);
netif_tx_start_all_queues(ndev); netif_tx_start_all_queues(ndev);
...@@ -3285,6 +3289,9 @@ fec_enet_close(struct net_device *ndev) ...@@ -3285,6 +3289,9 @@ fec_enet_close(struct net_device *ndev)
fec_enet_update_ethtool_stats(ndev); fec_enet_update_ethtool_stats(ndev);
fec_enet_clk_enable(ndev, false); fec_enet_clk_enable(ndev, false);
if (fep->quirks & FEC_QUIRK_HAS_PMQOS)
cpu_latency_qos_remove_request(&fep->pm_qos_req);
pinctrl_pm_select_sleep_state(&fep->pdev->dev); pinctrl_pm_select_sleep_state(&fep->pdev->dev);
pm_runtime_mark_last_busy(&fep->pdev->dev); pm_runtime_mark_last_busy(&fep->pdev->dev);
pm_runtime_put_autosuspend(&fep->pdev->dev); pm_runtime_put_autosuspend(&fep->pdev->dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment