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 <mkorpershoek@baylibre.com> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user