[U-Boot] [PATCH 4/7] mxc_nand: add nand driver for MX2/MX3

Wolfgang Denk wd at denx.de
Fri May 29 10:40:05 CEST 2009


Dear Magnus,

In message <59b21cf20905282322s60c91890w73eeb443c25a0963 at mail.gmail.com> you wrote:
> 
> >> +static void *mxc_nand_memcpy(void *dest, void *source, size_t size)
> >> +{
> >> +	uint32_t *s = source, *d = dest;
> >> +
> >> +	size >>= 2;
> >> +	while (size--)
> >> +		*d++ = *s++;
> >> +	return dest;
> >> +}
> >
> > Why do we need this "special" function here? Why cannot we use plain
> > standard memcpy() instead?
>
> Because the nand flash controller can only handle 32 bit read/write
> operations, any other size will cause an abort (or something like
> that).

I see.  I would find it helpful if this was mentioned in a comment;
eventually it should also be reflected in the function name. How about
memcpy32() or memcpy_aligned32() or similar?

While we are at alignment - what happens if the parameters "source"
and "dest" are not 32 bit aligned?

Maybe we should even move this function into common code?

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
If you're not part of the solution, you're part of the problem.


More information about the U-Boot mailing list