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,
if (host_status & TIFM_MMCSD_ERRMASK) {
if (host_status & TIFM_MMCSD_CERR)
error_code = MMC_ERR_FAILED;
else if (host_status &
(TIFM_MMCSD_CTO | TIFM_MMCSD_DTO))
else if (host_status
& (TIFM_MMCSD_CTO | TIFM_MMCSD_DTO))
error_code = MMC_ERR_TIMEOUT;
else if (host_status &
(TIFM_MMCSD_CCRC | TIFM_MMCSD_DCRC))
else if (host_status
& (TIFM_MMCSD_CCRC | TIFM_MMCSD_DCRC))
error_code = MMC_ERR_BADCRC;
writel(TIFM_FIFO_INT_SETALL,
......@@ -382,8 +382,8 @@ static unsigned int tifm_sd_signal_irq(struct tifm_dev *sock,
if (host_status & TIFM_MMCSD_CB)
host->flags |= CARD_BUSY;
if ((host_status & TIFM_MMCSD_EOFB) &&
(host->flags & CARD_BUSY)) {
if ((host_status & TIFM_MMCSD_EOFB)
&& (host->flags & CARD_BUSY)) {
host->written_blocks++;
host->flags &= ~CARD_BUSY;
}
......@@ -398,13 +398,14 @@ done:
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;
/* DMA style IO */
dev_dbg(&sock->dev, "setting dma for %d blocks\n",
cmd->data->blocks);
writel(TIFM_FIFO_INT_SETALL,
sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR);
writel(ilog2(cmd->data->blksz) - 2,
......@@ -448,7 +449,7 @@ static void tifm_sd_set_data_timeout(struct tifm_sd *host,
sock->addr + SOCK_MMCSD_SDIO_MODE_CONFIG);
} else {
data_timeout = (data_timeout >> 10) + 1;
if(data_timeout > 0xffff)
if (data_timeout > 0xffff)
data_timeout = 0; /* set to unlimited */
writel(data_timeout, sock->addr + SOCK_MMCSD_DATA_TO);
writel(TIFM_MMCSD_DPE
......@@ -539,8 +540,8 @@ static void tifm_sd_end_cmd(unsigned long data)
r_data = mrq->cmd->data;
if (r_data) {
if (r_data->flags & MMC_DATA_WRITE) {
r_data->bytes_xfered = host->written_blocks *
r_data->blksz;
r_data->bytes_xfered = host->written_blocks
* r_data->blksz;
} else {
r_data->bytes_xfered = r_data->blocks -
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)
if (r_data) {
tifm_sd_set_data_timeout(host, r_data);
host->buffer_size = mrq->cmd->data->blocks *
mrq->cmd->data->blksz;
host->buffer_size = mrq->cmd->data->blocks
* mrq->cmd->data->blksz;
writel(TIFM_MMCSD_BUFINT |
readl(sock->addr + SOCK_MMCSD_INT_ENABLE),
writel(TIFM_MMCSD_BUFINT
| readl(sock->addr + SOCK_MMCSD_INT_ENABLE),
sock->addr + SOCK_MMCSD_INT_ENABLE);
writel(((TIFM_MMCSD_FIFO_SIZE - 1) << 8) |
(TIFM_MMCSD_FIFO_SIZE - 1),
writel(((TIFM_MMCSD_FIFO_SIZE - 1) << 8)
| (TIFM_MMCSD_FIFO_SIZE - 1),
sock->addr + SOCK_MMCSD_BUFFER_CONFIG);
host->written_blocks = 0;
......@@ -642,8 +643,8 @@ static void tifm_sd_end_cmd_nodma(unsigned long data)
sock->addr + SOCK_MMCSD_INT_ENABLE);
if (r_data->flags & MMC_DATA_WRITE) {
r_data->bytes_xfered = host->written_blocks *
r_data->blksz;
r_data->bytes_xfered = host->written_blocks
* r_data->blksz;
} else {
r_data->bytes_xfered = r_data->blocks -
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)
writel(TIFM_MMCSD_4BBUS | readl(sock->addr + SOCK_MMCSD_CONFIG),
sock->addr + SOCK_MMCSD_CONFIG);
} else {
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);
}
......@@ -728,22 +729,23 @@ static void tifm_sd_ios(struct mmc_host *mmc, struct mmc_ios *ios)
if ((20000000 / clk_div1) > (24000000 / clk_div2)) {
host->clk_freq = 20000000;
host->clk_div = clk_div1;
writel((~TIFM_CTRL_FAST_CLK) &
readl(sock->addr + SOCK_CONTROL),
writel((~TIFM_CTRL_FAST_CLK)
& readl(sock->addr + SOCK_CONTROL),
sock->addr + SOCK_CONTROL);
} else {
host->clk_freq = 24000000;
host->clk_div = clk_div2;
writel(TIFM_CTRL_FAST_CLK |
readl(sock->addr + SOCK_CONTROL),
writel(TIFM_CTRL_FAST_CLK
| readl(sock->addr + SOCK_CONTROL),
sock->addr + SOCK_CONTROL);
}
} else {
host->clk_div = 0;
}
host->clk_div &= TIFM_MMCSD_CLKMASK;
writel(host->clk_div | ((~TIFM_MMCSD_CLKMASK) &
readl(sock->addr + SOCK_MMCSD_CONFIG)),
writel(host->clk_div
| ((~TIFM_MMCSD_CLKMASK)
& readl(sock->addr + SOCK_MMCSD_CONFIG)),
sock->addr + SOCK_MMCSD_CONFIG);
if (ios->bus_mode == MMC_BUSMODE_OPENDRAIN)
......@@ -855,8 +857,8 @@ static int tifm_sd_probe(struct tifm_dev *sock)
struct tifm_sd *host;
int rc = -EIO;
if (!(TIFM_SOCK_STATE_OCCUPIED &
readl(sock->addr + SOCK_PRESENT_STATE))) {
if (!(TIFM_SOCK_STATE_OCCUPIED
& readl(sock->addr + SOCK_PRESENT_STATE))) {
printk(KERN_WARNING DRIVER_NAME ": card gone, unexpectedly\n");
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