mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/2] phy: add smsc phy driver support
Date: Sat, 8 Dec 2012 16:05:42 +0100	[thread overview]
Message-ID: <20121208150542.GN24458@pengutronix.de> (raw)
In-Reply-To: <1352971904-12409-2-git-send-email-plagnioj@jcrosoft.com>

On Thu, Nov 15, 2012 at 10:31:44AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> as we to have specific phy init to fix chip issue link detection support

This patch was introduced to make the LAN8720 work with phylib. When
appplying this patch I believed that...

> +
> +static int lan87xx_config_init(struct phy_device *phydev)
> +{
> +	/*
> +	 * Make sure the EDPWRDOWN bit is NOT set. Setting this bit on
> +	 * LAN8710/LAN8720 PHY causes the PHY to misbehave, likely due
> +	 * to a bug on the chip.
> +	 *
> +	 * When the system is powered on with the network cable being
> +	 * disconnected all the way until after ifconfig ethX up is
> +	 * issued for the LAN port with this PHY, connecting the cable
> +	 * afterwards does not cause LINK change detection, while the
> +	 * expected behavior is the Link UP being detected.
> +	 */
> +	int rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS);
> +	if (rc < 0)
> +		return rc;
> +
> +	rc &= ~MII_LAN83C185_EDPWRDOWN;
> +
> +	rc = phy_write(phydev, MII_LAN83C185_CTRL_STATUS, rc);
> +	if (rc < 0)
> +		return rc;

... this change was responsible to let the phy driver correctly wait for
a link. As it just turned out, this change os totally irrelevant. The
change which makes this driver work is...

> +}, {
> +	.phy_id		= 0x0007c0f0, /* OUI=0x00800f, Model#=0x0f */
> +	.phy_id_mask	= 0xfffffff0,
> +	.drv.name	= "SMSC LAN8710/LAN8720",
> +
> +	.features	= (PHY_BASIC_FEATURES | SUPPORTED_Pause
> +				| SUPPORTED_Asym_Pause),

... this one. The phy now advertises SUPPORTED_Pause and
SUPPORTED_Asym_Pause which the generic phy driver does not do. This
causes the adv != oldadv check in genphy_config_advert to become true.
genphy_config_advert then returns '1' for advertise changed, which
causes genphy_config_aneg to call genphy_restart_aneg which calls
phy_aneg_done to wait for a link.

So this patch is bogus and by accident fixes a problem. The real problem
is that current phylib does not wait (reliably) for a link. This problem still
persists and is still very annoying. I just have a USB network adapter
here which needs a three second delay after discovering it to make it
work with barebox.

We need a phy_aneg_done() before trying to do network transfers and we
need that *unconditionally*.

Jean-Christophe, you can choose where you want to have this call, but it
will go in. We are carrying these phylib regressions for several months
now.

Sascha


-- 
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

      parent reply	other threads:[~2012-12-08 15:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-15  9:31 [PATCH 1/2] phy: add phy_drivers_register Jean-Christophe PLAGNIOL-VILLARD
2012-11-15  9:31 ` [PATCH 2/2] phy: add smsc phy driver support Jean-Christophe PLAGNIOL-VILLARD
2012-11-15 11:29   ` Sascha Hauer
2012-11-15 11:58   ` [PATCH 1/1 v2] " Jean-Christophe PLAGNIOL-VILLARD
2012-12-08 15:05   ` Sascha Hauer [this message]

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=20121208150542.GN24458@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=plagnioj@jcrosoft.com \
    /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