diff --git a/ubb-patgen/Makefile b/ubb-patgen/Makefile index 5bb248e..eafa139 100644 --- a/ubb-patgen/Makefile +++ b/ubb-patgen/Makefile @@ -11,7 +11,7 @@ # CC = mipsel-openwrt-linux-gcc -CFLAGS = -g -Wall -O9 -I../libubb/include +CFLAGS = -g -Wall -O9 -march=mips32 -I../libubb/include LDFLAGS = LDLIBS = -L../libubb -lubb -lm diff --git a/ubb-patgen/ubb-patgen.c b/ubb-patgen/ubb-patgen.c index dd90df1..8f54852 100644 --- a/ubb-patgen/ubb-patgen.c +++ b/ubb-patgen/ubb-patgen.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -25,9 +26,13 @@ #include +#define USE_DMA #define DMA 5 +extern int cacheflush(char *addr, int nbytes, int cache); + + /* ----- List available bus clock frequencies ------------------------------ */ @@ -309,6 +314,13 @@ static void send_buffer(const struct mmcclk *clk, #ifdef USE_DMA unsigned long phys; + if (cacheflush((void *) buf, nibbles >> 1, DCACHE)) { + perror("cacheflush"); + exit(1); + } + + asm("sync"); /* flush the write buffer */ + phys = physmem_xlat((void *) buf); mmc_buffer(clk, buf[0] >> 4, phys, nibbles, mask); #else