summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2010-03-24 14:08:40 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2010-03-30 14:14:58 +0200
commit9d9be6ba9be07035fdec7d3be9e400371e2d1c1c (patch)
tree5d8e877f924a70245af560d1ca9bfa3970502181 /drivers
parent2477fb12e9960a410a53ac125e2b43b0d8e1d7b6 (diff)
downloadbarebox-9d9be6ba9be07035fdec7d3be9e400371e2d1c1c.tar.gz
barebox-9d9be6ba9be07035fdec7d3be9e400371e2d1c1c.tar.xz
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/nand/nand_imx.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/nand/nand_imx.c b/drivers/nand/nand_imx.c
index afd5637626..da9b2d5176 100644
--- a/drivers/nand/nand_imx.c
+++ b/drivers/nand/nand_imx.c
@@ -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;