Skip to content

Commit 2155e69

Browse files
committed
Merge tag 'dmaengine-4.16-rc1' of git://git.infradead.org/users/vkoul/slave-dma
Pull dmaengine updates from Vinod Koul: "This time is smallish update with updates mainly to drivers: - updates to xilinx and zynqmp dma controllers - update reside calculation for rcar controller - more RSTify fixes for documentation - add support for race free transfer termination and updating for users for that - support for new rev of hidma with addition new APIs to get device match data in ACPI/OF - random updates to bunch of other drivers" * tag 'dmaengine-4.16-rc1' of git://git.infradead.org/users/vkoul/slave-dma: (47 commits) dmaengine: dmatest: fix container_of member in dmatest_callback dmaengine: stm32-dmamux: Remove unnecessary platform_get_resource() error check dmaengine: sprd: statify 'sprd_dma_prep_dma_memcpy' dmaengine: qcom_hidma: simplify DT resource parsing dmaengine: xilinx_dma: Free BD consistent memory dmaengine: xilinx_dma: Fix warning variable prev set but not used dmaengine: xilinx_dma: properly configure the SG mode bit in the driver for cdma dmaengine: doc: format struct fields using monospace dmaengine: doc: fix bullet list formatting dmaengine: ti-dma-crossbar: Fix event mapping for TPCC_EVT_MUX_60_63 dmaengine: cppi41: Fix channel queues array size check dmaengine: imx-sdma: Add MODULE_FIRMWARE dmaengine: xilinx_dma: Fix typos dmaengine: xilinx_dma: Differentiate probe based on the ip type dmaengine: xilinx_dma: fix style issues from checkpatch dmaengine: xilinx_dma: Fix kernel doc warnings dmaengine: xilinx_dma: Fix race condition in the driver for multiple descriptor scenario dmaeninge: xilinx_dma: Fix bug in multiple frame stores scenario in vdma dmaengine: xilinx_dma: Check for channel idle state before submitting dma descriptor dmaengine: zynqmp_dma: Fix race condition in the probe ...
2 parents 2382dc9 + 330542f commit 2155e69

34 files changed

+609
-299
lines changed

Documentation/devicetree/bindings/dma/qcom_hidma_mgmt.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ When the OS is not in control of the management interface (i.e. it's a guest),
4747
the channel nodes appear on their own, not under a management node.
4848

4949
Required properties:
50-
- compatible: must contain "qcom,hidma-1.0" for initial HW or "qcom,hidma-1.1"
51-
for MSI capable HW.
50+
- compatible: must contain "qcom,hidma-1.0" for initial HW or
51+
"qcom,hidma-1.1"/"qcom,hidma-1.2" for MSI capable HW.
5252
- reg: Addresses for the transfer and event channel
5353
- interrupts: Should contain the event interrupt
5454
- desc-count: Number of asynchronous requests this channel can handle

Documentation/driver-api/dmaengine/provider.rst

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -111,40 +111,36 @@ The first thing you need to do in your driver is to allocate this
111111
structure. Any of the usual memory allocators will do, but you'll also
112112
need to initialize a few fields in there:
113113

114-
- channels: should be initialized as a list using the
114+
- ``channels``: should be initialized as a list using the
115115
INIT_LIST_HEAD macro for example
116116

117-
- src_addr_widths:
117+
- ``src_addr_widths``:
118118
should contain a bitmask of the supported source transfer width
119119

120-
- dst_addr_widths:
120+
- ``dst_addr_widths``:
121121
should contain a bitmask of the supported destination transfer width
122122

123-
- directions:
123+
- ``directions``:
124124
should contain a bitmask of the supported slave directions
125125
(i.e. excluding mem2mem transfers)
126126

127-
- residue_granularity:
127+
- ``residue_granularity``:
128+
granularity of the transfer residue reported to dma_set_residue.
129+
This can be either:
128130

129-
- Granularity of the transfer residue reported to dma_set_residue.
130-
This can be either:
131+
- Descriptor:
132+
your device doesn't support any kind of residue
133+
reporting. The framework will only know that a particular
134+
transaction descriptor is done.
131135

132-
- Descriptor
136+
- Segment:
137+
your device is able to report which chunks have been transferred
133138

134-
- Your device doesn't support any kind of residue
135-
reporting. The framework will only know that a particular
136-
transaction descriptor is done.
139+
- Burst:
140+
your device is able to report which burst have been transferred
137141

138-
- Segment
139-
140-
- Your device is able to report which chunks have been transferred
141-
142-
- Burst
143-
144-
- Your device is able to report which burst have been transferred
145-
146-
- dev: should hold the pointer to the ``struct device`` associated
147-
to your current driver instance.
142+
- ``dev``: should hold the pointer to the ``struct device`` associated
143+
to your current driver instance.
148144

149145
Supported transaction types
150146
---------------------------

drivers/acpi/bus.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -785,6 +785,24 @@ const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids,
785785
}
786786
EXPORT_SYMBOL_GPL(acpi_match_device);
787787

788+
void *acpi_get_match_data(const struct device *dev)
789+
{
790+
const struct acpi_device_id *match;
791+
792+
if (!dev->driver)
793+
return NULL;
794+
795+
if (!dev->driver->acpi_match_table)
796+
return NULL;
797+
798+
match = acpi_match_device(dev->driver->acpi_match_table, dev);
799+
if (!match)
800+
return NULL;
801+
802+
return (void *)match->driver_data;
803+
}
804+
EXPORT_SYMBOL_GPL(acpi_get_match_data);
805+
788806
int acpi_match_device_ids(struct acpi_device *device,
789807
const struct acpi_device_id *ids)
790808
{

drivers/acpi/property.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,9 +1271,17 @@ static int acpi_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
12711271
return 0;
12721272
}
12731273

1274+
static void *
1275+
acpi_fwnode_device_get_match_data(const struct fwnode_handle *fwnode,
1276+
const struct device *dev)
1277+
{
1278+
return acpi_get_match_data(dev);
1279+
}
1280+
12741281
#define DECLARE_ACPI_FWNODE_OPS(ops) \
12751282
const struct fwnode_operations ops = { \
12761283
.device_is_available = acpi_fwnode_device_is_available, \
1284+
.device_get_match_data = acpi_fwnode_device_get_match_data, \
12771285
.property_present = acpi_fwnode_property_present, \
12781286
.property_read_int_array = \
12791287
acpi_fwnode_property_read_int_array, \

drivers/base/property.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,3 +1340,10 @@ int fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
13401340
return fwnode_call_int_op(fwnode, graph_parse_endpoint, endpoint);
13411341
}
13421342
EXPORT_SYMBOL(fwnode_graph_parse_endpoint);
1343+
1344+
void *device_get_match_data(struct device *dev)
1345+
{
1346+
return fwnode_call_ptr_op(dev_fwnode(dev), device_get_match_data,
1347+
dev);
1348+
}
1349+
EXPORT_SYMBOL_GPL(device_get_match_data);

drivers/dma/amba-pl08x.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2182,7 +2182,7 @@ static int pl08x_terminate_all(struct dma_chan *chan)
21822182
}
21832183
/* Dequeue jobs and free LLIs */
21842184
if (plchan->at) {
2185-
pl08x_desc_free(&plchan->at->vd);
2185+
vchan_terminate_vdesc(&plchan->at->vd);
21862186
plchan->at = NULL;
21872187
}
21882188
/* Dequeue jobs not yet fired as well */
@@ -2193,6 +2193,13 @@ static int pl08x_terminate_all(struct dma_chan *chan)
21932193
return 0;
21942194
}
21952195

2196+
static void pl08x_synchronize(struct dma_chan *chan)
2197+
{
2198+
struct pl08x_dma_chan *plchan = to_pl08x_chan(chan);
2199+
2200+
vchan_synchronize(&plchan->vc);
2201+
}
2202+
21962203
static int pl08x_pause(struct dma_chan *chan)
21972204
{
21982205
struct pl08x_dma_chan *plchan = to_pl08x_chan(chan);
@@ -2773,6 +2780,7 @@ static int pl08x_probe(struct amba_device *adev, const struct amba_id *id)
27732780
pl08x->memcpy.device_pause = pl08x_pause;
27742781
pl08x->memcpy.device_resume = pl08x_resume;
27752782
pl08x->memcpy.device_terminate_all = pl08x_terminate_all;
2783+
pl08x->memcpy.device_synchronize = pl08x_synchronize;
27762784
pl08x->memcpy.src_addr_widths = PL80X_DMA_BUSWIDTHS;
27772785
pl08x->memcpy.dst_addr_widths = PL80X_DMA_BUSWIDTHS;
27782786
pl08x->memcpy.directions = BIT(DMA_MEM_TO_MEM);
@@ -2802,6 +2810,7 @@ static int pl08x_probe(struct amba_device *adev, const struct amba_id *id)
28022810
pl08x->slave.device_pause = pl08x_pause;
28032811
pl08x->slave.device_resume = pl08x_resume;
28042812
pl08x->slave.device_terminate_all = pl08x_terminate_all;
2813+
pl08x->slave.device_synchronize = pl08x_synchronize;
28052814
pl08x->slave.src_addr_widths = PL80X_DMA_BUSWIDTHS;
28062815
pl08x->slave.dst_addr_widths = PL80X_DMA_BUSWIDTHS;
28072816
pl08x->slave.directions =

drivers/dma/bcm2835-dma.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ static int bcm2835_dma_terminate_all(struct dma_chan *chan)
812812
* c->desc is NULL and exit.)
813813
*/
814814
if (c->desc) {
815-
bcm2835_dma_desc_free(&c->desc->vd);
815+
vchan_terminate_vdesc(&c->desc->vd);
816816
c->desc = NULL;
817817
bcm2835_dma_abort(c->chan_base);
818818

@@ -836,6 +836,13 @@ static int bcm2835_dma_terminate_all(struct dma_chan *chan)
836836
return 0;
837837
}
838838

839+
static void bcm2835_dma_synchronize(struct dma_chan *chan)
840+
{
841+
struct bcm2835_chan *c = to_bcm2835_dma_chan(chan);
842+
843+
vchan_synchronize(&c->vc);
844+
}
845+
839846
static int bcm2835_dma_chan_init(struct bcm2835_dmadev *d, int chan_id,
840847
int irq, unsigned int irq_flags)
841848
{
@@ -942,6 +949,7 @@ static int bcm2835_dma_probe(struct platform_device *pdev)
942949
od->ddev.device_prep_dma_memcpy = bcm2835_dma_prep_dma_memcpy;
943950
od->ddev.device_config = bcm2835_dma_slave_config;
944951
od->ddev.device_terminate_all = bcm2835_dma_terminate_all;
952+
od->ddev.device_synchronize = bcm2835_dma_synchronize;
945953
od->ddev.src_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES);
946954
od->ddev.dst_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES);
947955
od->ddev.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV) |

drivers/dma/cppi41.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ static bool cpp41_dma_filter_fn(struct dma_chan *chan, void *param)
934934

935935
BUILD_BUG_ON(ARRAY_SIZE(am335x_usb_queues_rx) !=
936936
ARRAY_SIZE(am335x_usb_queues_tx));
937-
if (WARN_ON(cchan->port_num > ARRAY_SIZE(am335x_usb_queues_rx)))
937+
if (WARN_ON(cchan->port_num >= ARRAY_SIZE(am335x_usb_queues_rx)))
938938
return false;
939939

940940
cchan->q_num = queues[cchan->port_num].submit;

drivers/dma/dma-jz4780.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ static int jz4780_dma_terminate_all(struct dma_chan *chan)
511511
/* Clear the DMA status and stop the transfer. */
512512
jz4780_dma_writel(jzdma, JZ_DMA_REG_DCS(jzchan->id), 0);
513513
if (jzchan->desc) {
514-
jz4780_dma_desc_free(&jzchan->desc->vdesc);
514+
vchan_terminate_vdesc(&jzchan->desc->vdesc);
515515
jzchan->desc = NULL;
516516
}
517517

@@ -523,6 +523,13 @@ static int jz4780_dma_terminate_all(struct dma_chan *chan)
523523
return 0;
524524
}
525525

526+
static void jz4780_dma_synchronize(struct dma_chan *chan)
527+
{
528+
struct jz4780_dma_chan *jzchan = to_jz4780_dma_chan(chan);
529+
530+
vchan_synchronize(&jzchan->vchan);
531+
}
532+
526533
static int jz4780_dma_config(struct dma_chan *chan,
527534
struct dma_slave_config *config)
528535
{
@@ -813,6 +820,7 @@ static int jz4780_dma_probe(struct platform_device *pdev)
813820
dd->device_prep_dma_memcpy = jz4780_dma_prep_dma_memcpy;
814821
dd->device_config = jz4780_dma_config;
815822
dd->device_terminate_all = jz4780_dma_terminate_all;
823+
dd->device_synchronize = jz4780_dma_synchronize;
816824
dd->device_tx_status = jz4780_dma_tx_status;
817825
dd->device_issue_pending = jz4780_dma_issue_pending;
818826
dd->src_addr_widths = JZ_DMA_BUSWIDTHS;

drivers/dma/dmatest.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ static void dmatest_callback(void *arg)
355355
{
356356
struct dmatest_done *done = arg;
357357
struct dmatest_thread *thread =
358-
container_of(arg, struct dmatest_thread, done_wait);
358+
container_of(done, struct dmatest_thread, test_done);
359359
if (!thread->done) {
360360
done->done = true;
361361
wake_up_all(done->wait);

drivers/dma/edma.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -860,11 +860,8 @@ static int edma_terminate_all(struct dma_chan *chan)
860860
/* Move the cyclic channel back to default queue */
861861
if (!echan->tc && echan->edesc->cyclic)
862862
edma_assign_channel_eventq(echan, EVENTQ_DEFAULT);
863-
/*
864-
* free the running request descriptor
865-
* since it is not in any of the vdesc lists
866-
*/
867-
edma_desc_free(&echan->edesc->vdesc);
863+
864+
vchan_terminate_vdesc(&echan->edesc->vdesc);
868865
echan->edesc = NULL;
869866
}
870867

drivers/dma/img-mdc-dma.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,6 @@ static unsigned int mdc_get_new_events(struct mdc_chan *mchan)
694694
static int mdc_terminate_all(struct dma_chan *chan)
695695
{
696696
struct mdc_chan *mchan = to_mdc_chan(chan);
697-
struct mdc_tx_desc *mdesc;
698697
unsigned long flags;
699698
LIST_HEAD(head);
700699

@@ -703,21 +702,28 @@ static int mdc_terminate_all(struct dma_chan *chan)
703702
mdc_chan_writel(mchan, MDC_CONTROL_AND_STATUS_CANCEL,
704703
MDC_CONTROL_AND_STATUS);
705704

706-
mdesc = mchan->desc;
707-
mchan->desc = NULL;
705+
if (mchan->desc) {
706+
vchan_terminate_vdesc(&mchan->desc->vd);
707+
mchan->desc = NULL;
708+
}
708709
vchan_get_all_descriptors(&mchan->vc, &head);
709710

710711
mdc_get_new_events(mchan);
711712

712713
spin_unlock_irqrestore(&mchan->vc.lock, flags);
713714

714-
if (mdesc)
715-
mdc_desc_free(&mdesc->vd);
716715
vchan_dma_desc_free_list(&mchan->vc, &head);
717716

718717
return 0;
719718
}
720719

720+
static void mdc_synchronize(struct dma_chan *chan)
721+
{
722+
struct mdc_chan *mchan = to_mdc_chan(chan);
723+
724+
vchan_synchronize(&mchan->vc);
725+
}
726+
721727
static int mdc_slave_config(struct dma_chan *chan,
722728
struct dma_slave_config *config)
723729
{
@@ -952,6 +958,7 @@ static int mdc_dma_probe(struct platform_device *pdev)
952958
mdma->dma_dev.device_tx_status = mdc_tx_status;
953959
mdma->dma_dev.device_issue_pending = mdc_issue_pending;
954960
mdma->dma_dev.device_terminate_all = mdc_terminate_all;
961+
mdma->dma_dev.device_synchronize = mdc_synchronize;
955962
mdma->dma_dev.device_config = mdc_slave_config;
956963

957964
mdma->dma_dev.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV);

drivers/dma/imx-sdma.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1939,4 +1939,10 @@ module_platform_driver(sdma_driver);
19391939

19401940
MODULE_AUTHOR("Sascha Hauer, Pengutronix <[email protected]>");
19411941
MODULE_DESCRIPTION("i.MX SDMA driver");
1942+
#if IS_ENABLED(CONFIG_SOC_IMX6Q)
1943+
MODULE_FIRMWARE("imx/sdma/sdma-imx6q.bin");
1944+
#endif
1945+
#if IS_ENABLED(CONFIG_SOC_IMX7D)
1946+
MODULE_FIRMWARE("imx/sdma/sdma-imx7d.bin");
1947+
#endif
19421948
MODULE_LICENSE("GPL");

drivers/dma/k3dma.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ static int k3_dma_terminate_all(struct dma_chan *chan)
719719
c->phy = NULL;
720720
p->vchan = NULL;
721721
if (p->ds_run) {
722-
k3_dma_free_desc(&p->ds_run->vd);
722+
vchan_terminate_vdesc(&p->ds_run->vd);
723723
p->ds_run = NULL;
724724
}
725725
p->ds_done = NULL;
@@ -730,6 +730,13 @@ static int k3_dma_terminate_all(struct dma_chan *chan)
730730
return 0;
731731
}
732732

733+
static void k3_dma_synchronize(struct dma_chan *chan)
734+
{
735+
struct k3_dma_chan *c = to_k3_chan(chan);
736+
737+
vchan_synchronize(&c->vc);
738+
}
739+
733740
static int k3_dma_transfer_pause(struct dma_chan *chan)
734741
{
735742
struct k3_dma_chan *c = to_k3_chan(chan);
@@ -868,6 +875,7 @@ static int k3_dma_probe(struct platform_device *op)
868875
d->slave.device_pause = k3_dma_transfer_pause;
869876
d->slave.device_resume = k3_dma_transfer_resume;
870877
d->slave.device_terminate_all = k3_dma_terminate_all;
878+
d->slave.device_synchronize = k3_dma_synchronize;
871879
d->slave.copy_align = DMAENGINE_ALIGN_8_BYTES;
872880

873881
/* init virtual channel */

drivers/dma/mic_x100_dma.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,9 +480,7 @@ static int mic_dma_setup_irq(struct mic_dma_chan *ch)
480480
to_mbus_hw_ops(ch)->request_threaded_irq(to_mbus_device(ch),
481481
mic_dma_intr_handler, mic_dma_thread_fn,
482482
"mic dma_channel", ch, ch->ch_num);
483-
if (IS_ERR(ch->cookie))
484-
return PTR_ERR(ch->cookie);
485-
return 0;
483+
return PTR_ERR_OR_ZERO(ch->cookie);
486484
}
487485

488486
static inline void mic_dma_free_irq(struct mic_dma_chan *ch)

drivers/dma/omap-dma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1311,7 +1311,7 @@ static int omap_dma_terminate_all(struct dma_chan *chan)
13111311
* c->desc is NULL and exit.)
13121312
*/
13131313
if (c->desc) {
1314-
omap_dma_desc_free(&c->desc->vd);
1314+
vchan_terminate_vdesc(&c->desc->vd);
13151315
c->desc = NULL;
13161316
/* Avoid stopping the dma twice */
13171317
if (!c->paused)

0 commit comments

Comments
 (0)