From: Pavel Bartusek <pba@sysgo.de>
To: Jean-Denis Boyer <jdboyer@mediatrix.com>,
Dan Malek <dan@embeddededge.com>,
linuxppc-embedded <linuxppc-embedded@lists.linuxppc.org>
Subject: Re: MDIO clock speed computation
Date: Wed, 24 Jul 2002 09:38:38 +0200 [thread overview]
Message-ID: <3D3E597E.9050305@sysgo.de> (raw)
In-Reply-To: 2702075D4DE2B043BF5EB82E9CFAD45B093B12@mail1.mediatrix.com
[-- Attachment #1: Type: text/plain, Size: 1165 bytes --]
Jean-Denis Boyer wrote:
>>Will this work for all cases? :
>>
>>((((bd->bi_intfreq + 4999999) / 2500000) / 2 ) & 0x3F ) << 1;
>>
>
>I hope so ;-)
>
Because hoping is not enough, I wrote a little brute force program for testing (see attachment).
The algorithm above is OK :-) It produces MDIO frequencies from 1.875MHz to 2.5 MHz.
BTW: Wolfgang, similar problem is in the PPCboot.
----------------------------------------------------------------------
| Pavel Bartusek |
| |
| Sysgo RTS GmbH, phone: +49 (0) 6136 9948-722 |
| Am Pfaffenstein 14 fax: +49 (0) 6136 9948-10 |
| D-55270 Klein-Winternheim email: pba@sysgo.de |
| Germany |
| |
| http://www.sysgo.de http://www.elinos.com |
| |
----------------------------------------------------------------------
[-- Attachment #2: fec_speed.test.c --]
[-- Type: text/plain, Size: 572 bytes --]
#include <stdio.h>
#include <limits.h>
#define ALGORITHM ((((bi_intfreq + 4999999) / 2500000) / 2 ) & 0x3F ) << 1
int main(void)
{
unsigned long bi_intfreq, mdio_clock_min=INT_MAX, mdio_clock_max=0, mii_speed,mii_speed_reg;
for(bi_intfreq=10000000; bi_intfreq<200000000; bi_intfreq++) {
mii_speed_reg = ALGORITHM;
mii_speed = bi_intfreq / (mii_speed_reg & ~1);
if (mii_speed > mdio_clock_max) mdio_clock_max = mii_speed;
if (mii_speed < mdio_clock_min) mdio_clock_min = mii_speed;
}
printf("MDIO clocks are from %ldHz to %ldHz\n",mdio_clock_min,mdio_clock_max);
}
next prev parent reply other threads:[~2002-07-24 7:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-23 19:41 MDIO clock speed computation Jean-Denis Boyer
2002-07-24 7:38 ` Pavel Bartusek [this message]
-- strict thread matches above, loose matches on Subject: below --
2002-07-23 15:47 Jean-Denis Boyer
2002-07-23 17:34 ` Dan Malek
2002-07-22 20:54 Jean-Denis Boyer
2002-07-22 18:19 Jean-Denis Boyer
2002-07-22 19:51 ` Dan Malek
2002-07-22 20:12 ` Dan Malek
2002-07-22 20:15 ` Wolfgang Denk
2002-07-23 10:22 ` Pavel Bartusek
2002-07-23 15:01 ` Dan Malek
2002-07-22 17:19 Pavel Bartusek
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=3D3E597E.9050305@sysgo.de \
--to=pba@sysgo.de \
--cc=dan@embeddededge.com \
--cc=jdboyer@mediatrix.com \
--cc=linuxppc-embedded@lists.linuxppc.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).