Commit 2e8ce5e7 authored by Alex Dubov's avatar Alex Dubov Committed by Pierre Ossman

tifm_sd: prettify

This patch introduces no semantic changes - it is here for estetic purposes.
Signed-off-by: default avatarAlex Dubov <oakad@yahoo.com>
Signed-off-by: default avatarPierre Ossman <drzeus@drzeus.cx>
parent 8e02f858
...@@ -350,11 +350,11 @@ static unsigned int tifm_sd_signal_irq(struct tifm_dev *sock, ...@@ -350,11 +350,11 @@ static unsigned int tifm_sd_signal_irq(struct tifm_dev *sock,
if (host_status & TIFM_MMCSD_ERRMASK) { if (host_status & TIFM_MMCSD_ERRMASK) {
if (host_status & TIFM_MMCSD_CERR) if (host_status & TIFM_MMCSD_CERR)
error_code = MMC_ERR_FAILED; error_code = MMC_ERR_FAILED;
else if (host_status & else if (host_status
(TIFM_MMCSD_CTO | TIFM_MMCSD_DTO)) & (TIFM_MMCSD_CTO | TIFM_MMCSD_DTO))
error_code = MMC_ERR_TIMEOUT; error_code = MMC_ERR_TIMEOUT;
else if (host_status & else if (host_status
(TIFM_MMCSD_CCRC | TIFM_MMCSD_DCRC)) & (TIFM_MMCSD_CCRC | TIFM_MMCSD_DCRC))
error_code = MMC_ERR_BADCRC; error_code = MMC_ERR_BADCRC;
writel(TIFM_FIFO_INT_SETALL, writel(TIFM_FIFO_INT_SETALL,
...@@ -382,8 +382,8 @@ static unsigned int tifm_sd_signal_irq(struct tifm_dev *sock, ...@@ -382,8 +382,8 @@ static unsigned int tifm_sd_signal_irq(struct tifm_dev *sock,
if (host_status & TIFM_MMCSD_CB) if (host_status & TIFM_MMCSD_CB)
host->flags |= CARD_BUSY; host->flags |= CARD_BUSY;
if ((host_status & TIFM_MMCSD_EOFB) && if ((host_status & TIFM_MMCSD_EOFB)
(host->flags & CARD_BUSY)) { && (host->flags & CARD_BUSY)) {
host->written_blocks++; host->written_blocks++;
host->flags &= ~CARD_BUSY; host->flags &= ~CARD_BUSY;
} }
...@@ -398,13 +398,14 @@ done: ...@@ -398,13 +398,14 @@ done:
return sock_irq_status; return sock_irq_status;
} }
static void tifm_sd_prepare_data(struct tifm_sd *card, struct mmc_command *cmd) static void tifm_sd_prepare_data(struct tifm_sd *host, struct mmc_command *cmd)
{ {
struct tifm_dev *sock = card->dev; struct tifm_dev *sock = host->dev;
unsigned int dest_cnt; unsigned int dest_cnt;
/* DMA style IO */ /* DMA style IO */
dev_dbg(&sock->dev, "setting dma for %d blocks\n",
cmd->data->blocks);
writel(TIFM_FIFO_INT_SETALL, writel(TIFM_FIFO_INT_SETALL,
sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR); sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR);
writel(ilog2(cmd->data->blksz) - 2, writel(ilog2(cmd->data->blksz) - 2,
...@@ -448,7 +449,7 @@ static void tifm_sd_set_data_timeout(struct tifm_sd *host, ...@@ -448,7 +449,7 @@ static void tifm_sd_set_data_timeout(struct tifm_sd *host,
sock->addr + SOCK_MMCSD_SDIO_MODE_CONFIG); sock->addr + SOCK_MMCSD_SDIO_MODE_CONFIG);
} else { } else {
data_timeout = (data_timeout >> 10) + 1; data_timeout = (data_timeout >> 10) + 1;
if(data_timeout > 0xffff) if (data_timeout > 0xffff)
data_timeout = 0; /* set to unlimited */ data_timeout = 0; /* set to unlimited */
writel(data_timeout, sock->addr + SOCK_MMCSD_DATA_TO); writel(data_timeout, sock->addr + SOCK_MMCSD_DATA_TO);
writel(TIFM_MMCSD_DPE writel(TIFM_MMCSD_DPE
...@@ -539,8 +540,8 @@ static void tifm_sd_end_cmd(unsigned long data) ...@@ -539,8 +540,8 @@ static void tifm_sd_end_cmd(unsigned long data)
r_data = mrq->cmd->data; r_data = mrq->cmd->data;
if (r_data) { if (r_data) {
if (r_data->flags & MMC_DATA_WRITE) { if (r_data->flags & MMC_DATA_WRITE) {
r_data->bytes_xfered = host->written_blocks * r_data->bytes_xfered = host->written_blocks
r_data->blksz; * r_data->blksz;
} else { } else {
r_data->bytes_xfered = r_data->blocks - r_data->bytes_xfered = r_data->blocks -
readl(sock->addr + SOCK_MMCSD_NUM_BLOCKS) - 1; readl(sock->addr + SOCK_MMCSD_NUM_BLOCKS) - 1;
...@@ -582,14 +583,14 @@ static void tifm_sd_request_nodma(struct mmc_host *mmc, struct mmc_request *mrq) ...@@ -582,14 +583,14 @@ static void tifm_sd_request_nodma(struct mmc_host *mmc, struct mmc_request *mrq)
if (r_data) { if (r_data) {
tifm_sd_set_data_timeout(host, r_data); tifm_sd_set_data_timeout(host, r_data);
host->buffer_size = mrq->cmd->data->blocks * host->buffer_size = mrq->cmd->data->blocks
mrq->cmd->data->blksz; * mrq->cmd->data->blksz;
writel(TIFM_MMCSD_BUFINT | writel(TIFM_MMCSD_BUFINT
readl(sock->addr + SOCK_MMCSD_INT_ENABLE), | readl(sock->addr + SOCK_MMCSD_INT_ENABLE),
sock->addr + SOCK_MMCSD_INT_ENABLE); sock->addr + SOCK_MMCSD_INT_ENABLE);
writel(((TIFM_MMCSD_FIFO_SIZE - 1) << 8) | writel(((TIFM_MMCSD_FIFO_SIZE - 1) << 8)
(TIFM_MMCSD_FIFO_SIZE - 1), | (TIFM_MMCSD_FIFO_SIZE - 1),
sock->addr + SOCK_MMCSD_BUFFER_CONFIG); sock->addr + SOCK_MMCSD_BUFFER_CONFIG);
host->written_blocks = 0; host->written_blocks = 0;
...@@ -642,8 +643,8 @@ static void tifm_sd_end_cmd_nodma(unsigned long data) ...@@ -642,8 +643,8 @@ static void tifm_sd_end_cmd_nodma(unsigned long data)
sock->addr + SOCK_MMCSD_INT_ENABLE); sock->addr + SOCK_MMCSD_INT_ENABLE);
if (r_data->flags & MMC_DATA_WRITE) { if (r_data->flags & MMC_DATA_WRITE) {
r_data->bytes_xfered = host->written_blocks * r_data->bytes_xfered = host->written_blocks
r_data->blksz; * r_data->blksz;
} else { } else {
r_data->bytes_xfered = r_data->blocks - r_data->bytes_xfered = r_data->blocks -
readl(sock->addr + SOCK_MMCSD_NUM_BLOCKS) - 1; readl(sock->addr + SOCK_MMCSD_NUM_BLOCKS) - 1;
...@@ -707,8 +708,8 @@ static void tifm_sd_ios(struct mmc_host *mmc, struct mmc_ios *ios) ...@@ -707,8 +708,8 @@ static void tifm_sd_ios(struct mmc_host *mmc, struct mmc_ios *ios)
writel(TIFM_MMCSD_4BBUS | readl(sock->addr + SOCK_MMCSD_CONFIG), writel(TIFM_MMCSD_4BBUS | readl(sock->addr + SOCK_MMCSD_CONFIG),
sock->addr + SOCK_MMCSD_CONFIG); sock->addr + SOCK_MMCSD_CONFIG);
} else { } else {
writel((~TIFM_MMCSD_4BBUS) & writel((~TIFM_MMCSD_4BBUS)
readl(sock->addr + SOCK_MMCSD_CONFIG), & readl(sock->addr + SOCK_MMCSD_CONFIG),
sock->addr + SOCK_MMCSD_CONFIG); sock->addr + SOCK_MMCSD_CONFIG);
} }
...@@ -728,22 +729,23 @@ static void tifm_sd_ios(struct mmc_host *mmc, struct mmc_ios *ios) ...@@ -728,22 +729,23 @@ static void tifm_sd_ios(struct mmc_host *mmc, struct mmc_ios *ios)
if ((20000000 / clk_div1) > (24000000 / clk_div2)) { if ((20000000 / clk_div1) > (24000000 / clk_div2)) {
host->clk_freq = 20000000; host->clk_freq = 20000000;
host->clk_div = clk_div1; host->clk_div = clk_div1;
writel((~TIFM_CTRL_FAST_CLK) & writel((~TIFM_CTRL_FAST_CLK)
readl(sock->addr + SOCK_CONTROL), & readl(sock->addr + SOCK_CONTROL),
sock->addr + SOCK_CONTROL); sock->addr + SOCK_CONTROL);
} else { } else {
host->clk_freq = 24000000; host->clk_freq = 24000000;
host->clk_div = clk_div2; host->clk_div = clk_div2;
writel(TIFM_CTRL_FAST_CLK | writel(TIFM_CTRL_FAST_CLK
readl(sock->addr + SOCK_CONTROL), | readl(sock->addr + SOCK_CONTROL),
sock->addr + SOCK_CONTROL); sock->addr + SOCK_CONTROL);
} }
} else { } else {
host->clk_div = 0; host->clk_div = 0;
} }
host->clk_div &= TIFM_MMCSD_CLKMASK; host->clk_div &= TIFM_MMCSD_CLKMASK;
writel(host->clk_div | ((~TIFM_MMCSD_CLKMASK) & writel(host->clk_div
readl(sock->addr + SOCK_MMCSD_CONFIG)), | ((~TIFM_MMCSD_CLKMASK)
& readl(sock->addr + SOCK_MMCSD_CONFIG)),
sock->addr + SOCK_MMCSD_CONFIG); sock->addr + SOCK_MMCSD_CONFIG);
if (ios->bus_mode == MMC_BUSMODE_OPENDRAIN) if (ios->bus_mode == MMC_BUSMODE_OPENDRAIN)
...@@ -855,8 +857,8 @@ static int tifm_sd_probe(struct tifm_dev *sock) ...@@ -855,8 +857,8 @@ static int tifm_sd_probe(struct tifm_dev *sock)
struct tifm_sd *host; struct tifm_sd *host;
int rc = -EIO; int rc = -EIO;
if (!(TIFM_SOCK_STATE_OCCUPIED & if (!(TIFM_SOCK_STATE_OCCUPIED
readl(sock->addr + SOCK_PRESENT_STATE))) { & readl(sock->addr + SOCK_PRESENT_STATE))) {
printk(KERN_WARNING DRIVER_NAME ": card gone, unexpectedly\n"); printk(KERN_WARNING DRIVER_NAME ": card gone, unexpectedly\n");
return rc; return rc;
} }
......
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