Re: [U-Boot] [PATCH] net: fec_mxc: fix PHY initialization bug with CONFIG_DM_ETH

2017-06-29 Thread Stefano Babic
On 27/06/2017 15:23, Lothar Waßmann wrote:
> When CONFIG_DM_ETH is set, the FEC ethernet controller is reset after
> the PHY has been set up and initialzed. This breaks the communication
> with the PHY and results in an inoperable ethernet interface.
> 
> Do the initialization with CONFIG_DM_ETH in the same order as with
> legacy ETH support to fix this.
> 
> Signed-off-by: Lothar Waßmann 
> ---
>  drivers/net/fec_mxc.c | 24 +---
>  1 file changed, 13 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
> index 910879b..f61268c 100644
> --- a/drivers/net/fec_mxc.c
> +++ b/drivers/net/fec_mxc.c
> @@ -1216,17 +1216,6 @@ static int fecmxc_probe(struct udevice *dev)
>   if (ret)
>   return ret;
>  
> - bus = fec_get_miibus((uint32_t)priv->eth, dev_id);
> - if (!bus)
> - goto err_mii;
> -
> - priv->bus = bus;
> - priv->xcv_type = CONFIG_FEC_XCV_TYPE;
> - priv->interface = pdata->phy_interface;
> - ret = fec_phy_init(priv, dev);
> - if (ret)
> - goto err_phy;
> -
>   /* Reset chip. */
>   writel(readl(>eth->ecntrl) | FEC_ECNTRL_RESET,
>  >eth->ecntrl);
> @@ -1242,6 +1231,19 @@ static int fecmxc_probe(struct udevice *dev)
>   fec_reg_setup(priv);
>   priv->dev_id = (dev_id == -1) ? 0 : dev_id;
>  
> + bus = fec_get_miibus(dev, dev_id);
> + if (!bus) {
> + ret = -ENOMEM;
> + goto err_mii;
> + }
> +
> + priv->bus = bus;
> + priv->xcv_type = CONFIG_FEC_XCV_TYPE;
> + priv->interface = pdata->phy_interface;
> + ret = fec_phy_init(priv, dev);
> + if (ret)
> + goto err_phy;
> +
>   return 0;
>  
>  err_timeout:
> 

Applied to u-boot-imx, -next, thanks !

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] net: fec_mxc: fix PHY initialization bug with CONFIG_DM_ETH

2017-06-27 Thread Joe Hershberger
On Tue, Jun 27, 2017 at 8:23 AM, Lothar Waßmann  
wrote:
> When CONFIG_DM_ETH is set, the FEC ethernet controller is reset after
> the PHY has been set up and initialzed. This breaks the communication
> with the PHY and results in an inoperable ethernet interface.
>
> Do the initialization with CONFIG_DM_ETH in the same order as with
> legacy ETH support to fix this.
>
> Signed-off-by: Lothar Waßmann 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] net: fec_mxc: fix PHY initialization bug with CONFIG_DM_ETH

2017-06-27 Thread Lothar Waßmann
When CONFIG_DM_ETH is set, the FEC ethernet controller is reset after
the PHY has been set up and initialzed. This breaks the communication
with the PHY and results in an inoperable ethernet interface.

Do the initialization with CONFIG_DM_ETH in the same order as with
legacy ETH support to fix this.

Signed-off-by: Lothar Waßmann 
---
 drivers/net/fec_mxc.c | 24 +---
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 910879b..f61268c 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -1216,17 +1216,6 @@ static int fecmxc_probe(struct udevice *dev)
if (ret)
return ret;
 
-   bus = fec_get_miibus((uint32_t)priv->eth, dev_id);
-   if (!bus)
-   goto err_mii;
-
-   priv->bus = bus;
-   priv->xcv_type = CONFIG_FEC_XCV_TYPE;
-   priv->interface = pdata->phy_interface;
-   ret = fec_phy_init(priv, dev);
-   if (ret)
-   goto err_phy;
-
/* Reset chip. */
writel(readl(>eth->ecntrl) | FEC_ECNTRL_RESET,
   >eth->ecntrl);
@@ -1242,6 +1231,19 @@ static int fecmxc_probe(struct udevice *dev)
fec_reg_setup(priv);
priv->dev_id = (dev_id == -1) ? 0 : dev_id;
 
+   bus = fec_get_miibus(dev, dev_id);
+   if (!bus) {
+   ret = -ENOMEM;
+   goto err_mii;
+   }
+
+   priv->bus = bus;
+   priv->xcv_type = CONFIG_FEC_XCV_TYPE;
+   priv->interface = pdata->phy_interface;
+   ret = fec_phy_init(priv, dev);
+   if (ret)
+   goto err_phy;
+
return 0;
 
 err_timeout:
-- 
2.1.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot