I think the fec's parent clock is the ipb clock not the ppc core clock. Could that be the problem?<br><br><div class="gmail_quote">On Wed, May 6, 2009 at 2:21 PM, Wolfgang Denk <span dir="ltr"><<a href="mailto:wd@denx.de">wd@denx.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Signed-off-by: Wolfgang Denk <<a href="mailto:wd@denx.de">wd@denx.de</a>><br>
Cc: Grant Likely <<a href="mailto:grant.likely@secretlab.ca">grant.likely@secretlab.ca</a>><br>
Cc: John Rigby <<a href="mailto:jcrigby@gmail.com">jcrigby@gmail.com</a>><br>
---<br>
This patch is NOT intended for inclusion into mainline, but rather a<br>
request for help. For some reason which I don't understand yet, the<br>
Ethernet interface on the ARIA board does not work in the default<br>
configuration, because MII probing fails.<br>
<br>
What I'm seeing is this; the problem is with this part of code in<br>
"drivers/net/fs_enet/mii-fec.c":<br>
<br>
156 fec->mii_speed = ((ppc_proc_freq + 4999999) / 5000000) << 1;<br>
...<br>
163 out_be32(&fec->fecp->fec_mii_speed, fec->mii_speed);<br>
<br>
I added some debug messages, and this is what I see:<br>
<br>
On the ADS5121, we have the CPU clocked at 400 MHz. I get:<br>
...<br>
## ppc_proc_freq = 399999996, fec->mii_speed = 160<br>
FEC MII Bus: probed<br>
...<br>
It works fine.<br>
<br>
According to the Ref. Man.:<br>
A value of 0 in this field turns off the MDC and leaves it in<br>
a low-voltage state. Any non-zero value results in the MDC<br>
frequency of 1/(mii_speed*2) of the system clock frequency.<br>
that means we have a MDC frequency of<br>
400 MHz / (2 * 160) = 1.25 MHz<br>
which is obviously within the 2.5 MHz limit.<br>
<br>
Now ARIA is currently running at 316.8 MHz, and this is what I get:<br>
...<br>
## ppc_proc_freq = 316800000, fec->mii_speed = 128<br>
fsl-fec-mdio: probe of 80002800.mdio failed with error -5<br>
...<br>
It fails. MDC frequency is<br>
316.8 MHz / (2 * 128) = 1.24 MHz<br>
which should be fine.<br>
<br>
However, If I change the code to<br>
<br>
fec->mii_speed = (((ppc_proc_freq / 1000000) / 30) + 1) << 1;<br>
<br>
then I get:<br>
...<br>
## ppc_proc_freq = 316800000, fec->mii_speed = 22<br>
FEC MII Bus: probed<br>
... and it's working!!! However, I compute MDC frequency as<br>
316.8 MHz / (2 * 22) = 7.2 MHz<br>
which is far above the maximum allowed clock of 2.5 MHz ???<br>
<br>
Has anybody any idea what might be going on here?<br>
<br>
<br>
drivers/net/fs_enet/mii-fec.c | 6 +++++-<br>
1 files changed, 5 insertions(+), 1 deletions(-)<br>
<br>
diff --git a/drivers/net/fs_enet/mii-fec.c b/drivers/net/fs_enet/mii-fec.c<br>
index 9d8bd97..a51dd83 100644<br>
--- a/drivers/net/fs_enet/mii-fec.c<br>
+++ b/drivers/net/fs_enet/mii-fec.c<br>
@@ -153,8 +153,12 @@ static int __devinit fs_enet_mdio_probe(struct of_device *ofdev,<br>
if (!fec->fecp)<br>
goto out_fec;<br>
<br>
+#if 0<br>
fec->mii_speed = ((ppc_proc_freq + 4999999) / 5000000) << 1;<br>
-<br>
+#else<br>
+ fec->mii_speed = (((ppc_proc_freq / 1000000) / 30) + 1) << 1;<br>
+ printk("## ppc_proc_freq = %d, fec->mii_speed = %d\n", ppc_proc_freq, fec->mii_speed);<br>
+#endif<br>
setbits32(&fec->fecp->fec_r_cntrl, FEC_RCNTRL_MII_MODE);<br>
setbits32(&fec->fecp->fec_ecntrl, FEC_ECNTRL_PINMUX |<br>
FEC_ECNTRL_ETHER_EN);<br>
<font color="#888888">--<br>
1.6.0.6<br>
<br>
</font></blockquote></div><br>