* [PATCH v1 net-next PATCH 1/1] net: phy: air_en8811h: Introduce resume/suspend and clk_restore_context to ensure correct CKO settings after network interface reinitialization.
@ 2025-06-29 11:59 Lucien.Jheng
2025-06-29 14:23 ` kernel test robot
2025-06-29 18:10 ` Andrew Lunn
0 siblings, 2 replies; 3+ messages in thread
From: Lucien.Jheng @ 2025-06-29 11:59 UTC (permalink / raw)
To: linux-clk, andrew, hkallweit1, linux, kuba, davem, edumazet,
pabeni, daniel, ericwouds
Cc: netdev, linux-kernel, joseph.lin, wenshin.chung, lucien.jheng,
albert-al.lee, Lucien.Jheng
If the user reinitializes the network interface, the PHY will reinitialize,
and the CKO settings will revert to their initial configuration(be enabled).
To prevent CKO from being re-enabled,
en8811h_clk_restore_context and en8811h_resume were added
to ensure the CKO settings remain correct.
Signed-off-by: Lucien.Jheng <lucienzx159@gmail.com>
---
drivers/net/phy/air_en8811h.c | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/drivers/net/phy/air_en8811h.c b/drivers/net/phy/air_en8811h.c
index 57fbd8df9438..94cafda1f535 100644
--- a/drivers/net/phy/air_en8811h.c
+++ b/drivers/net/phy/air_en8811h.c
@@ -11,6 +11,7 @@
* Copyright (C) 2023 Airoha Technology Corp.
*/
+#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/phy.h>
#include <linux/firmware.h>
@@ -865,11 +866,20 @@ static int en8811h_clk_is_enabled(struct clk_hw *hw)
return (pbus_value & EN8811H_CLK_CGM_CKO);
}
+static void en8811h_clk_restore_context(struct clk_hw *hw)
+{
+ if (!__clk_get_enable_count(hw->clk))
+ en8811h_clk_disable(hw);
+ else
+ en8811h_clk_enable(hw);
+}
+
static const struct clk_ops en8811h_clk_ops = {
- .recalc_rate = en8811h_clk_recalc_rate,
- .enable = en8811h_clk_enable,
- .disable = en8811h_clk_disable,
- .is_enabled = en8811h_clk_is_enabled,
+ .recalc_rate = en8811h_clk_recalc_rate,
+ .enable = en8811h_clk_enable,
+ .disable = en8811h_clk_disable,
+ .is_enabled = en8811h_clk_is_enabled,
+ .restore_context = en8811h_clk_restore_context,
};
static int en8811h_clk_provider_setup(struct device *dev, struct clk_hw *hw)
@@ -1149,6 +1159,13 @@ static irqreturn_t en8811h_handle_interrupt(struct phy_device *phydev)
return IRQ_HANDLED;
}
+static int en8811h_resume(struct phy_device *phydev)
+{
+ clk_restore_context();
+
+ return genphy_resume(phydev);
+}
+
static struct phy_driver en8811h_driver[] = {
{
PHY_ID_MATCH_MODEL(EN8811H_PHY_ID),
@@ -1159,6 +1176,8 @@ static struct phy_driver en8811h_driver[] = {
.get_rate_matching = en8811h_get_rate_matching,
.config_aneg = en8811h_config_aneg,
.read_status = en8811h_read_status,
+ .resume = en8811h_resume,
+ .suspend = genphy_suspend,
.config_intr = en8811h_clear_intr,
.handle_interrupt = en8811h_handle_interrupt,
.led_hw_is_supported = en8811h_led_hw_is_supported,
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1 net-next PATCH 1/1] net: phy: air_en8811h: Introduce resume/suspend and clk_restore_context to ensure correct CKO settings after network interface reinitialization.
2025-06-29 11:59 [PATCH v1 net-next PATCH 1/1] net: phy: air_en8811h: Introduce resume/suspend and clk_restore_context to ensure correct CKO settings after network interface reinitialization Lucien.Jheng
@ 2025-06-29 14:23 ` kernel test robot
2025-06-29 18:10 ` Andrew Lunn
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2025-06-29 14:23 UTC (permalink / raw)
To: Lucien.Jheng, linux-clk, andrew, hkallweit1, linux, kuba, davem,
edumazet, pabeni, daniel, ericwouds
Cc: oe-kbuild-all, netdev, linux-kernel, joseph.lin, wenshin.chung,
lucien.jheng, albert-al.lee, Lucien.Jheng
Hi Lucien.Jheng,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Lucien-Jheng/net-phy-air_en8811h-Introduce-resume-suspend-and-clk_restore_context-to-ensure-correct-CKO-settings-after-network-interf/20250629-200137
base: net-next/main
patch link: https://lore.kernel.org/r/20250629115911.51392-1-lucienzx159%40gmail.com
patch subject: [PATCH v1 net-next PATCH 1/1] net: phy: air_en8811h: Introduce resume/suspend and clk_restore_context to ensure correct CKO settings after network interface reinitialization.
config: arm-randconfig-004-20250629 (https://download.01.org/0day-ci/archive/20250629/202506292222.nBaJywJw-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 12.4.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250629/202506292222.nBaJywJw-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202506292222.nBaJywJw-lkp@intel.com/
All errors (new ones prefixed by >>, old ones prefixed by <<):
>> ERROR: modpost: "__clk_get_enable_count" [drivers/net/phy/air_en8811h.ko] undefined!
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1 net-next PATCH 1/1] net: phy: air_en8811h: Introduce resume/suspend and clk_restore_context to ensure correct CKO settings after network interface reinitialization.
2025-06-29 11:59 [PATCH v1 net-next PATCH 1/1] net: phy: air_en8811h: Introduce resume/suspend and clk_restore_context to ensure correct CKO settings after network interface reinitialization Lucien.Jheng
2025-06-29 14:23 ` kernel test robot
@ 2025-06-29 18:10 ` Andrew Lunn
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2025-06-29 18:10 UTC (permalink / raw)
To: Lucien.Jheng
Cc: linux-clk, hkallweit1, linux, kuba, davem, edumazet, pabeni,
daniel, ericwouds, netdev, linux-kernel, joseph.lin,
wenshin.chung, lucien.jheng, albert-al.lee
> +static void en8811h_clk_restore_context(struct clk_hw *hw)
> +{
> + if (!__clk_get_enable_count(hw->clk))
Using a __ functions seems wrong, they are supposed to be internal.
How about clk_ops save_context() and restore_context()?
Andrew
---
pw-bot: cr
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-06-29 18:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-29 11:59 [PATCH v1 net-next PATCH 1/1] net: phy: air_en8811h: Introduce resume/suspend and clk_restore_context to ensure correct CKO settings after network interface reinitialization Lucien.Jheng
2025-06-29 14:23 ` kernel test robot
2025-06-29 18:10 ` Andrew Lunn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®