summaryrefslogtreecommitdiff
path: root/drivers/net/phy
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/phy')
-rw-r--r--drivers/net/phy/atheros.c1
-rw-r--r--drivers/net/phy/broadcom.c1
-rw-r--r--drivers/net/phy/davicom.c1
-rw-r--r--drivers/net/phy/generic_10g.c2
-rw-r--r--drivers/net/phy/lxt.c1
-rw-r--r--drivers/net/phy/marvell.c1
-rw-r--r--drivers/net/phy/micrel_ksz8xxx.c1
-rw-r--r--drivers/net/phy/micrel_ksz90x1.c2
-rw-r--r--drivers/net/phy/natsemi.c1
-rw-r--r--drivers/net/phy/phy.c6
-rw-r--r--drivers/net/phy/realtek.c1
-rw-r--r--drivers/net/phy/smsc.c1
-rw-r--r--drivers/net/phy/teranetics.c1
-rw-r--r--drivers/net/phy/ti.c41
-rw-r--r--drivers/net/phy/vitesse.c1
-rw-r--r--drivers/net/phy/xilinx_phy.c10
16 files changed, 44 insertions, 28 deletions
diff --git a/drivers/net/phy/atheros.c b/drivers/net/phy/atheros.c
index 79f68af14c..3783d155e7 100644
--- a/drivers/net/phy/atheros.c
+++ b/drivers/net/phy/atheros.c
@@ -5,6 +5,7 @@
* Copyright 2011, 2013 Freescale Semiconductor, Inc.
* author Andy Fleming
*/
+#include <common.h>
#include <phy.h>
#define AR803x_PHY_DEBUG_ADDR_REG 0x1d
diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index 202e3dd487..3399fd2366 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -5,7 +5,6 @@
* Copyright 2010-2011 Freescale Semiconductor, Inc.
* author Andy Fleming
*/
-#include <config.h>
#include <common.h>
#include <phy.h>
diff --git a/drivers/net/phy/davicom.c b/drivers/net/phy/davicom.c
index 27c7788493..4666497d44 100644
--- a/drivers/net/phy/davicom.c
+++ b/drivers/net/phy/davicom.c
@@ -5,6 +5,7 @@
* Copyright 2010-2011 Freescale Semiconductor, Inc.
* author Andy Fleming
*/
+#include <common.h>
#include <phy.h>
#define MIIM_DM9161_SCR 0x10
diff --git a/drivers/net/phy/generic_10g.c b/drivers/net/phy/generic_10g.c
index 1024d7db7b..b4384e1f78 100644
--- a/drivers/net/phy/generic_10g.c
+++ b/drivers/net/phy/generic_10g.c
@@ -7,8 +7,6 @@
*
* Based loosely off of Linux's PHY Lib
*/
-
-#include <config.h>
#include <common.h>
#include <miiphy.h>
#include <phy.h>
diff --git a/drivers/net/phy/lxt.c b/drivers/net/phy/lxt.c
index 5942664f1c..2618deb009 100644
--- a/drivers/net/phy/lxt.c
+++ b/drivers/net/phy/lxt.c
@@ -5,6 +5,7 @@
* Copyright 2010-2011 Freescale Semiconductor, Inc.
* author Andy Fleming
*/
+#include <common.h>
#include <phy.h>
/* LXT971 Status 2 registers */
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 436ff572fe..efbbd31ff7 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -5,7 +5,6 @@
* Copyright 2010-2011 Freescale Semiconductor, Inc.
* author Andy Fleming
*/
-#include <config.h>
#include <common.h>
#include <errno.h>
#include <phy.h>
diff --git a/drivers/net/phy/micrel_ksz8xxx.c b/drivers/net/phy/micrel_ksz8xxx.c
index c70c0364b8..3411150ab9 100644
--- a/drivers/net/phy/micrel_ksz8xxx.c
+++ b/drivers/net/phy/micrel_ksz8xxx.c
@@ -6,7 +6,6 @@
* author Andy Fleming
* (C) 2012 NetModule AG, David Andrey, added KSZ9031
*/
-#include <config.h>
#include <common.h>
#include <dm.h>
#include <errno.h>
diff --git a/drivers/net/phy/micrel_ksz90x1.c b/drivers/net/phy/micrel_ksz90x1.c
index 5462532be6..3951535bf1 100644
--- a/drivers/net/phy/micrel_ksz90x1.c
+++ b/drivers/net/phy/micrel_ksz90x1.c
@@ -8,8 +8,6 @@
* (C) Copyright 2017 Adaptrum, Inc.
* Written by Alexandru Gagniuc <alex.g@adaptrum.com> for Adaptrum, Inc.
*/
-
-#include <config.h>
#include <common.h>
#include <dm.h>
#include <errno.h>
diff --git a/drivers/net/phy/natsemi.c b/drivers/net/phy/natsemi.c
index 05c7e7c089..efde4574de 100644
--- a/drivers/net/phy/natsemi.c
+++ b/drivers/net/phy/natsemi.c
@@ -5,6 +5,7 @@
* Copyright 2010-2011 Freescale Semiconductor, Inc.
* author Andy Fleming
*/
+#include <common.h>
#include <phy.h>
/* NatSemi DP83630 */
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 4e610bf054..e837eb7688 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -7,8 +7,6 @@
*
* Based loosely off of Linux's PHY Lib
*/
-
-#include <config.h>
#include <common.h>
#include <console.h>
#include <dm.h>
@@ -644,6 +642,10 @@ static struct phy_device *phy_device_create(struct mii_dev *bus, int addr,
dev->link = 0;
dev->interface = interface;
+#ifdef CONFIG_DM_ETH
+ dev->node = ofnode_null();
+#endif
+
dev->autoneg = AUTONEG_ENABLE;
dev->addr = addr;
diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
index b0867af220..b3e6578df9 100644
--- a/drivers/net/phy/realtek.c
+++ b/drivers/net/phy/realtek.c
@@ -6,7 +6,6 @@
* author Andy Fleming
* Copyright 2016 Karsten Merker <merker@debian.org>
*/
-#include <config.h>
#include <common.h>
#include <linux/bitops.h>
#include <phy.h>
diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c
index 2f92957a5a..7740a2510d 100644
--- a/drivers/net/phy/smsc.c
+++ b/drivers/net/phy/smsc.c
@@ -9,6 +9,7 @@
* Some code copied from linux kernel
* Copyright (c) 2006 Herbert Valerio Riedel <hvr@gnu.org>
*/
+#include <common.h>
#include <miiphy.h>
/* This code does not check the partner abilities. */
diff --git a/drivers/net/phy/teranetics.c b/drivers/net/phy/teranetics.c
index d674e8f857..49d6a1ad90 100644
--- a/drivers/net/phy/teranetics.c
+++ b/drivers/net/phy/teranetics.c
@@ -5,7 +5,6 @@
* Copyright 2010-2011 Freescale Semiconductor, Inc.
* author Andy Fleming
*/
-#include <config.h>
#include <common.h>
#include <phy.h>
diff --git a/drivers/net/phy/ti.c b/drivers/net/phy/ti.c
index 8f3ed8a983..f870e6d662 100644
--- a/drivers/net/phy/ti.c
+++ b/drivers/net/phy/ti.c
@@ -8,11 +8,9 @@
#include <linux/compat.h>
#include <malloc.h>
-#include <fdtdec.h>
#include <dm.h>
#include <dt-bindings/net/ti-dp83867.h>
-DECLARE_GLOBAL_DATA_PTR;
/* TI DP83867 */
#define DP83867_DEVADDR 0x1f
@@ -24,6 +22,7 @@ DECLARE_GLOBAL_DATA_PTR;
#define DP83867_CTRL 0x1f
/* Extended Registers */
+#define DP83867_CFG4 0x0031
#define DP83867_RGMIICTL 0x0032
#define DP83867_RGMIIDCTL 0x0086
#define DP83867_IO_MUX_CFG 0x0170
@@ -95,6 +94,7 @@ struct dp83867_private {
int tx_id_delay;
int fifo_depth;
int io_impedance;
+ bool rxctrl_strap_quirk;
};
/**
@@ -172,25 +172,31 @@ void phy_write_mmd_indirect(struct phy_device *phydev, int prtad,
static int dp83867_of_init(struct phy_device *phydev)
{
struct dp83867_private *dp83867 = phydev->priv;
- struct udevice *dev = phydev->dev;
- int node = dev_of_offset(dev);
- const void *fdt = gd->fdt_blob;
+ ofnode node;
- if (fdtdec_get_bool(fdt, node, "ti,max-output-impedance"))
+ node = phy_get_ofnode(phydev);
+ if (!ofnode_valid(node))
+ return -EINVAL;
+
+ if (ofnode_read_bool(node, "ti,max-output-impedance"))
dp83867->io_impedance = DP83867_IO_MUX_CFG_IO_IMPEDANCE_MAX;
- else if (fdtdec_get_bool(fdt, node, "ti,min-output-impedance"))
+ else if (ofnode_read_bool(node, "ti,min-output-impedance"))
dp83867->io_impedance = DP83867_IO_MUX_CFG_IO_IMPEDANCE_MIN;
else
dp83867->io_impedance = -EINVAL;
- dp83867->rx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
- "ti,rx-internal-delay", -1);
+ if (ofnode_read_bool(node, "ti,dp83867-rxctrl-strap-quirk"))
+ dp83867->rxctrl_strap_quirk = true;
+ dp83867->rx_id_delay = ofnode_read_u32_default(node,
+ "ti,rx-internal-delay",
+ -1);
- dp83867->tx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
- "ti,tx-internal-delay", -1);
+ dp83867->tx_id_delay = ofnode_read_u32_default(node,
+ "ti,tx-internal-delay",
+ -1);
- dp83867->fifo_depth = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
- "ti,fifo-depth", -1);
+ dp83867->fifo_depth = ofnode_read_u32_default(node, "ti,fifo-depth",
+ -1);
return 0;
}
@@ -232,6 +238,15 @@ static int dp83867_config(struct phy_device *phydev)
phy_write(phydev, MDIO_DEVAD_NONE, DP83867_CTRL,
val | DP83867_SW_RESTART);
+ /* Mode 1 or 2 workaround */
+ if (dp83867->rxctrl_strap_quirk) {
+ val = phy_read_mmd_indirect(phydev, DP83867_CFG4,
+ DP83867_DEVADDR, phydev->addr);
+ val &= ~BIT(7);
+ phy_write_mmd_indirect(phydev, DP83867_CFG4,
+ DP83867_DEVADDR, phydev->addr, val);
+ }
+
if (phy_interface_is_rgmii(phydev)) {
ret = phy_write(phydev, MDIO_DEVAD_NONE, MII_DP83867_PHYCTRL,
(DP83867_MDI_CROSSOVER_AUTO << DP83867_MDI_CROSSOVER) |
diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c
index 9df4a3fae5..eca26c9893 100644
--- a/drivers/net/phy/vitesse.c
+++ b/drivers/net/phy/vitesse.c
@@ -6,6 +6,7 @@
* Original Author: Andy Fleming
* Add vsc8662 phy support - Priyanka Jain
*/
+#include <common.h>
#include <miiphy.h>
/* Cicada Auxiliary Control/Status Register */
diff --git a/drivers/net/phy/xilinx_phy.c b/drivers/net/phy/xilinx_phy.c
index 004cfcf647..3aa8891efe 100644
--- a/drivers/net/phy/xilinx_phy.c
+++ b/drivers/net/phy/xilinx_phy.c
@@ -10,8 +10,6 @@
#include <phy.h>
#include <dm.h>
-DECLARE_GLOBAL_DATA_PTR;
-
#define MII_PHY_STATUS_SPD_MASK 0x0C00
#define MII_PHY_STATUS_FULLDUPLEX 0x1000
#define MII_PHY_STATUS_1000 0x0800
@@ -101,10 +99,14 @@ static int xilinxphy_startup(struct phy_device *phydev)
static int xilinxphy_of_init(struct phy_device *phydev)
{
u32 phytype;
+ ofnode node;
debug("%s\n", __func__);
- phytype = fdtdec_get_int(gd->fdt_blob, dev_of_offset(phydev->dev),
- "xlnx,phy-type", -1);
+ node = phy_get_ofnode(phydev);
+ if (!ofnode_valid(node))
+ return -EINVAL;
+
+ phytype = ofnode_read_u32_default(node, "xlnx,phy-type", -1);
if (phytype == XAE_PHY_TYPE_1000BASE_X)
phydev->flags |= XAE_PHY_TYPE_1000BASE_X;