ref: faf3f0df06f7a994d58eb48cff7a6ccaa0b847a6
parent: b9eb7258bdb1b244af91dbe75595d55d3de810d4
author: cinap_lenrek <[email protected]>
date: Fri Sep 4 20:33:57 EDT 2015
zynq: fix cache flush bug for emmc driver (have to invalidate cache *before* read)
--- a/sys/src/9/zynq/emmc.c
+++ b/sys/src/9/zynq/emmc.c
@@ -351,8 +351,13 @@
pa = PADDR(buf);
if(write){
+ /* flush cache before write */
cleandse((uchar*)buf, (uchar*)buf+len);
clean2pa(pa, pa+len);
+ } else {
+ /* invalidate cache before read */
+ invaldse((uchar*)buf, (uchar*)buf+len);
+ inval2pa(pa, pa+len);
}
r = emmc.regs;
@@ -362,7 +367,7 @@
}
static void
-emmcio(int write, uchar *buf, int len)
+emmcio(int write, uchar *, int)
{
u32int *r;
int i;
@@ -387,12 +392,6 @@
}
if(i)
r[Interrupt] = i;
-
- if(!write){
- uintptr pa = PADDR(buf);
- invaldse((uchar*)buf, (uchar*)buf+len);
- inval2pa(pa, pa+len);
- }
}
SDio sdio = {