Skip to content

Commit

Permalink
drivers/mmc/host/dw_mmc: Add dcache flush(VIC7100 ONLY).
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom authored and esmil committed Jun 13, 2021
1 parent 57f7282 commit 7a144b2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions drivers/mmc/host/dw_mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ static int dw_mci_req_show(struct seq_file *s, void *v)
}
DEFINE_SHOW_ATTRIBUTE(dw_mci_req);

#ifdef CONFIG_MMC_DW_FLUSH_DDR
#include <soc/starfive/vic7100.h>
static inline void dw_mci_flush_dcache(unsigned long start, unsigned long len)
{
starfive_flush_dcache(_ALIGN_DOWN(start, 64), len + start % 64);
}
#endif

static int dw_mci_regs_show(struct seq_file *s, void *v)
{
struct dw_mci *host = s->private;
Expand Down Expand Up @@ -691,6 +699,10 @@ static inline int dw_mci_prepare_desc32(struct dw_mci *host,
/* Physical address to DMA to/from */
desc->des2 = cpu_to_le32(mem_addr);

#ifdef CONFIG_MMC_DW_FLUSH_DDR
dw_mci_flush_dcache((unsigned long)mem_addr,
(unsigned long)desc_len);
#endif
/* Update physical address for the next desc */
mem_addr += desc_len;

Expand All @@ -707,6 +719,10 @@ static inline int dw_mci_prepare_desc32(struct dw_mci *host,
IDMAC_DES0_DIC));
desc_last->des0 |= cpu_to_le32(IDMAC_DES0_LD);

#ifdef CONFIG_MMC_DW_FLUSH_DDR
dw_mci_flush_dcache((unsigned long)(host->sg_dma),
(unsigned long)(sg_len * sizeof(struct idmac_desc)));
#endif
return 0;
err_own_bit:
/* restore the descriptor chain as it's polluted */
Expand Down

0 comments on commit 7a144b2

Please sign in to comment.