]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - board/synopsys/axs101/nand.c
axs101: Fix type mismatch warning
[karo-tx-uboot.git] / board / synopsys / axs101 / nand.c
index 8672803871d298a5cf54c939586d6b319599f615..ff35286c6efdb2e14474830fc6fc5cee6df9da31 100644 (file)
@@ -62,8 +62,10 @@ struct nand_bd {
        uint32_t buffer_ptr1;   /* DES3 */
 };
 
-#define NAND_REG_WRITE(r, v)   writel(v, CONFIG_SYS_NAND_BASE + r)
-#define NAND_REG_READ(r)       readl(CONFIG_SYS_NAND_BASE + r)
+#define NAND_REG_WRITE(r, v)   \
+       writel(v, (volatile void __iomem *)(CONFIG_SYS_NAND_BASE + r))
+#define NAND_REG_READ(r)               \
+       readl((const volatile void __iomem *)(CONFIG_SYS_NAND_BASE + r))
 
 static struct nand_bd *bd;     /* DMA buffer descriptors       */
 
@@ -107,6 +109,10 @@ static void axs101_nand_write_buf(struct mtd_info *mtd, const u_char *buf,
        writel(bbstate.bounce_buffer, &bd->buffer_ptr0);
        writel(0, &bd->buffer_ptr1);
 
+       /* Flush modified buffer descriptor */
+       flush_dcache_range((unsigned long)bd,
+                          (unsigned long)bd + sizeof(struct nand_bd));
+
        /* Issue "write" command */
        NAND_REG_WRITE(AC_FIFO, B_CT_WRITE | B_WFR | B_IWC | B_LC | (len-1));
 
@@ -137,6 +143,10 @@ static void axs101_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
        writel(bbstate.bounce_buffer, &bd->buffer_ptr0);
        writel(0, &bd->buffer_ptr1);
 
+       /* Flush modified buffer descriptor */
+       flush_dcache_range((unsigned long)bd,
+                          (unsigned long)bd + sizeof(struct nand_bd));
+
        /* Issue "read" command */
        NAND_REG_WRITE(AC_FIFO, B_CT_READ | B_WFR | B_IWC | B_LC | (len - 1));