[U-Boot] [PATCH 05/10] AVR32: macb - Disable 100mbps if clock is slow

Wolfgang Denk wd at denx.de
Wed Nov 19 00:48:36 CET 2008


Dear Olav Morken,

In message <09189b13a9a10f413f4f12395032140345592cf3.1223643536.git.olavmrk at gmail.com> you wrote:
> For 100mbps operation, the ethernet controller requires a 25 MHz clock
> in MII mode, and a 50 MHz clock in RMII mode. If the clock is slower,
> disable 100mbps mode.
> 
> Signed-off-by: Gunnar Rangoy <gunnar at rangoy.com>
> Signed-off-by: Paul Driveklepp <pauldriveklepp at gmail.com>
> Signed-off-by: Olav Morken <olavmrk at gmail.com>
> ---
>  drivers/net/macb.c |   23 ++++++++++++++++++++++-
>  1 files changed, 22 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/macb.c b/drivers/net/macb.c
> index 08bebf7..4fef374 100644
> --- a/drivers/net/macb.c
> +++ b/drivers/net/macb.c
> @@ -296,8 +296,29 @@ static void macb_phy_reset(struct macb_device *macb)
>  	struct eth_device *netdev = &macb->netdev;
>  	int i;
>  	u16 status, adv;
> +	int rmii_mode;
> +	unsigned min_hz;
> +
> +#ifdef CONFIG_RMII
> +	rmii_mode = 1;
> +	min_hz = 50000000;
> +#else
> +	rmii_mode = 0;
> +	min_hz = 25000000;
> +#endif
> +
> +	adv = ADVERTISE_CSMA | ADVERTISE_ALL ;
> +
> +	if (get_hsb_clk_rate() < min_hz) {
> +		printf("%s: HSB clock < %u MHz in %s mode - "
> +		       "disabling 100mbit.\n", netdev->name, min_hz / 1000000,

Use str_mhz() to round and print the frequency. And please
use "Mbit/s" or "Mbps" instead of "mbit". See
http://en.wikipedia.org/wiki/Mbps#Megabit_per_second



Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"I've finally learned what `upward compatible' means. It means we get
to keep all our old mistakes." - Dennie van Tassel


More information about the U-Boot mailing list