container_of(tx, struct shdma_desc, async_tx),
*last = desc;
struct shdma_chan *schan = to_shdma_chan(tx->chan);
- struct shdma_slave *slave = tx->chan->private;
+ struct shdma_slave *slave = schan->slave;
dma_async_tx_callback callback = tx->callback;
dma_cookie_t cookie;
bool power_up;
goto edescalloc;
}
schan->desc_num = NR_DESCS_PER_CHANNEL;
+ schan->slave = slave;
for (i = 0; i < NR_DESCS_PER_CHANNEL; i++) {
desc = ops->embedded_desc(schan->desc, i);
if (!list_empty(&schan->ld_queue))
shdma_chan_ld_cleanup(schan, true);
- if (chan->private) {
+ if (schan->slave) {
/* The caller is holding dma_list_mutex */
- struct shdma_slave *slave = chan->private;
+ struct shdma_slave *slave = schan->slave;
clear_bit(slave->slave_id, shdma_slave_used);
chan->private = NULL;
}
struct shdma_chan *schan = to_shdma_chan(chan);
struct shdma_dev *sdev = to_shdma_dev(schan->dma_chan.device);
const struct shdma_ops *ops = sdev->ops;
- struct shdma_slave *slave = chan->private;
+ struct shdma_slave *slave = schan->slave;
dma_addr_t slave_addr;
if (!chan)
shdma_chan);
if (sslave) {
- struct sh_dmae_slave *slave = container_of(sslave,
- struct sh_dmae_slave, shdma_slave);
const struct sh_dmae_slave_config *cfg =
- slave->config;
+ sh_chan->config;
dmae_set_dmars(sh_chan, cfg->mid_rid);
dmae_set_chcr(sh_chan, cfg->chcr);
{
struct sh_dmae_chan *sh_chan = container_of(schan, struct sh_dmae_chan,
shdma_chan);
- struct sh_dmae_slave *slave = container_of(sslave, struct sh_dmae_slave,
- shdma_slave);
const struct sh_dmae_slave_config *cfg = dmae_find_slave(sh_chan, sslave->slave_id);
if (!cfg)
return -ENODEV;
- slave->config = cfg;
+ sh_chan->config = cfg;
return 0;
}
for (i = 0; i < shdev->pdata->channel_num; i++) {
struct sh_dmae_chan *sh_chan = shdev->chan[i];
- struct sh_dmae_slave *param = sh_chan->shdma_chan.dma_chan.private;
if (!sh_chan->shdma_chan.desc_num)
continue;
- if (param) {
- const struct sh_dmae_slave_config *cfg = param->config;
+ if (sh_chan->shdma_chan.slave) {
+ const struct sh_dmae_slave_config *cfg = sh_chan->config;
dmae_set_dmars(sh_chan, cfg->mid_rid);
dmae_set_chcr(sh_chan, cfg->chcr);
} else {
static dma_addr_t sh_dmae_slave_addr(struct shdma_chan *schan)
{
- struct sh_dmae_slave *param = schan->dma_chan.private;
+ struct sh_dmae_chan *sh_chan = container_of(schan,
+ struct sh_dmae_chan, shdma_chan);
/*
- * Implicit BUG_ON(!param)
- * if (param != NULL), this is a successfully requested slave channel,
- * therefore param->config != NULL too.
+ * Implicit BUG_ON(!sh_chan->config)
+ * This is an exclusive slave DMA operation, may only be called after a
+ * successful slave configuration.
*/
- return param->config->addr;
+ return sh_chan->config->addr;
}
static struct shdma_desc *sh_dmae_embedded_desc(void *buf, int i)
#ifndef __DMA_SHDMA_H
#define __DMA_SHDMA_H
+#include <linux/sh_dma.h>
#include <linux/shdma-base.h>
#include <linux/dmaengine.h>
#include <linux/interrupt.h>
struct sh_dmae_chan {
struct shdma_chan shdma_chan;
+ const struct sh_dmae_slave_config *config; /* Slave DMA configuration */
int xmit_shift; /* log_2(bytes_per_xfer) */
u32 __iomem *base;
char dev_id[16]; /* unique name per DMAC of channel */