Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 316669
b: refs/heads/master
c: ecf90fb
h: refs/heads/master
i:
  316667: 5465273
v: v3
  • Loading branch information
Guennadi Liakhovetski authored and Vinod Koul committed Jul 20, 2012
1 parent 5dc9bec commit d6bb9a9
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1e7f07b5390b4bbf82fe017fcb46682dcf4ab1d0
refs/heads/master: ecf90fbbdc66cde6f5fa25d88541112b9baac459
9 changes: 5 additions & 4 deletions trunk/drivers/dma/sh/shdma-base.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static dma_cookie_t shdma_tx_submit(struct dma_async_tx_descriptor *tx)
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;
Expand Down Expand Up @@ -208,6 +208,7 @@ static int shdma_alloc_chan_resources(struct dma_chan *chan)
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);
Expand Down Expand Up @@ -365,9 +366,9 @@ static void shdma_free_chan_resources(struct dma_chan *chan)
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;
}
Expand Down Expand Up @@ -558,7 +559,7 @@ static struct dma_async_tx_descriptor *shdma_prep_slave_sg(
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)
Expand Down
24 changes: 10 additions & 14 deletions trunk/drivers/dma/sh/shdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,8 @@ static void sh_dmae_setup_xfer(struct shdma_chan *schan,
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);
Expand Down Expand Up @@ -326,13 +324,11 @@ static int sh_dmae_set_slave(struct shdma_chan *schan,
{
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;
}
Expand Down Expand Up @@ -579,13 +575,12 @@ static int sh_dmae_resume(struct device *dev)

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 {
Expand All @@ -609,14 +604,15 @@ const struct dev_pm_ops sh_dmae_pm = {

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)
Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/dma/sh/shdma.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#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>
Expand All @@ -25,6 +26,7 @@ struct device;

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 */
Expand Down
2 changes: 0 additions & 2 deletions trunk/include/linux/sh_dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ struct device;
/* Used by slave DMA clients to request DMA to/from a specific peripheral */
struct sh_dmae_slave {
struct shdma_slave shdma_slave; /* Set by the platform */
struct device *dma_dev; /* Set by the platform */
const struct sh_dmae_slave_config *config; /* Set by the driver */
};

/*
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/shdma-base.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ struct shdma_chan {
size_t max_xfer_len; /* max transfer length */
int id; /* Raw id of this channel */
int irq; /* Channel IRQ */
struct shdma_slave *slave; /* Client data for slave DMA */
enum shdma_pm_state pm_state;
};

Expand Down

0 comments on commit d6bb9a9

Please sign in to comment.