summaryrefslogtreecommitdiff
path: root/drivers/phy/phy-uclass.c
diff options
context:
space:
mode:
authorMarek Vasut <marek.vasut+renesas@mailbox.org>2023-03-19 20:09:42 +0300
committerMarek Vasut <marek.vasut+renesas@mailbox.org>2023-04-07 15:23:26 +0300
commitb0177a24d48e4ce13bfd7fce0d9c17dc0996f9a5 (patch)
tree35132d34223ab4fe3ae58ee5f7ae811546d4ef87 /drivers/phy/phy-uclass.c
parent12a8efbcdd6240e0f0a1e99b744eaed9ba6fba22 (diff)
downloadu-boot-b0177a24d48e4ce13bfd7fce0d9c17dc0996f9a5.tar.xz
phy: Add .set_mode and .set_speed callbacks
Add two new callbacks matching the Linux ones. The .set_mode is used to set PHY mode and submode, where mode is either USB, Ethernet, and so on, while submode is e.g. for Ethernet case RGMII, RMII, and so on. The .set_speed is used to configure link speed into the PHY. Unlike the existing configure callback, which is used to pass arbitrary custom information to the PHY, these two callbacks are used to pass standardized set of information to the PHY. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Diffstat (limited to 'drivers/phy/phy-uclass.c')
-rw-r--r--drivers/phy/phy-uclass.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/phy/phy-uclass.c b/drivers/phy/phy-uclass.c
index 3fef5135a9..83e4b63079 100644
--- a/drivers/phy/phy-uclass.c
+++ b/drivers/phy/phy-uclass.c
@@ -351,6 +351,28 @@ int generic_phy_configure(struct phy *phy, void *params)
return ops->configure ? ops->configure(phy, params) : 0;
}
+int generic_phy_set_mode(struct phy *phy, enum phy_mode mode, int submode)
+{
+ struct phy_ops const *ops;
+
+ if (!generic_phy_valid(phy))
+ return 0;
+ ops = phy_dev_ops(phy->dev);
+
+ return ops->set_mode ? ops->set_mode(phy, mode, submode) : 0;
+}
+
+int generic_phy_set_speed(struct phy *phy, int speed)
+{
+ struct phy_ops const *ops;
+
+ if (!generic_phy_valid(phy))
+ return 0;
+ ops = phy_dev_ops(phy->dev);
+
+ return ops->set_speed ? ops->set_speed(phy, speed) : 0;
+}
+
int generic_phy_get_bulk(struct udevice *dev, struct phy_bulk *bulk)
{
int i, ret, count;