mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-06-01 04:11:36 +00:00
net: axi_emac: Enable access to MDIO in probe
Detect phy when driver probes. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
This commit is contained in:
parent
75cc93fad7
commit
5d0449d4c7
1 changed files with 19 additions and 3 deletions
|
@ -221,11 +221,10 @@ static u32 phywrite(struct axidma_priv *priv, u32 phyaddress, u32 registernum,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setting axi emac and phy to proper setting */
|
static int axiemac_phy_init(struct udevice *dev)
|
||||||
static int setup_phy(struct udevice *dev)
|
|
||||||
{
|
{
|
||||||
u16 phyreg;
|
u16 phyreg;
|
||||||
u32 i, speed, emmc_reg, ret;
|
u32 i, ret;
|
||||||
struct axidma_priv *priv = dev_get_priv(dev);
|
struct axidma_priv *priv = dev_get_priv(dev);
|
||||||
struct axi_regs *regs = priv->iobase;
|
struct axi_regs *regs = priv->iobase;
|
||||||
struct phy_device *phydev;
|
struct phy_device *phydev;
|
||||||
|
@ -237,6 +236,9 @@ static int setup_phy(struct udevice *dev)
|
||||||
SUPPORTED_1000baseT_Half |
|
SUPPORTED_1000baseT_Half |
|
||||||
SUPPORTED_1000baseT_Full;
|
SUPPORTED_1000baseT_Full;
|
||||||
|
|
||||||
|
/* Set default MDIO divisor */
|
||||||
|
out_be32(®s->mdio_mc, XAE_MDIO_DIV_DFT | XAE_MDIO_MC_MDIOEN_MASK);
|
||||||
|
|
||||||
if (priv->phyaddr == -1) {
|
if (priv->phyaddr == -1) {
|
||||||
/* Detect the PHY address */
|
/* Detect the PHY address */
|
||||||
for (i = 31; i >= 0; i--) {
|
for (i = 31; i >= 0; i--) {
|
||||||
|
@ -259,6 +261,18 @@ static int setup_phy(struct udevice *dev)
|
||||||
phydev->advertising = phydev->supported;
|
phydev->advertising = phydev->supported;
|
||||||
priv->phydev = phydev;
|
priv->phydev = phydev;
|
||||||
phy_config(phydev);
|
phy_config(phydev);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Setting axi emac and phy to proper setting */
|
||||||
|
static int setup_phy(struct udevice *dev)
|
||||||
|
{
|
||||||
|
u32 speed, emmc_reg;
|
||||||
|
struct axidma_priv *priv = dev_get_priv(dev);
|
||||||
|
struct axi_regs *regs = priv->iobase;
|
||||||
|
struct phy_device *phydev = priv->phydev;
|
||||||
|
|
||||||
if (phy_startup(phydev)) {
|
if (phy_startup(phydev)) {
|
||||||
printf("axiemac: could not initialize PHY %s\n",
|
printf("axiemac: could not initialize PHY %s\n",
|
||||||
phydev->dev->name);
|
phydev->dev->name);
|
||||||
|
@ -621,6 +635,8 @@ static int axi_emac_probe(struct udevice *dev)
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
axiemac_phy_init(dev);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue