Commit 73f52410 authored by Kevin Hilman's avatar Kevin Hilman

Revert "mmc: host: davinci: reimplement read/write fifo in C"

This reverts commit 5912086e.
Signed-off-by: default avatarKevin Hilman <khilman@deeprootsystems.com>
parent 6cb2d372
......@@ -225,73 +225,59 @@ MODULE_PARM_DESC(use_dma, "Wether to use DMA or not. Default = 1");
#define RSP_TYPE(x) ((x) & ~(MMC_RSP_BUSY|MMC_RSP_OPCODE))
static void davinci_mmc_read_fifo(struct mmc_davinci_host *host,
u16 len, u8 *dest)
{
void __iomem *fifo = host->base + DAVINCI_MMCDRR;
u16 index = 0;
dev_dbg(mmc_dev(host->mmc), "RX fifo %p count %d buf %p\n",
fifo, len, dest);
if (likely((0x03 & (unsigned long) dest) == 0)) {
if (len >= 4) {
ioread32_rep(fifo, dest, len >> 2);
index = len & ~0x03;
}
if (len & 0x02) {
*(u16 *)&dest[index] = ioread16(fifo);
index += 2;
}
if (len & 0x01) {
dest[index] = ioread8(fifo);
index += 1;
}
} else if ((0x01 & (unsigned long) dest) == 0) {
if (len >= 2) {
ioread16_rep(fifo, dest, len >> 1);
index = len & ~0x01;
}
if (len & 0x01)
dest[index] = ioread8(fifo);
} else {
ioread8_rep(fifo, dest, len);
}
}
static void davinci_mmc_write_fifo(struct mmc_davinci_host *host,
u16 len, const u8 *src)
{
void __iomem *fifo = host->base + DAVINCI_MMCDXR;
u16 index = 0;
dev_dbg(mmc_dev(host->mmc), "TX fifo %p count %d buf %p\n",
fifo, len, src);
if (likely((0x03 & (unsigned long) src) == 0)) {
if (len >= 4) {
iowrite32_rep(fifo, src + index, len >> 2);
index = len & ~0x03;
}
if (len & 0x02) {
iowrite16(*(u16 *)&src[index], fifo);
index += 2;
}
if (len & 0x01) {
iowrite8(src[index], fifo);
index += 1;
}
} else if ((0x01 & (unsigned long) src) == 0) {
if (len >= 2) {
iowrite16_rep(fifo, src + index, len >> 1);
index = len & ~0x01;
}
if (len & 0x01)
iowrite8(src[index], fifo);
} else {
iowrite8_rep(fifo, src, len);
}
}
#define DAVINCI_MMCSD_READ_FIFO(pDst, pRegs, cnt) asm( \
" cmp %3,#16\n" \
"1: ldrhs r0,[%1,%2]\n" \
" ldrhs r1,[%1,%2]\n" \
" ldrhs r2,[%1,%2]\n" \
" ldrhs r3,[%1,%2]\n" \
" stmhsia %0!,{r0,r1,r2,r3}\n" \
" beq 3f\n" \
" subhs %3,%3,#16\n" \
" cmp %3,#16\n" \
" bhs 1b\n" \
" tst %3,#0x0c\n" \
"2: ldrne r0,[%1,%2]\n" \
" strne r0,[%0],#4\n" \
" subne %3,%3,#4\n" \
" tst %3,#0x0c\n" \
" bne 2b\n" \
" tst %3,#2\n" \
" ldrneh r0,[%1,%2]\n" \
" strneh r0,[%0],#2\n" \
" tst %3,#1\n" \
" ldrneb r0,[%1,%2]\n" \
" strneb r0,[%0],#1\n" \
"3:\n" \
: "+r"(pDst) : "r"(pRegs), "i"(DAVINCI_MMCDRR), \
"r"(cnt) : "r0", "r1", "r2", "r3");
#define DAVINCI_MMCSD_WRITE_FIFO(pDst, pRegs, cnt) asm( \
" cmp %3,#16\n" \
"1: ldmhsia %0!,{r0,r1,r2,r3}\n" \
" strhs r0,[%1,%2]\n" \
" strhs r1,[%1,%2]\n" \
" strhs r2,[%1,%2]\n" \
" strhs r3,[%1,%2]\n" \
" beq 3f\n" \
" subhs %3,%3,#16\n" \
" cmp %3,#16\n" \
" bhs 1b\n" \
" tst %3,#0x0c\n" \
"2: ldrne r0,[%0],#4\n" \
" strne r0,[%1,%2]\n" \
" subne %3,%3,#4\n" \
" tst %3,#0x0c\n" \
" bne 2b\n" \
" tst %3,#2\n" \
" ldrneh r0,[%0],#2\n" \
" strneh r0,[%1,%2]\n" \
" tst %3,#1\n" \
" ldrneb r0,[%0],#1\n" \
" strneb r0,[%1,%2]\n" \
"3:\n" \
: "+r"(pDst) : "r"(pRegs), "i"(DAVINCI_MMCDXR), \
"r"(cnt) : "r0", "r1", "r2", "r3");
/* PIO only */
static void mmc_davinci_sg_to_buf(struct mmc_davinci_host *host)
......@@ -321,11 +307,11 @@ static void davinci_fifo_data_trans(struct mmc_davinci_host *host, int n)
host->buffer_bytes_left -= n;
host->bytes_left -= n;
if (host->data_dir == DAVINCI_MMC_DATADIR_WRITE)
davinci_mmc_write_fifo(host, n, p);
else
davinci_mmc_read_fifo(host, n, p);
if (host->data_dir == DAVINCI_MMC_DATADIR_WRITE) {
DAVINCI_MMCSD_WRITE_FIFO(p, host->base, n);
} else {
DAVINCI_MMCSD_READ_FIFO(p, host->base, n);
}
host->buffer = p;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment