netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kristoffer Glembo <kristoffer@gaisler.com>
To: netdev@vger.kernel.org
Subject: phy_connect_direct problem
Date: Tue, 27 Oct 2009 11:28:58 +0100	[thread overview]
Message-ID: <4AE6CB6A.5050600@gaisler.com> (raw)

Hi,

I'm in the process of converting an ethernet driver to using the PHY 
layer, but ran into a problem where my adjust_state handler was never 
called and the link did not go up ...

I use phy_connect to connect the PHY device with my ethernet driver. In 
phy_connect_direct I found the following code: 	

phy_prepare_link(phydev, handler);
phy_start_machine(phydev, NULL);

So first the adjust_state is set to handler by phy_prepare_link and then 
it is overwritten with the NULL parameter passed to phy_start_machine.

Maybe I'm abusing the PHY layer somehow since there are plenty of other 
drivers using this interface. However the patch below solved the issue 
for me.

Best regards,
Kristoffer Glembo


---
  drivers/net/phy/phy_device.c |    3 +--
  1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index b10fedd..d27ca80 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -311,8 +311,7 @@ int phy_connect_direct(struct net_device *dev, 
struct phy_device *phydev,
  	if (rc)
  		return rc;

-	phy_prepare_link(phydev, handler);
-	phy_start_machine(phydev, NULL);
+	phy_start_machine(phydev, handler);
  	if (phydev->irq > 0)
  		phy_start_interrupts(phydev);

-- 
1.5.2.2

             reply	other threads:[~2009-10-27 11:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-27 10:28 Kristoffer Glembo [this message]
2009-10-27 13:10 ` phy_connect_direct problem Kristoffer Glembo

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=4AE6CB6A.5050600@gaisler.com \
    --to=kristoffer@gaisler.com \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).