summaryrefslogtreecommitdiff
path: root/drivers/phy
diff options
context:
space:
mode:
authorMarek Vasut <[email protected]>2024-09-08 23:09:03 +0200
committerMarek Vasut <[email protected]>2024-09-09 17:18:04 +0200
commit35941d3a962dbee1fdf9bb3fe0eb7185d833b9d8 (patch)
tree4bb0546ecc6de1fceb3481c11a7d68e5150ea09f /drivers/phy
parentd0f74bd417daf6492975ce346843ba0767caf51c (diff)
phy: Extend generic_setup_phy() with PHY mode and submode
Extend generic_setup_phy() parameter list with PHY mode and submode and call generic_phy_set_mode() in generic_setup_phy(), so the generic PHY setup function can configure the PHY into correct mode before powering the PHY up. Update all call sites of generic_setup_phy() as well, all of which are USB host related, except for DM test which now behaves as a USB host test. Note that if the PHY driver does not implement the .set_mode callback, generic_phy_set_mode() call returns 0 and does not error out, so this should not break any existing systems. Reviewed-by: Mattijs Korpershoek <[email protected]> Signed-off-by: Marek Vasut <[email protected]>
Diffstat (limited to 'drivers/phy')
-rw-r--r--drivers/phy/phy-uclass.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/phy/phy-uclass.c b/drivers/phy/phy-uclass.c
index acdcda15b5b..777d952b041 100644
--- a/drivers/phy/phy-uclass.c
+++ b/drivers/phy/phy-uclass.c
@@ -508,7 +508,8 @@ int generic_phy_power_off_bulk(struct phy_bulk *bulk)
return ret;
}
-int generic_setup_phy(struct udevice *dev, struct phy *phy, int index)
+int generic_setup_phy(struct udevice *dev, struct phy *phy, int index,
+ enum phy_mode mode, int submode)
{
int ret;
@@ -520,10 +521,18 @@ int generic_setup_phy(struct udevice *dev, struct phy *phy, int index)
if (ret)
return ret;
+ ret = generic_phy_set_mode(phy, mode, submode);
+ if (ret)
+ goto phys_mode_err;
+
ret = generic_phy_power_on(phy);
if (ret)
- generic_phy_exit(phy);
+ goto phys_mode_err;
+
+ return 0;
+phys_mode_err:
+ generic_phy_exit(phy);
return ret;
}