summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorStefan Chulski <stefanc@marvell.com>2021-05-03 09:08:52 +0300
committerStefan Roese <sr@denx.de>2021-05-20 14:03:31 +0300
commit27844000ef5f6717570789cace60af76f739f564 (patch)
tree5985ed9a479fd2988e159b580776879c48daaa78 /drivers/net
parentd757c859c758330bccf460d6c192109fc94b1443 (diff)
downloadu-boot-27844000ef5f6717570789cace60af76f739f564.tar.xz
net: mvpp2: allow MDIO registration for fixed links
Currently, there are 2 valid cases for interface, PHY and mdio relation: - If an interface has PHY handler, it'll call mdio_mii_bus_get_from_phy(), which will register MDIO bus. - If we want to use fixed-link for an interface, PHY handle is not defined in the DTS, and no MDIO is registered. There is a third case, for some boards (with switch), the MDIO is used for switch configuration, but the interface itself uses fixed link. This patch allows this option by checking if fixed-link subnode is defined, in this case, MDIO bus is registers, but the PHY address is set to PHY_MAX_ADDR for this interface, so this interface will not try to access the PHY later on. Signed-off-by: Stefan Chulski <stefanc@marvell.com> Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/mvpp2.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c
index 3d920e85ff..c5bfe41281 100644
--- a/drivers/net/mvpp2.c
+++ b/drivers/net/mvpp2.c
@@ -4787,16 +4787,25 @@ static int phy_info_parse(struct udevice *dev, struct mvpp2_port *port)
u32 id;
u32 phyaddr = 0;
int phy_mode = -1;
+ int fixed_link = 0;
int ret;
phy_node = fdtdec_lookup_phandle(gd->fdt_blob, port_node, "phy");
+ fixed_link = fdt_subnode_offset(gd->fdt_blob, port_node, "fixed-link");
if (phy_node > 0) {
int parent;
- phyaddr = fdtdec_get_int(gd->fdt_blob, phy_node, "reg", 0);
- if (phyaddr < 0) {
- dev_err(dev, "could not find phy address\n");
- return -1;
+
+ if (fixed_link != -FDT_ERR_NOTFOUND) {
+ /* phy_addr is set to invalid value for fixed links */
+ phyaddr = PHY_MAX_ADDR;
+ } else {
+ phyaddr = fdtdec_get_int(gd->fdt_blob, phy_node,
+ "reg", 0);
+ if (phyaddr < 0) {
+ dev_err(dev, "could not find phy address\n");
+ return -1;
+ }
}
parent = fdt_parent_offset(gd->fdt_blob, phy_node);
ret = uclass_get_device_by_of_offset(UCLASS_MDIO, parent,