summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAnjanaSuraj <anjana.r@puresoftware.com>2022-04-08 11:23:59 +0530
committerXiaobo Xie <xiaobo.xie@nxp.com>2022-05-30 13:06:56 +0200
commitf405a4f65855b384ad5b7cd3eff1ff815826ffa8 (patch)
tree18742af98b44fe16572cd560e15fdaede921d7ec /drivers
parent7e24913fad6082b9969ea79c5c61bb7b01abcd15 (diff)
dpaa_eth: add ACPI support to connect to PHY
Add ACPI support for the DPAA Ethernet driver when connecting to a PHY. Signed-off-by: AnjanaSuraj <anjana.r@puresoftware.com> Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/freescale/dpaa/dpaa_eth.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 685d2d8a3b36..c320e9e5eb18 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -1,5 +1,6 @@
/* Copyright 2008 - 2016 Freescale Semiconductor Inc.
* Copyright 2020 NXP
+ * Copyright 2020 Puresoftware Ltd.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -57,6 +58,7 @@
#include <linux/bpf_trace.h>
#include <soc/fsl/bman.h>
#include <soc/fsl/qman.h>
+#include <linux/acpi.h>
#include "fman.h"
#include "fman_port.h"
#include "mac.h"
@@ -2918,13 +2920,27 @@ static int dpaa_phy_init(struct net_device *net_dev)
struct mac_device *mac_dev;
struct phy_device *phy_dev;
struct dpaa_priv *priv;
+ struct device *dev;
priv = netdev_priv(net_dev);
mac_dev = priv->mac_dev;
- phy_dev = of_phy_connect(net_dev, mac_dev->phy_node,
- &dpaa_adjust_link, 0,
- mac_dev->phy_if);
+ if (is_acpi_node(mac_dev->fwnode_phy)) {
+ dev = bus_find_device_by_fwnode(&mdio_bus_type,
+ mac_dev->fwnode_phy);
+ if (dev) {
+ phy_dev = to_phy_device(dev);
+ WARN_ON(phy_dev->attached_dev);
+ phy_dev = phy_connect(net_dev, phydev_name(phy_dev),
+ &dpaa_adjust_link, mac_dev->phy_if);
+ } else {
+ phy_dev = NULL;
+ }
+ } else {
+ phy_dev = of_phy_connect(net_dev, mac_dev->phy_node,
+ &dpaa_adjust_link, 0, mac_dev->phy_if);
+ }
+
if (!phy_dev) {
netif_err(priv, ifup, net_dev, "init_phy() failed\n");
return -ENODEV;