| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * SA11x0 DMAengine support |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2012 Russell King |
|---|
| 5 | 6 | * Derived in part from arch/arm/mach-sa1100/dma.c, |
|---|
| 6 | 7 | * Copyright (C) 2000, 2001 by Nicolas Pitre |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 9 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 10 | | - * published by the Free Software Foundation. |
|---|
| 11 | 8 | */ |
|---|
| 12 | 9 | #include <linux/sched.h> |
|---|
| 13 | 10 | #include <linux/device.h> |
|---|
| .. | .. |
|---|
| 17 | 14 | #include <linux/kernel.h> |
|---|
| 18 | 15 | #include <linux/module.h> |
|---|
| 19 | 16 | #include <linux/platform_device.h> |
|---|
| 20 | | -#include <linux/sa11x0-dma.h> |
|---|
| 21 | 17 | #include <linux/slab.h> |
|---|
| 22 | 18 | #include <linux/spinlock.h> |
|---|
| 23 | 19 | |
|---|
| .. | .. |
|---|
| 82 | 78 | bool cyclic; |
|---|
| 83 | 79 | |
|---|
| 84 | 80 | unsigned sglen; |
|---|
| 85 | | - struct sa11x0_dma_sg sg[0]; |
|---|
| 81 | + struct sa11x0_dma_sg sg[]; |
|---|
| 86 | 82 | }; |
|---|
| 87 | 83 | |
|---|
| 88 | 84 | struct sa11x0_dma_phy; |
|---|
| .. | .. |
|---|
| 327 | 323 | } |
|---|
| 328 | 324 | } |
|---|
| 329 | 325 | |
|---|
| 330 | | -static void sa11x0_dma_tasklet(unsigned long arg) |
|---|
| 326 | +static void sa11x0_dma_tasklet(struct tasklet_struct *t) |
|---|
| 331 | 327 | { |
|---|
| 332 | | - struct sa11x0_dma_dev *d = (struct sa11x0_dma_dev *)arg; |
|---|
| 328 | + struct sa11x0_dma_dev *d = from_tasklet(d, t, task); |
|---|
| 333 | 329 | struct sa11x0_dma_phy *p; |
|---|
| 334 | 330 | struct sa11x0_dma_chan *c; |
|---|
| 335 | 331 | unsigned pch, pch_alloc = 0; |
|---|
| .. | .. |
|---|
| 706 | 702 | struct sa11x0_dma_chan *c = to_sa11x0_dma_chan(chan); |
|---|
| 707 | 703 | struct sa11x0_dma_dev *d = to_sa11x0_dma(chan->device); |
|---|
| 708 | 704 | struct sa11x0_dma_phy *p; |
|---|
| 709 | | - LIST_HEAD(head); |
|---|
| 710 | 705 | unsigned long flags; |
|---|
| 711 | 706 | |
|---|
| 712 | 707 | dev_dbg(d->slave.dev, "vchan %p: pause\n", &c->vc); |
|---|
| .. | .. |
|---|
| 733 | 728 | struct sa11x0_dma_chan *c = to_sa11x0_dma_chan(chan); |
|---|
| 734 | 729 | struct sa11x0_dma_dev *d = to_sa11x0_dma(chan->device); |
|---|
| 735 | 730 | struct sa11x0_dma_phy *p; |
|---|
| 736 | | - LIST_HEAD(head); |
|---|
| 737 | 731 | unsigned long flags; |
|---|
| 738 | 732 | |
|---|
| 739 | 733 | dev_dbg(d->slave.dev, "vchan %p: resume\n", &c->vc); |
|---|
| .. | .. |
|---|
| 829 | 823 | { "sa11x0-ssp", "tx", "Ser4SSPTr" }, |
|---|
| 830 | 824 | { "sa11x0-ssp", "rx", "Ser4SSPRc" }, |
|---|
| 831 | 825 | }; |
|---|
| 826 | + |
|---|
| 827 | +static bool sa11x0_dma_filter_fn(struct dma_chan *chan, void *param) |
|---|
| 828 | +{ |
|---|
| 829 | + struct sa11x0_dma_chan *c = to_sa11x0_dma_chan(chan); |
|---|
| 830 | + const char *p = param; |
|---|
| 831 | + |
|---|
| 832 | + return !strcmp(c->name, p); |
|---|
| 833 | +} |
|---|
| 832 | 834 | |
|---|
| 833 | 835 | static int sa11x0_dma_init_dmadev(struct dma_device *dmadev, |
|---|
| 834 | 836 | struct device *dev) |
|---|
| .. | .. |
|---|
| 926 | 928 | goto err_ioremap; |
|---|
| 927 | 929 | } |
|---|
| 928 | 930 | |
|---|
| 929 | | - tasklet_init(&d->task, sa11x0_dma_tasklet, (unsigned long)d); |
|---|
| 931 | + tasklet_setup(&d->task, sa11x0_dma_tasklet); |
|---|
| 930 | 932 | |
|---|
| 931 | 933 | for (i = 0; i < NR_PHY_CHAN; i++) { |
|---|
| 932 | 934 | struct sa11x0_dma_phy *p = &d->phy[i]; |
|---|
| .. | .. |
|---|
| 1086 | 1088 | .probe = sa11x0_dma_probe, |
|---|
| 1087 | 1089 | .remove = sa11x0_dma_remove, |
|---|
| 1088 | 1090 | }; |
|---|
| 1089 | | - |
|---|
| 1090 | | -bool sa11x0_dma_filter_fn(struct dma_chan *chan, void *param) |
|---|
| 1091 | | -{ |
|---|
| 1092 | | - if (chan->device->dev->driver == &sa11x0_dma_driver.driver) { |
|---|
| 1093 | | - struct sa11x0_dma_chan *c = to_sa11x0_dma_chan(chan); |
|---|
| 1094 | | - const char *p = param; |
|---|
| 1095 | | - |
|---|
| 1096 | | - return !strcmp(c->name, p); |
|---|
| 1097 | | - } |
|---|
| 1098 | | - return false; |
|---|
| 1099 | | -} |
|---|
| 1100 | | -EXPORT_SYMBOL(sa11x0_dma_filter_fn); |
|---|
| 1101 | 1091 | |
|---|
| 1102 | 1092 | static int __init sa11x0_dma_init(void) |
|---|
| 1103 | 1093 | { |
|---|