From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?ISO-8859-1?Q?Timo_Ter=E4s?= Subject: Re: r8169 mac reading/writing broken Date: Sat, 27 Mar 2010 13:46:38 +0200 Message-ID: <4BADF01E.9090906@iki.fi> References: <4BADDDB7.4010005@iki.fi> <20100327114059.GA3432@electric-eye.fr.zoreil.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Ivan Vecera , netdev@vger.kernel.org To: =?ISO-8859-1?Q?Fran=E7ois_Romieu?= Return-path: Received: from ey-out-2122.google.com ([74.125.78.24]:58608 "EHLO ey-out-2122.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752709Ab0C0Lqn (ORCPT ); Sat, 27 Mar 2010 07:46:43 -0400 Received: by ey-out-2122.google.com with SMTP id d26so1023398eyd.19 for ; Sat, 27 Mar 2010 04:46:41 -0700 (PDT) In-Reply-To: <20100327114059.GA3432@electric-eye.fr.zoreil.com> Sender: netdev-owner@vger.kernel.org List-ID: =46ran=E7ois Romieu wrote: > Timo Ter=E4s : > [...] >> I did some more testing, and added debugging info to rtl_rar_set(). = It would >> appear that even if I write any mac address (with ifconfig) and rere= ad the >> MAC0..MAC5 register, the first four bytes get zeroed. So it would so= unds like >> the hardware is faulty, or that the rtl_rar_set function is buggy. >> >> Any suggestions to fix this ? >=20 > Try something like the patch below and please send a complete lspci -= vvv. Attached at the end. > I wonder what the bus controler looks like. >=20 > diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c > index 9d3ebf3..5db357a 100644 > --- a/drivers/net/r8169.c > +++ b/drivers/net/r8169.c > @@ -2814,6 +2814,7 @@ static void rtl_rar_set(struct rtl8169_private = *tp, u8 *addr) > void __iomem *ioaddr =3D tp->mmio_addr; > u32 high; > u32 low; > + int i; > =20 > low =3D addr[0] | (addr[1] << 8) | (addr[2] << 16) | (addr[3] << 2= 4); > high =3D addr[4] | (addr[5] << 8); > @@ -2822,7 +2823,17 @@ static void rtl_rar_set(struct rtl8169_private= *tp, u8 *addr) > =20 > RTL_W8(Cfg9346, Cfg9346_Unlock); > RTL_W32(MAC0, low); > - RTL_W32(MAC4, high); > + for (i =3D 0; i < 16; i++) { > + u32 read; > + > + RTL_W32(MAC4, high); > + read =3D RTL_R32(MAC4); > + if (read !=3D high) { > + printk(KERN_ERR PFX > + "failure %02d: read =3D 0x%08x, write =3D 0x%08x\n", > + i, read, high); > + } > + } > RTL_W8(Cfg9346, Cfg9346_Lock); > =20 > spin_unlock_irq(&tp->lock); I don't think this would do anything. The high part is recorded correct= ly always. It's the 'low' part that gets discarded. I can do similar test if writi= ng it more times will help. Will post results soon. - Timo 00:00.0 Host bridge: VIA Technologies, Inc. CN700/VN800/P4M800CE/Pro Ho= st Bridge Subsystem: VIA Technologies, Inc. CN700/VN800/P4M800CE/Pro Host Bridge Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- St= epping- SERR- FastB2B- DisINTx- Status: Cap+ 66MHz+ UDF- FastB2B- ParErr- DEVSEL=3Dmedium >TAbort- SERR- Capabilities: [50] Power Management version 2 Flags: PMEClk- DSI- D1- D2- AuxCurrent=3D0mA PME(D0-,D1-,D2-,D3hot-,D= 3cold-) Status: D0 NoSoftRst- PME-Enable- DSel=3D0 DScale=3D0 PME- Kernel driver in use: agpgart-via 00:00.1 Host bridge: VIA Technologies, Inc. CN700/VN800/P4M800CE/Pro Ho= st Bridge Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- St= epping- SERR- FastB2B- DisINTx- Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=3Dmedium >TAbort- SERR- TAbort- SERR- TAbort- SERR- TAbort- SERR- TAbort- SERR- TAbort- SERR- TAbort- Reset- FastB2B- PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn- Capabilities: [70] Power Management version 2 Flags: PMEClk- DSI- D1+ D2- AuxCurrent=3D0mA PME(D0-,D1-,D2-,D3hot-,D= 3cold-) Status: D0 NoSoftRst- PME-Enable- DSel=3D0 DScale=3D0 PME- 00:09.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8110SC= /8169SC Gigabit Ethernet (rev 10) Subsystem: Jetway Information Co., Ltd. Device 10ec Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV+ VGASnoop- ParErr- St= epping- SERR- FastB2B- DisINTx- Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=3Dmedium >TAbort- SERR- TAbort- SERR- TAbort- SERR- TAbort- SERR- TAbort- SERR- TAbort- SERR- TAbort- SERR- TAbort- SERR- TAbort- SERR- TAbort- SERR- TAbort- SERR- TAbort- SERR- TAbort- SERR- TAbort- SERR- TAbort- SERR-