From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michal Simek Date: Mon, 11 Apr 2016 09:09:53 +0200 Subject: [U-Boot] [uboot] [PATCH 2/7] net: zynq_gem: Add the passing of the phy-handle node In-Reply-To: <1460131707-8496-2-git-send-email-dmurphy@ti.com> References: <1460131707-8496-1-git-send-email-dmurphy@ti.com> <1460131707-8496-2-git-send-email-dmurphy@ti.com> Message-ID: <570B4DC1.8050005@xilinx.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 8.4.2016 18:08, Dan Murphy wrote: > Add the ability to pass the phy-handle node offset > to the phy driver. This allows the phy driver > to access the DT subnode's data and parse accordingly. > > Signed-off-by: Dan Murphy > --- > drivers/net/zynq_gem.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c > index aec8077..722927a 100644 > --- a/drivers/net/zynq_gem.c > +++ b/drivers/net/zynq_gem.c > @@ -179,6 +179,7 @@ struct zynq_gem_priv { > struct zynq_gem_regs *iobase; > phy_interface_t interface; > struct phy_device *phydev; > + int phy_of_handle; > struct mii_dev *bus; > }; > > @@ -352,6 +353,10 @@ static int zynq_phy_init(struct udevice *dev) > priv->phydev->supported = supported | ADVERTISED_Pause | > ADVERTISED_Asym_Pause; > priv->phydev->advertising = priv->phydev->supported; > + > + if (priv->phy_of_handle > 0) > + priv->phydev->dev->of_offset = priv->phy_of_handle; > + > phy_config(priv->phydev); > > return 0; > @@ -684,10 +689,11 @@ static int zynq_gem_ofdata_to_platdata(struct udevice *dev) > priv->emio = 0; > priv->phyaddr = -1; > > - offset = fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset, > + priv->phy_of_handle = fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset, > "phy-handle"); This line is longer than 80 chars - checkpatch is failing on it. > - if (offset > 0) > - priv->phyaddr = fdtdec_get_int(gd->fdt_blob, offset, "reg", -1); > + if (priv->phy_of_handle > 0) > + priv->phyaddr = fdtdec_get_int(gd->fdt_blob, > + priv->phy_of_handle, "reg", -1); > > phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy-mode", NULL); > if (phy_mode) > You have to remove offset too. drivers/net/zynq_gem.c:683:6: warning: unused variable ?offset? [-Wunused-variable] int offset = 0; ^ With changes I have done myself it looks that it is working. I will retest next version. Thanks, Michal