The host_sglen is now actually used to keep track of whether DMA
is active or not, so rename and retype it to bool.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
struct dma_chan *chan_rx;
struct dma_chan *chan_tx;
struct completion dma_complete;
struct dma_chan *chan_rx;
struct dma_chan *chan_tx;
struct completion dma_complete;
- unsigned int dma_sglen;
};
static inline void sh_mmcif_bitset(struct sh_mmcif_host *host,
};
static inline void sh_mmcif_bitset(struct sh_mmcif_host *host,
ret = dma_map_sg(chan->device->dev, sg, host->data->sg_len,
DMA_FROM_DEVICE);
if (ret > 0) {
ret = dma_map_sg(chan->device->dev, sg, host->data->sg_len,
DMA_FROM_DEVICE);
if (ret > 0) {
+ host->dma_active = true;
desc = chan->device->device_prep_slave_sg(chan, sg, ret,
DMA_FROM_DEVICE, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
}
desc = chan->device->device_prep_slave_sg(chan, sg, ret,
DMA_FROM_DEVICE, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
}
if (ret >= 0)
ret = -EIO;
host->chan_rx = NULL;
if (ret >= 0)
ret = -EIO;
host->chan_rx = NULL;
+ host->dma_active = false;
dma_release_channel(chan);
/* Free the Tx channel too */
chan = host->chan_tx;
dma_release_channel(chan);
/* Free the Tx channel too */
chan = host->chan_tx;
ret = dma_map_sg(chan->device->dev, sg, host->data->sg_len,
DMA_TO_DEVICE);
if (ret > 0) {
ret = dma_map_sg(chan->device->dev, sg, host->data->sg_len,
DMA_TO_DEVICE);
if (ret > 0) {
+ host->dma_active = true;
desc = chan->device->device_prep_slave_sg(chan, sg, ret,
DMA_TO_DEVICE, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
}
desc = chan->device->device_prep_slave_sg(chan, sg, ret,
DMA_TO_DEVICE, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
}
if (ret >= 0)
ret = -EIO;
host->chan_tx = NULL;
if (ret >= 0)
ret = -EIO;
host->chan_tx = NULL;
+ host->dma_active = false;
dma_release_channel(chan);
/* Free the Rx channel too */
chan = host->chan_rx;
dma_release_channel(chan);
/* Free the Rx channel too */
chan = host->chan_rx;
static void sh_mmcif_request_dma(struct sh_mmcif_host *host,
struct sh_mmcif_plat_data *pdata)
{
static void sh_mmcif_request_dma(struct sh_mmcif_host *host,
struct sh_mmcif_plat_data *pdata)
{
+ host->dma_active = false;
/* We can only either use DMA for both Tx and Rx or not use it at all */
if (pdata->dma) {
/* We can only either use DMA for both Tx and Rx or not use it at all */
if (pdata->dma) {
dma_release_channel(chan);
}
dma_release_channel(chan);
}
+ host->dma_active = false;
}
static void sh_mmcif_clock_control(struct sh_mmcif_host *host, unsigned int clk)
}
static void sh_mmcif_clock_control(struct sh_mmcif_host *host, unsigned int clk)
}
sh_mmcif_get_response(host, cmd);
if (host->data) {
}
sh_mmcif_get_response(host, cmd);
if (host->data) {
- if (!host->dma_sglen) {
+ if (!host->dma_active) {
ret = sh_mmcif_data_trans(host, mrq, cmd->opcode);
} else {
long time =
ret = sh_mmcif_data_trans(host, mrq, cmd->opcode);
} else {
long time =
ret = time;
sh_mmcif_bitclr(host, MMCIF_CE_BUF_ACC,
BUF_ACC_DMAREN | BUF_ACC_DMAWEN);
ret = time;
sh_mmcif_bitclr(host, MMCIF_CE_BUF_ACC,
BUF_ACC_DMAREN | BUF_ACC_DMAWEN);
+ host->dma_active = false;
}
if (ret < 0)
mrq->data->bytes_xfered = 0;
}
if (ret < 0)
mrq->data->bytes_xfered = 0;