[U-Boot] [linux-sunxi] [PATCH] sunxi: Fix gmac not working reliable on the Bananapi

Siarhei Siamashka siarhei.siamashka at gmail.com
Mon Sep 29 08:13:37 CEST 2014


On Sun, 28 Sep 2014 20:13:21 +0200
Hans de Goede <hdegoede at redhat.com> wrote:

> In order for the gmac nic to work reliable on the Bananapi, we need to poke
> these 2 undocumented bits in the gmac clk register. Since these are
> undocumented, this commit only sets these bits on the Bananapi for now.
> 
> I'll contact Allwinner to try and get these bits documented, once they
> are documented we can hopefully replace this hack with a better patch.

Could you please provide a bit more details in the commit message?
What are the symptoms of the problem? How did you come to the idea
to poke these bits? Does the GMAC driver in the linux kernel need a
similar fix/workaround? And if you apply it in the linux kernel, does
it provide any visible changes in performance or anything else?

Also as mentioned in another e-mail
    http://lists.denx.de/pipermail/u-boot/2014-September/190096.html
u-boot configures the "912MHz @1.4V" CPU clock frequency/voltage
setup for sun7i hardware. And according to the information from Tony
Zhang, this is supposed to be unreliable for the Banana Pi. So what
happens to this GMAC bug if you just increase the dcdc2 voltage in
u-boot (or reduce the CPU clock frequency)?

I remember that some users suffered from GMAC problems, which turned
out to be caused by just overclocking the CPU to 1.2GHz (a "helful"
SD card image creator decided that the users would like to enjoy
better performance):
    http://www.cubieforums.com/index.php/topic,2590.0.html
So it looks like GMAC might be one of those canaries, which die first
on wrong CPU clock frequency/voltage settings.


> Reported-by: Karsten Merker <merker at debian.org>
> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
> ---
>  board/sunxi/gmac.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/board/sunxi/gmac.c b/board/sunxi/gmac.c
> index e7ff952..f58c963 100644
> --- a/board/sunxi/gmac.c
> +++ b/board/sunxi/gmac.c
> @@ -24,6 +24,15 @@ int sunxi_gmac_initialize(bd_t *bis)
>  		CCM_GMAC_CTRL_GPIT_MII);
>  #endif
>  
> +	/*
> +	 * HdG: this is necessary to get GMAC to work reliable on the
> +	 * Bananapi. We don't know what these undocumented bits do, so this
> +	 * is a Bananapi specific hack for now.
> +	 */
> +#ifdef CONFIG_BANANAPI
> +	setbits_le32(&ccm->gmac_clk_cfg, 0x3 << 10);
> +#endif
> +
>  	/* Configure pin mux settings for GMAC */
>  	for (pin = SUNXI_GPA(0); pin <= SUNXI_GPA(16); pin++) {
>  #ifdef CONFIG_RGMII



-- 
Best regards,
Siarhei Siamashka


More information about the U-Boot mailing list