Skip to content

Commit 42ae6f1

Browse files
Linus Walleijvinodkoul
authored andcommitted
dmaengine: ste_dma40: Remove platform data
The Ux500 is device tree-only since ages. Delete the platform data header and push it into or next to the driver instead. Drop the non-DT probe path since this will not happen. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20230417-ux500-dma40-cleanup-v3-4-60bfa6785968@linaro.org Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent fb85a8c commit 42ae6f1

3 files changed

Lines changed: 41 additions & 119 deletions

File tree

drivers/dma/ste_dma40.c

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,39 @@
2323
#include <linux/of_dma.h>
2424
#include <linux/amba/bus.h>
2525
#include <linux/regulator/consumer.h>
26-
#include <linux/platform_data/dma-ste-dma40.h>
2726

2827
#include "dmaengine.h"
28+
#include "ste_dma40.h"
2929
#include "ste_dma40_ll.h"
3030

31+
/**
32+
* struct stedma40_platform_data - Configuration struct for the dma device.
33+
*
34+
* @dev_tx: mapping between destination event line and io address
35+
* @dev_rx: mapping between source event line and io address
36+
* @disabled_channels: A vector, ending with -1, that marks physical channels
37+
* that are for different reasons not available for the driver.
38+
* @soft_lli_chans: A vector, that marks physical channels will use LLI by SW
39+
* which avoids HW bug that exists in some versions of the controller.
40+
* SoftLLI introduces relink overhead that could impact performace for
41+
* certain use cases.
42+
* @num_of_soft_lli_chans: The number of channels that needs to be configured
43+
* to use SoftLLI.
44+
* @use_esram_lcla: flag for mapping the lcla into esram region
45+
* @num_of_memcpy_chans: The number of channels reserved for memcpy.
46+
* @num_of_phy_chans: The number of physical channels implemented in HW.
47+
* 0 means reading the number of channels from DMA HW but this is only valid
48+
* for 'multiple of 4' channels, like 8.
49+
*/
50+
struct stedma40_platform_data {
51+
int disabled_channels[STEDMA40_MAX_PHYS];
52+
int *soft_lli_chans;
53+
int num_of_soft_lli_chans;
54+
bool use_esram_lcla;
55+
int num_of_memcpy_chans;
56+
int num_of_phy_chans;
57+
};
58+
3159
#define D40_NAME "dma40"
3260

3361
#define D40_PHY_CHAN -1
@@ -2269,7 +2297,7 @@ d40_prep_sg(struct dma_chan *dchan, struct scatterlist *sg_src,
22692297
return NULL;
22702298
}
22712299

2272-
bool stedma40_filter(struct dma_chan *chan, void *data)
2300+
static bool stedma40_filter(struct dma_chan *chan, void *data)
22732301
{
22742302
struct stedma40_chan_cfg *info = data;
22752303
struct d40_chan *d40c =
@@ -2288,7 +2316,6 @@ bool stedma40_filter(struct dma_chan *chan, void *data)
22882316

22892317
return err == 0;
22902318
}
2291-
EXPORT_SYMBOL(stedma40_filter);
22922319

22932320
static void __d40_set_prio_rt(struct d40_chan *d40c, int dev_type, bool src)
22942321
{
@@ -3517,16 +3544,9 @@ static int __init d40_probe(struct platform_device *pdev)
35173544
int num_reserved_chans;
35183545
u32 val;
35193546

3520-
if (!plat_data) {
3521-
if (np) {
3522-
if (d40_of_probe(pdev, np)) {
3523-
ret = -ENOMEM;
3524-
goto report_failure;
3525-
}
3526-
} else {
3527-
d40_err(dev, "No pdata or Device Tree provided\n");
3528-
goto report_failure;
3529-
}
3547+
if (d40_of_probe(pdev, np)) {
3548+
ret = -ENOMEM;
3549+
goto report_failure;
35303550
}
35313551

35323552
base = d40_hw_detect_init(pdev);
@@ -3650,11 +3670,11 @@ static int __init d40_probe(struct platform_device *pdev)
36503670

36513671
d40_hw_init(base);
36523672

3653-
if (np) {
3654-
ret = of_dma_controller_register(np, d40_xlate, NULL);
3655-
if (ret)
3656-
dev_err(dev,
3657-
"could not register of_dma_controller\n");
3673+
ret = of_dma_controller_register(np, d40_xlate, NULL);
3674+
if (ret) {
3675+
dev_err(dev,
3676+
"could not register of_dma_controller\n");
3677+
goto destroy_cache;
36583678
}
36593679

36603680
dev_info(base->dev, "initialized\n");
Lines changed: 1 addition & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,8 @@
11
/* SPDX-License-Identifier: GPL-2.0-only */
2-
/*
3-
* Copyright (C) ST-Ericsson SA 2007-2010
4-
* Author: Per Forlin <per.forlin@stericsson.com> for ST-Ericsson
5-
* Author: Jonas Aaberg <jonas.aberg@stericsson.com> for ST-Ericsson
6-
*/
7-
82

93
#ifndef STE_DMA40_H
104
#define STE_DMA40_H
115

12-
#include <linux/dmaengine.h>
13-
#include <linux/scatterlist.h>
14-
#include <linux/workqueue.h>
15-
#include <linux/interrupt.h>
16-
176
/*
187
* Maxium size for a single dma descriptor
198
* Size is limited to 16 bits.
@@ -118,92 +107,4 @@ struct stedma40_chan_cfg {
118107
int phy_channel;
119108
};
120109

121-
/**
122-
* struct stedma40_platform_data - Configuration struct for the dma device.
123-
*
124-
* @dev_tx: mapping between destination event line and io address
125-
* @dev_rx: mapping between source event line and io address
126-
* @disabled_channels: A vector, ending with -1, that marks physical channels
127-
* that are for different reasons not available for the driver.
128-
* @soft_lli_chans: A vector, that marks physical channels will use LLI by SW
129-
* which avoids HW bug that exists in some versions of the controller.
130-
* SoftLLI introduces relink overhead that could impact performace for
131-
* certain use cases.
132-
* @num_of_soft_lli_chans: The number of channels that needs to be configured
133-
* to use SoftLLI.
134-
* @use_esram_lcla: flag for mapping the lcla into esram region
135-
* @num_of_memcpy_chans: The number of channels reserved for memcpy.
136-
* @num_of_phy_chans: The number of physical channels implemented in HW.
137-
* 0 means reading the number of channels from DMA HW but this is only valid
138-
* for 'multiple of 4' channels, like 8.
139-
*/
140-
struct stedma40_platform_data {
141-
int disabled_channels[STEDMA40_MAX_PHYS];
142-
int *soft_lli_chans;
143-
int num_of_soft_lli_chans;
144-
bool use_esram_lcla;
145-
int num_of_memcpy_chans;
146-
int num_of_phy_chans;
147-
};
148-
149-
#ifdef CONFIG_STE_DMA40
150-
151-
/**
152-
* stedma40_filter() - Provides stedma40_chan_cfg to the
153-
* ste_dma40 dma driver via the dmaengine framework.
154-
* does some checking of what's provided.
155-
*
156-
* Never directly called by client. It used by dmaengine.
157-
* @chan: dmaengine handle.
158-
* @data: Must be of type: struct stedma40_chan_cfg and is
159-
* the configuration of the framework.
160-
*
161-
*
162-
*/
163-
164-
bool stedma40_filter(struct dma_chan *chan, void *data);
165-
166-
/**
167-
* stedma40_slave_mem() - Transfers a raw data buffer to or from a slave
168-
* (=device)
169-
*
170-
* @chan: dmaengine handle
171-
* @addr: source or destination physicall address.
172-
* @size: bytes to transfer
173-
* @direction: direction of transfer
174-
* @flags: is actually enum dma_ctrl_flags. See dmaengine.h
175-
*/
176-
177-
static inline struct
178-
dma_async_tx_descriptor *stedma40_slave_mem(struct dma_chan *chan,
179-
dma_addr_t addr,
180-
unsigned int size,
181-
enum dma_transfer_direction direction,
182-
unsigned long flags)
183-
{
184-
struct scatterlist sg;
185-
sg_init_table(&sg, 1);
186-
sg.dma_address = addr;
187-
sg.length = size;
188-
189-
return dmaengine_prep_slave_sg(chan, &sg, 1, direction, flags);
190-
}
191-
192-
#else
193-
static inline bool stedma40_filter(struct dma_chan *chan, void *data)
194-
{
195-
return false;
196-
}
197-
198-
static inline struct
199-
dma_async_tx_descriptor *stedma40_slave_mem(struct dma_chan *chan,
200-
dma_addr_t addr,
201-
unsigned int size,
202-
enum dma_transfer_direction direction,
203-
unsigned long flags)
204-
{
205-
return NULL;
206-
}
207-
#endif
208-
209-
#endif
110+
#endif /* STE_DMA40_H */

drivers/dma/ste_dma40_ll.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
*/
77

88
#include <linux/kernel.h>
9-
#include <linux/platform_data/dma-ste-dma40.h>
9+
#include <linux/dmaengine.h>
1010

11+
#include "ste_dma40.h"
1112
#include "ste_dma40_ll.h"
1213

1314
static u8 d40_width_to_bits(enum dma_slave_buswidth width)

0 commit comments

Comments
 (0)