netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Guo-Fu Tseng" <cooldavid@cooldavid.org>
To: "David Miller" <davem@davemloft.net>
Cc: Guo-Fu Tseng <cooldavid@cooldavid.org>,
	"linux-netdev" <netdev@vger.kernel.org>,
	"Aries Lee" <arieslee@jmicron.com>,
	"Devinchiu" <devinchiu@jmicron.com>,
	"Ethan Hsiao" <ethanhsiao@jmicron.com>
Subject: [PATCH net-next-2.6 7/9] jme: Refill receive unicase MAC addr after resume
Date: Mon, 14 Feb 2011 12:27:40 +0800	[thread overview]
Message-ID: <1297657662-30289-7-git-send-email-cooldavid@cooldavid.org> (raw)
In-Reply-To: <1297657662-30289-1-git-send-email-cooldavid@cooldavid.org>

From: Guo-Fu Tseng <cooldavid@cooldavid.org>

The value of the register which holds receive Unicast MAC Address
sometimes get messed-up after resume.
This patch refill it before enabling the hardware filter.

Signed-off-by: Guo-Fu Tseng <cooldavid@cooldavid.org>
---
 drivers/net/jme.c |   28 ++++++++++++++++++----------
 drivers/net/jme.h |    1 +
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/drivers/net/jme.c b/drivers/net/jme.c
index dd41324..ed35e17 100644
--- a/drivers/net/jme.c
+++ b/drivers/net/jme.c
@@ -898,6 +898,7 @@ jme_enable_rx_engine(struct jme_adapter *jme)
 	/*
 	 * Setup Unicast Filter
 	 */
+	jme_set_unicastaddr(jme->dev);
 	jme_set_multi(jme->dev);
 
 	/*
@@ -2114,27 +2115,34 @@ jme_start_xmit(struct sk_buff *skb, struct net_device *netdev)
 	return NETDEV_TX_OK;
 }
 
+static void
+jme_set_unicastaddr(struct net_device *netdev)
+{
+	struct jme_adapter *jme = netdev_priv(netdev);
+	u32 val;
+
+	val = (netdev->dev_addr[3] & 0xff) << 24 |
+	      (netdev->dev_addr[2] & 0xff) << 16 |
+	      (netdev->dev_addr[1] & 0xff) <<  8 |
+	      (netdev->dev_addr[0] & 0xff);
+	jwrite32(jme, JME_RXUMA_LO, val);
+	val = (netdev->dev_addr[5] & 0xff) << 8 |
+	      (netdev->dev_addr[4] & 0xff);
+	jwrite32(jme, JME_RXUMA_HI, val);
+}
+
 static int
 jme_set_macaddr(struct net_device *netdev, void *p)
 {
 	struct jme_adapter *jme = netdev_priv(netdev);
 	struct sockaddr *addr = p;
-	u32 val;
 
 	if (netif_running(netdev))
 		return -EBUSY;
 
 	spin_lock_bh(&jme->macaddr_lock);
 	memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
-
-	val = (addr->sa_data[3] & 0xff) << 24 |
-	      (addr->sa_data[2] & 0xff) << 16 |
-	      (addr->sa_data[1] & 0xff) <<  8 |
-	      (addr->sa_data[0] & 0xff);
-	jwrite32(jme, JME_RXUMA_LO, val);
-	val = (addr->sa_data[5] & 0xff) << 8 |
-	      (addr->sa_data[4] & 0xff);
-	jwrite32(jme, JME_RXUMA_HI, val);
+	jme_set_unicastaddr(netdev);
 	spin_unlock_bh(&jme->macaddr_lock);
 
 	return 0;
diff --git a/drivers/net/jme.h b/drivers/net/jme.h
index 668958c..b7ae0c7 100644
--- a/drivers/net/jme.h
+++ b/drivers/net/jme.h
@@ -1258,6 +1258,7 @@ static inline int new_phy_power_ctrl(u8 chip_main_rev)
  */
 static int jme_set_settings(struct net_device *netdev,
 				struct ethtool_cmd *ecmd);
+static void jme_set_unicastaddr(struct net_device *netdev);
 static void jme_set_multi(struct net_device *netdev);
 
 #endif
-- 
1.7.2.2


  parent reply	other threads:[~2011-02-14  4:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-14  4:27 [PATCH net-next-2.6 1/9] jme: Extract main and sub chip revision Guo-Fu Tseng
2011-02-14  4:27 ` [PATCH net-next-2.6 2/9] jme: PHY Power control for new chip Guo-Fu Tseng
2011-02-14  4:44   ` David Miller
2011-02-14  4:27 ` [PATCH net-next-2.6 3/9] jme: Fix bit typo of JMC250A2 workaround Guo-Fu Tseng
2011-02-14  4:44   ` David Miller
2011-02-14  4:27 ` [PATCH net-next-2.6 4/9] jme: Rename phyfifo function for easier understand Guo-Fu Tseng
2011-02-14  4:44   ` David Miller
2011-02-14  4:27 ` [PATCH net-next-2.6 5/9] jme: Fix hardware action of full-duplex Guo-Fu Tseng
2011-02-14  4:44   ` David Miller
2011-02-14  4:27 ` [PATCH net-next-2.6 6/9] jme: Safer MAC processor reset sequence Guo-Fu Tseng
2011-02-14  4:44   ` David Miller
2011-02-14  4:27 ` Guo-Fu Tseng [this message]
2011-02-14  4:44   ` [PATCH net-next-2.6 7/9] jme: Refill receive unicase MAC addr after resume David Miller
2011-02-14  4:27 ` [PATCH net-next-2.6 8/9] jme: Don't show UDP Checksum error if HW misjudged Guo-Fu Tseng
2011-02-14  4:43   ` David Miller
2011-02-14  5:13     ` Guo-Fu Tseng
2011-02-14  4:27 ` [PATCH net-next-2.6 9/9] jme: Advance driver version Guo-Fu Tseng
2011-02-14  4:44 ` [PATCH net-next-2.6 1/9] jme: Extract main and sub chip revision David Miller

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=1297657662-30289-7-git-send-email-cooldavid@cooldavid.org \
    --to=cooldavid@cooldavid.org \
    --cc=arieslee@jmicron.com \
    --cc=davem@davemloft.net \
    --cc=devinchiu@jmicron.com \
    --cc=ethanhsiao@jmicron.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).