* [U-Boot] [PATCH 1/3] net: xilinx: Handle error value from phy_startup()
@ 2016-05-18 11:20 Michal Simek
2016-05-18 11:20 ` [U-Boot] [PATCH 2/3] phy: Return correct error code when timeout happens Michal Simek
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Michal Simek @ 2016-05-18 11:20 UTC (permalink / raw)
To: u-boot
Handle error returned by phy_startup() properly.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
drivers/net/xilinx_emaclite.c | 4 +++-
drivers/net/zynq_gem.c | 5 ++++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
index 5862bf0a7e2d..badb99d67c61 100644
--- a/drivers/net/xilinx_emaclite.c
+++ b/drivers/net/xilinx_emaclite.c
@@ -302,7 +302,9 @@ static int setup_phy(struct udevice *dev)
phydev->advertising = supported;
emaclite->phydev = phydev;
phy_config(phydev);
- phy_startup(phydev);
+ ret = phy_startup(phydev);
+ if (ret)
+ return ret;
if (!phydev->link) {
printf("%s: No link.\n", phydev->dev->name);
diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
index aec8077f10b3..3704ce0dd78a 100644
--- a/drivers/net/zynq_gem.c
+++ b/drivers/net/zynq_gem.c
@@ -360,6 +360,7 @@ static int zynq_phy_init(struct udevice *dev)
static int zynq_gem_init(struct udevice *dev)
{
u32 i, nwconfig;
+ int ret;
unsigned long clk_rate = 0;
struct zynq_gem_priv *priv = dev_get_priv(dev);
struct zynq_gem_regs *regs = priv->iobase;
@@ -427,7 +428,9 @@ static int zynq_gem_init(struct udevice *dev)
priv->init++;
}
- phy_startup(priv->phydev);
+ ret = phy_startup(priv->phydev);
+ if (ret)
+ return ret;
if (!priv->phydev->link) {
printf("%s: No link.\n", priv->phydev->dev->name);
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 2/3] phy: Return correct error code when timeout happens
2016-05-18 11:20 [U-Boot] [PATCH 1/3] net: xilinx: Handle error value from phy_startup() Michal Simek
@ 2016-05-18 11:20 ` Michal Simek
2016-05-24 15:32 ` Joe Hershberger
2016-05-18 11:20 ` [U-Boot] [PATCH 3/3] net: phy: Handle phy_startup() error codes properly Michal Simek
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Michal Simek @ 2016-05-18 11:20 UTC (permalink / raw)
To: u-boot
Return -ETIMEDOUT if timeout happens.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
drivers/net/phy/marvell.c | 4 ++--
drivers/net/phy/phy.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index b8b1157a0a4a..d24451be0a2d 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -103,7 +103,7 @@ static int m88e1011s_config(struct phy_device *phydev)
/* Parse the 88E1011's status register for speed and duplex
* information
*/
-static uint m88e1xxx_parse_status(struct phy_device *phydev)
+static int m88e1xxx_parse_status(struct phy_device *phydev)
{
unsigned int speed;
unsigned int mii_reg;
@@ -120,7 +120,7 @@ static uint m88e1xxx_parse_status(struct phy_device *phydev)
if (i > PHY_AUTONEGOTIATE_TIMEOUT) {
puts(" TIMEOUT !\n");
phydev->link = 0;
- break;
+ return -ETIMEDOUT;
}
if ((i++ % 1000) == 0)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 23c82bb36e93..68e752e09315 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -248,7 +248,7 @@ int genphy_update_link(struct phy_device *phydev)
if (i > PHY_ANEG_TIMEOUT) {
printf(" TIMEOUT !\n");
phydev->link = 0;
- return 0;
+ return -ETIMEDOUT;
}
if (ctrlc()) {
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 3/3] net: phy: Handle phy_startup() error codes properly
2016-05-18 11:20 [U-Boot] [PATCH 1/3] net: xilinx: Handle error value from phy_startup() Michal Simek
2016-05-18 11:20 ` [U-Boot] [PATCH 2/3] phy: Return correct error code when timeout happens Michal Simek
@ 2016-05-18 11:20 ` Michal Simek
2016-05-24 15:33 ` Joe Hershberger
2016-05-18 16:23 ` [U-Boot] [PATCH 1/3] net: xilinx: Handle error value from phy_startup() Stephen Warren
2016-05-24 15:37 ` Joe Hershberger
3 siblings, 1 reply; 7+ messages in thread
From: Michal Simek @ 2016-05-18 11:20 UTC (permalink / raw)
To: u-boot
Propagate error code from genphy_update_link() to phy startup().
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
drivers/net/phy/broadcom.c | 34 ++++++++++++++++++++++------------
drivers/net/phy/davicom.c | 9 ++++++---
drivers/net/phy/et1011c.c | 10 +++++++---
drivers/net/phy/lxt.c | 9 ++++++---
drivers/net/phy/marvell.c | 29 +++++++++++++++++++----------
drivers/net/phy/micrel.c | 7 ++++++-
drivers/net/phy/natsemi.c | 18 ++++++++++++------
drivers/net/phy/phy.c | 9 ++++++---
drivers/net/phy/realtek.c | 28 +++++++++++++++++++---------
drivers/net/phy/smsc.c | 10 +++++++---
drivers/net/phy/vitesse.c | 8 +++++---
11 files changed, 115 insertions(+), 56 deletions(-)
diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index 4b2808eff00f..9871cc3edd7c 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -84,11 +84,14 @@ static int bcm54xx_parse_status(struct phy_device *phydev)
static int bcm54xx_startup(struct phy_device *phydev)
{
+ int ret;
+
/* Read the Status (2x to make sure link is right) */
- genphy_update_link(phydev);
- bcm54xx_parse_status(phydev);
+ ret = genphy_update_link(phydev);
+ if (ret)
+ return ret;
- return 0;
+ return bcm54xx_parse_status(phydev);
}
/* Broadcom BCM5482S */
@@ -139,11 +142,14 @@ static int bcm5482_config(struct phy_device *phydev)
static int bcm_cygnus_startup(struct phy_device *phydev)
{
+ int ret;
+
/* Read the Status (2x to make sure link is right) */
- genphy_update_link(phydev);
- genphy_parse_link(phydev);
+ ret = genphy_update_link(phydev);
+ if (ret)
+ return ret;
- return 0;
+ return genphy_parse_link(phydev);
}
static int bcm_cygnus_config(struct phy_device *phydev)
@@ -239,17 +245,21 @@ static u32 bcm5482_parse_serdes_sr(struct phy_device *phydev)
*/
static int bcm5482_startup(struct phy_device *phydev)
{
+ int ret;
+
if (bcm5482_is_serdes(phydev)) {
bcm5482_parse_serdes_sr(phydev);
phydev->port = PORT_FIBRE;
- } else {
- /* Wait for auto-negotiation to complete or fail */
- genphy_update_link(phydev);
- /* Parse BCM54xx copper aux status register */
- bcm54xx_parse_status(phydev);
+ return 0;
}
- return 0;
+ /* Wait for auto-negotiation to complete or fail */
+ ret = genphy_update_link(phydev);
+ if (ret)
+ return ret;
+
+ /* Parse BCM54xx copper aux status register */
+ return bcm54xx_parse_status(phydev);
}
static struct phy_driver BCM5461S_driver = {
diff --git a/drivers/net/phy/davicom.c b/drivers/net/phy/davicom.c
index 0c039fe79ff1..0a6e4107ba5d 100644
--- a/drivers/net/phy/davicom.c
+++ b/drivers/net/phy/davicom.c
@@ -60,10 +60,13 @@ static int dm9161_parse_status(struct phy_device *phydev)
static int dm9161_startup(struct phy_device *phydev)
{
- genphy_update_link(phydev);
- dm9161_parse_status(phydev);
+ int ret;
- return 0;
+ ret = genphy_update_link(phydev);
+ if (ret)
+ return ret;
+
+ return dm9161_parse_status(phydev);
}
static struct phy_driver DM9161_driver = {
diff --git a/drivers/net/phy/et1011c.c b/drivers/net/phy/et1011c.c
index 70c15e2f20c9..2fe01327faae 100644
--- a/drivers/net/phy/et1011c.c
+++ b/drivers/net/phy/et1011c.c
@@ -79,9 +79,13 @@ static int et1011c_parse_status(struct phy_device *phydev)
static int et1011c_startup(struct phy_device *phydev)
{
- genphy_update_link(phydev);
- et1011c_parse_status(phydev);
- return 0;
+ int ret;
+
+ ret = genphy_update_link(phydev);
+ if (ret)
+ return ret;
+
+ return et1011c_parse_status(phydev);
}
static struct phy_driver et1011c_driver = {
diff --git a/drivers/net/phy/lxt.c b/drivers/net/phy/lxt.c
index 91838ce5ea17..9abc2a84f9f6 100644
--- a/drivers/net/phy/lxt.c
+++ b/drivers/net/phy/lxt.c
@@ -49,10 +49,13 @@ static int lxt971_parse_status(struct phy_device *phydev)
static int lxt971_startup(struct phy_device *phydev)
{
- genphy_update_link(phydev);
- lxt971_parse_status(phydev);
+ int ret;
- return 0;
+ ret = genphy_update_link(phydev);
+ if (ret)
+ return ret;
+
+ return lxt971_parse_status(phydev);
}
static struct phy_driver LXT971_driver = {
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index d24451be0a2d..64713fbaebf4 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -162,10 +162,13 @@ static int m88e1xxx_parse_status(struct phy_device *phydev)
static int m88e1011s_startup(struct phy_device *phydev)
{
- genphy_update_link(phydev);
- m88e1xxx_parse_status(phydev);
+ int ret;
- return 0;
+ ret = genphy_update_link(phydev);
+ if (ret)
+ return ret;
+
+ return m88e1xxx_parse_status(phydev);
}
/* Marvell 88E1111S */
@@ -358,13 +361,16 @@ static int m88e1118_config(struct phy_device *phydev)
static int m88e1118_startup(struct phy_device *phydev)
{
+ int ret;
+
/* Change Page Number */
phy_write(phydev, MDIO_DEVAD_NONE, MIIM_88E1118_PHY_PAGE, 0x0000);
- genphy_update_link(phydev);
- m88e1xxx_parse_status(phydev);
+ ret = genphy_update_link(phydev);
+ if (ret)
+ return ret;
- return 0;
+ return m88e1xxx_parse_status(phydev);
}
/* Marvell 88E1121R */
@@ -421,12 +427,15 @@ static int m88e1145_config(struct phy_device *phydev)
static int m88e1145_startup(struct phy_device *phydev)
{
- genphy_update_link(phydev);
+ int ret;
+
+ ret = genphy_update_link(phydev);
+ if (ret)
+ return ret;
+
phy_write(phydev, MDIO_DEVAD_NONE, MIIM_88E1145_PHY_LED_CONTROL,
MIIM_88E1145_PHY_LED_DIRECT);
- m88e1xxx_parse_status(phydev);
-
- return 0;
+ return m88e1xxx_parse_status(phydev);
}
/* Marvell 88E1149S */
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 8fcf737cb8fa..b08788a2b051 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -181,7 +181,12 @@ static struct phy_driver KS8721_driver = {
static int ksz90xx_startup(struct phy_device *phydev)
{
unsigned phy_ctl;
- genphy_update_link(phydev);
+ int ret;
+
+ ret = genphy_update_link(phydev);
+ if (ret)
+ return ret;
+
phy_ctl = phy_read(phydev, MDIO_DEVAD_NONE, MII_KSZ90xx_PHY_CTL);
if (phy_ctl & MIIM_KSZ90xx_PHYCTL_DUPLEX)
diff --git a/drivers/net/phy/natsemi.c b/drivers/net/phy/natsemi.c
index d2e4c3c487e3..1592e9b7b975 100644
--- a/drivers/net/phy/natsemi.c
+++ b/drivers/net/phy/natsemi.c
@@ -93,10 +93,13 @@ static int dp83865_parse_status(struct phy_device *phydev)
static int dp83865_startup(struct phy_device *phydev)
{
- genphy_update_link(phydev);
- dp83865_parse_status(phydev);
+ int ret;
- return 0;
+ ret = genphy_update_link(phydev);
+ if (ret)
+ return ret;
+
+ return dp83865_parse_status(phydev);
}
@@ -134,10 +137,13 @@ static int dp83848_parse_status(struct phy_device *phydev)
static int dp83848_startup(struct phy_device *phydev)
{
- genphy_update_link(phydev);
- dp83848_parse_status(phydev);
+ int ret;
- return 0;
+ ret = genphy_update_link(phydev);
+ if (ret)
+ return ret;
+
+ return dp83848_parse_status(phydev);
}
static struct phy_driver DP83848_driver = {
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 68e752e09315..98986bb6f13f 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -431,10 +431,13 @@ int genphy_config(struct phy_device *phydev)
int genphy_startup(struct phy_device *phydev)
{
- genphy_update_link(phydev);
- genphy_parse_link(phydev);
+ int ret;
- return 0;
+ ret = genphy_update_link(phydev);
+ if (ret)
+ return ret;
+
+ return genphy_parse_link(phydev);
}
int genphy_shutdown(struct phy_device *phydev)
diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
index 9d7f55bdae07..7a99cb023401 100644
--- a/drivers/net/phy/realtek.c
+++ b/drivers/net/phy/realtek.c
@@ -208,28 +208,38 @@ static int rtl8211f_parse_status(struct phy_device *phydev)
static int rtl8211x_startup(struct phy_device *phydev)
{
+ int ret;
+
/* Read the Status (2x to make sure link is right) */
- genphy_update_link(phydev);
- rtl8211x_parse_status(phydev);
+ ret = genphy_update_link(phydev);
+ if (ret)
+ return ret;
- return 0;
+ return rtl8211x_parse_status(phydev);
}
static int rtl8211e_startup(struct phy_device *phydev)
{
- genphy_update_link(phydev);
- genphy_parse_link(phydev);
+ int ret;
- return 0;
+ ret = genphy_update_link(phydev);
+ if (ret)
+ return ret;
+
+ return genphy_parse_link(phydev);
}
static int rtl8211f_startup(struct phy_device *phydev)
{
+ int ret;
+
+ /* Read the Status (2x to make sure link is right) */
+ ret = genphy_update_link(phydev);
+ if (ret)
+ return ret;
/* Read the Status (2x to make sure link is right) */
- genphy_update_link(phydev);
- rtl8211f_parse_status(phydev);
- return 0;
+ return rtl8211f_parse_status(phydev);
}
/* Support for RTL8211B PHY */
diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c
index 34986a29fc3f..313fcdfdc52d 100644
--- a/drivers/net/phy/smsc.c
+++ b/drivers/net/phy/smsc.c
@@ -34,9 +34,13 @@ static int smsc_parse_status(struct phy_device *phydev)
static int smsc_startup(struct phy_device *phydev)
{
- genphy_update_link(phydev);
- smsc_parse_status(phydev);
- return 0;
+ int ret;
+
+ ret = genphy_update_link(phydev);
+ if (ret)
+ return ret;
+
+ return smsc_parse_status(phydev);
}
static struct phy_driver lan8700_driver = {
diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c
index 941d0760b57f..2635b821e967 100644
--- a/drivers/net/phy/vitesse.c
+++ b/drivers/net/phy/vitesse.c
@@ -112,10 +112,12 @@ static int vitesse_parse_status(struct phy_device *phydev)
static int vitesse_startup(struct phy_device *phydev)
{
- genphy_update_link(phydev);
- vitesse_parse_status(phydev);
+ int ret;
- return 0;
+ ret = genphy_update_link(phydev);
+ if (ret)
+ return ret;
+ return vitesse_parse_status(phydev);
}
static int cis8204_config(struct phy_device *phydev)
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 1/3] net: xilinx: Handle error value from phy_startup()
2016-05-18 11:20 [U-Boot] [PATCH 1/3] net: xilinx: Handle error value from phy_startup() Michal Simek
2016-05-18 11:20 ` [U-Boot] [PATCH 2/3] phy: Return correct error code when timeout happens Michal Simek
2016-05-18 11:20 ` [U-Boot] [PATCH 3/3] net: phy: Handle phy_startup() error codes properly Michal Simek
@ 2016-05-18 16:23 ` Stephen Warren
2016-05-24 15:37 ` Joe Hershberger
3 siblings, 0 replies; 7+ messages in thread
From: Stephen Warren @ 2016-05-18 16:23 UTC (permalink / raw)
To: u-boot
On 05/18/2016 05:20 AM, Michal Simek wrote:
> Handle error returned by phy_startup() properly.
The series,
Acked-by: Stephen Warren <swarren@nvidia.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 2/3] phy: Return correct error code when timeout happens
2016-05-18 11:20 ` [U-Boot] [PATCH 2/3] phy: Return correct error code when timeout happens Michal Simek
@ 2016-05-24 15:32 ` Joe Hershberger
0 siblings, 0 replies; 7+ messages in thread
From: Joe Hershberger @ 2016-05-24 15:32 UTC (permalink / raw)
To: u-boot
On Wed, May 18, 2016 at 6:20 AM, Michal Simek <michal.simek@xilinx.com> wrote:
> Return -ETIMEDOUT if timeout happens.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 3/3] net: phy: Handle phy_startup() error codes properly
2016-05-18 11:20 ` [U-Boot] [PATCH 3/3] net: phy: Handle phy_startup() error codes properly Michal Simek
@ 2016-05-24 15:33 ` Joe Hershberger
0 siblings, 0 replies; 7+ messages in thread
From: Joe Hershberger @ 2016-05-24 15:33 UTC (permalink / raw)
To: u-boot
On Wed, May 18, 2016 at 6:20 AM, Michal Simek <michal.simek@xilinx.com> wrote:
> Propagate error code from genphy_update_link() to phy startup().
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Thanks!!
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 1/3] net: xilinx: Handle error value from phy_startup()
2016-05-18 11:20 [U-Boot] [PATCH 1/3] net: xilinx: Handle error value from phy_startup() Michal Simek
` (2 preceding siblings ...)
2016-05-18 16:23 ` [U-Boot] [PATCH 1/3] net: xilinx: Handle error value from phy_startup() Stephen Warren
@ 2016-05-24 15:37 ` Joe Hershberger
3 siblings, 0 replies; 7+ messages in thread
From: Joe Hershberger @ 2016-05-24 15:37 UTC (permalink / raw)
To: u-boot
On Wed, May 18, 2016 at 6:20 AM, Michal Simek <michal.simek@xilinx.com> wrote:
> Handle error returned by phy_startup() properly.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-05-24 15:37 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-18 11:20 [U-Boot] [PATCH 1/3] net: xilinx: Handle error value from phy_startup() Michal Simek
2016-05-18 11:20 ` [U-Boot] [PATCH 2/3] phy: Return correct error code when timeout happens Michal Simek
2016-05-24 15:32 ` Joe Hershberger
2016-05-18 11:20 ` [U-Boot] [PATCH 3/3] net: phy: Handle phy_startup() error codes properly Michal Simek
2016-05-24 15:33 ` Joe Hershberger
2016-05-18 16:23 ` [U-Boot] [PATCH 1/3] net: xilinx: Handle error value from phy_startup() Stephen Warren
2016-05-24 15:37 ` Joe Hershberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox