hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/dma/coh901318.c
....@@ -1,8 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * driver/dma/coh901318.c
34 *
45 * Copyright (C) 2007-2009 ST-Ericsson
5
- * License terms: GNU General Public License (GPL) version 2
66 * DMA driver for COH 901 318
77 * Author: Per Friden <per.friden@stericsson.com>
88 */
....@@ -1306,6 +1306,7 @@
13061306 unsigned long nbr_active_done;
13071307 unsigned long busy;
13081308
1309
+ struct dma_slave_config config;
13091310 u32 addr;
13101311 u32 ctrl;
13111312
....@@ -1377,10 +1378,8 @@
13771378
13781379 dma_dentry = debugfs_create_dir("dma", NULL);
13791380
1380
- (void) debugfs_create_file("status",
1381
- S_IFREG | S_IRUGO,
1382
- dma_dentry, NULL,
1383
- &coh901318_debugfs_status_operations);
1381
+ debugfs_create_file("status", S_IFREG | S_IRUGO, dma_dentry, NULL,
1382
+ &coh901318_debugfs_status_operations);
13841383 return 0;
13851384 }
13861385
....@@ -1401,6 +1400,10 @@
14011400 {
14021401 return container_of(chan, struct coh901318_chan, chan);
14031402 }
1403
+
1404
+static int coh901318_dma_set_runtimeconfig(struct dma_chan *chan,
1405
+ struct dma_slave_config *config,
1406
+ enum dma_transfer_direction direction);
14041407
14051408 static inline const struct coh901318_params *
14061409 cohc_chan_param(struct coh901318_chan *cohc)
....@@ -1865,9 +1868,9 @@
18651868 * This tasklet is called from the interrupt handler to
18661869 * handle each descriptor (DMA job) that is sent to a channel.
18671870 */
1868
-static void dma_tasklet(unsigned long data)
1871
+static void dma_tasklet(struct tasklet_struct *t)
18691872 {
1870
- struct coh901318_chan *cohc = (struct coh901318_chan *) data;
1873
+ struct coh901318_chan *cohc = from_tasklet(cohc, t, tasklet);
18711874 struct coh901318_desc *cohd_fin;
18721875 unsigned long flags;
18731876 struct dmaengine_desc_callback cb;
....@@ -2351,6 +2354,8 @@
23512354 if (lli == NULL)
23522355 goto err_dma_alloc;
23532356
2357
+ coh901318_dma_set_runtimeconfig(chan, &cohc->config, direction);
2358
+
23542359 /* initiate allocated lli list */
23552360 ret = coh901318_lli_fill_sg(&cohc->base->pool, lli, sgl, sg_len,
23562361 cohc->addr,
....@@ -2490,7 +2495,8 @@
24902495 };
24912496
24922497 static int coh901318_dma_set_runtimeconfig(struct dma_chan *chan,
2493
- struct dma_slave_config *config)
2498
+ struct dma_slave_config *config,
2499
+ enum dma_transfer_direction direction)
24942500 {
24952501 struct coh901318_chan *cohc = to_coh901318_chan(chan);
24962502 dma_addr_t addr;
....@@ -2500,11 +2506,11 @@
25002506 int i = 0;
25012507
25022508 /* We only support mem to per or per to mem transfers */
2503
- if (config->direction == DMA_DEV_TO_MEM) {
2509
+ if (direction == DMA_DEV_TO_MEM) {
25042510 addr = config->src_addr;
25052511 addr_width = config->src_addr_width;
25062512 maxburst = config->src_maxburst;
2507
- } else if (config->direction == DMA_MEM_TO_DEV) {
2513
+ } else if (direction == DMA_MEM_TO_DEV) {
25082514 addr = config->dst_addr;
25092515 addr_width = config->dst_addr_width;
25102516 maxburst = config->dst_maxburst;
....@@ -2570,6 +2576,16 @@
25702576 return 0;
25712577 }
25722578
2579
+static int coh901318_dma_slave_config(struct dma_chan *chan,
2580
+ struct dma_slave_config *config)
2581
+{
2582
+ struct coh901318_chan *cohc = to_coh901318_chan(chan);
2583
+
2584
+ memcpy(&cohc->config, config, sizeof(*config));
2585
+
2586
+ return 0;
2587
+}
2588
+
25732589 static void coh901318_base_init(struct dma_device *dma, const int *pick_chans,
25742590 struct coh901318_base *base)
25752591 {
....@@ -2599,8 +2615,7 @@
25992615 INIT_LIST_HEAD(&cohc->active);
26002616 INIT_LIST_HEAD(&cohc->queue);
26012617
2602
- tasklet_init(&cohc->tasklet, dma_tasklet,
2603
- (unsigned long) cohc);
2618
+ tasklet_setup(&cohc->tasklet, dma_tasklet);
26042619
26052620 list_add_tail(&cohc->chan.device_node,
26062621 &dma->channels);
....@@ -2675,7 +2690,7 @@
26752690 base->dma_slave.device_prep_slave_sg = coh901318_prep_slave_sg;
26762691 base->dma_slave.device_tx_status = coh901318_tx_status;
26772692 base->dma_slave.device_issue_pending = coh901318_issue_pending;
2678
- base->dma_slave.device_config = coh901318_dma_set_runtimeconfig;
2693
+ base->dma_slave.device_config = coh901318_dma_slave_config;
26792694 base->dma_slave.device_pause = coh901318_pause;
26802695 base->dma_slave.device_resume = coh901318_resume;
26812696 base->dma_slave.device_terminate_all = coh901318_terminate_all;
....@@ -2698,7 +2713,7 @@
26982713 base->dma_memcpy.device_prep_dma_memcpy = coh901318_prep_memcpy;
26992714 base->dma_memcpy.device_tx_status = coh901318_tx_status;
27002715 base->dma_memcpy.device_issue_pending = coh901318_issue_pending;
2701
- base->dma_memcpy.device_config = coh901318_dma_set_runtimeconfig;
2716
+ base->dma_memcpy.device_config = coh901318_dma_slave_config;
27022717 base->dma_memcpy.device_pause = coh901318_pause;
27032718 base->dma_memcpy.device_resume = coh901318_resume;
27042719 base->dma_memcpy.device_terminate_all = coh901318_terminate_all;