[U-Boot] [PATCH] net: fec: Avoid MX28 bus sync issue

Wolfgang Denk
2013-09-12T17:50:14Z

Dear Hector Palacios,

In message <523195CA.3010305@digi.com> you wrote:
>
> Here is a patch:
>
> From: Robert Hodaszi <robert.hodaszi@digi.com>
> Date: Fri, 6 Sep 2013 09:50:52 +0200
> Subject: [PATCH] net: fec: fix invalid temporary RX buffer alignment because
> of GCC bug
>
> Older GCC versions don't handle well alignment on stack variables.

Can you please be specific - which exact versions of GCC are supposed
to misbehave here?

> To fix it, don't put the temporary onto the stack.

This is not a good idea, as it wastes a memory for no good reason.

> Signed-off-by: Robert Hodaszi <robert.hodaszi@digi.com>
> Signed-off-by: Hector Palacios <hector.palacios@digi.com>
> ---
> drivers/net/fec_mxc.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
> index f4f72b7..315017e 100644
> --- a/drivers/net/fec_mxc.c
> +++ b/drivers/net/fec_mxc.c
> @@ -828,7 +828,10 @@ static int fec_recv(struct eth_device *dev)
> uint16_t bd_status;
> uint32_t addr, size, end;
> int i;
> - uchar buff[FEC_MAX_PKT_SIZE] __aligned(ARCH_DMA_MINALIGN);
> + /* Don't place this variable on the stack, because older GCC version
> + * doesn't handle alignement on stack well.
> + */
> + static uchar buff[FEC_MAX_PKT_SIZE] __aligned(ARCH_DMA_MINALIGN);

I have to admit that I doubt the explanation - somthing else is
probaly wrong instead. I would really like to know which compiler
version misbehaves, and what the generated code looks like, both in
the working and in the broken case.

Thanks.

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 had the rare misfortune of being one of the first people to try and
implement a PL/1 compiler. -- T. Cheatham