DMAENGINE: DMA40 fix for allocation of logical channel 0
Fix for allocation failure of logical channel when event line happens to be number 0. Signed-off-by: Marcin Mielczarczyk <marcin.mielczarczyk@tieto.com> Signed-off-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
parent
a5ebca4769
commit
4aed79b281
1 changed files with 8 additions and 7 deletions
|
@ -1039,11 +1039,11 @@ static int d40_validate_conf(struct d40_chan *d40c,
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool d40_alloc_mask_set(struct d40_phy_res *phy, bool is_src,
|
static bool d40_alloc_mask_set(struct d40_phy_res *phy, bool is_src,
|
||||||
int log_event_line)
|
int log_event_line, bool is_log)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
spin_lock_irqsave(&phy->lock, flags);
|
spin_lock_irqsave(&phy->lock, flags);
|
||||||
if (!log_event_line) {
|
if (!is_log) {
|
||||||
/* Physical interrupts are masked per physical full channel */
|
/* Physical interrupts are masked per physical full channel */
|
||||||
if (phy->allocated_src == D40_ALLOC_FREE &&
|
if (phy->allocated_src == D40_ALLOC_FREE &&
|
||||||
phy->allocated_dst == D40_ALLOC_FREE) {
|
phy->allocated_dst == D40_ALLOC_FREE) {
|
||||||
|
@ -1161,15 +1161,16 @@ static int d40_allocate_channel(struct d40_chan *d40c)
|
||||||
/* Find physical half channel */
|
/* Find physical half channel */
|
||||||
for (i = 0; i < d40c->base->num_phy_chans; i++) {
|
for (i = 0; i < d40c->base->num_phy_chans; i++) {
|
||||||
|
|
||||||
if (d40_alloc_mask_set(&phys[i], is_src, 0))
|
if (d40_alloc_mask_set(&phys[i], is_src,
|
||||||
|
0, is_log))
|
||||||
goto found_phy;
|
goto found_phy;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
for (j = 0; j < d40c->base->num_phy_chans; j += 8) {
|
for (j = 0; j < d40c->base->num_phy_chans; j += 8) {
|
||||||
int phy_num = j + event_group * 2;
|
int phy_num = j + event_group * 2;
|
||||||
for (i = phy_num; i < phy_num + 2; i++) {
|
for (i = phy_num; i < phy_num + 2; i++) {
|
||||||
if (d40_alloc_mask_set(&phys[i],
|
if (d40_alloc_mask_set(&phys[i], is_src,
|
||||||
is_src, 0))
|
0, is_log))
|
||||||
goto found_phy;
|
goto found_phy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1193,13 +1194,13 @@ found_phy:
|
||||||
if (is_src) {
|
if (is_src) {
|
||||||
for (i = phy_num; i < phy_num + 2; i++) {
|
for (i = phy_num; i < phy_num + 2; i++) {
|
||||||
if (d40_alloc_mask_set(&phys[i], is_src,
|
if (d40_alloc_mask_set(&phys[i], is_src,
|
||||||
event_line))
|
event_line, is_log))
|
||||||
goto found_log;
|
goto found_log;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (i = phy_num + 1; i >= phy_num; i--) {
|
for (i = phy_num + 1; i >= phy_num; i--) {
|
||||||
if (d40_alloc_mask_set(&phys[i], is_src,
|
if (d40_alloc_mask_set(&phys[i], is_src,
|
||||||
event_line))
|
event_line, is_log))
|
||||||
goto found_log;
|
goto found_log;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue