All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Simek <michal.simek@xilinx.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 03/14] net: gem: Do not continue if phy is not found
Date: Thu,  3 Dec 2015 15:47:51 +0100	[thread overview]
Message-ID: <b550928802b3401308e9d569f9453cb298d14930.1449154075.git.michal.simek@xilinx.com> (raw)
In-Reply-To: <3846048879467c3510abb54b930cdc05772d469e.1449154075.git.michal.simek@xilinx.com>

Add return value for phy detection algorithm to stop init function when
phy is not found.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

Changes in v3: None
Changes in v2: None

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

diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
index 858093f0d7e2..1a5a366c9444 100644
--- a/drivers/net/zynq_gem.c
+++ b/drivers/net/zynq_gem.c
@@ -241,7 +241,7 @@ static u32 phywrite(struct eth_device *dev, u32 phy_addr, u32 regnum, u16 data)
 				ZYNQ_GEM_PHYMNTNC_OP_W_MASK, &data);
 }
 
-static void phy_detection(struct eth_device *dev)
+static int phy_detection(struct eth_device *dev)
 {
 	int i;
 	u16 phyreg;
@@ -254,7 +254,7 @@ static void phy_detection(struct eth_device *dev)
 			/* Found a valid PHY address */
 			debug("Default phy address %d is valid\n",
 			      priv->phyaddr);
-			return;
+			return 0;
 		} else {
 			debug("PHY address is not setup correctly %d\n",
 			      priv->phyaddr);
@@ -272,11 +272,12 @@ static void phy_detection(struct eth_device *dev)
 				/* Found a valid PHY address */
 				priv->phyaddr = i;
 				debug("Found valid phy address, %d\n", i);
-				return;
+				return 0;
 			}
 		}
 	}
 	printf("PHY is not detected\n");
+	return -1;
 }
 
 static int zynq_gem_setup_mac(struct eth_device *dev)
@@ -310,6 +311,7 @@ static int zynq_gem_setup_mac(struct eth_device *dev)
 static int zynq_gem_init(struct eth_device *dev, bd_t * bis)
 {
 	u32 i;
+	int ret;
 	unsigned long clk_rate = 0;
 	struct phy_device *phydev;
 	struct zynq_gem_regs *regs = (struct zynq_gem_regs *)dev->iobase;
@@ -384,7 +386,11 @@ static int zynq_gem_init(struct eth_device *dev, bd_t * bis)
 		priv->init++;
 	}
 
-	phy_detection(dev);
+	ret = phy_detection(dev);
+	if (ret) {
+		printf("GEM PHY init failed\n");
+		return ret;
+	}
 
 	/* interface - look at tsec */
 	phydev = phy_connect(priv->bus, priv->phyaddr, dev,
-- 
1.9.1

  parent reply	other threads:[~2015-12-03 14:47 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-03 14:47 [U-Boot] [PATCH v3 01/14] ARM: zynq: Remove PHYLIB from config to defconfig Michal Simek
2015-12-03 14:47 ` [U-Boot] [PATCH v3 02/14] ARM: zynq: Remove CONFIG_API Michal Simek
2015-12-03 16:09   ` Jagan Teki
2015-12-03 17:57     ` Jeroen Hofstee
2015-12-04  8:20       ` Michal Simek
2015-12-04  8:33         ` Jagan Teki
2015-12-04  7:47     ` Michal Simek
2015-12-03 14:47 ` Michal Simek [this message]
2015-12-03 16:23   ` [U-Boot] [PATCH v3 03/14] net: gem: Do not continue if phy is not found Jagan Teki
2015-12-03 14:47 ` [U-Boot] [PATCH v3 04/14] net: gem: Change mdio_wait prototype to pass regs Michal Simek
2015-12-03 14:47 ` [U-Boot] [PATCH v3 05/14] net: gem: Change mii function not to use eth_device structure Michal Simek
2015-12-03 14:47 ` [U-Boot] [PATCH v3 06/14] net: gem: Remove phydev variable Michal Simek
2015-12-03 14:47 ` [U-Boot] [PATCH v3 07/14] net: gem: Extract phy init code Michal Simek
2015-12-03 14:47 ` [U-Boot] [PATCH v3 08/14] net: gem: Check if priv->phydev is valid Michal Simek
2015-12-03 16:24   ` Jagan Teki
2015-12-03 14:47 ` [U-Boot] [PATCH v3 09/14] net: gem: Enable MDIO bus earlier Michal Simek
2015-12-03 14:47 ` [U-Boot] [PATCH v3 10/14] net: gem: Remove zynq_gem_of_init() Michal Simek
2015-12-03 16:24   ` Jagan Teki
2015-12-03 14:47 ` [U-Boot] [PATCH v3 11/14] net: gem: Fix miiphy_read name Michal Simek
2015-12-03 16:25   ` Jagan Teki
2015-12-03 14:48 ` [U-Boot] [PATCH v3 12/14] net: gem: Move driver to DM Michal Simek
2015-12-03 16:16   ` Jagan Teki
2015-12-03 18:57   ` Simon Glass
2015-12-03 19:00     ` Joe Hershberger
2015-12-03 19:04       ` Simon Glass
2015-12-04  6:24   ` Bin Meng
2015-12-03 14:48 ` [U-Boot] [PATCH v3 13/14] net: gem: Read information about interface from DT Michal Simek
2015-12-03 16:21   ` Jagan Teki
2015-12-03 14:48 ` [U-Boot] [PATCH v3 14/14] net: gem: Move gem to Kconfig Michal Simek
2015-12-03 16:19   ` Jagan Teki
2015-12-03 16:11 ` [U-Boot] [PATCH v3 01/14] ARM: zynq: Remove PHYLIB from config to defconfig Jagan Teki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b550928802b3401308e9d569f9453cb298d14930.1449154075.git.michal.simek@xilinx.com \
    --to=michal.simek@xilinx.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.