netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jens Renner (EFE)" <renner@efe-gmbh.de>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net
Subject: [PATCH] net: ethernet: xilinx_emaclite: keep protocol selector bits by reading ANAR
Date: Tue, 28 May 2013 18:10:38 +0200	[thread overview]
Message-ID: <51A4D6FE.3080308@efe-gmbh.de> (raw)

This patch reads the PHY's MII_ADVERTISE register (ANAR) before modifying it.
Hence, the protocol selector bits (4:0) which indicate IEEE 803.3u support are
prevented from being cleared. While the selector bits are fixed / read-only on
some PHYs, not setting them correctly on others (like TI DP83630) makes the
PHY fall back to 10/half mode which should be avoided.

Signed-off-by: Jens Renner <renner@efe-gmbh.de>
---
drivers/net/ethernet/xilinx/xilinx_emaclite.c               |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index 919b983..4a67af1 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -922,7 +922,7 @@ void xemaclite_adjust_link(struct net_device *ndev)
 static int xemaclite_open(struct net_device *dev)
 {
        struct net_local *lp = netdev_priv(dev);
-       int retval;
+       int retval, adv;

        /* Just to be safe, stop the device first */
        xemaclite_disable_interrupts(lp);
@@ -946,7 +946,10 @@ static int xemaclite_open(struct net_device *dev)
                phy_write(lp->phy_dev, MII_CTRL1000, 0);

                /* Advertise only 10 and 100mbps full/half duplex speeds */
-               phy_write(lp->phy_dev, MII_ADVERTISE, ADVERTISE_ALL);
+               adv = phy_read(lp->phy_dev, MII_ADVERTISE);
+               if (adv < 0)
+                       return adv;
+               phy_write(lp->phy_dev, MII_ADVERTISE, adv | ADVERTISE_ALL);

                /* Restart auto negotiation */
                bmcr = phy_read(lp->phy_dev, MII_BMCR);

             reply	other threads:[~2013-05-28 16:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-28 16:10 Jens Renner (EFE) [this message]
2013-05-28 16:22 ` [PATCH] net: ethernet: xilinx_emaclite: keep protocol selector bits by reading ANAR David Laight
2013-05-28 19:35   ` renner
2013-05-29  8:51     ` David Laight
2013-05-29 11:20       ` Jens Renner (EFE)
2013-05-29 15:23 ` Michal Simek
2013-05-29 16:54   ` Jens Renner (EFE)
2013-05-29 16:59     ` Michal Simek

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=51A4D6FE.3080308@efe-gmbh.de \
    --to=renner@efe-gmbh.de \
    --cc=davem@davemloft.net \
    --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).