aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/phy/phy.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2021-02-16 15:14:34 -0500
committerTom Rini <trini@konsulko.com>2021-02-16 15:14:34 -0500
commit496f49464d90b564da5f1a2f4eecb5553e01edf9 (patch)
treee084452c2b7e9f2d0ede789aa840e9e3ae2338ed /drivers/net/phy/phy.c
parent767582cd4c755c52bce3e1813bc462f37047cb5c (diff)
parentd003434525767145d152b54573ef8e030b63a6fe (diff)
Merge branch '2021-02-16-assorted-improvements'
- DSA switch support (Layerscape platforms) - IOMUX cleanup / fixes - i2c OP-TEE trampoline driver
Diffstat (limited to 'drivers/net/phy/phy.c')
-rw-r--r--drivers/net/phy/phy.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index a2be398736..89e3076bfd 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -977,6 +977,37 @@ static struct phy_device *phy_connect_gmii2rgmii(struct mii_dev *bus,
#endif
#ifdef CONFIG_PHY_FIXED
+/**
+ * fixed_phy_create() - create an unconnected fixed-link pseudo-PHY device
+ * @node: OF node for the container of the fixed-link node
+ *
+ * Description: Creates a struct phy_device based on a fixed-link of_node
+ * description. Can be used without phy_connect by drivers which do not expose
+ * a UCLASS_ETH udevice.
+ */
+struct phy_device *fixed_phy_create(ofnode node)
+{
+ phy_interface_t interface = PHY_INTERFACE_MODE_NONE;
+ const char *if_str;
+ ofnode subnode;
+
+ if_str = ofnode_read_string(node, "phy-mode");
+ if (!if_str) {
+ if_str = ofnode_read_string(node, "phy-interface-type");
+ }
+ if (if_str) {
+ interface = phy_get_interface_by_name(if_str);
+ }
+
+ subnode = ofnode_find_subnode(node, "fixed-link");
+ if (!ofnode_valid(subnode)) {
+ return NULL;
+ }
+
+ return phy_device_create(NULL, ofnode_to_offset(subnode), PHY_FIXED_ID,
+ false, interface);
+}
+
#ifdef CONFIG_DM_ETH
static struct phy_device *phy_connect_fixed(struct mii_dev *bus,
struct udevice *dev,