Skip to content

Commit 8950052

Browse files
andy-shevVinod Koul
authored andcommitted
dmaengine: dw: apply both HS interfaces and remove slave_id usage
Instead of one request line member let's use both source and destination ones. Usually we have no such hardware except Atmel MMC controller found on AVR32 platform (see arch/avr32/mach-at32ap/at32ap700x.c and drivers/mmc/host/atmel-mci.c). This patch removes slave_id usage since it'll be removed from the generic structure in later. This breaks the non-ACPI / non-DT cases for the users of the driver, i.e. SPI and HSUART. However, these cases mean only PCI enumerated devices for now, which is anyway broken (considering more than one DMA controller in the system) and this patch series is intended to fix that eventually. The ACPI and DT cases shall be aware of the channel direction when setting request lines, but this is a minor problem that would be addressed in future. Suggested-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
1 parent 7e1e2f2 commit 8950052

File tree

3 files changed

+10
-35
lines changed

3 files changed

+10
-35
lines changed

drivers/dma/dw/core.c

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -37,24 +37,6 @@
3737
* support descriptor writeback.
3838
*/
3939

40-
static inline bool is_request_line_unset(struct dw_dma_chan *dwc)
41-
{
42-
return dwc->request_line == (typeof(dwc->request_line))~0;
43-
}
44-
45-
static inline void dwc_set_masters(struct dw_dma_chan *dwc)
46-
{
47-
struct dw_dma *dw = to_dw_dma(dwc->chan.device);
48-
struct dw_dma_slave *dws = dwc->chan.private;
49-
unsigned char mmax = dw->nr_masters - 1;
50-
51-
if (!is_request_line_unset(dwc))
52-
return;
53-
54-
dwc->src_master = min_t(unsigned char, mmax, dwc_get_sms(dws));
55-
dwc->dst_master = min_t(unsigned char, mmax, dwc_get_dms(dws));
56-
}
57-
5840
#define DWC_DEFAULT_CTLLO(_chan) ({ \
5941
struct dw_dma_chan *_dwc = to_dw_dma_chan(_chan); \
6042
struct dma_slave_config *_sconfig = &_dwc->dma_sconfig; \
@@ -158,10 +140,8 @@ static void dwc_initialize(struct dw_dma_chan *dwc)
158140
cfghi |= DWC_CFGH_DST_PER(dws->dst_id);
159141
cfghi |= DWC_CFGH_SRC_PER(dws->src_id);
160142
} else {
161-
if (dwc->direction == DMA_MEM_TO_DEV)
162-
cfghi = DWC_CFGH_DST_PER(dwc->request_line);
163-
else if (dwc->direction == DMA_DEV_TO_MEM)
164-
cfghi = DWC_CFGH_SRC_PER(dwc->request_line);
143+
cfghi |= DWC_CFGH_DST_PER(dwc->dst_id);
144+
cfghi |= DWC_CFGH_SRC_PER(dwc->src_id);
165145
}
166146

167147
channel_writel(dwc, CFG_LO, cfglo);
@@ -967,10 +947,6 @@ set_runtime_config(struct dma_chan *chan, struct dma_slave_config *sconfig)
967947
memcpy(&dwc->dma_sconfig, sconfig, sizeof(*sconfig));
968948
dwc->direction = sconfig->direction;
969949

970-
/* Take the request line from slave_id member */
971-
if (is_request_line_unset(dwc))
972-
dwc->request_line = sconfig->slave_id;
973-
974950
convert_burst(&dwc->dma_sconfig.src_maxburst);
975951
convert_burst(&dwc->dma_sconfig.dst_maxburst);
976952

@@ -1123,8 +1099,6 @@ static int dwc_alloc_chan_resources(struct dma_chan *chan)
11231099
* doesn't mean what you think it means), and status writeback.
11241100
*/
11251101

1126-
dwc_set_masters(dwc);
1127-
11281102
spin_lock_irqsave(&dwc->lock, flags);
11291103
i = dwc->descs_allocated;
11301104
while (dwc->descs_allocated < NR_DESCS_PER_CHANNEL) {
@@ -1182,7 +1156,6 @@ static void dwc_free_chan_resources(struct dma_chan *chan)
11821156
list_splice_init(&dwc->free_list, &list);
11831157
dwc->descs_allocated = 0;
11841158
dwc->initialized = false;
1185-
dwc->request_line = ~0;
11861159

11871160
/* Disable interrupts */
11881161
channel_clear_bit(dw, MASK.XFER, dwc->mask);
@@ -1604,7 +1577,6 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
16041577
channel_clear_bit(dw, CH_EN, dwc->mask);
16051578

16061579
dwc->direction = DMA_TRANS_NONE;
1607-
dwc->request_line = ~0;
16081580

16091581
/* Hardware configuration */
16101582
if (autocfg) {

drivers/dma/dw/platform.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ static bool dw_dma_of_filter(struct dma_chan *chan, void *param)
4141
if (chan->device != &fargs->dw->dma)
4242
return false;
4343

44-
dwc->request_line = fargs->req;
44+
dwc->src_id = fargs->req;
45+
dwc->dst_id = fargs->req;
4546
dwc->src_master = fargs->src;
4647
dwc->dst_master = fargs->dst;
4748

@@ -86,7 +87,8 @@ static bool dw_dma_acpi_filter(struct dma_chan *chan, void *param)
8687
chan->chan_id != dma_spec->chan_id)
8788
return false;
8889

89-
dwc->request_line = dma_spec->slave_id;
90+
dwc->src_id = dma_spec->slave_id;
91+
dwc->dst_id = dma_spec->slave_id;
9092
dwc->src_master = dwc_get_sms(NULL);
9193
dwc->dst_master = dwc_get_dms(NULL);
9294

drivers/dma/dw/regs.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,10 @@ struct dw_dma_chan {
221221
bool nollp;
222222

223223
/* custom slave configuration */
224-
unsigned int request_line;
225-
unsigned char src_master;
226-
unsigned char dst_master;
224+
u8 src_id;
225+
u8 dst_id;
226+
u8 src_master;
227+
u8 dst_master;
227228

228229
/* configuration passed via DMA_SLAVE_CONFIG */
229230
struct dma_slave_config dma_sconfig;

0 commit comments

Comments
 (0)