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

Wolfgang Denk wd at denx.de
Fri May 29 01:06:18 CEST 2009


Dear Ilya Yanok,

In message <1242777361-6717-5-git-send-email-yanok at emcraft.com> you wrote:
> Driver for NFC NAND controller found on Freescale's MX2 and MX3
> processors. Ported from Linux. Tested only with i.MX27 but should
> works with other MX2 and MX3 processors too.

...
> +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?


> +	if (col < mtd->writesize)
> +		p = (uint16_t __iomem *)(host->regs->MAIN_AREA0 + (col >> 1));
> +	else
> +		p = (uint16_t __iomem *)(host->regs->SPARE_AREA0 +
> +				((col - mtd->writesize) >> 1));

Braces,please.

...
> +		if (col < mtd->writesize)
> +			p = host->regs->MAIN_AREA0 + (col & ~3);
> +		else
> +			p = host->regs->SPARE_AREA0 -
> +						mtd->writesize + (col & ~3);

Braces, please.

[please check globally, I will not send more of these comments.]


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 all you have is a hammer, everything looks like a nail.


More information about the U-Boot mailing list