mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/1] phy: fix force mode
@ 2013-02-24  9:34 Jean-Christophe PLAGNIOL-VILLARD
  2013-02-25  7:55 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-24  9:34 UTC (permalink / raw)
  To: barebox

do not try to read the status in force mode
the link is up

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 drivers/net/phy/mdio_bus.c |    4 ++++
 drivers/net/phy/phy.c      |    4 ++++
 include/linux/phy.h        |    1 +
 3 files changed, 9 insertions(+)

diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index d1d802b..e1bb7b1 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -167,10 +167,14 @@ static int mdio_bus_probe(struct device_d *_dev)
 			dev->speed = SPEED_10;
 			dev->duplex = DUPLEX_FULL;
 			dev->autoneg = !AUTONEG_ENABLE;
+			dev->force = 1;
+			dev->link = 1;
 		} else if (dev->dev_flags & PHYLIB_FORCE_100) {
 			dev->speed = SPEED_100;
 			dev->duplex = DUPLEX_FULL;
 			dev->autoneg = !AUTONEG_ENABLE;
+			dev->force = 1;
+			dev->link = 1;
 		}
 	}
 
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 1cf2cb9..12739ff 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -549,6 +549,10 @@ int genphy_read_status(struct phy_device *phydev)
 	int lpa;
 	int lpagb = 0;
 
+	/* if force the status and link are set */
+	if (phydev->force)
+		return 0;
+
 	/* Update the link, but return if there
 	 * was an error */
 	err = genphy_update_link(phydev);
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 6c9cac9..99c9639 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -158,6 +158,7 @@ struct phy_device {
 	u32 advertising;
 
 	int autoneg;
+	int force;
 
 
 	/* private data pointer */
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] phy: fix force mode
  2013-02-24  9:34 [PATCH 1/1] phy: fix force mode Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-25  7:55 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2013-02-25  7:55 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Sun, Feb 24, 2013 at 10:34:12AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> do not try to read the status in force mode
> the link is up
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

Applied, thanks

Sascha

> ---
>  drivers/net/phy/mdio_bus.c |    4 ++++
>  drivers/net/phy/phy.c      |    4 ++++
>  include/linux/phy.h        |    1 +
>  3 files changed, 9 insertions(+)
> 
> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
> index d1d802b..e1bb7b1 100644
> --- a/drivers/net/phy/mdio_bus.c
> +++ b/drivers/net/phy/mdio_bus.c
> @@ -167,10 +167,14 @@ static int mdio_bus_probe(struct device_d *_dev)
>  			dev->speed = SPEED_10;
>  			dev->duplex = DUPLEX_FULL;
>  			dev->autoneg = !AUTONEG_ENABLE;
> +			dev->force = 1;
> +			dev->link = 1;
>  		} else if (dev->dev_flags & PHYLIB_FORCE_100) {
>  			dev->speed = SPEED_100;
>  			dev->duplex = DUPLEX_FULL;
>  			dev->autoneg = !AUTONEG_ENABLE;
> +			dev->force = 1;
> +			dev->link = 1;
>  		}
>  	}
>  
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index 1cf2cb9..12739ff 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -549,6 +549,10 @@ int genphy_read_status(struct phy_device *phydev)
>  	int lpa;
>  	int lpagb = 0;
>  
> +	/* if force the status and link are set */
> +	if (phydev->force)
> +		return 0;
> +
>  	/* Update the link, but return if there
>  	 * was an error */
>  	err = genphy_update_link(phydev);
> diff --git a/include/linux/phy.h b/include/linux/phy.h
> index 6c9cac9..99c9639 100644
> --- a/include/linux/phy.h
> +++ b/include/linux/phy.h
> @@ -158,6 +158,7 @@ struct phy_device {
>  	u32 advertising;
>  
>  	int autoneg;
> +	int force;
>  
>  
>  	/* private data pointer */
> -- 
> 1.7.10.4
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-25  7:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-24  9:34 [PATCH 1/1] phy: fix force mode Jean-Christophe PLAGNIOL-VILLARD
2013-02-25  7:55 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox