diff options
author | Patrice Chotard | 2022-09-06 08:15:26 +0200 |
---|---|---|
committer | Marek Vasut | 2022-10-10 18:08:18 +0200 |
commit | 84e561407a5f62a8746dcf8f920e4682690435a0 (patch) | |
tree | f09f2e8d1ea772812c45b7c0bbba336342b1dcc8 /include | |
parent | 7cc1af902dfad290ab39b0ee52128b18d83a151a (diff) |
phy: Add generic_{setup,shutdown}_phy() helpers
In drivers usb/host/{ehci,ohci}-generic.c, {ehci,ohci}_setup_phy() and
{ehci,ohci}_shutdown_phy() shares 95% of common code.
Factorize this code in new generic_{setup,shudown}_phy() functions.
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/generic-phy.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/include/generic-phy.h b/include/generic-phy.h index d40ce589b64..f8eddeff67a 100644 --- a/include/generic-phy.h +++ b/include/generic-phy.h @@ -342,6 +342,26 @@ int generic_phy_power_on_bulk(struct phy_bulk *bulk); */ int generic_phy_power_off_bulk(struct phy_bulk *bulk); +/** + * generic_setup_phy() - Get, initialize and power on phy. + * + * @dev: The consumer device. + * @phy: A pointer to the PHY port + * @index: The index in the list of available PHYs + * + * Return: 0 if OK, or negative error code. + */ +int generic_setup_phy(struct udevice *dev, struct phy *phy, int index); + +/** + * generic_shutdown_phy() - Power off and de-initialize phy. + * + * @phy: A pointer to the PHY port. + * + * Return: 0 if OK, or negative error code. + */ +int generic_shutdown_phy(struct phy *phy); + #else /* CONFIG_PHY */ static inline int generic_phy_init(struct phy *phy) @@ -407,6 +427,16 @@ static inline int generic_phy_power_off_bulk(struct phy_bulk *bulk) return 0; } +static inline int generic_setup_phy(struct udevice *dev, struct phy *phy, int index) +{ + return 0; +} + +static inline int generic_shutdown_phy(struct phy *phy) +{ + return 0; +} + #endif /* CONFIG_PHY */ /** |