From patchwork Sat Mar 27 11:40:59 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Francois Romieu X-Patchwork-Id: 48742 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id F0162B7CEE for ; Sat, 27 Mar 2010 22:41:41 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752746Ab0C0Lld (ORCPT ); Sat, 27 Mar 2010 07:41:33 -0400 Received: from 55.58.140-88.rev.gaoland.net ([88.140.58.55]:47713 "EHLO electric-eye.fr.zoreil.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752709Ab0C0Lld (ORCPT ); Sat, 27 Mar 2010 07:41:33 -0400 Received: from electric-eye.fr.zoreil.com (localhost [127.0.0.1]) by electric-eye.fr.zoreil.com (8.14.3/8.14.3) with ESMTP id o2RBf3kL005082; Sat, 27 Mar 2010 12:41:03 +0100 Received: (from romieu@localhost) by electric-eye.fr.zoreil.com (8.14.3/8.14.3/Submit) id o2RBexri005080; Sat, 27 Mar 2010 12:40:59 +0100 X-Authentication-Warning: electric-eye.fr.zoreil.com: romieu set sender to romieu@fr.zoreil.com using -f Date: Sat, 27 Mar 2010 12:40:59 +0100 From: =?iso-8859-1?Q?Fran=E7ois?= Romieu To: Timo =?iso-8859-1?Q?Ter=E4s?= Cc: Ivan Vecera , netdev@vger.kernel.org Subject: Re: r8169 mac reading/writing broken Message-ID: <20100327114059.GA3432@electric-eye.fr.zoreil.com> References: <4BADDDB7.4010005@iki.fi> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4BADDDB7.4010005@iki.fi> X-Organisation: Land of Sunshine Inc. User-Agent: Mutt/1.5.20 (2009-08-17) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Timo Teräs : [...] > 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 reread the > MAC0..MAC5 register, the first four bytes get zeroed. So it would sounds like > the hardware is faulty, or that the rtl_rar_set function is buggy. > > Any suggestions to fix this ? Try something like the patch below and please send a complete lspci -vvv. I wonder what the bus controler looks like. --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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 = tp->mmio_addr; u32 high; u32 low; + int i; low = addr[0] | (addr[1] << 8) | (addr[2] << 16) | (addr[3] << 24); high = addr[4] | (addr[5] << 8); @@ -2822,7 +2823,17 @@ static void rtl_rar_set(struct rtl8169_private *tp, u8 *addr) RTL_W8(Cfg9346, Cfg9346_Unlock); RTL_W32(MAC0, low); - RTL_W32(MAC4, high); + for (i = 0; i < 16; i++) { + u32 read; + + RTL_W32(MAC4, high); + read = RTL_R32(MAC4); + if (read != high) { + printk(KERN_ERR PFX + "failure %02d: read = 0x%08x, write = 0x%08x\n", + i, read, high); + } + } RTL_W8(Cfg9346, Cfg9346_Lock); spin_unlock_irq(&tp->lock);