mmc: atmel-mci: change atmci_readl and atmci_writel macros
Change atmci_readl and atmci_writel macros: remove string concatenation. We can use these macros with registers which are not prefixed by ATMCI_. This is the case if we want to write PDC registers which are common to several devices so they are not prefixed with ATMCI_. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Chris Ball <cjb@laptop.org>
This commit is contained in:
parent
2c96a293bb
commit
03fc9a7f0c
@ -121,8 +121,8 @@
|
|||||||
|
|
||||||
/* Register access macros */
|
/* Register access macros */
|
||||||
#define atmci_readl(port,reg) \
|
#define atmci_readl(port,reg) \
|
||||||
__raw_readl((port)->regs + ATMCI_##reg)
|
__raw_readl((port)->regs + reg)
|
||||||
#define atmci_writel(port,reg,value) \
|
#define atmci_writel(port,reg,value) \
|
||||||
__raw_writel((value), (port)->regs + ATMCI_##reg)
|
__raw_writel((value), (port)->regs + reg)
|
||||||
|
|
||||||
#endif /* __DRIVERS_MMC_ATMEL_MCI_H__ */
|
#endif /* __DRIVERS_MMC_ATMEL_MCI_H__ */
|
||||||
|
@ -499,7 +499,7 @@ static void atmci_set_timeout(struct atmel_mci *host,
|
|||||||
|
|
||||||
dev_vdbg(&slot->mmc->class_dev, "setting timeout to %u cycles\n",
|
dev_vdbg(&slot->mmc->class_dev, "setting timeout to %u cycles\n",
|
||||||
dtocyc << dtomul_to_shift[dtomul]);
|
dtocyc << dtomul_to_shift[dtomul]);
|
||||||
atmci_writel(host, DTOR, (ATMCI_DTOMUL(dtomul) | ATMCI_DTOCYC(dtocyc)));
|
atmci_writel(host, ATMCI_DTOR, (ATMCI_DTOMUL(dtomul) | ATMCI_DTOCYC(dtocyc)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -564,14 +564,14 @@ static void atmci_start_command(struct atmel_mci *host,
|
|||||||
"start command: ARGR=0x%08x CMDR=0x%08x\n",
|
"start command: ARGR=0x%08x CMDR=0x%08x\n",
|
||||||
cmd->arg, cmd_flags);
|
cmd->arg, cmd_flags);
|
||||||
|
|
||||||
atmci_writel(host, ARGR, cmd->arg);
|
atmci_writel(host, ATMCI_ARGR, cmd->arg);
|
||||||
atmci_writel(host, CMDR, cmd_flags);
|
atmci_writel(host, ATMCI_CMDR, cmd_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void atmci_send_stop_cmd(struct atmel_mci *host, struct mmc_data *data)
|
static void atmci_send_stop_cmd(struct atmel_mci *host, struct mmc_data *data)
|
||||||
{
|
{
|
||||||
atmci_start_command(host, data->stop, host->stop_cmdr);
|
atmci_start_command(host, data->stop, host->stop_cmdr);
|
||||||
atmci_writel(host, IER, ATMCI_CMDRDY);
|
atmci_writel(host, ATMCI_IER, ATMCI_CMDRDY);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_MMC_ATMELMCI_DMA
|
#ifdef CONFIG_MMC_ATMELMCI_DMA
|
||||||
@ -596,7 +596,7 @@ static void atmci_stop_dma(struct atmel_mci *host)
|
|||||||
} else {
|
} else {
|
||||||
/* Data transfer was stopped by the interrupt handler */
|
/* Data transfer was stopped by the interrupt handler */
|
||||||
atmci_set_pending(host, EVENT_XFER_COMPLETE);
|
atmci_set_pending(host, EVENT_XFER_COMPLETE);
|
||||||
atmci_writel(host, IER, ATMCI_NOTBUSY);
|
atmci_writel(host, ATMCI_IER, ATMCI_NOTBUSY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -610,7 +610,7 @@ static void atmci_dma_complete(void *arg)
|
|||||||
|
|
||||||
if (atmci_is_mci2())
|
if (atmci_is_mci2())
|
||||||
/* Disable DMA hardware handshaking on MCI */
|
/* Disable DMA hardware handshaking on MCI */
|
||||||
atmci_writel(host, DMA, atmci_readl(host, DMA) & ~ATMCI_DMAEN);
|
atmci_writel(host, ATMCI_DMA, atmci_readl(host, ATMCI_DMA) & ~ATMCI_DMAEN);
|
||||||
|
|
||||||
atmci_dma_cleanup(host);
|
atmci_dma_cleanup(host);
|
||||||
|
|
||||||
@ -642,7 +642,7 @@ static void atmci_dma_complete(void *arg)
|
|||||||
* completion callback" rule of the dma engine
|
* completion callback" rule of the dma engine
|
||||||
* framework.
|
* framework.
|
||||||
*/
|
*/
|
||||||
atmci_writel(host, IER, ATMCI_NOTBUSY);
|
atmci_writel(host, ATMCI_IER, ATMCI_NOTBUSY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -680,7 +680,7 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
if (atmci_is_mci2())
|
if (atmci_is_mci2())
|
||||||
atmci_writel(host, DMA, ATMCI_DMA_CHKSIZE(3) | ATMCI_DMAEN);
|
atmci_writel(host, ATMCI_DMA, ATMCI_DMA_CHKSIZE(3) | ATMCI_DMAEN);
|
||||||
|
|
||||||
if (data->flags & MMC_DATA_READ)
|
if (data->flags & MMC_DATA_READ)
|
||||||
direction = DMA_FROM_DEVICE;
|
direction = DMA_FROM_DEVICE;
|
||||||
@ -730,7 +730,7 @@ static void atmci_stop_dma(struct atmel_mci *host)
|
|||||||
{
|
{
|
||||||
/* Data transfer was stopped by the interrupt handler */
|
/* Data transfer was stopped by the interrupt handler */
|
||||||
atmci_set_pending(host, EVENT_XFER_COMPLETE);
|
atmci_set_pending(host, EVENT_XFER_COMPLETE);
|
||||||
atmci_writel(host, IER, ATMCI_NOTBUSY);
|
atmci_writel(host, ATMCI_IER, ATMCI_NOTBUSY);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_MMC_ATMELMCI_DMA */
|
#endif /* CONFIG_MMC_ATMELMCI_DMA */
|
||||||
@ -793,24 +793,24 @@ static void atmci_start_request(struct atmel_mci *host,
|
|||||||
host->data_status = 0;
|
host->data_status = 0;
|
||||||
|
|
||||||
if (host->need_reset) {
|
if (host->need_reset) {
|
||||||
atmci_writel(host, CR, ATMCI_CR_SWRST);
|
atmci_writel(host, ATMCI_CR, ATMCI_CR_SWRST);
|
||||||
atmci_writel(host, CR, ATMCI_CR_MCIEN);
|
atmci_writel(host, ATMCI_CR, ATMCI_CR_MCIEN);
|
||||||
atmci_writel(host, MR, host->mode_reg);
|
atmci_writel(host, ATMCI_MR, host->mode_reg);
|
||||||
if (atmci_is_mci2())
|
if (atmci_is_mci2())
|
||||||
atmci_writel(host, CFG, host->cfg_reg);
|
atmci_writel(host, ATMCI_CFG, host->cfg_reg);
|
||||||
host->need_reset = false;
|
host->need_reset = false;
|
||||||
}
|
}
|
||||||
atmci_writel(host, SDCR, slot->sdc_reg);
|
atmci_writel(host, ATMCI_SDCR, slot->sdc_reg);
|
||||||
|
|
||||||
iflags = atmci_readl(host, IMR);
|
iflags = atmci_readl(host, ATMCI_IMR);
|
||||||
if (iflags & ~(ATMCI_SDIOIRQA | ATMCI_SDIOIRQB))
|
if (iflags & ~(ATMCI_SDIOIRQA | ATMCI_SDIOIRQB))
|
||||||
dev_warn(&slot->mmc->class_dev, "WARNING: IMR=0x%08x\n",
|
dev_warn(&slot->mmc->class_dev, "WARNING: IMR=0x%08x\n",
|
||||||
iflags);
|
iflags);
|
||||||
|
|
||||||
if (unlikely(test_and_clear_bit(ATMCI_CARD_NEED_INIT, &slot->flags))) {
|
if (unlikely(test_and_clear_bit(ATMCI_CARD_NEED_INIT, &slot->flags))) {
|
||||||
/* Send init sequence (74 clock cycles) */
|
/* Send init sequence (74 clock cycles) */
|
||||||
atmci_writel(host, CMDR, ATMCI_CMDR_SPCMD_INIT);
|
atmci_writel(host, ATMCI_CMDR, ATMCI_CMDR_SPCMD_INIT);
|
||||||
while (!(atmci_readl(host, SR) & ATMCI_CMDRDY))
|
while (!(atmci_readl(host, ATMCI_SR) & ATMCI_CMDRDY))
|
||||||
cpu_relax();
|
cpu_relax();
|
||||||
}
|
}
|
||||||
iflags = 0;
|
iflags = 0;
|
||||||
@ -819,7 +819,7 @@ static void atmci_start_request(struct atmel_mci *host,
|
|||||||
atmci_set_timeout(host, slot, data);
|
atmci_set_timeout(host, slot, data);
|
||||||
|
|
||||||
/* Must set block count/size before sending command */
|
/* Must set block count/size before sending command */
|
||||||
atmci_writel(host, BLKR, ATMCI_BCNT(data->blocks)
|
atmci_writel(host, ATMCI_BLKR, ATMCI_BCNT(data->blocks)
|
||||||
| ATMCI_BLKLEN(data->blksz));
|
| ATMCI_BLKLEN(data->blksz));
|
||||||
dev_vdbg(&slot->mmc->class_dev, "BLKR=0x%08x\n",
|
dev_vdbg(&slot->mmc->class_dev, "BLKR=0x%08x\n",
|
||||||
ATMCI_BCNT(data->blocks) | ATMCI_BLKLEN(data->blksz));
|
ATMCI_BCNT(data->blocks) | ATMCI_BLKLEN(data->blksz));
|
||||||
@ -852,7 +852,7 @@ static void atmci_start_request(struct atmel_mci *host,
|
|||||||
* conditions (e.g. command and data complete, but stop not
|
* conditions (e.g. command and data complete, but stop not
|
||||||
* prepared yet.)
|
* prepared yet.)
|
||||||
*/
|
*/
|
||||||
atmci_writel(host, IER, iflags);
|
atmci_writel(host, ATMCI_IER, iflags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void atmci_queue_request(struct atmel_mci *host,
|
static void atmci_queue_request(struct atmel_mci *host,
|
||||||
@ -927,10 +927,10 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
|
|||||||
spin_lock_bh(&host->lock);
|
spin_lock_bh(&host->lock);
|
||||||
if (!host->mode_reg) {
|
if (!host->mode_reg) {
|
||||||
clk_enable(host->mck);
|
clk_enable(host->mck);
|
||||||
atmci_writel(host, CR, ATMCI_CR_SWRST);
|
atmci_writel(host, ATMCI_CR, ATMCI_CR_SWRST);
|
||||||
atmci_writel(host, CR, ATMCI_CR_MCIEN);
|
atmci_writel(host, ATMCI_CR, ATMCI_CR_MCIEN);
|
||||||
if (atmci_is_mci2())
|
if (atmci_is_mci2())
|
||||||
atmci_writel(host, CFG, host->cfg_reg);
|
atmci_writel(host, ATMCI_CFG, host->cfg_reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -972,9 +972,9 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (list_empty(&host->queue)) {
|
if (list_empty(&host->queue)) {
|
||||||
atmci_writel(host, MR, host->mode_reg);
|
atmci_writel(host, ATMCI_MR, host->mode_reg);
|
||||||
if (atmci_is_mci2())
|
if (atmci_is_mci2())
|
||||||
atmci_writel(host, CFG, host->cfg_reg);
|
atmci_writel(host, ATMCI_CFG, host->cfg_reg);
|
||||||
} else {
|
} else {
|
||||||
host->need_clock_update = true;
|
host->need_clock_update = true;
|
||||||
}
|
}
|
||||||
@ -992,9 +992,9 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!any_slot_active) {
|
if (!any_slot_active) {
|
||||||
atmci_writel(host, CR, ATMCI_CR_MCIDIS);
|
atmci_writel(host, ATMCI_CR, ATMCI_CR_MCIDIS);
|
||||||
if (host->mode_reg) {
|
if (host->mode_reg) {
|
||||||
atmci_readl(host, MR);
|
atmci_readl(host, ATMCI_MR);
|
||||||
clk_disable(host->mck);
|
clk_disable(host->mck);
|
||||||
}
|
}
|
||||||
host->mode_reg = 0;
|
host->mode_reg = 0;
|
||||||
@ -1058,9 +1058,9 @@ static void atmci_enable_sdio_irq(struct mmc_host *mmc, int enable)
|
|||||||
struct atmel_mci *host = slot->host;
|
struct atmel_mci *host = slot->host;
|
||||||
|
|
||||||
if (enable)
|
if (enable)
|
||||||
atmci_writel(host, IER, slot->sdio_irq);
|
atmci_writel(host, ATMCI_IER, slot->sdio_irq);
|
||||||
else
|
else
|
||||||
atmci_writel(host, IDR, slot->sdio_irq);
|
atmci_writel(host, ATMCI_IDR, slot->sdio_irq);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct mmc_host_ops atmci_ops = {
|
static const struct mmc_host_ops atmci_ops = {
|
||||||
@ -1087,9 +1087,9 @@ static void atmci_request_end(struct atmel_mci *host, struct mmc_request *mrq)
|
|||||||
* busy transferring data.
|
* busy transferring data.
|
||||||
*/
|
*/
|
||||||
if (host->need_clock_update) {
|
if (host->need_clock_update) {
|
||||||
atmci_writel(host, MR, host->mode_reg);
|
atmci_writel(host, ATMCI_MR, host->mode_reg);
|
||||||
if (atmci_is_mci2())
|
if (atmci_is_mci2())
|
||||||
atmci_writel(host, CFG, host->cfg_reg);
|
atmci_writel(host, ATMCI_CFG, host->cfg_reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
host->cur_slot->mrq = NULL;
|
host->cur_slot->mrq = NULL;
|
||||||
@ -1118,10 +1118,10 @@ static void atmci_command_complete(struct atmel_mci *host,
|
|||||||
u32 status = host->cmd_status;
|
u32 status = host->cmd_status;
|
||||||
|
|
||||||
/* Read the response from the card (up to 16 bytes) */
|
/* Read the response from the card (up to 16 bytes) */
|
||||||
cmd->resp[0] = atmci_readl(host, RSPR);
|
cmd->resp[0] = atmci_readl(host, ATMCI_RSPR);
|
||||||
cmd->resp[1] = atmci_readl(host, RSPR);
|
cmd->resp[1] = atmci_readl(host, ATMCI_RSPR);
|
||||||
cmd->resp[2] = atmci_readl(host, RSPR);
|
cmd->resp[2] = atmci_readl(host, ATMCI_RSPR);
|
||||||
cmd->resp[3] = atmci_readl(host, RSPR);
|
cmd->resp[3] = atmci_readl(host, ATMCI_RSPR);
|
||||||
|
|
||||||
if (status & ATMCI_RTOE)
|
if (status & ATMCI_RTOE)
|
||||||
cmd->error = -ETIMEDOUT;
|
cmd->error = -ETIMEDOUT;
|
||||||
@ -1139,7 +1139,7 @@ static void atmci_command_complete(struct atmel_mci *host,
|
|||||||
if (cmd->data) {
|
if (cmd->data) {
|
||||||
atmci_stop_dma(host);
|
atmci_stop_dma(host);
|
||||||
host->data = NULL;
|
host->data = NULL;
|
||||||
atmci_writel(host, IDR, ATMCI_NOTBUSY
|
atmci_writel(host, ATMCI_IDR, ATMCI_NOTBUSY
|
||||||
| ATMCI_TXRDY | ATMCI_RXRDY
|
| ATMCI_TXRDY | ATMCI_RXRDY
|
||||||
| ATMCI_DATA_ERROR_FLAGS);
|
| ATMCI_DATA_ERROR_FLAGS);
|
||||||
}
|
}
|
||||||
@ -1192,11 +1192,11 @@ static void atmci_detect_change(unsigned long data)
|
|||||||
* Reset controller to terminate any ongoing
|
* Reset controller to terminate any ongoing
|
||||||
* commands or data transfers.
|
* commands or data transfers.
|
||||||
*/
|
*/
|
||||||
atmci_writel(host, CR, ATMCI_CR_SWRST);
|
atmci_writel(host, ATMCI_CR, ATMCI_CR_SWRST);
|
||||||
atmci_writel(host, CR, ATMCI_CR_MCIEN);
|
atmci_writel(host, ATMCI_CR, ATMCI_CR_MCIEN);
|
||||||
atmci_writel(host, MR, host->mode_reg);
|
atmci_writel(host, ATMCI_MR, host->mode_reg);
|
||||||
if (atmci_is_mci2())
|
if (atmci_is_mci2())
|
||||||
atmci_writel(host, CFG, host->cfg_reg);
|
atmci_writel(host, ATMCI_CFG, host->cfg_reg);
|
||||||
|
|
||||||
host->data = NULL;
|
host->data = NULL;
|
||||||
host->cmd = NULL;
|
host->cmd = NULL;
|
||||||
@ -1262,7 +1262,7 @@ static void atmci_tasklet_func(unsigned long priv)
|
|||||||
dev_vdbg(&host->pdev->dev,
|
dev_vdbg(&host->pdev->dev,
|
||||||
"tasklet: state %u pending/completed/mask %lx/%lx/%x\n",
|
"tasklet: state %u pending/completed/mask %lx/%lx/%x\n",
|
||||||
state, host->pending_events, host->completed_events,
|
state, host->pending_events, host->completed_events,
|
||||||
atmci_readl(host, IMR));
|
atmci_readl(host, ATMCI_IMR));
|
||||||
|
|
||||||
do {
|
do {
|
||||||
prev_state = state;
|
prev_state = state;
|
||||||
@ -1331,7 +1331,7 @@ static void atmci_tasklet_func(unsigned long priv)
|
|||||||
} else {
|
} else {
|
||||||
data->bytes_xfered = data->blocks * data->blksz;
|
data->bytes_xfered = data->blocks * data->blksz;
|
||||||
data->error = 0;
|
data->error = 0;
|
||||||
atmci_writel(host, IDR, ATMCI_DATA_ERROR_FLAGS);
|
atmci_writel(host, ATMCI_IDR, ATMCI_DATA_ERROR_FLAGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!data->stop) {
|
if (!data->stop) {
|
||||||
@ -1381,7 +1381,7 @@ static void atmci_read_data_pio(struct atmel_mci *host)
|
|||||||
unsigned int nbytes = 0;
|
unsigned int nbytes = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
value = atmci_readl(host, RDR);
|
value = atmci_readl(host, ATMCI_RDR);
|
||||||
if (likely(offset + 4 <= sg->length)) {
|
if (likely(offset + 4 <= sg->length)) {
|
||||||
put_unaligned(value, (u32 *)(buf + offset));
|
put_unaligned(value, (u32 *)(buf + offset));
|
||||||
|
|
||||||
@ -1413,9 +1413,9 @@ static void atmci_read_data_pio(struct atmel_mci *host)
|
|||||||
nbytes += offset;
|
nbytes += offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = atmci_readl(host, SR);
|
status = atmci_readl(host, ATMCI_SR);
|
||||||
if (status & ATMCI_DATA_ERROR_FLAGS) {
|
if (status & ATMCI_DATA_ERROR_FLAGS) {
|
||||||
atmci_writel(host, IDR, (ATMCI_NOTBUSY | ATMCI_RXRDY
|
atmci_writel(host, ATMCI_IDR, (ATMCI_NOTBUSY | ATMCI_RXRDY
|
||||||
| ATMCI_DATA_ERROR_FLAGS));
|
| ATMCI_DATA_ERROR_FLAGS));
|
||||||
host->data_status = status;
|
host->data_status = status;
|
||||||
data->bytes_xfered += nbytes;
|
data->bytes_xfered += nbytes;
|
||||||
@ -1432,8 +1432,8 @@ static void atmci_read_data_pio(struct atmel_mci *host)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
atmci_writel(host, IDR, ATMCI_RXRDY);
|
atmci_writel(host, ATMCI_IDR, ATMCI_RXRDY);
|
||||||
atmci_writel(host, IER, ATMCI_NOTBUSY);
|
atmci_writel(host, ATMCI_IER, ATMCI_NOTBUSY);
|
||||||
data->bytes_xfered += nbytes;
|
data->bytes_xfered += nbytes;
|
||||||
smp_wmb();
|
smp_wmb();
|
||||||
atmci_set_pending(host, EVENT_XFER_COMPLETE);
|
atmci_set_pending(host, EVENT_XFER_COMPLETE);
|
||||||
@ -1452,7 +1452,7 @@ static void atmci_write_data_pio(struct atmel_mci *host)
|
|||||||
do {
|
do {
|
||||||
if (likely(offset + 4 <= sg->length)) {
|
if (likely(offset + 4 <= sg->length)) {
|
||||||
value = get_unaligned((u32 *)(buf + offset));
|
value = get_unaligned((u32 *)(buf + offset));
|
||||||
atmci_writel(host, TDR, value);
|
atmci_writel(host, ATMCI_TDR, value);
|
||||||
|
|
||||||
offset += 4;
|
offset += 4;
|
||||||
nbytes += 4;
|
nbytes += 4;
|
||||||
@ -1473,20 +1473,20 @@ static void atmci_write_data_pio(struct atmel_mci *host)
|
|||||||
|
|
||||||
host->sg = sg = sg_next(sg);
|
host->sg = sg = sg_next(sg);
|
||||||
if (!sg) {
|
if (!sg) {
|
||||||
atmci_writel(host, TDR, value);
|
atmci_writel(host, ATMCI_TDR, value);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
offset = 4 - remaining;
|
offset = 4 - remaining;
|
||||||
buf = sg_virt(sg);
|
buf = sg_virt(sg);
|
||||||
memcpy((u8 *)&value + remaining, buf, offset);
|
memcpy((u8 *)&value + remaining, buf, offset);
|
||||||
atmci_writel(host, TDR, value);
|
atmci_writel(host, ATMCI_TDR, value);
|
||||||
nbytes += offset;
|
nbytes += offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = atmci_readl(host, SR);
|
status = atmci_readl(host, ATMCI_SR);
|
||||||
if (status & ATMCI_DATA_ERROR_FLAGS) {
|
if (status & ATMCI_DATA_ERROR_FLAGS) {
|
||||||
atmci_writel(host, IDR, (ATMCI_NOTBUSY | ATMCI_TXRDY
|
atmci_writel(host, ATMCI_IDR, (ATMCI_NOTBUSY | ATMCI_TXRDY
|
||||||
| ATMCI_DATA_ERROR_FLAGS));
|
| ATMCI_DATA_ERROR_FLAGS));
|
||||||
host->data_status = status;
|
host->data_status = status;
|
||||||
data->bytes_xfered += nbytes;
|
data->bytes_xfered += nbytes;
|
||||||
@ -1503,8 +1503,8 @@ static void atmci_write_data_pio(struct atmel_mci *host)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
atmci_writel(host, IDR, ATMCI_TXRDY);
|
atmci_writel(host, ATMCI_IDR, ATMCI_TXRDY);
|
||||||
atmci_writel(host, IER, ATMCI_NOTBUSY);
|
atmci_writel(host, ATMCI_IER, ATMCI_NOTBUSY);
|
||||||
data->bytes_xfered += nbytes;
|
data->bytes_xfered += nbytes;
|
||||||
smp_wmb();
|
smp_wmb();
|
||||||
atmci_set_pending(host, EVENT_XFER_COMPLETE);
|
atmci_set_pending(host, EVENT_XFER_COMPLETE);
|
||||||
@ -1512,7 +1512,7 @@ done:
|
|||||||
|
|
||||||
static void atmci_cmd_interrupt(struct atmel_mci *host, u32 status)
|
static void atmci_cmd_interrupt(struct atmel_mci *host, u32 status)
|
||||||
{
|
{
|
||||||
atmci_writel(host, IDR, ATMCI_CMDRDY);
|
atmci_writel(host, ATMCI_IDR, ATMCI_CMDRDY);
|
||||||
|
|
||||||
host->cmd_status = status;
|
host->cmd_status = status;
|
||||||
smp_wmb();
|
smp_wmb();
|
||||||
@ -1540,16 +1540,16 @@ static irqreturn_t atmci_interrupt(int irq, void *dev_id)
|
|||||||
unsigned int pass_count = 0;
|
unsigned int pass_count = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
status = atmci_readl(host, SR);
|
status = atmci_readl(host, ATMCI_SR);
|
||||||
mask = atmci_readl(host, IMR);
|
mask = atmci_readl(host, ATMCI_IMR);
|
||||||
pending = status & mask;
|
pending = status & mask;
|
||||||
if (!pending)
|
if (!pending)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (pending & ATMCI_DATA_ERROR_FLAGS) {
|
if (pending & ATMCI_DATA_ERROR_FLAGS) {
|
||||||
atmci_writel(host, IDR, ATMCI_DATA_ERROR_FLAGS
|
atmci_writel(host, ATMCI_IDR, ATMCI_DATA_ERROR_FLAGS
|
||||||
| ATMCI_RXRDY | ATMCI_TXRDY);
|
| ATMCI_RXRDY | ATMCI_TXRDY);
|
||||||
pending &= atmci_readl(host, IMR);
|
pending &= atmci_readl(host, ATMCI_IMR);
|
||||||
|
|
||||||
host->data_status = status;
|
host->data_status = status;
|
||||||
smp_wmb();
|
smp_wmb();
|
||||||
@ -1557,7 +1557,7 @@ static irqreturn_t atmci_interrupt(int irq, void *dev_id)
|
|||||||
tasklet_schedule(&host->tasklet);
|
tasklet_schedule(&host->tasklet);
|
||||||
}
|
}
|
||||||
if (pending & ATMCI_NOTBUSY) {
|
if (pending & ATMCI_NOTBUSY) {
|
||||||
atmci_writel(host, IDR,
|
atmci_writel(host, ATMCI_IDR,
|
||||||
ATMCI_DATA_ERROR_FLAGS | ATMCI_NOTBUSY);
|
ATMCI_DATA_ERROR_FLAGS | ATMCI_NOTBUSY);
|
||||||
if (!host->data_status)
|
if (!host->data_status)
|
||||||
host->data_status = status;
|
host->data_status = status;
|
||||||
@ -1790,7 +1790,7 @@ static int __init atmci_probe(struct platform_device *pdev)
|
|||||||
goto err_ioremap;
|
goto err_ioremap;
|
||||||
|
|
||||||
clk_enable(host->mck);
|
clk_enable(host->mck);
|
||||||
atmci_writel(host, CR, ATMCI_CR_SWRST);
|
atmci_writel(host, ATMCI_CR, ATMCI_CR_SWRST);
|
||||||
host->bus_hz = clk_get_rate(host->mck);
|
host->bus_hz = clk_get_rate(host->mck);
|
||||||
clk_disable(host->mck);
|
clk_disable(host->mck);
|
||||||
|
|
||||||
@ -1861,9 +1861,9 @@ static int __exit atmci_remove(struct platform_device *pdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
clk_enable(host->mck);
|
clk_enable(host->mck);
|
||||||
atmci_writel(host, IDR, ~0UL);
|
atmci_writel(host, ATMCI_IDR, ~0UL);
|
||||||
atmci_writel(host, CR, ATMCI_CR_MCIDIS);
|
atmci_writel(host, ATMCI_CR, ATMCI_CR_MCIDIS);
|
||||||
atmci_readl(host, SR);
|
atmci_readl(host, ATMCI_SR);
|
||||||
clk_disable(host->mck);
|
clk_disable(host->mck);
|
||||||
|
|
||||||
#ifdef CONFIG_MMC_ATMELMCI_DMA
|
#ifdef CONFIG_MMC_ATMELMCI_DMA
|
||||||
|
Loading…
Reference in New Issue
Block a user