diff mbox

[U-Boot,v6,2/7] net: zynq_gem: Add the passing of the phy-handle node

Message ID 1460723242-20805-2-git-send-email-dmurphy@ti.com
State Superseded
Delegated to: Joe Hershberger
Headers show

Commit Message

Dan Murphy April 15, 2016, 12:27 p.m. UTC
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 <dmurphy@ti.com>
Tested-by: Michal Simek <michal.simek@xilinx.com>
---

v6 - No changes - https://patchwork.ozlabs.org/patch/608769/

 drivers/net/zynq_gem.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

Comments

Dan Murphy April 20, 2016, 7:41 p.m. UTC | #1
Bump?
On 04/15/2016 07:27 AM, 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 <dmurphy@ti.com>
> Tested-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
> v6 - No changes - https://patchwork.ozlabs.org/patch/608769/
>
>  drivers/net/zynq_gem.c | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
> index aec8077..f9b22c4 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;
> @@ -675,7 +680,6 @@ static int zynq_gem_ofdata_to_platdata(struct udevice *dev)
>  {
>  	struct eth_pdata *pdata = dev_get_platdata(dev);
>  	struct zynq_gem_priv *priv = dev_get_priv(dev);
> -	int offset = 0;
>  	const char *phy_mode;
>  
>  	pdata->iobase = (phys_addr_t)dev_get_addr(dev);
> @@ -684,10 +688,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,
> -				       "phy-handle");
> -	if (offset > 0)
> -		priv->phyaddr = fdtdec_get_int(gd->fdt_blob, offset, "reg", -1);
> +	priv->phy_of_handle = fdtdec_lookup_phandle(gd->fdt_blob,
> +					dev->of_offset, "phy-handle");
> +	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)
Michal Simek April 21, 2016, 5:46 a.m. UTC | #2
On 20.4.2016 21:41, Dan Murphy wrote:
> Bump?
> On 04/15/2016 07:27 AM, 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 <dmurphy@ti.com>
>> Tested-by: Michal Simek <michal.simek@xilinx.com>
>> ---
>>
>> v6 - No changes - https://patchwork.ozlabs.org/patch/608769/
>>
>>  drivers/net/zynq_gem.c | 15 ++++++++++-----
>>  1 file changed, 10 insertions(+), 5 deletions(-)
>>


Joe, Tom: Do you want to take this series?
I am happy to do so because there is xilinx part.

Thanks,
Michal
Tom Rini April 21, 2016, 11:51 a.m. UTC | #3
On Thu, Apr 21, 2016 at 07:46:34AM +0200, Michal Simek wrote:
> On 20.4.2016 21:41, Dan Murphy wrote:
> > Bump?
> > On 04/15/2016 07:27 AM, 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 <dmurphy@ti.com>
> >> Tested-by: Michal Simek <michal.simek@xilinx.com>
> >> ---
> >>
> >> v6 - No changes - https://patchwork.ozlabs.org/patch/608769/
> >>
> >>  drivers/net/zynq_gem.c | 15 ++++++++++-----
> >>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> 
> Joe, Tom: Do you want to take this series?
> I am happy to do so because there is xilinx part.

If Joe doesn't want to take it, I will.
Michal Simek April 21, 2016, 1:42 p.m. UTC | #4
On 21.4.2016 13:51, Tom Rini wrote:
> On Thu, Apr 21, 2016 at 07:46:34AM +0200, Michal Simek wrote:
>> On 20.4.2016 21:41, Dan Murphy wrote:
>>> Bump?
>>> On 04/15/2016 07:27 AM, 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 <dmurphy@ti.com>
>>>> Tested-by: Michal Simek <michal.simek@xilinx.com>
>>>> ---
>>>>
>>>> v6 - No changes - https://patchwork.ozlabs.org/patch/608769/
>>>>
>>>>  drivers/net/zynq_gem.c | 15 ++++++++++-----
>>>>  1 file changed, 10 insertions(+), 5 deletions(-)
>>
>>
>> Joe, Tom: Do you want to take this series?
>> I am happy to do so because there is xilinx part.
> 
> If Joe doesn't want to take it, I will.

Ok. Thanks,
Michal
Joe Hershberger April 25, 2016, 9:39 p.m. UTC | #5
On Fri, Apr 15, 2016 at 7:27 AM, Dan Murphy <dmurphy@ti.com> 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 <dmurphy@ti.com>
> Tested-by: Michal Simek <michal.simek@xilinx.com>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
diff mbox

Patch

diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
index aec8077..f9b22c4 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;
@@ -675,7 +680,6 @@  static int zynq_gem_ofdata_to_platdata(struct udevice *dev)
 {
 	struct eth_pdata *pdata = dev_get_platdata(dev);
 	struct zynq_gem_priv *priv = dev_get_priv(dev);
-	int offset = 0;
 	const char *phy_mode;
 
 	pdata->iobase = (phys_addr_t)dev_get_addr(dev);
@@ -684,10 +688,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,
-				       "phy-handle");
-	if (offset > 0)
-		priv->phyaddr = fdtdec_get_int(gd->fdt_blob, offset, "reg", -1);
+	priv->phy_of_handle = fdtdec_lookup_phandle(gd->fdt_blob,
+					dev->of_offset, "phy-handle");
+	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)