From patchwork Wed May 6 20:21:02 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfgang Denk X-Patchwork-Id: 26939 Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4CC65B6F56 for ; Thu, 7 May 2009 06:44:08 +1000 (EST) Received: by ozlabs.org (Postfix) id 4FFDB50D22; Thu, 7 May 2009 06:23:30 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 4DED950D21 for ; Thu, 7 May 2009 06:23:30 +1000 (EST) X-Original-To: linuxppc-dev@ozlabs.org Delivered-To: linuxppc-dev@ozlabs.org Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.10]) by ozlabs.org (Postfix) with ESMTP id B102DDE9D0 for ; Thu, 7 May 2009 06:21:08 +1000 (EST) Received: from mail01.m-online.net (mail.m-online.net [192.168.3.149]) by mail-out.m-online.net (Postfix) with ESMTP id 557A51C0007F; Wed, 6 May 2009 22:21:07 +0200 (CEST) Received: from localhost (dynscan2.mnet-online.de [192.168.1.215]) by mail.m-online.net (Postfix) with ESMTP id 4EE4790399; Wed, 6 May 2009 22:21:07 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from smtp-auth.mnet-online.de ([192.168.3.149]) by localhost (dynscan2.mnet-online.de [192.168.1.215]) (amavisd-new, port 10024) with ESMTP id fBwNQspJTBaL; Wed, 6 May 2009 22:21:03 +0200 (CEST) X-Auth-Info: N1UQGYDZbwm7cIiRXXz7Yv7XdRu7/vHYQvKJbG2Bygk= Received: from diddl.denx.de (ppp-93-104-42-126.dynamic.mnet-online.de [93.104.42.126]) by smtp-auth.mnet-online.de (Postfix) with ESMTP; Wed, 6 May 2009 22:21:03 +0200 (CEST) Received: from gemini.denx.de (unknown [10.0.0.2]) by diddl.denx.de (Postfix) with ESMTP id 61E35C7D6DEF; Wed, 6 May 2009 22:21:02 +0200 (CEST) Received: by gemini.denx.de (Postfix, from userid 500) id 3751583568A7; Wed, 6 May 2009 22:21:02 +0200 (CEST) From: Wolfgang Denk To: linuxppc-dev@ozlabs.org Subject: [PATCH 05/04] *** NOT FOR RELEASE *** HACK *** Work around MII clock issue *** Date: Wed, 6 May 2009 22:21:02 +0200 Message-Id: <1241641262-5202-6-git-send-email-wd@denx.de> X-Mailer: git-send-email 1.6.0.6 In-Reply-To: <1241641262-5202-1-git-send-email-wd@denx.de> References: <1241641262-5202-1-git-send-email-wd@denx.de> Cc: Wolfgang Denk X-BeenThere: linuxppc-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Signed-off-by: Wolfgang Denk Cc: Grant Likely Cc: John Rigby --- This patch is NOT intended for inclusion into mainline, but rather a request for help. For some reason which I don't understand yet, the Ethernet interface on the ARIA board does not work in the default configuration, because MII probing fails. What I'm seeing is this; the problem is with this part of code in "drivers/net/fs_enet/mii-fec.c": 156 fec->mii_speed = ((ppc_proc_freq + 4999999) / 5000000) << 1; ... 163 out_be32(&fec->fecp->fec_mii_speed, fec->mii_speed); I added some debug messages, and this is what I see: On the ADS5121, we have the CPU clocked at 400 MHz. I get: ... ## ppc_proc_freq = 399999996, fec->mii_speed = 160 FEC MII Bus: probed ... It works fine. According to the Ref. Man.: A value of 0 in this field turns off the MDC and leaves it in a low-voltage state. Any non-zero value results in the MDC frequency of 1/(mii_speed*2) of the system clock frequency. that means we have a MDC frequency of 400 MHz / (2 * 160) = 1.25 MHz which is obviously within the 2.5 MHz limit. Now ARIA is currently running at 316.8 MHz, and this is what I get: ... ## ppc_proc_freq = 316800000, fec->mii_speed = 128 fsl-fec-mdio: probe of 80002800.mdio failed with error -5 ... It fails. MDC frequency is 316.8 MHz / (2 * 128) = 1.24 MHz which should be fine. However, If I change the code to fec->mii_speed = (((ppc_proc_freq / 1000000) / 30) + 1) << 1; then I get: ... ## ppc_proc_freq = 316800000, fec->mii_speed = 22 FEC MII Bus: probed ... and it's working!!! However, I compute MDC frequency as 316.8 MHz / (2 * 22) = 7.2 MHz which is far above the maximum allowed clock of 2.5 MHz ??? Has anybody any idea what might be going on here? drivers/net/fs_enet/mii-fec.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/net/fs_enet/mii-fec.c b/drivers/net/fs_enet/mii-fec.c index 9d8bd97..a51dd83 100644 --- a/drivers/net/fs_enet/mii-fec.c +++ b/drivers/net/fs_enet/mii-fec.c @@ -153,8 +153,12 @@ static int __devinit fs_enet_mdio_probe(struct of_device *ofdev, if (!fec->fecp) goto out_fec; +#if 0 fec->mii_speed = ((ppc_proc_freq + 4999999) / 5000000) << 1; - +#else + fec->mii_speed = (((ppc_proc_freq / 1000000) / 30) + 1) << 1; + printk("## ppc_proc_freq = %d, fec->mii_speed = %d\n", ppc_proc_freq, fec->mii_speed); +#endif setbits32(&fec->fecp->fec_r_cntrl, FEC_RCNTRL_MII_MODE); setbits32(&fec->fecp->fec_ecntrl, FEC_ECNTRL_PINMUX | FEC_ECNTRL_ETHER_EN);