9
0
Fork 0

nand_imx: use optimized memcpy

The internal SRAM buffer of the i.MX NAND controller does not
allow byte accesses. We use the memcpy32 function to handle this.
If we have assembler optimized string functions we can do better
because they won't do byte accesses when source and target are word
aligned.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2010-03-24 14:08:40 +01:00
parent 2477fb12e9
commit 9d9be6ba9b
1 changed files with 17 additions and 2 deletions

View File

@ -200,12 +200,17 @@ static struct nand_ecclayout nandv2_hw_eccoob_largepage = {
}
};
static void __nand_boot_init memcpy32(void *trg, const void *src, int size)
static void memcpy32(void *trg, const void *src, int size)
{
int i;
unsigned int *t = trg;
unsigned const int *s = src;
#ifdef CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS
if (!((unsigned long)trg & 0x3) && !((unsigned long)src & 0x3))
memcpy(trg, src, size);
else
#endif
for (i = 0; i < (size >> 2); i++)
*t++ = *s++;
}
@ -1025,6 +1030,16 @@ static void __nand_boot_init nfc_addr(struct imx_nand_host *host, u32 offs)
}
}
static void __nand_boot_init __memcpy32(void *trg, const void *src, int size)
{
int i;
unsigned int *t = trg;
unsigned const int *s = src;
for (i = 0; i < (size >> 2); i++)
*t++ = *s++;
}
void __nand_boot_init imx_nand_load_image(void *dest, int size)
{
struct imx_nand_host host;
@ -1135,7 +1150,7 @@ void __nand_boot_init imx_nand_load_image(void *dest, int size)
continue;
}
memcpy32(dest, host.base, pagesize);
__memcpy32(dest, host.base, pagesize);
dest += pagesize;
size -= pagesize;