Skip to content

Commit f9425de

Browse files
Peter UjfalusiVinod Koul
authored andcommitted
dmaengine: edma: Merge map_dmach_to_queue into assign_channel_eventq
edma_assign_channel_eventq() is a wrapper around edma_map_dmach_to_queue() We can merge the content of the later so we will have only one function to be used for mapping channels to given eventq Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
1 parent d9c345d commit f9425de

File tree

1 file changed

+22
-34
lines changed

1 file changed

+22
-34
lines changed

drivers/dma/edma.c

Lines changed: 22 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -391,22 +391,6 @@ static inline void clear_bits(int offset, int len, unsigned long *p)
391391
clear_bit(offset + (len - 1), p);
392392
}
393393

394-
static void edma_map_dmach_to_queue(struct edma_chan *echan,
395-
enum dma_event_q queue_no)
396-
{
397-
struct edma_cc *ecc = echan->ecc;
398-
int channel = EDMA_CHAN_SLOT(echan->ch_num);
399-
int bit = (channel & 0x7) * 4;
400-
401-
/* default to low priority queue */
402-
if (queue_no == EVENTQ_DEFAULT)
403-
queue_no = ecc->default_queue;
404-
405-
queue_no &= 7;
406-
edma_modify_array(ecc, EDMA_DMAQNUM, (channel >> 3), ~(0x7 << bit),
407-
queue_no << bit);
408-
}
409-
410394
static void edma_assign_priority_to_queue(struct edma_cc *ecc, int queue_no,
411395
int priority)
412396
{
@@ -723,6 +707,25 @@ static void edma_clean_channel(struct edma_chan *echan)
723707
edma_write(ecc, EDMA_CCERRCLR, BIT(16) | BIT(1) | BIT(0));
724708
}
725709

710+
/* Move channel to a specific event queue */
711+
static void edma_assign_channel_eventq(struct edma_chan *echan,
712+
enum dma_event_q eventq_no)
713+
{
714+
struct edma_cc *ecc = echan->ecc;
715+
int channel = EDMA_CHAN_SLOT(echan->ch_num);
716+
int bit = (channel & 0x7) * 4;
717+
718+
/* default to low priority queue */
719+
if (eventq_no == EVENTQ_DEFAULT)
720+
eventq_no = ecc->default_queue;
721+
if (eventq_no >= ecc->num_tc)
722+
return;
723+
724+
eventq_no &= 7;
725+
edma_modify_array(ecc, EDMA_DMAQNUM, (channel >> 3), ~(0x7 << bit),
726+
eventq_no << bit);
727+
}
728+
726729
static int edma_alloc_channel(struct edma_chan *echan,
727730
enum dma_event_q eventq_no)
728731
{
@@ -751,7 +754,7 @@ static int edma_alloc_channel(struct edma_chan *echan,
751754

752755
edma_setup_interrupt(echan, true);
753756

754-
edma_map_dmach_to_queue(echan, eventq_no);
757+
edma_assign_channel_eventq(echan, eventq_no);
755758

756759
return 0;
757760
}
@@ -764,21 +767,6 @@ static void edma_free_channel(struct edma_chan *echan)
764767
edma_setup_interrupt(echan, false);
765768
}
766769

767-
/* Move channel to a specific event queue */
768-
static void edma_assign_channel_eventq(struct edma_chan *echan,
769-
enum dma_event_q eventq_no)
770-
{
771-
struct edma_cc *ecc = echan->ecc;
772-
773-
/* default to low priority queue */
774-
if (eventq_no == EVENTQ_DEFAULT)
775-
eventq_no = ecc->default_queue;
776-
if (eventq_no >= ecc->num_tc)
777-
return;
778-
779-
edma_map_dmach_to_queue(echan, eventq_no);
780-
}
781-
782770
static inline struct edma_cc *to_edma_cc(struct dma_device *d)
783771
{
784772
return container_of(d, struct edma_cc, dma_slave);
@@ -2154,8 +2142,8 @@ static int edma_probe(struct platform_device *pdev)
21542142

21552143
for (i = 0; i < ecc->num_channels; i++) {
21562144
/* Assign all channels to the default queue */
2157-
edma_map_dmach_to_queue(&ecc->slave_chans[i],
2158-
info->default_queue);
2145+
edma_assign_channel_eventq(&ecc->slave_chans[i],
2146+
info->default_queue);
21592147
/* Set entry slot to the dummy slot */
21602148
edma_set_chmap(&ecc->slave_chans[i], ecc->dummy_slot);
21612149
}

0 commit comments

Comments
 (0)