From e638e851f2f2dcbf3036b048f39647db979dcd11 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: May 25 2023 07:19:35 +0000 Subject: phy: st: miphy28lp: use _poll_timeout functions for waits (git-fixes). --- diff --git a/patches.suse/phy-st-miphy28lp-use-_poll_timeout-functions-for-wai.patch b/patches.suse/phy-st-miphy28lp-use-_poll_timeout-functions-for-wai.patch new file mode 100644 index 0000000..4153624 --- /dev/null +++ b/patches.suse/phy-st-miphy28lp-use-_poll_timeout-functions-for-wai.patch @@ -0,0 +1,108 @@ +From e3be4dd2c8d8aabfd2c3127d0e2e5754d3ae82d6 Mon Sep 17 00:00:00 2001 +From: Alain Volmat +Date: Fri, 10 Feb 2023 23:43:08 +0100 +Subject: [PATCH] phy: st: miphy28lp: use _poll_timeout functions for waits +Git-commit: e3be4dd2c8d8aabfd2c3127d0e2e5754d3ae82d6 +Patch-mainline: v6.4-rc1 +References: git-fixes + +This commit introduces _poll_timeout functions usage instead of +wait loops waiting for a status bit. + +Signed-off-by: Alain Volmat +Reviewed-by: Patrice Chotard +Link: https://lore.kernel.org/r/20230210224309.98452-1-avolmat@me.com +Signed-off-by: Vinod Koul +Acked-by: Takashi Iwai + +--- + drivers/phy/st/phy-miphy28lp.c | 42 +++++++++-------------------------------- + 1 file changed, 10 insertions(+), 32 deletions(-) + +--- a/drivers/phy/st/phy-miphy28lp.c ++++ b/drivers/phy/st/phy-miphy28lp.c +@@ -9,6 +9,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -484,19 +485,11 @@ static inline void miphy28lp_pcie_config + + static inline int miphy28lp_wait_compensation(struct miphy28lp_phy *miphy_phy) + { +- unsigned long finish = jiffies + 5 * HZ; + u8 val; + + /* Waiting for Compensation to complete */ +- do { +- val = readb_relaxed(miphy_phy->base + MIPHY_COMP_FSM_6); +- +- if (time_after_eq(jiffies, finish)) +- return -EBUSY; +- cpu_relax(); +- } while (!(val & COMP_DONE)); +- +- return 0; ++ return readb_relaxed_poll_timeout(miphy_phy->base + MIPHY_COMP_FSM_6, ++ val, val & COMP_DONE, 1, 5 * USEC_PER_SEC); + } + + +@@ -805,7 +798,6 @@ static inline void miphy28lp_configure_u + + static inline int miphy_is_ready(struct miphy28lp_phy *miphy_phy) + { +- unsigned long finish = jiffies + 5 * HZ; + u8 mask = HFC_PLL | HFC_RDY; + u8 val; + +@@ -816,21 +808,14 @@ static inline int miphy_is_ready(struct + if (miphy_phy->type == PHY_TYPE_SATA) + mask |= PHY_RDY; + +- do { +- val = readb_relaxed(miphy_phy->base + MIPHY_STATUS_1); +- if ((val & mask) != mask) +- cpu_relax(); +- else +- return 0; +- } while (!time_after_eq(jiffies, finish)); +- +- return -EBUSY; ++ return readb_relaxed_poll_timeout(miphy_phy->base + MIPHY_STATUS_1, ++ val, (val & mask) == mask, 1, ++ 5 * USEC_PER_SEC); + } + + static int miphy_osc_is_ready(struct miphy28lp_phy *miphy_phy) + { + struct miphy28lp_dev *miphy_dev = miphy_phy->phydev; +- unsigned long finish = jiffies + 5 * HZ; + u32 val; + + if (!miphy_phy->osc_rdy) +@@ -839,17 +824,10 @@ static int miphy_osc_is_ready(struct mip + if (!miphy_phy->syscfg_reg[SYSCFG_STATUS]) + return -EINVAL; + +- do { +- regmap_read(miphy_dev->regmap, +- miphy_phy->syscfg_reg[SYSCFG_STATUS], &val); +- +- if ((val & MIPHY_OSC_RDY) != MIPHY_OSC_RDY) +- cpu_relax(); +- else +- return 0; +- } while (!time_after_eq(jiffies, finish)); +- +- return -EBUSY; ++ return regmap_read_poll_timeout(miphy_dev->regmap, ++ miphy_phy->syscfg_reg[SYSCFG_STATUS], ++ val, val & MIPHY_OSC_RDY, 1, ++ 5 * USEC_PER_SEC); + } + + static int miphy28lp_get_resource_byname(struct device_node *child, diff --git a/series.conf b/series.conf index 58e4d61..ac9dcb9 100644 --- a/series.conf +++ b/series.conf @@ -20062,6 +20062,7 @@ patches.suse/dmaengine-dw-edma-Fix-to-change-for-continuous-trans.patch patches.suse/dmaengine-dw-edma-Fix-to-enable-to-issue-dma-request.patch patches.suse/dmaengine-at_xdmac-do-not-enable-all-cyclic-channels.patch + patches.suse/phy-st-miphy28lp-use-_poll_timeout-functions-for-wai.patch patches.suse/phy-tegra-xusb-Add-missing-tegra_xusb_port_unregiste.patch patches.suse/soundwire-qcom-correct-setting-ignore-bit-on-v1.5.1.patch patches.suse/pwm-meson-Fix-axg-ao-mux-parents.patch