Skip to content

Commit

Permalink
Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git…
Browse files Browse the repository at this point in the history
…/djbw/async_tx

* 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx:
  async_tx: checkpatch says s/__FUNCTION__/__func__/g
  iop-adma.c: replace remaining __FUNCTION__ occurrences
  fsldma: Add a completed cookie updated action in DMA finish interrupt.
  fsldma: Add device_prep_dma_interrupt support to fsldma.c
  dmaengine: Fix a bug about BUG_ON() on DMA engine capability DMA_INTERRUPT.
  fsldma: Fix fsldma.c warning messages when it's compiled under PPC64.
  • Loading branch information
Linus Torvalds committed Mar 13, 2008
2 parents ebe168d + 3280ab3 commit b1881fb
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 46 deletions.
6 changes: 3 additions & 3 deletions crypto/async_tx/async_memcpy.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ async_memcpy(struct page *dest, struct page *src, unsigned int dest_offset,
}

if (tx) {
pr_debug("%s: (async) len: %zu\n", __FUNCTION__, len);
pr_debug("%s: (async) len: %zu\n", __func__, len);
async_tx_submit(chan, tx, flags, depend_tx, cb_fn, cb_param);
} else {
void *dest_buf, *src_buf;
pr_debug("%s: (sync) len: %zu\n", __FUNCTION__, len);
pr_debug("%s: (sync) len: %zu\n", __func__, len);

/* wait for any prerequisite operations */
if (depend_tx) {
Expand All @@ -80,7 +80,7 @@ async_memcpy(struct page *dest, struct page *src, unsigned int dest_offset,
BUG_ON(depend_tx->ack);
if (dma_wait_for_async_tx(depend_tx) == DMA_ERROR)
panic("%s: DMA_ERROR waiting for depend_tx\n",
__FUNCTION__);
__func__);
}

dest_buf = kmap_atomic(dest, KM_USER0) + dest_offset;
Expand Down
6 changes: 3 additions & 3 deletions crypto/async_tx/async_memset.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ async_memset(struct page *dest, int val, unsigned int offset,
}

if (tx) {
pr_debug("%s: (async) len: %zu\n", __FUNCTION__, len);
pr_debug("%s: (async) len: %zu\n", __func__, len);
async_tx_submit(chan, tx, flags, depend_tx, cb_fn, cb_param);
} else { /* run the memset synchronously */
void *dest_buf;
pr_debug("%s: (sync) len: %zu\n", __FUNCTION__, len);
pr_debug("%s: (sync) len: %zu\n", __func__, len);

dest_buf = (void *) (((char *) page_address(dest)) + offset);

Expand All @@ -79,7 +79,7 @@ async_memset(struct page *dest, int val, unsigned int offset,
BUG_ON(depend_tx->ack);
if (dma_wait_for_async_tx(depend_tx) == DMA_ERROR)
panic("%s: DMA_ERROR waiting for depend_tx\n",
__FUNCTION__);
__func__);
}

memset(dest_buf, val, len);
Expand Down
6 changes: 3 additions & 3 deletions crypto/async_tx/async_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -472,11 +472,11 @@ async_trigger_callback(enum async_tx_flags flags,
tx = NULL;

if (tx) {
pr_debug("%s: (async)\n", __FUNCTION__);
pr_debug("%s: (async)\n", __func__);

async_tx_submit(chan, tx, flags, depend_tx, cb_fn, cb_param);
} else {
pr_debug("%s: (sync)\n", __FUNCTION__);
pr_debug("%s: (sync)\n", __func__);

/* wait for any prerequisite operations */
if (depend_tx) {
Expand All @@ -486,7 +486,7 @@ async_trigger_callback(enum async_tx_flags flags,
BUG_ON(depend_tx->ack);
if (dma_wait_for_async_tx(depend_tx) == DMA_ERROR)
panic("%s: DMA_ERROR waiting for depend_tx\n",
__FUNCTION__);
__func__);
}

async_tx_sync_epilog(flags, depend_tx, cb_fn, cb_param);
Expand Down
12 changes: 6 additions & 6 deletions crypto/async_tx/async_xor.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ do_async_xor(struct dma_device *device,
int i;
unsigned long dma_prep_flags = cb_fn ? DMA_PREP_INTERRUPT : 0;

pr_debug("%s: len: %zu\n", __FUNCTION__, len);
pr_debug("%s: len: %zu\n", __func__, len);

dma_dest = dma_map_page(device->dev, dest, offset, len,
DMA_FROM_DEVICE);
Expand Down Expand Up @@ -86,7 +86,7 @@ do_sync_xor(struct page *dest, struct page **src_list, unsigned int offset,
void *_dest;
int i;

pr_debug("%s: len: %zu\n", __FUNCTION__, len);
pr_debug("%s: len: %zu\n", __func__, len);

/* reuse the 'src_list' array to convert to buffer pointers */
for (i = 0; i < src_cnt; i++)
Expand Down Expand Up @@ -196,7 +196,7 @@ async_xor(struct page *dest, struct page **src_list, unsigned int offset,
DMA_ERROR)
panic("%s: DMA_ERROR waiting for "
"depend_tx\n",
__FUNCTION__);
__func__);
}

do_sync_xor(dest, &src_list[src_off], offset,
Expand Down Expand Up @@ -276,7 +276,7 @@ async_xor_zero_sum(struct page *dest, struct page **src_list,
unsigned long dma_prep_flags = cb_fn ? DMA_PREP_INTERRUPT : 0;
int i;

pr_debug("%s: (async) len: %zu\n", __FUNCTION__, len);
pr_debug("%s: (async) len: %zu\n", __func__, len);

for (i = 0; i < src_cnt; i++)
dma_src[i] = dma_map_page(device->dev, src_list[i],
Expand All @@ -299,7 +299,7 @@ async_xor_zero_sum(struct page *dest, struct page **src_list,
} else {
unsigned long xor_flags = flags;

pr_debug("%s: (sync) len: %zu\n", __FUNCTION__, len);
pr_debug("%s: (sync) len: %zu\n", __func__, len);

xor_flags |= ASYNC_TX_XOR_DROP_DST;
xor_flags &= ~ASYNC_TX_ACK;
Expand All @@ -310,7 +310,7 @@ async_xor_zero_sum(struct page *dest, struct page **src_list,
if (tx) {
if (dma_wait_for_async_tx(tx) == DMA_ERROR)
panic("%s: DMA_ERROR waiting for tx\n",
__FUNCTION__);
__func__);
async_tx_ack(tx);
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/dma/dmaengine.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ int dma_async_device_register(struct dma_device *device)
!device->device_prep_dma_zero_sum);
BUG_ON(dma_has_cap(DMA_MEMSET, device->cap_mask) &&
!device->device_prep_dma_memset);
BUG_ON(dma_has_cap(DMA_ZERO_SUM, device->cap_mask) &&
BUG_ON(dma_has_cap(DMA_INTERRUPT, device->cap_mask) &&
!device->device_prep_dma_interrupt);

BUG_ON(!device->device_alloc_chan_resources);
Expand Down
58 changes: 44 additions & 14 deletions drivers/dma/fsldma.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ static void dma_init(struct fsl_dma_chan *fsl_chan)

}

static void set_sr(struct fsl_dma_chan *fsl_chan, dma_addr_t val)
static void set_sr(struct fsl_dma_chan *fsl_chan, u32 val)
{
DMA_OUT(fsl_chan, &fsl_chan->reg_base->sr, val, 32);
}

static dma_addr_t get_sr(struct fsl_dma_chan *fsl_chan)
static u32 get_sr(struct fsl_dma_chan *fsl_chan)
{
return DMA_IN(fsl_chan, &fsl_chan->reg_base->sr, 32);
}
Expand Down Expand Up @@ -406,6 +406,32 @@ static void fsl_dma_free_chan_resources(struct dma_chan *chan)
dma_pool_destroy(fsl_chan->desc_pool);
}

static struct dma_async_tx_descriptor *
fsl_dma_prep_interrupt(struct dma_chan *chan)
{
struct fsl_dma_chan *fsl_chan;
struct fsl_desc_sw *new;

if (!chan)
return NULL;

fsl_chan = to_fsl_chan(chan);

new = fsl_dma_alloc_descriptor(fsl_chan);
if (!new) {
dev_err(fsl_chan->dev, "No free memory for link descriptor\n");
return NULL;
}

new->async_tx.cookie = -EBUSY;
new->async_tx.ack = 0;

/* Set End-of-link to the last link descriptor of new list*/
set_ld_eol(fsl_chan, new);

return &new->async_tx;
}

static struct dma_async_tx_descriptor *fsl_dma_prep_memcpy(
struct dma_chan *chan, dma_addr_t dma_dest, dma_addr_t dma_src,
size_t len, unsigned long flags)
Expand Down Expand Up @@ -436,7 +462,7 @@ static struct dma_async_tx_descriptor *fsl_dma_prep_memcpy(
dev_dbg(fsl_chan->dev, "new link desc alloc %p\n", new);
#endif

copy = min(len, FSL_DMA_BCR_MAX_CNT);
copy = min(len, (size_t)FSL_DMA_BCR_MAX_CNT);

set_desc_cnt(fsl_chan, &new->hw, copy);
set_desc_src(fsl_chan, &new->hw, dma_src);
Expand Down Expand Up @@ -513,7 +539,6 @@ static void fsl_chan_ld_cleanup(struct fsl_dma_chan *fsl_chan)

spin_lock_irqsave(&fsl_chan->desc_lock, flags);

fsl_dma_update_completed_cookie(fsl_chan);
dev_dbg(fsl_chan->dev, "chan completed_cookie = %d\n",
fsl_chan->completed_cookie);
list_for_each_entry_safe(desc, _desc, &fsl_chan->ld_queue, node) {
Expand Down Expand Up @@ -581,8 +606,8 @@ static void fsl_chan_xfer_ld_queue(struct fsl_dma_chan *fsl_chan)
if (ld_node != &fsl_chan->ld_queue) {
/* Get the ld start address from ld_queue */
next_dest_addr = to_fsl_desc(ld_node)->async_tx.phys;
dev_dbg(fsl_chan->dev, "xfer LDs staring from 0x%016llx\n",
(u64)next_dest_addr);
dev_dbg(fsl_chan->dev, "xfer LDs staring from %p\n",
(void *)next_dest_addr);
set_cdar(fsl_chan, next_dest_addr);
dma_start(fsl_chan);
} else {
Expand Down Expand Up @@ -662,7 +687,7 @@ static enum dma_status fsl_dma_is_complete(struct dma_chan *chan,
static irqreturn_t fsl_dma_chan_do_interrupt(int irq, void *data)
{
struct fsl_dma_chan *fsl_chan = (struct fsl_dma_chan *)data;
dma_addr_t stat;
u32 stat;

stat = get_sr(fsl_chan);
dev_dbg(fsl_chan->dev, "event: channel %d, stat = 0x%x\n",
Expand All @@ -681,10 +706,10 @@ static irqreturn_t fsl_dma_chan_do_interrupt(int irq, void *data)
*/
if (stat & FSL_DMA_SR_EOSI) {
dev_dbg(fsl_chan->dev, "event: End-of-segments INT\n");
dev_dbg(fsl_chan->dev, "event: clndar 0x%016llx, "
"nlndar 0x%016llx\n", (u64)get_cdar(fsl_chan),
(u64)get_ndar(fsl_chan));
dev_dbg(fsl_chan->dev, "event: clndar %p, nlndar %p\n",
(void *)get_cdar(fsl_chan), (void *)get_ndar(fsl_chan));
stat &= ~FSL_DMA_SR_EOSI;
fsl_dma_update_completed_cookie(fsl_chan);
}

/* If it current transfer is the end-of-transfer,
Expand Down Expand Up @@ -726,12 +751,15 @@ static void dma_do_tasklet(unsigned long data)
fsl_chan_ld_cleanup(fsl_chan);
}

#ifdef FSL_DMA_CALLBACKTEST
static void fsl_dma_callback_test(struct fsl_dma_chan *fsl_chan)
{
if (fsl_chan)
dev_info(fsl_chan->dev, "selftest: callback is ok!\n");
}
#endif

#ifdef CONFIG_FSL_DMA_SELFTEST
static int fsl_dma_self_test(struct fsl_dma_chan *fsl_chan)
{
struct dma_chan *chan;
Expand Down Expand Up @@ -837,9 +865,9 @@ static int fsl_dma_self_test(struct fsl_dma_chan *fsl_chan)
if (err) {
for (i = 0; (*(src + i) == *(dest + i)) && (i < test_size);
i++);
dev_err(fsl_chan->dev, "selftest: Test failed, data %d/%d is "
dev_err(fsl_chan->dev, "selftest: Test failed, data %d/%ld is "
"error! src 0x%x, dest 0x%x\n",
i, test_size, *(src + i), *(dest + i));
i, (long)test_size, *(src + i), *(dest + i));
}

free_resources:
Expand All @@ -848,6 +876,7 @@ static int fsl_dma_self_test(struct fsl_dma_chan *fsl_chan)
kfree(src);
return err;
}
#endif

static int __devinit of_fsl_dma_chan_probe(struct of_device *dev,
const struct of_device_id *match)
Expand Down Expand Up @@ -1008,15 +1037,16 @@ static int __devinit of_fsl_dma_probe(struct of_device *dev,
}

dev_info(&dev->dev, "Probe the Freescale DMA driver for %s "
"controller at 0x%08x...\n",
match->compatible, fdev->reg.start);
"controller at %p...\n",
match->compatible, (void *)fdev->reg.start);
fdev->reg_base = ioremap(fdev->reg.start, fdev->reg.end
- fdev->reg.start + 1);

dma_cap_set(DMA_MEMCPY, fdev->common.cap_mask);
dma_cap_set(DMA_INTERRUPT, fdev->common.cap_mask);
fdev->common.device_alloc_chan_resources = fsl_dma_alloc_chan_resources;
fdev->common.device_free_chan_resources = fsl_dma_free_chan_resources;
fdev->common.device_prep_dma_interrupt = fsl_dma_prep_interrupt;
fdev->common.device_prep_dma_memcpy = fsl_dma_prep_memcpy;
fdev->common.device_is_tx_complete = fsl_dma_is_complete;
fdev->common.device_issue_pending = fsl_dma_memcpy_issue_pending;
Expand Down
Loading

0 comments on commit b1881fb

Please sign in to comment.