From: Reinhard Meyer <u-boot@emk-elektronik.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] drivers/net/at91_emac.c: increase timeout for autonegotiation
Date: Thu, 07 Oct 2010 10:12:12 +0200 [thread overview]
Message-ID: <4CAD80DC.2050109@emk-elektronik.de> (raw)
In-Reply-To: <1286437487-10501-2-git-send-email-andreas.devel@googlemail.com>
Dear Andreas Bie?mann,
> This patch increases timeout for autonegotiation from 1 second to 3 seconds.
> Some boards (e.g. at91rm9200ek) did not negotiate within 1 second.
> @@ -220,7 +220,7 @@ static int at91emac_phy_reset(struct eth_device *netdev)
> at91emac_write(emac, CONFIG_DRIVER_AT91EMAC_PHYADDR, MII_BMCR,
> (BMCR_ANENABLE | BMCR_ANRESTART));
>
> - for (i = 0; i < 100000 / 100; i++) {
> + for (i = 0; i < 30000; i++) {
> at91emac_read(emac, CONFIG_DRIVER_AT91EMAC_PHYADDR,
> MII_BMSR, &status);
> if (status & BMSR_ANEGCOMPLETE)
You might want to change the timeout to use the timer like here,
otherwise such looped timeouts are subject to toolchain version
and cache and optimisation and cpu clock and whatever ;)
/*
* Wait for the XTAL oscillator to become ready
*/
static int enc_clock_wait(enc_dev_t *enc)
{
uint64_t etime;
/* one second timeout */
etime = get_ticks() + get_tbclk();
/*
* Wait for CLKRDY to become set (i.e., check that we can
* communicate with the ENC)
*/
do
{
if (enc_r8(enc, CTL_REG_ESTAT) & ENC_ESTAT_CLKRDY)
return 0;
} while (get_ticks() <= etime);
printf("%s: timeout waiting for CLKRDY\n", enc->dev->name);
return -1;
}
Reinhard
next prev parent reply other threads:[~2010-10-07 8:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-07 7:44 [U-Boot] [PATCH 0/2] More rework on at91_emac Andreas Bießmann
2010-10-07 7:44 ` [U-Boot] [PATCH 1/2] drivers/net/at91_emac.c: increase timeout for autonegotiation Andreas Bießmann
2010-10-07 8:12 ` Reinhard Meyer [this message]
2010-10-07 8:20 ` Reinhard Meyer
2010-10-12 6:33 ` Ben Warren
2010-10-12 6:45 ` Reinhard Meyer
2010-10-07 7:44 ` [U-Boot] [PATCH 2/2] drivers/net/at91_emac.c: change return values Andreas Bießmann
2010-10-12 6:33 ` Ben Warren
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=4CAD80DC.2050109@emk-elektronik.de \
--to=u-boot@emk-elektronik.de \
--cc=u-boot@lists.denx.de \
/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