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 09/14] net: gem: Enable MDIO bus earlier
Date: Thu,  3 Dec 2015 15:47:57 +0100	[thread overview]
Message-ID: <8f8635752e008171c83b5c90e5fe5f227647c9e9.1449154075.git.michal.simek@xilinx.com> (raw)
In-Reply-To: <3846048879467c3510abb54b930cdc05772d469e.1449154075.git.michal.simek@xilinx.com>

Enable access to MDIO before zynq_gem_init is called.
It enables read information about phy earlier.

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, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
index d5540ec2155c..9ce1221e8d0f 100644
--- a/drivers/net/zynq_gem.c
+++ b/drivers/net/zynq_gem.c
@@ -314,6 +314,7 @@ static int zynq_phy_init(struct eth_device *dev)
 {
 	int ret;
 	struct zynq_gem_priv *priv = dev->priv;
+	struct zynq_gem_regs *regs = (struct zynq_gem_regs *)dev->iobase;
 	const u32 supported = SUPPORTED_10baseT_Half |
 			SUPPORTED_10baseT_Full |
 			SUPPORTED_100baseT_Half |
@@ -321,6 +322,9 @@ static int zynq_phy_init(struct eth_device *dev)
 			SUPPORTED_1000baseT_Half |
 			SUPPORTED_1000baseT_Full;
 
+	/* Enable only MDIO bus */
+	writel(ZYNQ_GEM_NWCTRL_MDEN_MASK, &regs->nwctrl);
+
 	ret = phy_detection(dev);
 	if (ret) {
 		printf("GEM PHY init failed\n");
@@ -343,7 +347,6 @@ static int zynq_phy_init(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 zynq_gem_regs *regs = (struct zynq_gem_regs *)dev->iobase;
 	struct zynq_gem_priv *priv = dev->priv;
@@ -411,10 +414,6 @@ static int zynq_gem_init(struct eth_device *dev, bd_t *bis)
 		priv->init++;
 	}
 
-	ret = zynq_phy_init(dev);
-	if (ret)
-		return ret;
-
 	phy_startup(priv->phydev);
 
 	if (!priv->phydev->link) {
@@ -597,6 +596,7 @@ static int zynq_gem_miiphy_write(const char *devname, uchar addr,
 int zynq_gem_initialize(bd_t *bis, phys_addr_t base_addr,
 			int phy_addr, u32 emio)
 {
+	int ret;
 	struct eth_device *dev;
 	struct zynq_gem_priv *priv;
 	void *bd_space;
@@ -650,6 +650,10 @@ int zynq_gem_initialize(bd_t *bis, phys_addr_t base_addr,
 	miiphy_register(dev->name, zynq_gem_miiphyread, zynq_gem_miiphy_write);
 	priv->bus = miiphy_get_dev_by_name(dev->name);
 
+	ret = zynq_phy_init(dev);
+	if (ret)
+		return ret;
+
 	return 1;
 }
 
-- 
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 ` [U-Boot] [PATCH v3 03/14] net: gem: Do not continue if phy is not found Michal Simek
2015-12-03 16:23   ` 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 ` Michal Simek [this message]
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=8f8635752e008171c83b5c90e5fe5f227647c9e9.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.