drivers: imx: irqsteer: Fix computation of status

status of an output irqsteer line is a 64bit variable
composed of 2 x 32 bit registers.

Because first 64 output irqsteer lines only holds status for
IRQ in[0] we have a different formula for getting the status
compared to the existing implementation done for i.MX8QXP/i.MX8QM.

Mapping for status register is as follows:

line 0 -> [0 | chan0]
line 1 -> [chan2 | chan1]
line 3 -> [chan4 | chan 3]

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
This commit is contained in:
Daniel Baluta 2020-04-07 22:07:34 +03:00 committed by Liam Girdwood
parent b4cce00e46
commit 5f7d4e268f
1 changed files with 19 additions and 0 deletions

View File

@ -225,6 +225,24 @@ const char * const irq_name_irqsteer[] = {
/* Extract the 64 status bits corresponding to output interrupt line /* Extract the 64 status bits corresponding to output interrupt line
* index (64 input interrupts) * index (64 input interrupts)
*/ */
#ifdef CONFIG_IMX8M
static uint64_t get_irqsteer_interrupts(uint32_t index)
{
uint64_t result = 0;
result = irqstr_get_status_word(2 * index);
result <<= 32;
/* line 0 is special only maps interrupts [63..32],
* interval [31..0] is not used
*/
if (index == 0)
return result;
result |= irqstr_get_status_word(2 * index - 1);
return result;
}
#else
static uint64_t get_irqsteer_interrupts(uint32_t index) static uint64_t get_irqsteer_interrupts(uint32_t index)
{ {
uint64_t result = irqstr_get_status_word(2 * index + 1); uint64_t result = irqstr_get_status_word(2 * index + 1);
@ -233,6 +251,7 @@ static uint64_t get_irqsteer_interrupts(uint32_t index)
result |= irqstr_get_status_word(2 * index); result |= irqstr_get_status_word(2 * index);
return result; return result;
} }
#endif
/** /**
* get_first_irq() Get the first IRQ bit set in this group. * get_first_irq() Get the first IRQ bit set in this group.