Re: [U-Boot] [PATCH v2 3/6] net: mvpp2: mark phy as invalid in case of missing appropriate driver

2019-08-03 Thread Ramon Fried
On Sat, Aug 3, 2019 at 4:56 AM  wrote:
>
> From: Grzegorz Jaszczyk 
>
> If the phy doesn't match with any existing u-boot drivers the phy
> framework will connect it to generic one which uid == 0x. In
> this case act as if the phy wouldn't be declared in dts. Otherwise in
> case of 3310 (for which the driver doesn't exist) the link will be
> marked as always down. Removing phy entry from dts in case of 3310 is
> not good option because it is required for the phy_fw_down procedure.
>
> This patch fixes the issue with the link always down on MCBIN board.
>
> Signed-off-by: Grzegorz Jaszczyk 
> Reviewed-on: http://vgitil04.il.marvell.com:8080/58907
This should be pushed to mailing list.
> Reviewed-by: Igal Liberman 
> Tested-by: Igal Liberman 
> ---
>  drivers/net/mvpp2.c | 21 +
>  1 file changed, 21 insertions(+)
>
> diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c
> index b6dfed5c54..fae7090121 100644
> --- a/drivers/net/mvpp2.c
> +++ b/drivers/net/mvpp2.c
> @@ -4484,6 +4484,27 @@ static void mvpp2_phy_connect(struct udevice *dev, 
> struct mvpp2_port *port)
> if (!port->init || port->link == 0) {
> phy_dev = phy_connect(port->bus, port->phyaddr, dev,
>   port->phy_interface);
> +
> +   /* If the phy doesn't match with any existing u-boot drivers 
> the
> +* phy framework will connect it to generic one which
> +* uid == 0x. In this case act as if the phy wouldn't 
> be
> +* declared in dts. Otherwise in case of 3310 (for which the
> +* driver doesn't exist) the link will not be correctly
> +* detected. Removing phy entry from dts in case of 3310 is 
> not
> +* an option because it is required for the phy_fw_down
> +* procedure.
> +*/
> +   if (phy_dev->drv->uid == 0x) {/* Generic phy */
> +   netdev_warn(port->dev,
> +   "Marking phy as invalid, link will not be 
> checked\n");
> +   /* set phy_addr to invalid value */
> +   port->phyaddr = PHY_MAX_ADDR;
> +   mvpp2_egress_enable(port);
> +   mvpp2_ingress_enable(port);
> +
> +   return;
> +   }
> +
> port->phy_dev = phy_dev;
> if (!phy_dev) {
> netdev_err(port->dev, "cannot connect to phy\n");
> --
> 2.21.0
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
Please remove the Reviewed-On line, besides,
Reviewed-By: Ramon Fried 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 3/6] net: mvpp2: mark phy as invalid in case of missing appropriate driver

2019-08-02 Thread nhed+uboot
From: Grzegorz Jaszczyk 

If the phy doesn't match with any existing u-boot drivers the phy
framework will connect it to generic one which uid == 0x. In
this case act as if the phy wouldn't be declared in dts. Otherwise in
case of 3310 (for which the driver doesn't exist) the link will be
marked as always down. Removing phy entry from dts in case of 3310 is
not good option because it is required for the phy_fw_down procedure.

This patch fixes the issue with the link always down on MCBIN board.

Signed-off-by: Grzegorz Jaszczyk 
Reviewed-on: http://vgitil04.il.marvell.com:8080/58907
Reviewed-by: Igal Liberman 
Tested-by: Igal Liberman 
---
 drivers/net/mvpp2.c | 21 +
 1 file changed, 21 insertions(+)

diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c
index b6dfed5c54..fae7090121 100644
--- a/drivers/net/mvpp2.c
+++ b/drivers/net/mvpp2.c
@@ -4484,6 +4484,27 @@ static void mvpp2_phy_connect(struct udevice *dev, 
struct mvpp2_port *port)
if (!port->init || port->link == 0) {
phy_dev = phy_connect(port->bus, port->phyaddr, dev,
  port->phy_interface);
+
+   /* If the phy doesn't match with any existing u-boot drivers the
+* phy framework will connect it to generic one which
+* uid == 0x. In this case act as if the phy wouldn't be
+* declared in dts. Otherwise in case of 3310 (for which the
+* driver doesn't exist) the link will not be correctly
+* detected. Removing phy entry from dts in case of 3310 is not
+* an option because it is required for the phy_fw_down
+* procedure.
+*/
+   if (phy_dev->drv->uid == 0x) {/* Generic phy */
+   netdev_warn(port->dev,
+   "Marking phy as invalid, link will not be 
checked\n");
+   /* set phy_addr to invalid value */
+   port->phyaddr = PHY_MAX_ADDR;
+   mvpp2_egress_enable(port);
+   mvpp2_ingress_enable(port);
+
+   return;
+   }
+
port->phy_dev = phy_dev;
if (!phy_dev) {
netdev_err(port->dev, "cannot connect to phy\n");
-- 
2.21.0

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