netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] r8169 : MAC address change fix for the 8168e-vl.
@ 2011-08-02 13:53 Francois Romieu
  2011-08-03  0:09 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Francois Romieu @ 2011-08-02 13:53 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Hayes Wang

Addresses https://bugzilla.kernel.org/show_bug.cgi?id=39252

Hayes suggested that the usual MAC{0, 4} register writes be completed
with writes to extended GigaMAC registers :
- 0xe0 .. 0xe5
- 0xf2 .. 0xf7

Registers 0xf0 and 0xf1 should be set to 0.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Hayes Wang <hayeswang@realtek.com>
---
 drivers/net/r8169.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 7d9c650..851a488 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -1091,6 +1091,21 @@ rtl_w1w0_eri(void __iomem *ioaddr, int addr, u32 mask, u32 p, u32 m, int type)
 	rtl_eri_write(ioaddr, addr, mask, (val & ~m) | p, type);
 }
 
+struct exgmac_reg {
+	u16 addr;
+	u16 mask;
+	u32 val;
+};
+
+static void rtl_write_exgmac_batch(void __iomem *ioaddr,
+				   const struct exgmac_reg *r, int len)
+{
+	while (len-- > 0) {
+		rtl_eri_write(ioaddr, r->addr, r->mask, r->val, ERIAR_EXGMAC);
+		r++;
+	}
+}
+
 static u8 rtl8168d_efuse_read(void __iomem *ioaddr, int reg_addr)
 {
 	u8 value = 0xff;
@@ -3116,6 +3131,18 @@ static void rtl_rar_set(struct rtl8169_private *tp, u8 *addr)
 	RTL_W32(MAC0, low);
 	RTL_R32(MAC0);
 
+	if (tp->mac_version == RTL_GIGA_MAC_VER_34) {
+		const struct exgmac_reg e[] = {
+			{ .addr = 0xe0, ERIAR_MASK_1111, .val = low },
+			{ .addr = 0xe4, ERIAR_MASK_1111, .val = high },
+			{ .addr = 0xf0, ERIAR_MASK_1111, .val = low << 16 },
+			{ .addr = 0xf4, ERIAR_MASK_1111, .val = high << 16 |
+								low  >> 16 },
+		};
+
+		rtl_write_exgmac_batch(ioaddr, e, ARRAY_SIZE(e));
+	}
+
 	RTL_W8(Cfg9346, Cfg9346_Lock);
 
 	spin_unlock_irq(&tp->lock);
-- 
1.7.6


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] r8169 : MAC address change fix for the 8168e-vl.
  2011-08-02 13:53 [PATCH] r8169 : MAC address change fix for the 8168e-vl Francois Romieu
@ 2011-08-03  0:09 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-08-03  0:09 UTC (permalink / raw)
  To: romieu; +Cc: netdev, hayeswang

From: Francois Romieu <romieu@fr.zoreil.com>
Date: Tue, 2 Aug 2011 15:53:43 +0200

> Addresses https://bugzilla.kernel.org/show_bug.cgi?id=39252
> 
> Hayes suggested that the usual MAC{0, 4} register writes be completed
> with writes to extended GigaMAC registers :
> - 0xe0 .. 0xe5
> - 0xf2 .. 0xf7
> 
> Registers 0xf0 and 0xf1 should be set to 0.
> 
> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-08-03  0:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-02 13:53 [PATCH] r8169 : MAC address change fix for the 8168e-vl Francois Romieu
2011-08-03  0:09 ` David Miller

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